Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2svn2004-01-05 14:29:22 +0000
committercvs2svn2004-01-05 14:29:22 +0000
commit31346304d2556e3b461b5740383dc77893d333ef (patch)
treec7c444bf52d9ecf5dface9186b6e91d89f625cfa
parent2cbf8b64bb820cdaa3f4324993104cad0240a3f3 (diff)
downloadeclipse.platform.text-typingTarget.tar.gz
eclipse.platform.text-typingTarget.tar.xz
eclipse.platform.text-typingTarget.zip
This commit was manufactured by cvs2svn to create branch 'typingTarget'.typingTarget
Sprout from master 2004-01-05 14:29:18 UTC Dani Megert <dmegert> 'Fixed bug 47877: [misc] NPE in TextViewer.addPresentation' Delete: org.eclipse.core.filebuffers/.classpath org.eclipse.core.filebuffers/.cvsignore org.eclipse.core.filebuffers/.project org.eclipse.core.filebuffers/about.html org.eclipse.core.filebuffers/build.properties org.eclipse.core.filebuffers/hglegal2003.htm org.eclipse.core.filebuffers/ngibmcpy2003.gif org.eclipse.core.filebuffers/plugin.properties org.eclipse.core.filebuffers/plugin.xml org.eclipse.core.filebuffers/schema/documentCreation.exsd org.eclipse.core.filebuffers/schema/documentSetup.exsd org.eclipse.core.filebuffers/scripts/exportplugin.xml org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentFactory.java org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentSetupParticipant.java org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBuffer.java org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferListener.java org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferManager.java org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ISynchronizationContext.java org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBuffer.java org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/AbstractFileBuffer.java org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ContainerGenerator.java org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/DefaultDocumentFactory.java org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersPlugin.java org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/JavaFileBuffer.java org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/JavaTextFileBuffer.java org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java org.eclipse.search/.classpath org.eclipse.search/.cvsignore org.eclipse.search/.project org.eclipse.search/about.html org.eclipse.search/build.properties org.eclipse.search/buildnotes_search.html org.eclipse.search/hglegal2003.htm org.eclipse.search/icons/full/clcl16/search_goto.gif org.eclipse.search/icons/full/clcl16/search_history.gif org.eclipse.search/icons/full/clcl16/search_next.gif org.eclipse.search/icons/full/clcl16/search_prev.gif org.eclipse.search/icons/full/clcl16/search_rem.gif org.eclipse.search/icons/full/clcl16/search_remall.gif org.eclipse.search/icons/full/clcl16/search_sortmatch.gif org.eclipse.search/icons/full/clcl16/search_stop.gif org.eclipse.search/icons/full/ctool16/search.gif org.eclipse.search/icons/full/cview16/searchres.gif org.eclipse.search/icons/full/dlcl16/search_goto.gif org.eclipse.search/icons/full/dlcl16/search_history.gif org.eclipse.search/icons/full/dlcl16/search_next.gif org.eclipse.search/icons/full/dlcl16/search_prev.gif org.eclipse.search/icons/full/dlcl16/search_rem.gif org.eclipse.search/icons/full/dlcl16/search_remall.gif org.eclipse.search/icons/full/dlcl16/search_sortmatch.gif org.eclipse.search/icons/full/dlcl16/search_stop.gif org.eclipse.search/icons/full/dtool16/search.gif org.eclipse.search/icons/full/elcl16/search_goto.gif org.eclipse.search/icons/full/elcl16/search_history.gif org.eclipse.search/icons/full/elcl16/search_next.gif org.eclipse.search/icons/full/elcl16/search_prev.gif org.eclipse.search/icons/full/elcl16/search_rem.gif org.eclipse.search/icons/full/elcl16/search_remall.gif org.eclipse.search/icons/full/elcl16/search_sortmatch.gif org.eclipse.search/icons/full/elcl16/search_stop.gif org.eclipse.search/icons/full/etool16/search.gif org.eclipse.search/icons/full/eview16/searchres.gif org.eclipse.search/icons/full/obj16/searchm_obj.gif org.eclipse.search/icons/full/obj16/tsearch_dpdn_obj.gif org.eclipse.search/icons/full/obj16/tsearch_obj.gif org.eclipse.search/ngibmcpy2003.gif org.eclipse.search/old_buildnotes_search_2.1.html org.eclipse.search/old_buildnotes_search_2_0.html org.eclipse.search/plugin.properties org.eclipse.search/plugin.xml org.eclipse.search/schema/searchPages.exsd org.eclipse.search/schema/searchResultSorters.exsd org.eclipse.search/scripts/exportplugin.xml org.eclipse.search/search/org/eclipse/search/internal/core/ISearchScope.java org.eclipse.search/search/org/eclipse/search/internal/core/SearchScope.java org.eclipse.search/search/org/eclipse/search/internal/core/text/AmountOfWorkCalculator.java org.eclipse.search/search/org/eclipse/search/internal/core/text/ITextSearchResultCollector.java org.eclipse.search/search/org/eclipse/search/internal/core/text/MatchLocator.java org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngine.java org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchScope.java org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java org.eclipse.search/search/org/eclipse/search/internal/core/text/TypedResourceVisitor.java org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/GotoMarkerAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java org.eclipse.search/search/org/eclipse/search/internal/ui/OpenFileSearchPageAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllResultsAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllSearchesAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveMatchAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/RemovePotentialMatchesAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveResultAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/ResourceToItemsMapper.java org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchAgainAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDropDownAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchManager.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPageDescriptor.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultContentProvider.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntry.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntryAdapterFactory.java org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/ShowNextResultAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/ShowPreviousResultAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/SortDropDownAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/SorterDescriptor.java org.eclipse.search/search/org/eclipse/search/internal/ui/WorkingSetComparator.java org.eclipse.search/search/org/eclipse/search/internal/ui/text/GotoMarkerAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/text/GroupByKeyComputer.java org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceAction.java org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceDialog.java org.eclipse.search/search/org/eclipse/search/internal/ui/text/ResourcePathSorter.java org.eclipse.search/search/org/eclipse/search/internal/ui/text/ResourcenameSorter.java org.eclipse.search/search/org/eclipse/search/internal/ui/text/SearchAgainConfirmationDialog.java org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchActionGroup.java org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchOperation.java org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchResultCollector.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/ComboFieldEditor.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExceptionHandler.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExtendedDialogWindow.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileLabelProvider.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileTypeEditor.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/ListContentProvider.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/ListDialog.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/MessageLine.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/PixelConverter.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/RowLayouter.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/SWTUtil.java org.eclipse.search/search/org/eclipse/search/internal/ui/util/TypeFilteringDialog.java org.eclipse.search/search/org/eclipse/search/ui/IActionGroupFactory.java org.eclipse.search/search/org/eclipse/search/ui/IContextMenuConstants.java org.eclipse.search/search/org/eclipse/search/ui/IContextMenuContributor.java org.eclipse.search/search/org/eclipse/search/ui/IGroupByKeyComputer.java org.eclipse.search/search/org/eclipse/search/ui/IReplacePage.java org.eclipse.search/search/org/eclipse/search/ui/ISearchPage.java org.eclipse.search/search/org/eclipse/search/ui/ISearchPageContainer.java org.eclipse.search/search/org/eclipse/search/ui/ISearchPageScoreComputer.java org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java org.eclipse.search/search/org/eclipse/search/ui/ISearchResultViewEntry.java org.eclipse.search/search/org/eclipse/search/ui/SearchUI.java org.eclipse.search/search/org/eclipse/search/ui/package.html org.eclipse.text/.classpath org.eclipse.text/.cvsignore org.eclipse.text/.project org.eclipse.text/about.html org.eclipse.text/build.properties org.eclipse.text/plugin.properties org.eclipse.text/plugin.xml org.eclipse.text/projection/org/eclipse/jface/text/CoordinatesTranslator.java org.eclipse.text/projection/org/eclipse/jface/text/Fragment.java org.eclipse.text/projection/org/eclipse/jface/text/FragmentUpdater.java org.eclipse.text/projection/org/eclipse/jface/text/ProjectionDocument.java org.eclipse.text/projection/org/eclipse/jface/text/ProjectionDocumentManager.java org.eclipse.text/projection/org/eclipse/jface/text/ProjectionPosition.java org.eclipse.text/projection/org/eclipse/jface/text/ProjectionPositionUpdater.java org.eclipse.text/projection/org/eclipse/jface/text/ProjectionTextStore.java org.eclipse.text/scripts/exportplugin.xml org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java org.eclipse.text/src/org/eclipse/jface/text/AbstractLineTracker.java org.eclipse.text/src/org/eclipse/jface/text/Assert.java org.eclipse.text/src/org/eclipse/jface/text/BadLocationException.java org.eclipse.text/src/org/eclipse/jface/text/BadPartitioningException.java org.eclipse.text/src/org/eclipse/jface/text/BadPositionCategoryException.java org.eclipse.text/src/org/eclipse/jface/text/ChildDocument.java org.eclipse.text/src/org/eclipse/jface/text/ChildDocumentManager.java org.eclipse.text/src/org/eclipse/jface/text/ConfigurableLineTracker.java org.eclipse.text/src/org/eclipse/jface/text/DefaultLineTracker.java org.eclipse.text/src/org/eclipse/jface/text/DefaultPositionUpdater.java org.eclipse.text/src/org/eclipse/jface/text/Document.java org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java org.eclipse.text/src/org/eclipse/jface/text/DocumentPartitioningChangedEvent.java org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java org.eclipse.text/src/org/eclipse/jface/text/FindReplaceOperationCode.java org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java org.eclipse.text/src/org/eclipse/jface/text/IDocument.java org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension.java org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension2.java org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension3.java org.eclipse.text/src/org/eclipse/jface/text/IDocumentInformationMapping.java org.eclipse.text/src/org/eclipse/jface/text/IDocumentListener.java org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioner.java org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitionerExtension.java org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitionerExtension2.java org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListener.java org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListenerExtension.java org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListenerExtension2.java org.eclipse.text/src/org/eclipse/jface/text/ILineTracker.java org.eclipse.text/src/org/eclipse/jface/text/IPositionUpdater.java org.eclipse.text/src/org/eclipse/jface/text/IRegion.java org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocument.java org.eclipse.text/src/org/eclipse/jface/text/ISlaveDocumentManager.java org.eclipse.text/src/org/eclipse/jface/text/ITextStore.java org.eclipse.text/src/org/eclipse/jface/text/ITypedRegion.java org.eclipse.text/src/org/eclipse/jface/text/Line.java org.eclipse.text/src/org/eclipse/jface/text/ParentChildMapping.java org.eclipse.text/src/org/eclipse/jface/text/Position.java org.eclipse.text/src/org/eclipse/jface/text/Region.java org.eclipse.text/src/org/eclipse/jface/text/SequentialRewriteTextStore.java org.eclipse.text/src/org/eclipse/jface/text/SlaveDocumentEvent.java org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java org.eclipse.text/src/org/eclipse/jface/text/TypedPosition.java org.eclipse.text/src/org/eclipse/jface/text/TypedRegion.java org.eclipse.text/src/org/eclipse/text/edits/CopySourceEdit.java org.eclipse.text/src/org/eclipse/text/edits/CopyTargetEdit.java org.eclipse.text/src/org/eclipse/text/edits/CopyingRangeMarker.java org.eclipse.text/src/org/eclipse/text/edits/DeleteEdit.java org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java org.eclipse.text/src/org/eclipse/text/edits/ISourceModifier.java org.eclipse.text/src/org/eclipse/text/edits/InsertEdit.java org.eclipse.text/src/org/eclipse/text/edits/MalformedTreeException.java org.eclipse.text/src/org/eclipse/text/edits/Messages.properties org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java org.eclipse.text/src/org/eclipse/text/edits/MoveTargetEdit.java org.eclipse.text/src/org/eclipse/text/edits/MultiTextEdit.java org.eclipse.text/src/org/eclipse/text/edits/RangeMarker.java org.eclipse.text/src/org/eclipse/text/edits/ReplaceEdit.java org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java org.eclipse.text/src/org/eclipse/text/edits/TextEditCopier.java org.eclipse.text/src/org/eclipse/text/edits/TextEditMessages.java org.eclipse.text/src/org/eclipse/text/edits/TextEditProcessor.java org.eclipse.text/src/org/eclipse/text/edits/TextEditVisitor.java org.eclipse.text/src/org/eclipse/text/edits/TreeIterationInfo.java org.eclipse.text/src/org/eclipse/text/edits/UndoCollector.java org.eclipse.text/src/org/eclipse/text/edits/UndoEdit.java org.eclipse.ui.editors/.classpath org.eclipse.ui.editors/.cvsignore org.eclipse.ui.editors/.project org.eclipse.ui.editors/_buildnotes_text_2_0.html org.eclipse.ui.editors/_buildnotes_text_2_1.html org.eclipse.ui.editors/about.html org.eclipse.ui.editors/build.properties org.eclipse.ui.editors/buildnotes_text.html org.eclipse.ui.editors/icons/full/ctool16/next_nav.gif org.eclipse.ui.editors/icons/full/ctool16/prev_nav.gif org.eclipse.ui.editors/icons/full/dtool16/next_nav.gif org.eclipse.ui.editors/icons/full/dtool16/prev_nav.gif org.eclipse.ui.editors/icons/full/etool16/next_nav.gif org.eclipse.ui.editors/icons/full/etool16/prev_nav.gif org.eclipse.ui.editors/icons/full/obj16/file_obj.gif org.eclipse.ui.editors/migration_guidelines.html org.eclipse.ui.editors/plugin.properties org.eclipse.ui.editors/plugin.xml org.eclipse.ui.editors/schema/annotationTypes.exsd org.eclipse.ui.editors/schema/documentProviders.exsd org.eclipse.ui.editors/schema/markerAnnotationSpecification.exsd org.eclipse.ui.editors/schema/markerUpdaters.exsd org.eclipse.ui.editors/scripts/exportplugin.xml org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/DefaultEncodingSupport.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsConstants.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsDefinitionIds.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsHelpContextIds.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingSupport.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ILocationProvider.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ISchedulingRuleProvider.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IStorageDocumentProvider.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ITextEditorHelpContextIds.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/StorageDocumentProvider.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditor.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorActionContributor.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.properties org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferenceConstants.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferencePage.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/UISynchronizationContext.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/WorkspaceOperationRunner.java org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/package.html org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ColorEditor.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/FileEditorInputAdapterFactory.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IEditorsStatusConstants.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/JavaFileEditorInput.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPreviousPulldownActionDelegate.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPulldownActionDelegate.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OpenExternalFileAction.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OverlayPreferenceStore.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/PreviousPulldownActionDelegate.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/StatusInfo.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TabFolderLayout.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorPreferencePage2.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddTaskAction.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationPreferenceLookup.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationType.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeHierarchy.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BasicMarkerUpdater.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BookmarkRulerAction.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultAnnotation.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultMarkerAnnotationAccess.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DelegatingAnnotationPreference.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DocumentProviderRegistry.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditor.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditorPreferenceConstants.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/IMarkerUpdater.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ImageUtilities.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerInfoAction.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUpdater.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerAction.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerInfoAction.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectRulerAction.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TaskRulerAction.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.java org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.properties org.eclipse.ui.examples.javaeditor/.classpath org.eclipse.ui.examples.javaeditor/.cvsignore org.eclipse.ui.examples.javaeditor/.project org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaAnnotationHover.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaContentOutlinePage.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentSetupParticipant.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorMessages.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorMessages.properties org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaPartitionScanner.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaTextHover.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/PresentationAction.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaAutoIndentStrategy.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCodeScanner.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCompletionProcessor.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaDoubleClickSelector.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaEditorMessages.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocCompletionProcessor.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocScanner.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/togglepresentation.gif org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaColorProvider.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaWhitespaceDetector.java org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaWordDetector.java org.eclipse.ui.examples.javaeditor/about.html org.eclipse.ui.examples.javaeditor/build.properties org.eclipse.ui.examples.javaeditor/doc-html/hglegal.htm org.eclipse.ui.examples.javaeditor/doc-html/hglegal2002.htm org.eclipse.ui.examples.javaeditor/doc-html/hglegal2003.htm org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy.gif org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy2002.gif org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy2003.gif org.eclipse.ui.examples.javaeditor/doc-html/ui_javaeditor_ex.html org.eclipse.ui.examples.javaeditor/icons/obj16/java.gif org.eclipse.ui.examples.javaeditor/plugin.properties org.eclipse.ui.examples.javaeditor/plugin.xml org.eclipse.ui.workbench.texteditor/.classpath org.eclipse.ui.workbench.texteditor/.cvsignore org.eclipse.ui.workbench.texteditor/.project org.eclipse.ui.workbench.texteditor/about.html org.eclipse.ui.workbench.texteditor/build.properties org.eclipse.ui.workbench.texteditor/icons/full/ctool16/last_edit_pos.gif org.eclipse.ui.workbench.texteditor/icons/full/ctool16/segment_edit.gif org.eclipse.ui.workbench.texteditor/icons/full/dtool16/last_edit_pos.gif org.eclipse.ui.workbench.texteditor/icons/full/dtool16/segment_edit.gif org.eclipse.ui.workbench.texteditor/icons/full/etool16/last_edit_pos.gif org.eclipse.ui.workbench.texteditor/icons/full/etool16/segment_edit.gif org.eclipse.ui.workbench.texteditor/plugin.properties org.eclipse.ui.workbench.texteditor/plugin.xml org.eclipse.ui.workbench.texteditor/schema/quickDiffReferenceProvider.exsd org.eclipse.ui.workbench.texteditor/scripts/exportplugin.xml org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditPosition.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.properties org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/GotoLastEditPositionAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/TextEditorPlugin.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DocumentLineDiffer.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffMessages.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffMessages.properties org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffRestoreAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/ReferenceSelectionAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RestoreAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertBlockAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertLineAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertSelectionAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/DifferencesIterator.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/DocLineComparator.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/IRangeComparator.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/ITokenComparator.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/LinkedRangeDifference.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifference.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifferencer.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/package.html org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/package.html org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractDocumentProvider.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/CaseAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ComboContentAssistSubjectAdapter.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ContentAssistAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConvertLineDelimitersAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DeleteLineAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DeleteLineTarget.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.properties org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorStatusLine.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceTarget.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAbstractTextEditorHelpContextIds.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAnnotationImageProvider.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProvider.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension2.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension3.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IEditorStatusLine.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IElementStateListener.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IElementStateListenerExtension.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IFindReplaceTargetExtension2.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IReadOnlyDependent.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IStatusField.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IStatusFieldExtension.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditor.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension2.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension3.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IUpdate.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IWorkbenchActionDefinitionIds.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindTarget.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkRegionTarget.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MoveLinesAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/PropagatingFontFieldEditor.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RegExContentAssistProcessor.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ResourceAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RetargetTextEditorAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RevertToSavedAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SaveAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ShiftAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SmartEnterAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusLineContributionItem.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextEditorAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextNavigationAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextOperationAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextSelectionNavigationLocation.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ValidateStateException.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/WorkbenchChainedTextFontFieldEditor.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/package.html org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/IQuickDiffProviderImplementation.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/IQuickDiffReferenceProvider.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiff.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiffToggleAction.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/ReferenceProviderDescriptor.java org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/package.html
-rw-r--r--org.eclipse.core.filebuffers/.classpath7
-rw-r--r--org.eclipse.core.filebuffers/.cvsignore1
-rw-r--r--org.eclipse.core.filebuffers/.project31
-rw-r--r--org.eclipse.core.filebuffers/about.html30
-rw-r--r--org.eclipse.core.filebuffers/build.properties17
-rw-r--r--org.eclipse.core.filebuffers/hglegal2003.htm14
-rw-r--r--org.eclipse.core.filebuffers/ngibmcpy2003.gifbin1101 -> 0 bytes
-rw-r--r--org.eclipse.core.filebuffers/plugin.properties15
-rw-r--r--org.eclipse.core.filebuffers/plugin.xml35
-rw-r--r--org.eclipse.core.filebuffers/schema/documentCreation.exsd114
-rw-r--r--org.eclipse.core.filebuffers/schema/documentSetup.exsd114
-rw-r--r--org.eclipse.core.filebuffers/scripts/exportplugin.xml28
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java105
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentFactory.java29
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentSetupParticipant.java28
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBuffer.java130
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferListener.java98
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferManager.java138
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ISynchronizationContext.java26
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBuffer.java48
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java64
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/AbstractFileBuffer.java36
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ContainerGenerator.java118
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/DefaultDocumentFactory.java32
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java231
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersPlugin.java84
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/JavaFileBuffer.java218
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/JavaTextFileBuffer.java338
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java406
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java347
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java301
-rw-r--r--org.eclipse.search/.classpath7
-rw-r--r--org.eclipse.search/.cvsignore1
-rw-r--r--org.eclipse.search/.project39
-rw-r--r--org.eclipse.search/about.html30
-rw-r--r--org.eclipse.search/build.properties18
-rw-r--r--org.eclipse.search/buildnotes_search.html189
-rw-r--r--org.eclipse.search/hglegal2003.htm14
-rw-r--r--org.eclipse.search/icons/full/clcl16/search_goto.gifbin169 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/clcl16/search_history.gifbin181 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/clcl16/search_next.gifbin105 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/clcl16/search_prev.gifbin132 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/clcl16/search_rem.gifbin97 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/clcl16/search_remall.gifbin117 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/clcl16/search_sortmatch.gifbin160 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/clcl16/search_stop.gifbin163 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/ctool16/search.gifbin153 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/cview16/searchres.gifbin179 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/search_goto.gifbin97 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/search_history.gifbin103 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/search_next.gifbin82 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/search_prev.gifbin82 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/search_rem.gifbin66 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/search_remall.gifbin75 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/search_sortmatch.gifbin90 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/search_stop.gifbin91 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/dtool16/search.gifbin94 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/search_goto.gifbin163 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/search_history.gifbin169 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/search_next.gifbin103 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/search_prev.gifbin105 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/search_rem.gifbin97 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/search_remall.gifbin111 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/search_sortmatch.gifbin158 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/search_stop.gifbin120 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/etool16/search.gifbin150 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/eview16/searchres.gifbin177 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/obj16/searchm_obj.gifbin136 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/obj16/tsearch_dpdn_obj.gifbin148 -> 0 bytes
-rw-r--r--org.eclipse.search/icons/full/obj16/tsearch_obj.gifbin245 -> 0 bytes
-rw-r--r--org.eclipse.search/ngibmcpy2003.gifbin1101 -> 0 bytes
-rw-r--r--org.eclipse.search/old_buildnotes_search_2.1.html3403
-rw-r--r--org.eclipse.search/old_buildnotes_search_2_0.html925
-rw-r--r--org.eclipse.search/plugin.properties47
-rw-r--r--org.eclipse.search/plugin.xml212
-rw-r--r--org.eclipse.search/schema/searchPages.exsd234
-rw-r--r--org.eclipse.search/schema/searchResultSorters.exsd165
-rw-r--r--org.eclipse.search/scripts/exportplugin.xml31
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/ISearchScope.java37
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/SearchScope.java101
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/AmountOfWorkCalculator.java61
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/ITextSearchResultCollector.java44
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/MatchLocator.java189
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngine.java75
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchScope.java226
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java196
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/TypedResourceVisitor.java67
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java89
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/GotoMarkerAction.java29
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java33
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/OpenFileSearchPageAction.java61
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogAction.java84
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllResultsAction.java26
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllSearchesAction.java26
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveMatchAction.java60
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/RemovePotentialMatchesAction.java117
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveResultAction.java96
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ResourceToItemsMapper.java163
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java424
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java213
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchAgainAction.java27
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java574
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDropDownAction.java92
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchManager.java507
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java65
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties223
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPageDescriptor.java342
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java376
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java111
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.java224
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultContentProvider.java39
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java72
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java325
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntry.java198
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntryAdapterFactory.java52
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java728
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.java43
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ShowNextResultAction.java30
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ShowPreviousResultAction.java30
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchAction.java37
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java128
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SortDropDownAction.java218
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SorterDescriptor.java106
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/WorkingSetComparator.java37
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/GotoMarkerAction.java145
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/GroupByKeyComputer.java25
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceAction.java193
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceDialog.java674
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/ResourcePathSorter.java65
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/ResourcenameSorter.java65
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/SearchAgainConfirmationDialog.java124
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchActionGroup.java154
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchOperation.java103
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java698
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchResultCollector.java139
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/ComboFieldEditor.java186
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExceptionHandler.java143
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExtendedDialogWindow.java356
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileLabelProvider.java132
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileTypeEditor.java109
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/ListContentProvider.java47
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/ListDialog.java125
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/MessageLine.java144
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/PixelConverter.java58
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/RowLayouter.java172
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/SWTUtil.java122
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/TypeFilteringDialog.java291
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/IActionGroupFactory.java40
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/IContextMenuConstants.java114
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/IContextMenuContributor.java35
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/IGroupByKeyComputer.java29
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/IReplacePage.java31
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/ISearchPage.java47
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/ISearchPageContainer.java121
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/ISearchPageScoreComputer.java50
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java184
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/ISearchResultViewEntry.java66
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/SearchUI.java183
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/package.html25
-rw-r--r--org.eclipse.text/.classpath8
-rw-r--r--org.eclipse.text/.cvsignore1
-rw-r--r--org.eclipse.text/.project29
-rw-r--r--org.eclipse.text/about.html30
-rw-r--r--org.eclipse.text/build.properties6
-rw-r--r--org.eclipse.text/plugin.properties12
-rw-r--r--org.eclipse.text/plugin.xml20
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/CoordinatesTranslator.java349
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/Fragment.java53
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/FragmentUpdater.java120
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/ProjectionDocument.java834
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/ProjectionDocumentManager.java320
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/ProjectionPosition.java63
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/ProjectionPositionUpdater.java71
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/ProjectionTextStore.java153
-rw-r--r--org.eclipse.text/scripts/exportplugin.xml29
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java1285
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/AbstractLineTracker.java557
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/Assert.java178
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/BadLocationException.java36
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/BadPartitioningException.java35
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/BadPositionCategoryException.java38
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/ChildDocument.java453
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/ChildDocumentManager.java464
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/ConfigurableLineTracker.java64
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/DefaultLineTracker.java80
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/DefaultPositionUpdater.java228
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/Document.java73
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java95
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/DocumentPartitioningChangedEvent.java120
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java313
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/FindReplaceOperationCode.java64
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java259
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocument.java571
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension.java83
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension2.java53
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension3.java99
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentInformationMapping.java113
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentListener.java39
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioner.java110
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitionerExtension.java41
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitionerExtension2.java33
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListener.java33
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListenerExtension.java33
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListenerExtension2.java27
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/ILineTracker.java136
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IPositionUpdater.java39
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IRegion.java38
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocument.java31
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/ISlaveDocumentManager.java92
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/ITextStore.java63
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/ITypedRegion.java30
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/Line.java69
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/ParentChildMapping.java159
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/Position.java189
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/Region.java69
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/SequentialRewriteTextStore.java273
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/SlaveDocumentEvent.java45
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java488
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/TypedPosition.java74
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/TypedRegion.java62
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/CopySourceEdit.java309
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/CopyTargetEdit.java161
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/CopyingRangeMarker.java78
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/DeleteEdit.java75
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java209
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/ISourceModifier.java49
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/InsertEdit.java97
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/MalformedTreeException.java61
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/Messages.properties33
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java415
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/MoveTargetEdit.java192
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/MultiTextEdit.java142
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/RangeMarker.java72
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/ReplaceEdit.java99
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java822
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/TextEditCopier.java99
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/TextEditMessages.java41
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/TextEditProcessor.java205
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/TextEditVisitor.java213
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/TreeIterationInfo.java59
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/UndoCollector.java64
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/UndoEdit.java105
-rw-r--r--org.eclipse.ui.editors/.classpath7
-rw-r--r--org.eclipse.ui.editors/.cvsignore1
-rw-r--r--org.eclipse.ui.editors/.project35
-rw-r--r--org.eclipse.ui.editors/_buildnotes_text_2_0.html971
-rw-r--r--org.eclipse.ui.editors/_buildnotes_text_2_1.html267
-rw-r--r--org.eclipse.ui.editors/about.html30
-rw-r--r--org.eclipse.ui.editors/build.properties18
-rw-r--r--org.eclipse.ui.editors/buildnotes_text.html302
-rw-r--r--org.eclipse.ui.editors/icons/full/ctool16/next_nav.gifbin105 -> 0 bytes
-rw-r--r--org.eclipse.ui.editors/icons/full/ctool16/prev_nav.gifbin132 -> 0 bytes
-rw-r--r--org.eclipse.ui.editors/icons/full/dtool16/next_nav.gifbin82 -> 0 bytes
-rw-r--r--org.eclipse.ui.editors/icons/full/dtool16/prev_nav.gifbin82 -> 0 bytes
-rw-r--r--org.eclipse.ui.editors/icons/full/etool16/next_nav.gifbin101 -> 0 bytes
-rw-r--r--org.eclipse.ui.editors/icons/full/etool16/prev_nav.gifbin102 -> 0 bytes
-rw-r--r--org.eclipse.ui.editors/icons/full/obj16/file_obj.gifbin152 -> 0 bytes
-rw-r--r--org.eclipse.ui.editors/migration_guidelines.html57
-rw-r--r--org.eclipse.ui.editors/plugin.properties68
-rw-r--r--org.eclipse.ui.editors/plugin.xml491
-rw-r--r--org.eclipse.ui.editors/schema/annotationTypes.exsd130
-rw-r--r--org.eclipse.ui.editors/schema/documentProviders.exsd147
-rw-r--r--org.eclipse.ui.editors/schema/markerAnnotationSpecification.exsd309
-rw-r--r--org.eclipse.ui.editors/schema/markerUpdaters.exsd142
-rw-r--r--org.eclipse.ui.editors/scripts/exportplugin.xml31
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/DefaultEncodingSupport.java234
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java393
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java804
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsConstants.java70
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsDefinitionIds.java70
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsHelpContextIds.java73
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingSupport.java41
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ILocationProvider.java30
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ISchedulingRuleProvider.java30
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IStorageDocumentProvider.java47
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ITextEditorHelpContextIds.java51
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/StorageDocumentProvider.java420
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditor.java366
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorActionContributor.java127
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.java36
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.properties119
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferenceConstants.java259
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferencePage.java120
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java1002
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java45
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/UISynchronizationContext.java42
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/WorkspaceOperationRunner.java74
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/package.html13
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java306
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ColorEditor.java159
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java174
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/FileEditorInputAdapterFactory.java62
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IEditorsStatusConstants.java28
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/JavaFileEditorInput.java112
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPreviousPulldownActionDelegate.java189
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPulldownActionDelegate.java29
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OpenExternalFileAction.java155
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OverlayPreferenceStore.java514
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/PreviousPulldownActionDelegate.java30
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.java76
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/StatusInfo.java183
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TabFolderLayout.java66
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java52
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties56
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorPreferencePage2.java815
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java619
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java324
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddTaskAction.java60
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationPreferenceLookup.java103
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationType.java62
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeHierarchy.java109
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java207
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BasicMarkerUpdater.java98
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BookmarkRulerAction.java31
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultAnnotation.java324
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultMarkerAnnotationAccess.java311
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DelegatingAnnotationPreference.java248
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DocumentProviderRegistry.java301
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditor.java1022
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditorPreferenceConstants.java205
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/IMarkerUpdater.java59
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ImageUtilities.java86
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java282
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java322
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java429
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerInfoAction.java31
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUpdater.java65
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java399
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java152
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerAction.java288
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerInfoAction.java32
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectRulerAction.java30
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TaskRulerAction.java76
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.java36
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.properties71
-rw-r--r--org.eclipse.ui.examples.javaeditor/.classpath7
-rw-r--r--org.eclipse.ui.examples.javaeditor/.cvsignore1
-rw-r--r--org.eclipse.ui.examples.javaeditor/.project35
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java90
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaAnnotationHover.java38
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaContentOutlinePage.java237
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentSetupParticipant.java41
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java146
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java99
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorMessages.java36
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorMessages.properties39
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaPartitionScanner.java105
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.java166
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaTextHover.java45
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/PresentationAction.java52
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaAutoIndentStrategy.java263
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCodeScanner.java69
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCompletionProcessor.java111
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaDoubleClickSelector.java240
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaEditorMessages.java32
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocCompletionProcessor.java68
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocScanner.java80
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/togglepresentation.gifbin125 -> 0 bytes
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaColorProvider.java58
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaWhitespaceDetector.java27
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaWordDetector.java34
-rw-r--r--org.eclipse.ui.examples.javaeditor/about.html30
-rw-r--r--org.eclipse.ui.examples.javaeditor/build.properties21
-rw-r--r--org.eclipse.ui.examples.javaeditor/doc-html/hglegal.htm14
-rw-r--r--org.eclipse.ui.examples.javaeditor/doc-html/hglegal2002.htm13
-rw-r--r--org.eclipse.ui.examples.javaeditor/doc-html/hglegal2003.htm14
-rw-r--r--org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy.gifbin814 -> 0 bytes
-rw-r--r--org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy2002.gifbin1045 -> 0 bytes
-rw-r--r--org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy2003.gifbin1101 -> 0 bytes
-rw-r--r--org.eclipse.ui.examples.javaeditor/doc-html/ui_javaeditor_ex.html237
-rw-r--r--org.eclipse.ui.examples.javaeditor/icons/obj16/java.gifbin140 -> 0 bytes
-rw-r--r--org.eclipse.ui.examples.javaeditor/plugin.properties22
-rw-r--r--org.eclipse.ui.examples.javaeditor/plugin.xml47
-rw-r--r--org.eclipse.ui.workbench.texteditor/.classpath7
-rw-r--r--org.eclipse.ui.workbench.texteditor/.cvsignore1
-rw-r--r--org.eclipse.ui.workbench.texteditor/.project31
-rw-r--r--org.eclipse.ui.workbench.texteditor/about.html30
-rw-r--r--org.eclipse.ui.workbench.texteditor/build.properties18
-rw-r--r--org.eclipse.ui.workbench.texteditor/icons/full/ctool16/last_edit_pos.gifbin150 -> 0 bytes
-rw-r--r--org.eclipse.ui.workbench.texteditor/icons/full/ctool16/segment_edit.gifbin158 -> 0 bytes
-rw-r--r--org.eclipse.ui.workbench.texteditor/icons/full/dtool16/last_edit_pos.gifbin88 -> 0 bytes
-rw-r--r--org.eclipse.ui.workbench.texteditor/icons/full/dtool16/segment_edit.gifbin89 -> 0 bytes
-rw-r--r--org.eclipse.ui.workbench.texteditor/icons/full/etool16/last_edit_pos.gifbin146 -> 0 bytes
-rw-r--r--org.eclipse.ui.workbench.texteditor/icons/full/etool16/segment_edit.gifbin121 -> 0 bytes
-rw-r--r--org.eclipse.ui.workbench.texteditor/plugin.properties157
-rw-r--r--org.eclipse.ui.workbench.texteditor/plugin.xml1054
-rw-r--r--org.eclipse.ui.workbench.texteditor/schema/quickDiffReferenceProvider.exsd149
-rw-r--r--org.eclipse.ui.workbench.texteditor/scripts/exportplugin.xml32
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditPosition.java87
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.java35
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.properties16
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/GotoLastEditPositionAction.java176
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/TextEditorPlugin.java124
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DocumentLineDiffer.java1349
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffMessages.java52
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffMessages.properties23
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffRestoreAction.java159
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/ReferenceSelectionAction.java171
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RestoreAction.java100
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertBlockAction.java91
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertLineAction.java89
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertSelectionAction.java101
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/DifferencesIterator.java77
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/DocLineComparator.java221
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/IRangeComparator.java60
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/ITokenComparator.java56
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/LinkedRangeDifference.java57
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifference.java269
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifferencer.java542
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/package.html12
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/package.html13
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractDocumentProvider.java944
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java145
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java4631
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java838
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java293
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/CaseAction.java129
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ComboContentAssistSubjectAdapter.java257
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ContentAssistAction.java122
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConvertLineDelimitersAction.java271
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java169
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DeleteLineAction.java173
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DeleteLineTarget.java326
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.java36
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.properties415
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorStatusLine.java133
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java396
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceAction.java250
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java1769
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceTarget.java220
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java188
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAbstractTextEditorHelpContextIds.java298
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAnnotationImageProvider.java55
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProvider.java203
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension.java115
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension2.java38
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension3.java29
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IEditorStatusLine.java35
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IElementStateListener.java66
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IElementStateListenerExtension.java47
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IFindReplaceTargetExtension2.java29
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IReadOnlyDependent.java37
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IStatusField.java39
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IStatusFieldExtension.java65
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditor.java177
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java425
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java443
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension.java64
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension2.java46
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension3.java75
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IUpdate.java24
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IWorkbenchActionDefinitionIds.java131
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindAction.java119
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindTarget.java772
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java227
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkAction.java73
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkRegionTarget.java124
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MoveLinesAction.java500
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/PropagatingFontFieldEditor.java29
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RegExContentAssistProcessor.java355
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ResourceAction.java149
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RetargetTextEditorAction.java241
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RevertToSavedAction.java56
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SaveAction.java56
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ShiftAction.java159
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SmartEnterAction.java177
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java768
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusLineContributionItem.java260
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java197
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextEditorAction.java144
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextNavigationAction.java302
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextOperationAction.java156
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextSelectionNavigationLocation.java343
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ValidateStateException.java32
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/WorkbenchChainedTextFontFieldEditor.java69
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/package.html30
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/IQuickDiffProviderImplementation.java52
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/IQuickDiffReferenceProvider.java51
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiff.java162
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiffToggleAction.java212
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/ReferenceProviderDescriptor.java128
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/package.html13
482 files changed, 0 insertions, 78664 deletions
diff --git a/org.eclipse.core.filebuffers/.classpath b/org.eclipse.core.filebuffers/.classpath
deleted file mode 100644
index 065ac06e197..00000000000
--- a/org.eclipse.core.filebuffers/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.core.filebuffers/.cvsignore b/org.eclipse.core.filebuffers/.cvsignore
deleted file mode 100644
index c5e82d74585..00000000000
--- a/org.eclipse.core.filebuffers/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/org.eclipse.core.filebuffers/.project b/org.eclipse.core.filebuffers/.project
deleted file mode 100644
index ac71d98c0f7..00000000000
--- a/org.eclipse.core.filebuffers/.project
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.filebuffers</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.text</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.core.filebuffers/about.html b/org.eclipse.core.filebuffers/about.html
deleted file mode 100644
index 9db411aab99..00000000000
--- a/org.eclipse.core.filebuffers/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 (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). 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, &quot;Program&quot; 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 (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) 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/org.eclipse.core.filebuffers/build.properties b/org.eclipse.core.filebuffers/build.properties
deleted file mode 100644
index 95c07dee416..00000000000
--- a/org.eclipse.core.filebuffers/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,\
- *.jar,\
- about.html
-src.includes = about.html,\
- schema/
-source.filebuffers.jar = src/
diff --git a/org.eclipse.core.filebuffers/hglegal2003.htm b/org.eclipse.core.filebuffers/hglegal2003.htm
deleted file mode 100644
index 47c8540c84c..00000000000
--- a/org.eclipse.core.filebuffers/hglegal2003.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">
- <LINK REL="stylesheet" HREF="book.css" CHARSET="ISO-8859-1" TYPE="text/css">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.
-</body>
-</html>
diff --git a/org.eclipse.core.filebuffers/ngibmcpy2003.gif b/org.eclipse.core.filebuffers/ngibmcpy2003.gif
deleted file mode 100644
index c786e43e1f9..00000000000
--- a/org.eclipse.core.filebuffers/ngibmcpy2003.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.core.filebuffers/plugin.properties b/org.eclipse.core.filebuffers/plugin.properties
deleted file mode 100644
index 23d210cea8b..00000000000
--- a/org.eclipse.core.filebuffers/plugin.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
-###############################################################################
-pluginName= File Buffers
-providerName= Eclipse.org
-documentCreationPoint= Document Creation
-documentSetupPoint= Document Setup
-defaultDocumentFactory= Default Document Factory
diff --git a/org.eclipse.core.filebuffers/plugin.xml b/org.eclipse.core.filebuffers/plugin.xml
deleted file mode 100644
index 872501d93ea..00000000000
--- a/org.eclipse.core.filebuffers/plugin.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.core.filebuffers"
- name="%pluginName"
- version="3.0"
- provider-name="%providerName"
- class="org.eclipse.core.internal.filebuffers.FileBuffersPlugin">
-
- <runtime>
- <library name="filebuffers.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.core.filebuffers,org.eclipse.core.internal.filebuffers"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.runtime.compatibility" optional="true"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.text"/>
- </requires>
-
-
- <extension-point id="documentCreation" name="%documentCreationPoint" schema="schema/documentCreation.exsd"/>
- <extension-point id="documentSetup" name="%documentSetupPoint" schema="schema/documentSetup.exsd"/>
-
- <extension
- id="DefaultDocumentFactory"
- name="%defaultDocumentFactory"
- point="org.eclipse.core.filebuffers.documentCreation">
- <factory
- extensions="*"
- class="org.eclipse.core.internal.filebuffers.DefaultDocumentFactory">
- </factory>
- </extension>
-</plugin>
diff --git a/org.eclipse.core.filebuffers/schema/documentCreation.exsd b/org.eclipse.core.filebuffers/schema/documentCreation.exsd
deleted file mode 100644
index 1d3ddc7e794..00000000000
--- a/org.eclipse.core.filebuffers/schema/documentCreation.exsd
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.core.filebuffers">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.core.filebuffers" id="documentCreation" name="Document Creation"/>
- </appInfo>
- <documentation>
- This extension point is interesting for your if you want the file buffer manager to instantiate a specific document implementation for certain file extensions.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="factory"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <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>
- </complexType>
- </element>
-
- <element name="factory">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=&quot;0&quot; height=&quot;14&quot; width=&quot;324&quot;&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.core.filebuffers/schema/documentSetup.exsd b/org.eclipse.core.filebuffers/schema/documentSetup.exsd
deleted file mode 100644
index 1f3908d3594..00000000000
--- a/org.eclipse.core.filebuffers/schema/documentSetup.exsd
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.core.filebuffers">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.core.filebuffers" id="documentSetup" name="Document Setup"/>
- </appInfo>
- <documentation>
- This extension point is interesting if you want to install specific partitioners etc. on documents created by the file buffer manager for certain file extensions.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="participant"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <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>
- </complexType>
- </element>
-
- <element name="participant">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=&quot;0&quot; height=&quot;14&quot; width=&quot;324&quot;&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.core.filebuffers/scripts/exportplugin.xml b/org.eclipse.core.filebuffers/scripts/exportplugin.xml
deleted file mode 100644
index 57d44f387a0..00000000000
--- a/org.eclipse.core.filebuffers/scripts/exportplugin.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<project name="Export Text" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.core.filebuffers" />
- <property name="version" value="_3.0.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}/filebuffers.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <zip zipfile="${dest}/filebufferssrc.zip">
- <fileset dir="src" />
- </zip>
- </target>
-</project>
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
deleted file mode 100644
index 14ea016ba75..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.filebuffers;
-
-import java.io.File;
-
-import org.eclipse.core.internal.filebuffers.FileBuffersPlugin;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Facade for the file buffers plug-in. Provides access to the
- * text file buffer manager.
- *
- * @since 3.0
- */
-public final class FileBuffers {
-
- /**
- * Cannot be instantiated.
- */
- private FileBuffers() {
- }
-
- /**
- * Returns the text file buffer manager.
- *
- * @return the text file buffer manager
- */
- public static ITextFileBufferManager getTextFileBufferManager() {
- return FileBuffersPlugin.getDefault().getFileBufferManager();
- }
-
- /**
- * Returns the workspace file at the given location or <code>null</code> if
- * the location is not a valid location in the workspace.
- *
- * @param location the location
- * @return the workspace file at the location or <code>null</code>
- */
- public static IFile getWorkspaceFileAtLocation(IPath location) {
- IPath normalized= normalizeLocation(location);
- IWorkspaceRoot workspaceRoot= ResourcesPlugin.getWorkspace().getRoot();
- IFile file= workspaceRoot.getFile(normalized);
- if (file != null && file.exists())
- return file;
- return null;
- }
-
- /**
- * Returns a copy of the given location in a normalized form.
- *
- * @param location the location to be normalized
- * @return normalized copy of location
- */
- public static IPath normalizeLocation(IPath location) {
- IWorkspaceRoot workspaceRoot= ResourcesPlugin.getWorkspace().getRoot();
- IProject[] projects= workspaceRoot.getProjects();
-
- for (int i= 0, length= projects.length; i < length; i++) {
- IPath path= projects[i].getLocation();
- if (path.isPrefixOf(location)) {
- IPath filePath= location.removeFirstSegments(path.segmentCount());
- filePath= projects[i].getFullPath().append(filePath);
- return filePath.makeAbsolute();
- }
-
- }
- return location.makeAbsolute();
- }
-
- /**
- * Returns the file in the local file system for the given location.
- * <p>
- * The location is either a full path of a workspace resource or an
- * absolute path in the local file system.
- * </p>
- *
- * @param location
- * @return
- */
- public static File getSystemFileAtLocation(IPath location) {
- if (location == null)
- return null;
-
- IFile file= getWorkspaceFileAtLocation(location);
- if (file != null) {
- IPath path= file.getLocation();
- return path.toFile();
- }
-
- return location.toFile();
- }
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentFactory.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentFactory.java
deleted file mode 100644
index 989ecf993c3..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.filebuffers;
-
-import org.eclipse.jface.text.IDocument;
-
-/**
- * Factory for text file buffer documents. Used by the text file buffer
- * manager to create the document for a new text file buffer.
- *
- * @since 3.0
- */
-public interface IDocumentFactory {
-
- /**
- * Creates and returns a new, empty document.
- *
- * @return a new, empty document
- */
- IDocument createDocument();
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentSetupParticipant.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentSetupParticipant.java
deleted file mode 100644
index 93a5d5ad871..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentSetupParticipant.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.filebuffers;
-
-import org.eclipse.jface.text.IDocument;
-
-/**
- * Participates in the setup of a text file buffer document.
- *
- * @since 3.0
- */
-public interface IDocumentSetupParticipant {
-
- /**
- * Sets up the document to be ready for use by a text file buffer.
- *
- * @param document the document to be set up
- */
- void setup(IDocument document);
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBuffer.java
deleted file mode 100644
index 8ae2afeea1a..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBuffer.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.filebuffers;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * A file buffer represents a file that can be edited by more than one client. Editing is
- * session oriented. This means that editing is a sequence of modification steps. The
- * start of the sequence and the end of the sequence are explicitly indicated. There are
- * no time constraints connected with the sequence of modification steps. A file buffer
- * reifies editing sessions and allows them to interleave.<p>
- * It is not specified whether simultaneous editing sessions can be owned by different
- * threads.
- *
- * @since 3.0
- */
-public interface IFileBuffer {
-
- /**
- * Returns the location of this file buffer.
- * <p>
- * The location is either a full path of a workspace resource or an
- * absolute path in the local file system.
- * </p>
- *
- * @return the location of this file buffer
- */
- IPath getLocation();
-
- /**
- * Returns whether this file buffer is synchronized with the file system. This is when
- * the file buffer's underlying file is in sync with the file system and the file buffer
- * has been initialized after the underlying files has been modified the last time.
- *
- * @return <code>true</code> if the file buffer is synchronized with the file system
- */
- boolean isSynchronized();
-
- /**
- * Reverts the contents of this file buffer to the content of its underlying file. After
- * that call successfully returned, <code>isDirty</code> returns <code>false</code> and
- * <code>isSynchronized</code> returns <code>true</code>.
- *
- * @param monitor the progress monitor
- * @throws CoreException if reading or accessing the underlying file fails
- */
- void revert(IProgressMonitor monitor) throws CoreException;
-
- /**
- * Commits this file buffer by changing the contents of th underlying file to
- * the contents of this file buffer. After that call, <code>isDirty</code>
- * returns <code>false</code> and <code>isSynchronized</code> returns
- * <code>true</code>.
- *
- * @param monitor the progress monitor
- * @param overwrite indicates whether the underlying file should be overwritten if it is not synchronized with the file system
- * @throws CoreException if writing or accessing the underlying file fails
- */
- void commit(IProgressMonitor monitor, boolean overwrite) throws CoreException;
-
- /**
- * Returns whether changes have been applied to this file buffer since initialization, or the most
- * recent <code>revert</code> or <code>commit</code> call.
- *
- * @return <code>true</code> if changes have been applied to this buffer
- */
- boolean isDirty();
-
- /**
- * Returns whether this file buffer is shared by more than one client.
- *
- * @return <code>true</code> if this file buffer is shared by more than one client
- */
- boolean isShared();
-
- /**
- * Validates the state of this file buffer and tries to bring the buffer's
- * underlying file into a state in which it can be modified. If state
- * validation is not supported this operation does nothing.
- *
- * @param monitor the progress monitor
- * @param computationContext the context in which the validation is
- * performed, e.g., a SWT shell
- * @exception CoreException if the underlying file can not be accessed to
- * it's state cannot be changed
- */
- void validateState(IProgressMonitor monitor, Object computationContext) throws CoreException;
-
- /**
- * Returns whether the state of this file buffer has been validated. If
- * state validation is not supported this method always returns <code>true</code>.
- *
- * @return <code>true</code> if the state has been validated, <code>false</code>
- * otherwise
- */
- boolean isStateValidated();
-
- /**
- * Resets state validation. If state validation is supported, <code>isStateValidated</code>
- * afterwars returns <code>false</code> unti the state is revalidated.
- */
- void resetStateValidation();
-
- /**
- * Returns the status of this file buffer. This is the result of the last operation peformed on this file buffer or
- * internally initiated by this file buffer.
- *
- * @return the status of this file buffer
- */
- IStatus getStatus();
-
- /**
- * Returns the modification stamp of the file underlying this file buffer.
- *
- * @return the modification stamp of the file underlying this file buffer
- */
- long getModifcationStamp();
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferListener.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferListener.java
deleted file mode 100644
index 06f8e244f33..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferListener.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.filebuffers;
-
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Interface for listeners of file buffer changes.
- *
- * @since 3.0
- */
-public interface IFileBufferListener {
-
- /**
- * Informs the listener about the creation of the given buffer.
- *
- * @param buffer the created file buffer
- */
- void bufferCreated(IFileBuffer buffer);
-
- /**
- * Informs the listener about the disposal of the given buffer.
- *
- * @param buffer
- */
- void bufferDisposed(IFileBuffer buffer);
-
- /**
- * Informs the listener about an upcoming replace of the contents of the given buffer.
- *
- * @param buffer the effected file buffer
- */
- void bufferContentAboutToBeReplaced(IFileBuffer buffer);
-
- /**
- * Informs the listener that the buffer of the given buffer has been replaced.
- *
- * @param buffer the effected file buffer
- */
- void bufferContentReplaced(IFileBuffer buffer);
-
- /**
- * Informs the listener about the start of a state changing operation on
- * the given buffer.
- *
- * @param buffer the effected file buffer
- */
- void stateChanging(IFileBuffer buffer);
-
- /**
- * Informs the listener that the dirty state of the given buffer changed
- * to the specified value
- *
- * @param buffer the effected file buffer
- * @param isDirty <code>true</code> if the buffer is dirty, <code>false</code> otherwise
- */
- void dirtyStateChanged(IFileBuffer buffer, boolean isDirty);
-
- /**
- * Informs the listener that the state validation changed to the specified value.
- *
- * @param buffer the effected file buffer
- * @param isStateValidated <code>true</code> if the buffer state is validated, <code>false</code> otherwise
- */
- void stateValidationChanged(IFileBuffer buffer, boolean isStateValidated);
-
- /**
- * Informs the listener that the file underlying the given file buffer has been moved to the
- * given location.
- *
- * @param buffer the effected file buffer
- * @param target the new location (not just the container)
- */
- void underlyingFileMoved(IFileBuffer buffer, IPath path);
-
- /**
- * Informs the listener that the file underlying the given file buffer has been deleted.
- *
- * @param buffer the effected file buffer
- */
- void underlyingFileDeleted(IFileBuffer buffer);
-
- /**
- * Informs the listener that a state changing operation on the given
- * file buffer failed.
- *
- * @param buffer the effected file buffer
- */
- void stateChangeFailed(IFileBuffer buffer);
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferManager.java
deleted file mode 100644
index f0e7cae7f1c..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferManager.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-
-package org.eclipse.core.filebuffers;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * A file buffer manager manages file buffers for files while the files are
- * connected to the file buffer manager. In order to connect a file to a file
- * buffer manager call <code>connect</code>. After that call has
- * successfully completed the file buffer can be obtained by <code>getFileBuffer</code>.
- * The file buffer is created on the first connect and destroyed on the last
- * disconnect. I.e. the file buffer manager keeps track of how often a file is
- * connected and returns the same file buffer to each client as long as the
- * file is connected.
- *
- * @since 3.0
- */
-public interface IFileBufferManager {
-
- /**
- * Connects the file at the given location to this manager. After that call
- * successfully completed it is guaranteed that each call to <code>getFileBuffer</code>
- * returns the same file buffer until <code>disconnect</code> is called.
- * <p>
- * The provided location is either a full path of a workspace resource or
- * an absolute path in the local file system. The file buffer manager does
- * not resolve the location of workspace resources in the case of linked
- * resources.
- * </p>
- *
- * @param location the location of the file to be connected
- * @param monitor the progress monitor
- * @throws CoreException if the file could not successfully be connected
- */
- void connect(IPath location, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Disconnects the file at the given location from this manager. After that
- * call successfully completed there is no guarantee that <code>getFileBuffer</code>
- * will return a valid file buffer.
- * <p>
- * The provided location is either a full path of a workspace resource or
- * an absolute path in the local file system. The file buffer manager does
- * not resolve the location of workspace resources in the case of linked
- * resources.
- * </p>
- *
- * @param location the location of the file to be disconnected
- * @param monitor the progress monitor
- * @throws CoreException if the file could not successfully be disconnected
- */
- void disconnect(IPath location, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Returns the file buffer managed for the given location or <code>null</code>
- * if there is no such file buffer.
- * <p>
- * The provided location is either a full path of a workspace resource or
- * an absolute path in the local file system. The file buffer manager does
- * not resolve the location of workspace resources in the case of linked
- * resources.
- * </p>
- *
- * @param location the location
- * @return the file buffer managed for that location or <code>null</code>
- */
- IFileBuffer getFileBuffer(IPath location);
-
- /**
- * Sets the synchronization context for this file buffer manager, i.e., for
- * all file buffers this manager manages.
- *
- * @param context the synchronization context managed by this file buffer
- * manager
- */
- void setSynchronizationContext(ISynchronizationContext context);
-
- /**
- * Requests that the synchronization context is used to synchronize the
- * given location with its file buffer. This call as no effect if there is
- * no file buffer managed for the given location.
- * <p>
- * The provided location is either a full path of a workspace resource or
- * an absolute path in the local file system. The file buffer manager does
- * not resolve the location of workspace resources in the case of linked
- * resources.
- * </p>
- *
- * @param location the location
- */
- void requestSynchronizationContext(IPath location);
-
- /**
- * No longer requests the synchronization context for the filebuffer for
- * the given location. This method has no effect if there is no file buffer
- * managed for this location.
- * <p>
- * The provided location is either a full path of a workspace resource or
- * an absolute path in the local file system. The file buffer manager does
- * not resolve the location of workspace resources in the case of linked
- * resources.
- * </p>
- *
- * @param location the location
- */
- void releaseSynchronizationContext(IPath location);
-
- /**
- * Adds the given listener to the list of file buffer listeners. After that
- * call the listener is informated about changes related to this file
- * buffer. If the listener is already registered with the file buffer, this
- * call has no effect.
- *
- * @param listener the listener to be added
- */
- void addFileBufferListener(IFileBufferListener listener);
-
- /**
- * Removes the given listener from the list of file buffer listeners. If
- * the listener is not registered with this file buffer, this call has no
- * effect.
- *
- * @param listener the listener to be removed
- */
- void removeFileBufferListener(IFileBufferListener listener);
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ISynchronizationContext.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ISynchronizationContext.java
deleted file mode 100644
index 046e9a93da1..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ISynchronizationContext.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.filebuffers;
-
-/**
- * Executes runnables that describe how to synchronize a file buffer with its underlying file.
- *
- * @since 3.0
- */
-public interface ISynchronizationContext {
-
- /**
- * Executes the given runnable.
- *
- * @param runnable the runnable to be executed
- */
- void run(Runnable runnable);
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBuffer.java
deleted file mode 100644
index 60da3a8bb73..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBuffer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.filebuffers;
-
-
-import org.eclipse.jface.text.IDocument;
-
-/**
- * A text file buffer is a file buffer for text files. The contents of a text file buffe is
- * given in the form of a document. Also, the text file buffer provides methods to
- * manage the character encoding used to read and write the buffer's underlying
- * text file.
- *
- * @since 3.0
- */
-public interface ITextFileBuffer extends IFileBuffer {
-
- /**
- * Returns the document of this text file buffer.
- *
- * @return the document of this text file buffer
- */
- IDocument getDocument();
-
- /**
- * Returns the character encoding to be used for reading and writing the
- * buffer's underlying file.
- *
- * @return the character encoding
- */
- String getEncoding();
-
- /**
- * Sets the character encoding to be used for reading and writing the buffer's
- * underlyning file.
- *
- * @param encoding the encoding
- */
- void setEncoding(String encoding);
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java
deleted file mode 100644
index 6897cdf56fa..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-
-package org.eclipse.core.filebuffers;
-
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.jface.text.IDocument;
-
-
-/**
- * A text file buffer manager manages text file buffers for files whose contents
- * could be considered text.
- *
- * @since 3.0
- */
-public interface ITextFileBufferManager extends IFileBufferManager {
-
- /**
- * Returns the text file buffer managed for the file at the given location
- * or <code>null</code> if either there is no such text file buffer.
- * <p>
- * The provided location is either a full path of a workspace resource or
- * an absolute path in the local file system. The file buffer manager does
- * not resolve the location of workspace resources in the case of linked
- * resources.
- * </p>
- *
- * @param location the location
- * @return the text file buffer managed for that location or <code>null</code>
- */
- ITextFileBuffer getTextFileBuffer(IPath location);
-
- /**
- * Returns the default encoding that is used to read the contents of text files
- * if no other encoding is specified.
- *
- * @return the default text file encoding
- */
- String getDefaultEncoding();
-
- /**
- * Creates a new empty document . The document is set up in the same way as
- * it would be used in a text file buffer for a file at the given location.
- * <p>
- * The provided location is either a full path of a workspace resource or
- * an absolute path in the local file system. The file buffer manager does
- * not resolve the location of workspace resources in the case of linked
- * resources.
- * </p>
- *
- * @param location the location used to set up the newly created document
- * @return a new empty document
- */
- IDocument createEmptyDocument(IPath location);
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/AbstractFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/AbstractFileBuffer.java
deleted file mode 100644
index 6be8c2a9e34..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/AbstractFileBuffer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.internal.filebuffers;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.core.filebuffers.IFileBuffer;
-
-/**
- * @since 3.0
- */
-public abstract class AbstractFileBuffer implements IFileBuffer {
-
-
- public abstract void create(IPath location, IProgressMonitor monitor) throws CoreException;
-
- public abstract void connect();
-
- public abstract void disconnect() throws CoreException;
-
- public abstract boolean isDisposed();
-
- public abstract void requestSynchronizationContext();
-
- public abstract void releaseSynchronizationContext();
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ContainerGenerator.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ContainerGenerator.java
deleted file mode 100644
index c1b0c7066f2..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ContainerGenerator.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.internal.filebuffers;
-
-import org.eclipse.core.resources.IContainer;
-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.IWorkspaceRoot;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-public class ContainerGenerator {
-
- private IPath fContainerFullPath;
- private IContainer fContainer;
- private IWorkspace fWorkspace;
-
- public ContainerGenerator(IWorkspace workspace, IPath containerPath) {
- fWorkspace= workspace;
- fContainerFullPath = containerPath;
- }
-
- private IFolder createFolder(IFolder folderHandle, IProgressMonitor monitor) throws CoreException {
- folderHandle.create(false, true, monitor);
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- return folderHandle;
- }
-
- private IFolder createFolderHandle(IContainer container, String folderName) {
- return container.getFolder(new Path(folderName));
- }
-
- private IProject createProject(IProject projectHandle, IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask("",2000);//$NON-NLS-1$
-
- projectHandle.create(new SubProgressMonitor(monitor, 1000));
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- projectHandle.open(new SubProgressMonitor(monitor, 1000));
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- } finally {
- monitor.done();
- }
-
- return projectHandle;
- }
-
- private IProject createProjectHandle(IWorkspaceRoot root, String projectName) {
- return root.getProject(projectName);
- }
-
- public IContainer generateContainer(IProgressMonitor monitor) throws CoreException {
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("creating container", 1000 * fContainerFullPath.segmentCount());
- if (fContainer != null)
- return;
-
- // Does the container exist already?
- IWorkspaceRoot root= fWorkspace.getRoot();
- fContainer= (IContainer) root.findMember(fContainerFullPath);
- if (fContainer != null)
- return;
-
- // Create the container for the given path
- fContainer= root;
- for (int i = 0; i < fContainerFullPath.segmentCount(); i++) {
- String currentSegment = fContainerFullPath.segment(i);
- IResource resource = fContainer.findMember(currentSegment);
- if (resource != null) {
- fContainer= (IContainer) resource;
- monitor.worked(1000);
- }
- else {
- if (i == 0) {
- IProject projectHandle= createProjectHandle(root, currentSegment);
- fContainer= createProject(projectHandle, new SubProgressMonitor(monitor,1000));
- }
- else {
- IFolder folderHandle= createFolderHandle(fContainer, currentSegment);
- fContainer= createFolder(folderHandle, new SubProgressMonitor(monitor,1000));
- }
- }
- }
- }
- };
-
- // Get scheduling rule
- IWorkspaceRoot root= fWorkspace.getRoot();
- IPath existingParentPath= fContainerFullPath;
- while (!root.exists(existingParentPath))
- existingParentPath= existingParentPath.removeLastSegments(1);
-
- IResource schedulingRule= root.findMember(existingParentPath);
- fWorkspace.run(runnable, schedulingRule, IWorkspace.AVOID_UPDATE, monitor);
- return fContainer;
- }
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/DefaultDocumentFactory.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/DefaultDocumentFactory.java
deleted file mode 100644
index 0a4973ab22d..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/DefaultDocumentFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.internal.filebuffers;
-
-import org.eclipse.core.filebuffers.IDocumentFactory;
-
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * The default document factory.
- */
-public class DefaultDocumentFactory implements IDocumentFactory {
-
- public DefaultDocumentFactory() {
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IDocumentFactory#createDocument()
- */
- public IDocument createDocument() {
- return new Document();
- }
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java
deleted file mode 100644
index f8fc178c3fd..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.filebuffers;
-
-
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.filebuffers.IDocumentFactory;
-import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-
-/**
- * This registry manages shareable document factories. Document factories are specified
- * in <code>plugin.xml</code> per file name extension.
- */
-public class ExtensionsRegistry {
-
- private final static String WILDCARD= "*"; //$NON-NLS-1$
-
- /** The mapping between name extensions and configuration elements describing document factories. */
- private Map fFactoryDescriptors= new HashMap();
- /** The mapping between configuration elements for document factories and instantiated document factories. */
- private Map fFactories= new HashMap();
- /** The mapping between name extensions and configuration elements describing document setup participants. */
- private Map fSetupParticipantDescriptors= new HashMap();
- /** The mapping between configuration elements for setup participants and instantiated setup participants. */
- private Map fSetupParticipants= new HashMap();
-
-
- /**
- * Creates a new document factory registry and intializes it with the information
- * found in the plugin registry.
- */
- public ExtensionsRegistry() {
- initialize("documentCreation", "extensions", fFactoryDescriptors); //$NON-NLS-1$ //$NON-NLS-2$
- initialize("documentSetup", "extensions", fSetupParticipantDescriptors); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Reads the comma-separated value of the given configuration element for the given attribute name and remembers the configuration element
- * in the given map under the individual tokens of the attribute value.
- */
- private void read(String attributeName, IConfigurationElement element, Map map) {
- String value= element.getAttribute(attributeName);
- if (value != null) {
- StringTokenizer tokenizer= new StringTokenizer(value, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String token= tokenizer.nextToken().trim();
-
- Set s= (Set) map.get(token);
- if (s == null) {
- s= new HashSet();
- map.put(token, s);
- }
- s.add(element);
- }
- }
- }
-
- /**
- * Adds an entry to the log of this plugin for the given status
- * @param status the status to log
- */
- private void log(IStatus status) {
- ILog log= Platform.getPlugin(FileBuffersPlugin.PLUGIN_ID).getLog();
- log.log(status);
- }
-
- /**
- * Initializes this registry. It retrieves all implementers of the given
- * extension point and remembers those implementers based on the
- * file name extensions in the given map.
- *
- * @param extensionPointName the name of the extension point
- * @param childElementName the name of the child elements
- * @param descriptors the map to be filled
- */
- private void initialize(String extensionPointName, String childElementName, Map descriptors) {
-
- IExtensionPoint extensionPoint= Platform.getPluginRegistry().getExtensionPoint(FileBuffersPlugin.PLUGIN_ID, extensionPointName);
- if (extensionPoint == null) {
- log(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, 0, MessageFormat.format("Extension point \"{0}\" not found.", new Object[] { extensionPointName}), null));
- return;
- }
-
- IConfigurationElement[] elements= extensionPoint.getConfigurationElements();
- for (int i= 0; i < elements.length; i++)
- read(childElementName, elements[i], descriptors);
- }
-
- /**
- * Returns the executable extension for the given configuration element.
- * If there is no instantiated extension remembered for this
- * element, a new extension is created and put into the cache if it is of the requested type.
- *
- * @param entry the configuration element
- * @param extensions the map of instantiated extensions
- * @param extensionType the requested result type
- */
- private Object getExtension(IConfigurationElement entry, Map extensions, Class extensionType) {
- Object extension= extensions.get(entry);
- if (extension != null)
- return extension;
-
- try {
- extension= entry.createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException x) {
- log(x.getStatus());
- }
-
- if (extensionType.isInstance(extension)) {
- extensions.put(entry, extension);
- return extension;
- }
-
- return null;
- }
-
- /**
- * Returns the first enumerated element of the given set.
- *
- * @param set the set from which to choose
- */
- private IConfigurationElement selectConfigurationElement(Set set) {
- if (set != null && !set.isEmpty()) {
- Iterator e= set.iterator();
- return (IConfigurationElement) e.next();
- }
- return null;
- }
-
- /**
- * Returns a shareable document factory for the given file name extension.
- *
- * @param extension the name extension to be used for lookup
- * @return the shareable document factory or <code>null</code>
- */
- private IDocumentFactory getDocumentFactory(String extension) {
-
- Set set= (Set) fFactoryDescriptors.get(extension);
- if (set != null) {
- IConfigurationElement entry= selectConfigurationElement(set);
- return (IDocumentFactory) getExtension(entry, fFactories, IDocumentFactory.class);
- }
- return null;
- }
-
- /**
- * Returns the set of setup participants for the given file name.
- *
- * @param extension the name extension to be used for lookup
- * @return the shareable set of document setup participants
- */
- private List getDocumentSetupParticipants(String extension) {
-
- Set set= (Set) fSetupParticipantDescriptors.get(extension);
- if (set == null)
- return null;
-
- List participants= new ArrayList();
- Iterator e= set.iterator();
- while (e.hasNext()) {
- IConfigurationElement entry= (IConfigurationElement) e.next();
- Object participant= getExtension(entry, fSetupParticipants, IDocumentSetupParticipant.class);
- if (participant != null)
- participants.add(participant);
- }
-
- return participants;
- }
-
- /**
- * Returns the shareable document factory for the given location.
- *
- * @param location the location for which to looked up the factory
- * @return the shareable document factory
- */
- public IDocumentFactory getDocumentFactory(IPath location) {
- IDocumentFactory factory= getDocumentFactory(location.getFileExtension());
- if (factory == null)
- factory= getDocumentFactory(WILDCARD);
- return factory;
- }
-
- /**
- * Returns the shareable set of document setup participants for the given location.
- *
- * @param location the location for which to look up the setup participants
- * @return the shareable set of document setup participants
- */
- public IDocumentSetupParticipant[] getDocumentSetupParticipants(IPath location) {
- List participants= new ArrayList();
-
- List p= getDocumentSetupParticipants(location.getFileExtension());
- if (p != null)
- participants.addAll(p);
-
- p= getDocumentSetupParticipants(WILDCARD);
- if (p != null)
- participants.addAll(p);
-
- IDocumentSetupParticipant[] result= new IDocumentSetupParticipant[participants.size()];
- participants.toArray(result);
- return result;
- }
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersPlugin.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersPlugin.java
deleted file mode 100644
index 752cffe2826..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileBuffersPlugin.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.core.internal.filebuffers;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.Plugin;
-
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class FileBuffersPlugin extends Plugin {
-
- public final static String PLUGIN_ID= "org.eclipse.core.filebuffers"; //$NON-NLS-1$
-
- /** The shared plug-in instance */
- private static FileBuffersPlugin fgPlugin;
- /** The resource bundle */
- private ResourceBundle fResourceBundle;
- /** The file buffer manager */
- private ITextFileBufferManager fTextFileBufferManager;
-
- /**
- * The constructor.
- */
- public FileBuffersPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- fgPlugin = this;
- try {
- fResourceBundle= ResourceBundle.getBundle("org.eclipse.core.internal.filebuffers.FileBuffersPlugin"); //$NON-NLS-1$
- } catch (MissingResourceException x) {
- fResourceBundle = null;
- }
- }
-
- /**
- * Returns the shared instance.
- */
- public static FileBuffersPlugin getDefault() {
- return fgPlugin;
- }
-
- /**
- * 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= FileBuffersPlugin.getDefault().getResourceBundle();
- try {
- return (bundle!=null ? bundle.getString(key) : key);
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- return fResourceBundle;
- }
-
- /**
- * Returns the text file buffer manager of this plug-in.
- *
- * @return the text file buffer manager of this plug-in
- */
- public ITextFileBufferManager getFileBufferManager() {
- if (fTextFileBufferManager == null)
- fTextFileBufferManager= new TextFileBufferManager();
- return fTextFileBufferManager;
- }
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/JavaFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/JavaFileBuffer.java
deleted file mode 100644
index e7b6c506d1e..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/JavaFileBuffer.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.internal.filebuffers;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.core.filebuffers.FileBuffers;
-
-/**
- * @since 3.0
- */
-public abstract class JavaFileBuffer extends AbstractFileBuffer {
-
- /** The location */
- protected IPath fLocation;
- /** The element for which the info is stored */
- protected File fFile;
- /** How often the element has been connected */
- protected int fReferenceCount;
- /** Can the element be saved */
- protected boolean fCanBeSaved= false;
- /** The status of this element */
- protected IStatus fStatus;
- /** The time stamp at which this buffer synchronized with the underlying file. */
- protected long fSynchronizationStamp= IFile.NULL_STAMP;
- /** How often the synchronization context has been requested */
- protected int fSynchronizationContextCount;
- /** The text file buffer manager */
- protected TextFileBufferManager fManager;
-
-
- public JavaFileBuffer(TextFileBufferManager manager) {
- super();
- fManager= manager;
- }
-
- abstract protected void addFileBufferContentListeners();
-
- abstract protected void removeFileBufferContentListeners();
-
- abstract protected void initializeFileBufferContent(IProgressMonitor monitor) throws CoreException;
-
- abstract protected void commitFileBufferContent(IProgressMonitor monitor, boolean overwrite) throws CoreException;
-
- /**
- * Returns the file at the given location or <code>null</code> if
- * there is no such file.
- *
- * @param location the location
- * @return the file at the given location
- */
- private File getFileAtLocation(IPath location) {
- File file= FileBuffers.getSystemFileAtLocation(location);
- return file.exists() ? file : null;
- }
-
- public void create(IPath location, IProgressMonitor monitor) throws CoreException {
- File file= getFileAtLocation(location);
- if (file == null)
- throw new CoreException(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, "File does not exist", null));
-
- fLocation= location;
- fFile= file;
- initializeFileBufferContent(monitor);
- fSynchronizationStamp= fFile.lastModified();
-
- addFileBufferContentListeners();
- }
-
- public void connect() {
- ++ fReferenceCount;
- }
-
- public void disconnect() throws CoreException {
- -- fReferenceCount;
- }
-
- /**
- * Returns whether this file buffer has already been disposed.
- *
- * @return <code>true</code> if already disposed, <code>false</code> otherwise
- */
- public boolean isDisposed() {
- return fReferenceCount <= 0;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#getLocation()
- */
- public IPath getLocation() {
- return fLocation;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#commit(org.eclipse.core.runtime.IProgressMonitor, boolean)
- */
- public void commit(IProgressMonitor monitor, boolean overwrite) throws CoreException {
- if (!isDisposed() && fCanBeSaved) {
-
- fManager.fireStateChanging(this);
-
- try {
- commitFileBufferContent(monitor, overwrite);
- } catch (CoreException x) {
- fManager.fireStateChangeFailed(this);
- throw x;
- } catch (RuntimeException x) {
- fManager.fireStateChangeFailed(this);
- throw x;
- }
-
- fCanBeSaved= false;
- addFileBufferContentListeners();
- fManager.fireDirtyStateChanged(this, fCanBeSaved);
- }
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#isDirty()
- */
- public boolean isDirty() {
- return fCanBeSaved;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#isShared()
- */
- public boolean isShared() {
- return fReferenceCount > 1;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#validateState(org.eclipse.core.runtime.IProgressMonitor, java.lang.Object)
- */
- public void validateState(IProgressMonitor monitor, Object computationContext) throws CoreException {
- // nop
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#isStateValidated()
- */
- public boolean isStateValidated() {
- return true;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#resetStateValidation()
- */
- public void resetStateValidation() {
- // nop
- }
-
- /**
- * Sends out the notification that the file serving as document input has been moved.
- *
- * @param newLocation the path of the new location of the file
- */
- protected void handleFileMoved(IPath newLocation) {
- fManager.fireUnderlyingFileMoved(this, newLocation);
- }
-
- /**
- * Defines the standard procedure to handle <code>CoreExceptions</code>. Exceptions
- * are written to the plug-in log.
- *
- * @param exception the exception to be logged
- * @param message the message to be logged
- */
- protected void handleCoreException(CoreException exception) {
- ILog log= Platform.getPlugin(FileBuffersPlugin.PLUGIN_ID).getLog();
- log.log(exception.getStatus());
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#isSynchronized()
- */
- public boolean isSynchronized() {
- return fSynchronizationStamp == fFile.lastModified();
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#getModifcationStamp()
- */
- public long getModifcationStamp() {
- return fFile.lastModified();
- }
-
- /**
- * Requests the file buffer manager's synchronization context for this file buffer.
- */
- public void requestSynchronizationContext() {
- ++ fSynchronizationContextCount;
- }
-
- /**
- * Releases the file buffer manager's synchronization context for this file buffer.
- */
- public void releaseSynchronizationContext() {
- -- fSynchronizationContextCount;
- }
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/JavaTextFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/JavaTextFileBuffer.java
deleted file mode 100644
index d4b05920b3f..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/JavaTextFileBuffer.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.internal.filebuffers;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Reader;
-
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-
-/**
- * @since 3.0
- */
-public class JavaTextFileBuffer extends JavaFileBuffer implements ITextFileBuffer {
-
-
- private class DocumentListener implements IDocumentListener {
-
- /*
- * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentChanged(DocumentEvent event) {
- fCanBeSaved= true;
- removeFileBufferContentListeners();
- fManager.fireDirtyStateChanged(JavaTextFileBuffer.this, fCanBeSaved);
- }
- }
-
- /**
- * Reader chunk size.
- */
- static final private int READER_CHUNK_SIZE= 2048;
- /**
- * Buffer size.
- */
- static final private int BUFFER_SIZE= 8 * READER_CHUNK_SIZE;
- /**
- * Constant for representing the ok status. This is considered a value object.
- */
- static final private IStatus STATUS_OK= new Status(IStatus.OK, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, "OK", null);
- /**
- * Constant for representing the error status. This is considered a value object.
- */
- static final private IStatus STATUS_ERROR= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.INFO, "Error", null);
-
-
-
- /** The element's document */
- protected IDocument fDocument;
- /** The encoding used to create the document from the storage or <code>null</code> for workbench encoding. */
- protected String fEncoding;
- /** Internal document listener */
- protected IDocumentListener fDocumentListener= new DocumentListener();
-
-
-
- public JavaTextFileBuffer(TextFileBufferManager manager) {
- super(manager);
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedTextFile#getDocument()
- */
- public IDocument getDocument() {
- return fDocument;
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedTextFile#getEncoding()
- */
- public String getEncoding() {
- return fEncoding;
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedTextFile#setEncoding(java.lang.String)
- */
- public void setEncoding(String encoding) {
- fEncoding= encoding;
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedFile#getStatus()
- */
- public IStatus getStatus() {
- if (!isDisposed()) {
- if (fStatus != null)
- return fStatus;
- return (fDocument == null ? STATUS_ERROR : STATUS_OK);
- }
- return STATUS_ERROR;
- }
-
- private InputStream getFileContents(IProgressMonitor monitor) {
- try {
- return new FileInputStream(fFile);
- } catch (FileNotFoundException e) {
- }
- return null;
- }
-
- private void setFileContents(InputStream stream, boolean overwrite, IProgressMonitor monitor) {
- try {
- OutputStream out= new FileOutputStream(fFile, false);
-
- try {
- byte[] buffer = new byte[8192];
- while (true) {
- int bytesRead = -1;
- try {
- bytesRead = stream.read(buffer);
- } catch (IOException e) {
- }
- if (bytesRead == -1)
- break;
- try {
- out.write(buffer, 0, bytesRead);
- } catch (IOException e) {
- }
- monitor.worked(1);
- }
- } finally {
- try {
- stream.close();
- } catch (IOException e) {
- } finally {
- try {
- out.close();
- } catch (IOException e) {
- }
- }
- }
- } catch (FileNotFoundException e) {
- }
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#revert(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void revert(IProgressMonitor monitor) throws CoreException {
- if (isDisposed())
- return;
-
- IDocument original= null;
- IStatus status= null;
-
- try {
- original= fManager.createEmptyDocument(getLocation());
- setDocumentContent(original, getFileContents(monitor), fEncoding);
- } catch (CoreException x) {
- status= x.getStatus();
- }
-
- fStatus= status;
-
- if (original != null) {
-
- String originalContents= original.get();
- boolean replaceContents= !originalContents.equals(fDocument.get());
-
- if (replaceContents) {
- fManager.fireBufferContentAboutToBeReplaced(this);
- fDocument.set(original.get());
- }
-
- if (fCanBeSaved) {
- fCanBeSaved= false;
- addFileBufferContentListeners();
- }
-
- if (replaceContents)
- fManager.fireBufferContentReplaced(this);
-
- fManager.fireDirtyStateChanged(this, fCanBeSaved);
- }
- }
-
- /*
- * @see org.eclipse.core.internal.filebuffers.FileBuffer#addFileBufferContentListeners()
- */
- protected void addFileBufferContentListeners() {
- if (fDocument != null)
- fDocument.addDocumentListener(fDocumentListener);
- }
-
- /*
- * @see org.eclipse.core.internal.filebuffers.FileBuffer#removeFileBufferContentListeners()
- */
- protected void removeFileBufferContentListeners() {
- if (fDocument != null)
- fDocument.removeDocumentListener(fDocumentListener);
- }
-
- /*
- * @see org.eclipse.core.internal.filebuffers.FileBuffer#initializeFileBufferContent(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void initializeFileBufferContent(IProgressMonitor monitor) throws CoreException {
- try {
- fDocument= fManager.createEmptyDocument(getLocation());
- setDocumentContent(fDocument, getFileContents(monitor), fEncoding);
- } catch (CoreException x) {
- fDocument= fManager.createEmptyDocument(getLocation());
- fStatus= x.getStatus();
- }
- }
-
- /*
- * @see org.eclipse.core.internal.filebuffers.FileBuffer#commitFileBufferContent(org.eclipse.core.runtime.IProgressMonitor, boolean)
- */
- protected void commitFileBufferContent(IProgressMonitor monitor, boolean overwrite) throws CoreException {
- try {
-
- String encoding= getEncoding();
- if (encoding == null)
- encoding= fManager.getDefaultEncoding();
-
- InputStream stream= new ByteArrayInputStream(fDocument.get().getBytes(encoding));
-
- if (fFile.exists()) {
-
- if (!overwrite)
- checkSynchronizationState();
-
-
- // here the file synchronizer should actually be removed and afterwards added again. However,
- // we are already inside an operation, so the delta is sent AFTER we have added the listener
- setFileContents(stream, overwrite, monitor);
- // set synchronization stamp to know whether the file synchronizer must become active
- fSynchronizationStamp= fFile.lastModified();
-
- // TODO if there is an annotation model update it here
-
- } else {
-
-// try {
-// monitor.beginTask("Saving", 2000); //$NON-NLS-1$
-// ContainerGenerator generator = new ContainerGenerator(fFile.getWorkspace(), fFile.getParent().getFullPath());
-// generator.generateContainer(new SubProgressMonitor(monitor, 1000));
-// fFile.create(stream, false, new SubProgressMonitor(monitor, 1000));
-// }
-// finally {
-// monitor.done();
-// }
-
- }
-
- } catch (IOException x) {
- String message= (x.getMessage() != null ? x.getMessage() : ""); //$NON-NLS-1$
- IStatus s= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, message, x);
- throw new CoreException(s);
- }
- }
-
- /**
- * Intitializes the given document with the given stream using the given encoding.
- *
- * @param document the document to be initialized
- * @param contentStream the stream which delivers the document content
- * @param encoding the character encoding for reading the given stream
- * @exception CoreException if the given stream can not be read
- */
- private void setDocumentContent(IDocument document, InputStream contentStream, String encoding) throws CoreException {
- Reader in= null;
- try {
-
- if (encoding == null)
- encoding= fManager.getDefaultEncoding();
-
- in= new BufferedReader(new InputStreamReader(contentStream, encoding), BUFFER_SIZE);
- StringBuffer buffer= new StringBuffer(BUFFER_SIZE);
- char[] readBuffer= new char[READER_CHUNK_SIZE];
- int n= in.read(readBuffer);
- while (n > 0) {
- buffer.append(readBuffer, 0, n);
- n= in.read(readBuffer);
- }
-
- document.set(buffer.toString());
-
- } catch (IOException x) {
- String msg= x.getMessage() == null ? "" : x.getMessage(); //$NON-NLS-1$
- IStatus s= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, msg, x);
- throw new CoreException(s);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException x) {
- }
- }
- }
- }
-
- /**
- * Checks whether the given file is synchronized with the the local file system.
- * If the file has been changed, a <code>CoreException</code> is thrown.
- *
- * @param file the file to check
- * @exception CoreException if file has been changed on the file system
- */
- private void checkSynchronizationState() throws CoreException {
- if (!isSynchronized()) {
- Status status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IResourceStatus.OUT_OF_SYNC_LOCAL, "out of sync", null);
- throw new CoreException(status);
- }
- }
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java
deleted file mode 100644
index 0024eff3860..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.internal.filebuffers;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IFile;
-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.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.core.filebuffers.FileBuffers;
-
-
-public abstract class ResourceFileBuffer extends AbstractFileBuffer {
-
- /**
- * Runnable encapsulating an element state change. This runnable ensures
- * that a element change failed message is sent out to the element state
- * listeners in case an exception occurred.
- */
- private class SafeFileChange implements Runnable {
-
- /**
- * Creates a new safe runnable for the given file.
- */
- public SafeFileChange() {
- }
-
- /**
- * Execute the change.
- * Subclass responsibility.
- *
- * @exception an exception in case of error
- */
- protected void execute() throws Exception {
- }
-
- /**
- * Does everything necessary prior to execution.
- */
- public void preRun() {
- fManager.fireStateChanging(ResourceFileBuffer.this);
- }
-
- /*
- * @see java.lang.Runnable#run()
- */
- public void run() {
-
- if (isDisposed()) {
- fManager.fireStateChangeFailed(ResourceFileBuffer.this);
- return;
- }
-
- try {
- execute();
- } catch (Exception x) {
- FileBuffersPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, "Exception when synchronizing", x)); //$NON-NLS-1$
- fManager.fireStateChangeFailed(ResourceFileBuffer.this);
- }
- }
- }
-
- /**
- * Synchronizes the document with external resource changes.
- */
- private class FileSynchronizer implements IResourceChangeListener, IResourceDeltaVisitor {
-
- /** A flag indicating whether this synchronizer is installed or not. */
- private boolean fIsInstalled= false;
-
- /**
- * Creates a new file synchronizer. Is not yet installed on a file.
- */
- public FileSynchronizer() {
- }
-
- /**
- * Installs the synchronizer on the file.
- */
- public void install() {
- fFile.getWorkspace().addResourceChangeListener(this);
- fIsInstalled= true;
- }
-
- /**
- * Uninstalls the synchronizer from the file.
- */
- public void uninstall() {
- fFile.getWorkspace().removeResourceChangeListener(this);
- fIsInstalled= false;
- }
-
- /*
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent e) {
- IResourceDelta delta= e.getDelta();
- try {
- if (delta != null && fIsInstalled)
- delta.accept(this);
- } catch (CoreException x) {
- handleCoreException(x);
- }
- }
-
- /*
- * @see IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
- */
- public boolean visit(IResourceDelta delta) throws CoreException {
-
- if (delta != null && fFile.equals(delta.getResource())) {
-
- SafeFileChange fileChange= null;
-
- switch (delta.getKind()) {
- case IResourceDelta.CHANGED:
- if ((IResourceDelta.CONTENT & delta.getFlags()) != 0) {
- if (!isDisposed() && !fCanBeSaved && !isSynchronized()) {
- fileChange= new SafeFileChange() {
- protected void execute() throws Exception {
- handleFileContentChanged();
- }
- };
- }
- }
- break;
- case IResourceDelta.REMOVED:
- if ((IResourceDelta.MOVED_TO & delta.getFlags()) != 0) {
- final IPath path= delta.getMovedToPath();
- fileChange= new SafeFileChange() {
- protected void execute() throws Exception {
- handleFileMoved(path);
- }
- };
- } else {
- if (!isDisposed() && !fCanBeSaved) {
- fileChange= new SafeFileChange() {
- protected void execute() throws Exception {
- handleFileDeleted();
- }
- };
- }
- }
- break;
- }
-
- if (fileChange != null) {
- fileChange.preRun();
- fManager.execute(fileChange, fSynchronizationContextCount > 0);
- }
- }
-
- return true; // because we are sitting on files anyway
- }
- }
-
-
-
- /** The location */
- protected IPath fLocation;
- /** The element for which the info is stored */
- protected IFile fFile;
- /** How often the element has been connected */
- protected int fReferenceCount;
- /** Can the element be saved */
- protected boolean fCanBeSaved= false;
- /** Has element state been validated */
- protected boolean fIsStateValidated= false;
- /** The status of this element */
- protected IStatus fStatus;
- /** The file synchronizer. */
- protected FileSynchronizer fFileSynchronizer;
- /** The time stamp at which this buffer synchronized with the underlying file. */
- protected long fSynchronizationStamp= IFile.NULL_STAMP;
- /** How often the synchronization context has been requested */
- protected int fSynchronizationContextCount;
- /** The text file buffer manager */
- protected TextFileBufferManager fManager;
-
-
-
-
- public ResourceFileBuffer(TextFileBufferManager manager) {
- super();
- fManager= manager;
- }
-
- abstract protected void handleFileContentChanged();
-
- abstract protected void addFileBufferContentListeners();
-
- abstract protected void removeFileBufferContentListeners();
-
- abstract protected void initializeFileBufferContent(IProgressMonitor monitor) throws CoreException;
-
- abstract protected void commitFileBufferContent(IProgressMonitor monitor, boolean overwrite) throws CoreException;
-
- public void create(IPath location, IProgressMonitor monitor) throws CoreException {
- IFile file= FileBuffers.getWorkspaceFileAtLocation(location);
- if (file == null || !file.exists())
- throw new CoreException(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, "File does not exist", null));
-
- fLocation= location;
- fFile= file;
- fFileSynchronizer= new FileSynchronizer();
-
- refreshFile(monitor);
- initializeFileBufferContent(monitor);
- fSynchronizationStamp= fFile.getModificationStamp();
-
- addFileBufferContentListeners();
- }
-
- public void connect() {
- ++ fReferenceCount;
- if (fReferenceCount == 1)
- fFileSynchronizer.install();
- }
-
- public void disconnect() throws CoreException {
- -- fReferenceCount;
- if (fReferenceCount == 0) {
- if (fFileSynchronizer != null)
- fFileSynchronizer.uninstall();
- fFileSynchronizer= null;
- }
- }
-
- /**
- * Returns whether this file buffer has already been disposed.
- *
- * @return <code>true</code> if already disposed, <code>false</code> otherwise
- */
- public boolean isDisposed() {
- return fFileSynchronizer == null;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#getLocation()
- */
- public IPath getLocation() {
- return fLocation;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#commit(org.eclipse.core.runtime.IProgressMonitor, boolean)
- */
- public void commit(IProgressMonitor monitor, boolean overwrite) throws CoreException {
- if (!isDisposed() && fCanBeSaved) {
-
- fManager.fireStateChanging(this);
-
- try {
- commitFileBufferContent(monitor, overwrite);
- } catch (CoreException x) {
- fManager.fireStateChangeFailed(this);
- throw x;
- } catch (RuntimeException x) {
- fManager.fireStateChangeFailed(this);
- throw x;
- }
-
- fCanBeSaved= false;
- addFileBufferContentListeners();
- fManager.fireDirtyStateChanged(this, fCanBeSaved);
- }
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#isDirty()
- */
- public boolean isDirty() {
- return fCanBeSaved;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#isShared()
- */
- public boolean isShared() {
- return fReferenceCount > 1;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#validateState(org.eclipse.core.runtime.IProgressMonitor, java.lang.Object)
- */
- public void validateState(IProgressMonitor monitor, Object computationContext) throws CoreException {
- if (!isDisposed() && !fIsStateValidated) {
-
- if (fFile.isReadOnly()) {
- IWorkspace workspace= fFile.getWorkspace();
- fStatus= workspace.validateEdit(new IFile[] { fFile }, computationContext);
- }
- fIsStateValidated= true;
- fManager.fireStateValidationChanged(this, fIsStateValidated);
- }
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#isStateValidated()
- */
- public boolean isStateValidated() {
- return fIsStateValidated;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#resetStateValidation()
- */
- public void resetStateValidation() {
- if (fIsStateValidated) {
- fIsStateValidated= false;
- fManager.fireStateValidationChanged(this, fIsStateValidated);
- }
- }
-
- /**
- * Sends out the notification that the file serving as document input has been moved.
- *
- * @param newLocation the path of the new location of the file
- */
- protected void handleFileMoved(IPath newLocation) {
- fManager.fireUnderlyingFileMoved(this, newLocation);
- }
-
- /**
- * Sends out the notification that the file serving as document input has been deleted.
- */
- protected void handleFileDeleted() {
- fManager.fireUnderlyingFileDeleted(this);
- }
-
- /**
- * Refreshes the given file.
- */
- protected void refreshFile(IProgressMonitor monitor) {
- try {
- fFile.refreshLocal(IFile.DEPTH_INFINITE, monitor);
- } catch (OperationCanceledException x) {
- } catch (CoreException x) {
- handleCoreException(x);
- }
- }
-
- /**
- * Defines the standard procedure to handle <code>CoreExceptions</code>. Exceptions
- * are written to the plug-in log.
- *
- * @param exception the exception to be logged
- * @param message the message to be logged
- */
- protected void handleCoreException(CoreException exception) {
- ILog log= Platform.getPlugin(FileBuffersPlugin.PLUGIN_ID).getLog();
- log.log(exception.getStatus());
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#isSynchronized()
- */
- public boolean isSynchronized() {
- return fSynchronizationStamp == fFile.getModificationStamp() && fFile.isSynchronized(IResource.DEPTH_ZERO);
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#getModifcationStamp()
- */
- public long getModifcationStamp() {
- File file= FileBuffers.getSystemFileAtLocation(getLocation());
- if (file != null)
- return file.lastModified();
- return IResource.NULL_STAMP;
- }
-
- /**
- * Requests the file buffer manager's synchronization context for this file buffer.
- */
- public void requestSynchronizationContext() {
- ++ fSynchronizationContextCount;
- }
-
- /**
- * Releases the file buffer manager's synchronization context for this file buffer.
- */
- public void releaseSynchronizationContext() {
- -- fSynchronizationContextCount;
- }
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java
deleted file mode 100644
index b18404c0475..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.internal.filebuffers;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-
-/**
- *
- */
-public class ResourceTextFileBuffer extends ResourceFileBuffer implements ITextFileBuffer {
-
-
- private class DocumentListener implements IDocumentListener {
-
- /*
- * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentChanged(DocumentEvent event) {
- fCanBeSaved= true;
- removeFileBufferContentListeners();
- fManager.fireDirtyStateChanged(ResourceTextFileBuffer.this, fCanBeSaved);
- }
- }
-
- /**
- * Reader chunk size.
- */
- static final private int READER_CHUNK_SIZE= 2048;
- /**
- * Buffer size.
- */
- static final private int BUFFER_SIZE= 8 * READER_CHUNK_SIZE;
- /**
- * Qualified name for the encoding key.
- */
- static final private QualifiedName ENCODING_KEY= new QualifiedName(FileBuffersPlugin.PLUGIN_ID, "encoding"); //$NON-NLS-1$
- /**
- * Constant for representing the ok status. This is considered a value object.
- */
- static final private IStatus STATUS_OK= new Status(IStatus.OK, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, "OK", null);
- /**
- * Constant for representing the error status. This is considered a value object.
- */
- static final private IStatus STATUS_ERROR= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.INFO, "Error", null);
-
-
-
- /** The element's document */
- protected IDocument fDocument;
- /** The encoding used to create the document from the storage or <code>null</code> for workbench encoding. */
- protected String fEncoding;
- /** Internal document listener */
- protected IDocumentListener fDocumentListener= new DocumentListener();
-
-
-
- public ResourceTextFileBuffer(TextFileBufferManager manager) {
- super(manager);
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedTextFile#getDocument()
- */
- public IDocument getDocument() {
- return fDocument;
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedTextFile#getEncoding()
- */
- public String getEncoding() {
- return fEncoding;
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedTextFile#setEncoding(java.lang.String)
- */
- public void setEncoding(String encoding) {
- fEncoding= encoding;
- try {
- fFile.setPersistentProperty(ENCODING_KEY, encoding);
- } catch (CoreException x) {
- handleCoreException(x);
- }
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedFile#getStatus()
- */
- public IStatus getStatus() {
- if (!isDisposed()) {
- if (fStatus != null)
- return fStatus;
- return (fDocument == null ? STATUS_ERROR : STATUS_OK);
- }
- return STATUS_ERROR;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBuffer#revert(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void revert(IProgressMonitor monitor) throws CoreException {
- if (isDisposed())
- return;
-
- refreshFile(monitor);
-
- IDocument original= null;
- IStatus status= null;
-
- try {
- original= fManager.createEmptyDocument(fFile.getLocation());
- setDocumentContent(original, fFile.getContents(), fEncoding);
- } catch (CoreException x) {
- status= x.getStatus();
- }
-
- fStatus= status;
-
- if (original != null) {
-
- String originalContents= original.get();
- boolean replaceContents= !originalContents.equals(fDocument.get());
-
- if (replaceContents) {
- fManager.fireBufferContentAboutToBeReplaced(this);
- fDocument.set(original.get());
- }
-
- if (fCanBeSaved) {
- fCanBeSaved= false;
- addFileBufferContentListeners();
- }
-
- if (replaceContents)
- fManager.fireBufferContentReplaced(this);
-
- fManager.fireDirtyStateChanged(this, fCanBeSaved);
- }
- }
-
- /*
- * @see org.eclipse.core.internal.filebuffers.FileBuffer#addFileBufferContentListeners()
- */
- protected void addFileBufferContentListeners() {
- if (fDocument != null)
- fDocument.addDocumentListener(fDocumentListener);
- }
-
- /*
- * @see org.eclipse.core.internal.filebuffers.FileBuffer#removeFileBufferContentListeners()
- */
- protected void removeFileBufferContentListeners() {
- if (fDocument != null)
- fDocument.removeDocumentListener(fDocumentListener);
- }
-
- /*
- * @see org.eclipse.core.internal.filebuffers.FileBuffer#initializeFileBufferContent(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void initializeFileBufferContent(IProgressMonitor monitor) throws CoreException {
- try {
- fEncoding= fFile.getPersistentProperty(ENCODING_KEY);
- fDocument= fManager.createEmptyDocument(fFile.getLocation());
- setDocumentContent(fDocument, fFile.getContents(), fEncoding);
- } catch (CoreException x) {
- fDocument= fManager.createEmptyDocument(fFile.getLocation());
- fStatus= x.getStatus();
- }
- }
-
- /*
- * @see org.eclipse.core.internal.filebuffers.FileBuffer#commitFileBufferContent(org.eclipse.core.runtime.IProgressMonitor, boolean)
- */
- protected void commitFileBufferContent(IProgressMonitor monitor, boolean overwrite) throws CoreException {
- try {
-
- String encoding= getEncoding();
- if (encoding == null)
- encoding= fManager.getDefaultEncoding();
-
- InputStream stream= new ByteArrayInputStream(fDocument.get().getBytes(encoding));
-
- if (fFile.exists()) {
-
- if (!overwrite)
- checkSynchronizationState();
-
-
- // here the file synchronizer should actually be removed and afterwards added again. However,
- // we are already inside an operation, so the delta is sent AFTER we have added the listener
- fFile.setContents(stream, overwrite, true, monitor);
- // set synchronization stamp to know whether the file synchronizer must become active
- fSynchronizationStamp= fFile.getModificationStamp();
-
- // TODO if there is an annotation model update it here
-
- } else {
-
- try {
- monitor.beginTask("Saving", 2000); //$NON-NLS-1$
- ContainerGenerator generator = new ContainerGenerator(fFile.getWorkspace(), fFile.getParent().getFullPath());
- generator.generateContainer(new SubProgressMonitor(monitor, 1000));
- fFile.create(stream, false, new SubProgressMonitor(monitor, 1000));
- }
- finally {
- monitor.done();
- }
- }
-
- } catch (IOException x) {
- String message= (x.getMessage() != null ? x.getMessage() : ""); //$NON-NLS-1$
- IStatus s= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, message, x);
- throw new CoreException(s);
- }
- }
-
- /**
- * Updates the element info to a change of the file content and sends out appropriate notifications.
- */
- protected void handleFileContentChanged() {
- if (isDisposed())
- return;
-
- IDocument document= fManager.createEmptyDocument(fFile.getLocation());
- IStatus status= null;
-
- try {
- setDocumentContent(document, fFile.getContents(false), fEncoding);
- } catch (CoreException x) {
- status= x.getStatus();
- }
-
- String newContent= document.get();
-
- if ( !newContent.equals(fDocument.get())) {
-
- fManager.fireBufferContentAboutToBeReplaced(this);
-
- removeFileBufferContentListeners();
- fDocument.set(newContent);
- fCanBeSaved= false;
- fSynchronizationStamp= fFile.getModificationStamp();
- fStatus= status;
- addFileBufferContentListeners();
-
- fManager.fireBufferContentReplaced(this);
-
- } else {
-
- removeFileBufferContentListeners();
- fCanBeSaved= false;
- fSynchronizationStamp= fFile.getModificationStamp();
- fStatus= status;
- addFileBufferContentListeners();
-
- fManager.fireDirtyStateChanged(this, fCanBeSaved);
- }
- }
-
- /**
- * Intitializes the given document with the given stream using the given encoding.
- *
- * @param document the document to be initialized
- * @param contentStream the stream which delivers the document content
- * @param encoding the character encoding for reading the given stream
- * @exception CoreException if the given stream can not be read
- */
- private void setDocumentContent(IDocument document, InputStream contentStream, String encoding) throws CoreException {
- Reader in= null;
- try {
-
- if (encoding == null)
- encoding= fManager.getDefaultEncoding();
-
- in= new BufferedReader(new InputStreamReader(contentStream, encoding), BUFFER_SIZE);
- StringBuffer buffer= new StringBuffer(BUFFER_SIZE);
- char[] readBuffer= new char[READER_CHUNK_SIZE];
- int n= in.read(readBuffer);
- while (n > 0) {
- buffer.append(readBuffer, 0, n);
- n= in.read(readBuffer);
- }
-
- document.set(buffer.toString());
-
- } catch (IOException x) {
- String message= (x.getMessage() != null ? x.getMessage() : ""); //$NON-NLS-1$
- IStatus s= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, message, x);
- throw new CoreException(s);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException x) {
- }
- }
- }
- }
-
- /**
- * Checks whether the given file is synchronized with the the local file system.
- * If the file has been changed, a <code>CoreException</code> is thrown.
- *
- * @param file the file to check
- * @exception CoreException if file has been changed on the file system
- */
- private void checkSynchronizationState() throws CoreException {
- if (!fFile.isSynchronized(IFile.DEPTH_ZERO)) {
- Status status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IResourceStatus.OUT_OF_SYNC_LOCAL, "out of sync", null);
- throw new CoreException(status);
- }
- }
-}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java
deleted file mode 100644
index e2685562031..00000000000
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.core.internal.filebuffers;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.filebuffers.IDocumentFactory;
-import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
-import org.eclipse.core.filebuffers.IFileBuffer;
-import org.eclipse.core.filebuffers.IFileBufferListener;
-import org.eclipse.core.filebuffers.ISynchronizationContext;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * @since 3.0
- */
-public class TextFileBufferManager implements ITextFileBufferManager {
-
- private Map fFilesBuffers= new HashMap();
- private List fFileBufferListeners= new ArrayList();
- private ExtensionsRegistry fRegistry;
- private ISynchronizationContext fSynchronizationContext;
-
-
- public TextFileBufferManager() {
- fRegistry= new ExtensionsRegistry();
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBufferManager#connect(org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void connect(IPath location, IProgressMonitor monitor) throws CoreException {
- Assert.isNotNull(location);
- location= FileBuffers.normalizeLocation(location);
-
- AbstractFileBuffer fileBuffer= (AbstractFileBuffer) fFilesBuffers.get(location);
- if (fileBuffer == null) {
-
- fileBuffer= createFileBuffer(location);
- if (fileBuffer == null)
- throw new CoreException(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, 0, "Cannot create file buffer.", null));
-
- fileBuffer.create(location, monitor);
- fileBuffer.connect();
- fFilesBuffers.put(location, fileBuffer);
- fireBufferCreated(fileBuffer);
-
- } else {
- fileBuffer.connect();
- }
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBufferManager#disconnect(org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void disconnect(IPath location, IProgressMonitor monitor) throws CoreException {
- Assert.isNotNull(location);
- location= FileBuffers.normalizeLocation(location);
-
- AbstractFileBuffer fileBuffer= (AbstractFileBuffer) fFilesBuffers.get(location);
- if (fileBuffer != null) {
- fileBuffer.disconnect();
- if (fileBuffer.isDisposed()) {
- fFilesBuffers.remove(location);
- fireBufferDisposed(fileBuffer);
- }
- }
- }
-
- private AbstractFileBuffer createFileBuffer(IPath location) {
- if (!isTextFile(location))
- return null;
-
- if (isWorkspaceResource(location))
- return new ResourceTextFileBuffer(this);
-
- return new JavaTextFileBuffer(this);
- }
-
- private boolean isWorkspaceResource(IPath location) {
- return FileBuffers.getWorkspaceFileAtLocation(location) != null;
- }
-
- private boolean isTextFile(IPath location) {
- return true;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBufferManager#getFileBuffer(org.eclipse.core.runtime.IPath)
- */
- public IFileBuffer getFileBuffer(IPath location) {
- location= FileBuffers.normalizeLocation(location);
- return (IFileBuffer) fFilesBuffers.get(location);
- }
-
- /*
- * @see org.eclipse.core.filebuffers.ITextFileBufferManager#getTextFileBuffer(org.eclipse.core.runtime.IPath)
- */
- public ITextFileBuffer getTextFileBuffer(IPath location) {
- location= FileBuffers.normalizeLocation(location);
- return (ITextFileBuffer) fFilesBuffers.get(location);
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedFileManager#getDefaultEncoding()
- */
- public String getDefaultEncoding() {
- return ResourcesPlugin.getEncoding();
- }
-
- /*
- * @see org.eclipse.core.filebuffers.ITextFileBufferManager#createEmptyDocument(org.eclipse.core.runtime.IPath)
- */
- public IDocument createEmptyDocument(IPath location) {
- Assert.isNotNull(location);
- location= FileBuffers.normalizeLocation(location);
-
- IDocumentFactory factory= fRegistry.getDocumentFactory(location);
-
- IDocument document= null;
- if (factory != null)
- document= factory.createDocument();
- else
- document= new Document();
-
- IDocumentSetupParticipant[] participants= fRegistry.getDocumentSetupParticipants(location);
- if (participants != null) {
- for (int i= 0; i < participants.length; i++)
- participants[i].setup(document);
- }
-
- return document;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBufferManager#addFileBufferListener(org.eclipse.core.filebuffers.IFileBufferListener)
- */
- public void addFileBufferListener(IFileBufferListener listener) {
- Assert.isNotNull(listener);
- if (!fFileBufferListeners.contains(listener))
- fFileBufferListeners.add(listener);
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBufferManager#removeFileBufferListener(org.eclipse.core.filebuffers.IFileBufferListener)
- */
- public void removeFileBufferListener(IFileBufferListener listener) {
- Assert.isNotNull(listener);
- fFileBufferListeners.remove(listener);
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBufferManager#setSynchronizationContext(org.eclipse.core.filebuffers.ISynchronizationContext)
- */
- public void setSynchronizationContext(ISynchronizationContext context) {
- fSynchronizationContext= context;
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBufferManager#requestSynchronizationContext(org.eclipse.core.runtime.IPath)
- */
- public void requestSynchronizationContext(IPath location) {
- Assert.isNotNull(location);
- location= FileBuffers.normalizeLocation(location);
-
- AbstractFileBuffer fileBuffer= (AbstractFileBuffer) fFilesBuffers.get(location);
- if (fileBuffer != null)
- fileBuffer.requestSynchronizationContext();
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBufferManager#releaseSynchronizationContext(org.eclipse.core.runtime.IPath)
- */
- public void releaseSynchronizationContext(IPath location) {
- Assert.isNotNull(location);
- location= FileBuffers.normalizeLocation(location);
-
- AbstractFileBuffer fileBuffer= (AbstractFileBuffer) fFilesBuffers.get(location);
- if (fileBuffer != null)
- fileBuffer.releaseSynchronizationContext();
- }
-
- /**
- * Executes the given runnable in the synchronization context of this file buffer manager.
- * If there is no synchronization context connected with this manager, the runnable is
- * directly executed.
- *
- * @param runnable the runnable to be executed
- */
- public void execute(Runnable runnable, boolean requestSynchronizationContext) {
- if (requestSynchronizationContext && fSynchronizationContext != null)
- fSynchronizationContext.run(runnable);
- else
- runnable.run();
- }
-
- protected void fireDirtyStateChanged(IFileBuffer buffer, boolean isDirty) {
- Iterator e= new ArrayList(fFileBufferListeners).iterator();
- while (e.hasNext()) {
- IFileBufferListener l= (IFileBufferListener) e.next();
- l.dirtyStateChanged(buffer, isDirty);
- }
- }
-
- protected void fireBufferContentAboutToBeReplaced(IFileBuffer buffer) {
- Iterator e= new ArrayList(fFileBufferListeners).iterator();
- while (e.hasNext()) {
- IFileBufferListener l= (IFileBufferListener) e.next();
- l.bufferContentAboutToBeReplaced(buffer);
- }
- }
-
- protected void fireBufferContentReplaced(IFileBuffer buffer) {
- Iterator e= new ArrayList(fFileBufferListeners).iterator();
- while (e.hasNext()) {
- IFileBufferListener l= (IFileBufferListener) e.next();
- l.bufferContentReplaced(buffer);
- }
- }
-
- protected void fireUnderlyingFileMoved(IFileBuffer buffer, IPath target) {
- Iterator e= new ArrayList(fFileBufferListeners).iterator();
- while (e.hasNext()) {
- IFileBufferListener l= (IFileBufferListener) e.next();
- l.underlyingFileMoved(buffer, target);
- }
- }
-
- protected void fireUnderlyingFileDeleted(IFileBuffer buffer) {
- Iterator e= new ArrayList(fFileBufferListeners).iterator();
- while (e.hasNext()) {
- IFileBufferListener l= (IFileBufferListener) e.next();
- l.underlyingFileDeleted(buffer);
- }
- }
-
- protected void fireStateValidationChanged(IFileBuffer buffer, boolean isStateValidated) {
- Iterator e= new ArrayList(fFileBufferListeners).iterator();
- while (e.hasNext()) {
- IFileBufferListener l= (IFileBufferListener) e.next();
- l.stateValidationChanged(buffer, isStateValidated);
- }
- }
-
- protected void fireStateChanging(IFileBuffer buffer) {
- Iterator e= new ArrayList(fFileBufferListeners).iterator();
- while (e.hasNext()) {
- IFileBufferListener l= (IFileBufferListener) e.next();
- l.stateChanging(buffer);
- }
- }
-
- protected void fireStateChangeFailed(IFileBuffer buffer) {
- Iterator e= new ArrayList(fFileBufferListeners).iterator();
- while (e.hasNext()) {
- IFileBufferListener l= (IFileBufferListener) e.next();
- l.stateChangeFailed(buffer);
- }
- }
-
- protected void fireBufferCreated(IFileBuffer buffer) {
- Iterator e= new ArrayList(fFileBufferListeners).iterator();
- while (e.hasNext()) {
- IFileBufferListener l= (IFileBufferListener) e.next();
- l.bufferCreated(buffer);
- }
- }
-
- protected void fireBufferDisposed(IFileBuffer buffer) {
- Iterator e= new ArrayList(fFileBufferListeners).iterator();
- while (e.hasNext()) {
- IFileBufferListener l= (IFileBufferListener) e.next();
- l.bufferDisposed(buffer);
- }
- }
-}
diff --git a/org.eclipse.search/.classpath b/org.eclipse.search/.classpath
deleted file mode 100644
index a9ba8cb51e5..00000000000
--- a/org.eclipse.search/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="search"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.search/.cvsignore b/org.eclipse.search/.cvsignore
deleted file mode 100644
index ba077a4031a..00000000000
--- a/org.eclipse.search/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/org.eclipse.search/.project b/org.eclipse.search/.project
deleted file mode 100644
index aa7e58b5ea3..00000000000
--- a/org.eclipse.search/.project
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.search</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.filebuffers</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.jface.text</project>
- <project>org.eclipse.swt</project>
- <project>org.eclipse.ui</project>
- <project>org.eclipse.ui.editors</project>
- <project>org.eclipse.ui.ide</project>
- <project>org.eclipse.ui.workbench.texteditor</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.search/about.html b/org.eclipse.search/about.html
deleted file mode 100644
index 9db411aab99..00000000000
--- a/org.eclipse.search/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 (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). 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, &quot;Program&quot; 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 (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) 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/org.eclipse.search/build.properties b/org.eclipse.search/build.properties
deleted file mode 100644
index b4d9c8eedb8..00000000000
--- a/org.eclipse.search/build.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
-###############################################################################
-bin.includes = plugin.xml,\
- about.html,\
- icons/,\
- plugin.properties,\
- *.jar
-src.includes = about.html,\
- schema/
-source.search.jar = search/
diff --git a/org.eclipse.search/buildnotes_search.html b/org.eclipse.search/buildnotes_search.html
deleted file mode 100644
index 82ce5bbb62c..00000000000
--- a/org.eclipse.search/buildnotes_search.html
+++ /dev/null
@@ -1,189 +0,0 @@
-<!--
- DO NOT EDIT THIS FILE WITH HTML EDITORS
--->
-
-<!DOCTYPE doctype 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.76 [en] (Windows NT 5.0; U) [Netscape]">
- <title>Eclipse Platform Build Notes - Search</title>
-</head>
-
-<body>
-<h1>
-Eclipse Platform Build Notes<br>
-Search</h1>
-To see which bugs have been addressed in one of the builds simply open the <a href="http://bugs.eclipse.org/bugs/query.cgi?short_desc_type=allwordssubstr&amp;product=Platform&amp;component=Search&amp;long_desc_type=allwordssubstr&amp;long_desc=&amp;bug_file_loc_type=allwordssubstr&amp;bug_file_loc=&amp;keywords_type=allwords&amp;keywords=&amp;emailtype1=substring&amp;email1=&amp;emailtype2=substring&amp;email2=&amp;bugidtype=include&amp;bug_id=&amp;votes=&amp;changedin=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;namedcmd=Assigned&amp;newqueryname=&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=">Search bugzilla query page</a>, select status, resolution and the time frame.
-<br>
-<br>
-<br>
-========== Eclipse Build Input December 16th 2003 ==========<br>
-
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- bug fixing
-</pre>
-<br>
-<br>
-========== Eclipse Build Input November 18th 2003 ==========<br>
-
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- Added a new interface IReplacePage. If an ISearchPage implements IReplacePage,
- a "Replace" button will be shown in the search dialog (when the page is active).
- The text search page implements that interface.
-- Extended the text replace dialog to support "Replace in File" and "Replace All" actions.
-</pre>
-<br>
-<br>
-========== Eclipse Build Input November 11th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- Converted to RPC
-</pre>
-<br>
-<br>
-
-========== Eclipse Build Input October 28th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- A new preference has been introduced which allows to prevent the
- Search view from being activated.
-- Search annotations can be configured to be highlighted using background painter
-</pre>
-<br>
-<br>
-========== Eclipse Build Input October 21th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- 1 bug fixed
-</pre>
-<br>
-<br>
-========== Eclipse Build Input October 7th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- Added F1 help for File search page's regular expression support
-</pre>
-<br>
-<br>
-========== Eclipse Build Input September 30th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input September 23th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input September 16th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- File Search page now supports regular expressions
-- 1 bug fixed
-</pre
-<br>
-========== Eclipse Build Input September 9th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input September 3th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input August 26th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input August 19th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- Added a new attribute "canSearchEnclosingProjects" to the extension point
- "org.eclipse.search.searchPages". If the attribute is set to true, the search
- dialog scope area will have a new radio button labeled "Enclosing Projects".
- Search page contributors whishing to support search in projects enclosing the
- current selection have to set this attribute to true and handle the new search
- scope constant org.eclipse.search.ui.ISearchPageContainer.SELECTED_PROJECTS_SCOPE.
- The file search page supports search in enclosing projects.
-- Improved project scope
-</pre>
-<br>
-<br>
-========== Eclipse Build Input August 12th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-- Project scope has been added to the Search dialog (see feature 16287)
-<br>
-<br>
-========== Eclipse Build Input August 5th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input July 29th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input July 22th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input July 15th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input July 8st 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-- searchPage contributors can now specify a custom help context ID for the Search view.<br>
-<br>
-<br>
-========== Eclipse Build Input July 1st 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-- 1 bug fixed<br>
-<br>
-<br>
-========== Eclipse Build Input June 24th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input June 17th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-- Added missing requirement in schema documentation
-<br>
-<br>
-========== Eclipse Build Input June 10th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input June 3rd 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-- 1 bug fixed<br>
-<br>
-<br>
-========== Eclipse Build Input May 27th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input May 20th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input May 13th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-- 1 bug fixed<br>
-<br>
-<br>
-========== Eclipse Build Input May 6th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-- 1 bug fixed<br>
-<br>
-<br>
-========== Eclipse Build Input April 29th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<br>
-<br>
-========== Eclipse Build Input April 22nd 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-- 1 bug fixed<br>
-<br>
-<br>
-</body></html> \ No newline at end of file
diff --git a/org.eclipse.search/hglegal2003.htm b/org.eclipse.search/hglegal2003.htm
deleted file mode 100644
index 47c8540c84c..00000000000
--- a/org.eclipse.search/hglegal2003.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">
- <LINK REL="stylesheet" HREF="book.css" CHARSET="ISO-8859-1" TYPE="text/css">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.
-</body>
-</html>
diff --git a/org.eclipse.search/icons/full/clcl16/search_goto.gif b/org.eclipse.search/icons/full/clcl16/search_goto.gif
deleted file mode 100644
index 80484787d21..00000000000
--- a/org.eclipse.search/icons/full/clcl16/search_goto.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/clcl16/search_history.gif b/org.eclipse.search/icons/full/clcl16/search_history.gif
deleted file mode 100644
index 151fe137e33..00000000000
--- a/org.eclipse.search/icons/full/clcl16/search_history.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/clcl16/search_next.gif b/org.eclipse.search/icons/full/clcl16/search_next.gif
deleted file mode 100644
index 8392f3345c5..00000000000
--- a/org.eclipse.search/icons/full/clcl16/search_next.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/clcl16/search_prev.gif b/org.eclipse.search/icons/full/clcl16/search_prev.gif
deleted file mode 100644
index 9b278e6fa81..00000000000
--- a/org.eclipse.search/icons/full/clcl16/search_prev.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/clcl16/search_rem.gif b/org.eclipse.search/icons/full/clcl16/search_rem.gif
deleted file mode 100644
index 12a9167c59d..00000000000
--- a/org.eclipse.search/icons/full/clcl16/search_rem.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/clcl16/search_remall.gif b/org.eclipse.search/icons/full/clcl16/search_remall.gif
deleted file mode 100644
index 2c069ab3f43..00000000000
--- a/org.eclipse.search/icons/full/clcl16/search_remall.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/clcl16/search_sortmatch.gif b/org.eclipse.search/icons/full/clcl16/search_sortmatch.gif
deleted file mode 100644
index 9ed470d02f7..00000000000
--- a/org.eclipse.search/icons/full/clcl16/search_sortmatch.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/clcl16/search_stop.gif b/org.eclipse.search/icons/full/clcl16/search_stop.gif
deleted file mode 100644
index 4eb53ec41c4..00000000000
--- a/org.eclipse.search/icons/full/clcl16/search_stop.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/ctool16/search.gif b/org.eclipse.search/icons/full/ctool16/search.gif
deleted file mode 100644
index 6dc3ebefc92..00000000000
--- a/org.eclipse.search/icons/full/ctool16/search.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/cview16/searchres.gif b/org.eclipse.search/icons/full/cview16/searchres.gif
deleted file mode 100644
index 8b39ab3b8be..00000000000
--- a/org.eclipse.search/icons/full/cview16/searchres.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/search_goto.gif b/org.eclipse.search/icons/full/dlcl16/search_goto.gif
deleted file mode 100644
index 4d8cd04e403..00000000000
--- a/org.eclipse.search/icons/full/dlcl16/search_goto.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/search_history.gif b/org.eclipse.search/icons/full/dlcl16/search_history.gif
deleted file mode 100644
index ee26f79a803..00000000000
--- a/org.eclipse.search/icons/full/dlcl16/search_history.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/search_next.gif b/org.eclipse.search/icons/full/dlcl16/search_next.gif
deleted file mode 100644
index 6cbeced2629..00000000000
--- a/org.eclipse.search/icons/full/dlcl16/search_next.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/search_prev.gif b/org.eclipse.search/icons/full/dlcl16/search_prev.gif
deleted file mode 100644
index a3441a06280..00000000000
--- a/org.eclipse.search/icons/full/dlcl16/search_prev.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/search_rem.gif b/org.eclipse.search/icons/full/dlcl16/search_rem.gif
deleted file mode 100644
index 7e0ad4aed42..00000000000
--- a/org.eclipse.search/icons/full/dlcl16/search_rem.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/search_remall.gif b/org.eclipse.search/icons/full/dlcl16/search_remall.gif
deleted file mode 100644
index 7ace43e8a73..00000000000
--- a/org.eclipse.search/icons/full/dlcl16/search_remall.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/search_sortmatch.gif b/org.eclipse.search/icons/full/dlcl16/search_sortmatch.gif
deleted file mode 100644
index 8a47d61be8d..00000000000
--- a/org.eclipse.search/icons/full/dlcl16/search_sortmatch.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/search_stop.gif b/org.eclipse.search/icons/full/dlcl16/search_stop.gif
deleted file mode 100644
index 7f0f9b925f8..00000000000
--- a/org.eclipse.search/icons/full/dlcl16/search_stop.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/dtool16/search.gif b/org.eclipse.search/icons/full/dtool16/search.gif
deleted file mode 100644
index 5fe80f3fc6e..00000000000
--- a/org.eclipse.search/icons/full/dtool16/search.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/search_goto.gif b/org.eclipse.search/icons/full/elcl16/search_goto.gif
deleted file mode 100644
index d02e028054b..00000000000
--- a/org.eclipse.search/icons/full/elcl16/search_goto.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/search_history.gif b/org.eclipse.search/icons/full/elcl16/search_history.gif
deleted file mode 100644
index d1e6b85ecf4..00000000000
--- a/org.eclipse.search/icons/full/elcl16/search_history.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/search_next.gif b/org.eclipse.search/icons/full/elcl16/search_next.gif
deleted file mode 100644
index 1d0b40adc61..00000000000
--- a/org.eclipse.search/icons/full/elcl16/search_next.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/search_prev.gif b/org.eclipse.search/icons/full/elcl16/search_prev.gif
deleted file mode 100644
index 13729577c02..00000000000
--- a/org.eclipse.search/icons/full/elcl16/search_prev.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/search_rem.gif b/org.eclipse.search/icons/full/elcl16/search_rem.gif
deleted file mode 100644
index 310510ee588..00000000000
--- a/org.eclipse.search/icons/full/elcl16/search_rem.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/search_remall.gif b/org.eclipse.search/icons/full/elcl16/search_remall.gif
deleted file mode 100644
index 33908b12653..00000000000
--- a/org.eclipse.search/icons/full/elcl16/search_remall.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/search_sortmatch.gif b/org.eclipse.search/icons/full/elcl16/search_sortmatch.gif
deleted file mode 100644
index 336c0ec3d09..00000000000
--- a/org.eclipse.search/icons/full/elcl16/search_sortmatch.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/search_stop.gif b/org.eclipse.search/icons/full/elcl16/search_stop.gif
deleted file mode 100644
index a519f44d453..00000000000
--- a/org.eclipse.search/icons/full/elcl16/search_stop.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/etool16/search.gif b/org.eclipse.search/icons/full/etool16/search.gif
deleted file mode 100644
index 57ed3b4f6dd..00000000000
--- a/org.eclipse.search/icons/full/etool16/search.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/eview16/searchres.gif b/org.eclipse.search/icons/full/eview16/searchres.gif
deleted file mode 100644
index 7425e604f91..00000000000
--- a/org.eclipse.search/icons/full/eview16/searchres.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/obj16/searchm_obj.gif b/org.eclipse.search/icons/full/obj16/searchm_obj.gif
deleted file mode 100644
index 657b67e716e..00000000000
--- a/org.eclipse.search/icons/full/obj16/searchm_obj.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/obj16/tsearch_dpdn_obj.gif b/org.eclipse.search/icons/full/obj16/tsearch_dpdn_obj.gif
deleted file mode 100644
index e6be5623860..00000000000
--- a/org.eclipse.search/icons/full/obj16/tsearch_dpdn_obj.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/icons/full/obj16/tsearch_obj.gif b/org.eclipse.search/icons/full/obj16/tsearch_obj.gif
deleted file mode 100644
index 73ac91bddbc..00000000000
--- a/org.eclipse.search/icons/full/obj16/tsearch_obj.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/ngibmcpy2003.gif b/org.eclipse.search/ngibmcpy2003.gif
deleted file mode 100644
index c786e43e1f9..00000000000
--- a/org.eclipse.search/ngibmcpy2003.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.search/old_buildnotes_search_2.1.html b/org.eclipse.search/old_buildnotes_search_2.1.html
deleted file mode 100644
index 7822f778b7a..00000000000
--- a/org.eclipse.search/old_buildnotes_search_2.1.html
+++ /dev/null
@@ -1,3403 +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.75 [en] (WinNT; U) [Netscape]">
-
-
-
- <meta name="Author" content="IBM"><title>Eclipse Platform Release Notes - Search</title></head><body>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20030227
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2003%2F02%2F20&amp;chfieldto=2003%2F02%2F27&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2003/02/20 and 2003/02/27.<br>
-<br>
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20030220
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2003%2F02%2F18&amp;chfieldto=2003%2F02%2F20&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2003/02/18 and 2003/02/20.<br>
-<br>
-
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20030218
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2003%2F02%2F13&amp;chfieldto=2003%2F02%2F18&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2003/02/13 and 2003/02/18.<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20030213
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2003%2F02%2F11&amp;chfieldto=2003%2F02%2F13&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2003/02/11 and 2003/02/13.<br>
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20030211
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2003%2F02%2F07&amp;chfieldto=2003%2F02%2F11&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2003/02/07 and 2003/02/11.<br>
-<br>
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20030206
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2003%2F02%2F05&amp;chfieldto=2003%2F02%2F06&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2003/02/05 and 2003/02/06.<br>
-
-<br>
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20030205
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2003%2F01%2F28&amp;chfieldto=2003%2F02%2F05&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2003/01/28 and 2003/02/05.<br>
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20030128
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2003%2F01%2F21&amp;chfieldto=2003%2F01%2F28&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2003/01/21 and 2003/01/28.<br>
-<br>
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20030121
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2003%2F01%2F14&amp;chfieldto=2003%2F01%2F21&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2003/01/14 and 2003/01/21.<br>
-
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20030114
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2003%2F01%2F07&amp;chfieldto=2003%2F01%2F14&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2003/01/07 and 2003/01/14.<br>
-
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20030107
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F12%2F16&amp;chfieldto=2003%2F01%2F07&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/12/16 and 2003/01/07.<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20021216
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F12%2F13&amp;chfieldto=2002%2F12%2F16&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/12/13 and 2002/12/16.<br>
-
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20021213
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F12%2F10&amp;chfieldto=2002%2F12%2F13&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/12/10 and 2002/12/13.<br>
-<br>
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20021210
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F11%2F26&amp;chfieldto=2002%2F12%2F10&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/11/26 and 2002/12/10.<br>
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20021126
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F11%2F19&amp;chfieldto=2002%2F11%2F26&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/11/19 and 2002/11/26.<br>
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20021119
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F11%2F13&amp;chfieldto=2002%2F11%2F19&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/11/13 and 2002/11/19.
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20021113
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F11%2F12&amp;chfieldto=2002%2F11%2F13&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/11/12 and 2002/11/13.
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20021112
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F10%2F29&amp;chfieldto=2002%2F11%2F12&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/10/29 and 2002/11/12.
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20021029
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li>A default perspective can be configured for the Search view.<br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F10%2F15&amp;chfieldto=2002%2F10%2F29&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/10/15 and 2002/10/29.<br>
-<br>
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20021015
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F10%2F08&amp;chfieldto=2002%2F10%2F15&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/10/08 and 2002/10/15.<br>
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20021008
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F10%2F01&amp;chfieldto=2002%2F10%2F08&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/10/01 and 2002/10/08.<br>
-<br>
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20021001
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F09%2F19&amp;chfieldto=2002%2F10%2F01&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/09/19 and 2002/10/01.<br>
-<br>
-
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020919
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-
-<ul>
-<li>Added "openWith" context menu<br></li>
-</ul>
-
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F09%2F10&amp;chfieldto=2002%2F09%2F20&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/09/10 and 2002/09/19.<br>
-<br>
-<br>
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020910
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F09%2F03&amp;chfieldto=2002%2F09%2F10&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/09/03 and 2002/09/10.<br>
-<br>
-
-<br>
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020903
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F08%2F27&amp;chfieldto=2002%2F09%2F03&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/08/27 and 2002/09/03.<br>
-<br>
-
-<br>
-
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020827
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F08%2F20&amp;chfieldto=2002%2F08%2F27&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/08/20 and 2002/08/27.<br>
-
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020820
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-
-<ul>
-<li>Search view supports select all<br></li>
-</ul>
-
-
-
-<h2>Problem Reports</h2>
-
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F08%2F13&amp;chfieldto=2002%2F08%2F20&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/08/13 and 2002/08/20.<br>
-
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020813
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-
-<ul>
-<li><br></li>
-</ul>
-
-
-<h2>Problem Reports</h2>
-
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F07%2F23&amp;chfieldto=2002%2F08%2F13&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/07/23 and 2002/08/13.<br>
-
-<br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020723
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-
-<ul>
-
-<li>Removed all 2.0 build notes. They can be found in <a href="buildnotes_search_2_0.html">buildnotes_search_2_0.html</a><br></li>
-</ul>
-
-<h2>Problem Reports</h2>
-
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F06%2F29&amp;chfieldto=2002%2F07%2F23&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a> to see BRs which have been marked as RESOLVED or CLOSED between 2002/06/29 and 2002/07/23.<br>
-
-<br>
-
-<br>
-
-<a href="hglegal2003.htm"><img src="ngibmcpy2003.gif" border="0" height="14" width="324" alt="Copyright IBM Corporation and others 2000, 2003."></a>
-<br>
-
-<br>
-
-<br>
-
-<br>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-</body></html>
diff --git a/org.eclipse.search/old_buildnotes_search_2_0.html b/org.eclipse.search/old_buildnotes_search_2_0.html
deleted file mode 100644
index d36c4a7942c..00000000000
--- a/org.eclipse.search/old_buildnotes_search_2_0.html
+++ /dev/null
@@ -1,925 +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.75 [en] (WinNT; U) [Netscape]">
-
- <meta name="Author" content="IBM"><title>Eclipse Platform Release Notes - Search</title></head><body>
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020618
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li>Reverted File/Text search back to only ignore derived resoureces<br></li><li>Removed dependency on Team Support Core plug-in<br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F06%2F06&amp;chfieldto=2002%2F06%2F18&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/06/06 and 2002/06/18.<br>
-<br>
-<hr size="1" width="100%"><br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020606
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li>Reverted File/Text search back to only ignore derived resoureces<br>
-</li><li>Removed dependency on Team Support Core plug-in<br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F05%2F31&amp;chfieldto=2002%2F06%2F06&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/05/31 and 2002/06/06.<br>
-<br>
-<hr size="1" width="100%"><br>
-
-
-
-
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020531
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li>File search ignores derived and to be ignored resource (see Team preference page)</li><li>Text search ignores binary files<br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F05%2F28&amp;chfieldto=2002%2F05%2F31&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/05/28 and 2002/05/31.<br>
-<br>
-<hr size="1" width="100%">
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020528
-
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li><br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F05%2F21&amp;chfieldto=2002%2F05%2F28&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
-
-
-
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/05/21 and 2002/05/28.<br>
-<br>
-<hr size="1" width="100%"><br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020521
-
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li><br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F05%2F18&amp;chfieldto=2002%2F05%2F21&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
-
-
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/05/18 and 2002/05/21.<br>
-<br>
-<hr size="1" width="100%">
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020518
-
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li>Global menu for Search actions</li><li>Replace is now available on text search results<br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F05%2F14&amp;chfieldto=2002%2F05%2F18&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
-
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/05/14 and 2002/05/18.<br>
-<br>
-<hr size="1" width="100%">
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020514
-
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li><br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F05%2F08&amp;chfieldto=2002%2F05%2F14&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/05/08 and 2002/05/14.<br>
-<br>
-<hr size="1" width="100%"><br>
-
-
-
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020508
-
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li>The visible search pages can be configured in the Search dialog.<br>
-</li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F04%2F30&amp;chfieldto=2002%2F05%2F08&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/04/30 and 2002/05/08.<br>
-<br>
-<hr size="1" width="100%"><br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020430
-
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li>Removed the deprecated working set API</li><li>Search dialog no longer reserves space for scope for all pages but only those that require it<br></li>
-
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F04%2F23&amp;chfieldto=2002%2F04%2F30&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/04/23 and 2002/04/30.<br>
-<br>
-<hr size="1" width="100%"><br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020423
-
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li><br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F04%2F19&amp;chfieldto=2002%2F04%2F23&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/04/18 and 2002/04/23.<br>
-<br>
-<hr size="1" width="100%">
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
-
-
- Eclipse Build Input 20020418
-
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li><br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F04%2F16&amp;chfieldto=2002%2F04%2F19&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/04/16 and 2002/04/18.<br>
-<br>
-<hr size="1" width="100%">
-
-
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
- Eclipse Build Input 20020416
-
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li>Search no longer uses its own implementation of working sets but takes
-advantage of the workbench working set support. As a consequence you will
-have to redefine your existing working sets.<br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F04%2F11&amp;chfieldto=2002%2F04%2F17&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/04/11 and 2002/04/16.<br>
-<br>
-<hr size="1" width="100%"><br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
-
-
- Eclipse Build Input 20020411
-
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li><br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F04%2F09&amp;chfieldto=2002%2F04%2F12&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/04/09
-and 2002/04/11.<br>
-<br>
-<hr size="1" width="100%"><br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
-
-
- Eclipse Build Input 20020409
-
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li><i>Text Search</i> has been changed to <i>File Search</i> and now allows to search for files with a given file name pattern.<br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F04%2F02&amp;chfieldto=2002%2F04%2F09&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/04/02
-and 2002/04/09.<br>
-<br>
-<hr size="1" width="100%"><br>
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
-
- Eclipse Build Input 20020402
-
-
-<h2> What's new in this drop</h2>
-<ul>
-<li><br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F03%2F19&amp;chfieldto=2002%2F03%2F26&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/03/26
-and 2002/04/02.<br>
-<br>
-<hr size="1" width="100%"><br>
-
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
- Eclipse Build Input 20020326
-
-<h2> What's new in this drop</h2>
-<ul>
-<li>Text search also finds matches in dirty editors.<br></li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F03%2F26&amp;chfieldto=2002%2F04%2F02&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
-
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/03/19
-and 2002/03/26.<br>
-<br>
-<hr size="1" width="100%"><br>
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
-
- Eclipse Build Input 20020226
-<h2> What's new in this drop</h2>
-<ul>
- <li>Previous file name patterns are now available through a combo box.</li>
- <li>The file name pattern is only derived the first time from the selection
-and after that the previous value is used to initialize the field.<br>
- </li>
-</ul>
-<h2>Problem Reports</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F02%2F14&amp;chfieldto=2002%2F02%2F26&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/02/14
-and 2002/02/26.<br>
-<br>
-<hr size="1" width="100%"><br>
-<br>
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
- Eclipse Build Input 20020214
-<h2> What's new in this drop</h2>
-
-<ul>
- <li>Reuse of editors when stepping through search matches now managed
-by platform and no longer directly by the Search plug-in.<br>
- </li>
-
-</ul>
-
-<h2>Problem Reports</h2>
- <a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&amp;bug_status=CLOSED&amp;chfield=bug_status&amp;chfieldfrom=2002%2F02%2F05&amp;chfieldto=2002%2F02%2F14&amp;product=Platform&amp;component=Search&amp;cmdtype=doit&amp;&amp;order=Bug+Number">
- Click here</a>
- to see BRs which have been marked as RESOLVED or CLOSED between 2002/02/05
-and 2002/02/14.<br>
- <br>
-
-<hr size="1" width="100%"><br>
-
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
- Eclipse Integration Build 20020205
-<h2> What's new in this drop</h2>
-
-<h3> API changes</h3>
-
-<h3> API additions</h3>
-
-<h3> Other highlights</h3>
-
-<h2> Known deficiencies</h2>
-
-<h2> Problem reports fixed</h2>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8611">8611</a>
- NPE in text search with Compare to a Version editor open<br>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=9007">9007</a>
- Working Set; OK button not disabled<br>
-
-<h2> Problem reports closed</h2>
-
-<hr size="1" width="100%"><br>
-
-<h1> Eclipse Platform Build Notes<br>
- Search</h1>
- Eclipse Integration Build 20020129
-<h2>What's new in this drop</h2>
-
-<ul>
- <li>A new attribute called <i>showScopeSection</i> has been added to
- the markup language for Search pages. If this attribute is missing or set
- to <tt>false</tt> then the scope section is not shown in the Search dialog.
- To see the scope section this attribute has to be set to <tt>true</tt>
-. Plug-ins which add their own Search page and want to see the scope section
- will have to add the new attribute to their plugin.xml</li>
-
-</ul>
-
-<h3> API changes</h3>
-
-<ul>
- <li>Activation of the Search view has been moved from the dialog to
-the individual Search page. Plug-ins which want the Search page to appear
- when Search is invoked have to call <tt>SearchUI.activateSearchResultView()</tt><br>
- </li>
-
-</ul>
-
-<h3> API additions</h3>
-
-<h3> Other highlights</h3>
-
-<h2> Known deficiencies</h2>
-
-<h2> Problem reports fixed</h2>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7918">7918</a>
- Missing busy cursor in search dialog when flipping pages<br>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7919">7919</a>
- Search: scope section doesn't apply to Help search<br>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8024">8024</a>
- SearchResultsView opens without calling SearchUI.activateSearchView<br>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8025">8025</a>
- Scope section added to ISearchPage<br>
-
-<h2> Problem reports closed</h2>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=8456">8456</a>
- Widget is disposed error in Search<br>
- <br>
- <br>
-
-<hr size="1" width="100%">
-<h1>Eclipse Platform Build Notes<br>
- Search</h1>
- Eclipse Integration Build 20020122
-<h2> What's new in this drop</h2>
-
-<h3> API changes</h3>
-
-<h3> API additions</h3>
-
-<h3> Other highlights</h3>
-
-<h2> Known deficiencies</h2>
-
-<h2> Problem reports fixed</h2>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=7813">7813</a>
- NPE in SearchPageDescriptor.readExtensionScorePairs/StringTo<br>
-
-<h2> Problem reports closed</h2>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=4066">4066</a>
- Default extension in text search is often wrong (1GHFMPL)<br>
- <br>
-
-<hr size="1" width="100%">
-<h1> Eclipse Platform Build Notes<br>
- Search</h1>
- Eclipse Integration Build 20011218
-<h2> What's new in this drop</h2>
-
-<h3> API changes</h3>
-
-<h3> API additions</h3>
-
-<h3> Other highlights</h3>
- APIs added for 2.0 are now flagged with <b>@since 2.0</b>.
-
-<h2> Known deficiencies</h2>
-
-<h2> Problem reports fixed</h2>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6836">6836</a>
- Working Sets Dialog: Mnemonics, issues
-<hr size="1" width="100%">
-<h1> Eclipse Platform Build Notes<br>
- Search</h1>
- Eclipse Integration Build 20011211
-<h2> What's new in this drop</h2>
-
-<h3> API changes</h3>
-
-<h3> API additions</h3>
-
-<h3> Other highlights</h3>
-
-<h2> Known deficiencies</h2>
-
-<h2> Problem reports fixed</h2>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5868">5868</a>
- Define working set does too much work in the UI thread <br>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5620">5620</a>
- Search: control keys for navigating the list of search results
-
-<hr size="1" width="100%">
-<h1> Eclipse Platform Build Notes<br>
- Search</h1>
- Eclipse Integration Build 20011206
-<h2> What's new in this drop</h2>
-
-<h3> API changes</h3>
-
-<h3> API additions</h3>
-
-<h3> Other highlights</h3>
-
-<h2> Known deficiencies</h2>
-
-<h2> Problem reports fixed</h2>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6119">6119</a>
- cannot delete a working set <br>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6264">6264</a>
- Search results don't have initial selection
-<hr size="1" width="100%">
-<h1> Eclipse Platform Build Notes<br>
- Search</h1>
- Eclipse Integration Build 20011204
-<h2> What's new in this drop</h2>
-
-<h3> API changes</h3>
-
-<h3> API additions</h3>
-
-<h3> Other highlights</h3>
-
-<h2> Known deficiencies</h2>
-
-<h2> Problem reports fixed</h2>
- <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=3954">3954</a>
- Search dialog does not need parentheses around label (1GF86BN)
-<br>
- <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=6435">6435</a>
- Search again should move search to top of MRU list
-<hr size="1" width="100%">
-<h1> Eclipse Platform Build Notes<br>
- Search</h1>
- Note: Previous build notes have been included in <i>Eclipse Platform
- Build Notes - Java Development Tooling UI.</i><br>
- &nbsp;
-</body></html> \ No newline at end of file
diff --git a/org.eclipse.search/plugin.properties b/org.eclipse.search/plugin.properties
deleted file mode 100644
index f8e4c8ba326..00000000000
--- a/org.eclipse.search/plugin.properties
+++ /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
-###############################################################################
-
-pluginName= Search Support
-providerName= Eclipse.org
-
-searchMarker= Search Marker
-
-searchPages= Search Pages
-searchResultSorters= Search Result Sorters
-
-search= Search
-
-searchMenu.label= Se&arch
-openFileSearchPageAction.label= &File...
-
-openSearchDialogAction.label= Se&arch...
-openSearchDialogAction.tooltip= Search
-
-fileSearch= File Search
-searchResultViewName= Search
-
-ResourcenameSorter.label= &Name
-ResourcenameSorter.tooltip= Sort by Resource Name
-ResourcePathSorter.label= &Path
-ResourcePathSorter.tooltip= Sort by Resource Path
-
-SearchPreferencePage.label= Search
-
-ActionDefinition.openSearchDialog.name= Open Search Dialog
-ActionDefinition.openSearchDialog.description= Open the Search dialog
-
-ActionDefinition.openFileSearchPage.name= File Search
-ActionDefinition.openFileSearchPage.description= Open the Search dialog\'s file search page
-
-SearchMarkerPreference.label= Search Results
-
-searchCategory.name= Search
-searchCategory.description= Search command category
diff --git a/org.eclipse.search/plugin.xml b/org.eclipse.search/plugin.xml
deleted file mode 100644
index 01dfc641454..00000000000
--- a/org.eclipse.search/plugin.xml
+++ /dev/null
@@ -1,212 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-
-<!-- ======================================================================= -->
-<!-- Search Plugin -->
-<!-- ======================================================================= -->
-<plugin
- name="%pluginName"
-
- id="org.eclipse.search"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.search.internal.ui.SearchPlugin">
-
- <requires>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.core.filebuffers"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.ui.ide"/>
- <import plugin="org.eclipse.ui.workbench.texteditor"/>
- <import plugin="org.eclipse.jface.text"/>
- <import plugin="org.eclipse.ui.editors"/>
- <import plugin="org.eclipse.core.runtime.compatibility" optional="true"/>
- </requires>
-
- <runtime>
- <library name="search.jar" >
- <export name = "*"/>
- <packages prefixes="org.eclipse.search.ui,org.eclipse.search.internal"/>
- </library>
- </runtime>
-
-
- <!-- Search extension point definitions -->
-
- <extension-point name="%searchPages" id="searchPages" schema="schema/searchPages.exsd"/>
- <extension-point name="%searchResultSorters" id="searchResultSorters" schema="schema/searchResultSorters.exsd"/>
-
-
- <!-- Extensions -->
-
- <extension point="org.eclipse.core.resources.markers" id="searchmarker" name="%searchMarker">
- <super type="org.eclipse.core.resources.textmarker"/>
- <attribute name="line"/>
- <attribute name="potentialMatch"/>
- </extension>
-
- <extension
- point="org.eclipse.ui.ide.markerImageProviders">
- <imageprovider
- id="org.eclipse.ui.searchMarkerProvider"
- markertype="org.eclipse.search.searchmarker"
- icon="icons/full/obj16/searchm_obj.gif">
- </imageprovider>
- </extension>
-
- <!-- commands and their bindings -->
- <extension point="org.eclipse.ui.commands">
- <category
- name="%searchCategory.name"
- description="%searchCategory.description"
- id="org.eclipse.search.ui.category.search"
- />
-
- <command
- category="org.eclipse.search.ui.category.search"
- id="org.eclipse.search.ui.openSearchDialog"
- name= "%ActionDefinition.openSearchDialog.name"
- description="%ActionDefinition.openSearchDialog.description"
- />
- <keyBinding
- string="Ctrl+H"
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.search.ui.openSearchDialog"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration"
- />
-
- <command
- category="org.eclipse.search.ui.category.search"
- id="org.eclipse.search.ui.openFileSearchPage"
- name= "%ActionDefinition.openFileSearchPage.name"
- description="%ActionDefinition.openFileSearchPage.description"
- />
- <keyBinding
- string=""
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.search.ui.openFileSearchPage"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration"
- />
- </extension>
-
- <!-- action sets -->
- <extension point="org.eclipse.ui.actionSets">
- <actionSet
- id="org.eclipse.search.searchActionSet"
- label="%search"
- visible="true">
-
- <!-- =================================================================== -->
- <!-- Search Menu -->
- <!-- =================================================================== -->
-
- <menu
- id="org.eclipse.search.menu"
- label="%searchMenu.label"
- path="navigate">
- <groupMarker name="internalDialogGroup"/> <!-- not to be used by clients -->
- <groupMarker name="dialogGroup"/> <!-- to be used by clients -->
- <separator name="contextMenuActionsGroup"/>
- </menu>
-
- <!-- dialog group -->
- <action id="org.eclipse.search.OpenFileSearchPage"
- definitionId="org.eclipse.search.ui.openFileSearchPage"
- menubarPath="org.eclipse.search.menu/internalDialogGroup"
- label="%openFileSearchPageAction.label"
- icon="icons/full/obj16/tsearch_obj.gif"
- helpContextId="file_search_action_context"
- class="org.eclipse.search.internal.ui.OpenFileSearchPageAction"/>
-
- <action id="org.eclipse.search.OpenSearchDialog"
- definitionId="org.eclipse.search.ui.openSearchDialog"
- toolbarPath="Normal/Search"
- menubarPath="org.eclipse.search.menu/internalDialogGroup"
- label="%openSearchDialogAction.label"
- tooltip="%openSearchDialogAction.tooltip"
- icon="icons/full/ctool16/search.gif"
- helpContextId="open_search_dialog_action_context"
- class="org.eclipse.search.internal.ui.OpenSearchDialogAction"/>
- </actionSet>
- </extension>
-
- <extension point="org.eclipse.ui.views">
- <view
- id="org.eclipse.search.SearchResultView"
- name="%searchResultViewName"
- category="org.eclipse.ui"
- class="org.eclipse.search.internal.ui.SearchResultView"
- icon="icons/full/cview16/searchres.gif">
- </view>
- </extension>
-
- <extension point="org.eclipse.search.searchPages">
- <page
- id="org.eclipse.search.internal.ui.text.TextSearchPage"
- label="%fileSearch"
- icon="icons/full/obj16/tsearch_obj.gif"
- sizeHint="250,160"
- tabPosition="1"
- extensions="*:1"
- showScopeSection="true"
- canSearchEnclosingProjects="true"
- class="org.eclipse.search.internal.ui.text.TextSearchPage">
- </page>
- </extension>
-
- <extension point="org.eclipse.search.searchResultSorters">
- <sorter
- id="org.eclipse.search.internal.ui.ResourcenameSorter"
- pageId="org.eclipse.search.internal.ui.text.TextSearchPage"
- label="%ResourcenameSorter.label"
- tooltip="%ResourcenameSorter.tooltip"
- icon="icons/full/clcl16/search_sortmatch.gif"
- class="org.eclipse.search.internal.ui.text.ResourcenameSorter">
- </sorter>
- <sorter
- id="org.eclipse.search.internal.ui.ResourcePathSorter"
- pageId="org.eclipse.search.internal.ui.text.TextSearchPage"
- label="%ResourcePathSorter.label"
- tooltip="%ResourcePathSorter.tooltip"
- icon="icons/full/clcl16/search_sortmatch.gif"
- class="org.eclipse.search.internal.ui.text.ResourcePathSorter">
- </sorter>
- </extension>
-
- <extension
- point="org.eclipse.ui.preferencePages">
- <page name="%SearchPreferencePage.label"
- id="org.eclipse.search.preferences.SearchPreferencePage"
- class="org.eclipse.search.internal.ui.SearchPreferencePage"
- category="org.eclipse.ui.preferencePages.Workbench">
- </page>
- </extension>
-
- <extension
- point="org.eclipse.ui.editors.markerAnnotationSpecification">
- <specification
- annotationType="org.eclipse.search.results"
- label="%SearchMarkerPreference.label"
- icon="icons/full/obj16/searchm_obj.gif"
- markerType="org.eclipse.search.searchmarker"
- textPreferenceKey="searchResultIndication"
- textPreferenceValue="true"
- highlightPreferenceKey="searchResultHighlighting"
- highlightPreferenceValue="false"
- overviewRulerPreferenceKey="searchResultIndicationInOverviewRuler"
- overviewRulerPreferenceValue="true"
- verticalRulerPreferenceKey="searchResultIndicationInVerticalRuler"
- verticalRulerPreferenceValue="true"
- colorPreferenceKey="searchResultIndicationColor"
- colorPreferenceValue="192,192,192"
- presentationLayer="3"
- showInNextPrevDropdownToolbarActionKey="showSearchResultInNextPrevDropdownToolbarAction"
- showInNextPrevDropdownToolbarAction="true"
- isGoToNextNavigationTargetKey="isSearchResultGoToNextNavigationTarget"
- isGoToNextNavigationTarget="false"
- isGoToPreviousNavigationTargetKey="isSearchResultGoToPreviousNavigationTarget"
- isGoToPreviousNavigationTarget="false">
- </specification>
- </extension>
-
-</plugin> \ No newline at end of file
diff --git a/org.eclipse.search/schema/searchPages.exsd b/org.eclipse.search/schema/searchPages.exsd
deleted file mode 100644
index 71f901c9fdd..00000000000
--- a/org.eclipse.search/schema/searchPages.exsd
+++ /dev/null
@@ -1,234 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.search">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.search" id="searchPages" name="Search Pages"/>
- </appInfo>
- <documentation>
- This extension point allows a plug-in to register search
-pages for specialized searches. When the search action
-is performed on a resource, the search infrastructure
-locates the most specific registered search page for it.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="page" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="page">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="label" icon="icon"/>
- </appInfo>
- </annotation>
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique name that will be used to identify this
-search page
- </documentation>
- </annotation>
- </attribute>
- <attribute name="label" type="string" use="required">
- <annotation>
- <documentation>
- a translatable label that will be used in the search
-page tab
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- a name of the class which implements &lt;samp&gt;org.eclipse.search.ui.ISearchPage&lt;/samp&gt;. We recommend subclassing
-&lt;samp&gt;org.eclipse.jface.dialogs.DialogPage&lt;/samp&gt;.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.jface.dialogs.DialogPage:org.eclipse.search.ui.ISearchPage"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="icon" type="string">
- <annotation>
- <documentation>
- a relative name of the image that will be used
-for all resources that match the specified extensions.
-If omitted, the search page&apos;s tab will only contain a label.
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="sizeHint" type="string">
- <annotation>
- <documentation>
- a hint for the initial size of the page. This is a string
-containing the width and height separated by
-comma (e.g. &quot;50, 60&quot;). In the case this hint is
-omitted the page will be no larger than the other pages.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="tabPosition" type="string">
- <annotation>
- <documentation>
- an integer defining where the page is placed in the page
-book. The value does not define the absolute position
-but the position relative to the other pages. The ordering
-of pages is as follows:
-&lt;ol&gt;
-&lt;li&gt;
-if neither page defines the tab position then they are
-ordered alphabetically according to their labels
-&lt;/li&gt;
-&lt;li&gt;
-if both pages have the tab position specified then the
-page with the lower value comes first. If the values
-are equal then the pages are treated as if the values
-would not exist (see 1.)
-&lt;/li&gt;
-&lt;li&gt;
-if only one page has the value specified then this
-page comes first
-&lt;/ol&gt;
- </documentation>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string">
- <annotation>
- <documentation>
- a comma separated list with file extensions on which
-the search page can operate. Each extension must
-also include a weight (0 meaning lowest weight)
-which enables the search infrastructure to find the
-best fitting page. The weight is separated from
-the extension by a colon. If a search page can
-search all possible resources then &quot;*&quot; can be used.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="searchViewHelpContextId" type="string">
- <annotation>
- <documentation>
- an optional help context ID of the Search view displaying results of this page. If this attribute is missing then the default search help context ID (&lt;samp&gt;org.eclipse.search.search_view_context&lt;/samp&gt;) is used.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="showScopeSection" type="boolean">
- <annotation>
- <documentation>
- If this attribute is missing or set to &quot;false&quot;, then the scope section is not shown in the Search dialog.
-To see the scope section, this attribute has to be set to &quot;true&quot;.
-Plug-ins which add their own Search page and want to see the scope section have to add this to their plugin.xml.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="enabled" type="boolean">
- <annotation>
- <documentation>
- If this attribute is missing or set to &quot;false&quot;, then the page is not initially shown in the Search dialog.
-The page can be activated by the user via the &quot;Customize...&quot; button on the Search dialog.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="canSearchEnclosingProjects" type="boolean">
- <annotation>
- <documentation>
- If this attribute is missing or set to &quot;false&quot;, the &quot;Enclosing Projects&quot; search scope is not shown in the search dialog&apos;s scope part.
-If the attribute &quot;showScopeSection&quot; is missing or set to &quot;false&quot;, this attribute will be ignored.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a search page extension
-definition:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.search.searchPages&quot;&gt;
- &lt;page
- id=&quot;org.eclipse.search.ui.text.TextSearchPage&quot;
- label=&quot;Text Search&quot;
- icon=&quot;icons/full/obj16/tsearch_pref.gif&quot;
- sizeHint=&quot;250,160&quot;
- tabPosition=&quot;1&quot;
- extensions=&quot;*:1&quot;
- showScopeSection=&quot;true&quot;
- class=&quot;org.eclipse.search.ui.text.TextSearchPage&quot;&gt;
- &lt;/page&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The search infrastructure provides a search page
-for full-text search.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.search/schema/searchResultSorters.exsd b/org.eclipse.search/schema/searchResultSorters.exsd
deleted file mode 100644
index 8959ebe79ba..00000000000
--- a/org.eclipse.search/schema/searchResultSorters.exsd
+++ /dev/null
@@ -1,165 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.search">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.search" id="searchResultSorters" name="Result Sorters"/>
- </appInfo>
- <documentation>
- This extension point allows a plug-in to contribute
-search result sorters to the search result view&apos;s Sort
-context menu.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="sorter" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="sorter">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="label" icon="icon"/>
- </appInfo>
- </annotation>
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique name that will be used to identify this search result sorter.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="pageId" type="string" use="required">
- <annotation>
- <documentation>
- the ID of a registered search page for which the
-sorter will be activated. &quot;*&quot; activates the sorter
-for all pages.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="label" type="string" use="required">
- <annotation>
- <documentation>
- a translatable label that will be used as the
-menu item&apos;s label.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="tooltip" type="string">
- <annotation>
- <documentation>
- a translatable text that will be used as the menu
-item&apos;s tool tip . If omitted, the menu item will
-have no tool tip.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="icon" type="string">
- <annotation>
- <documentation>
- a relative name of the image that will be shown in
-the context menu along with the label. If omitted,
-the menu entry will only contain a label.
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- a name of the class that extends &lt;samp&gt;org.eclipse.jface.viewers.ViewerSorter&lt;/samp&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.jface.viewers.ViewerSorter"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a search page extension definition:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.search.searchResultSorters&quot;&gt;
- &lt;sorter
- id=&quot;org.eclipse.search.internal.ui.FileNameSorter&quot;
- pageId=&quot;*&quot;
- label=&quot;%FileNameSorter.label&quot;
- tooltip=&quot;%FilenNameSorter.tooltip&quot;
- icon=&quot;icons/full/ecl16/search_sort.gif&quot;
- class=&quot;org.eclipse.search.internal.ui.FileNameSorter&quot;&gt;
- &lt;/sorter&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The search infrastructure provides a sorter that sorts
-the matches by the resource name.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.search/scripts/exportplugin.xml b/org.eclipse.search/scripts/exportplugin.xml
deleted file mode 100644
index a7840c24ab5..00000000000
--- a/org.eclipse.search/scripts/exportplugin.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<project name="org.eclipse.search" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.search" />
- <property name="version" value="_3.0.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}/search.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <copy todir="${dest}/icons">
- <fileset dir="icons" />
- </copy>
- <zip zipfile="${dest}/searchsrc.zip">
- <fileset dir="search" />
- </zip>
- </target>
-</project>
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/ISearchScope.java b/org.eclipse.search/search/org/eclipse/search/internal/core/ISearchScope.java
deleted file mode 100644
index 1400e4a06e2..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/ISearchScope.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.search.internal.core;
-
-import org.eclipse.core.resources.IResourceProxy;
-
-/**
- * Defines a scope to which search results are limited.
- */
-public interface ISearchScope {
-
- /**
- * Checks whether the given element is enclosed by
- * this scope or not.
- *
- * @param element the resource proxy to be checked
- * @return <code>true</code> if the resource is inside the search scope
- *
- */
- public boolean encloses(IResourceProxy element);
-
- /**
- * Returns a human readable description of this scope
- *
- * @return the description of this scope as <code>String</code>
- *
- */
- public String getDescription();
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/SearchScope.java b/org.eclipse.search/search/org/eclipse/search/internal/core/SearchScope.java
deleted file mode 100644
index 315abd9318a..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/SearchScope.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.search.internal.core;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.jface.util.Assert;
-
-/**
- * A default implementation of <code>ISearchScope</code>.
- */
-public class SearchScope implements ISearchScope {
-
- private List fElements;
- private String fDescription;
-
- public SearchScope(String description) {
- Assert.isNotNull(description);
- fDescription= description;
- fElements= new ArrayList(5);
- }
-
- public SearchScope(String description, IResource[] resources) {
- Assert.isNotNull(description);
- int resourceCount= resources.length;
- fDescription= description;
- fElements= new ArrayList(resourceCount + 5);
- for (int i= 0; i < resourceCount; i++)
- fElements.add(resources[i]);
- }
-
- public void setDescription(String description) {
- Assert.isNotNull(description);
- fDescription= description;
- }
-
- /*
- * @see ISearchScope#add(IResource)
- */
- public void add(IResource element) {
- fElements.add(element);
- }
-
- /*
- * Implements method from ISearchScope
- */
- public boolean encloses(IResourceProxy proxy) {
- IPath elementPath= proxy.requestFullPath();
- Iterator iter= elements();
- while (iter.hasNext()) {
- IResource resource= (IResource)iter.next();
- if (resource.getFullPath().isPrefixOf(elementPath))
- return true;
- }
- return false;
- }
-
- /*
- * Implements method from ISearchScope
- */
- public String getDescription() {
- return fDescription;
- }
-
- /**
- * Returns the search scope elements
- */
- protected Iterator elements() {
- return fElements.iterator();
- }
-
- /**
- * Implements method from ISearchScope
- *
- * @deprecated as of 2.1 use @link #encloses(IResourceProxy)
- */
- public boolean encloses(IResource element) {
- IPath elementPath= element.getFullPath();
- Iterator iter= elements();
- while (iter.hasNext()) {
- IResource resource= (IResource)iter.next();
- if (resource.getFullPath().isPrefixOf(elementPath))
- return true;
- }
- return false;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/AmountOfWorkCalculator.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/AmountOfWorkCalculator.java
deleted file mode 100644
index 5a200092353..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/AmountOfWorkCalculator.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.search.internal.core.text;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.MultiStatus;
-
-import org.eclipse.search.internal.core.ISearchScope;
-
-/**
- * The visitor that does the actual work.
- */
-public class AmountOfWorkCalculator extends TypedResourceVisitor {
- private ISearchScope fScope;
- private int fResult;
-
- AmountOfWorkCalculator(MultiStatus status) {
- super(status);
- }
-
- protected boolean visitFile(IResourceProxy proxy) throws CoreException {
- if (fScope.encloses(proxy) && !proxy.isDerived())
- fResult++;
- return true;
- }
-
- public int process(Collection projects, ISearchScope scope) {
- fResult= 0;
- fScope= scope;
-
- Iterator i= projects.iterator();
- while(i.hasNext()) {
- IProject project= (IProject)i.next();
- int save= fResult;
- try {
- project.accept(this, IResource.NONE);
- } catch (CoreException ex) {
- addToStatus(ex);
- }
- // Project doesn't contain any files that are in scope
- if (save == fResult)
- i.remove();
- }
-
- return fResult;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/ITextSearchResultCollector.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/ITextSearchResultCollector.java
deleted file mode 100644
index e2caed1e5ae..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/ITextSearchResultCollector.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.search.internal.core.text;
-
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public interface ITextSearchResultCollector {
-
- /**
- * Returns the progress monitor used to setup and report progress.
- */
- public IProgressMonitor getProgressMonitor();
-
- /**
- * Called before the actual search starts.
- */
- public void aboutToStart() throws CoreException;
-
- /**
- * Accepts the given search result.
- * @param resource proxy the resource proxy in which the match has been found.
- * @param line the line containing the match
- * @param int start position from the beginning of the file. Start position
- * is zero based.
- * @param length the length of the match.
- * @param lineNumber the line number of the match.
- */
- public void accept(IResourceProxy proxy, String line, int start, int length, int lineNumber) throws CoreException;
-
- /**
- * Called when the search has ended.
- */
- public void done() throws CoreException;
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/MatchLocator.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/MatchLocator.java
deleted file mode 100644
index 9d77f53f612..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/MatchLocator.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.core.text;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.search.internal.ui.SearchMessages;
-
-/**
- * A class finding matches withing a file.
- * @since 3.0
- */
-public class MatchLocator {
-
- protected static final int fgLF= '\n';
- protected static final int fgCR= '\r';
-
- private Matcher fMatcher;
- protected int fPushbackChar;
- protected boolean fPushback;
- private String fPattern;
- private boolean fIsRegEx;
-
- public MatchLocator(String pattern, String options) {
- fPattern= pattern;
- Pattern regExPattern;
-
- fIsRegEx= options.indexOf('r') != -1;
- if (!isRegExSearch())
- pattern= asRegEx(pattern);
-
- if (options.indexOf('i') != -1)
- regExPattern= Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
- else
- regExPattern= Pattern.compile(pattern);
-
- fMatcher= regExPattern.matcher(""); //$NON-NLS-1$
-
- }
-
- public boolean isEmtpy() {
- return getPattern().length() == 0;
- }
-
- public String getPattern() {
- return fPattern;
- }
-
- public void locateMatches(IProgressMonitor monitor, IResourceProxy proxy, Reader reader, ITextSearchResultCollector collector) throws CoreException, IOException {
- int lineCounter= 1;
- int charCounter=0;
- boolean eof= false;
- try {
- while (!eof) {
- StringBuffer sb= new StringBuffer(200);
- int eolStrLength= readLine(reader, sb);
- int lineLength= sb.length();
- int start= 0;
- eof= eolStrLength == -1;
- String line= sb.toString();
- while (start < lineLength) {
- fMatcher.reset(line);
- if (fMatcher.find(start)) {
- start= charCounter + fMatcher.start();
- int length= fMatcher.end() - fMatcher.start();
- collector.accept(proxy, line.trim(), start, length, lineCounter);
- start= fMatcher.end();
- }
- else // no match in this line
- start= lineLength;
- }
- charCounter+= lineLength + eolStrLength;
- lineCounter++;
- if (monitor.isCanceled())
- throw new OperationCanceledException(SearchMessages.getString("TextSearchVisitor.canceled")); //$NON-NLS-1$
- }
- } finally {
- if (reader != null)
- reader.close();
- }
- }
-
- /*
- * Converts '*' and '?' to regEx variables.
- */
- private String asRegEx(String pattern) {
-
- StringBuffer out= new StringBuffer(pattern.length());
-
- boolean escaped= false;
- boolean quoting= false;
-
- int i= 0;
- while (i < pattern.length()) {
- char ch= pattern.charAt(i++);
-
- if (ch == '*' && !escaped) {
- if (quoting) {
- out.append("\\E"); //$NON-NLS-1$
- quoting= false;
- }
- out.append(".*"); //$NON-NLS-1$
- escaped= false;
- continue;
- } else if (ch == '?' && !escaped) {
- if (quoting) {
- out.append("\\E"); //$NON-NLS-1$
- quoting= false;
- }
- out.append("."); //$NON-NLS-1$
- escaped= false;
- continue;
- } else if (ch == '\\' && !escaped) {
- escaped= true;
- continue;
-
- } else if (ch == '\\' && escaped) {
- escaped= false;
- if (quoting) {
- out.append("\\E"); //$NON-NLS-1$
- quoting= false;
- }
- out.append("\\\\"); //$NON-NLS-1$
- continue;
- }
-
- if (!quoting) {
- out.append("\\Q"); //$NON-NLS-1$
- quoting= true;
- }
- if (escaped && ch != '*' && ch != '?' && ch != '\\')
- out.append('\\');
- out.append(ch);
- escaped= ch == '\\';
-
- }
- if (quoting)
- out.append("\\E"); //$NON-NLS-1$
-
- return out.toString();
- }
-
- protected int readLine(Reader reader, StringBuffer sb) throws IOException {
- int ch= -1;
- if (fPushback) {
- ch= fPushbackChar;
- fPushback= false;
- }
- else
- ch= reader.read();
- while (ch >= 0) {
- if (ch == fgLF)
- return 1;
- if (ch == fgCR) {
- ch= reader.read();
- if (ch == fgLF)
- return 2;
- else {
- fPushbackChar= ch;
- fPushback= true;
- return 1;
- }
- }
- sb.append((char)ch);
- ch= reader.read();
- }
- return -1;
- }
-
- public boolean isRegExSearch() {
- return fIsRegEx;
- }
-
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngine.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngine.java
deleted file mode 100644
index 55a3a5f56e3..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngine.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.search.internal.core.text;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.search.ui.SearchUI;
-
-import org.eclipse.search.internal.core.ISearchScope;
-import org.eclipse.search.internal.ui.SearchMessages;
-
-public class TextSearchEngine {
-
- /**
- * Search for the given pattern.
- */
- public IStatus search(IWorkspace workspace, ISearchScope scope, ITextSearchResultCollector collector, MatchLocator matchLocator) {
- Assert.isNotNull(workspace);
- Assert.isNotNull(scope);
- Assert.isNotNull(collector);
- Assert.isNotNull(matchLocator);
- IProgressMonitor monitor= collector.getProgressMonitor();
-
- IProject[] projects= workspace.getRoot().getProjects();
- Collection openProjects= new ArrayList(10);
- for (int i= 0; i < projects.length; i++) {
- IProject project= projects[i];
- if (project.isOpen())
- openProjects.add(project);
- }
- String message= SearchMessages.getString("TextSearchEngine.statusMessage"); //$NON-NLS-1$
- MultiStatus status= new MultiStatus(SearchUI.PLUGIN_ID, IStatus.OK, message, null);
- if (!openProjects.isEmpty()) {
- int amountOfWork= (new AmountOfWorkCalculator(status)).process(openProjects, scope);
- try {
- monitor.beginTask("", amountOfWork); //$NON-NLS-1$
- if (amountOfWork > 0) {
- Integer[] args= new Integer[] {new Integer(1), new Integer(amountOfWork)};
- monitor.setTaskName(SearchMessages.getFormattedString("TextSearchEngine.scanning", args)); //$NON-NLS-1$
- }
- collector.aboutToStart();
- TextSearchVisitor visitor= new TextSearchVisitor(matchLocator, scope, collector, status, amountOfWork);
- visitor.process(openProjects);
- } catch (CoreException ex) {
- status.add(ex.getStatus());
- } finally {
- monitor.done();
- try {
- collector.done();
- } catch (CoreException ex) {
- status.add(ex.getStatus());
- }
- }
- }
- return status;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchScope.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchScope.java
deleted file mode 100644
index 5b2646f1c21..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchScope.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.search.internal.core.text;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.ui.IWorkingSet;
-
-import org.eclipse.search.internal.core.SearchScope;
-import org.eclipse.search.internal.ui.SearchMessages;
-
-/**
- * A special text search scope that take file extensions into account.
- */
-public class TextSearchScope extends SearchScope {
-
- private static class WorkspaceScope extends TextSearchScope {
-
- private WorkspaceScope() {
- super(SearchMessages.getString("WorkspaceScope")); //$NON-NLS-1$
- }
-
- public void add(IResource element) {
- // do nothing
- }
-
- /**
- * @see ISearchScope#encloses(Object)
- */
- public boolean encloses(IResourceProxy proxy) {
- if (proxy.getType() == IResource.FILE && skipFile(proxy))
- return false;
- return true;
- }
- }
-
- private Set fExtensions= new HashSet(3);
-
- /**
- * Returns a new Workbench scope.
- */
- public static TextSearchScope newWorkspaceScope() {
- return new WorkspaceScope();
- }
-
- public TextSearchScope(String description) {
- super(description);
- }
-
- public TextSearchScope(String description, IResource[] resources) {
- super(description, resources);
- }
-
- public TextSearchScope(String description, IAdaptable[] elements) {
- super(description, convertToResources(elements));
-
- }
-
- public TextSearchScope(String description, IWorkingSet[] workingSets) {
- super(description, convertToResources(getElements(workingSets)));
- }
-
- private static IResource[] convertToResources(IAdaptable[] elements) {
- int length= elements.length;
- Set resources= new HashSet(length);
- for (int i= 0; i < length; i++) {
- IResource resource= (IResource)elements[i].getAdapter(IResource.class);
- if (resource != null)
- resources.add(resource);
- }
- return (IResource[])resources.toArray(new IResource[resources.size()]);
- }
-
- private static IAdaptable[] getElements(IWorkingSet[] workingSets) {
- int length= workingSets.length;
- Set elements= new HashSet(length);
- for (int i= 0; i < length; i++) {
- elements.addAll(Arrays.asList(workingSets[i].getElements()));
- }
- return (IAdaptable[])elements.toArray(new IAdaptable[elements.size()]);
- }
-
- /**
- * Adds an extension to the scope.
- */
- public void addExtension(String extension) {
- Pattern pattern= Pattern.compile(asRegEx(extension), Pattern.CASE_INSENSITIVE);
- fExtensions.add(pattern.matcher("")); //$NON-NLS-1$
- }
-
- /*
- * Converts '*' and '?' to regEx variables.
- */
- private String asRegEx(String pattern) {
-
- StringBuffer out= new StringBuffer(pattern.length());
-
- boolean escaped= false;
- boolean quoting= false;
-
- int i= 0;
- while (i < pattern.length()) {
- char ch= pattern.charAt(i++);
-
- if (ch == '*' && !escaped) {
- if (quoting) {
- out.append("\\E"); //$NON-NLS-1$
- quoting= false;
- }
- out.append(".*"); //$NON-NLS-1$
- escaped= false;
- continue;
- } else if (ch == '?' && !escaped) {
- if (quoting) {
- out.append("\\E"); //$NON-NLS-1$
- quoting= false;
- }
- out.append("."); //$NON-NLS-1$
- escaped= false;
- continue;
- } else if (ch == '\\' && !escaped) {
- escaped= true;
- continue;
-
- } else if (ch == '\\' && escaped) {
- escaped= false;
- if (quoting) {
- out.append("\\E"); //$NON-NLS-1$
- quoting= false;
- }
- out.append("\\\\"); //$NON-NLS-1$
- continue;
- }
-
- if (!quoting) {
- out.append("\\Q"); //$NON-NLS-1$
- quoting= true;
- }
- if (escaped && ch != '*' && ch != '?' && ch != '\\')
- out.append('\\');
- out.append(ch);
- escaped= ch == '\\';
-
- }
- if (quoting)
- out.append("\\E"); //$NON-NLS-1$
-
- return out.toString();
- }
-
- /**
- * Adds all string patterns contained in <code>extensions</code> to this
- * scope. The allowed pattern characters are <code>*</code> for any character
- * and <code>?</code> for one character.
- */
- public void addExtensions(Set extensions) {
- if (extensions == null)
- return;
- Iterator iter= extensions.iterator();
- while (iter.hasNext()) {
- Object obj= iter.next();
- if (obj instanceof String)
- addExtension((String)obj);
- }
- }
-
- /*
- * Implements method from ISearchScope
- */
- public boolean encloses(IResourceProxy proxy) {
- if (proxy.getType() == IResource.FILE && skipFile(proxy))
- return false;
- return super.encloses(proxy);
- }
-
- boolean skipFile(IResourceProxy proxy) {
- if (proxy != null) {
- Iterator iter= fExtensions.iterator();
- while (iter.hasNext()) {
- if (((Matcher)iter.next()).reset(proxy.getName()).matches())
- return false;
- }
- }
- return true;
- }
-
- /**
- * Implements method from ISearchScope
- *
- * @deprecated As of 2.1, replaced by {@link #encloses(IResourceProxy)}
- */
- public boolean encloses(IResource element) {
- if (element.getType() == IResource.FILE && skipFile((IFile)element))
- return false;
- return super.encloses(element);
- }
-
- boolean skipFile(IFile file) {
- if (file != null) {
- Iterator iter= fExtensions.iterator();
- while (iter.hasNext()) {
- if (((Matcher)iter.next()).reset(file.getName()).matches())
- return false;
- }
- }
- return true;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java
deleted file mode 100644
index a5f9ceff64f..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.core.text;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.search.internal.core.ISearchScope;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.ui.SearchUI;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * The visitor that does the actual work.
- */
-public class TextSearchVisitor extends TypedResourceVisitor {
- protected static final int fgLF= '\n';
- protected static final int fgCR= '\r';
-
- private ISearchScope fScope;
- private ITextSearchResultCollector fCollector;
- private IEditorPart[] fEditors;
- private MatchLocator fLocator;
-
- private IProgressMonitor fProgressMonitor;
- private Integer[] fMessageFormatArgs;
-
- private int fNumberOfScannedFiles;
- private int fNumberOfFilesToScan;
- private long fLastUpdateTime;
-
- public TextSearchVisitor(MatchLocator locator, ISearchScope scope, ITextSearchResultCollector collector, MultiStatus status, int fileCount) {
- super(status);
- fScope= scope;
- fCollector= collector;
-
- fProgressMonitor= collector.getProgressMonitor();
-
- fLocator= locator;
-
- fNumberOfScannedFiles= 0;
- fNumberOfFilesToScan= fileCount;
- fMessageFormatArgs= new Integer[] { new Integer(0), new Integer(fileCount) };
- }
-
- public void process(Collection projects) {
- Iterator i= projects.iterator();
- while(i.hasNext()) {
- IProject project= (IProject)i.next();
- try {
- project.accept(this, IResource.NONE);
- } catch (CoreException ex) {
- addToStatus(ex);
- }
- }
- }
-
- /**
- * Returns an array of all editors that have an unsaved content. If the identical content is
- * presented in more than one editor, only one of those editor parts is part of the result.
- *
- * @return an array of all editor parts.
- */
- public static IEditorPart[] getEditors() {
- Set inputs= new HashSet();
- List result= new ArrayList(0);
- IWorkbench workbench= SearchPlugin.getDefault().getWorkbench();
- IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
- for (int i= 0; i < windows.length; i++) {
- IWorkbenchPage[] pages= windows[i].getPages();
- for (int x= 0; x < pages.length; x++) {
- IEditorReference[] editorRefs= pages[x].getEditorReferences();
- for (int z= 0; z < editorRefs.length; z++) {
- IEditorPart ep= editorRefs[z].getEditor(false);
- if (ep != null) {
- IEditorInput input= ep.getEditorInput();
- if (!inputs.contains(input)) {
- inputs.add(input);
- result.add(ep);
- }
- }
- }
- }
- }
- return (IEditorPart[])result.toArray(new IEditorPart[result.size()]);
- }
-
-
- protected boolean visitFile(IResourceProxy proxy) throws CoreException {
- if (! fScope.encloses(proxy))
- return false;
-
- // Exclude to derived resources
- if (proxy.isDerived())
- return false;
-
- if (fLocator.isEmtpy()) {
- fCollector.accept(proxy, "", -1, 0, -1); //$NON-NLS-1$
- updateProgressMonitor();
- return true;
- }
- IFile file= (IFile)proxy.requestResource();
- try {
- BufferedReader reader= null;
- ITextEditor editor= findEditorFor(file);
- if (editor != null) {
- String s= editor.getDocumentProvider().getDocument(editor.getEditorInput()).get();
- reader= new BufferedReader(new StringReader(s));
- } else {
- InputStream stream= file.getContents(false);
- reader= new BufferedReader(new InputStreamReader(stream, ResourcesPlugin.getEncoding()));
- }
- fLocator.locateMatches(fProgressMonitor, proxy, reader, fCollector);
- } catch (IOException e) {
- String message= SearchMessages.getFormattedString("TextSearchVisitor.error", file.getFullPath()); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, SearchUI.PLUGIN_ID, Platform.PLUGIN_ERROR, message, e));
- }
- finally {
- updateProgressMonitor();
- }
- return true;
- }
-
- private void updateProgressMonitor() {
- fNumberOfScannedFiles++;
- if (fNumberOfScannedFiles < fNumberOfFilesToScan) {
- if (System.currentTimeMillis() - fLastUpdateTime > 1000) {
- fMessageFormatArgs[0]= new Integer(fNumberOfScannedFiles+1);
- fProgressMonitor.setTaskName(SearchMessages.getFormattedString("TextSearchVisitor.scanning", fMessageFormatArgs)); //$NON-NLS-1$
- fLastUpdateTime= System.currentTimeMillis();
- }
- }
- fProgressMonitor.worked(1);
- if (fProgressMonitor.isCanceled())
- throw new OperationCanceledException(SearchMessages.getString("TextSearchVisitor.canceled")); //$NON-NLS-1$
- }
-
- private ITextEditor findEditorFor(IFile file) {
- int i= 0;
- while (i < fEditors.length) {
- IEditorPart editor= fEditors[i];
- IEditorInput input= editor.getEditorInput();
- if (input instanceof IFileEditorInput && editor instanceof ITextEditor)
- if (((IFileEditorInput)input).getFile().equals(file))
- return (ITextEditor)editor;
- i++;
- }
- return null;
- }
-
- /*
- * @see IResourceProxyVisitor#visit(IResourceProxy)
- */
- public boolean visit(IResourceProxy proxy) {
- fEditors= getEditors();
- return super.visit(proxy);
- }
-}
-
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TypedResourceVisitor.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TypedResourceVisitor.java
deleted file mode 100644
index 6188516cfd1..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TypedResourceVisitor.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.search.internal.core.text;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.MultiStatus;
-
-import org.eclipse.jface.util.Assert;
-
-public class TypedResourceVisitor implements IResourceProxyVisitor {
-
- private MultiStatus fStatus;
-
- TypedResourceVisitor(MultiStatus status) {
- Assert.isNotNull(status);
- fStatus= status;
- }
-
- protected boolean visitFile(IResourceProxy proxy) throws CoreException {
- return true;
- }
-
- protected boolean visitProject(IResourceProxy proxy) throws CoreException {
- return true;
- }
-
- protected boolean visitFolder(IResourceProxy proxy) throws CoreException {
- return true;
- }
-
- protected void addToStatus(CoreException ex) {
- fStatus.add(ex.getStatus());
- }
-
- /*
- * @see org.eclipse.core.resources.IResourceProxyVisitor#visit(org.eclipse.core.resources.IResourceProxy)
- */
- public boolean visit(IResourceProxy proxy) {
- try {
- switch(proxy.getType()) {
- case IResource.FILE:
- return visitFile(proxy);
- case IResource.FOLDER:
- return visitFolder(proxy);
- case IResource.PROJECT:
- return visitProject(proxy);
- default:
- Assert.isTrue(false, "unknown resource type"); //$NON-NLS-1$
- }
- return false;
- } catch (CoreException ex) {
- addToStatus(ex);
- return false;
- }
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java
deleted file mode 100644
index b1b4770b7d6..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.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.search.internal.ui;
-
-import java.util.Collections;
-import java.util.Iterator;
-
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-public class CopyToClipboardAction extends Action {
-
- private SearchResultViewer fViewer;
-
- public CopyToClipboardAction(SearchResultViewer viewer) {
- Assert.isNotNull(viewer);
- fViewer= viewer;
- setText(SearchMessages.getString("CopyToClipboardAction.label")); //$NON-NLS-1$
- setToolTipText(SearchMessages.getString("CopyToClipboardAction.tooltip")); //$NON-NLS-1$
- }
-
- /*
- * Implements method from IAction
- */
- public void run() {
- Shell shell= SearchPlugin.getActiveWorkbenchShell();
- if (shell == null)
- return;
-
- ILabelProvider labelProvider= (ILabelProvider)fViewer.getLabelProvider();
- String lineDelim= System.getProperty("line.separator"); //$NON-NLS-1$
- StringBuffer buf= new StringBuffer();
- Iterator iter= getSelection();
- while (iter.hasNext()) {
- if (buf.length() > 0) {
- buf.append(lineDelim);
- }
- buf.append(labelProvider.getText(iter.next()));
- }
-
- if (buf.length() > 0) {
- Clipboard clipboard= new Clipboard(shell.getDisplay());
- try {
- copyToClipbard(clipboard, buf.toString(), shell);
- } finally {
- clipboard.dispose();
- }
- }
- }
-
- private Iterator getSelection() {
- ISelection s= fViewer.getSelection();
- if (s instanceof IStructuredSelection)
- return ((IStructuredSelection)s).iterator();
- return Collections.EMPTY_LIST.iterator();
- }
-
- private void copyToClipbard(Clipboard clipboard, String str, Shell shell) {
- try {
- clipboard.setContents(new String[] { str }, new Transfer[] { TextTransfer.getInstance() });
- } catch (SWTError ex) {
- if (ex.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
- throw ex;
- String title= SearchMessages.getString("CopyToClipboardAction.error.title"); //$NON-NLS-1$
- String message= SearchMessages.getString("CopyToClipboardAction.error.message"); //$NON-NLS-1$
- if (MessageDialog.openQuestion(shell, title, message))
- copyToClipbard(clipboard, str, shell);
- }
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/GotoMarkerAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/GotoMarkerAction.java
deleted file mode 100644
index 3050af6c73a..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/GotoMarkerAction.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.search.internal.ui;
-
-import org.eclipse.jface.action.Action;
-
-class GotoMarkerAction extends Action {
-
- private SearchResultViewer fViewer;
-
- public GotoMarkerAction(SearchResultViewer viewer) {
- super(SearchMessages.getString("SearchResultView.gotoMarker.text")); //$NON-NLS-1$
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_GOTO);
- setToolTipText(SearchMessages.getString("SearchResultView.gotoMarker.tooltip")); //$NON-NLS-1$
- fViewer= viewer;
- }
-
- public void run() {
- fViewer.showResult();
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java
deleted file mode 100644
index 9fde0e98ee4..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.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.search.internal.ui;
-
-import org.eclipse.search.ui.SearchUI;
-
-public interface ISearchHelpContextIds {
-
- public static final String PREFIX= SearchUI.PLUGIN_ID + "."; //$NON-NLS-1$
-
- public static final String SEARCH_DIALOG= PREFIX + "search_dialog_context"; //$NON-NLS-1$
-
- public static final String TEXT_SEARCH_PAGE= PREFIX + "text_search_page_context"; //$NON-NLS-1$
- public static final String TYPE_FILTERING_DIALOG= PREFIX + "type_filtering_dialog_context"; //$NON-NLS-1$
-
- public static final String SEARCH_VIEW= PREFIX + "search_view_context"; //$NON-NLS-1$
-
- public static final String SEARCH_PREFERENCE_PAGE= PREFIX + "search_preference_page_context"; //$NON-NLS-1$
-
- public static final String SELECT_ALL_ACTION = PREFIX + "select_all_action_context"; //$NON-NLS-1$
-
- public static final String SEARCH_ACTION = PREFIX + "search_action_context"; //$NON-NLS-1$
-
- public static final String FILE_SEARCH_ACTION= PREFIX + "file_search_action_context"; //$NON-NLS-1$
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenFileSearchPageAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenFileSearchPageAction.java
deleted file mode 100644
index 1c4f4ee5570..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenFileSearchPageAction.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.search.internal.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-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.search.ui.SearchUI;
-
-/**
- * Opens the Search Dialog.
- */
-public class OpenFileSearchPageAction implements IWorkbenchWindowActionDelegate {
-
- private static final String TEXT_SEARCH_PAGE_ID= "org.eclipse.search.internal.ui.text.TextSearchPage"; //$NON-NLS-1$
-
- private IWorkbenchWindow fWindow;
-
- public OpenFileSearchPageAction() {
- }
-
- public void init(IWorkbenchWindow window) {
- fWindow= window;
- }
-
- public void run(IAction action) {
- if (fWindow == null || fWindow.getActivePage() == null) {
- SearchPlugin.beep();
- logErrorMessage("Could not open the search dialog - for some reason the window handle was null"); //$NON-NLS-1$
- return;
- }
- SearchUI.openSearchDialog(fWindow, TEXT_SEARCH_PAGE_ID); //$NON-NLS-1$
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // do nothing since the action isn't selection dependent.
- }
-
- public void dispose() {
- fWindow= null;
- }
-
- public static void logErrorMessage(String message) {
- IStatus status= new Status(IStatus.ERROR, SearchUI.PLUGIN_ID, IStatus.ERROR, message, null);
- SearchPlugin.log(status);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogAction.java
deleted file mode 100644
index ce38d4da8dc..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogAction.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.search.internal.ui;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * Opens the Search Dialog.
- */
-public class OpenSearchDialogAction extends Action implements IWorkbenchWindowActionDelegate {
-
- private IWorkbenchWindow fWindow;
- private String fPageId;
-
- public OpenSearchDialogAction() {
- super(SearchMessages.getString("OpenSearchDialogAction.label")); //$NON-NLS-1$
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_TOOL, SearchPluginImages.IMG_TOOL_SEARCH);
- setToolTipText(SearchMessages.getString("OpenSearchDialogAction.tooltip")); //$NON-NLS-1$
- }
-
- public OpenSearchDialogAction(IWorkbenchWindow window, String pageId) {
- this();
- fPageId= pageId;
- fWindow= window;
- }
-
- public void init(IWorkbenchWindow window) {
- fWindow= window;
- }
-
- public void run(IAction action) {
- run();
- }
-
- public void run() {
- if (getWindow().getActivePage() == null) {
- SearchPlugin.beep();
- return;
- }
- SearchDialog dialog= new SearchDialog(
- getWindow().getShell(),
- SearchPlugin.getWorkspace(),
- getSelection(),
- getEditorPart(),
- fPageId);
- dialog.open();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // do nothing since the action isn't selection dependent.
- }
-
- private ISelection getSelection() {
- return getWindow().getSelectionService().getSelection();
- }
-
- private IEditorPart getEditorPart() {
- return getWindow().getActivePage().getActiveEditor();
- }
-
- private IWorkbenchWindow getWindow() {
- if (fWindow == null)
- fWindow= SearchPlugin.getActiveWorkbenchWindow();
- return fWindow;
- }
-
- public void dispose() {
- fWindow= null;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllResultsAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllResultsAction.java
deleted file mode 100644
index 08ffc5be6ac..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllResultsAction.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.search.internal.ui;
-
-import org.eclipse.jface.action.Action;
-
-class RemoveAllResultsAction extends Action {
-
- public RemoveAllResultsAction() {
- super(SearchMessages.getString("SearchResultView.removeAllResults.text")); //$NON-NLS-1$
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_REM_ALL);
- setToolTipText(SearchMessages.getString("SearchResultView.removeAllResults.tooltip")); //$NON-NLS-1$
- }
-
- public void run() {
- SearchManager.getDefault().removeAllResults();
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllSearchesAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllSearchesAction.java
deleted file mode 100644
index 178ccbab8f8..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllSearchesAction.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.search.internal.ui;
-
-import org.eclipse.jface.action.Action;
-
-class RemoveAllSearchesAction extends Action {
-
- public RemoveAllSearchesAction() {
- super(SearchMessages.getString("SearchResultView.removeAllSearches.text")); //$NON-NLS-1$
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_REM_ALL);
- setToolTipText(SearchMessages.getString("SearchResultView.removeAllSearches.tooltip")); //$NON-NLS-1$
- }
-
- public void run() {
- SearchManager.getDefault().removeAllSearches();
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveMatchAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveMatchAction.java
deleted file mode 100644
index 98abd6ac731..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveMatchAction.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.search.internal.ui;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.search.ui.ISearchResultViewEntry;
-
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
-class RemoveMatchAction extends Action {
-
- private ISelectionProvider fSelectionProvider;
-
- public RemoveMatchAction(ISelectionProvider provider) {
- super(SearchMessages.getString("SearchResultView.removeMatch.text")); //$NON-NLS-1$
- setToolTipText(SearchMessages.getString("SearchResultView.removeMatch.tooltip")); //$NON-NLS-1$
- fSelectionProvider= provider;
- }
-
- public void run() {
- IMarker[] markers= getMarkers(fSelectionProvider.getSelection());
- if (markers != null)
- try {
- SearchPlugin.getWorkspace().deleteMarkers(markers);
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.deleteMarkers.title"), SearchMessages.getString("Search.Error.deleteMarkers.message")); //$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- private IMarker[] getMarkers(ISelection s) {
- if (! (s instanceof IStructuredSelection) || s.isEmpty())
- return null;
-
- IStructuredSelection selection= (IStructuredSelection)s;
- int size= selection.size();
- if (size != 1)
- return null;
- if (selection.getFirstElement() instanceof ISearchResultViewEntry) {
- IMarker marker= ((ISearchResultViewEntry)selection.getFirstElement()).getSelectedMarker();
- if (marker != null)
- return new IMarker[] {marker};
- }
- return null;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemovePotentialMatchesAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/RemovePotentialMatchesAction.java
deleted file mode 100644
index 5ff5b301f59..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemovePotentialMatchesAction.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.search.internal.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.IWorkbenchSite;
-
-import org.eclipse.search.ui.SearchUI;
-
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
-class RemovePotentialMatchesAction extends Action {
-
- private IWorkbenchSite fSite;
-
- public RemovePotentialMatchesAction(IWorkbenchSite site) {
- fSite= site;
-
- if (usePluralLabel()) {
- setText(SearchMessages.getString("RemovePotentialMatchesAction.removePotentialMatches.text")); //$NON-NLS-1$
- setToolTipText(SearchMessages.getString("RemovePotentialMatchesAction.removePotentialMatches.tooltip")); //$NON-NLS-1$
- }
- else {
- setText(SearchMessages.getString("RemovePotentialMatchesAction.removePotentialMatch.text")); //$NON-NLS-1$
- setToolTipText(SearchMessages.getString("RemovePotentialMatchesAction.removePotentialMatch.tooltip")); //$NON-NLS-1$
- }
- }
-
- public void run() {
- IMarker[] markers= getMarkers();
- if (markers != null)
- try {
- SearchPlugin.getWorkspace().deleteMarkers(markers);
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.deleteMarkers.title"), SearchMessages.getString("Search.Error.deleteMarkers.message")); //$NON-NLS-2$ //$NON-NLS-1$
- }
- else {
- String title= SearchMessages.getString("RemovePotentialMatchesAction.dialog.title"); //$NON-NLS-1$
- String message= SearchMessages.getString("RemovePotentialMatchesAction.dialog.message"); //$NON-NLS-1$
- MessageDialog.openInformation(fSite.getShell(), title, message);
- }
-
- // action only makes sense once
- setEnabled(false);
- }
-
- private IMarker[] getMarkers() {
-
- ISelection s= fSite.getSelectionProvider().getSelection();
- if (! (s instanceof IStructuredSelection))
- return null;
- IStructuredSelection selection= (IStructuredSelection)s;
-
- int size= selection.size();
- if (size <= 0)
- return null;
-
- ArrayList markers= new ArrayList(size * 3);
- Iterator iter= selection.iterator();
- for(int i= 0; iter.hasNext(); i++) {
- SearchResultViewEntry entry= (SearchResultViewEntry)iter.next();
- Iterator entryIter= entry.getMarkers().iterator();
- while (entryIter.hasNext()) {
- IMarker marker= (IMarker)entryIter.next();
- if (marker.getAttribute(SearchUI.POTENTIAL_MATCH, false))
- markers.add(marker);
- }
- }
- return (IMarker[])markers.toArray(new IMarker[markers.size()]);
- }
-
- private boolean usePluralLabel() {
- ISelection s= fSite.getSelectionProvider().getSelection();
-
- if (! (s instanceof IStructuredSelection) || s.isEmpty())
- return false;
-
- IStructuredSelection selection= (IStructuredSelection)s;
- int size= selection.size();
- if (size <= 0)
- return false;
-
- int markerCount= 0;
- Iterator iter= selection.iterator();
- for(int i= 0; iter.hasNext(); i++) {
- SearchResultViewEntry entry= (SearchResultViewEntry)iter.next();
- Iterator entryIter= entry.getMarkers().iterator();
- while (entryIter.hasNext()) {
- IMarker marker= (IMarker)entryIter.next();
- if (marker.getAttribute(SearchUI.POTENTIAL_MATCH, false)) {
- markerCount++;
- }
- if (markerCount > 1)
- return true;
- }
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveResultAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveResultAction.java
deleted file mode 100644
index 4922292bd0c..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveResultAction.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.search.internal.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.custom.BusyIndicator;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.search.ui.ISearchResultViewEntry;
-
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
-class RemoveResultAction extends Action {
-
- private ISelectionProvider fSelectionProvider;
-
- public RemoveResultAction(ISelectionProvider provider, boolean stringsDependOnMatchCount) {
- fSelectionProvider= provider;
- if (!stringsDependOnMatchCount || usePluralLabel()) {
- setText(SearchMessages.getString("SearchResultView.removeEntries.text")); //$NON-NLS-1$
- setToolTipText(SearchMessages.getString("SearchResultView.removeEntries.tooltip")); //$NON-NLS-1$
- }
- else {
- setText(SearchMessages.getString("SearchResultView.removeEntry.text")); //$NON-NLS-1$
- setToolTipText(SearchMessages.getString("SearchResultView.removeEntry.tooltip")); //$NON-NLS-1$
- }
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_REM);
- }
-
- public void run() {
- final IMarker[] markers= getMarkers(fSelectionProvider.getSelection());
- if (markers != null) {
- BusyIndicator.showWhile(SearchPlugin.getActiveWorkbenchShell().getDisplay(), new Runnable() {
- public void run() {
- try {
- SearchPlugin.getWorkspace().deleteMarkers(markers);
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.deleteMarkers.title"), SearchMessages.getString("Search.Error.deleteMarkers.message")); //$NON-NLS-2$ //$NON-NLS-1$
- }
- }
- });
- }
- }
-
- private IMarker[] getMarkers(ISelection s) {
- if (! (s instanceof IStructuredSelection) || s.isEmpty())
- return null;
-
- IStructuredSelection selection= (IStructuredSelection)s;
- int size= selection.size();
- if (size <= 0)
- return null;
- ArrayList markers= new ArrayList(size * 3);
- int markerCount= 0;
- Iterator iter= selection.iterator();
- for(int i= 0; iter.hasNext(); i++) {
- SearchResultViewEntry entry= (SearchResultViewEntry)iter.next();
- markerCount += entry.getMatchCount();
- markers.addAll(entry.getMarkers());
- }
- return (IMarker[])markers.toArray(new IMarker[markerCount]);
- }
-
- private boolean usePluralLabel() {
- ISelection s= fSelectionProvider.getSelection();
- if (s == null || s.isEmpty() || !(s instanceof IStructuredSelection))
- return false;
- IStructuredSelection selection= (IStructuredSelection)s;
-
- if (selection.size() != 1)
- return true;
-
- Object firstElement= selection.getFirstElement();
- if (firstElement instanceof ISearchResultViewEntry)
- return ((ISearchResultViewEntry)firstElement).getMatchCount() > 1;
- else
- return false;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ResourceToItemsMapper.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ResourceToItemsMapper.java
deleted file mode 100644
index 3019eb396ac..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ResourceToItemsMapper.java
+++ /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
- *******************************************************************************/
-package org.eclipse.search.internal.ui;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Stack;
-
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Item;
-
-import org.eclipse.jface.viewers.ContentViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-
-import org.eclipse.search.ui.ISearchResultViewEntry;
-
-/**
- * Helper class for updating error markers and other decorators that work on resources.
- * Items are mapped to their element's underlying resource.
- * Method <code>resourceChanged</code> updates all items that are affected from the changed
- * elements.
- */
-class ResourceToItemsMapper {
-
- private static final int NUMBER_LIST_REUSE= 10;
-
- // map from resource to item
- private HashMap fResourceToItem;
- private Stack fReuseLists;
-
- private ContentViewer fContentViewer;
-
- public ResourceToItemsMapper(ContentViewer viewer) {
- fResourceToItem= new HashMap();
- fReuseLists= new Stack();
-
- fContentViewer= viewer;
- }
-
- /**
- * Must be called from the UI thread.
- */
- public void resourceChanged(IResource changedResource) {
- Object obj= fResourceToItem.get(changedResource);
- if (obj == null) {
- // not mapped
- } else if (obj instanceof Item) {
- updateItem((Item) obj);
- } else { // List of Items
- List list= (List) obj;
- for (int k= 0; k < list.size(); k++) {
- updateItem((Item) list.get(k));
- }
- }
- }
-
- private void updateItem(Item item) {
- if (!item.isDisposed()) { // defensive code
- ILabelProvider lprovider= (ILabelProvider) fContentViewer.getLabelProvider();
-
- Object data= item.getData();
-
- String oldText= item.getText();
- String text= lprovider.getText(data);
- if (text != null && !text.equals(oldText)) {
- item.setText(text);
- }
-
- Image oldImage= item.getImage();
- Image image= lprovider.getImage(data);
- if (image != null && !image.equals(oldImage)) {
- item.setImage(image);
- }
- }
- }
-
- /**
- * Adds a new item to the map.
- * @param element Element to map
- * @param item The item used for the element
- */
- public void addToMap(Object element, Item item) {
- IResource resource= ((ISearchResultViewEntry)element).getResource();
- if (resource != null) {
- Object existingMapping= fResourceToItem.get(resource);
- if (existingMapping == null) {
- fResourceToItem.put(resource, item);
- } else if (existingMapping instanceof Item) {
- if (existingMapping != item) {
- List list= getNewList();
- list.add(existingMapping);
- list.add(item);
- fResourceToItem.put(resource, list);
- }
- } else { // List
- List list= (List) existingMapping;
- if (!list.contains(item)) {
- list.add(item);
- }
- }
- }
- }
-
- /**
- * Removes an element from the map.
- */
- public void removeFromMap(Object element, Item item) {
- IResource resource= ((ISearchResultViewEntry)element).getResource();
- if (resource != null) {
- Object existingMapping= fResourceToItem.get(resource);
- if (existingMapping == null) {
- return;
- } else if (existingMapping instanceof Item) {
- fResourceToItem.remove(resource);
- } else { // List
- List list= (List) existingMapping;
- list.remove(item);
- if (list.isEmpty()) {
- fResourceToItem.remove(list);
- releaseList(list);
- }
- }
- }
- }
-
- private List getNewList() {
- if (!fReuseLists.isEmpty()) {
- return (List) fReuseLists.pop();
- }
- return new ArrayList(2);
- }
-
- private void releaseList(List list) {
- if (fReuseLists.size() < NUMBER_LIST_REUSE) {
- fReuseLists.push(list);
- }
- }
-
- /**
- * Clears the map.
- */
- public void clearMap() {
- fResourceToItem.clear();
- }
-
- /**
- * Clears the map.
- */
- public boolean isEmpty() {
- return fResourceToItem.isEmpty();
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java
deleted file mode 100644
index 187cebc1c43..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java
+++ /dev/null
@@ -1,424 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.search.internal.ui.util.PixelConverter;
-import org.eclipse.search.internal.ui.util.SWTUtil;
-import org.eclipse.search.ui.ISearchPageContainer;
-import org.eclipse.search.ui.SearchUI;
-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.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-
-public class ScopePart {
-
- // Settings store
- private static final String DIALOG_SETTINGS_KEY= "SearchDialog.ScopePart"; //$NON-NLS-1$
- private static final String STORE_SCOPE= "scope"; //$NON-NLS-1$
- private static final String STORE_LRU_WORKING_SET_NAME= "lastUsedWorkingSetName"; //$NON-NLS-1$
- private static final String STORE_LRU_WORKING_SET_NAMES= "lastUsedWorkingSetNames"; //$NON-NLS-1$
- private static IDialogSettings fgSettingsStore;
-
- static {
- fgSettingsStore= SearchPlugin.getDefault().getDialogSettings().getSection(DIALOG_SETTINGS_KEY);
- if (fgSettingsStore == null)
- fgSettingsStore= SearchPlugin.getDefault().getDialogSettings().addNewSection(DIALOG_SETTINGS_KEY);
- }
-
- private Group fPart;
-
- // Scope radio buttons
- private Button fUseWorkspace;
- private Button fUseSelection;
- private Button fUseProject;
- private Button fUseWorkingSet;
-
- private int fScope;
- private boolean fCanSearchEnclosingProjects;
- private Text fWorkingSetText;
- private IWorkingSet[] fWorkingSets;
-
- // Reference to its search page container (can be null)
- private ISearchPageContainer fSearchPageContainer;
-
- /**
- * Returns a new scope part with workspace as initial scope.
- * The part is not yet created.
- */
- public ScopePart(ISearchPageContainer searchPageContainer, boolean searchEnclosingProjects) {
- int initialScope= getStoredScope();
- Assert.isLegal(initialScope >= 0 && initialScope <= 3);
- fScope= initialScope;
- fCanSearchEnclosingProjects= searchEnclosingProjects;
- if (!fCanSearchEnclosingProjects && fScope == ISearchPageContainer.SELECTED_PROJECTS_SCOPE)
- fScope= ISearchPageContainer.WORKSPACE_SCOPE;
- fSearchPageContainer= searchPageContainer;
- restoreState();
- }
-
- private static int getStoredScope() {
- int scope;
- try {
- scope= fgSettingsStore.getInt(STORE_SCOPE);
- } catch (NumberFormatException ex) {
- scope= ISearchPageContainer.WORKSPACE_SCOPE;
- }
- if (scope != ISearchPageContainer.WORKING_SET_SCOPE
- && scope != ISearchPageContainer.SELECTION_SCOPE
- && scope != ISearchPageContainer.SELECTED_PROJECTS_SCOPE
- && scope != ISearchPageContainer.WORKSPACE_SCOPE)
- scope= ISearchPageContainer.WORKSPACE_SCOPE;
- return scope;
- }
-
-
- private void restoreState() {
- String[] lruWorkingSetNames= fgSettingsStore.getArray(STORE_LRU_WORKING_SET_NAMES);
- if (lruWorkingSetNames != null) {
- Set existingWorkingSets= new HashSet(lruWorkingSetNames.length);
- for (int i= 0; i < lruWorkingSetNames.length; i++) {
- String name= lruWorkingSetNames[i];
- IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name);
- if (workingSet != null)
- existingWorkingSets.add(workingSet);
- }
- if (!existingWorkingSets.isEmpty())
- fWorkingSets= (IWorkingSet[]) existingWorkingSets.toArray(new IWorkingSet[existingWorkingSets.size()]);
- } else {
- // Backward compatibility
- String workingSetName= fgSettingsStore.get(STORE_LRU_WORKING_SET_NAME);
- if (workingSetName != null) {
- IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName);
- if (workingSet != null) {
- fWorkingSets= new IWorkingSet[] { workingSet };
- saveState();
- }
- }
- }
- }
-
-
- /**
- * Returns the scope selected in this part
- *
- * @return the selected scope
- */
- public int getSelectedScope() {
- return fScope;
- }
-
- /**
- * Sets the selected scope.
- * This method must only be called on a created part.
- *
- * @param scope the scope to be selected in this part
- */
- public void setSelectedScope(int scope) {
- Assert.isLegal(scope >= 0 && scope <= 3);
- Assert.isNotNull(fUseWorkspace);
- Assert.isNotNull(fUseSelection);
- Assert.isNotNull(fUseWorkingSet);
- Assert.isNotNull(fUseProject);
- fScope= scope;
- if (fScope == ISearchPageContainer.SELECTED_PROJECTS_SCOPE) {
- if (!fCanSearchEnclosingProjects) {
- SearchPlugin.log(new Status(IStatus.WARNING, SearchUI.PLUGIN_ID, IStatus.WARNING, "Enclosing projects scope set on search page that does not support it", null)); //$NON-NLS-1$
- fScope= ISearchPageContainer.WORKSPACE_SCOPE;
- } else if (!fUseProject.isEnabled()) {
- fScope= ISearchPageContainer.WORKSPACE_SCOPE;
- }
- } else if (fScope == ISearchPageContainer.SELECTION_SCOPE) {
- if (!fUseSelection.isEnabled()) {
- fScope= ISearchPageContainer.WORKSPACE_SCOPE;
- }
- }
- switch (fScope) {
- case ISearchPageContainer.WORKSPACE_SCOPE :
- fUseWorkspace.setSelection(true);
- fUseSelection.setSelection(false);
- fUseProject.setSelection(false);
- fUseWorkingSet.setSelection(false);
- break;
- case ISearchPageContainer.SELECTION_SCOPE :
- fUseWorkspace.setSelection(false);
- fUseSelection.setSelection(true);
- fUseProject.setSelection(false);
- fUseWorkingSet.setSelection(false);
- break;
- case ISearchPageContainer.WORKING_SET_SCOPE :
- fUseWorkspace.setSelection(false);
- fUseSelection.setSelection(false);
- fUseProject.setSelection(false);
- fUseWorkingSet.setSelection(true);
- break;
- case ISearchPageContainer.SELECTED_PROJECTS_SCOPE :
- fUseWorkspace.setSelection(false);
- fUseSelection.setSelection(false);
- fUseProject.setSelection(true);
- fUseWorkingSet.setSelection(false);
- break;
- }
-
- updateSearchPageContainerActionPerformedEnablement();
- fgSettingsStore.put(STORE_SCOPE, fScope);
-
- }
-
- private void updateSearchPageContainerActionPerformedEnablement() {
- boolean newState= fScope != ISearchPageContainer.WORKING_SET_SCOPE || fWorkingSets != null;
- if (fSearchPageContainer instanceof SearchDialog)
- ((SearchDialog) fSearchPageContainer).setPerformActionEnabledFromScopePart(newState);
- else if (fSearchPageContainer != null)
- fSearchPageContainer.setPerformActionEnabled(newState);
- }
-
- /**
- * Returns the selected working set of this part.
- *
- * @return the selected working set or null
- * - if the scope is not WORKING_SET_SCOPE
- * - if there is no working set selected
- */
- public IWorkingSet[] getSelectedWorkingSets() {
- if (getSelectedScope() == ISearchPageContainer.WORKING_SET_SCOPE)
- return fWorkingSets;
- else
- return null;
- }
-
- /**
- * Sets the selected working set for this part.
- * This method must only be called on a created part.
- *
- * @param workingSet the working set to be selected
- */
- public void setSelectedWorkingSets(IWorkingSet[] workingSets) {
- Assert.isNotNull(workingSets);
- setSelectedScope(ISearchPageContainer.WORKING_SET_SCOPE);
- fWorkingSets= null;
- Set existingWorkingSets= new HashSet(workingSets.length);
- for (int i= 0; i < workingSets.length; i++) {
- String name= workingSets[i].getName();
- IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name);
- if (workingSet != null)
- existingWorkingSets.add(workingSet);
- }
- if (!existingWorkingSets.isEmpty())
- fWorkingSets= (IWorkingSet[]) existingWorkingSets.toArray(new IWorkingSet[existingWorkingSets.size()]);
-
- saveState();
-
- if (fWorkingSetText != null)
- fWorkingSetText.setText(toString(fWorkingSets));
- }
-
- /**
- * Saves the last recently used working sets,
- * if any.
- */
- private void saveState() {
- if (fWorkingSets != null && fWorkingSets.length > 0) {
- String[] existingWorkingSetNames= new String[fWorkingSets.length];
- for (int i= 0; i < existingWorkingSetNames.length; i++)
- existingWorkingSetNames[i]= fWorkingSets[i].getName();
- fgSettingsStore.put(STORE_LRU_WORKING_SET_NAMES, existingWorkingSetNames);
- }
- }
-
- /**
- * Creates this scope part.
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- */
- public Composite createPart(Composite parent) {
- fPart= new Group(parent, SWT.NONE);
- fPart.setText(SearchMessages.getString("ScopePart.group.text")); //$NON-NLS-1$
-
- GridLayout layout= new GridLayout();
- layout.numColumns= 4;
- fPart.setLayout(layout);
- fPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- fUseWorkspace= new Button(fPart, SWT.RADIO);
- fUseWorkspace.setData(new Integer(ISearchPageContainer.WORKSPACE_SCOPE));
- fUseWorkspace.setText(SearchMessages.getString("ScopePart.workspaceScope.text")); //$NON-NLS-1$
-
- fUseSelection= new Button(fPart, SWT.RADIO);
- fUseSelection.setData(new Integer(ISearchPageContainer.SELECTION_SCOPE));
- fUseSelection.setText(SearchMessages.getString("ScopePart.selectedResourcesScope.text")); //$NON-NLS-1$
- ISelection selection= fSearchPageContainer.getSelection();
- fUseSelection.setEnabled((selection instanceof IStructuredSelection &&
- !fSearchPageContainer.getSelection().isEmpty()));
-
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent= 8;
- fUseSelection.setLayoutData(gd);
-
- fUseProject= new Button(fPart, SWT.RADIO);
- fUseProject.setData(new Integer(ISearchPageContainer.SELECTED_PROJECTS_SCOPE));
- fUseProject.setText(SearchMessages.getString("ScopePart.enclosingProjectsScope.text")); //$NON-NLS-1$
- fUseProject.setEnabled((selection instanceof IStructuredSelection &&
- !fSearchPageContainer.getSelection().isEmpty()) ||
- hasFocusEditor());
-
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalSpan= 2;
- gd.horizontalIndent= 8;
- fUseProject.setLayoutData(gd);
- if (!fCanSearchEnclosingProjects)
- fUseProject.setVisible(false);
-
- fUseWorkingSet= new Button(fPart, SWT.RADIO);
- fUseWorkingSet.setData(new Integer(ISearchPageContainer.WORKING_SET_SCOPE));
- fUseWorkingSet.setText(SearchMessages.getString("ScopePart.workingSetScope.text")); //$NON-NLS-1$
- fWorkingSetText= new Text(fPart, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- Button chooseWorkingSet= new Button(fPart, SWT.PUSH);
- chooseWorkingSet.setLayoutData(new GridData());
- chooseWorkingSet.setText(SearchMessages.getString("ScopePart.workingSetChooseButton.text")); //$NON-NLS-1$
- SWTUtil.setButtonDimensionHint(chooseWorkingSet);
- chooseWorkingSet.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (handleChooseWorkingSet()) {
- setSelectedScope(ISearchPageContainer.WORKING_SET_SCOPE);
- }
- }
- });
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalIndent= 8;
- gd.horizontalSpan= 2;
- gd.widthHint= new PixelConverter(fWorkingSetText).convertWidthInCharsToPixels(30);
- fWorkingSetText.setLayoutData(gd);
-
- // Add scope change listeners
- SelectionAdapter scopeChangedLister= new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleScopeChanged(e);
- }
- };
- fUseWorkspace.addSelectionListener(scopeChangedLister);
- fUseSelection.addSelectionListener(scopeChangedLister);
- fUseProject.addSelectionListener(scopeChangedLister);
- fUseWorkingSet.addSelectionListener(scopeChangedLister);
-
- // Set initial scope
- setSelectedScope(fScope);
-
- // Set initial working set
- if (fWorkingSets != null)
- fWorkingSetText.setText(toString(fWorkingSets));
-
- return fPart;
- }
-
- /**
- * @return Whether an editor has the focus
- */
- private boolean hasFocusEditor() {
- IWorkbenchPage activePage= SearchPlugin.getActivePage();
- if (activePage == null)
- return false;
- if (activePage.getActivePart() instanceof IEditorPart)
- return true;
- return false;
- }
-
- private void handleScopeChanged(SelectionEvent e) {
- Object source= e.getSource();
- if (source instanceof Button) {
- Button button= (Button) source;
- if (button.getSelection())
- setSelectedScope(((Integer) button.getData()).intValue());
- }
- }
-
- private boolean handleChooseWorkingSet() {
- IWorkingSetSelectionDialog dialog=
- PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(
- fUseSelection.getShell(),
- true);
-
- if (fWorkingSets != null)
- dialog.setSelection(fWorkingSets);
- if (dialog.open() == Window.OK) {
- Object[] result= dialog.getSelection();
- if (result.length > 0) {
- setSelectedWorkingSets((IWorkingSet[]) result);
- return true;
- }
- fWorkingSetText.setText(""); //$NON-NLS-1$
- fWorkingSets= null;
- if (fScope == ISearchPageContainer.WORKING_SET_SCOPE)
- setSelectedScope(ISearchPageContainer.WORKSPACE_SCOPE);
- return false;
- } else {
- if (fWorkingSets != null) {
- // test if selected working set has been removed
- int i= 0;
- while (i < fWorkingSets.length) {
- if (PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(fWorkingSets[i].getName())
- == null)
- break;
- i++;
- }
- if (i < fWorkingSets.length) {
- fWorkingSetText.setText(""); //$NON-NLS-1$
- fWorkingSets= null;
- updateSearchPageContainerActionPerformedEnablement();
- }
- }
- }
- return false;
- }
-
- void setVisible(boolean state) {
- fPart.setVisible(state);
- }
-
- public static String toString(IWorkingSet[] workingSets) {
- String result= ""; //$NON-NLS-1$
- if (workingSets != null && workingSets.length > 0) {
- Arrays.sort(workingSets, new WorkingSetComparator());
- boolean firstFound= false;
- for (int i= 0; i < workingSets.length; i++) {
- String workingSetName= workingSets[i].getName();
- if (firstFound)
- result= SearchMessages.getFormattedString("ScopePart.workingSetConcatenation", new String[] { result, workingSetName }); //$NON-NLS-1$
- else {
- result= workingSetName;
- firstFound= true;
- }
- }
- }
- return result;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java
deleted file mode 100644
index 9a78101b36d..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/Search.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.search.internal.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IWorkspaceDescription;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.search.ui.IActionGroupFactory;
-import org.eclipse.search.ui.IContextMenuContributor;
-import org.eclipse.search.ui.IGroupByKeyComputer;
-import org.eclipse.search.ui.ISearchResultViewEntry;
-
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
-public class Search extends Object {
- private String fPageId;
- private String fSingularLabel;
- private String fPluralLabelPattern;
- private ImageDescriptor fImageDescriptor;
- private ILabelProvider fLabelProvider;
- private ISelection fSelection;
- private ArrayList fResults;
- private IAction fGotoMarkerAction;
- private IContextMenuContributor fContextMenuContributor;
- private IActionGroupFactory fActionGroupFactory;
- private IGroupByKeyComputer fGroupByKeyComputer;
- private IRunnableWithProgress fOperation;
-
-
- public Search(String pageId, String singularLabel, String pluralLabelPattern, ILabelProvider labelProvider, ImageDescriptor imageDescriptor, IAction gotoMarkerAction, IActionGroupFactory groupFactory, IGroupByKeyComputer groupByKeyComputer, IRunnableWithProgress operation) {
- fPageId= pageId;
- fSingularLabel= singularLabel;
- fPluralLabelPattern= pluralLabelPattern;
- fImageDescriptor= imageDescriptor;
- fLabelProvider= labelProvider;
- fGotoMarkerAction= gotoMarkerAction;
- fActionGroupFactory= groupFactory;
- fGroupByKeyComputer= groupByKeyComputer;
- fOperation= operation;
-
- if (fPluralLabelPattern == null)
- fPluralLabelPattern= ""; //$NON-NLS-1$
- }
-
- public Search(String pageId, String singularLabel, String pluralLabelPattern, ILabelProvider labelProvider, ImageDescriptor imageDescriptor, IAction gotoMarkerAction, IContextMenuContributor contextMenuContributor, IGroupByKeyComputer groupByKeyComputer, IRunnableWithProgress operation) {
- fPageId= pageId;
- fSingularLabel= singularLabel;
- fPluralLabelPattern= pluralLabelPattern;
- fImageDescriptor= imageDescriptor;
- fLabelProvider= labelProvider;
- fGotoMarkerAction= gotoMarkerAction;
- fContextMenuContributor= contextMenuContributor;
- fGroupByKeyComputer= groupByKeyComputer;
- fOperation= operation;
-
- if (fPluralLabelPattern == null)
- fPluralLabelPattern= ""; //$NON-NLS-1$
- }
-
- /**
- * Returns the full description of the search.
- * The description set by the client where
- * {0} will be replaced by the match count.
- */
- String getFullDescription() {
- if (fSingularLabel != null && getItemCount() == 1)
- return fSingularLabel;
-
- // try to replace "{0}" with the match count
- int i= fPluralLabelPattern.lastIndexOf("{0}"); //$NON-NLS-1$
- if (i < 0)
- return fPluralLabelPattern;
- else
- return fPluralLabelPattern.substring(0, i) + getItemCount()+ fPluralLabelPattern.substring(Math.min(i + 3, fPluralLabelPattern.length()));
- }
-
- /**
- * Returns a short description of the search.
- * Cuts off after 30 characters and adds ...
- * The description set by the client where
- * {0} will be replaced by the match count.
- */
- String getShortDescription() {
- String text= getFullDescription();
- int separatorPos= text.indexOf(" - "); //$NON-NLS-1$
- if (separatorPos < 1)
- return text.substring(0, Math.min(50, text.length())) + "..."; // use first 50 characters //$NON-NLS-1$
- if (separatorPos < 30)
- return text; // don't cut
- if (text.charAt(0) == '"') //$NON-NLS-1$
- return text.substring(0, Math.min(30, text.length())) + "...\" - " + text.substring(Math.min(separatorPos + 3, text.length())); //$NON-NLS-1$
- else
- return text.substring(0, Math.min(30, text.length())) + "... - " + text.substring(Math.min(separatorPos + 3, text.length())); //$NON-NLS-1$
- }
- /** Image used when search is displayed in a list */
- ImageDescriptor getImageDescriptor() {
- return fImageDescriptor;
- }
-
- int getItemCount() {
- int count= 0;
- Iterator iter= getResults().iterator();
- while (iter.hasNext())
- count += ((ISearchResultViewEntry)iter.next()).getMatchCount();
- return count;
- }
-
- List getResults() {
- if (fResults == null)
- return new ArrayList();
- return fResults;
- }
-
- ILabelProvider getLabelProvider() {
- return fLabelProvider;
- }
-
- void searchAgain() {
- if (fOperation == null)
- return;
- Shell shell= SearchPlugin.getActiveWorkbenchShell();
- IWorkspaceDescription workspaceDesc= SearchPlugin.getWorkspace().getDescription();
- boolean isAutoBuilding= workspaceDesc.isAutoBuilding();
- if (isAutoBuilding)
- // disable auto-build during search operation
- SearchPlugin.setAutoBuilding(false);
- try {
- new ProgressMonitorDialog(shell).run(true, true, fOperation);
- } catch (InvocationTargetException ex) {
- ExceptionHandler.handle(ex, shell, SearchMessages.getString("Search.Error.search.title"), SearchMessages.getString("Search.Error.search.message")); //$NON-NLS-2$ //$NON-NLS-1$
- } catch(InterruptedException e) {
- } finally {
- if (isAutoBuilding)
- // enable auto-building again
- SearchPlugin.setAutoBuilding(true);
- }
- }
-
- boolean isSameSearch(Search search) {
- return search != null && search.getOperation() == fOperation && fOperation != null;
- }
-
- void backupMarkers() {
- Iterator iter= getResults().iterator();
- while (iter.hasNext()) {
- ((SearchResultViewEntry)iter.next()).backupMarkers();
- }
- }
-
- String getPageId() {
- return fPageId;
- }
-
- IGroupByKeyComputer getGroupByKeyComputer() {
- return fGroupByKeyComputer;
- }
-
- public IRunnableWithProgress getOperation() {
- return fOperation;
- }
-
- IAction getGotoMarkerAction() {
- return fGotoMarkerAction;
- }
-
- IContextMenuContributor getContextMenuContributor() {
- return fContextMenuContributor;
- }
-
- IActionGroupFactory getActionGroupFactory() {
- return fActionGroupFactory;
- }
-
- public void removeResults() {
- fResults= null;
- }
-
- void setResults(ArrayList results) {
- Assert.isNotNull(results);
- fResults= results;
- }
-
- ISelection getSelection() {
- return fSelection;
- }
-
- void setSelection(ISelection selection) {
- fSelection= selection;
- }
-}
-
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchAgainAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchAgainAction.java
deleted file mode 100644
index 304d838c78b..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchAgainAction.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.search.internal.ui;
-
-import org.eclipse.jface.action.Action;
-
-class SearchAgainAction extends Action {
-
- public SearchAgainAction() {
- super(SearchMessages.getString("SearchResultView.searchAgain.text")); //$NON-NLS-1$
- setToolTipText(SearchMessages.getString("SearchResultView.searchAgain.tooltip")); //$NON-NLS-1$
- }
-
- public void run() {
- Search selected= SearchManager.getDefault().getCurrentSearch();
- if (selected != null)
- selected.searchAgain();
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java
deleted file mode 100644
index 64dd64485c5..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java
+++ /dev/null
@@ -1,574 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.search.internal.ui.util.ExtendedDialogWindow;
-import org.eclipse.search.internal.ui.util.ListContentProvider;
-import org.eclipse.search.internal.ui.util.SWTUtil;
-import org.eclipse.search.ui.IReplacePage;
-import org.eclipse.search.ui.ISearchPage;
-import org.eclipse.search.ui.ISearchPageContainer;
-import org.eclipse.search.ui.ISearchPageScoreComputer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-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.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-class SearchDialog extends ExtendedDialogWindow implements ISearchPageContainer {
-
- private class TabFolderLayout extends Layout {
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
-
- int x= 0;
- int y= 0;
- Control[] children= composite.getChildren();
- for (int i= 0; i < children.length; i++) {
- Point size= children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- x= Math.max(x, size.x);
- y= Math.max(y, size.y);
- }
-
- Point minSize= getMinSize();
- x= Math.max(x, minSize.x);
- y= Math.max(y, minSize.y);
-
- if (wHint != SWT.DEFAULT)
- x= wHint;
- if (hHint != SWT.DEFAULT)
- y= hHint;
- return new Point(x, y);
- }
- protected void layout(Composite composite, boolean flushCache) {
- Rectangle rect= composite.getClientArea();
-
- Control[] children= composite.getChildren();
- for (int i= 0; i < children.length; i++) {
- children[i].setBounds(rect);
- }
- }
- }
-
-
- private static final int SEARCH_ID= IDialogConstants.CLIENT_ID+1;
- private static final int REPLACE_ID= SEARCH_ID+1;
-
- private IWorkspace fWorkspace;
- private ISearchPage fCurrentPage;
- private String fInitialPageId;
- private int fCurrentIndex;
- private ISelection fSelection;
- private IEditorPart fEditorPart;
- private List fDescriptors;
- private Point fMinSize;
- private ScopePart[] fScopeParts;
- private boolean fPageStateIgnoringScopePart;
- private Button fCustomizeButton;
- private Button fReplaceButton;
-
- public SearchDialog(Shell shell, IWorkspace workspace, ISelection selection, IEditorPart editor, String pageId) {
- super(shell);
- Assert.isNotNull(workspace);
- fWorkspace= workspace;
- fSelection= selection;
- fEditorPart= editor;
- fDescriptors= SearchPlugin.getDefault().getEnabledSearchPageDescriptors(pageId);
- fInitialPageId= pageId;
- }
-
- /* (non-Javadoc)
- * Method declared in Window.
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(SearchMessages.getString("SearchDialog.title")); //$NON-NLS-1$
- shell.setImage(SearchPluginImages.get(SearchPluginImages.IMG_TOOL_SEARCH));
- WorkbenchHelp.setHelp(shell, ISearchHelpContextIds.SEARCH_DIALOG);
- }
-
- public IWorkspace getWorkspace() {
- return fWorkspace;
- }
-
- public ISelection getSelection() {
- return fSelection;
- }
-
- public IEditorPart getEditorPart() {
- return fEditorPart;
- }
-
- //---- Page Handling -------------------------------------------------------
-
- /*
- * Overrides method from Window
- */
- public void create() {
- super.create();
- if (fCurrentPage != null)
- fCurrentPage.setVisible(true);
- }
-
- private void handleCustomizePressed() {
- List input= SearchPlugin.getDefault().getSearchPageDescriptors();
- final ArrayList createdImages= new ArrayList(input.size());
- ILabelProvider labelProvider= new LabelProvider() {
- public String getText(Object element) {
- if (element instanceof SearchPageDescriptor) {
- String label= ((SearchPageDescriptor)element).getLabel();
- int i= label.indexOf('&');
- while (i >= 0) {
- if (i < label.length())
- label= label.substring(0, i) + label.substring(i+1);
- else
- label.substring(0, i);
- i= label.indexOf('&');
- }
- return label;
- } else
- return null;
- }
- public Image getImage(Object element) {
- if (element instanceof SearchPageDescriptor) {
- ImageDescriptor imageDesc= ((SearchPageDescriptor)element).getImage();
- if (imageDesc == null)
- return null;
- Image image= imageDesc.createImage();
- if (image != null)
- createdImages.add(image);
- return image;
- } else
- return null;
- }
- };
-
- String message= SearchMessages.getString("SearchPageSelectionDialog.message"); //$NON-NLS-1$
-
- ListSelectionDialog dialog= new ListSelectionDialog(getShell(), input, new ListContentProvider(), labelProvider, message) {
- public void create() {
- super.create();
- final CheckboxTableViewer viewer= getViewer();
- final Button okButton= this.getOkButton();
- viewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- okButton.setEnabled(viewer.getCheckedElements().length > 0);
- }
- });
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- okButton.setEnabled(viewer.getCheckedElements().length > 0);
- }
- };
- this.getButton(IDialogConstants.SELECT_ALL_ID).addSelectionListener(listener);
- this.getButton(IDialogConstants.DESELECT_ALL_ID).addSelectionListener(listener);
- }
- };
- dialog.setTitle(SearchMessages.getString("SearchPageSelectionDialog.title")); //$NON-NLS-1$
- dialog.setInitialSelections(SearchPlugin.getDefault().getEnabledSearchPageDescriptors(fInitialPageId).toArray());
- if (dialog.open() == Window.OK) {
- SearchPageDescriptor.setEnabled(dialog.getResult());
- Display display= getShell().getDisplay();
- close();
- if (display != null && !display.isDisposed()) {
- display.asyncExec(
- new Runnable() {
- public void run() {
- new OpenSearchDialogAction().run();
- }
- });
- }
- }
- destroyImages(createdImages);
- }
-
- private void destroyImages(List images) {
- Iterator iter= images.iterator();
- while (iter.hasNext()) {
- Image image= (Image)iter.next();
- if (image != null && !image.isDisposed())
- image.dispose();
- }
- }
-
- protected Control createPageArea(Composite parent) {
- int numPages= fDescriptors.size();
- fScopeParts= new ScopePart[numPages];
-
- if (numPages == 0) {
- Label label= new Label(parent, SWT.CENTER | SWT.WRAP);
- label.setText(SearchMessages.getString("SearchDialog.noSearchExtension")); //$NON-NLS-1$
- return label;
- }
-
- fCurrentIndex= getPreferredPageIndex();
-
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- fCurrentPage= getDescriptorAt(fCurrentIndex).createObject();
- }
- });
-
- fCurrentPage.setContainer(this);
-
- if (numPages == 1)
- return getControl(fCurrentPage, parent, 0);
- else {
- Composite border= new Composite(parent, SWT.NONE);
- FillLayout layout= new FillLayout();
- layout.marginWidth= 7;
- layout.marginHeight= 7;
- border.setLayout(layout);
-
- TabFolder folder= new TabFolder(border, SWT.NONE);
- folder.setLayout(new TabFolderLayout());
-
- for (int i= 0; i < numPages; i++) {
- SearchPageDescriptor descriptor= (SearchPageDescriptor)fDescriptors.get(i);
-
- final TabItem item= new TabItem(folder, SWT.NONE);
- item.setText(descriptor.getLabel());
- item.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- item.setData(null);
- if (item.getImage() != null)
- item.getImage().dispose();
- }
- });
- ImageDescriptor imageDesc= descriptor.getImage();
- if (imageDesc != null)
- item.setImage(imageDesc.createImage());
- item.setData(descriptor);
- if (i == fCurrentIndex) {
- item.setControl(getControl(fCurrentPage, folder, i));
- item.setData(fCurrentPage);
- }
- }
-
- folder.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- turnToPage(event);
- }
- });
-
- folder.setSelection(fCurrentIndex);
-
- return border;
- }
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- fReplaceButton= createActionButton(parent, REPLACE_ID, SearchMessages.getString("SearchDialog.replaceAction"), true); //$NON-NLS-1$
- fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage);
- createActionButton(parent, SEARCH_ID, SearchMessages.getString("SearchDialog.searchAction"), true); //$NON-NLS-1$
- super.createButtonsForButtonBar(parent);
- }
-
- protected Control createButtonBar(Composite parent) {
- Composite composite= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns= 3;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
-
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- fCustomizeButton= new Button(composite, SWT.NONE);
- fCustomizeButton.setText(SearchMessages.getString("SearchDialog.customize")); //$NON-NLS-1$
- GridData gd= new GridData();
- gd.horizontalIndent= 2 * new GridLayout().marginWidth;
- fCustomizeButton.setLayoutData(gd);
- SWTUtil.setButtonDimensionHint(fCustomizeButton);
- fCustomizeButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleCustomizePressed();
- }
- });
-
- Label filler= new Label(composite, SWT.NONE);
- filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
-
- Control result= super.createButtonBar(composite);
- getButton(SEARCH_ID).setEnabled(fDescriptors.size() > 0);
- applyDialogFont(composite);
-
- return result;
- }
-
- protected boolean performAction(int actionID) {
- if (fCurrentPage == null)
- return true;
-
- boolean isAutoBuilding= SearchPlugin.getWorkspace().isAutoBuilding();
- if (isAutoBuilding)
- // disable auto-build during search operation
- SearchPlugin.setAutoBuilding(false);
- try {
- fCustomizeButton.setEnabled(false);
- if (actionID == SEARCH_ID)
- return fCurrentPage.performAction();
- else
- // safe cast, replace button is only visible when the curren page is
- // a replace page.
- return ((IReplacePage)fCurrentPage).performReplace();
- } finally {
- fCustomizeButton.setEnabled(true);
- if (isAutoBuilding)
- // enable auto-building again
- SearchPlugin.setAutoBuilding(true);
- }
- }
-
- private SearchPageDescriptor getDescriptorAt(int index) {
- return (SearchPageDescriptor)fDescriptors.get(index);
- }
-
- private Point getMinSize() {
- if (fMinSize != null)
- return fMinSize;
-
- int x= 0;
- int y= 0;
- int length= fDescriptors.size();
- for (int i= 0; i < length; i++) {
- Point size= getDescriptorAt(i).getPreferredSize();
- if (size.x != SWT.DEFAULT)
- x= Math.max(x, size.x);
- if (size.y != SWT.DEFAULT)
- y= Math.max(y, size.y);
- }
-
- fMinSize= new Point(x, y);
- return fMinSize;
- }
-
- private void turnToPage(SelectionEvent event) {
- final TabItem item= (TabItem)event.item;
- TabFolder folder= item.getParent();
- Control oldControl= folder.getItem(fCurrentIndex).getControl();
- Point oldSize= oldControl.getSize();
- if (item.getControl() == null) {
- final SearchPageDescriptor descriptor= (SearchPageDescriptor)item.getData();
-
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- item.setData(descriptor.createObject());
- }
- });
-
- ISearchPage page= (ISearchPage)item.getData();
- page.setContainer(this);
-
- Control newControl= getControl(page, (Composite)event.widget, item.getParent().getSelectionIndex());
- item.setControl(newControl);
-
- }
- if (item.getData() instanceof ISearchPage) {
- fCurrentPage= (ISearchPage)item.getData();
- fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage);
- fCurrentIndex= item.getParent().getSelectionIndex();
- fCurrentPage.setVisible(true);
- }
- Control newControl= item.getControl();
- resizeDialogIfNeeded(oldSize, newControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
- }
-
- private int getPreferredPageIndex() {
- Object element= null;
- if (fSelection instanceof IStructuredSelection)
- element= ((IStructuredSelection)fSelection).getFirstElement();
- if (element == null && fEditorPart != null) {
- element= fEditorPart.getEditorInput();
- if (element instanceof IFileEditorInput)
- element= ((IFileEditorInput)element).getFile();
- }
- int result= 0;
- int level= ISearchPageScoreComputer.LOWEST;
- int size= fDescriptors.size();
- for (int i= 0; i < size; i++) {
- SearchPageDescriptor descriptor= (SearchPageDescriptor)fDescriptors.get(i);
- if (fInitialPageId != null && fInitialPageId.equals(descriptor.getId()))
- return i;
-
- int newLevel= descriptor.computeScore(element);
- if ( newLevel > level) {
- level= newLevel;
- result= i;
- }
- }
- return result;
- }
-
- /*
- * Implements method from ISearchPageContainer
- */
- public IRunnableContext getRunnableContext() {
- return this;
- }
-
- /*
- * Implements method from ISearchPageContainer
- */
- public int getSelectedScope() {
- if (fScopeParts[fCurrentIndex] == null)
- // safe code - should not happen
- return ISearchPageContainer.WORKSPACE_SCOPE;
- else
- return fScopeParts[fCurrentIndex].getSelectedScope();
- }
-
- /*
- * Implements method from ISearchPageContainer
- */
- public IWorkingSet[] getSelectedWorkingSets() {
- if (fScopeParts[fCurrentIndex] == null)
- // safe code - should not happen
- return null;
- else
- return fScopeParts[fCurrentIndex].getSelectedWorkingSets();
- }
-
- /*
- * Implements method from ISearchPageContainer
- */
- public void setSelectedScope(int scope) {
- if (fScopeParts[fCurrentIndex] != null)
- fScopeParts[fCurrentIndex].setSelectedScope(scope);
- }
-
- /*
- * Implements method from ISearchPageContainer
- */
- public boolean hasValidScope() {
- return getSelectedScope() != WORKING_SET_SCOPE || getSelectedWorkingSets() != null;
- }
-
- /*
- * Implements method from ISearchPageContainer
- */
- public void setSelectedWorkingSets(IWorkingSet[] workingSets) {
- if (fScopeParts[fCurrentIndex] != null)
- fScopeParts[fCurrentIndex].setSelectedWorkingSets(workingSets);
- }
-
- /*
- * Overrides method from ExtendedDialogWindow
- */
- public void setPerformActionEnabled(boolean state) {
- super.setPerformActionEnabled(state);
- fPageStateIgnoringScopePart= state;
- setPerformActionEnabledFromScopePart(hasValidScope());
- }
-
- /**
- * Set the enable state of the perform action button.
- * <p>
- * Note: This is a special method to be called only from the ScopePart
- * </p>
- */
- public void setPerformActionEnabledFromScopePart(boolean state) {
- if (fPageStateIgnoringScopePart)
- super.setPerformActionEnabled(state);
- }
-
- private Control getControl(ISearchPage page, Composite parent, int index) {
- Control control= page.getControl();
- if (control != null)
- return control;
- // Page wrapper
- Composite pageWrapper= new Composite(parent, SWT.NONE);
- GridLayout layout= new GridLayout();
- layout.marginWidth= 0;
- layout.marginHeight= 0;
- pageWrapper.setLayout(layout);
-
- Dialog.applyDialogFont(pageWrapper);
- // The page itself
- page.createControl(pageWrapper);
-
-
- // Search scope
- SearchPageDescriptor descriptor= getDescriptorAt(index);
- boolean showScope= descriptor.showScopeSection();
- if (showScope) {
- Composite c= new Composite(pageWrapper, SWT.NONE);
- layout= new GridLayout();
- c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- c.setLayout(layout);
- fScopeParts[index]= new ScopePart(this, descriptor.canSearchInProjects());
- Control part= fScopeParts[index].createPart(c);
- applyDialogFont(part);
- fScopeParts[index].setVisible(true);
- }
- return pageWrapper;
- }
-
- private void resizeDialogIfNeeded(Point oldSize, Point newSize) {
- if (oldSize == null || newSize == null)
- return;
- Shell shell= getShell();
- Point shellSize= shell.getSize();
- if (mustResize(oldSize, newSize)) {
- if (newSize.x > oldSize.x)
- shellSize.x+= (newSize.x-oldSize.x);
- if (newSize.y > oldSize.y)
- shellSize.y+= (newSize.y-oldSize.y);
- shell.setSize(shellSize);
- shell.layout(true);
- }
- }
-
- private boolean mustResize(Point currentSize, Point newSize) {
- return currentSize.x < newSize.x || currentSize.y < newSize.y;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDropDownAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDropDownAction.java
deleted file mode 100644
index bb6db831989..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDropDownAction.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.search.internal.ui;
-
-import java.util.Iterator;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-
-class SearchDropDownAction extends Action implements IMenuCreator {
-
-
- public static final int RESULTS_IN_DROP_DOWN= 10;
-
- private Menu fMenu;
-
- public SearchDropDownAction() {
- setText(SearchMessages.getString("SearchResultView.previousSearches.text")); //$NON-NLS-1$
- setToolTipText(SearchMessages.getString("SearchResultView.previousSearches.tooltip")); //$NON-NLS-1$
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_HISTORY);
- setMenuCreator(this);
- }
-
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- fMenu= null;
- }
- }
-
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- public Menu getMenu(Control parent) {
- if (fMenu != null)
- fMenu.dispose();
-
- fMenu= new Menu(parent);
- boolean checkedOne= false;
- Iterator iter= SearchManager.getDefault().getPreviousSearches().iterator();
- Search selected= SearchManager.getDefault().getCurrentSearch();
- int i= 0;
- while (iter.hasNext() && i++ < RESULTS_IN_DROP_DOWN) {
- Search search= (Search)iter.next();
- ShowSearchAction action= new ShowSearchAction(search);
- action.setChecked(search.equals(selected));
- if (search.equals(selected))
- checkedOne= true;
- addActionToMenu(fMenu, action);
- }
- new MenuItem(fMenu, SWT.SEPARATOR);
- if (iter.hasNext()) {
- Action others= new ShowSearchesAction();
- others.setChecked(!checkedOne);
- addActionToMenu(fMenu, others);
- }
- addActionToMenu(fMenu, new RemoveAllSearchesAction());
- return fMenu;
- }
-
- protected void addActionToMenu(Menu parent, Action action) {
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- public void run() {
- new ShowSearchesAction().run(true);
- }
-
- /**
- * Get's rid of the menu, because the menu hangs on to
- * the searches, etc.
- */
- void clear() {
- dispose();
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchManager.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchManager.java
deleted file mode 100644
index 6e310231650..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchManager.java
+++ /dev/null
@@ -1,507 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-
-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;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-import org.eclipse.search.ui.IGroupByKeyComputer;
-import org.eclipse.search.ui.SearchUI;
-
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
-/**
- * Manage search results
- */
-public class SearchManager implements IResourceChangeListener {
-
- static final SearchManager fgDefault= new SearchManager();
-
- Search fCurrentSearch= null;
-
- private SearchManager() {
- SearchPlugin.getWorkspace().addResourceChangeListener(this);
- }
-
- private HashSet fListeners= new HashSet();
- private LinkedList fPreviousSearches= new LinkedList();
- private boolean fIsRemoveAll= false;
-
- public static SearchManager getDefault() {
- return fgDefault;
- }
-
- /**
- * Returns the list with previous searches (ISearch).
- */
- LinkedList getPreviousSearches() {
- return fPreviousSearches;
- }
- /**
- * Returns the list with current (last) results
- */
- ArrayList getCurrentResults() {
- if (fCurrentSearch == null)
- return new ArrayList(0);
- else
- return (ArrayList)fCurrentSearch.getResults();
- }
-
- public Search getCurrentSearch() {
- return fCurrentSearch;
- }
-
- void removeAllSearches() {
- SearchPlugin.getWorkspace().removeResourceChangeListener(this);
- WorkspaceModifyOperation op= new WorkspaceModifyOperation(null) {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(SearchMessages.getString("SearchManager.updating"), 100); //$NON-NLS-1$
- SearchPlugin.getWorkspace().getRoot().deleteMarkers(SearchUI.SEARCH_MARKER, true, IResource.DEPTH_INFINITE);
- monitor.worked(100);
- monitor.done();
- }
- };
- boolean isAutoBuilding= SearchPlugin.getWorkspace().isAutoBuilding();
- if (isAutoBuilding)
- // disable auto-build during search operation
- SearchPlugin.setAutoBuilding(false);
- try {
- ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
- dialog.run(true, true, op);
- } catch (InvocationTargetException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.deleteMarkers.title"), SearchMessages.getString("Search.Error.deleteMarkers.message")); //$NON-NLS-2$ //$NON-NLS-1$
- } catch (InterruptedException e) {
- // Do nothing. Operation has been canceled.
- } finally {
- SearchPlugin.getWorkspace().addResourceChangeListener(this);
- if (isAutoBuilding)
- // enable auto-building again
- SearchPlugin.setAutoBuilding(true);
- }
-
- // clear searches
- fPreviousSearches= new LinkedList();
- fCurrentSearch= null;
-
- // update viewers
- Iterator iter= fListeners.iterator();
- while (iter.hasNext()) {
- SearchResultViewer viewer= (SearchResultViewer)iter.next();
- handleAllSearchesRemoved(viewer);
- }
- }
-
- private void handleAllSearchesRemoved(SearchResultViewer viewer) {
- viewer.handleAllSearchesRemoved();
- }
-
- void setCurrentSearch(final Search search) {
- if (fCurrentSearch == search)
- return;
-
- SearchPlugin.getWorkspace().removeResourceChangeListener(this);
- WorkspaceModifyOperation op= new WorkspaceModifyOperation(null) {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- internalSetCurrentSearch(search, monitor);
- }
- };
- boolean isAutoBuilding= SearchPlugin.getWorkspace().isAutoBuilding();
- if (isAutoBuilding)
- // disable auto-build during search operation
- SearchPlugin.setAutoBuilding(false);
- try {
- ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
- dialog.run(true, true, op);
- } catch (InvocationTargetException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.switchSearch.title"), SearchMessages.getString("Search.Error.switchSearch.message")); //$NON-NLS-2$ //$NON-NLS-1$
- } catch (InterruptedException e) {
- // Do nothing. Operation has been canceled.
- } finally {
- SearchPlugin.getWorkspace().addResourceChangeListener(this);
- if (isAutoBuilding)
- // enable auto-building again
- SearchPlugin.setAutoBuilding(true);
- }
-
- getPreviousSearches().remove(search);
- getPreviousSearches().addFirst(search);
- }
-
- void internalSetCurrentSearch(final Search search, IProgressMonitor monitor) {
- if (fCurrentSearch != null)
- fCurrentSearch.backupMarkers();
-
- final Search previousSearch= fCurrentSearch;
- fCurrentSearch= search;
- monitor.beginTask(SearchMessages.getString("SearchManager.updating"), getCurrentResults().size() + 20); //$NON-NLS-1$
-
- // remove current search markers
- try {
- SearchPlugin.getWorkspace().getRoot().deleteMarkers(SearchUI.SEARCH_MARKER, true, IResource.DEPTH_INFINITE);
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.deleteMarkers.title"), SearchMessages.getString("Search.Error.deleteMarkers.message")); //$NON-NLS-2$ //$NON-NLS-1$
- }
- monitor.worked(10);
-
- // add search markers
- Iterator iter= getCurrentResults().iterator();
- ArrayList emptyEntries= new ArrayList(10);
- boolean filesChanged= false;
- boolean filesDeleted= false;
- IGroupByKeyComputer groupByKeyComputer= getCurrentSearch().getGroupByKeyComputer();
- while (iter.hasNext()) {
- monitor.worked(1);
- SearchResultViewEntry entry= (SearchResultViewEntry)iter.next();
- Iterator attrPerMarkerIter= entry.getAttributesPerMarker().iterator();
- entry.clearMarkerList();
- if (entry.getResource() == null || !entry.getResource().exists()) {
- emptyEntries.add(entry);
- filesDeleted= true;
- continue;
- }
- while (attrPerMarkerIter.hasNext()) {
- IMarker newMarker= null;
- try {
- newMarker= entry.getResource().createMarker(entry.getMarkerType());
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.createMarker.title"), SearchMessages.getString("Search.Error.createMarker.message")); //$NON-NLS-2$ //$NON-NLS-1$
- continue;
- }
- try {
- newMarker.setAttributes((Map)attrPerMarkerIter.next());
- if (groupByKeyComputer !=null && groupByKeyComputer.computeGroupByKey(newMarker) == null) {
- filesDeleted= true;
- newMarker.delete();
- continue;
- }
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.markerAttributeAccess.title"), SearchMessages.getString("Search.Error.markerAttributeAccess.message")); //$NON-NLS-2$ //$NON-NLS-1$
- }
- entry.add(newMarker);
- }
- if (entry.getMatchCount() == 0)
- emptyEntries.add(entry);
- else if (!filesChanged && entry.getResource().getModificationStamp() != entry.getModificationStamp())
- filesChanged= true;
- }
- getCurrentResults().removeAll(emptyEntries);
- monitor.worked(10);
-
- String warningMessage= null;
- Display display= getDisplay();
-
- if (filesChanged)
- warningMessage= SearchMessages.getString("SearchManager.resourceChanged"); //$NON-NLS-1$
- if (filesDeleted) {
- if (warningMessage == null)
- warningMessage= ""; //$NON-NLS-1$
- else
- warningMessage += "\n"; //$NON-NLS-1$
- warningMessage += SearchMessages.getString("SearchManager.resourceDeleted"); //$NON-NLS-1$
- }
- if (warningMessage != null) {
- if (display != null && !display.isDisposed()) {
- final String warningTitle= SearchMessages.getString("SearchManager.resourceChangedWarning"); //$NON-NLS-1$
- final String warningMsg= warningMessage;
- display.syncExec(new Runnable() {
- public void run() {
- MessageDialog.openWarning(getShell(), warningTitle, warningMsg);
- }
- });
- }
- }
-
- // update viewers
- iter= fListeners.iterator();
- if (display != null && !display.isDisposed()) {
- final Viewer visibleViewer= ((SearchResultView)SearchPlugin.getSearchResultView()).getViewer();
- while (iter.hasNext()) {
- final SearchResultViewer viewer= (SearchResultViewer)iter.next();
- display.syncExec(new Runnable() {
- public void run() {
- if (previousSearch != null && viewer == visibleViewer)
- previousSearch.setSelection(viewer.getSelection());
- viewer.setInput(null);
- viewer.setPageId(search.getPageId());
- viewer.setGotoMarkerAction(search.getGotoMarkerAction());
- viewer.setContextMenuTarget(search.getContextMenuContributor());
- viewer.setActionGroupFactory(null);
- viewer.setInput(getCurrentResults());
- viewer.setActionGroupFactory(search.getActionGroupFactory());
- viewer.setSelection(fCurrentSearch.getSelection(), true);
- }
- });
- }
- }
- monitor.done();
- }
-
- /**
- * Returns the number of matches
- */
- int getCurrentItemCount() {
- if (fCurrentSearch != null)
- return fCurrentSearch.getItemCount();
- else
- return 0;
- }
-
- void removeAllResults() {
- fIsRemoveAll= true;
- try {
- SearchPlugin.getWorkspace().getRoot().deleteMarkers(SearchUI.SEARCH_MARKER, true, IResource.DEPTH_INFINITE);
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.deleteMarkers.title"), SearchMessages.getString("Search.Error.deleteMarkers.message")); //$NON-NLS-2$ //$NON-NLS-1$
- fIsRemoveAll= false;
- }
- }
-
- void addNewSearch(final Search newSearch) {
-
- SearchPlugin.getWorkspace().removeResourceChangeListener(this);
-
- // Clear the viewers
- Iterator iter= fListeners.iterator();
- Display display= getDisplay();
- if (display != null && !display.isDisposed()) {
- final Viewer visibleViewer= ((SearchResultView)SearchPlugin.getSearchResultView()).getViewer();
- while (iter.hasNext()) {
- final SearchResultViewer viewer= (SearchResultViewer)iter.next();
- display.syncExec(new Runnable() {
- public void run() {
- if (fCurrentSearch != null && viewer == visibleViewer)
- fCurrentSearch.setSelection(viewer.getSelection());
- setNewSearch(viewer, newSearch);
- }
- });
- }
- }
-
- if (fCurrentSearch != null) {
- if (fCurrentSearch.isSameSearch(newSearch))
- getPreviousSearches().remove(fCurrentSearch);
- else
- fCurrentSearch.backupMarkers();
- }
- fCurrentSearch= newSearch;
- getPreviousSearches().addFirst(fCurrentSearch);
-
- // Remove the markers
- try {
- SearchPlugin.getWorkspace().getRoot().deleteMarkers(SearchUI.SEARCH_MARKER, true, IResource.DEPTH_INFINITE);
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.deleteMarkers.title"), SearchMessages.getString("Search.Error.deleteMarkers.message")); //$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- void searchFinished(ArrayList results) {
- Assert.isNotNull(results);
- getCurrentSearch().setResults(results);
-
- Display display= getDisplay();
- if (display == null || display.isDisposed())
- return;
-
- if (Thread.currentThread() == display.getThread())
- handleNewSearchResult();
- else {
- display.syncExec(new Runnable() {
- public void run() {
- handleNewSearchResult();
- }
- });
- }
- SearchPlugin.getWorkspace().addResourceChangeListener(this);
- }
-
- //--- Change event handling -------------------------------------------------
-
- void addSearchChangeListener(SearchResultViewer viewer) {
- fListeners.add(viewer);
- }
-
- void removeSearchChangeListener(SearchResultViewer viewer) {
- Assert.isNotNull(viewer);
- fListeners.remove(viewer);
- }
-
- private final void handleSearchMarkersChanged(IMarkerDelta[] markerDeltas) {
- if (fIsRemoveAll) {
- handleRemoveAll();
- fIsRemoveAll= false;
- return;
- }
-
- Iterator iter= fListeners.iterator();
- while (iter.hasNext())
- ((SearchResultViewer)iter.next()).getControl().setRedraw(false);
-
- for (int i=0; i < markerDeltas.length; i++) {
- handleSearchMarkerChanged(markerDeltas[i]);
- }
-
- iter= fListeners.iterator();
- while (iter.hasNext())
- ((SearchResultViewer)iter.next()).getControl().setRedraw(true);
-
- }
-
- private void handleSearchMarkerChanged(IMarkerDelta markerDelta) {
- int kind= markerDelta.getKind();
- // don't listen for adds will be done by ISearchResultView.addMatch(...)
- if (((kind & IResourceDelta.REMOVED) != 0))
- handleRemoveMatch(markerDelta.getMarker());
- else if ((kind & IResourceDelta.CHANGED) != 0)
- handleUpdateMatch(markerDelta.getMarker());
- }
-
- private void handleRemoveAll() {
- if (fCurrentSearch != null)
- fCurrentSearch.removeResults();
- Iterator iter= fListeners.iterator();
- while (iter.hasNext())
- ((SearchResultViewer)iter.next()).handleRemoveAll();
- }
-
- private void handleNewSearchResult() {
- Iterator iter= fListeners.iterator();
- while (iter.hasNext()) {
- SearchResultViewer viewer= (SearchResultViewer)iter.next();
- viewer.setInput(getCurrentResults());
- }
- }
-
- private void setNewSearch(SearchResultViewer viewer, Search search) {
- viewer.setInput(null);
- viewer.clearTitle();
- viewer.setPageId(search.getPageId());
- viewer.setGotoMarkerAction(search.getGotoMarkerAction());
- viewer.setContextMenuTarget(search.getContextMenuContributor());
- viewer.setActionGroupFactory(search.getActionGroupFactory());
- }
-
- private void handleRemoveMatch(IMarker marker) {
- SearchResultViewEntry entry= findEntry(marker);
- if (entry != null) {
- entry.remove(marker);
- if (entry.getMatchCount() == 0) {
- getCurrentResults().remove(entry);
- Iterator iter= fListeners.iterator();
- while (iter.hasNext())
- ((SearchResultViewer)iter.next()).handleRemoveMatch(entry);
- }
- else {
- Iterator iter= fListeners.iterator();
- while (iter.hasNext())
- ((SearchResultViewer)iter.next()).handleUpdateMatch(entry, true);
- }
- }
- }
-
- private void handleUpdateMatch(IMarker marker) {
- SearchResultViewEntry entry= findEntry(marker);
- if (entry != null) {
- Iterator iter= fListeners.iterator();
- while (iter.hasNext())
- ((SearchResultViewer)iter.next()).handleUpdateMatch(entry, false);
- }
- }
-
- private SearchResultViewEntry findEntry(IMarker marker) {
- Iterator entries= getCurrentResults().iterator();
- while (entries.hasNext()) {
- SearchResultViewEntry entry= (SearchResultViewEntry)entries.next();
- if (entry.contains(marker))
- return entry;
- }
- return null;
- }
-
- /**
- * Received a resource event. Since the delta could be created in a
- * separate thread this methods post the event into the viewer's
- * display thread.
- */
- public final void resourceChanged(final IResourceChangeEvent event) {
- if (event == null)
- return;
-
- final IMarkerDelta[] markerDeltas= event.findMarkerDeltas(SearchUI.SEARCH_MARKER, true);
- if (markerDeltas == null || markerDeltas.length < 1)
- return;
-
- Display display= getDisplay();
- if (display == null || display.isDisposed())
- return;
-
- Runnable runnable= new Runnable() {
- public void run() {
- if (getCurrentSearch() != null) {
- handleSearchMarkersChanged(markerDeltas);
- // update title and actions
- Iterator iter= fListeners.iterator();
- while (iter.hasNext()) {
- SearchResultViewer viewer= (SearchResultViewer)iter.next();
- viewer.enableActions();
- viewer.updateTitle();
- }
- }
- }
- };
- display.syncExec(runnable);
- }
- /**
- * Find and return a valid display
- */
- private Display getDisplay() {
- Iterator iter= fListeners.iterator();
- while (iter.hasNext()) {
- Control control= ((Viewer)iter.next()).getControl();
- if (control != null && !control.isDisposed()) {
- Display display= control.getDisplay();
- if (display != null && !display.isDisposed())
- return display;
- }
- }
- return null;
- }
- /**
- * Find and return a valid shell
- */
- private Shell getShell() {
- return SearchPlugin.getActiveWorkbenchShell();
- }
-}
-
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java
deleted file mode 100644
index 2f9d75ec664..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.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.search.internal.ui;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class SearchMessages {
-
- private static final String RESOURCE_BUNDLE= SearchMessages.class.getName();
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private SearchMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- /**
- * Gets a string from the resource bundle and formats it with the argument
- *
- * @param key the string used to get the bundle value, must not be null
- */
- public static String getFormattedString(String key, Object arg) {
- String format= null;
- try {
- format= fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- if (arg == null)
- arg= ""; //$NON-NLS-1$
- return MessageFormat.format(format, new Object[] { arg });
- }
-
- /**
- * Gets a string from the resource bundle and formats it with the argument
- *
- * @param key the string used to get the bundle value, must not be null
- */
- public static String getFormattedString(String key, Object[] args) {
- String format= null;
- try {
- format= fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- return MessageFormat.format(format, args);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties
deleted file mode 100644
index 4cbec3d110e..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties
+++ /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
-###############################################################################
-
-SearchDialog.title= Search
-SearchDialog.searchAction= &Search
-SearchDialog.replaceAction= R&eplace...
-SearchDialog.customize= Customi&ze...
-SearchDialog.noSearchExtension= No Search Extensions plugged into workbench or all search pages disabled.
-
-SearchPageSelectionDialog.title= Search Page Selection
-SearchPageSelectionDialog.message= S&elect from the pages shown in the dialog:
-
-SearchManager.resourceChangedWarning= Changed Resources
-SearchManager.resourceChanged= Some resources have changed. The positions of matches may have changed.
-SearchManager.resourceDeleted= Some resources no longer exist. Corresponding matches have been removed from the search results.
-SearchManager.updating= Updating...
-
-SearchResultView.title= Search
-SearchResultView.titleWithDescription= Search ({0})
-SearchResultView.matches= matches
-SearchResultView.removed_resource= <removed resource>
-SearchResultView.removeAllResults.text= Remove &All Matches
-SearchResultView.removeAllResults.tooltip= Remove All Matches
-SearchResultView.removeAllSearches.text= &Clear History
-SearchResultView.removeAllSearches.tooltip= Clear the search result history
-SearchResultView.searchAgain.text= &Search Again
-SearchResultView.searchAgain.tooltip= Search Again
-SearchResultView.previousSearches.text= Previous Search Results
-SearchResultView.previousSearches.tooltip= Previous Search Results
-SearchResultView.removeEntry.text= &Remove Selected Match
-SearchResultView.removeEntry.tooltip= Remove Selected Match
-SearchResultView.removeEntries.text= &Remove Selected Matches
-SearchResultView.removeEntries.tooltip= Remove Selected Matches
-SearchResultView.removeMatch.text= Remove Current &Match
-SearchResultView.removeMatch.tooltip= Remove Current Match
-SearchResultView.gotoMarker.text= &Go to File
-SearchResultView.gotoMarker.tooltip= Go to File
-SearchResultView.showNext.text= Next Match
-SearchResultView.showNext.tooltip= Show Next Match
-SearchResultView.showPrev.text= Previous Match
-SearchResultView.showPrev.tooltip= Show Previous Match
-
-SearchDialogClosingDialog.title= Search Dialog Closing
-SearchDialogClosingDialog.message= Dialog can not be closed due to an active operation. You must cancel the operation before you can close the dialog.
-
-SearchPlugin.internal_error= Internal Error
-
-Search.Error.search.title= Search Error
-Search.Error.search.message= An error occurred during the search operation
-
-Search.Error.setDescription.title= Search Error
-Search.Error.setDescription.message= Can not save workspace description
-
-Search.Error.openEditor.title= Search Error
-Search.Error.openEditor.message= Could not open the editor
-
-Search.Error.openResultView.title= Search Error
-Search.Error.openResultView.message= Could not open the search results view
-
-Search.Error.deleteMarkers.title= Search Error
-Search.Error.deleteMarkers.message= An error occurred during deletion of search markers
-
-Search.Error.findMarkers.title= Search Error
-Search.Error.findMarkers.message= An error occurred while gathering the search markers
-
-Search.Error.createMarker.title= Search Error
-Search.Error.createMarker.message= Could not create the search marker
-
-Search.Error.markerAttributeAccess.title= Search Error
-Search.Error.markerAttributeAccess.message= An error occurred while accessing a marker attribute
-
-Search.Error.switchSearch.title= Search Error
-Search.Error.switchSearch.message= An error occurred while switching to a previous search result
-
-Search.Error.createSearchPage.title= Search Error
-Search.Error.createSearchPage.message= An error occurred while creating a search page
-
-Search.Error.createSorter.title= Search Error
-Search.Error.createSorter.message= An error occurred while creating a sorter
-
-Search.Error.incorrectIconLocation.message= Invalid icon location
-
-Search.Problems.title= Text Search Problems
-
-SearchResultCollector.match= 1 match
-SearchResultCollector.matches= {0} matches
-SearchResultCollector.done= Search done: {0}.
-
-SearchPage.containingText.text= C&ontaining text:
-SearchPage.containingText.hint= (* = any string, ? = any character, \\ = escape for literals: * ? \\)
-SearchPage.browse= &Browse...
-SearchPage.fileNamePatterns.text= File name &patterns:
-SearchPage.fileNamePatterns.hint= The patterns are separated by comma (* = any string, ? = any character)
-SearchPage.caseSensitive= Case sens&itive
-SearchPage.regularExpression= &Regular expression
-SearchPage.regularExpressionSyntaxProblem.title= Search: Invalid Regular Expression
-
-TextSearchEngine.scanning= Scanning file {0} of {1}...
-TextSearchEngine.statusMessage= Problems encountered during text search.
-
-TextSearchVisitor.scanning= Scanning file {0} of {1}...
-TextSearchVisitor.error= Error reading file during search: {0}
-TextSearchVisitor.canceled= Operation Canceled
-
-SortDropDownAction.label= S&ort By
-SortDropDownAction.tooltip= Sort By
-
-ShowOtherSearchesAction.label= &Other...
-ShowOtherSearchesAction.tooltip= Open Other Searches Dialog
-
-OtherSearchesDialog.title= Other Searches
-OtherSearchesDialog.message= &Select one of the searches
-
-PreviousSearchesDialog.title= Previous Searches
-PreviousSearchesDialog.message= &Select one of the searches
-
-# The first argument will be replaced by the pattern, the second by the scope
-TextSearchOperation.singularLabelPostfix= "{0}" - 1 Occurrence in {1}
-
-# The argument will be replaced by the scope
-FileSearchOperation.singularLabelPostfix= 1 File in {0}
-
-# The first argument will be replaced by the pattern, the second by the count and the last by the scope
-TextSearchOperation.pluralLabelPatternPostfix= "{0}" - {1} Occurrences in {2}
-
-# The first argument will be replaced by the count and the second by the scope
-FileSearchOperation.pluralLabelPatternPostfix= {0} Files in {1}
-
-OpenSearchDialogAction.label= Search
-OpenSearchDialogAction.tooltip= Search
-
-FileTypeEditor.typeDelimiter= ,
-
-FileLabelProvider.dashSeparated= {0} - {1}
-
-TypesFiltering.title= Select Types
-TypesFiltering.message= S&elect the types to scan.
-TypesFiltering.otherExtensions= &Other Patterns:
-TypesFiltering.selectAll= &Select All
-TypesFiltering.deselectAll= &Deselect All
-
-WorkspaceScope= Workspace
-WorkingSetScope= Working Set - {0}
-SelectionScope= Selection
-EnclosingProjectsScope= Projects {0}, ...
-EnclosingProjectScope= Project {0}
-
-ScopePart.group.text= Scope
-ScopePart.selectedResourcesScope.text= Selecte&d Resources
-ScopePart.enclosingProjectsScope.text= Enclosing Pro&jects
-ScopePart.workingSetChooseButton.text= C&hoose...
-ScopePart.workingSetScope.text= Wor&king Set:
-ScopePart.workspaceScope.text= &Workspace
-
-# Concatenate two working set names e.g. "Source, Lib"
-ScopePart.workingSetConcatenation= {0}, {1}
-
-CopyToClipboardAction.label= Copy to Clip&board
-CopyToClipboardAction.tooltip= Copy to Clipboard
-CopyToClipboardAction.error.title= Problem Copying to Clipboard
-CopyToClipboardAction.error.message= There was a problem when accessing the system clipboard. Retry?
-
-ExceptionDialog.seeErrorLogMessage= See error log for more details
-
-SearchPreferencePage.emphasizePotentialMatches= &Emphasize inexact matches
-SearchPreferencePage.potentialMatchFgColor= &Foreground color for inexact matches:
-SearchPreferencePage.reuseEditor= &Reuse editors to show matches
-SearchPreferencePage.bringToFront= &Bring Search view to front after search
-SearchPreferencePage.defaultPerspective= Default &perspective for the Search view:
-SearchPreferencePage.defaultPerspective.none= None
-SearchPreferencePage.ignorePotentialMatches= &Ignore inexact matches
-
-ReplaceAction.label_all= Re&place...
-ReplaceAction.label_selected= Rep&lace Selected...
-ReplaceAction.error.only_on_text_search= Replace is only available on text search.
-ReplaceAction.dialog.title= Replace
-
-ReplaceDialog.replace_label= Replace:
-ReplaceDialog.with_label= &With:
-ReplaceDialog.replace= &Replace
-ReplaceDialog.replaceAllInFile= Replace All in &File
-ReplaceDialog.replaceAll= Replace &All
-ReplaceDialog.skip= &Skip
-ReplaceDialog.skipFile= S&kip File
-ReplaceDialog.dialog.title= Replace
-ReplaceDialog.error.unable_to_open_text_editor= It is not possible to open the built-in text editor for file ''{0}''.
-ReplaceDialog.error.unable_to_replace= An error occurred while replacing in file ''{0}''.
-ReplaceDialog.progress.message= File: {0} ({1} of {2})
-
-SelectAllAction.label= Select A&ll
-SelectAllAction.tooltip= Select All
-
-RemovePotentialMatchesAction.removePotentialMatch.text= Remove Inexact Match
-RemovePotentialMatchesAction.removePotentialMatch.tooltip= Remove inexact match
-RemovePotentialMatchesAction.removePotentialMatches.text= Remove Inexact Matches
-RemovePotentialMatchesAction.removePotentialMatches.tooltip= Remove all inexact matches
-RemovePotentialMatchesAction.dialog.title= Remove Inexact Matches
-RemovePotentialMatchesAction.dialog.message= The current search result does not contain inexact matches.
-
-OpenWithMenu.label= Open Wit&h
-
-ReadOnlyDialog.skipFile= Skip File
-ReadOnlyDialog.skipAll= Skip All
-ReadOnlyDialog.message= The file {0} is read-only
-ReplaceDialog.task.replace= Replacing Match
-ReplaceDialog.task.replaceInFile= Replacing Matches in File {0}
-ReplaceDialog.task.replace.replaceAll= Replacing Matches
-ReplaceAction.label= Replace
-ReplaceAction.research.error= An error occurred while updating the matches
-SearchAgainConfirmationDialog.outofsync.message= Some resources are out of sync with the file system or may contain stale matches. Do you want to refresh those files and search again?
-SearchAgainConfirmationDialog.outofsync.label= Files out of sync:
-SearchAgainConfirmationDialog.stale.message= Some resources may contain stale matches. Do you want to search again?
-SearchAgainConfirmationDialog.stale.label= Files with stale matches:
-SearchAgainConfirmationDialog.title= Replace
-ReplaceDialog.isRegex.label= Regular Expression
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPageDescriptor.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPageDescriptor.java
deleted file mode 100644
index 8361043b745..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPageDescriptor.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.StringConverter;
-
-import org.eclipse.search.ui.ISearchPage;
-import org.eclipse.search.ui.ISearchPageScoreComputer;
-import org.eclipse.search.ui.ISearchResultViewEntry;
-
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
-/**
- * Proxy that represents a search page.
- */
-class SearchPageDescriptor implements Comparable {
-
- public final static String PAGE_TAG= "page"; //$NON-NLS-1$
- private final static String ID_ATTRIBUTE= "id"; //$NON-NLS-1$
- private final static String ICON_ATTRIBUTE= "icon"; //$NON-NLS-1$
- private final static String CLASS_ATTRIBUTE= "class"; //$NON-NLS-1$
- private final static String LABEL_ATTRIBUTE= "label"; //$NON-NLS-1$
- private final static String SIZE_ATTRIBUTE= "sizeHint"; //$NON-NLS-1$
- private final static String TAB_POSITION_ATTRIBUTE= "tabPosition"; //$NON-NLS-1$
- private final static String EXTENSIONS_ATTRIBUTE= "extensions"; //$NON-NLS-1$
- private final static String SHOW_SCOPE_SECTION_ATTRIBUTE= "showScopeSection"; //$NON-NLS-1$
- private final static String CAN_SEARCH_ENCLOSING_PROJECTS= "canSearchEnclosingProjects"; //$NON-NLS-1$
- private final static String ENABLED_ATTRIBUTE= "enabled"; //$NON-NLS-1$
- private final static String SEARCH_VIEW_HELP_CONTEXT_ID_ATTRIBUTE= "searchViewHelpContextId"; //$NON-NLS-1$
-
- public final static Point UNKNOWN_SIZE= new Point(SWT.DEFAULT, SWT.DEFAULT);
-
- // dialog store id constants
- private final static String SECTION_ID= "Search"; //$NON-NLS-1$
- private final static String STORE_ENABLED_PAGE_IDS= SECTION_ID + ".enabledPageIds"; //$NON-NLS-1$
- private final static String STORE_PROCESSED_PAGE_IDS= SECTION_ID + ".processedPageIds"; //$NON-NLS-1$
-
- private static List fgEnabledPageIds;
-
- private static class ExtensionScorePair {
- public String extension;
- public int score;
- public ExtensionScorePair(String extension, int score) {
- this.extension= extension;
- this.score= score;
- }
- }
-
- private IConfigurationElement fElement;
- private List fExtensionScorePairs;
- private int fWildcardScore= ISearchPageScoreComputer.UNKNOWN;
-
- /**
- * Creates a new search page node with the given configuration element.
- */
- public SearchPageDescriptor(IConfigurationElement element) {
- fElement= element;
- }
-
- /**
- * Creates a new search page from this node.
- */
- public ISearchPage createObject() {
- ISearchPage result= null;
- try {
- result= (ISearchPage)fElement.createExecutableExtension(CLASS_ATTRIBUTE);
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.createSearchPage.title"), SearchMessages.getString("Search.Error.createSearchPage.message")); //$NON-NLS-2$ //$NON-NLS-1$
- } catch (ClassCastException ex) {
- ExceptionHandler.displayMessageDialog(ex, SearchMessages.getString("Search.Error.createSearchPage.title"), SearchMessages.getString("Search.Error.createSearchPage.message")); //$NON-NLS-2$ //$NON-NLS-1$
- return null;
- }
- if (result != null) {
- result.setTitle(getLabel());
- }
- return result;
- }
-
- //---- XML Attribute accessors ---------------------------------------------
-
- /**
- * Returns the page's id.
- */
- public String getId() {
- return fElement.getAttribute(ID_ATTRIBUTE);
- }
-
- /**
- * Returns the page's image
- */
- public ImageDescriptor getImage() {
- String imageName= fElement.getAttribute(ICON_ATTRIBUTE);
- if (imageName == null)
- return null;
- URL url;
- try {
- url= new URL(fElement.getDeclaringExtension().getDeclaringPluginDescriptor().getInstallURL(), imageName);
- } catch (java.net.MalformedURLException ex) {
- ExceptionHandler.log(ex, SearchMessages.getString("Search.Error.createSearchPage.message")); //$NON-NLS-1$
- return null;
- }
- return ImageDescriptor.createFromURL(url);
- }
-
- /**
- * Returns the page's label.
- */
- public String getLabel() {
- return fElement.getAttribute(LABEL_ATTRIBUTE);
- }
-
- /**
- * Returns <code>true</code> if the scope section needs
- * to be shown in the dialog.
- */
- public boolean showScopeSection() {
- return Boolean.valueOf(fElement.getAttribute(SHOW_SCOPE_SECTION_ATTRIBUTE)).booleanValue();
- }
-
- /**
- * Returns <code>true</code> if the page is initially
- * shown in the Search dialog.
- *
- * This attribute is optional and defaults to <code>true</code>.
- */
- public boolean isInitiallyEnabled() {
- String strVal= fElement.getAttribute(ENABLED_ATTRIBUTE);
- return strVal == null || Boolean.valueOf(strVal).booleanValue();
- }
-
- /**
- * Returns <code>true</code> if the page can handle
- * searches in enclosing projects. The value should be ignored if <code>showScopeSection()</code>
- * returns <code>false</code>.
- *
- * This attribute is optional and defaults to <code>false</code>.
- */
- public boolean canSearchInProjects() {
- return Boolean.valueOf(fElement.getAttribute(CAN_SEARCH_ENCLOSING_PROJECTS)).booleanValue();
- }
-
- /**
- * Returns the page's preferred size
- */
- public Point getPreferredSize() {
- return StringConverter.asPoint(
- fElement.getAttribute(SIZE_ATTRIBUTE), UNKNOWN_SIZE);
- }
-
- /**
- * Returns the page's tab position relative to the other tabs.
- * @return the tab position or <code>Integer.MAX_VALUE</code> if not defined in
- * the plugins.xml file
- */
- public int getTabPosition() {
- int position= Integer.MAX_VALUE / 2;
- String str= fElement.getAttribute(TAB_POSITION_ATTRIBUTE);
- if (str != null)
- try {
- position= Integer.parseInt(str);
- } catch (NumberFormatException ex) {
- ExceptionHandler.log(ex, SearchMessages.getString("Search.Error.createSearchPage.message")); //$NON-NLS-1$
- // position is Integer.MAX_VALUE;
- }
- return position;
- }
-
- boolean isEnabled() {
- return getEnabledPageIds().contains(getId());
- }
-
- /**
- * Returns the help context for help shown in search view.
- *
- * @return the help context id or <code>null</code> if not defined
- */
- public String getSearchViewHelpContextId() {
- return fElement.getAttribute(SEARCH_VIEW_HELP_CONTEXT_ID_ATTRIBUTE);
- }
-
- static void setEnabled(Object[] enabledDescriptors) {
- fgEnabledPageIds= new ArrayList(5);
- for (int i= 0; i < enabledDescriptors.length; i++) {
- if (enabledDescriptors[i] instanceof SearchPageDescriptor)
- fgEnabledPageIds.add(((SearchPageDescriptor)enabledDescriptors[i]).getId());
- }
- storeEnabledPageIds();
- }
-
- private static List getEnabledPageIds() {
- if (fgEnabledPageIds == null) {
- List descriptors= SearchPlugin.getDefault().getSearchPageDescriptors();
-
- String[] enabledPageIds= getDialogSettings().getArray(STORE_ENABLED_PAGE_IDS);
- if (enabledPageIds == null)
- fgEnabledPageIds= new ArrayList(descriptors.size());
- else
- fgEnabledPageIds= new ArrayList(Arrays.asList(enabledPageIds));
-
-
- List processedPageIds;
- String[] processedPageIdsArr= getDialogSettings().getArray(STORE_PROCESSED_PAGE_IDS);
- if (processedPageIdsArr == null)
- processedPageIds= new ArrayList(descriptors.size());
- else
- processedPageIds= new ArrayList(Arrays.asList(processedPageIdsArr));
-
- // Enable pages based on contribution
- Iterator iter= descriptors.iterator();
- while (iter.hasNext()) {
- SearchPageDescriptor desc= (SearchPageDescriptor)iter.next();
- if (processedPageIds.contains(desc.getId()))
- continue;
-
- processedPageIds.add(desc.getId());
- if (desc.isInitiallyEnabled())
- fgEnabledPageIds.add(desc.getId());
- }
-
- getDialogSettings().put(STORE_PROCESSED_PAGE_IDS, (String[])processedPageIds.toArray(new String[processedPageIds.size()]));
- storeEnabledPageIds();
- }
- return fgEnabledPageIds;
- }
-
- private static void storeEnabledPageIds() {
- getDialogSettings().put(STORE_ENABLED_PAGE_IDS, (String[])fgEnabledPageIds.toArray(new String[fgEnabledPageIds.size()]));
- SearchPlugin.getDefault().savePluginPreferences();
- }
-
- private static IDialogSettings getDialogSettings() {
- IDialogSettings settings= SearchPlugin.getDefault().getDialogSettings();
- IDialogSettings section= settings.getSection(SECTION_ID);
- if (section == null)
- // create new section
- section= settings.addNewSection(SECTION_ID);
- return section;
- }
-
- /*
- * Implements a method from IComparable
- */
- public int compareTo(Object o) {
- int myPos= getTabPosition();
- int objsPos= ((SearchPageDescriptor)o).getTabPosition();
- if (myPos == Integer.MAX_VALUE && objsPos == Integer.MAX_VALUE || myPos == objsPos)
- return getLabel().compareTo(((SearchPageDescriptor)o).getLabel());
- else
- return myPos - objsPos;
- }
-
- //---- Suitability tests ---------------------------------------------------
-
- /**
- * Returns the score for this page with the given input element.
- */
- public int computeScore(Object element) {
- if (element instanceof IAdaptable) {
- IResource resource= (IResource)((IAdaptable)element).getAdapter(IResource.class);
- if (resource != null && resource.getType() == IResource.FILE) {
- String extension= ((IFile)resource).getFileExtension();
- if (extension != null)
- return getScoreForFileExtension(extension);
- } else {
- ISearchPageScoreComputer tester=
- (ISearchPageScoreComputer)((IAdaptable)element).getAdapter(ISearchPageScoreComputer.class);
- if (tester != null)
- return tester.computeScore(getId(), element);
- }
- } else if (element instanceof ISearchResultViewEntry) {
- ISearchResultViewEntry entry= (ISearchResultViewEntry)element;
- return computeScore(entry.getSelectedMarker());
- }
- if (fWildcardScore != ISearchPageScoreComputer.UNKNOWN)
- return fWildcardScore;
-
- return ISearchPageScoreComputer.LOWEST;
- }
-
- private int getScoreForFileExtension(String extension) {
- if (fExtensionScorePairs == null)
- readExtensionScorePairs();
-
- int size= fExtensionScorePairs.size();
- for (int i= 0; i < size; i++) {
- ExtensionScorePair p= (ExtensionScorePair)fExtensionScorePairs.get(i);
- if (extension.equals(p.extension))
- return p.score;
- }
- if (fWildcardScore != ISearchPageScoreComputer.UNKNOWN)
- return fWildcardScore;
-
- return ISearchPageScoreComputer.LOWEST;
- }
-
- private void readExtensionScorePairs() {
- fExtensionScorePairs= new ArrayList(3);
- String content= fElement.getAttribute(EXTENSIONS_ATTRIBUTE);
- if (content == null)
- return;
- StringTokenizer tokenizer= new StringTokenizer(content, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreElements()) {
- String token= tokenizer.nextToken().trim();
- int pos= token.indexOf(':');
- if (pos != -1) {
- String extension= token.substring(0, pos);
- int score= StringConverter.asInt(token.substring(pos+1), ISearchPageScoreComputer.UNKNOWN);
- if (extension.equals("*")) { //$NON-NLS-1$
- fWildcardScore= score;
- } else {
- fExtensionScorePairs.add(new ExtensionScorePair(extension, score));
- }
- }
- }
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java
deleted file mode 100644
index eb98f2a4b74..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-import org.eclipse.search.ui.IContextMenuConstants;
-import org.eclipse.search.ui.ISearchResultView;
-import org.eclipse.search.ui.ISearchResultViewEntry;
-import org.eclipse.search.ui.SearchUI;
-
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
-/**
- * The plug-in runtime class for Search plug-in
- */
-public class SearchPlugin extends AbstractUIPlugin {
-
- public static final String SEARCH_PAGE_EXTENSION_POINT= "searchPages"; //$NON-NLS-1$
- public static final String SORTER_EXTENSION_POINT= "searchResultSorters"; //$NON-NLS-1$
-
- /** Status code describing an internal error */
- public static final int INTERNAL_ERROR= 1;
-
- private static SearchPlugin fgSearchPlugin;
-
- private List fPageDescriptors;
- private List fSorterDescriptors;
-
- private SearchResultViewEntryAdapterFactory fSearchResultViewEntryAdapterFactory;
-
- public SearchPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- Assert.isTrue(fgSearchPlugin == null);
- fgSearchPlugin= this;
- }
-
- /**
- * Returns the search plugin instance.
- */
- public static SearchPlugin getDefault() {
- return fgSearchPlugin;
- }
-
- /*
- * Overrides AbstractUIPlugin#initializeDefaultPreferences
- */
- protected void initializeDefaultPreferences(IPreferenceStore store) {
- SearchPreferencePage.initDefaults(store);
- }
-
- /**
- * Returns the active workbench window.
- * <code>null</code> if the active window is not a workbench window
- */
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- IWorkbenchWindow window= fgSearchPlugin.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- final WindowRef windowRef= new WindowRef();
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- setActiveWorkbenchWindow(windowRef);
- }
- });
- return windowRef.window;
- }
- else
- return window;
- }
-
- private static class WindowRef {
- public IWorkbenchWindow window;
- }
-
- private static void setActiveWorkbenchWindow(WindowRef windowRef) {
- windowRef.window= null;
- Display display= Display.getCurrent();
- if (display == null)
- return;
- Control shell= display.getActiveShell();
- while (shell != null) {
- Object data= shell.getData();
- if (data instanceof IWorkbenchWindow) {
- windowRef.window= (IWorkbenchWindow)data;
- return;
- }
- shell= shell.getParent();
- }
- Shell shells[]= display.getShells();
- for (int i= 0; i < shells.length; i++) {
- Object data= shells[i].getData();
- if (data instanceof IWorkbenchWindow) {
- windowRef.window= (IWorkbenchWindow)data;
- return;
- }
- }
- }
-
- /**
- * Returns the shell of the active workbench window.
- */
- public static Shell getActiveWorkbenchShell() {
- IWorkbenchWindow window= getActiveWorkbenchWindow();
- if (window != null)
- return window.getShell();
- return null;
- }
-
- /**
- * Beeps using the display of the active workbench window.
- */
- public static void beep() {
- getActiveWorkbenchShell().getDisplay().beep();
- }
-
- /**
- * Returns the active workbench window's currrent page.
- */
- public static IWorkbenchPage getActivePage() {
- return getActiveWorkbenchWindow().getActivePage();
- }
-
- /**
- * Returns the workbench from which this plugin has been loaded.
- */
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * Activates the search result view in the active page.
- * This call has no effect, if the search result view is
- * already activated.
- *
- * @return <code>true</code> if the search result view could be activated
- */
- public static boolean activateSearchResultView() {
-
- String defaultPerspectiveId= SearchUI.getDefaultPerspectiveId();
- if (defaultPerspectiveId != null) {
- IWorkbenchWindow window= window= getActiveWorkbenchWindow();
- if (window != null && window.getShell() != null && !window.getShell().isDisposed()) {
- try {
- PlatformUI.getWorkbench().showPerspective(defaultPerspectiveId, window);
- } catch (WorkbenchException ex) {
- // show view in current perspective
- }
- }
- }
-
- try {
- IViewPart viewPart= getActivePage().findView(SearchUI.SEARCH_RESULT_VIEW_ID);
- if (viewPart == null || SearchPreferencePage.isViewBroughtToFront()) {
- return (getActivePage().showView(SearchUI.SEARCH_RESULT_VIEW_ID) != null);
- }
- return true;
- } catch (PartInitException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.openResultView.title"), SearchMessages.getString("Search.Error.openResultView.message")); //$NON-NLS-2$ //$NON-NLS-1$
- return false;
- }
- }
-
- /**
- * Returns the search result view of the active workbench window. Returns <code>
- * null</code> if the active workbench window doesn't have any search result
- * view.
- */
- public static ISearchResultView getSearchResultView() {
- IViewPart part= getActivePage().findView(SearchUI.SEARCH_RESULT_VIEW_ID);
- if (part instanceof ISearchResultView)
- return (ISearchResultView) part;
- return null;
- }
-
- static void setAutoBuilding(boolean state) {
- IWorkspaceDescription workspaceDesc= getWorkspace().getDescription();
- workspaceDesc.setAutoBuilding(state);
- try {
- getWorkspace().setDescription(workspaceDesc);
- }
- catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.setDescription.title"), SearchMessages.getString("Search.Error.setDescription.message")); //$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
-
- public void startup() throws CoreException {
- super.startup();
- registerAdapters();
- }
-
- /**
- * Shuts down this plug-in.
- */
- public void shutdown() throws CoreException {
- unregisterAdapters();
- getWorkspace().removeResourceChangeListener(SearchManager.getDefault());
- super.shutdown();
- fgSearchPlugin = null;
- }
-
- /**
- * Returns all search pages contributed to the workbench.
- */
- public List getSearchPageDescriptors() {
- if (fPageDescriptors == null) {
- IPluginRegistry registry= Platform.getPluginRegistry();
- IConfigurationElement[] elements= registry.getConfigurationElementsFor(SearchUI.PLUGIN_ID, SEARCH_PAGE_EXTENSION_POINT);
- fPageDescriptors= createSearchPageDescriptors(elements);
- }
- return fPageDescriptors;
- }
-
- /**
- * Returns all search pages contributed to the workbench.
- */
- public List getEnabledSearchPageDescriptors(String pageId) {
- Iterator iter= getSearchPageDescriptors().iterator();
- List enabledDescriptors= new ArrayList(5);
- while (iter.hasNext()) {
- SearchPageDescriptor desc= (SearchPageDescriptor)iter.next();
- if (desc.isEnabled() || desc.getId().equals(pageId))
- enabledDescriptors.add(desc);
- }
- return enabledDescriptors;
- }
-
- /**
- * Returns the help context ID for the Search view
- * as provided by the current search page extension.
- *
- * @since 3.0
- */
- public String getSearchViewHelpContextId() {
- Search currentSearch= SearchManager.getDefault().getCurrentSearch();
- if (currentSearch != null) {
- String pageId= currentSearch.getPageId();
- Iterator iter= getSearchPageDescriptors().iterator();
- while (iter.hasNext()) {
- SearchPageDescriptor desc= (SearchPageDescriptor)iter.next();
- if (desc.getId().equals(pageId)) {
- String helpId= desc.getSearchViewHelpContextId();
- if (helpId == null)
- return ISearchHelpContextIds.SEARCH_VIEW;
- else
- return desc.getSearchViewHelpContextId();
- }
- }
- }
- return ISearchHelpContextIds.SEARCH_VIEW;
- }
-
- /**
- * Creates all necessary search page nodes.
- */
- private List createSearchPageDescriptors(IConfigurationElement[] elements) {
- List result= new ArrayList(5);
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
- if (SearchPageDescriptor.PAGE_TAG.equals(element.getName())) {
- SearchPageDescriptor desc= new SearchPageDescriptor(element);
- result.add(desc);
- }
- }
- Collections.sort(result);
- return result;
- }
-
- /**
- * Returns all sorters contributed to the workbench.
- */
- public List getSorterDescriptors() {
- if (fSorterDescriptors == null) {
- IPluginRegistry registry= Platform.getPluginRegistry();
- IConfigurationElement[] elements= registry.getConfigurationElementsFor(SearchUI.PLUGIN_ID, SORTER_EXTENSION_POINT);
- fSorterDescriptors= createSorterDescriptors(elements);
- }
- return fSorterDescriptors;
- }
-
- /**
- * Creates all necessary sorter description nodes.
- */
- private List createSorterDescriptors(IConfigurationElement[] elements) {
- List result= new ArrayList(5);
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
- if (SorterDescriptor.SORTER_TAG.equals(element.getName()))
- result.add(new SorterDescriptor(element));
- }
- return result;
- }
-
- /**
- * Log status to platform log
- */
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, SearchUI.PLUGIN_ID, INTERNAL_ERROR, SearchMessages.getString("SearchPlugin.internal_error"), e)); //$NON-NLS-1$
- }
-
- /**
- * Creates the Search plugin standard groups in a context menu.
- */
- public static void createStandardGroups(IMenuManager menu) {
- if (!menu.isEmpty())
- return;
- menu.add(new Separator(IContextMenuConstants.GROUP_NEW));
- menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO));
- menu.add(new GroupMarker(IContextMenuConstants.GROUP_OPEN));
- menu.add(new Separator(IContextMenuConstants.GROUP_SHOW));
- menu.add(new Separator(IContextMenuConstants.GROUP_BUILD));
- menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE));
- menu.add(new Separator(IContextMenuConstants.GROUP_REMOVE_MATCHES));
- menu.add(new GroupMarker(IContextMenuConstants.GROUP_GENERATE));
- menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
- menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));
- menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP));
- menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES));
- }
-
- private void registerAdapters() {
- IAdapterManager manager= Platform.getAdapterManager();
- fSearchResultViewEntryAdapterFactory= new SearchResultViewEntryAdapterFactory();
- manager.registerAdapters(fSearchResultViewEntryAdapterFactory, ISearchResultViewEntry.class);
- }
-
- private void unregisterAdapters() {
- IAdapterManager manager= Platform.getAdapterManager();
- manager.unregisterAdapters(fSearchResultViewEntryAdapterFactory);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java
deleted file mode 100644
index 54331cc6b45..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
-/**
- * Bundle of all images used by the Search UI plugin.
- */
-public class SearchPluginImages {
-
- private static URL fgIconLocation;
-
- static {
- String pathSuffix= "icons/full/"; //$NON-NLS-1$
- try {
- fgIconLocation= new URL(SearchPlugin.getDefault().getDescriptor().getInstallURL(), pathSuffix);
- } catch (MalformedURLException ex) {
- ExceptionHandler.log(ex, SearchMessages.getString("Search.Error.incorrectIconLocation.message")); //$NON-NLS-1$
- }
- }
-
- // The plugin registry
- private final static ImageRegistry PLUGIN_REGISTRY= SearchPlugin.getDefault().getImageRegistry();
-
- public static final String T_OBJ= "obj16/"; //$NON-NLS-1$
- public static final String T_WIZBAN= "wizban/"; //$NON-NLS-1$
- public static final String T_LCL= "lcl16/"; //$NON-NLS-1$
- public static final String T_TOOL= "tool16/"; //$NON-NLS-1$
- public static final String T_VIEW= "view16/"; //$NON-NLS-1$
-
- private static final String NAME_PREFIX= "org.eclipse.search.ui."; //$NON-NLS-1$
- private static final int NAME_PREFIX_LENGTH= NAME_PREFIX.length();
-
- // Define image names
- public static final String IMG_TOOL_SEARCH= NAME_PREFIX + "search.gif"; //$NON-NLS-1$
-
- public static final String IMG_LCL_SEARCH_STOP= NAME_PREFIX + "search_stop.gif"; //$NON-NLS-1$
- public static final String IMG_LCL_SEARCH_REM= NAME_PREFIX + "search_rem.gif"; //$NON-NLS-1$
- public static final String IMG_LCL_SEARCH_REM_ALL= NAME_PREFIX + "search_remall.gif"; //$NON-NLS-1$
- public static final String IMG_LCL_SEARCH_NEXT= NAME_PREFIX + "search_next.gif"; //$NON-NLS-1$
- public static final String IMG_LCL_SEARCH_PREV= NAME_PREFIX + "search_prev.gif"; //$NON-NLS-1$
- public static final String IMG_LCL_SEARCH_GOTO= NAME_PREFIX + "search_goto.gif"; //$NON-NLS-1$
- public static final String IMG_LCL_SEARCH_SORT= NAME_PREFIX + "search_sortmatch.gif"; //$NON-NLS-1$
- public static final String IMG_LCL_SEARCH_HISTORY= NAME_PREFIX + "search_history.gif"; //$NON-NLS-1$
-
- public static final String IMG_VIEW_SEARCHRES= NAME_PREFIX + "searchres.gif"; //$NON-NLS-1$
-
- public static final String IMG_OBJ_TSEARCH= NAME_PREFIX + "tsearch_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_TSEARCH_DPDN= NAME_PREFIX + "tsearch_dpdn_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_SEARCHMARKER= NAME_PREFIX + "searchm_obj.gif"; //$NON-NLS-1$
-
-
-
- // Define images
- public static final ImageDescriptor DESC_OBJ_TSEARCH= createManaged(T_OBJ, IMG_OBJ_TSEARCH);
- public static final ImageDescriptor DESC_OBJ_TSEARCH_DPDN= createManaged(T_OBJ, IMG_OBJ_TSEARCH_DPDN);
- public static final ImageDescriptor DESC_OBJ_SEARCHMARKER= createManaged(T_OBJ, IMG_OBJ_SEARCHMARKER);
-
- public static Image get(String key) {
- return PLUGIN_REGISTRY.get(key);
- }
-
- private static ImageDescriptor createManaged(String prefix, String name) {
- ImageDescriptor result= ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
- PLUGIN_REGISTRY.put(name, result);
- return result;
- }
-
- private static ImageDescriptor create(String prefix, String name) {
- return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
- }
-
- private static URL makeIconFileURL(String prefix, String name) {
- StringBuffer buffer= new StringBuffer(prefix);
- buffer.append(name);
- try {
- return new URL(fgIconLocation, buffer.toString());
- } catch (MalformedURLException ex) {
- ExceptionHandler.log(ex, SearchMessages.getString("Search.Error.incorrectIconLocation.message")); //$NON-NLS-1$
- return null;
- }
- }
-
- /**
- * Sets all available image descriptors for the given action.
- */
- public static void setImageDescriptors(IAction action, String type, String relPath) {
- relPath= relPath.substring(NAME_PREFIX_LENGTH);
- action.setDisabledImageDescriptor(create("d" + type, relPath)); //$NON-NLS-1$
- action.setHoverImageDescriptor(create("c" + type, relPath)); //$NON-NLS-1$
- action.setImageDescriptor(create("e" + type, relPath)); //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.java
deleted file mode 100644
index f07ae469bbd..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.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.search.internal.ui;
-
-import java.text.Collator;
-import java.util.Arrays;
-import java.util.Comparator;
-
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.ColorFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveRegistry;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.search.internal.ui.util.ComboFieldEditor;
-
-/*
- * The page for setting the Search preferences.
- */
-public class SearchPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
- public static final String IGNORE_POTENTIAL_MATCHES= "org.eclipse.search.potentialMatch.ignore"; //$NON-NLS-1$
- public static final String EMPHASIZE_POTENTIAL_MATCHES= "org.eclipse.search.potentialMatch.emphasize"; //$NON-NLS-1$
- public static final String POTENTIAL_MATCH_FG_COLOR= "org.eclipse.search.potentialMatch.fgColor"; //$NON-NLS-1$
- public static final String REUSE_EDITOR= "org.eclipse.search.reuseEditor"; //$NON-NLS-1$
- public static final String DEFAULT_PERSPECTIVE= "org.eclipse.search.defaultPerspective"; //$NON-NLS-1$
- private static final String NO_DEFAULT_PERSPECTIVE= "org.eclipse.search.defaultPerspective.none"; //$NON-NLS-1$
- public static final String BRING_VIEW_TO_FRONT= "org.eclipse.search.bringToFront"; //$NON-NLS-1$
-
- private ColorFieldEditor fColorEditor;
- private BooleanFieldEditor fEmphasizedCheckbox;
- private BooleanFieldEditor fIgnorePotentialMatchesCheckbox;
-
-
- private static class PerspectiveDescriptorComparator implements Comparator {
- /*
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- if (o1 instanceof IPerspectiveDescriptor && o2 instanceof IPerspectiveDescriptor) {
- String id1= ((IPerspectiveDescriptor)o1).getLabel();
- String id2= ((IPerspectiveDescriptor)o2).getLabel();
- return Collator.getInstance().compare(id1, id2);
- }
- return 0;
- }
- }
-
-
-
- public SearchPreferencePage() {
- super(GRID);
- setPreferenceStore(SearchPlugin.getDefault().getPreferenceStore());
- }
-
- public static void initDefaults(IPreferenceStore store) {
- RGB gray= new RGB(85, 85, 85);
- store.setDefault(EMPHASIZE_POTENTIAL_MATCHES, true);
- store.setDefault(IGNORE_POTENTIAL_MATCHES, false);
- PreferenceConverter.setDefault(store, POTENTIAL_MATCH_FG_COLOR, gray);
- store.setDefault(REUSE_EDITOR, false);
- store.setDefault(BRING_VIEW_TO_FRONT, true);
- store.setDefault(DEFAULT_PERSPECTIVE, NO_DEFAULT_PERSPECTIVE);
- }
-
- public static boolean isEditorReused() {
- IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
- return store.getBoolean(REUSE_EDITOR);
- }
-
- public static boolean isViewBroughtToFront() {
- IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
- return store.getBoolean(BRING_VIEW_TO_FRONT);
-
- }
-
- public static String getDefaultPerspectiveId() {
- handleDeletedPerspectives();
- IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
- String id= store.getString(DEFAULT_PERSPECTIVE);
- if (id == null || id.length() == 0 || id.equals(NO_DEFAULT_PERSPECTIVE))
- return null;
- else if (PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id) == null) {
- store.putValue(DEFAULT_PERSPECTIVE, id);
- return null;
- }
- return id;
- }
-
- public static boolean arePotentialMatchesIgnored() {
- IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
- return store.getBoolean(IGNORE_POTENTIAL_MATCHES);
- }
-
- public static boolean arePotentialMatchesEmphasized() {
- IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
- return store.getBoolean(EMPHASIZE_POTENTIAL_MATCHES);
- }
-
- public static RGB getPotentialMatchForegroundColor() {
- IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
- return PreferenceConverter.getColor(store, POTENTIAL_MATCH_FG_COLOR);
- }
-
- public void createControl(Composite parent) {
- super.createControl(parent);
- WorkbenchHelp.setHelp(getControl(), ISearchHelpContextIds.SEARCH_PREFERENCE_PAGE);
- }
-
- protected void createFieldEditors() {
- BooleanFieldEditor boolEditor= new BooleanFieldEditor(
- REUSE_EDITOR,
- SearchMessages.getString("SearchPreferencePage.reuseEditor"), //$NON-NLS-1$
- getFieldEditorParent()
- );
- addField(boolEditor);
-
- boolEditor= new BooleanFieldEditor(
- BRING_VIEW_TO_FRONT,
- SearchMessages.getString("SearchPreferencePage.bringToFront"), //$NON-NLS-1$
- getFieldEditorParent()
- );
- addField(boolEditor);
-
- fIgnorePotentialMatchesCheckbox= new BooleanFieldEditor(
- IGNORE_POTENTIAL_MATCHES,
- SearchMessages.getString("SearchPreferencePage.ignorePotentialMatches"), //$NON-NLS-1$
- getFieldEditorParent());
- addField(fIgnorePotentialMatchesCheckbox);
-
- fEmphasizedCheckbox= new BooleanFieldEditor(
- EMPHASIZE_POTENTIAL_MATCHES,
- SearchMessages.getString("SearchPreferencePage.emphasizePotentialMatches"), //$NON-NLS-1$
- getFieldEditorParent());
- addField(fEmphasizedCheckbox);
-
- fColorEditor= new ColorFieldEditor(
- POTENTIAL_MATCH_FG_COLOR,
- SearchMessages.getString("SearchPreferencePage.potentialMatchFgColor"), //$NON-NLS-1$
- getFieldEditorParent()
- );
- addField(fColorEditor);
-
- fEmphasizedCheckbox.setEnabled(!arePotentialMatchesIgnored(), getFieldEditorParent());
- fColorEditor.setEnabled(!arePotentialMatchesIgnored() && arePotentialMatchesEmphasized(), getFieldEditorParent());
-
- handleDeletedPerspectives();
- String[][] perspectiveNamesAndIds = getPerspectiveNamesAndIds();
- ComboFieldEditor comboEditor= new ComboFieldEditor(
- DEFAULT_PERSPECTIVE,
- SearchMessages.getString("SearchPreferencePage.defaultPerspective"), //$NON-NLS-1$
- perspectiveNamesAndIds,
- getFieldEditorParent());
- addField(comboEditor);
- }
-
- public void setVisible(boolean state) {
- handleDeletedPerspectives();
- super.setVisible(state);
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- boolean arePotentialMatchesIgnored= fIgnorePotentialMatchesCheckbox.getBooleanValue();
- fEmphasizedCheckbox.setEnabled(!arePotentialMatchesIgnored, getFieldEditorParent());
- fColorEditor.setEnabled(!arePotentialMatchesIgnored && fEmphasizedCheckbox.getBooleanValue(), getFieldEditorParent());
- }
-
- public void init(IWorkbench workbench) {
- }
-
- protected void performDefaults() {
- super.performDefaults();
- boolean arePotentialMatchesIgnored= fIgnorePotentialMatchesCheckbox.getBooleanValue();
- fEmphasizedCheckbox.setEnabled(!arePotentialMatchesIgnored, getFieldEditorParent());
- fColorEditor.setEnabled(!arePotentialMatchesIgnored && fEmphasizedCheckbox.getBooleanValue(), getFieldEditorParent());
- }
-
- /**
- * Return a 2-dimensional array of perspective names and ids.
- */
- private String[][] getPerspectiveNamesAndIds() {
-
- IPerspectiveRegistry registry= PlatformUI.getWorkbench().getPerspectiveRegistry();
- IPerspectiveDescriptor[] perspectiveDescriptors= registry.getPerspectives();
-
- Arrays.sort(perspectiveDescriptors, new PerspectiveDescriptorComparator());
-
- String[][] table = new String[perspectiveDescriptors.length + 1][2];
- table[0][0] = SearchMessages.getString("SearchPreferencePage.defaultPerspective.none"); //$NON-NLS-1$;
- table[0][1] = NO_DEFAULT_PERSPECTIVE;
- for (int i = 0; i < perspectiveDescriptors.length; i++) {
- table[i + 1][0] = perspectiveDescriptors[i].getLabel();
- table[i + 1][1] = perspectiveDescriptors[i].getId();
- }
- return table;
- }
-
- private static void handleDeletedPerspectives() {
- IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
- String id= store.getString(DEFAULT_PERSPECTIVE);
- if (PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id) == null) {
- store.putValue(DEFAULT_PERSPECTIVE, NO_DEFAULT_PERSPECTIVE);
- }
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultContentProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultContentProvider.java
deleted file mode 100644
index 86f69cf23a7..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultContentProvider.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.search.internal.ui;
-
-import java.util.ArrayList;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-class SearchResultContentProvider implements IStructuredContentProvider {
-
- private static final Object[] fgEmptyArray= new Object[0];
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // Do nothing since the viewer listens to resource deltas
- }
-
- public void dispose() {
- }
-
- public boolean isDeleted(Object element) {
- return false;
- }
-
- public Object[] getElements(Object element) {
- if (element instanceof ArrayList)
- return ((ArrayList)element).toArray();
- else
- return fgEmptyArray;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java
deleted file mode 100644
index c55d2ef26fd..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.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.search.internal.ui;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.LabelProvider;
-
-import org.eclipse.ui.PlatformUI;
-
-import org.eclipse.search.ui.ISearchResultViewEntry;
-
-class SearchResultLabelProvider extends LabelProvider {
-
- private static final String MATCHES_POSTFIX= " " + SearchMessages.getString("SearchResultView.matches") + ")"; //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
-
- private ILabelProvider fLabelProvider;
-
-
- SearchResultLabelProvider(ILabelProvider provider) {
- fLabelProvider= provider;
- }
-
- public String getText(Object element) {
- StringBuffer buf= new StringBuffer(getLabelProvider().getText(element));
- int count= ((ISearchResultViewEntry)element).getMatchCount();
- if (count > 1) {
- buf.append(" ("); //$NON-NLS-1$
- buf.append(count);
- buf.append(MATCHES_POSTFIX);
- }
- return buf.toString();
- }
-
- public Image getImage(Object element) {
- return fLabelProvider.getImage(element);
- }
-
- // Don't dispose since label providers are reused.
- public void dispose() {
- }
-
- ILabelProvider getLabelProvider() {
- return fLabelProvider;
- }
-
- public void addListener(ILabelProviderListener listener) {
- super.addListener(listener);
- fLabelProvider.addListener(listener);
- PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator().addListener(listener);
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return fLabelProvider.isLabelProperty(element, property);
- }
-
- public void removeListener(ILabelProviderListener listener) {
- super.removeListener(listener);
- fLabelProvider.removeListener(listener);
- PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator().removeListener(listener);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java
deleted file mode 100644
index 8fc92a41475..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.ui.part.ViewPart;
-
-import org.eclipse.search.ui.IActionGroupFactory;
-import org.eclipse.search.ui.IContextMenuContributor;
-import org.eclipse.search.ui.IGroupByKeyComputer;
-import org.eclipse.search.ui.ISearchResultView;
-
-
-public class SearchResultView extends ViewPart implements ISearchResultView {
-
-
- private static Map fgLabelProviders= new HashMap(5);
-
- private SearchResultViewer fViewer;
- private Map fResponse;
- private IMemento fMemento;
- private IPropertyChangeListener fPropertyChangeListener;
- private CellEditorActionHandler fCellEditorActionHandler;
- private SelectAllAction fSelectAllAction;
-
- /*
- * Implements method from IViewPart.
- */
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- fMemento= memento;
- }
-
- /*
- * Implements method from IViewPart.
- */
- public void saveState(IMemento memento) {
- if (fViewer == null) {
- // part has not been created
- if (fMemento != null) //Keep the old state;
- memento.putMemento(fMemento);
- return;
- }
- fViewer.saveState(memento);
- }
-
- /**
- * Creates the search list inner viewer.
- */
- public void createPartControl(Composite parent) {
- Assert.isTrue(fViewer == null);
- fViewer= new SearchResultViewer(this, parent);
- if (fMemento != null)
- fViewer.restoreState(fMemento);
- fMemento= null;
- SearchManager.getDefault().addSearchChangeListener(fViewer);
- fViewer.init();
-
- // Add selectAll action handlers.
- fCellEditorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
- fSelectAllAction= new SelectAllAction(fViewer);
- fCellEditorActionHandler.setSelectAllAction(fSelectAllAction);
-
- fillActionBars(getViewSite().getActionBars());
-
- fPropertyChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (SearchPreferencePage.POTENTIAL_MATCH_FG_COLOR.equals(event.getProperty()) || SearchPreferencePage.EMPHASIZE_POTENTIAL_MATCHES.equals(event.getProperty()))
- if (fViewer != null)
- fViewer.updatedPotentialMatchFgColor();
- }
- };
-
- SearchPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener);
-
- WorkbenchHelp.setHelp(fViewer.getControl(), SearchPlugin.getDefault().getSearchViewHelpContextId());
- }
-
- /**
- * Returns the search result viewer.
- */
- public SearchResultViewer getViewer() {
- return fViewer;
- }
-
- //---- IWorkbenchPart ------------------------------------------------------
-
-
- public void setFocus() {
- fViewer.getControl().setFocus();
- }
-
- public void dispose() {
- if (fViewer != null) {
- SearchManager.getDefault().removeSearchChangeListener(fViewer);
- fViewer= null;
- }
- if (fPropertyChangeListener != null)
- SearchPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
- if (fCellEditorActionHandler != null) {
- fCellEditorActionHandler.dispose();
- fCellEditorActionHandler= null;
- }
- super.dispose();
- }
-
- protected void setTitle(String title) {
- super.setTitle(title);
- }
-
- protected void setTitleToolTip(String text) {
- super.setTitleToolTip(text);
- }
-
- //---- Adding Action to Toolbar -------------------------------------------
-
- private void fillActionBars(IActionBars actionBars) {
- IToolBarManager toolBar= actionBars.getToolBarManager();
- fillToolBar(toolBar);
- actionBars.updateActionBars();
-
- // Add selectAll action handlers.
- actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction);
- }
-
- private void fillToolBar(IToolBarManager tbm) {
- fViewer.fillToolBar(tbm);
- }
-
- ILabelProvider getLabelProvider(String pageId) {
- if (pageId != null)
- return (ILabelProvider)fgLabelProviders.get(pageId);
- return null;
- }
-
- public ILabelProvider getLabelProvider() {
- if (fViewer == null)
- return null;
- IBaseLabelProvider labelProvider= fViewer.getLabelProvider();
- if (labelProvider == null)
- return null;
-
- return ((SearchResultLabelProvider)labelProvider).getLabelProvider();
- }
-
- private void setGotoMarkerAction(final IAction gotoMarkerAction) {
- // Make sure we are doing it in the right thread.
- getDisplay().syncExec(new Runnable() {
- public void run() {
- getViewer().setGotoMarkerAction(gotoMarkerAction);
- }
- });
- }
-
-
- Display getDisplay() {
- return fViewer.getControl().getDisplay();
- }
-
-
- //---- ISearchResultView --------------------------------------------------
-
-
- /*
- * Implements method from ISearchResultView
- */
- public ISelection getSelection() {
- return fViewer.getSelection();
- }
-
- /*
- * Implements method from ISearchResultView
- */
- public void searchStarted(
- IActionGroupFactory groupFactory,
- String singularLabel,
- String pluralLabelPattern,
- ImageDescriptor imageDescriptor,
- String pageId,
- ILabelProvider labelProvider,
- IAction gotoAction,
- IGroupByKeyComputer groupByKeyComputer,
- IRunnableWithProgress operation) {
-
-
- Assert.isNotNull(pageId);
- Assert.isNotNull(pluralLabelPattern);
- Assert.isNotNull(gotoAction);
-
- fResponse= new HashMap(500);
- setGotoMarkerAction(gotoAction);
-
- ILabelProvider oldLabelProvider= (ILabelProvider)fgLabelProviders.get(pageId);
- if (oldLabelProvider != null)
- oldLabelProvider.dispose();
- fgLabelProviders.put(pageId, labelProvider);
-
- SearchManager.getDefault().addNewSearch(
- new Search(
- pageId,
- singularLabel,
- pluralLabelPattern,
- null,
- imageDescriptor,
- fViewer.getGotoMarkerAction(),
- groupFactory,
- groupByKeyComputer,
- operation));
- }
-
- /**
- * Implements method from ISearchResultView
- * @deprecated As of build > 20011107, replaced by the new version with additonal parameter
- */
- public void searchStarted(
- String pageId,
- String label,
- ImageDescriptor imageDescriptor,
- IContextMenuContributor contributor,
- ILabelProvider labelProvider,
- IAction gotoAction,
- IGroupByKeyComputer groupByKeyComputer,
- IRunnableWithProgress operation) {
-
- searchStarted(pageId, null, label, imageDescriptor, contributor, labelProvider, gotoAction, groupByKeyComputer, operation);
- }
-
- /**
- * Implements method from ISearchResultView
- * @deprecated As of build > 20020514
- */
- public void searchStarted(
- String pageId,
- String singularLabel,
- String pluralLabelPattern,
- ImageDescriptor imageDescriptor,
- IContextMenuContributor contributor,
- ILabelProvider labelProvider,
- IAction gotoAction,
- IGroupByKeyComputer groupByKeyComputer,
- IRunnableWithProgress operation) {
-
-
- Assert.isNotNull(pageId);
- Assert.isNotNull(pluralLabelPattern);
- Assert.isNotNull(gotoAction);
-
- fResponse= new HashMap(500);
- setGotoMarkerAction(gotoAction);
-
- ILabelProvider oldLabelProvider= (ILabelProvider)fgLabelProviders.get(pageId);
- if (oldLabelProvider != null)
- oldLabelProvider.dispose();
- fgLabelProviders.put(pageId, labelProvider);
-
- SearchManager.getDefault().addNewSearch(
- new Search(
- pageId,
- singularLabel,
- pluralLabelPattern,
- null,
- imageDescriptor,
- fViewer.getGotoMarkerAction(),
- contributor,
- groupByKeyComputer,
- operation));
- }
-
- /*
- * Implements method from ISearchResultView
- */
- public void addMatch(String description, Object groupByKey, IResource resource, IMarker marker) {
- SearchResultViewEntry entry= (SearchResultViewEntry)fResponse.get(groupByKey);
- if (entry == null) {
- entry= new SearchResultViewEntry(groupByKey, resource);
- fResponse.put(groupByKey, entry);
- }
- entry.add(marker);
- }
-
-
- /*
- * Implements method from ISearchResultView
- */
- public void searchFinished() {
- SearchManager.getDefault().searchFinished(new ArrayList(fResponse.values()));
- fResponse= null;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntry.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntry.java
deleted file mode 100644
index 9d536a31410..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntry.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.PlatformObject;
-
-import org.eclipse.search.ui.ISearchResultViewEntry;
-import org.eclipse.search.ui.SearchUI;
-
-/**
- * Represents an entry in the search result view
- */
-public class SearchResultViewEntry extends PlatformObject implements ISearchResultViewEntry {
-
- private Object fGroupByKey= null;
- private IResource fResource= null;
- private IMarker fMarker= null;
- private ArrayList fMarkers= null;
- private ArrayList fAttributes;
- private int fSelectedMarkerIndex;
- private long fModificationStamp= IResource.NULL_STAMP;
- private String fMarkerType;
-
- public SearchResultViewEntry(Object groupByKey, IResource resource) {
- fGroupByKey= groupByKey;
- fResource= resource;
- if (fResource != null)
- fModificationStamp= fResource.getModificationStamp();
- }
-
- //---- Accessors ------------------------------------------------
- public Object getGroupByKey() {
- return fGroupByKey;
- }
-
- void setGroupByKey(Object groupByKey) {
- fGroupByKey= groupByKey;
- }
-
- public IResource getResource() {
- return fResource;
- }
-
- public int getMatchCount() {
- if (fMarkers != null)
- return fMarkers.size();
- if (fMarkers == null && fMarker != null)
- return 1;
- return 0;
- }
-
- boolean isPotentialMatch() {
- if (fMarker != null)
- return fMarker.getAttribute(SearchUI.POTENTIAL_MATCH, false);
- return false;
- }
-
- List getAttributesPerMarker() {
- if (fAttributes == null)
- return new ArrayList(0);
- return fAttributes;
- }
-
- public long getModificationStamp() {
- return fModificationStamp;
- }
-
- void clearMarkerList() {
- fMarker= null;
- if (fMarkers != null)
- fMarkers.clear();
- }
-
- void add(IMarker marker) {
- if (marker != null && fMarkerType == null) {
- try {
- fMarkerType= marker.getType();
- } catch (CoreException ex) {
- // will default to org.eclipse.search.searchmarker
- }
- }
-
- if (fMarker == null) {
- fMarker= marker;
- if (fMarkers != null)
- fMarkers.add(marker);
- return;
- }
- if (fMarkers == null) {
- fMarkers= new ArrayList(10);
- addByStartpos(fMarkers, fMarker);
- }
- addByStartpos(fMarkers, marker);
- }
-
- void setSelectedMarkerIndex(int index) {
- fSelectedMarkerIndex= index;
- }
-
- public IMarker getSelectedMarker() {
- fSelectedMarkerIndex= Math.min(fSelectedMarkerIndex, getMatchCount() - 1);
- if (fMarkers == null && fMarker == null)
- return null;
- if (fMarkers != null && fSelectedMarkerIndex >= 0)
- return (IMarker)fMarkers.get(fSelectedMarkerIndex);
- return fMarker;
- }
-
- public List getMarkers() {
- if (fMarkers == null && fMarker == null)
- return new ArrayList(0);
- else if (fMarkers == null && fMarker != null) {
- List markers= new ArrayList(1);
- markers.add(fMarker);
- return markers;
- }
- return fMarkers;
- }
-
- String getMarkerType() {
- if (fMarkerType == null)
- return SearchUI.SEARCH_MARKER;
- else
- return fMarkerType;
- }
-
- boolean contains(IMarker marker) {
- if (fMarkers == null && fMarker == null)
- return false;
- if (fMarkers == null)
- return fMarker.equals(marker);
- else
- return fMarkers.contains(marker);
- }
-
- void remove(IMarker marker) {
- if (marker == null)
- return;
-
- if (fMarkers == null) {
- if (fMarker != null && fMarker.equals(marker))
- fMarker= null;
- }
- else {
- fMarkers.remove(marker);
- if (fMarkers.size() == 1) {
- fMarker= (IMarker)fMarkers.get(0);
- fMarkers= null;
- }
- }
- }
-
- void backupMarkers() {
- if (fResource != null)
- fModificationStamp= fResource.getModificationStamp();
- List markers= getMarkers();
- fAttributes= new ArrayList(markers.size());
- Iterator iter= markers.iterator();
- while (iter.hasNext()) {
- IMarker marker= (IMarker)iter.next();
- Map attributes= null;
- try {
- attributes= marker.getAttributes();
- } catch (CoreException ex) {
- // don't backup corrupt marker
- continue;
- }
- fAttributes.add(attributes);
- }
- }
-
- private void addByStartpos(ArrayList markers, IMarker marker) {
- int startPos= marker.getAttribute(IMarker.CHAR_START, -1);
- int i= 0;
- int markerCount= markers.size();
- while (i < markerCount && startPos >= ((IMarker)markers.get(i)).getAttribute(IMarker.CHAR_START, -1))
- i++;
- markers.add(i, marker);
- if (i == 0)
- fMarker= marker;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntryAdapterFactory.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntryAdapterFactory.java
deleted file mode 100644
index 7acaaf16980..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntryAdapterFactory.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.search.internal.ui;
-
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdapterFactory;
-
-import org.eclipse.search.ui.ISearchResultViewEntry;
-
-/**
- * Implements basic UI support for Java elements.
- * Implements handle to persistent support for Java elements.
- */
-public class SearchResultViewEntryAdapterFactory implements IAdapterFactory {
-
- private static Class[] PROPERTIES= new Class[] {
- IResource.class,
- };
-
-
- public Class[] getAdapterList() {
- return PROPERTIES;
- }
-
- public Object getAdapter(Object element, Class key) {
-
- ISearchResultViewEntry entry= (ISearchResultViewEntry)element;
-
- if (IResource.class.equals(key)) {
- IResource resource= entry.getResource();
- /*
- * This is a trick to filter out dummy markers that
- * have been attached to a project because there is no
- * corresponding resource in the workspace.
- */
- int type= resource.getType();
- if (type != IResource.PROJECT && type != IResource.ROOT)
- return resource;
- }
- return null;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java
deleted file mode 100644
index d9e07dfff65..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java
+++ /dev/null
@@ -1,728 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui;
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Widget;
-
-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.action.Separator;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-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.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.search.ui.IActionGroupFactory;
-import org.eclipse.search.ui.IContextMenuConstants;
-import org.eclipse.search.ui.IContextMenuContributor;
-import org.eclipse.search.ui.ISearchResultViewEntry;
-import org.eclipse.search.ui.SearchUI;
-
-import org.eclipse.search.internal.ui.util.FileLabelProvider;
-
-
-/**
- * A special viewer to present search results. The viewer implements an
- * optimized adding and removing strategy. Furthermore it manages
- * contributions for search result types. For example the viewer's context
- * menu differs if the search result has been generated by a text or
- * a java search.
- */
-public class SearchResultViewer extends TableViewer {
-
- private SearchResultView fOuterPart;
- private ShowNextResultAction fShowNextResultAction;
- private ShowPreviousResultAction fShowPreviousResultAction;
- private GotoMarkerAction fGotoMarkerActionProxy;
- private SearchAgainAction fSearchAgainAction;
- private RemoveResultAction fRemoveSelectedMatchesAction;
- private RemoveAllResultsAction fRemoveAllResultsAction;
- private SortDropDownAction fSortDropDownAction;
- private SearchDropDownAction fSearchDropDownAction;
- private CopyToClipboardAction fCopyToClipboardAction;
- private int fMarkerToShow;
- private boolean fHandleSelectionChangedEvents= true;
- private ISelection fLastSelection;
- private boolean fCurrentMatchRemoved= false;
- private Color fPotentialMatchFgColor;
- private ActionGroup fActionGroup;
- private IContextMenuContributor fContextMenuContributor;
- private IAction fGotoMarkerAction;
-
- private ResourceToItemsMapper fResourceToItemsMapper;
- private String fCurrentPageId= null;
-
- public SearchResultViewer(SearchResultView outerPart, Composite parent) {
- super(new Table(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
-
- fResourceToItemsMapper= new ResourceToItemsMapper(this);
-
- fOuterPart= outerPart;
- Assert.isNotNull(fOuterPart);
-
- if (SearchPreferencePage.arePotentialMatchesEmphasized())
- fPotentialMatchFgColor= new Color(SearchPlugin.getActiveWorkbenchShell().getDisplay(), SearchPreferencePage.getPotentialMatchForegroundColor());
-
- setUseHashlookup(true);
- setContentProvider(new SearchResultContentProvider());
-
- ILabelProvider labelProvider= new SearchResultLabelProvider(new FileLabelProvider(FileLabelProvider.SHOW_LABEL));
- setLabelProvider(labelProvider);
-
- Search currentSearch= SearchManager.getDefault().getCurrentSearch();
- boolean hasSearch= currentSearch != null;
- boolean hasSearchOperation= hasSearch && currentSearch.getOperation() != null;
-
- fShowNextResultAction= new ShowNextResultAction(this);
- fShowNextResultAction.setEnabled(false);
- fShowPreviousResultAction= new ShowPreviousResultAction(this);
- fShowPreviousResultAction.setEnabled(false);
- fGotoMarkerActionProxy= new GotoMarkerAction(this);
- fGotoMarkerActionProxy.setEnabled(false);
- fRemoveSelectedMatchesAction= new RemoveResultAction(this, false);
- fRemoveSelectedMatchesAction.setEnabled(false);
- fRemoveAllResultsAction= new RemoveAllResultsAction();
- fRemoveAllResultsAction.setEnabled(false);
- fSearchAgainAction= new SearchAgainAction();
- fSearchAgainAction.setEnabled(hasSearchOperation);
- fSortDropDownAction = new SortDropDownAction(this);
- fSortDropDownAction.setEnabled(getItemCount() > 0);
- fSearchDropDownAction= new SearchDropDownAction();
- fSearchDropDownAction.setEnabled(hasSearch);
- fCopyToClipboardAction= new CopyToClipboardAction(this);
-
- addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (fLastSelection == null || !fLastSelection.equals(event.getSelection())) {
- fLastSelection= event.getSelection();
- handleSelectionChanged();
- }
- }
- }
- );
-
- addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- showResult();
- }
- });
-
- MenuManager menuMgr= new MenuManager("#PopUp"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(
- new IMenuListener() {
- public void menuAboutToShow(IMenuManager mgr) {
- SearchPlugin.createStandardGroups(mgr);
- fillContextMenu(mgr);
- }
- });
- Menu menu= menuMgr.createContextMenu(getTable());
- getTable().setMenu(menu);
-
- // Register menu
- fOuterPart.getSite().registerContextMenu(menuMgr, this);
-
- IActionBars actionBars= fOuterPart.getViewSite().getActionBars();
- if (actionBars != null) {
- actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), fShowNextResultAction);
- actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), fShowPreviousResultAction);
- }
-
- fOuterPart.getSite().setSelectionProvider(this);
- }
-
- void init() {
- Search search= SearchManager.getDefault().getCurrentSearch();
- if (search != null) {
- setGotoMarkerAction(search.getGotoMarkerAction());
- setContextMenuTarget(search.getContextMenuContributor());
- setActionGroupFactory(null);
- setActionGroupFactory(search.getActionGroupFactory());
- setPageId(search.getPageId());
- setInput(search.getResults());
- }
- }
-
- /**
- * @see StructuredViewer#doUpdateItem(Widget, Object, boolean)
- */
- protected void doUpdateItem(Widget item, Object element, boolean fullMap) {
- super.doUpdateItem(item, element, fullMap);
- if (((SearchResultViewEntry)element).isPotentialMatch()) {
- TableItem ti = (TableItem) item;
- ti.setForeground(fPotentialMatchFgColor);
- }
- }
-
- private void handleSelectionChanged() {
- int selectionCount= getSelectedEntriesCount();
- boolean hasSingleSelection= selectionCount == 1;
- boolean hasElements= getItemCount() > 0;
- fShowNextResultAction.setEnabled(hasSingleSelection || (hasElements && selectionCount == 0));
- fShowPreviousResultAction.setEnabled(hasSingleSelection || (hasElements && selectionCount == 0));
- fGotoMarkerActionProxy.setEnabled(hasSingleSelection);
- fRemoveSelectedMatchesAction.setEnabled(selectionCount > 0);
-
- if (fHandleSelectionChangedEvents) {
- fMarkerToShow= -1;
- fCurrentMatchRemoved= false;
- } else
- fHandleSelectionChangedEvents= true;
-
- updateStatusLine();
- }
-
- void updateStatusLine() {
- boolean hasSingleSelection= getSelectedEntriesCount() == 1;
- String location= ""; //$NON-NLS-1$
- if (hasSingleSelection) {
- ISearchResultViewEntry entry= (ISearchResultViewEntry)getTable().getItem(getTable().getSelectionIndex()).getData();
- IPath path= entry.getResource().getFullPath();
- if (path != null)
- location= path.makeRelative().toString();
- }
- setStatusLineMessage(location);
- }
-
- void enableActions() {
- /*
- * Note: The check before each set operation reduces flickering
- */
- boolean state= getItemCount() > 0;
- if (state != fShowNextResultAction.isEnabled())
- fShowNextResultAction.setEnabled(state);
- if (state != fShowPreviousResultAction.isEnabled())
- fShowPreviousResultAction.setEnabled(state);
- if (state != fSortDropDownAction.isEnabled())
- fSortDropDownAction.setEnabled(state);
- if (state != fRemoveAllResultsAction.isEnabled())
- fRemoveAllResultsAction.setEnabled(state);
-
- Search currentSearch= SearchManager.getDefault().getCurrentSearch();
- state= currentSearch != null;
- boolean operationState= state && currentSearch.getOperation() != null;
- if (state != fSearchDropDownAction.isEnabled())
- fSearchDropDownAction.setEnabled(state);
- if (operationState != fSearchAgainAction.isEnabled())
- fSearchAgainAction.setEnabled(operationState);
-
- state= !getSelection().isEmpty();
- if (state != fGotoMarkerActionProxy.isEnabled())
- fGotoMarkerActionProxy.setEnabled(state);
- if (state != fRemoveSelectedMatchesAction.isEnabled())
- fRemoveSelectedMatchesAction.setEnabled(state);
- }
-
-
- protected void inputChanged(Object input, Object oldInput) {
- fLastSelection= null;
- getTable().removeAll();
- super.inputChanged(input, oldInput);
- fMarkerToShow= -1;
- fCurrentMatchRemoved= false;
- updateTitle();
- enableActions();
- if (getItemCount() > 0)
- selectResult(0);
-
- WorkbenchHelp.setHelp(getControl(), SearchPlugin.getDefault().getSearchViewHelpContextId());
- }
-
- protected int getSelectedEntriesCount() {
- ISelection s= getSelection();
- if (s == null || s.isEmpty() || !(s instanceof IStructuredSelection))
- return 0;
- IStructuredSelection selection= (IStructuredSelection)s;
- return selection.size();
- }
-
- //--- Contribution management -----------------------------------------------
-
-
- protected boolean enableRemoveMatchMenuItem() {
- if (getSelectedEntriesCount() != 1)
- return false;
- Table table= getTable();
- int index= table.getSelectionIndex();
- SearchResultViewEntry entry= null;
- if (index > -1)
- entry= (SearchResultViewEntry)table.getItem(index).getData();
- return (entry != null && entry.getMatchCount() > 1);
-
- }
-
- void fillContextMenu(IMenuManager menu) {
- ISelection selection= getSelection();
-
- if (fActionGroup != null) {
- ActionContext context= new ActionContext(selection);
- context.setInput(getInput());
- fActionGroup.setContext(context);
- fActionGroup.fillContextMenu(menu);
- fActionGroup.setContext(null);
- }
-
- if (fContextMenuContributor != null)
- fContextMenuContributor.fill(menu, this);
-
- if (!selection.isEmpty()) {
- menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, fCopyToClipboardAction);
- menu.appendToGroup(IContextMenuConstants.GROUP_GOTO, fGotoMarkerActionProxy);
- if (enableRemoveMatchMenuItem())
- menu.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, new RemoveMatchAction(this));
- menu.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, new RemoveResultAction(this, true));
-
- if (isPotentialMatchSelected())
- menu.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, new RemovePotentialMatchesAction(fOuterPart.getViewSite()));
- }
-
- // If we have elements
- if (getItemCount() > 0)
- menu.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, new RemoveAllResultsAction());
-
- menu.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, fSearchAgainAction);
- if (getItemCount() > 0) {
- fSortDropDownAction= fSortDropDownAction.renew();
- if (fSortDropDownAction.getSorterCount() > 1)
- menu.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, fSortDropDownAction);
- }
- }
-
- private boolean isPotentialMatchSelected() {
- if (getSelectedEntriesCount() == 0)
- return false;
-
- Iterator iter= Collections.EMPTY_LIST.iterator();
- ISelection selection= getSelection();
- if (selection instanceof IStructuredSelection)
- iter= ((IStructuredSelection)selection).iterator();
-
- while (iter.hasNext()) {
- Object entry= iter.next();
- if (entry instanceof ISearchResultViewEntry) {
- IMarker marker= ((ISearchResultViewEntry)entry).getSelectedMarker();
- if (marker != null && marker.getAttribute(SearchUI.POTENTIAL_MATCH, false))
- return true;
- }
- }
-
- return false;
- }
-
- IAction getGotoMarkerAction() {
- // null as return value is covered (no action will take place)
- return fGotoMarkerAction;
- }
-
- void setGotoMarkerAction(IAction gotoMarkerAction) {
- fGotoMarkerAction= gotoMarkerAction;
- }
-
-
- void setContextMenuTarget(IContextMenuContributor contributor) {
- fContextMenuContributor= contributor;
- }
-
- void setActionGroupFactory(IActionGroupFactory groupFactory) {
- IActionBars actionBars= fOuterPart.getViewSite().getActionBars();
- if (fActionGroup != null) {
- fActionGroup.dispose();
- fActionGroup= null;
- }
-
- if (groupFactory != null) {
- fActionGroup= groupFactory.createActionGroup(fOuterPart);
- if (actionBars != null)
- fActionGroup.fillActionBars(actionBars);
- }
- if (actionBars != null)
- actionBars.updateActionBars();
- }
-
- void setPageId(String pageId) {
- if (fCurrentPageId != null && fCurrentPageId.equals(pageId))
- return;
-
- fCurrentPageId= pageId;
- ILabelProvider labelProvider= fOuterPart.getLabelProvider(pageId);
- if (labelProvider != null)
- internalSetLabelProvider(labelProvider);
- fSortDropDownAction.setPageId(pageId);
- }
-
- void fillToolBar(IToolBarManager tbm) {
- tbm.add(fShowNextResultAction);
- tbm.add(fShowPreviousResultAction);
-// tbm.add(fGotoMarkerAction); see bug 15275
- tbm.add(fRemoveSelectedMatchesAction);
- tbm.add(fRemoveAllResultsAction);
- tbm.add(new Separator());
- tbm.add(new OpenSearchDialogAction());
- tbm.add(fSearchDropDownAction);
-
- // need to hook F5 to table
- getTable().addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- if (e.keyCode == SWT.F5) {
- fSearchAgainAction.run();
- return; // performance
- }
- if (e.character == SWT.DEL) {
- new RemoveResultAction(SearchResultViewer.this, true).run();
- return; // performance
- }
- }
- });
- }
-
- int getItemCount() {
- return SearchManager.getDefault().getCurrentItemCount();
- }
-
- void internalSetLabelProvider(ILabelProvider provider) {
- setLabelProvider(new SearchResultLabelProvider(provider));
- }
-
- /**
- * Makes the first marker of the current result entry
- * visible in an editor. If no result
- * is visible, this method does nothing.
- */
- public void showResult() {
- Table table= getTable();
- if (!canDoShowResult(table))
- return;
-
-
- int index= table.getSelectionIndex();
- if (index < 0)
- return;
- SearchResultViewEntry entry= (SearchResultViewEntry)getTable().getItem(index).getData();
-
-
- fMarkerToShow= 0;
- fCurrentMatchRemoved= false;
- entry.setSelectedMarkerIndex(0);
- openCurrentSelection();
- }
-
-
- /**
- * Makes the next result (marker) visible in an editor. If no result
- * is visible, this method makes the first result visible.
- */
- public void showNextResult() {
- Table table= getTable();
- if (!canDoShowResult(table))
- return;
-
- int index= table.getSelectionIndex();
- SearchResultViewEntry entry= null;
- if (index > -1)
- entry= (SearchResultViewEntry)table.getItem(index).getData();
-
- if (fCurrentMatchRemoved)
- fCurrentMatchRemoved= false;
- else
- fMarkerToShow++;
- if (entry == null || fMarkerToShow >= entry.getMatchCount()) {
- // move selection
- if (index == -1) {
- index= 0;
- } else {
- index++;
- if (index >= table.getItemCount())
- index= 0;
- }
- fMarkerToShow= 0;
- entry= (SearchResultViewEntry)getTable().getItem(index).getData();
- selectResult(index);
- }
- entry.setSelectedMarkerIndex(fMarkerToShow);
- openCurrentSelection();
- updateStatusLine();
- }
-
-
- /**
- * Makes the previous result (marker) visible. If there isn't any
- * visible result, this method makes the last result visible.
- */
- public void showPreviousResult() {
- fCurrentMatchRemoved= false;
- Table table= getTable();
- if (!canDoShowResult(table))
- return;
-
- int index= table.getSelectionIndex();
- SearchResultViewEntry entry;
-
-
- fMarkerToShow--;
- if (fMarkerToShow >= 0)
- entry= (SearchResultViewEntry)getTable().getItem(getTable().getSelectionIndex()).getData();
- else {
- // move selection
- int count= table.getItemCount();
- if (index == -1) {
- index= count - 1;
- } else {
- index--;
- if (index < 0)
- index= count - 1;
- }
- entry= (SearchResultViewEntry)getTable().getItem(index).getData();
- fMarkerToShow= entry.getMatchCount() - 1;
- selectResult(index);
- }
- entry.setSelectedMarkerIndex(fMarkerToShow);
- openCurrentSelection();
- updateStatusLine();
- }
-
- private boolean canDoShowResult(Table table) {
- if (table == null || getItemCount() == 0)
- return false;
- return true;
- }
-
- private void selectResult(int index) {
- fHandleSelectionChangedEvents= false;
- Object element= getElementAt(index);
- if (element != null)
- setSelection(new StructuredSelection(getElementAt(index)), true);
- else
- setSelection(StructuredSelection.EMPTY);
- }
-
- private void openCurrentSelection() {
- IAction action= getGotoMarkerAction();
- if (action != null)
- action.run();
- }
-
- /**
- * Updates the foreground color for potential matches.
- */
- void updatedPotentialMatchFgColor() {
- if (fPotentialMatchFgColor != null)
- fPotentialMatchFgColor.dispose();
- fPotentialMatchFgColor= null;
- if (SearchPreferencePage.arePotentialMatchesEmphasized())
- fPotentialMatchFgColor= new Color(SearchPlugin.getActiveWorkbenchShell().getDisplay(), SearchPreferencePage.getPotentialMatchForegroundColor());
- refresh();
- }
-
- /**
- * Update the title
- */
- protected void updateTitle() {
- boolean hasCurrentSearch= SearchManager.getDefault().getCurrentSearch() != null;
- String title;
- if (hasCurrentSearch) {
- String description= SearchManager.getDefault().getCurrentSearch().getFullDescription();
- title= SearchMessages.getFormattedString("SearchResultView.titleWithDescription", description); //$NON-NLS-1$
- } else
- title= SearchMessages.getString("SearchResultView.title"); //$NON-NLS-1$
- if (title == null || !title.equals(fOuterPart.getTitle()))
- fOuterPart.setTitle(title);
- }
-
- /**
- * Clear the title
- */
- protected void clearTitle() {
- String title= SearchMessages.getString("SearchResultView.title"); //$NON-NLS-1$
- if (!title.equals(fOuterPart.getTitle()))
- fOuterPart.setTitle(title);
- }
-
- /**
- * Sets the message text to be displayed on the status line.
- * The image on the status line is cleared.
- */
- private void setStatusLineMessage(String message) {
- fOuterPart.getViewSite().getActionBars().getStatusLineManager().setMessage(message);
- }
-
-
- protected void handleDispose(DisposeEvent event) {
- fLastSelection= null;
- Menu menu= getTable().getMenu();
- if (menu != null)
- menu.dispose();
- if (fPotentialMatchFgColor != null)
- fPotentialMatchFgColor.dispose();
- if (fActionGroup != null) {
- fActionGroup.dispose();
- fActionGroup= null;
- }
- super.handleDispose(event);
- }
-
- //--- Change event handling -------------------------------------------------
-
- /**
- * Handle a single add.
- */
- protected void handleAddMatch(ISearchResultViewEntry entry) {
- insert(entry, -1);
- }
-
- /**
- * Handle a single remove.
- */
- protected void handleRemoveMatch(ISearchResultViewEntry entry) {
- Widget item= findItem(entry);
- if (entry.getMatchCount() == 0)
- remove(entry);
- else
- updateItem(item, entry);
- updateStatusLine();
- }
-
- /**
- * Handle remove all.
- */
- protected void handleRemoveAll() {
- setContextMenuTarget(null);
- setActionGroupFactory(null);
- setInput(null);
- }
-
- /**
- * Handle an update of an entry.
- */
- protected void handleUpdateMatch(ISearchResultViewEntry entry, boolean matchRemoved) {
- Widget item= findItem(entry);
- updateItem(item, entry);
- if (matchRemoved && getSelectionFromWidget().contains(entry))
- fCurrentMatchRemoved= true;
- }
-
- //--- Persistency -------------------------------------------------
-
- void restoreState(IMemento memento) {
- fSortDropDownAction.restoreState(memento);
- }
-
- void saveState(IMemento memento) {
- fSortDropDownAction.saveState(memento);
- }
-
- /*
- * @see ContentViewer#handleLabelProviderChanged(LabelProviderChangedEvent)
- */
- protected void handleLabelProviderChanged(LabelProviderChangedEvent event) {
- Object[] changed= event.getElements();
- if (changed != null && !fResourceToItemsMapper.isEmpty()) {
- ArrayList others= new ArrayList(changed.length);
- for (int i= 0; i < changed.length; i++) {
- Object curr= changed[i];
- if (curr instanceof IResource)
- fResourceToItemsMapper.resourceChanged((IResource) curr);
- else if (curr instanceof IAdaptable) {
- IResource resource= (IResource)((IAdaptable)curr).getAdapter(IResource.class);
- if (resource != null)
- fResourceToItemsMapper.resourceChanged(resource);
- } else
- others.add(curr);
- }
- if (others.isEmpty()) {
- return;
- }
- event= new LabelProviderChangedEvent((IBaseLabelProvider) event.getSource(), others.toArray());
- }
- super.handleLabelProviderChanged(event);
- }
-
- /*
- * @see StructuredViewer#mapElement(Object, Widget)
- */
- protected void mapElement(Object element, Widget item) {
- super.mapElement(element, item);
- if (item instanceof Item) {
- fResourceToItemsMapper.addToMap(element, (Item)item);
- }
- }
-
- /*
- * @see StructuredViewer#unmapElement(Object, Widget)
- */
- protected void unmapElement(Object element, Widget item) {
- if (item instanceof Item) {
- fResourceToItemsMapper.removeFromMap(element, (Item)item);
- }
- super.unmapElement(element, item);
- }
-
- /*
- * @see StructuredViewer#unmapAllElements()
- */
- protected void unmapAllElements() {
- fResourceToItemsMapper.clearMap();
- super.unmapAllElements();
- }
-
- protected void internalRefresh(Object element, boolean updateLabels) {
- // see bug 44891
- getTable().setRedraw(false);
- super.internalRefresh(element, updateLabels);
- getTable().setRedraw(true);
- }
-
- void handleAllSearchesRemoved() {
- setContextMenuTarget(null);
- setActionGroupFactory(null);
- setInput(null);
- fSearchDropDownAction.clear();
- }
-
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.java
deleted file mode 100644
index 6ee7c5023a7..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.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.search.internal.ui;
-
-import org.eclipse.jface.action.Action;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This action selects all entries currently showing in view.
- */
-class SelectAllAction extends Action {
-
- private SearchResultViewer fViewer;
-
- /**
- * Creates the action.
- */
- SelectAllAction(SearchResultViewer viewer) {
- super("selectAll"); //$NON-NLS-1$
- setText(SearchMessages.getString("SelectAllAction.label")); //$NON-NLS-1$
- setToolTipText(SearchMessages.getString("SelectAllAction.tooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, ISearchHelpContextIds.SELECT_ALL_ACTION);
- fViewer= viewer;
- }
-
- /**
- * Selects all resources in the view.
- */
- public void run() {
- fViewer.getTable().selectAll();
- // force viewer selection change
- fViewer.setSelection(fViewer.getSelection());
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowNextResultAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowNextResultAction.java
deleted file mode 100644
index 974505625eb..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowNextResultAction.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.search.internal.ui;
-
-import org.eclipse.jface.action.Action;
-
-class ShowNextResultAction extends Action {
-
- private SearchResultViewer fViewer;
-
- public ShowNextResultAction(SearchResultViewer viewer) {
- super(SearchMessages.getString("SearchResultView.showNext.text")); //$NON-NLS-1$
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_NEXT);
- setToolTipText(SearchMessages.getString("SearchResultView.showNext.tooltip")); //$NON-NLS-1$
- fViewer= viewer;
- setActionDefinitionId("org.eclipse.ui.navigate.next"); //$NON-NLS-1$
- }
-
- public void run() {
- fViewer.showNextResult();
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowPreviousResultAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowPreviousResultAction.java
deleted file mode 100644
index 806144d7122..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowPreviousResultAction.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.search.internal.ui;
-
-import org.eclipse.jface.action.Action;
-
-class ShowPreviousResultAction extends Action {
-
- private SearchResultViewer fViewer;
-
- public ShowPreviousResultAction(SearchResultViewer viewer) {
- super(SearchMessages.getString("SearchResultView.showPrev.text")); //$NON-NLS-1$
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_PREV);
- setToolTipText(SearchMessages.getString("SearchResultView.showPrev.tooltip")); //$NON-NLS-1$
- setActionDefinitionId("org.eclipse.ui.navigate.previous"); //$NON-NLS-1$
- fViewer= viewer;
- }
-
- public void run() {
- fViewer.showPreviousResult();
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchAction.java
deleted file mode 100644
index 969e08500ed..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchAction.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.search.internal.ui;
-
-import org.eclipse.jface.action.Action;
-
-class ShowSearchAction extends Action {
- private Search fSearch;
-
- /**
- * Create a new instance of this class
- */
- public ShowSearchAction(Search search) {
- fSearch= search;
- String desc= search.getShortDescription();
- setText(desc);
- setToolTipText(desc);
- setImageDescriptor(search.getImageDescriptor());
- }
- /**
- * Invoke the resource wizard selection wizard
- *
- * @param browser org.eclipse.jface.parts.Window
- */
- public void run() {
- if (fSearch != SearchManager.getDefault().getCurrentSearch())
- SearchManager.getDefault().setCurrentSearch(fSearch);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java
deleted file mode 100644
index 26baeae4ef0..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.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.search.internal.ui;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
-
-import org.eclipse.search.internal.ui.util.ListDialog;
-
-/**
- * Invoke the resource creation wizard selection Wizard.
- * This action will retarget to the active view.
- */
-class ShowSearchesAction extends Action {
-
- private static final class SearchesLabelProvider extends LabelProvider {
-
- private ArrayList fImages= new ArrayList();
-
- public String getText(Object element) {
- if (!(element instanceof ShowSearchAction))
- return ""; //$NON-NLS-1$
- return ((ShowSearchAction)element).getText();
- }
- public Image getImage(Object element) {
- if (!(element instanceof ShowSearchAction))
- return null;
-
- ImageDescriptor imageDescriptor= ((ShowSearchAction)element).getImageDescriptor();
- if (imageDescriptor == null)
- return null;
-
- Image image= imageDescriptor.createImage();
- fImages.add(image);
-
- return image;
- }
-
- public void dispose() {
- Iterator iter= fImages.iterator();
- while (iter.hasNext())
- ((Image)iter.next()).dispose();
-
- fImages= null;
- }
- }
-
- /**
- * Create a new instance of this class
- */
- public ShowSearchesAction() {
- super(SearchMessages.getString("ShowOtherSearchesAction.label")); //$NON-NLS-1$
- setToolTipText(SearchMessages.getString("ShowOtherSearchesAction.tooltip")); //$NON-NLS-1$
- }
- /*
- * Overrides method from Action
- */
- public void run() {
- run(false);
- }
-
- public void run(boolean showAll) {
- Iterator iter= SearchManager.getDefault().getPreviousSearches().iterator();
- int cutOffSize;
- if (showAll)
- cutOffSize= 0;
- else
- cutOffSize= SearchDropDownAction.RESULTS_IN_DROP_DOWN;
- int size= SearchManager.getDefault().getPreviousSearches().size() - cutOffSize;
- Search selectedSearch= SearchManager.getDefault().getCurrentSearch();
- Action selectedAction = null;
- ArrayList input= new ArrayList(size);
- int i= 0;
- while (iter.hasNext()) {
- Search search= (Search)iter.next();
- if (i++ < cutOffSize)
- continue;
- Action action= new ShowSearchAction(search);
- input.add(action);
- if (selectedSearch == search)
- selectedAction= action;
- }
-
- // Open a list dialog.
- String title;
- String message;
- if (showAll) {
- title= SearchMessages.getString("PreviousSearchesDialog.title"); //$NON-NLS-1$
- message= SearchMessages.getString("PreviousSearchesDialog.message"); //$NON-NLS-1$
- }
- else {
- title= SearchMessages.getString("OtherSearchesDialog.title"); //$NON-NLS-1$
- message= SearchMessages.getString("OtherSearchesDialog.message"); //$NON-NLS-1$
- }
-
- LabelProvider labelProvider=new SearchesLabelProvider();
-
- ListDialog dlg= new ListDialog(SearchPlugin.getActiveWorkbenchShell(),input, title, message, new SearchResultContentProvider(), labelProvider);
- if (selectedAction != null) {
- Object[] selected= new Object[1];
- selected[0]= selectedAction;
- dlg.setInitialSelections(selected);
- }
- if (dlg.open() == Window.OK) {
- List result= Arrays.asList(dlg.getResult());
- if (result != null && result.size() == 1) {
- ((ShowSearchAction)result.get(0)).run();
- }
- }
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SortDropDownAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SortDropDownAction.java
deleted file mode 100644
index 4df1ab0e4d6..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SortDropDownAction.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.search.internal.ui;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.model.WorkbenchViewerSorter;
-
-/**
- * Drop down action that holds the currently registered sort actions.
- */
-class SortDropDownAction extends Action implements IMenuCreator {
-
- // Persistance tags.
- private static final String TAG_SORTERS= "sorters"; //$NON-NLS-1$
- private static final String TAG_DEFAULT_SORTERS= "defaultSorters"; //$NON-NLS-1$
- private static final String TAG_ELEMENT= "element"; //$NON-NLS-1$
- private static final String TAG_PAGE_ID= "pageId"; //$NON-NLS-1$
- private static final String TAG_SORTER_ID= "sorterId"; //$NON-NLS-1$
-
- private static Map fgLastCheckedForType= new HashMap(5);
-
- private SearchResultViewer fViewer;
- private String fPageId;
- private Menu fMenu;
- private Map fLastCheckedForType;
-
- public SortDropDownAction(SearchResultViewer viewer) {
- super(SearchMessages.getString("SortDropDownAction.label")); //$NON-NLS-1$
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_SORT);
- fViewer= viewer;
- setToolTipText(SearchMessages.getString("SortDropDownAction.tooltip")); //$NON-NLS-1$
- setMenuCreator(this);
- fLastCheckedForType= new HashMap(5);
- }
-
- public void dispose() {
- if (fMenu != null && !fMenu.isDisposed())
- fMenu.dispose();
- fMenu= null;
- }
-
- public Menu getMenu(Control parent) {
- return null;
- }
-
- void setPageId(String pageId) {
- fPageId= pageId;
- SorterDescriptor sorterDesc= (SorterDescriptor)fLastCheckedForType.get(pageId);
- if (sorterDesc == null)
- sorterDesc= (SorterDescriptor)fgLastCheckedForType.get(pageId);
- if (sorterDesc == null)
- sorterDesc= findSorter(fPageId);
- if (sorterDesc != null) {
- setChecked(sorterDesc);
- fViewer.setSorter(sorterDesc.createObject());
- } else {
- // Use default sort workbench viewer sorter
- fViewer.setSorter(new WorkbenchViewerSorter());
- }
- }
-
- public Menu getMenu(final Menu parent) {
- dispose(); // ensure old menu gets disposed
-
- fMenu= new Menu(parent);
-
- Iterator iter= SearchPlugin.getDefault().getSorterDescriptors().iterator();
- while (iter.hasNext()) {
- Object value= fLastCheckedForType.get(fPageId);
- final String checkedId;
- if (value instanceof SorterDescriptor)
- checkedId= ((SorterDescriptor)value).getId();
- else
- checkedId= ""; //$NON-NLS-1$
-
- final SorterDescriptor sorterDesc= (SorterDescriptor) iter.next();
- if (!sorterDesc.getPageId().equals(fPageId) && !sorterDesc.getPageId().equals("*")) //$NON-NLS-1$
- continue;
- final ViewerSorter sorter= sorterDesc.createObject();
- if (sorter != null) {
- final Action action= new Action() {
- public void run() {
- if (!checkedId.equals(sorterDesc.getId())) {
- SortDropDownAction.this.setChecked(sorterDesc);
- BusyIndicator.showWhile(parent.getDisplay(), new Runnable() {
- public void run() {
- fViewer.setSorter(sorter);
- }
- });
- }
- }
- };
- action.setText(sorterDesc.getLabel());
- action.setImageDescriptor(sorterDesc.getImage());
- action.setToolTipText(sorterDesc.getToolTipText());
- action.setChecked(checkedId.equals(sorterDesc.getId()));
- addActionToMenu(fMenu, action);
- }
- }
- return fMenu;
- }
-
- protected void addActionToMenu(Menu parent, Action action) {
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- public void run() {
- // nothing to do
- }
-
- private SorterDescriptor findSorter(String pageId) {
- Iterator iter= SearchPlugin.getDefault().getSorterDescriptors().iterator();
- while (iter.hasNext()) {
- SorterDescriptor sorterDesc= (SorterDescriptor)iter.next();
- if (sorterDesc.getPageId().equals(pageId) || sorterDesc.getPageId().equals("*")) //$NON-NLS-1$
- return sorterDesc;
- }
- return null;
- }
-
- private SorterDescriptor getSorter(String sorterId) {
- Iterator iter= SearchPlugin.getDefault().getSorterDescriptors().iterator();
- while (iter.hasNext()) {
- SorterDescriptor sorterDesc= (SorterDescriptor)iter.next();
- if (sorterDesc.getId().equals(sorterId))
- return sorterDesc;
- }
- return null;
- }
-
- private void setChecked(SorterDescriptor sorterDesc) {
- fLastCheckedForType.put(fPageId, sorterDesc);
- fgLastCheckedForType.put(fPageId, sorterDesc);
- }
-
- /**
- * Disposes this action's menu and returns a new unused instance.
- */
- SortDropDownAction renew() {
- SortDropDownAction action= new SortDropDownAction(fViewer);
- action.fLastCheckedForType= fLastCheckedForType;
- action.fPageId= fPageId;
- dispose();
- return action;
- }
-
- //--- Persistency -------------------------------------------------
-
- void restoreState(IMemento memento) {
- if (fLastCheckedForType.isEmpty())
- restoreState(memento, fLastCheckedForType, TAG_SORTERS);
- if (fgLastCheckedForType.isEmpty())
- restoreState(memento, fgLastCheckedForType, TAG_DEFAULT_SORTERS);
- }
-
- private void restoreState(IMemento memento, Map map, String mapName) {
- memento= memento.getChild(mapName);
- if (memento == null)
- return;
- IMemento[] mementoElements= memento.getChildren(TAG_ELEMENT);
- for (int i= 0; i < mementoElements.length; i++) {
- String pageId= mementoElements[i].getString(TAG_PAGE_ID);
- String sorterId= mementoElements[i].getString(TAG_SORTER_ID);
- SorterDescriptor sorterDesc= getSorter(sorterId);
- if (sorterDesc != null)
- map.put(pageId, sorterDesc);
- }
- }
-
- void saveState(IMemento memento) {
- saveState(memento, fgLastCheckedForType, TAG_DEFAULT_SORTERS);
- saveState(memento, fLastCheckedForType, TAG_SORTERS);
- }
-
- private void saveState(IMemento memento, Map map, String mapName) {
- Iterator iter= map.entrySet().iterator();
- memento= memento.createChild(mapName);
- while (iter.hasNext()) {
- IMemento mementoElement= memento.createChild(TAG_ELEMENT);
- Map.Entry entry= (Map.Entry)iter.next();
- mementoElement.putString(TAG_PAGE_ID, (String)entry.getKey());
- mementoElement.putString(TAG_SORTER_ID, ((SorterDescriptor)entry.getValue()).getId());
- }
- }
-
- int getSorterCount() {
- int count= 0;
- Iterator iter= SearchPlugin.getDefault().getSorterDescriptors().iterator();
- while (iter.hasNext()) {
- SorterDescriptor sorterDesc= (SorterDescriptor)iter.next();
- if (sorterDesc.getPageId().equals(fPageId) || sorterDesc.getPageId().equals("*")) //$NON-NLS-1$
- count++;
- }
- return count;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SorterDescriptor.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SorterDescriptor.java
deleted file mode 100644
index d1e572ffb03..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SorterDescriptor.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.search.internal.ui;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
-/**
- * Proxy that represents a sorter.
- */
-class SorterDescriptor {
-
- public final static String SORTER_TAG= "sorter"; //$NON-NLS-1$
- private final static String ID_ATTRIBUTE= "id"; //$NON-NLS-1$
- private final static String PAGE_ID_ATTRIBUTE= "pageId"; //$NON-NLS-1$
- private final static String ICON_ATTRIBUTE= "icon"; //$NON-NLS-1$
- private final static String CLASS_ATTRIBUTE= "class"; //$NON-NLS-1$
- private final static String LABEL_ATTRIBUTE= "label"; //$NON-NLS-1$
- private final static String TOOLTIP_ATTRIBUTE= "tooltip"; //$NON-NLS-1$
-
- private IConfigurationElement fElement;
-
- /**
- * Creates a new sorter node with the given configuration element.
- */
- public SorterDescriptor(IConfigurationElement element) {
- fElement= element;
- }
-
- /**
- * Creates a new sorter from this node.
- */
- public ViewerSorter createObject() {
- try {
- return (ViewerSorter)fElement.createExecutableExtension(CLASS_ATTRIBUTE);
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.createSorter.title"), SearchMessages.getString("Search.Error.createSorter.message")); //$NON-NLS-2$ //$NON-NLS-1$
- return null;
- } catch (ClassCastException ex) {
- ExceptionHandler.displayMessageDialog(ex, SearchMessages.getString("Search.Error.createSorter.title"), SearchMessages.getString("Search.Error.createSorter.message")); //$NON-NLS-2$ //$NON-NLS-1$
- return null;
- }
- }
-
- //---- XML Attribute accessors ---------------------------------------------
-
- /**
- * Returns the sorter's id.
- */
- public String getId() {
- return fElement.getAttribute(ID_ATTRIBUTE);
- }
-
- /**
- * Returns the sorter's image
- */
- public ImageDescriptor getImage() {
- String imageName= fElement.getAttribute(ICON_ATTRIBUTE);
- if (imageName == null)
- return null;
- URL url;
- try {
- url= new URL(fElement.getDeclaringExtension().getDeclaringPluginDescriptor().getInstallURL(), imageName);
- } catch (java.net.MalformedURLException ex) {
- ExceptionHandler.log(ex, SearchMessages.getString("Search.Error.createSorter.message")); //$NON-NLS-1$
- return null;
- }
- return ImageDescriptor.createFromURL(url);
- }
-
- /**
- * Returns the sorter's label.
- */
- public String getLabel() {
- return fElement.getAttribute(LABEL_ATTRIBUTE);
- }
-
- /**
- * Returns the sorter's preferred size
- */
- public String getToolTipText() {
- return fElement.getAttribute(TOOLTIP_ATTRIBUTE);
- }
-
- /**
- * Returns the sorter's preferred size
- */
- public String getPageId() {
- return fElement.getAttribute(PAGE_ID_ATTRIBUTE);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/WorkingSetComparator.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/WorkingSetComparator.java
deleted file mode 100644
index f660f3cf98e..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/WorkingSetComparator.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.search.internal.ui;
-
-import java.text.Collator;
-import java.util.Comparator;
-
-import org.eclipse.ui.IWorkingSet;
-
-class WorkingSetComparator implements Comparator {
-
- private Collator fCollator= Collator.getInstance();
-
- /*
- * @see Comparator#compare(Object, Object)
- */
- public int compare(Object o1, Object o2) {
- String name1= null;
- String name2= null;
-
- if (o1 instanceof IWorkingSet)
- name1= ((IWorkingSet)o1).getName();
-
- if (o2 instanceof IWorkingSet)
- name2= ((IWorkingSet)o2).getName();
-
- return fCollator.compare(name1, name2);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/GotoMarkerAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/GotoMarkerAction.java
deleted file mode 100644
index 5c7b954e607..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/GotoMarkerAction.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.search.internal.ui.text;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.part.FileEditorInput;
-
-import org.eclipse.search.ui.ISearchResultView;
-import org.eclipse.search.ui.ISearchResultViewEntry;
-import org.eclipse.search.ui.SearchUI;
-
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
-class GotoMarkerAction extends Action {
-
- private IEditorPart fEditor;
-
- public void run() {
- ISearchResultView view= SearchUI.getSearchResultView();
- ISelection selection= view.getSelection();
- Object element= null;
- if (selection instanceof IStructuredSelection)
- element= ((IStructuredSelection)selection).getFirstElement();
- if (element instanceof ISearchResultViewEntry) {
- ISearchResultViewEntry entry= (ISearchResultViewEntry)element;
- show(entry.getSelectedMarker());
- }
- }
-
- private void show(IMarker marker) {
- if (SearchUI.reuseEditor())
- showWithReuse(marker);
- else
- showWithoutReuse(marker);
- }
-
- private void showWithReuse(IMarker marker) {
- IWorkbenchPage page= SearchPlugin.getActivePage();
- IResource resource= marker.getResource();
- if (page == null || !(resource instanceof IFile))
- return;
-
- IEditorInput input= new FileEditorInput((IFile)resource);
- String editorId= null;
- IEditorDescriptor desc= IDE.getDefaultEditor((IFile)resource);
- if (desc == null)
- editorId= SearchPlugin.getDefault().getWorkbench().getEditorRegistry().findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID).getId();
- else
- editorId= desc.getId();
-
- IEditorPart editor= page.findEditor(input);
- if (editor != null)
- page.bringToTop(editor);
- else {
- boolean isOpen= false;
- if (fEditor != null) {
- IEditorReference[] parts= page.getEditorReferences();
- int i= 0;
- while (!isOpen && i < parts.length)
- isOpen= fEditor == parts[i++].getEditor(false);
- }
-
- boolean canBeReused= isOpen && !fEditor.isDirty() && !isPinned(fEditor);
- boolean showsSameInputType= fEditor != null && fEditor.getSite().getId().equals(editorId);
-
- if (canBeReused && !showsSameInputType) {
- page.closeEditor(fEditor, false);
- fEditor= null;
- }
-
- if (canBeReused && showsSameInputType) {
- ((IReusableEditor)fEditor).setInput(input);
- page.bringToTop(fEditor);
- editor= fEditor;
- } else
- try {
- editor= page.openEditor(input, editorId, false);
- if (editor instanceof IReusableEditor)
- fEditor= editor;
- else
- fEditor= null;
- } catch (PartInitException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.openEditor.title"), SearchMessages.getString("Search.Error.openEditor.message")); //$NON-NLS-2$ //$NON-NLS-1$
- return;
- }
- }
-
- if (editor != null) {
- IDE.gotoMarker(editor, marker);
- }
- }
-
- private boolean isPinned(IEditorPart editor) {
- if (editor == null)
- return false;
-
- IEditorReference[] editorRefs= editor.getEditorSite().getPage().getEditorReferences();
- int i= 0;
- while (i < editorRefs.length) {
- if (editor.equals(editorRefs[i].getEditor(false)))
- return editorRefs[i].isPinned();
- i++;
- }
- return false;
- }
-
- private void showWithoutReuse(IMarker marker) {
- IWorkbenchPage page= SearchPlugin.getActivePage();
- if (page == null)
- return;
-
- try {
- IDE.openEditor(page, marker, false);
- } catch (PartInitException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.openEditor.title"), SearchMessages.getString("Search.Error.openEditor.message")); //$NON-NLS-2$ //$NON-NLS-1$
- return;
- }
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/GroupByKeyComputer.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/GroupByKeyComputer.java
deleted file mode 100644
index 61e207ffb3f..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/GroupByKeyComputer.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.search.internal.ui.text;
-
-import org.eclipse.core.resources.IMarker;
-
-import org.eclipse.search.ui.IGroupByKeyComputer;
-
-class GroupByKeyComputer implements IGroupByKeyComputer {
-
- public Object computeGroupByKey(IMarker marker) {
- if (marker == null)
- return null;
- else
- return marker.getResource();
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceAction.java
deleted file mode 100644
index 8bd9767e8d4..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceAction.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
- *******************************************************************************/
-package org.eclipse.search.internal.ui.text;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.search.internal.core.text.ITextSearchResultCollector;
-import org.eclipse.search.internal.ui.Search;
-import org.eclipse.search.internal.ui.SearchManager;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchResultViewEntry;
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-import org.eclipse.search.ui.SearchUI;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/* package */ class ReplaceAction extends Action {
-
- private IWorkbenchSite fSite;
- private List fElements;
-
- public ReplaceAction(IWorkbenchSite site, List elements) {
- Assert.isNotNull(site);
- fSite= site;
- if (elements != null)
- fElements= elements;
- else
- fElements= new ArrayList(0);
- setText(SearchMessages.getString("ReplaceAction.label_all")); //$NON-NLS-1$
- setEnabled(!fElements.isEmpty());
- }
-
- public ReplaceAction(IWorkbenchSite site, IStructuredSelection selection) {
- Assert.isNotNull(site);
- fSite= site;
- setText(SearchMessages.getString("ReplaceAction.label_selected")); //$NON-NLS-1$
- fElements= selection.toList();
- setEnabled(!fElements.isEmpty());
- }
-
- public void run() {
- Search search= SearchManager.getDefault().getCurrentSearch();
- IRunnableWithProgress operation= search.getOperation();
- if (operation instanceof TextSearchOperation) {
- if (validateResources((TextSearchOperation) operation)) {
- ReplaceDialog dialog= new ReplaceDialog(fSite.getShell(), fElements, (TextSearchOperation)operation);
- dialog.open();
- }
- } else {
- MessageDialog.openError(fSite.getShell(), getDialogTitle(), SearchMessages.getString("ReplaceAction.error.only_on_text_search")); //$NON-NLS-1$
- }
- }
-
- private boolean validateResources(final TextSearchOperation operation) {
- final List outOfDateEntries= new ArrayList();
- for (Iterator elements = fElements.iterator(); elements.hasNext();) {
- SearchResultViewEntry entry = (SearchResultViewEntry) elements.next();
- if (isOutOfDate(entry)) {
- outOfDateEntries.add(entry);
- }
- }
-
- final List outOfSyncEntries= new ArrayList();
- for (Iterator elements = fElements.iterator(); elements.hasNext();) {
- SearchResultViewEntry entry = (SearchResultViewEntry) elements.next();
- if (isOutOfSync(entry)) {
- outOfSyncEntries.add(entry);
- }
- }
-
- if (outOfDateEntries.size() > 0 || outOfSyncEntries.size() > 0) {
- if (askForResearch(outOfDateEntries, outOfSyncEntries)) {
- ProgressMonitorDialog pmd= new ProgressMonitorDialog(fSite.getShell());
- try {
- pmd.run(true, true, new WorkspaceModifyOperation(null) {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- research(monitor, outOfDateEntries, operation);
- }
- });
- return true;
- } catch (InvocationTargetException e) {
- ExceptionHandler.handle(e, fSite.getShell(), SearchMessages.getString("ReplaceAction.label"), SearchMessages.getString("ReplaceAction.research.error")); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (InterruptedException e) {
- // canceled
- }
- }
- return false;
- }
- return true;
- }
-
- private void research(IProgressMonitor monitor, List outOfDateEntries, TextSearchOperation operation) throws CoreException {
- IStatus status= null;
- for (Iterator elements = outOfDateEntries.iterator(); elements.hasNext();) {
- SearchResultViewEntry entry = (SearchResultViewEntry) elements.next();
- status = research(operation, monitor, entry);
- if (status != null && !status.isOK()) {
- throw new CoreException(status);
- }
- }
- }
-
- private boolean askForResearch(List outOfDateEntries, List outOfSyncEntries) {
- SearchAgainConfirmationDialog dialog= new SearchAgainConfirmationDialog(fSite.getShell(), outOfSyncEntries, outOfDateEntries);
- return dialog.open() == IDialogConstants.OK_ID;
- }
-
- private String getDialogTitle() {
- return SearchMessages.getString("ReplaceAction.dialog.title"); //$NON-NLS-1$
- }
-
- private boolean isOutOfDate(SearchResultViewEntry entry) {
- IResource resource= entry.getResource();
- if (entry.getModificationStamp() != resource.getModificationStamp())
- return true;
- ITextFileBufferManager bm= FileBuffers.getTextFileBufferManager();
- ITextFileBuffer fb= bm.getTextFileBuffer(resource.getFullPath());
- if (fb != null && fb.isDirty())
- return true;
- return false;
- }
-
- private boolean isOutOfSync(SearchResultViewEntry entry) {
- return !entry.getResource().isSynchronized(IResource.DEPTH_ZERO);
- }
-
- private IStatus research(TextSearchOperation operation, final IProgressMonitor monitor, SearchResultViewEntry entry) throws CoreException {
- List markers= new ArrayList();
- markers.addAll(entry.getMarkers());
- operation.searchInFile((IFile) entry.getResource(), new ITextSearchResultCollector() {
- public IProgressMonitor getProgressMonitor() {
- return monitor;
- }
-
- public void aboutToStart() {
- }
-
- public void accept(IResourceProxy proxy, String line, int start, int length, int lineNumber) throws CoreException {
- IFile file= (IFile)proxy.requestResource();
- if (start < 0 || length < 1)
- return;
- IMarker marker= file.createMarker(SearchUI.SEARCH_MARKER);
- HashMap attributes= new HashMap(4);
- attributes.put(SearchUI.LINE, line);
- attributes.put(IMarker.CHAR_START, new Integer(start));
- attributes.put(IMarker.CHAR_END, new Integer(start + length));
- attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber));
- marker.setAttributes(attributes);
- }
-
- public void done(){
- }
- });
- IStatus status = operation.getStatus();
- if (status == null || status.isOK()) {
- for (Iterator markerIter = markers.iterator(); markerIter.hasNext();) {
- IMarker marker = (IMarker) markerIter.next();
- marker.delete();
- }
- }
- return status;
- }
-
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceDialog.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceDialog.java
deleted file mode 100644
index a967c507880..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceDialog.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.search.internal.ui.text;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.internal.ui.SearchResultView;
-import org.eclipse.search.internal.ui.SearchResultViewEntry;
-import org.eclipse.search.internal.ui.SearchResultViewer;
-import org.eclipse.search.internal.ui.util.ExtendedDialogWindow;
-import org.eclipse.search.ui.SearchUI;
-import org.eclipse.swt.SWT;
-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.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.MarkerUtilities;
-
-class ReplaceDialog extends ExtendedDialogWindow {
-
- /**
- * A class wrapping a resource marker, adding a position.
- */
- private static class ReplaceMarker {
- private Position fPosition;
- private IMarker fMarker;
-
- ReplaceMarker(IMarker marker) {
- fMarker= marker;
- }
-
- public IFile getFile() {
- return (IFile)fMarker.getResource();
- }
-
- public void deletePosition(IDocument doc) {
- if (fPosition != null) {
- MarkerUtilities.setCharStart(fMarker, fPosition.getOffset());
- MarkerUtilities.setCharEnd(fMarker, fPosition.getOffset()+fPosition.getLength());
- doc.removePosition(fPosition);
- fPosition= null;
- }
- }
-
- public void delete() throws CoreException {
- fMarker.delete();
- }
-
- public void createPosition(IDocument doc) throws BadLocationException {
- if (fPosition == null) {
- int charStart= MarkerUtilities.getCharStart(fMarker);
- fPosition= new Position(charStart, MarkerUtilities.getCharEnd(fMarker)-charStart);
- doc.addPosition(fPosition);
- }
- }
-
- public int getLength() {
- if (fPosition != null)
- return fPosition.getLength();
- return MarkerUtilities.getCharEnd(fMarker)-MarkerUtilities.getCharStart(fMarker);
- }
-
- public int getOffset() {
- if (fPosition != null)
- return fPosition.getOffset();
- return MarkerUtilities.getCharStart(fMarker);
- }
- }
-
- private abstract static class ReplaceOperation extends WorkspaceModifyOperation {
- public void execute(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- doReplace(monitor);
- } catch (BadLocationException e) {
- throw new InvocationTargetException(e);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } catch (IOException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- protected abstract void doReplace(IProgressMonitor pm) throws BadLocationException, CoreException, IOException;
- }
-
- // various widget related constants
- private static final int REPLACE= IDialogConstants.CLIENT_ID + 1;
- private static final int REPLACE_ALL_IN_FILE= IDialogConstants.CLIENT_ID + 2;
- private static final int REPLACE_ALL= IDialogConstants.CLIENT_ID + 3;
- private static final int SKIP= IDialogConstants.CLIENT_ID + 4;
- private static final int SKIP_FILE= IDialogConstants.CLIENT_ID + 5;
- private static final int SKIP_ALL= IDialogConstants.CLIENT_ID + 6;
-
- // Widgets
- private Text fTextField;
- private Button fReplaceButton;
- private Button fReplaceAllInFileButton;
- private Button fReplaceAllButton;
- private Button fSkipButton;
- private Button fSkipFileButton;
-
- private List fMarkers;
- private TextSearchOperation fOperation;
- private boolean fSkipReadonly= false;
-
- // reuse editors stuff
- private IReusableEditor fEditor;
-
- protected ReplaceDialog(Shell parentShell, List entries, TextSearchOperation operation) {
- super(parentShell);
- Assert.isNotNull(entries);
- Assert.isNotNull(operation);
- fMarkers= new ArrayList();
- initializeMarkers(entries);
- fOperation= operation;
- }
-
- private void initializeMarkers(List entries) {
- for (Iterator elements= entries.iterator(); elements.hasNext(); ) {
- SearchResultViewEntry element= (SearchResultViewEntry)elements.next();
- List markerList= element.getMarkers();
- for (Iterator markers= markerList.iterator(); markers.hasNext(); ) {
- IMarker marker= (IMarker)markers.next();
- fMarkers.add(new ReplaceMarker(marker));
- }
- }
- }
-
- // widget related stuff -----------------------------------------------------------
- public void create() {
- super.create();
- Shell shell= getShell();
- shell.setText(getDialogTitle());
- gotoCurrentMarker();
- enableButtons();
- }
-
- protected Control createPageArea(Composite parent) {
- Composite result= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- result.setLayout(layout);
- layout.numColumns= 2;
-
- layout.marginHeight =
- convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth =
- convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing =
- convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing =
- convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
-
- initializeDialogUnits(result);
-
- Label label= new Label(result, SWT.NONE);
- label.setText(SearchMessages.getString("ReplaceDialog.replace_label")); //$NON-NLS-1$
- Text clabel= new Text(result, SWT.BORDER);
- clabel.setEnabled(false);
- clabel.setText(fOperation.getPattern());
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint= convertWidthInCharsToPixels(50);
- clabel.setLayoutData(gd);
-
-
- label= new Label(result, SWT.NONE);
- label.setText(SearchMessages.getString("ReplaceDialog.with_label")); //$NON-NLS-1$
- fTextField= new Text(result, SWT.BORDER);
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint= convertWidthInCharsToPixels(50);
- fTextField.setLayoutData(gd);
- fTextField.setFocus();
-
-
- new Label(result, SWT.NONE);
- Button replaceWithRegex= new Button(result, SWT.CHECK);
- replaceWithRegex.setText(SearchMessages.getString("ReplaceDialog.isRegex.label")); //$NON-NLS-1$
- replaceWithRegex.setEnabled(false);
- replaceWithRegex.setSelection(false);
-
- applyDialogFont(result);
- return result;
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- fReplaceButton= createButton(parent, REPLACE, SearchMessages.getString("ReplaceDialog.replace"), true); //$NON-NLS-1$
- fReplaceAllInFileButton= createButton(parent, REPLACE_ALL_IN_FILE, SearchMessages.getString("ReplaceDialog.replaceAllInFile"), false); //$NON-NLS-1$
-
- Label filler= new Label(parent, SWT.NONE);
- filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
-
- fReplaceAllButton= createButton(parent, REPLACE_ALL, SearchMessages.getString("ReplaceDialog.replaceAll"), false); //$NON-NLS-1$
- fSkipButton= createButton(parent, SKIP, SearchMessages.getString("ReplaceDialog.skip"), false); //$NON-NLS-1$
- fSkipFileButton= createButton(parent, SKIP_FILE, SearchMessages.getString("ReplaceDialog.skipFile"), false); //$NON-NLS-1$
-
- filler= new Label(parent, SWT.NONE);
- filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- super.createButtonsForButtonBar(parent);
- ((GridLayout)parent.getLayout()).numColumns= 4;
- }
-
- protected Point getInitialLocation(Point initialSize) {
- SearchResultView view= (SearchResultView)SearchPlugin.getSearchResultView();
- if (view == null)
- return super.getInitialLocation(initialSize);
- Point result= new Point(0, 0);
- Control control= view.getViewer().getControl();
- Point size= control.getSize();
- Point location= control.toDisplay(control.getLocation());
- result.x= Math.max(0, location.x + size.x - initialSize.x);
- result.y= Math.max(0, location.y + size.y - initialSize.y);
- return result;
- }
-
- private void enableButtons() {
- fSkipButton.setEnabled(hasNextMarker());
- fSkipFileButton.setEnabled(hasNextFile());
- fReplaceButton.setEnabled(canReplace());
- fReplaceAllInFileButton.setEnabled(canReplace());
- fReplaceAllButton.setEnabled(canReplace());
- }
-
- protected void buttonPressed(int buttonId) {
- final String replaceText= fTextField.getText();
- try {
- switch (buttonId) {
- case SKIP :
- skip();
- break;
- case SKIP_FILE :
- skipFile();
- break;
- case REPLACE :
- run(false, true, new ReplaceOperation() {
- protected void doReplace(IProgressMonitor pm) throws BadLocationException, CoreException {
- replace(pm, replaceText);
- }
- });
- if (hasNextMarker())
- gotoCurrentMarker();
- break;
- case REPLACE_ALL_IN_FILE :
- run(false, true, new ReplaceOperation() {
- protected void doReplace(IProgressMonitor pm) throws BadLocationException, CoreException {
- replaceInFile(pm, replaceText);
-
- }
- });
- if (hasNextFile())
- gotoCurrentMarker();
- break;
- case REPLACE_ALL :
- run(false, true, new ReplaceOperation() {
- protected void doReplace(IProgressMonitor pm) throws BadLocationException, CoreException {
- replaceAll(pm, replaceText);
- }
- });
- if (hasNextFile())
- gotoCurrentMarker();
- break;
- default :
- {
- super.buttonPressed(buttonId);
- return;
- }
- }
- } catch (InvocationTargetException e) {
- SearchPlugin.log(e);
- String message= SearchMessages.getFormattedString("ReplaceDialog.error.unable_to_replace", getCurrentMarker().getFile().getName()); //$NON-NLS-1$
- MessageDialog.openError(getParentShell(), getDialogTitle(), message);
- } catch (InterruptedException e) {
- // means operation canceled
- }
- if (!hasNextMarker() && !hasNextFile() && !canReplace())
- close();
- else {
- enableButtons();
- }
- }
-
- private ReplaceMarker getCurrentMarker() {
- return (ReplaceMarker)fMarkers.get(0);
- }
-
- private void replace(IProgressMonitor pm, String replacementText) throws BadLocationException, CoreException {
- ReplaceMarker marker= getCurrentMarker();
- pm.beginTask(SearchMessages.getString("ReplaceDialog.task.replace"), 10); //$NON-NLS-1$
- replaceInFile(pm, marker.getFile(), replacementText, new ReplaceMarker[]{marker});
- }
-
- private void replaceInFile(IProgressMonitor pm, String replacementText) throws BadLocationException, CoreException {
- ReplaceMarker firstMarker= getCurrentMarker();
- ReplaceMarker[] markers= collectMarkers(firstMarker.getFile());
- pm.beginTask(SearchMessages.getFormattedString("ReplaceDialog.task.replaceInFile", firstMarker.getFile().getFullPath().toOSString()), 4); //$NON-NLS-1$
- replaceInFile(pm, firstMarker.getFile(), replacementText, markers);
- }
-
- private void replaceAll(IProgressMonitor pm, String replacementText) throws BadLocationException, CoreException {
- int resourceCount= countResources();
- pm.beginTask(SearchMessages.getString("ReplaceDialog.task.replace.replaceAll"), resourceCount); //$NON-NLS-1$
- while (fMarkers.size() > 0) {
- replaceInFile(new SubProgressMonitor(pm, 1, 0), replacementText);
- }
- pm.done();
- }
-
- private void replaceInFile(final IProgressMonitor pm, final IFile file, final String replacementText, final ReplaceMarker[] markers) throws BadLocationException, CoreException {
- if (pm.isCanceled())
- throw new OperationCanceledException();
- doReplaceInFile(pm, file, replacementText, markers);
- }
-
- private void doReplaceInFile(IProgressMonitor pm, IFile file, String replacementText, final ReplaceMarker[] markers) throws BadLocationException, CoreException {
- try {
- if (file.isReadOnly()) {
- file.getWorkspace().validateEdit(new IFile[]{file}, null);
- }
- if (file.isReadOnly()) {
- if (fSkipReadonly) {
- skipFile();
- return;
- }
- int rc= askForSkip(file);
- switch (rc) {
- case CANCEL :
- throw new OperationCanceledException();
- case SKIP_FILE :
- skipFile();
- return;
- case SKIP_ALL :
- fSkipReadonly= true;
- skipFile();
- return;
- }
- }
- ITextFileBufferManager bm= FileBuffers.getTextFileBufferManager();
- try {
- bm.connect(file.getFullPath(), new SubProgressMonitor(pm, 1));
- ITextFileBuffer fb= bm.getTextFileBuffer(file.getFullPath());
- boolean wasDirty= fb.isDirty();
- IDocument doc= fb.getDocument();
- try {
- createPositionsInFile(file, doc);
- for (int i= 0; i < markers.length; i++) {
- doc.replace(markers[i].getOffset(), markers[i].getLength(), replacementText);
- fMarkers.remove(0);
- markers[i].delete();
- }
- } finally {
- removePositonsInFile(file, doc);
- }
- if (!wasDirty)
- fb.commit(new SubProgressMonitor(pm, 1), true);
- } finally {
- bm.disconnect(file.getFullPath(), new SubProgressMonitor(pm, 1));
- }
- } finally {
- pm.done();
- }
- }
-
- private void removePositonsInFile(IFile file, IDocument doc) {
- for (Iterator markers= fMarkers.iterator(); markers.hasNext(); ) {
- ReplaceMarker marker= (ReplaceMarker)markers.next();
- if (!marker.getFile().equals(file))
- return;
- marker.deletePosition(doc);
- }
- }
-
- private void createPositionsInFile(IFile file, IDocument doc) throws BadLocationException {
- for (Iterator markers= fMarkers.iterator(); markers.hasNext(); ) {
- ReplaceMarker marker= (ReplaceMarker)markers.next();
- if (!marker.getFile().equals(file))
- return;
- marker.createPosition(doc);
- }
- }
-
- private int askForSkip(final IFile file) {
-
- String message= SearchMessages.getFormattedString("ReadOnlyDialog.message", file.getFullPath().toOSString()); //$NON-NLS-1$
- String[] buttonLabels= null;
- boolean showSkip= countResources() > 1;
- if (showSkip) {
- String skipLabel= SearchMessages.getString("ReadOnlyDialog.skipFile"); //$NON-NLS-1$
- String skipAllLabel= SearchMessages.getString("ReadOnlyDialog.skipAll"); //$NON-NLS-1$
- buttonLabels= new String[]{skipLabel, skipAllLabel, IDialogConstants.CANCEL_LABEL};
- } else {
- buttonLabels= new String[]{IDialogConstants.CANCEL_LABEL};
-
- }
-
- MessageDialog msd= new MessageDialog(getShell(), getShell().getText(), null, message, MessageDialog.ERROR, buttonLabels, 0);
- int rc= msd.open();
- switch (rc) {
- case 0 :
- return showSkip ? SKIP_FILE : CANCEL;
- case 1 :
- return SKIP_ALL;
- default :
- return CANCEL;
- }
- }
-
- private String getDialogTitle() {
- return SearchMessages.getString("ReplaceDialog.dialog.title"); //$NON-NLS-1$
- }
-
- private void skip() {
- fMarkers.remove(0);
- Assert.isTrue(fMarkers.size() > 0);
- gotoCurrentMarker();
- }
-
- private void skipFile() {
- ReplaceMarker currentMarker= getCurrentMarker();
- if (currentMarker == null)
- return;
- IResource currentFile= currentMarker.getFile();
- while (fMarkers.size() > 0 && getCurrentMarker().getFile().equals(currentFile))
- fMarkers.remove(0);
- if (fMarkers.size() > 0)
- gotoCurrentMarker();
- }
-
- private void gotoCurrentMarker() {
- if (fMarkers.size() > 0) {
- ReplaceMarker marker= getCurrentMarker();
- Control focusControl= getShell().getDisplay().getFocusControl();
- try {
- selectEntry(marker);
- ITextEditor editor= null;
- if (SearchUI.reuseEditor())
- editor= openEditorReuse(marker);
- else
- editor= openEditorNoReuse(marker);
- editor.selectAndReveal(marker.getOffset(), marker.getLength());
- if (focusControl != null && !focusControl.isDisposed())
- focusControl.setFocus();
- } catch (PartInitException e) {
- String message= SearchMessages.getFormattedString("ReplaceDialog.error.unable_to_open_text_editor", marker.getFile().getName()); //$NON-NLS-1$
- MessageDialog.openError(getParentShell(), getDialogTitle(), message);
- }
- }
- }
-
- private void selectEntry(ReplaceMarker marker) {
- SearchResultView view= (SearchResultView) SearchPlugin.getSearchResultView();
- if (view == null)
- return;
- SearchResultViewer viewer= view.getViewer();
- if (viewer == null)
- return;
- ISelection sel= viewer.getSelection();
- if (!(sel instanceof IStructuredSelection))
- return;
- IStructuredSelection ss= (IStructuredSelection) sel;
- IFile file= marker.getFile();
- if (ss.size() == 1 && file.equals(ss.getFirstElement()))
- return;
- Table table= viewer.getTable();
- if (table == null || table.isDisposed())
- return;
- int selectionIndex= table.getSelectionIndex();
- if (selectionIndex < 0)
- selectionIndex= 0;
- for (int i= 0; i < table.getItemCount(); i++) {
- int currentTableIndex= (selectionIndex+i) % table.getItemCount();
- SearchResultViewEntry entry= (SearchResultViewEntry) viewer.getElementAt(currentTableIndex);
- if (file.equals(entry.getGroupByKey())) {
- viewer.setSelection(new StructuredSelection(entry));
- return;
- }
- }
- }
-
- // opening editors ------------------------------------------
- private ITextEditor openEditorNoReuse(ReplaceMarker marker) throws PartInitException {
- IFile file= marker.getFile();
- IWorkbenchPage activePage= SearchPlugin.getActivePage();
- if (activePage == null)
- return null;
- ITextEditor textEditor= showOpenTextEditor(activePage, file);
- if (textEditor != null)
- return textEditor;
- return openNewTextEditor(file, activePage);
- }
-
- private ITextEditor openNewTextEditor(IFile file, IWorkbenchPage activePage) throws PartInitException {
- IEditorDescriptor desc= IDE.getDefaultEditor(file);
- if (desc != null) {
- String editorID= desc.getId();
- IEditorPart editor;
- if (desc.isInternal()) {
- editor= activePage.openEditor(new FileEditorInput(file), editorID);
- if (editor instanceof ITextEditor) {
- if (editor instanceof IReusableEditor)
- fEditor= (IReusableEditor) editor;
- return (ITextEditor)editor;
- } else
- activePage.closeEditor(editor, false);
- }
- }
- IEditorPart editor= activePage.openEditor(new FileEditorInput(file), "org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
- return (ITextEditor)editor;
- }
-
- private ITextEditor openEditorReuse(ReplaceMarker marker) throws PartInitException {
- IWorkbenchPage page= SearchPlugin.getActivePage();
- IFile file= marker.getFile();
- if (page == null)
- return null;
-
- ITextEditor textEditor= showOpenTextEditor(page, file);
- if (textEditor != null)
- return textEditor;
-
- String editorId= null;
- IEditorDescriptor desc= IDE.getDefaultEditor(file);
- if (desc != null && desc.isInternal())
- editorId= desc.getId();
-
- boolean isOpen= isEditorOpen(page, fEditor);
-
- boolean canBeReused= isOpen && !fEditor.isDirty() && !isPinned(fEditor);
- boolean showsSameInputType= fEditor != null && (editorId == null || fEditor.getSite().getId().equals(editorId));
-
- if (canBeReused) {
- if (showsSameInputType) {
- fEditor.setInput(new FileEditorInput(file));
- page.bringToTop(fEditor);
- return (ITextEditor) fEditor;
- } else {
- page.closeEditor(fEditor, false);
- fEditor= null;
- }
- }
- return openNewTextEditor(file, page);
- }
-
- private boolean isEditorOpen(IWorkbenchPage page, IEditorPart editor) {
- if (editor != null) {
- IEditorReference[] parts= page.getEditorReferences();
- int i= 0;
- for (int j = 0; j < parts.length; j++) {
- if (editor == parts[i++].getEditor(false))
- return true;
- }
- }
- return false;
- }
-
- private ITextEditor showOpenTextEditor(IWorkbenchPage page, IFile file) {
- IEditorPart editor= page.findEditor(new FileEditorInput(file));
- if (editor instanceof ITextEditor) {
- page.bringToTop(editor);
- return (ITextEditor) editor;
- }
- return null;
- }
-
- private boolean isPinned(IEditorPart editor) {
- if (editor == null)
- return false;
-
- IEditorReference[] editorRefs= editor.getEditorSite().getPage().getEditorReferences();
- int i= 0;
- while (i < editorRefs.length) {
- if (editor.equals(editorRefs[i].getEditor(false)))
- return editorRefs[i].isPinned();
- i++;
- }
- return false;
- }
-
- // resource related -------------------------------------------------------------
- /**
- * @return the number of resources referred to in fMarkers
- */
- private int countResources() {
- IResource r= null;
- int count= 0;
- for (Iterator elements= fMarkers.iterator(); elements.hasNext(); ) {
- ReplaceMarker element= (ReplaceMarker)elements.next();
- if (!element.getFile().equals(r)) {
- count++;
- r= element.getFile();
- }
- }
- return count;
- }
-
- private ReplaceMarker[] collectMarkers(IResource resource) {
- List matching= new ArrayList();
- for (int i= 0; i < fMarkers.size(); i++) {
- ReplaceMarker marker= (ReplaceMarker)fMarkers.get(i);
- if (!marker.getFile().equals(resource))
- break;
- matching.add(marker);
- }
- ReplaceMarker[] markers= new ReplaceMarker[matching.size()];
- return (ReplaceMarker[])matching.toArray(markers);
- }
-
-
- // some queries -------------------------------------------------------------
- private boolean hasNextMarker() {
- return fMarkers.size() > 1;
- }
-
- private boolean hasNextFile() {
- if (!hasNextMarker())
- return false;
- IResource currentFile= getCurrentMarker().getFile();
- for (int i= 0; i < fMarkers.size(); i++) {
- if (!((ReplaceMarker)fMarkers.get(i)).getFile().equals(currentFile))
- return true;
- }
- return false;
- }
-
- private boolean canReplace() {
- return fMarkers.size() > 0;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ResourcePathSorter.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ResourcePathSorter.java
deleted file mode 100644
index 591a085d8cb..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ResourcePathSorter.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.search.internal.ui.text;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-import org.eclipse.search.internal.ui.util.FileLabelProvider;
-import org.eclipse.search.ui.ISearchResultView;
-import org.eclipse.search.ui.ISearchResultViewEntry;
-import org.eclipse.search.ui.SearchUI;
-
-/**
- * Sorts the search result viewer by the resource path.
- */
-public class ResourcePathSorter extends ViewerSorter {
-
- /*
- * Overrides method from ViewerSorter
- */
- public int compare(Viewer viewer, Object e1, Object e2) {
- String name1= null;
- String name2= null;
-
- if (e1 instanceof ISearchResultViewEntry)
- name1= ((ISearchResultViewEntry)e1).getResource().getFullPath().toString();
- if (e2 instanceof ISearchResultViewEntry)
- name2= ((ISearchResultViewEntry)e2).getResource().getFullPath().toString();
- if (name1 == null)
- name1= ""; //$NON-NLS-1$
- if (name2 == null)
- name2= ""; //$NON-NLS-1$
- return getCollator().compare(name1, name2);
- }
-
- /*
- * Overrides method from ViewerSorter
- */
- public boolean isSorterProperty(Object element, String property) {
- return true;
- }
-
- /*
- * Overrides method from ViewerSorter
- */
- public void sort(Viewer viewer, Object[] elements) {
- // Set label provider to show "resource - path"
- ISearchResultView view= SearchUI.getSearchResultView();
- if (view != null) {
- ILabelProvider labelProvider= view.getLabelProvider();
- if (labelProvider instanceof FileLabelProvider)
- ((FileLabelProvider)labelProvider).setOrder(FileLabelProvider.SHOW_PATH_LABEL);
- }
- super.sort(viewer, elements);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ResourcenameSorter.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ResourcenameSorter.java
deleted file mode 100644
index 333f8c2288e..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ResourcenameSorter.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.search.internal.ui.text;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-import org.eclipse.search.internal.ui.util.FileLabelProvider;
-import org.eclipse.search.ui.ISearchResultView;
-import org.eclipse.search.ui.ISearchResultViewEntry;
-import org.eclipse.search.ui.SearchUI;
-
-/**
- * Sorts the search result viewer by the resource name.
- */
-public class ResourcenameSorter extends ViewerSorter {
-
- /*
- * Overrides method from ViewerSorter
- */
- public int compare(Viewer viewer, Object e1, Object e2) {
- String name1= null;
- String name2= null;
-
- if (e1 instanceof ISearchResultViewEntry)
- name1= ((ISearchResultViewEntry)e1).getResource().getName();
- if (e2 instanceof ISearchResultViewEntry)
- name2= ((ISearchResultViewEntry)e2).getResource().getName();
- if (name1 == null)
- name1= ""; //$NON-NLS-1$
- if (name2 == null)
- name2= ""; //$NON-NLS-1$
- return getCollator().compare(name1, name2);
- }
-
- /*
- * Overrides method from ViewerSorter
- */
- public boolean isSorterProperty(Object element, String property) {
- return true;
- }
-
- /*
- * Overrides method from ViewerSorter
- */
- public void sort(Viewer viewer, Object[] elements) {
- // Set label provider to show "resource - path"
- ISearchResultView view= SearchUI.getSearchResultView();
- if (view != null) {
- ILabelProvider labelProvider= view.getLabelProvider();
- if (labelProvider instanceof FileLabelProvider)
- ((FileLabelProvider)labelProvider).setOrder(FileLabelProvider.SHOW_LABEL_PATH);
- }
- super.sort(viewer, elements);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/SearchAgainConfirmationDialog.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/SearchAgainConfirmationDialog.java
deleted file mode 100644
index 543c6bb7874..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/SearchAgainConfirmationDialog.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.search.internal.ui.text;
-
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.internal.ui.SearchResultView;
-import org.eclipse.search.internal.ui.util.ListContentProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-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;
-
-/**
- * Dialog telling the user that files are out of sync or matches
- * are stale and asks for confirmation to refresh/search again
- * @since 3.0
- */
-
-public class SearchAgainConfirmationDialog extends Dialog {
- private List fOutOfSync;
- private List fOutOfDate;
-
- private static class ProxyLabelProvider extends LabelProvider {
- private ILabelProvider fLabelProvider;
-
- ProxyLabelProvider() {
- SearchResultView view= (SearchResultView) SearchPlugin.getSearchResultView();
- if (view != null)
- fLabelProvider= view.getLabelProvider();
- else
- fLabelProvider= null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- if (fLabelProvider != null)
- return fLabelProvider.getImage(element);
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- if (fLabelProvider != null)
- return fLabelProvider.getText(element);
- return null;
- }
-
- }
-
- SearchAgainConfirmationDialog(Shell shell, List outOfSync, List outOfDate) {
- super(shell);
- fOutOfSync= outOfSync;
- fOutOfDate= outOfDate;
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Composite result= (Composite) super.createDialogArea(parent);
-
- if (fOutOfSync.size() > 0) {
- createLabel(result, SearchMessages.getString("SearchAgainConfirmationDialog.outofsync.message")); //$NON-NLS-1$
-
- createLabel(result, SearchMessages.getString("SearchAgainConfirmationDialog.outofsync.label")); //$NON-NLS-1$
- createTableViewer(fOutOfSync, result);
- } else {
- createLabel(result, SearchMessages.getString("SearchAgainConfirmationDialog.stale.message")); //$NON-NLS-1$
- }
-
- createLabel(result, SearchMessages.getString("SearchAgainConfirmationDialog.stale.label")); //$NON-NLS-1$
- createTableViewer(fOutOfDate, result);
- return result;
- }
-
- private void createLabel(Composite parent, String text) {
- Label message= new Label(parent, SWT.WRAP);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint= convertWidthInCharsToPixels(40);
- message.setLayoutData(gd);
- message.setText(text);
- }
-
- private TableViewer createTableViewer(List input, Composite result) {
- TableViewer viewer= new TableViewer(result);
- viewer.setContentProvider(new ListContentProvider());
- viewer.setLabelProvider(new ProxyLabelProvider());
- viewer.setInput(input);
- GridData gd= new GridData(GridData.FILL_BOTH);
- gd.widthHint= convertWidthInCharsToPixels(40);
- gd.heightHint= convertHeightInCharsToPixels(5);
- viewer.getControl().setLayoutData(gd);
- return viewer;
- }
-
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(SearchMessages.getString("SearchAgainConfirmationDialog.title")); //$NON-NLS-1$
- }
-
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchActionGroup.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchActionGroup.java
deleted file mode 100644
index 44418875b0a..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchActionGroup.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui.text;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.search.internal.ui.SearchManager;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.internal.ui.SearchResultView;
-import org.eclipse.search.internal.ui.SearchResultViewer;
-import org.eclipse.search.ui.IContextMenuConstants;
-import org.eclipse.search.ui.ISearchResultView;
-import org.eclipse.search.ui.ISearchResultViewEntry;
-import org.eclipse.search.ui.SearchUI;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.actions.OpenWithMenu;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-
-/**
- * Action group that adds the Text search actions to a context menu and
- * the global menu bar.
- *
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- *
- * @since 2.1
- */
-class TextSearchActionGroup extends ActionGroup {
-
- private ISelectionProvider fSelectionProvider;
- private IWorkbenchPage fPage;
- private PropertyDialogAction fOpenPropertiesDialog;
-
- public TextSearchActionGroup(IViewPart part) {
- Assert.isNotNull(part);
- IWorkbenchPartSite site= part.getSite();
- fSelectionProvider= site.getSelectionProvider();
- fPage= site.getPage();
- fOpenPropertiesDialog= new PropertyDialogAction(site.getShell(), fSelectionProvider);
-
- ISelection selection= fSelectionProvider.getSelection();
-
- if (selection instanceof IStructuredSelection)
- fOpenPropertiesDialog.selectionChanged((IStructuredSelection)selection);
- else
- fOpenPropertiesDialog.selectionChanged(selection);
- }
-
- public void fillContextMenu(IMenuManager menu) {
- if (!isTextSearch())
- return;
-
- // view must exist if we create a context menu for it.
- ISearchResultView view= SearchUI.getSearchResultView();
- IStructuredSelection selection= null;
- if (getContext().getSelection() instanceof IStructuredSelection)
- selection= (IStructuredSelection)getContext().getSelection();
- else
- selection= StructuredSelection.EMPTY;
-
- addOpenWithMenu(menu, selection);
-
- ReplaceAction replaceAll= new ReplaceAction(view.getSite(), getSearchResultEntries());
- if (replaceAll.isEnabled())
- menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceAll);
- ReplaceAction replaceSelected= new ReplaceAction(view.getSite(), selection);
- if (replaceSelected.isEnabled())
- menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceSelected);
-
- if (fOpenPropertiesDialog != null && fOpenPropertiesDialog.isEnabled() && selection != null &&fOpenPropertiesDialog.isApplicableForSelection(selection))
- menu.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, fOpenPropertiesDialog);
- }
-
- private List getSearchResultEntries() {
- SearchResultView view= (SearchResultView) SearchPlugin.getSearchResultView();
- // we can assume we have a view, how else would we be called?
- SearchResultViewer viewer= view.getViewer();
- Table table= viewer.getTable();
- TableItem[] items= table.getItems();
- List elements = new ArrayList(items.length);
- for (int i = 0; i < items.length; i++) {
- elements.add(items[i].getData());
- }
- return elements;
- }
-
- private boolean isTextSearch() {
- IRunnableWithProgress operation= SearchManager.getDefault().getCurrentSearch().getOperation();
- if (operation instanceof TextSearchOperation) {
- String pattern= ((TextSearchOperation)operation).getPattern();
- return pattern != null && pattern.length() > 0;
- }
- return false;
- }
-
- private void addOpenWithMenu(IMenuManager menu, IStructuredSelection selection) {
- if (selection == null || selection.size() != 1)
- return;
-
- Object o= selection.getFirstElement();
- if (!(o instanceof ISearchResultViewEntry))
- return;
-
- Object resource= ((ISearchResultViewEntry)o).getResource();
- if (!(resource instanceof IFile))
- return;
-
- // Create menu
- IMenuManager submenu= new MenuManager(SearchMessages.getString("OpenWithMenu.label")); //$NON-NLS-1$
- submenu.add(new OpenWithMenu(fPage, (IFile)resource));
-
- // Add the submenu.
- menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
- }
-
- /* (non-Javadoc)
- * Method declared in ActionGroup
- */
- public void fillActionBars(IActionBars actionBar) {
- super.fillActionBars(actionBar);
- setGlobalActionHandlers(actionBar);
- }
-
- private void setGlobalActionHandlers(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), fOpenPropertiesDialog);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchOperation.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchOperation.java
deleted file mode 100644
index 5500c99e8a1..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchOperation.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.search.internal.ui.text;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.search.internal.core.ISearchScope;
-import org.eclipse.search.internal.core.text.ITextSearchResultCollector;
-import org.eclipse.search.internal.core.text.MatchLocator;
-import org.eclipse.search.internal.core.text.TextSearchEngine;
-import org.eclipse.search.internal.core.text.TextSearchScope;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchPluginImages;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * An operation to perform a regular text search.
- */
-public class TextSearchOperation extends WorkspaceModifyOperation {
-
- public static final int NO_PRIORITY_CHANGE= -1;
-
- private IWorkspace fWorkspace;
- private MatchLocator fMatchLocator;
- private ISearchScope fScope;
- private TextSearchResultCollector fCollector;
- private IStatus fStatus;
-
- /**
- * Creates a new text search operation.
- */
- public TextSearchOperation(IWorkspace workspace, String pattern, String options,
- ISearchScope scope, TextSearchResultCollector collector) {
- super(null);
- Assert.isNotNull(collector);
- fWorkspace= workspace;
- fMatchLocator= new MatchLocator(pattern, options);
- fScope= scope;
- fCollector= collector;
- fCollector.setOperation(this);
- }
-
- /**
- * The actual algorithm.
- */
- protected void execute(IProgressMonitor monitor) {
- fCollector.setProgressMonitor(monitor);
- TextSearchEngine engine= new TextSearchEngine();
- fStatus= engine.search(fWorkspace, fScope, fCollector, fMatchLocator);
- }
-
- void searchInFile(IFile file, ITextSearchResultCollector collector) {
- TextSearchEngine engine= new TextSearchEngine();
- TextSearchScope scope= new TextSearchScope(""); //$NON-NLS-1$
- scope.add(file);
- scope.addExtension("*"); //$NON-NLS-1$
- fStatus= engine.search(fWorkspace, scope, collector, fMatchLocator);
- }
-
- String getSingularLabel() {
- String pattern= fMatchLocator.getPattern();
- if (pattern == null || pattern.length() < 1)
- return SearchMessages.getFormattedString("FileSearchOperation.singularLabelPostfix", new String[] {fScope.getDescription()}); //$NON-NLS-1$
- else
- return SearchMessages.getFormattedString("TextSearchOperation.singularLabelPostfix", new String[] {fMatchLocator.getPattern(), fScope.getDescription()}); //$NON-NLS-1$
- }
-
- String getPluralLabelPattern() {
- String pattern= fMatchLocator.getPattern();
- if (pattern == null || pattern.length() < 1)
- return SearchMessages.getFormattedString("FileSearchOperation.pluralLabelPatternPostfix", new String[] {"{0}", fScope.getDescription()}); //$NON-NLS-2$ //$NON-NLS-1$
- else
- return SearchMessages.getFormattedString("TextSearchOperation.pluralLabelPatternPostfix", new String[] {fMatchLocator.getPattern(), "{0}", fScope.getDescription()}); //$NON-NLS-2$ //$NON-NLS-1$
- }
-
- ImageDescriptor getImageDescriptor() {
- return SearchPluginImages.DESC_OBJ_TSEARCH_DPDN;
- }
-
- IStatus getStatus() {
- return fStatus;
- }
-
- String getPattern() {
- return fMatchLocator.getPattern();
- }
-
- boolean isRegexSearch() {
- return fMatchLocator.isRegExSearch();
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java
deleted file mode 100644
index 53563f6036a..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java
+++ /dev/null
@@ -1,698 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui.text;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.PatternSyntaxException;
-
-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.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.search.internal.core.text.TextSearchScope;
-import org.eclipse.search.internal.ui.ISearchHelpContextIds;
-import org.eclipse.search.internal.ui.ScopePart;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.internal.ui.SearchResultView;
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-import org.eclipse.search.internal.ui.util.FileTypeEditor;
-import org.eclipse.search.internal.ui.util.RowLayouter;
-import org.eclipse.search.internal.ui.util.SWTUtil;
-import org.eclipse.search.ui.IReplacePage;
-import org.eclipse.search.ui.ISearchPage;
-import org.eclipse.search.ui.ISearchPageContainer;
-import org.eclipse.search.ui.ISearchResultViewEntry;
-import org.eclipse.search.ui.SearchUI;
-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.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.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-public class TextSearchPage extends DialogPage implements ISearchPage, IReplacePage {
-
- public static final String EXTENSION_POINT_ID= "org.eclipse.search.internal.ui.text.TextSearchPage"; //$NON-NLS-1$
-
- // Dialog store id constants
- private final static String PAGE_NAME= "TextSearchPage"; //$NON-NLS-1$
- private final static String STORE_CASE_SENSITIVE= PAGE_NAME + "CASE_SENSITIVE"; //$NON-NLS-1$
- private final static String STORE_IS_REG_EX_SEARCH= PAGE_NAME + "REG_EX_SEARCH"; //$NON-NLS-1$
-
- private static List fgPreviousSearchPatterns= new ArrayList(20);
-
- private IDialogSettings fDialogSettings;
- private boolean fFirstTime= true;
- private boolean fIsCaseSensitive;
- private boolean fIsRegExSearch;
-
- private Combo fPattern;
- private Button fIgnoreCase;
- private Combo fExtensions;
- private Button fIsRegExCheckbox;
- private Label fHintLabel;
-
- private ISearchPageContainer fContainer;
- private FileTypeEditor fFileTypeEditor;
-
-
- private static class SearchPatternData {
- boolean ignoreCase;
- boolean isRegExSearch;
- String textPattern;
- Set fileNamePatterns;
- int scope;
- IWorkingSet[] workingSets;
-
- public SearchPatternData(String textPattern, boolean ignoreCase, boolean isRegExSearch, Set fileNamePatterns, int scope, IWorkingSet[] workingSets) {
- this.ignoreCase= ignoreCase;
- this.isRegExSearch= isRegExSearch;
- this.textPattern= textPattern;
- this.fileNamePatterns= fileNamePatterns;
- this.scope= scope;
- this.workingSets= workingSets;
- }
- }
- //---- Action Handling ------------------------------------------------
-
- public boolean performAction() {
-
- TextSearchOperation op = createTextSearchOperation();
-
- return runOperation(op);
- }
-
- private boolean runOperation(final TextSearchOperation op) {
- IRunnableContext context= null;
- context= getContainer().getRunnableContext();
-
- Shell shell= fPattern.getShell();
- if (context == null)
- context= new ProgressMonitorDialog(shell);
-
- try {
- context.run(true, true, op);
- } catch (InvocationTargetException ex) {
- if (ex.getTargetException() instanceof PatternSyntaxException)
- showRegExSyntaxError((PatternSyntaxException)ex.getTargetException());
- else
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.search.title"),SearchMessages.getString("Search.Error.search.message")); //$NON-NLS-2$ //$NON-NLS-1$
- return false;
- } catch (InterruptedException e) {
- return false;
- }
- IStatus status= op.getStatus();
- if (status != null && !status.isOK()) {
- String title= SearchMessages.getString("Search.Problems.title"); //$NON-NLS-1$
- ErrorDialog.openError(getShell(), title, null, status); //$NON-NLS-1$
- return false;
- }
-
- return true;
- }
-
- private TextSearchOperation createTextSearchOperation() {
-
- SearchPatternData patternData= getPatternData();
- if (patternData.fileNamePatterns == null || fExtensions.getText().length() <= 0) {
- patternData.fileNamePatterns= new HashSet(1);
- patternData.fileNamePatterns.add("*"); //$NON-NLS-1$
- }
-
- // Setup search scope
- TextSearchScope scope= null;
- switch (getContainer().getSelectedScope()) {
- case ISearchPageContainer.WORKSPACE_SCOPE:
- scope= TextSearchScope.newWorkspaceScope();
- break;
- case ISearchPageContainer.SELECTION_SCOPE:
- scope= getSelectedResourcesScope(false);
- break;
- case ISearchPageContainer.SELECTED_PROJECTS_SCOPE:
- scope= getSelectedResourcesScope(true);
- break;
- case ISearchPageContainer.WORKING_SET_SCOPE:
- IWorkingSet[] workingSets= getContainer().getSelectedWorkingSets();
- String desc= SearchMessages.getFormattedString("WorkingSetScope", ScopePart.toString(workingSets)); //$NON-NLS-1$
- scope= new TextSearchScope(desc, workingSets);
- }
- scope.addExtensions(patternData.fileNamePatterns);
-
- SearchUI.activateSearchResultView();
- TextSearchResultCollector collector= new TextSearchResultCollector();
-
- final TextSearchOperation op= new TextSearchOperation(
- SearchPlugin.getWorkspace(),
- patternData.textPattern,
- getSearchOptions(),
- scope,
- collector);
- return op;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.IReplacePage#performReplace()
- */
- public boolean performReplace() {
- final TextSearchOperation op= createTextSearchOperation();
-
- if (!runOperation(op))
- return false;
-
- Display.getCurrent().asyncExec(new Runnable() {
- public void run() {
- SearchResultView view= (SearchResultView) SearchPlugin.getSearchResultView();
- new ReplaceDialog(SearchPlugin.getSearchResultView().getViewSite().getShell(), (List) view.getViewer().getInput(), op).open();
- }
- });
- return true;
- }
-
- private void showRegExSyntaxError(PatternSyntaxException ex) {
- String title= SearchMessages.getString("SearchPage.regularExpressionSyntaxProblem.title"); //$NON-NLS-1$
- MessageDialog.openInformation(getShell(), title, ex.getLocalizedMessage());
- }
-
- private String getPattern() {
- return fPattern.getText();
- }
-
- /**
- * Return search pattern data and update previous searches.
- * An existing entry will be updated.
- */
- private SearchPatternData getPatternData() {
- SearchPatternData match= null;
- String textPattern= fPattern.getText();
- int i= fgPreviousSearchPatterns.size() - 1;
- while (i >= 0) {
- match= (SearchPatternData)fgPreviousSearchPatterns.get(i);
- if (textPattern.equals(match.textPattern))
- break;
- i--;
- }
- if (i >= 0) {
- match.ignoreCase= ignoreCase();
- match.isRegExSearch= fIsRegExCheckbox.getSelection();
- match.textPattern= getPattern();
- match.fileNamePatterns= getExtensions();
- match.scope= getContainer().getSelectedScope();
- match.workingSets= getContainer().getSelectedWorkingSets();
- // remove - will be added last (see below)
- fgPreviousSearchPatterns.remove(match);
- } else {
- match= new SearchPatternData(
- getPattern(),
- ignoreCase(),
- fIsRegExCheckbox.getSelection(),
- getExtensions(),
- getContainer().getSelectedScope(),
- getContainer().getSelectedWorkingSets());
- }
- fgPreviousSearchPatterns.add(match);
- return match;
- }
-
- private String[] getPreviousExtensions() {
- List extensions= new ArrayList(fgPreviousSearchPatterns.size());
- for (int i= fgPreviousSearchPatterns.size() -1 ; i >= 0; i--) {
- SearchPatternData data= (SearchPatternData)fgPreviousSearchPatterns.get(i);
- String text= FileTypeEditor.typesToString(data.fileNamePatterns);
- if (!extensions.contains(text))
- extensions.add(text);
- }
- return (String[])extensions.toArray(new String[extensions.size()]);
- }
-
- private String[] getPreviousSearchPatterns() {
- int size= fgPreviousSearchPatterns.size();
- String [] patterns= new String[size];
- for (int i= 0; i < size; i++)
- patterns[i]= ((SearchPatternData) fgPreviousSearchPatterns.get(size - 1 - i)).textPattern;
- return patterns;
- }
-
- private String getSearchOptions() {
- StringBuffer result= new StringBuffer();
- if (!ignoreCase())
- result.append("i"); //$NON-NLS-1$
-
- if (fIsRegExSearch)
- result.append("r"); //$NON-NLS-1$
-
- return result.toString();
- }
-
- private Set getExtensions() {
- return fFileTypeEditor.getFileTypes();
- }
-
- private boolean ignoreCase() {
- return fIgnoreCase.getSelection();
- }
-
- /*
- * Implements method from IDialogPage
- */
- public void setVisible(boolean visible) {
- if (visible && fPattern != null) {
- if (fFirstTime) {
- fFirstTime= false;
- // Set item and text here to prevent page from resizing
- fPattern.setItems(getPreviousSearchPatterns());
- fExtensions.setItems(getPreviousExtensions());
- initializePatternControl();
- }
- fPattern.setFocus();
- getContainer().setPerformActionEnabled(getContainer().hasValidScope());
- }
- super.setVisible(visible);
- }
-
- //---- Widget creation ------------------------------------------------
-
- /**
- * Creates the page's content.
- */
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
- readConfiguration();
-
- GridData gd;
- Composite result= new Composite(parent, SWT.NONE);
- GridLayout layout= new GridLayout(3, false);
- layout.horizontalSpacing= 10;
- result.setLayout(layout);
- result.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- RowLayouter layouter= new RowLayouter(layout.numColumns);
- gd= new GridData();
- gd.horizontalAlignment= GridData.FILL;
- gd.verticalAlignment= GridData.VERTICAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_FILL;
-
- layouter.setDefaultGridData(gd, 0);
- layouter.setDefaultGridData(gd, 1);
- layouter.setDefaultGridData(gd, 2);
- layouter.setDefaultSpan();
-
- layouter.perform(createTextSearchComposite(result));
-
- // Vertical filler
- Label filler= new Label(result, SWT.LEFT);
- gd= new GridData(GridData.BEGINNING | GridData.VERTICAL_ALIGN_FILL);
- gd.heightHint= convertHeightInCharsToPixels(1) / 3;
- filler.setLayoutData(gd);
- layouter.perform(new Control[] {filler}, 3);
-
- layouter.perform(createFileNamePatternComposite(result));
-
- setControl(result);
- Dialog.applyDialogFont(result);
- WorkbenchHelp.setHelp(result, ISearchHelpContextIds.TEXT_SEARCH_PAGE);
- }
-
- private Control createTextSearchComposite(Composite group) {
- GridData gd;
- Label label;
-
- // Info text
- label= new Label(group, SWT.LEFT);
- label.setText(SearchMessages.getString("SearchPage.containingText.text")); //$NON-NLS-1$
- gd= new GridData(GridData.BEGINNING);
- gd.horizontalSpan= 3;
- label.setLayoutData(gd);
-
- // Pattern combo
- fPattern= new Combo(group, SWT.SINGLE | SWT.BORDER);
- // Not done here to prevent page from resizing
- // fPattern.setItems(getPreviousSearchPatterns());
- fPattern.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- getContainer().setPerformActionEnabled(true);
- }
- });
- fPattern.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleWidgetSelected();
- }
- });
- gd= new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalSpan= 2;
- fPattern.setLayoutData(gd);
-
- fIgnoreCase= new Button(group, SWT.CHECK);
- fIgnoreCase.setText(SearchMessages.getString("SearchPage.caseSensitive")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- fIgnoreCase.setLayoutData(gd);
- fIgnoreCase.setSelection(!fIsCaseSensitive);
- fIgnoreCase.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fIsCaseSensitive= !fIgnoreCase.getSelection();
- writeConfiguration();
- }
- });
-
- // Text line which explains the special characters
- fHintLabel= new Label(group, SWT.LEFT);
- fHintLabel.setText(SearchMessages.getString("SearchPage.containingText.hint")); //$NON-NLS-1$
- fHintLabel.setVisible(!fIsRegExSearch);
- gd= new GridData(GridData.BEGINNING);
- gd.horizontalSpan= 2;
- fHintLabel.setLayoutData(gd);
-
- // RegEx checkbox
- fIsRegExCheckbox= new Button(group, SWT.CHECK);
- fIsRegExCheckbox.setText(SearchMessages.getString("SearchPage.regularExpression")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- fIsRegExCheckbox.setLayoutData(gd);
- fIsRegExCheckbox.setSelection(fIsRegExSearch);
- fIsRegExCheckbox.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fIsRegExSearch= fIsRegExCheckbox.getSelection();
- fHintLabel.setVisible(!fIsRegExSearch);
- writeConfiguration();
- }
- });
-
- return group;
- }
-
- private void handleWidgetSelected() {
- if (fPattern.getSelectionIndex() < 0)
- return;
- int index= fgPreviousSearchPatterns.size() - 1 - fPattern.getSelectionIndex();
- SearchPatternData patternData= (SearchPatternData) fgPreviousSearchPatterns.get(index);
- if (patternData == null || !fPattern.getText().equals(patternData.textPattern))
- return;
- fIgnoreCase.setSelection(patternData.ignoreCase);
- fIsRegExCheckbox.setSelection(patternData.isRegExSearch);
- fHintLabel.setVisible(!patternData.isRegExSearch);
- fPattern.setText(patternData.textPattern);
- fFileTypeEditor.setFileTypes(patternData.fileNamePatterns);
- if (patternData.workingSets != null)
- getContainer().setSelectedWorkingSets(patternData.workingSets);
- else
- getContainer().setSelectedScope(patternData.scope);
- }
-
- private void initializePatternControl() {
- ISelection selection= getSelection();
- String text= ""; //$NON-NLS-1$
- String extension= null;
- if (selection instanceof ITextSelection) {
- ITextSelection textSelection= (ITextSelection)getSelection();
- text= textSelection.getText();
- } else {
- IResource resource= null;
- Object item= null;
- if (selection instanceof IStructuredSelection)
- item= ((IStructuredSelection)selection).getFirstElement();
- if (item instanceof IResource) {
- resource= (IResource)item;
- text= resource.getName();
- }
- else if (item instanceof ISearchResultViewEntry) {
- IMarker marker= ((ISearchResultViewEntry)item).getSelectedMarker();
- resource= marker.getResource();
- try {
- text= (String)marker.getAttribute(SearchUI.LINE);
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.markerAttributeAccess.title"), SearchMessages.getString("Search.Error.markerAttributeAccess.message")); //$NON-NLS-2$ //$NON-NLS-1$
- text= ""; //$NON-NLS-1$
- }
- } else if (item instanceof IAdaptable) {
- Object adapter= ((IAdaptable)item).getAdapter(IWorkbenchAdapter.class);
- if (adapter instanceof IWorkbenchAdapter)
- text= ((IWorkbenchAdapter)adapter).getLabel(item);
-
- adapter= ((IAdaptable)item).getAdapter(IResource.class);
- if (adapter instanceof IResource) {
- resource= (IResource)adapter;
- if (text == null) // keep text, if provided by workbench adapter
- text= resource.getName();
- }
- }
- if (resource instanceof IFile ) {
- extension= resource.getFileExtension();
- if (extension == null)
- extension= resource.getName();
- else
- extension= "*." + extension; //$NON-NLS-1$
- }
- else
- extension= "*"; //$NON-NLS-1$
- }
- fPattern.setText(insertEscapeChars(text));
-
- if (getPreviousExtensions().length > 0)
- fExtensions.setText(getPreviousExtensions()[0]);
- else {
- if (extension == null)
- extension= getExtensionFromEditor();
- if (extension != null)
- fExtensions.setText(extension);
- }
- }
-
- private String insertEscapeChars(String text) {
- if (text == null || text.equals("")) //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- StringBuffer sbIn= new StringBuffer(text);
- BufferedReader reader= new BufferedReader(new StringReader(text));
- int lengthOfFirstLine= 0;
- try {
- lengthOfFirstLine= reader.readLine().length();
- } catch (IOException ex) {
- return ""; //$NON-NLS-1$
- }
- StringBuffer sbOut= new StringBuffer(lengthOfFirstLine + 5);
- int i= 0;
- while (i < lengthOfFirstLine) {
- char ch= sbIn.charAt(i);
- if (ch == '*' || ch == '?' || ch == '\\')
- sbOut.append("\\"); //$NON-NLS-1$
- sbOut.append(ch);
- i= i+1;
- }
- return sbOut.toString();
- }
-
- private String getExtensionFromEditor() {
- IEditorPart ep= SearchPlugin.getActivePage().getActiveEditor();
- if (ep != null) {
- Object elem= ep.getEditorInput();
- if (elem instanceof IFileEditorInput) {
- String extension= ((IFileEditorInput)elem).getFile().getFileExtension();
- if (extension == null)
- return ((IFileEditorInput)elem).getFile().getName();
- else
- return "*." + extension; //$NON-NLS-1$
- }
- }
- return null;
- }
-
- private Control createFileNamePatternComposite(Composite group) {
- GridData gd;
-
- // Line with label, combo and button
- Label label= new Label(group, SWT.LEFT);
- label.setText(SearchMessages.getString("SearchPage.fileNamePatterns.text")); //$NON-NLS-1$
- gd= new GridData(GridData.BEGINNING);
- gd.horizontalSpan= 3;
- label.setLayoutData(gd);
-
- fExtensions= new Combo(group, SWT.SINGLE | SWT.BORDER);
- fExtensions.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- getContainer().setPerformActionEnabled(getContainer().hasValidScope());
- }
- });
- gd= new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalSpan= 2;
- fExtensions.setLayoutData(gd);
-
- Button button= new Button(group, SWT.PUSH);
- button.setText(SearchMessages.getString("SearchPage.browse")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_END);
- button.setLayoutData(gd);
- SWTUtil.setButtonDimensionHint(button);
- fFileTypeEditor= new FileTypeEditor(
- SearchPlugin.getDefault().getWorkbench().getEditorRegistry(),
- fExtensions, button);
-
- // Text line which explains the special characters
- label= new Label(group, SWT.LEFT);
- label.setText(SearchMessages.getString("SearchPage.fileNamePatterns.hint")); //$NON-NLS-1$
- gd= new GridData(GridData.BEGINNING);
- gd.horizontalSpan= 3;
- label.setLayoutData(gd);
-
- return group;
- }
-
- public boolean isValid() {
- return true;
- }
-
- /**
- * Sets the search page's container.
- */
- public void setContainer(ISearchPageContainer container) {
- fContainer= container;
- }
-
- /**
- * Returns the search page's container.
- */
- private ISearchPageContainer getContainer() {
- return fContainer;
- }
-
- /**
- * Returns the current active selection.
- */
- private ISelection getSelection() {
- return fContainer.getSelection();
- }
-
- private TextSearchScope getSelectedResourcesScope(boolean isProjectScope) {
- TextSearchScope scope= new TextSearchScope(SearchMessages.getString("SelectionScope")); //$NON-NLS-1$
- int elementCount= 0;
- IProject firstProject= null;
- if (getSelection() instanceof IStructuredSelection && !getSelection().isEmpty()) {
- Iterator iter= ((IStructuredSelection)getSelection()).iterator();
- while (iter.hasNext()) {
- Object selection= iter.next();
-
- //Unpack search result entry
- if (selection instanceof ISearchResultViewEntry)
- selection= ((ISearchResultViewEntry)selection).getGroupByKey();
-
- IResource resource= null;
- if (selection instanceof IResource)
- resource= (IResource)selection;
- else if (selection instanceof IAdaptable) {
- if (isProjectScope)
- resource= (IProject)((IAdaptable)selection).getAdapter(IProject.class);
- if (resource == null)
- resource= (IResource)((IAdaptable)selection).getAdapter(IResource.class);
- }
- if (resource != null) {
-
- if (isProjectScope) {
- resource= resource.getProject();
- if (resource == null || isProjectScope && scope.encloses(resource))
- continue;
- if (firstProject == null)
- firstProject= (IProject)resource;
- }
- elementCount++;
- scope.add(resource);
- }
- }
- } else if (isProjectScope) {
- IProject editorProject= getEditorProject();
- if (editorProject != null)scope.add(editorProject);
- }
- if (isProjectScope) {
- if (elementCount > 1)
- scope.setDescription(SearchMessages.getFormattedString("EnclosingProjectsScope", firstProject.getName())); //$NON-NLS-1$
- else if (elementCount == 1)
- scope.setDescription(SearchMessages.getFormattedString("EnclosingProjectScope", firstProject.getName())); //$NON-NLS-1$
- else
- scope.setDescription(SearchMessages.getFormattedString("EnclosingProjectScope", "")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return scope;
- }
-
- private IProject getEditorProject() {
- IWorkbenchPart activePart= SearchPlugin.getActivePage().getActivePart();
- if (activePart instanceof IEditorPart) {
- IEditorPart editor= (IEditorPart) activePart;
- IEditorInput input= editor.getEditorInput();
- if (input instanceof IFileEditorInput) {
- return ((IFileEditorInput)input).getFile().getProject();
- }
- }
- return null;
- }
- //--------------- Configuration handling --------------
-
-
- /**
- * Returns the page settings for this Java search page.
- *
- * @return the page settings to be used
- */
- private IDialogSettings getDialogSettings() {
- IDialogSettings settings= SearchPlugin.getDefault().getDialogSettings();
- fDialogSettings= settings.getSection(PAGE_NAME);
- if (fDialogSettings == null)
- fDialogSettings= settings.addNewSection(PAGE_NAME);
- return fDialogSettings;
- }
-
- /**
- * Initializes itself from the stored page settings.
- */
- private void readConfiguration() {
- IDialogSettings s= getDialogSettings();
- fIsCaseSensitive= s.getBoolean(STORE_CASE_SENSITIVE);
- fIsRegExSearch= s.getBoolean(STORE_IS_REG_EX_SEARCH);
- }
-
- /**
- * Stores it current configuration in the dialog store.
- */
- private void writeConfiguration() {
- IDialogSettings s= getDialogSettings();
- s.put(STORE_CASE_SENSITIVE, fIsCaseSensitive);
- s.put(STORE_IS_REG_EX_SEARCH, fIsRegExSearch);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchResultCollector.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchResultCollector.java
deleted file mode 100644
index cbb14eb3448..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchResultCollector.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.search.internal.ui.text;
-
-import java.text.MessageFormat;
-import java.util.HashMap;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.ui.actions.ActionGroup;
-
-import org.eclipse.search.ui.IActionGroupFactory;
-import org.eclipse.search.ui.ISearchResultView;
-import org.eclipse.search.ui.SearchUI;
-
-import org.eclipse.search.internal.core.text.ITextSearchResultCollector;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.util.FileLabelProvider;
-
-public class TextSearchResultCollector implements ITextSearchResultCollector {
-
- private static final String MATCH= SearchMessages.getString("SearchResultCollector.match"); //$NON-NLS-1$
- private static final String MATCHES= SearchMessages.getString("SearchResultCollector.matches"); //$NON-NLS-1$
- private static final String DONE= SearchMessages.getString("SearchResultCollector.done"); //$NON-NLS-1$
-
- private IProgressMonitor fMonitor;
- private ISearchResultView fView;
- private TextSearchOperation fOperation;
- private int fMatchCount= 0;
- private Integer[] fMessageFormatArgs= new Integer[1];
- private long fLastUpdateTime;
-
-
- private static class TextSearchActionGroupFactory implements IActionGroupFactory {
- public ActionGroup createActionGroup(ISearchResultView part) {
- return new TextSearchActionGroup(part);
- }
- }
-
- /**
- * Returns the progress monitor used to setup and report progress.
- */
- public IProgressMonitor getProgressMonitor() {
- return fMonitor;
- }
-
- void setProgressMonitor(IProgressMonitor pm) {
- fMonitor= pm;
- }
-
- /**
- * Called before the actual search starts.
- */
- public void aboutToStart() throws CoreException {
- fView= SearchUI.getSearchResultView();
- fMatchCount= 0;
- fLastUpdateTime= 0;
- if (fView != null) {
- fView.searchStarted(
- new TextSearchActionGroupFactory(),
- fOperation.getSingularLabel(),
- fOperation.getPluralLabelPattern(),
- fOperation.getImageDescriptor(),
- TextSearchPage.EXTENSION_POINT_ID,
- new FileLabelProvider(FileLabelProvider.SHOW_LABEL_PATH),
- new GotoMarkerAction(),
- new GroupByKeyComputer(),
- fOperation);
- }
- }
-
- /**
- * Accepts the given search result.
- */
- public void accept(final IResourceProxy proxy, String line, int start, int length, final int lineNumber) throws CoreException {
- IResource resource= proxy.requestResource();
- IMarker marker= resource.createMarker(SearchUI.SEARCH_MARKER);
- HashMap attributes= new HashMap(4);
- attributes.put(SearchUI.LINE, line);
- attributes.put(IMarker.CHAR_START, new Integer(start));
- attributes.put(IMarker.CHAR_END, new Integer(start + length));
- attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber));
- marker.setAttributes(attributes);
-
- String description= resource.getFullPath().lastSegment();
- if (description == null)
- description= ""; //$NON-NLS-1$
-
- fView.addMatch(description, resource, resource, marker);
-
- fMatchCount++;
-
- if (!getProgressMonitor().isCanceled() && System.currentTimeMillis() - fLastUpdateTime > 1000) {
- getProgressMonitor().subTask(getFormattedMatchesString(fMatchCount));
- fLastUpdateTime= System.currentTimeMillis();
- }
- }
-
- /**
- * Called when the search has ended.
- */
- public void done() {
- if (!getProgressMonitor().isCanceled()) {
- String matchesString= getFormattedMatchesString(fMatchCount);
- getProgressMonitor().setTaskName(MessageFormat.format(DONE, new String[]{matchesString}));
- }
-
- if (fView != null)
- fView.searchFinished();
-
- // Cut no longer unused references because the collector might be re-used
- fView= null;
- fMonitor= null;
- }
-
- void setOperation(TextSearchOperation operation) {
- fOperation= operation;
- }
-
- private String getFormattedMatchesString(int count) {
- if (fMatchCount == 1)
- return MATCH;
- fMessageFormatArgs[0]= new Integer(count);
- return MessageFormat.format(MATCHES, fMessageFormatArgs);
-
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ComboFieldEditor.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ComboFieldEditor.java
deleted file mode 100644
index 877d9a3fcce..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ComboFieldEditor.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.search.internal.ui.util;
-
-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.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.util.Assert;
-
-/**
- * A field editor for a combo box that allows the drop-down selection of one of a list of items.
- *
- * XXX: Note this is a copy from org.eclipse.debug.internal.ui.preferences
- * This class can be removed once bug 24928 is fixed.
- *
- * @since 2.1
- */
-public class ComboFieldEditor extends FieldEditor {
-
- /**
- * The <code>Combo</code> widget.
- */
- private Combo fCombo;
-
- /**
- * The value (not the name) of the currently selected item in the Combo widget.
- */
- private String fValue;
-
- /**
- * The names (labels) and underlying values to populate the combo widget. These should be
- * arranged as: { {name1, value1}, {name2, value2}, ...}
- */
- private String[][] fEntryNamesAndValues;
-
- public ComboFieldEditor(String name, String labelText, String[][] entryNamesAndValues, Composite parent) {
- init(name, labelText);
- Assert.isTrue(checkArray(entryNamesAndValues));
- fEntryNamesAndValues= entryNamesAndValues;
- createControl(parent);
- }
-
- /**
- * 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;
- }
-
- /*
- * @see FieldEditor#adjustForNumColumns(int)
- */
- protected void adjustForNumColumns(int numColumns) {
- Control control= getLabelControl();
- if (control != null) {
- ((GridData)control.getLayoutData()).horizontalSpan= numColumns;
- }
- ((GridData)fCombo.getLayoutData()).horizontalSpan= numColumns;
- }
-
- /*
- * @see FieldEditor#doFillIntoGrid(Composite, int)
- */
- protected void doFillIntoGrid(Composite parent, int numColumns) {
- Control control= getLabelControl(parent);
- GridData gd= new GridData();
- gd.horizontalSpan= numColumns;
- control.setLayoutData(gd);
- control= getComboBoxControl(parent);
- gd= new GridData();
- gd.horizontalSpan= numColumns;
- control.setLayoutData(gd);
- }
-
- /*
- * @see FieldEditor#doLoad()
- */
- protected void doLoad() {
- updateComboForValue(getPreferenceStore().getString(getPreferenceName()));
- }
-
- /*
- * @see FieldEditor#doLoadDefault()
- */
- protected void doLoadDefault() {
- updateComboForValue(getPreferenceStore().getDefaultString(getPreferenceName()));
- }
-
- /*
- * @see FieldEditor#doStore()
- */
- protected void doStore() {
- if (fValue == null) {
- getPreferenceStore().setToDefault(getPreferenceName());
- return;
- }
-
- getPreferenceStore().setValue(getPreferenceName(), fValue);
- }
-
- /*
- * @see FieldEditor#getNumberOfControls()
- */
- public int getNumberOfControls() {
- return 2;
- }
-
- /**
- * Lazily create and return the Combo control.
- */
- public Combo getComboBoxControl(Composite parent) {
- if (fCombo == null) {
- fCombo= new Combo(parent, SWT.READ_ONLY);
- for (int i= 0; i < fEntryNamesAndValues.length; i++) {
- fCombo.add(fEntryNamesAndValues[i][0], i);
- }
- fCombo.setFont(parent.getFont());
- fCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent evt) {
- String oldValue= fValue;
- String name= fCombo.getText();
- fValue= getValueForName(name);
- setPresentsDefaultValue(false);
- fireValueChanged(VALUE, oldValue, fValue);
- }
- });
- }
- return fCombo;
- }
-
- /**
- * Given the name (label) of an entry, return the corresponding value.
- */
- protected String getValueForName(String name) {
- for (int i= 0; i < fEntryNamesAndValues.length; i++) {
- String[] entry= fEntryNamesAndValues[i];
- if (name.equals(entry[0])) {
- return entry[1];
- }
- }
- return fEntryNamesAndValues[0][0];
- }
-
- /**
- * Set the name in the combo widget to match the specified value.
- */
- protected void updateComboForValue(String value) {
- fValue= value;
- for (int i= 0; i < fEntryNamesAndValues.length; i++) {
- if (value.equals(fEntryNamesAndValues[i][1])) {
- fCombo.setText(fEntryNamesAndValues[i][0]);
- return;
- }
- }
- if (fEntryNamesAndValues.length > 0) {
- fValue= fEntryNamesAndValues[0][1];
- fCombo.setText(fEntryNamesAndValues[0][0]);
- }
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExceptionHandler.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExceptionHandler.java
deleted file mode 100644
index 1cf4a324005..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExceptionHandler.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui.util;
-
-import java.io.StringWriter;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.ui.SearchUI;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-
-/**
- * The default exception handler shows an error dialog when one of its handle methods
- * is called. If the passed exception is a <code>CoreException</code> an error dialog
- * pops up showing the exception's status information. For a <code>InvocationTargetException</code>
- * a normal message dialog pops up showing the exception's message. Additionally the exception
- * is written to the platform log.
- */
-public class ExceptionHandler {
-
- private static ExceptionHandler fgInstance= new ExceptionHandler();
-
- /**
- * Logs the given exception using the platform's logging mechanism. The exception is
- * logged as an error with the error code <code>JavaStatusConstants.INTERNAL_ERROR</code>.
- */
- public static void log(Throwable t, String message) {
- SearchPlugin.log(new Status(IStatus.ERROR, SearchUI.PLUGIN_ID, IStatus.ERROR, message, t));
- }
-
- /**
- * Handles the given <code>CoreException</code>. The workbench shell is used as a parent
- * for the dialog window.
- *
- * @param e the <code>CoreException</code> to be handled
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(CoreException e, String title, String message) {
- handle(e, SearchPlugin.getActiveWorkbenchShell(), title, message);
- }
-
- /**
- * Handles the given <code>CoreException</code>.
- *
- * @param e the <code>CoreException</code> to be handled
- * @param parent the dialog window's parent shell
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(CoreException e, Shell parent, String title, String message) {
- fgInstance.perform(e, parent, title, message);
- }
-
- /**
- * Handles the given <code>InvocationTargetException</code>. The workbench shell is used
- * as a parent for the dialog window.
- *
- * @param e the <code>InvocationTargetException</code> to be handled
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(InvocationTargetException e, String title, String message) {
- handle(e, SearchPlugin.getActiveWorkbenchShell(), title, message);
- }
-
- /**
- * Handles the given <code>InvocationTargetException</code>.
- *
- * @param e the <code>InvocationTargetException</code> to be handled
- * @param parent the dialog window's parent shell
- * @param title the dialog window's window title
- * @param message message to be displayed by the dialog window
- */
- public static void handle(InvocationTargetException e, Shell parent, String title, String message) {
- fgInstance.perform(e, parent, title, message);
- }
-
- //---- Hooks for subclasses to control exception handling ------------------------------------
-
- protected void perform(CoreException e, Shell shell, String title, String message) {
- SearchPlugin.log(e);
- IStatus status= e.getStatus();
- if (status != null) {
- ErrorDialog.openError(shell, title, message, status);
- } else {
- displayMessageDialog(e, e.getMessage(), shell, title, message);
- }
- }
-
- protected void perform(InvocationTargetException e, Shell shell, String title, String message) {
- Throwable target= e.getTargetException();
- if (target instanceof CoreException) {
- perform((CoreException)target, shell, title, message);
- } else {
- SearchPlugin.log(e);
- if (e.getMessage() != null && e.getMessage().length() > 0) {
- displayMessageDialog(e, e.getMessage(), shell, title, message);
- } else {
- displayMessageDialog(e, target.getMessage(), shell, title, message);
- }
- }
- }
-
- //---- Helper methods -----------------------------------------------------------------------
-
- public static void displayMessageDialog(Throwable t, Shell shell, String title, String message) {
- fgInstance.displayMessageDialog(t, t.getMessage(), shell, title, message);
- }
-
- public static void displayMessageDialog(Throwable t, String title, String message) {
- displayMessageDialog(t, SearchPlugin.getActiveWorkbenchShell(), title, message);
- }
-
- private void displayMessageDialog(Throwable t, String exceptionMessage, Shell shell, String title, String message) {
- StringWriter msg= new StringWriter();
- if (message != null) {
- msg.write(message);
- msg.write("\n\n"); //$NON-NLS-1$
- }
- if (exceptionMessage == null || exceptionMessage.length() == 0)
- msg.write(SearchMessages.getString("ExceptionDialog.seeErrorLogMessage")); //$NON-NLS-1$
- else
- msg.write(exceptionMessage);
- MessageDialog.openError(shell, title, msg.toString());
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExtendedDialogWindow.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExtendedDialogWindow.java
deleted file mode 100644
index 1f5c705f58b..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExtendedDialogWindow.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui.util;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ControlEnableState;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.wizard.ProgressMonitorPart;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Cursor;
-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.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-
-public abstract class ExtendedDialogWindow extends Dialog implements IRunnableContext {
-
- private Control fContents;
- private Button fCancelButton;
- private Set fActionButtons;
-
- // The number of long running operation executed from the dialog.
- private long fActiveRunningOperations;
-
- // The progress monitor
- private ProgressMonitorPart fProgressMonitorPart;
- private MessageDialog fWindowClosingDialog;
- private static final String FOCUS_CONTROL= "focusControl"; //$NON-NLS-1$
- private Cursor fWaitCursor;
- private Cursor fArrowCursor;
-
-
- public ExtendedDialogWindow(Shell shell) {
- super(shell);
- fActionButtons= new HashSet();
- }
-
- //---- Hooks to reimplement in subclasses -----------------------------------
-
- /**
- * Hook called when the user has pressed the button to perform
- * the dialog's action. If the method returns <code>false</code>
- * the dialog stays open. Otherwise the dialog is going to be closed.
- */
- protected boolean performAction(int buttonId) {
- return true;
- }
-
- /**
- * Hook called when the user has pressed the button to cancel
- * the dialog. If the method returns <code>false</code> the dialog
- * stays open. Otherwise the dialog is going to be closed.
- */
- protected boolean performCancel() {
- return true;
- }
-
- //---- UI creation ----------------------------------------------------------
-
- /**
- * Create the page area.
- */
- protected abstract Control createPageArea(Composite parent);
-
- /**
- * Add buttons to the dialog's button bar.
- *
- * Subclasses may override.
- *
- * @param parent the button bar composite
- */
- protected void createButtonsForButtonBar(Composite parent) {
- fCancelButton= createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
-
- protected Button createActionButton(Composite parent, int id, String label,
- boolean defaultButton) {
- Button actionButton= createButton(parent, id, label, defaultButton);
- fActionButtons.add(actionButton);
- return actionButton;
- }
-
- /**
- * Creates the layout of the extended dialog window.
- */
- protected Control createDialogArea(Composite parent) {
- Composite result= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.marginWidth= 0;
- layout.marginHeight= 0;
- layout.horizontalSpacing= 0;
- layout.verticalSpacing= 0;
- result.setLayout(layout);
- result.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- fContents= createPageArea(result);
- fContents.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // Insert a progress monitor
- GridLayout pmlayout= new GridLayout();
- pmlayout.numColumns= 1;
- fProgressMonitorPart= new ProgressMonitorPart(result, pmlayout, SWT.DEFAULT);
- fProgressMonitorPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fProgressMonitorPart.setVisible(false);
-
-
- Label separator= new Label(result, SWT.SEPARATOR | SWT.HORIZONTAL);
- separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- applyDialogFont(result);
- return result;
- }
-
- protected void buttonPressed(int buttonId) {
- switch (buttonId) {
- case IDialogConstants.CANCEL_ID:
- if (fActiveRunningOperations == 0)
- close();
- break;
- default:
- if (performAction(buttonId))
- close();
- }
- }
-
- //---- Setters and Getters --------------------------------------------------
-
- /**
- * Set the enable state of the perform action button.
- */
- public void setPerformActionEnabled(boolean state) {
- for (Iterator buttons = fActionButtons.iterator(); buttons.hasNext(); ) {
- Button element = (Button) buttons.next();
- element.setEnabled(state);
- }
- }
-
- //---- Operation stuff ------------------------------------------------------
-
- /**
- * Runs the given <code>IRunnableWithProgress</code> with the progress monitor for this
- * wizard dialog.
- * @param fork if true, it is run in a separate thread
- * @param cancelable specifies whether to enable the cancel button or not
- * @param runnable the runnable to run
- */
- 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;
- try {
- fActiveRunningOperations++;
- state= aboutToStart(fork && cancelable);
- ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay());
- } finally {
- if (state != null)
- stopped(state);
- fActiveRunningOperations--;
- }
- }
-
- /**
- * Returns the progress monitor. If the wizard dialog doesn't
- * have a progress monitor <code>null</code> is returned.
- */
- protected IProgressMonitor getProgressMonitor() {
- return fProgressMonitorPart;
- }
-
- /**
- * About to start a long running operation tiggered through
- * the wizard. So show the progress monitor and disable
- * the wizard.
- * @return The saved UI state.
- */
- protected synchronized Object aboutToStart(boolean enableCancelButton) {
- HashMap savedState= null;
- Shell shell= getShell();
- if (shell != null) {
- Display d= shell.getDisplay();
-
- // Save focus control
- Control focusControl= d.getFocusControl();
- if (focusControl != null && focusControl.getShell() != shell)
- focusControl= null;
-
- // Set the busy cursor to all shells.
- fWaitCursor= new Cursor(d, SWT.CURSOR_WAIT);
- setDisplayCursor(d, fWaitCursor);
-
- // Set the arrow cursor to the cancel component.
- fArrowCursor= new Cursor(d, SWT.CURSOR_ARROW);
- fCancelButton.setCursor(fArrowCursor);
-
- // Deactivate shell
- savedState= saveUIState(enableCancelButton);
- if (focusControl != null)
- savedState.put(FOCUS_CONTROL, focusControl);
-
- // Attach the progress monitor part to the cancel button
- fProgressMonitorPart.attachToCancelComponent(fCancelButton);
- fProgressMonitorPart.setVisible(true);
- }
-
- return savedState;
- }
-
- /**
- * A long running operation triggered through the wizard
- * was stopped either by user input or by normal end.
- * @param savedState The saveState returned by <code>aboutToStart</code>.
- * @see #aboutToStart(boolean)
- */
- protected synchronized void stopped(Object savedState) {
- Assert.isTrue( savedState instanceof HashMap);
- Shell shell= getShell();
- if (shell != null) {
-
- fProgressMonitorPart.setVisible(false);
- fProgressMonitorPart.removeFromCancelComponent(fCancelButton);
-
- HashMap state= (HashMap)savedState;
- restoreUIState(state);
-
- setDisplayCursor(shell.getDisplay(), null);
- fCancelButton.setCursor(null);
- fWaitCursor.dispose();
- fWaitCursor= null;
- fArrowCursor.dispose();
- fArrowCursor= null;
- Control focusControl= (Control)state.get(FOCUS_CONTROL);
- if (focusControl != null && ! focusControl.isDisposed())
- focusControl.setFocus();
- }
- }
-
- private void setDisplayCursor(Display d, Cursor c) {
- Shell[] shells= d.getShells();
- for (int i= 0; i < shells.length; i++)
- shells[i].setCursor(c);
- }
-
- //---- UI state save and restoring ---------------------------------------------
-
- private void restoreUIState(HashMap state) {
- restoreEnableState(fCancelButton, state); //$NON-NLS-1$
- for (Iterator actionButtons = fActionButtons.iterator(); actionButtons.hasNext(); ) {
- Button button = (Button) actionButtons.next();
- restoreEnableState(button, state);
- }
- ControlEnableState pageState= (ControlEnableState)state.get("tabForm"); //$NON-NLS-1$
- pageState.restore();
- }
-
- /**
- * Restores the enable state of the given control.
- * @private
- */
- protected void restoreEnableState(Control w, HashMap h) {
- if (!w.isDisposed()) {
- Boolean b= (Boolean)h.get(w);
- if (b != null)
- w.setEnabled(b.booleanValue());
- }
- }
-
- private HashMap saveUIState(boolean keepCancelEnabled) {
- HashMap savedState= new HashMap(10);
- saveEnableStateAndSet(fCancelButton, savedState, keepCancelEnabled); //$NON-NLS-1$
- for (Iterator actionButtons = fActionButtons.iterator(); actionButtons.hasNext(); ) {
- Button button = (Button) actionButtons.next();
- saveEnableStateAndSet(button, savedState, false);
- }
- savedState.put("tabForm", ControlEnableState.disable(fContents)); //$NON-NLS-1$
-
- return savedState;
- }
-
- private void saveEnableStateAndSet(Control w, HashMap h, boolean enabled) {
- if (!w.isDisposed()) {
- h.put(w, new Boolean(w.isEnabled()));
- w.setEnabled(enabled);
- }
- }
-
- protected void handleShellCloseEvent() {
- if (okToClose())
- super.handleShellCloseEvent();
- }
-
- /**
- * The dialog is going to be closed. Check if there is a running
- * operation. If so, post an alert saying that the wizard can't
- * be closed.
- */
- public boolean okToClose() {
- if (fActiveRunningOperations > 0) {
- synchronized (this) {
- fWindowClosingDialog= createClosingDialog();
- }
- fWindowClosingDialog.open();
- synchronized (this) {
- fWindowClosingDialog= null;
- }
- return false;
- }
- return true;
- }
-
- private MessageDialog createClosingDialog() {
- MessageDialog result=
- new MessageDialog(
- getShell(),
- SearchMessages.getString("SearchDialogClosingDialog.title"), //$NON-NLS-1$
- null,
- SearchMessages.getString("SearchDialogClosingDialog.message"), //$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL},
- 0);
- return result;
- }
-
- /**
- * Returns the cancel component that is to be used to cancel
- * a long running operation.
- */
- protected Control getCancelComponent() {
- return fCancelButton;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileLabelProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileLabelProvider.java
deleted file mode 100644
index 771da1589d0..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileLabelProvider.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui.util;
-
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.LabelProvider;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-import org.eclipse.search.ui.ISearchResultViewEntry;
-
-import org.eclipse.search.internal.ui.SearchMessages;
-
-
-public class FileLabelProvider extends LabelProvider {
-
- public static final int SHOW_LABEL= 1;
- public static final int SHOW_LABEL_PATH= 2;
- public static final int SHOW_PATH_LABEL= 3;
- public static final int SHOW_PATH= 4;
-
- private static final String fgSeparatorFormat= SearchMessages.getString("FileLabelProvider.dashSeparated"); //$NON-NLS-1$
-
- private WorkbenchLabelProvider fLabelProvider;
- private ILabelDecorator fDecorator;
-
- private int fOrder;
- private String[] fArgs= new String[2];
-
- public FileLabelProvider(int orderFlag) {
- fDecorator= PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
- fLabelProvider= new WorkbenchLabelProvider();
- fOrder= orderFlag;
- }
-
- public void setOrder(int orderFlag) {
- fOrder= orderFlag;
- }
-
- public String getText(Object element) {
- if (!(element instanceof ISearchResultViewEntry))
- return ""; //$NON-NLS-1$
-
- IResource resource= ((ISearchResultViewEntry) element).getResource();
- String text= null;
-
- if (resource == null || !resource.exists())
- text= SearchMessages.getString("SearchResultView.removed_resource"); //$NON-NLS-1$
-
- else {
- IPath path= resource.getFullPath().removeLastSegments(1);
- if (path.getDevice() == null)
- path= path.makeRelative();
- if (fOrder == SHOW_LABEL || fOrder == SHOW_LABEL_PATH) {
- text= fLabelProvider.getText(resource);
- if (path != null && fOrder == SHOW_LABEL_PATH) {
- fArgs[0]= text;
- fArgs[1]= path.toString();
- text= MessageFormat.format(fgSeparatorFormat, fArgs);
- }
- } else {
- if (path != null)
- text= path.toString();
- else
- text= ""; //$NON-NLS-1$
- if (fOrder == SHOW_PATH_LABEL) {
- fArgs[0]= text;
- fArgs[1]= fLabelProvider.getText(resource);
- text= MessageFormat.format(fgSeparatorFormat, fArgs);
- }
- }
- }
-
- // Do the decoration
- if (fDecorator != null) {
- String decoratedText= fDecorator.decorateText(text, resource);
- if (decoratedText != null)
- return decoratedText;
- }
- return text;
- }
-
- public Image getImage(Object element) {
- if (!(element instanceof ISearchResultViewEntry))
- return null; //$NON-NLS-1$
-
- IResource resource= ((ISearchResultViewEntry) element).getResource();
- Image image= fLabelProvider.getImage(resource);
- if (fDecorator != null) {
- Image decoratedImage= fDecorator.decorateImage(image, resource);
- if (decoratedImage != null)
- return decoratedImage;
- }
- return image;
- }
-
- public void dispose() {
- super.dispose();
- fLabelProvider.dispose();
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return fLabelProvider.isLabelProperty(element, property);
- }
-
- public void removeListener(ILabelProviderListener listener) {
- super.removeListener(listener);
- fLabelProvider.removeListener(listener);
- }
-
- public void addListener(ILabelProviderListener listener) {
- super.addListener(listener);
- fLabelProvider.addListener(listener);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileTypeEditor.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileTypeEditor.java
deleted file mode 100644
index 1cc0730c0c3..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileTypeEditor.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.search.internal.ui.util;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Widget;
-
-import org.eclipse.jface.window.Window;
-
-import org.eclipse.ui.IEditorRegistry;
-
-import org.eclipse.search.internal.ui.SearchMessages;
-
-public class FileTypeEditor extends SelectionAdapter implements DisposeListener, SelectionListener {
-
- private Combo fTextField;
- private Button fBrowseButton;
-
- final static String TYPE_DELIMITER= SearchMessages.getString("FileTypeEditor.typeDelimiter"); //$NON-NLS-1$
-
- public FileTypeEditor(IEditorRegistry registry, Combo textField, Button browseButton) {
- fTextField= textField;
- fBrowseButton= browseButton;
-
- fTextField.addDisposeListener(this);
- fBrowseButton.addDisposeListener(this);
- fBrowseButton.addSelectionListener(this);
- }
-
- public void widgetDisposed(DisposeEvent event) {
- Widget widget= event.widget;
- if (widget == fTextField)
- fTextField= null;
- else if (widget == fBrowseButton)
- fBrowseButton= null;
- }
-
- public void widgetSelected(SelectionEvent event) {
- if (event.widget == fBrowseButton)
- handleBrowseButton();
- }
-
- public void widgetDoubleSelected(SelectionEvent event) {
- }
- /**
- * Answer a collection of the currently-specified resource types
- *
- * @return java.util.Vector
- */
- public Set getFileTypes() {
- Set result= new HashSet();
- StringTokenizer tokenizer= new StringTokenizer(fTextField.getText(), TYPE_DELIMITER);
-
- while (tokenizer.hasMoreTokens()) {
- String currentExtension= tokenizer.nextToken().trim();
- result.add(currentExtension);
- }
- return result;
- }
- /**
- * Populate self's import types field based upon the passed types collection
- *
- * @param types java.util.Vector
- */
- public void setFileTypes(Set types) {
- fTextField.setText(typesToString(types));
- }
- protected void handleBrowseButton() {
- TypeFilteringDialog dialog= new TypeFilteringDialog(fTextField.getShell(), getFileTypes());
- if (dialog.open() == Window.OK) {
- setFileTypes(new HashSet(Arrays.asList(dialog.getResult())));
- }
- }
-
- public static String typesToString(Set types) {
- StringBuffer result= new StringBuffer();
- Iterator typesIter= types.iterator();
- boolean first= true;
- while (typesIter.hasNext()) {
- if (!first) {
- result.append(TYPE_DELIMITER);
- result.append(" "); //$NON-NLS-1$
- } else
- first= false;
- result.append(typesIter.next());
- }
- return result.toString();
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ListContentProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ListContentProvider.java
deleted file mode 100644
index 715c28cd981..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ListContentProvider.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.search.internal.ui.util;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * A specialized content provider to show a list of editor parts.
- */
-public class ListContentProvider implements IStructuredContentProvider {
- List fContents;
-
- public ListContentProvider() {
- }
-
- public Object[] getElements(Object input) {
- if (fContents != null && fContents == input)
- return fContents.toArray();
- return new Object[0];
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof List)
- fContents= (List)newInput;
- else
- fContents= null;
- // we use a fixed set.
- }
-
- public void dispose() {
- }
-
- public boolean isDeleted(Object o) {
- return fContents != null && !fContents.contains(o);
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ListDialog.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ListDialog.java
deleted file mode 100644
index bbe8b4e6e30..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ListDialog.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.search.internal.ui.util;
-
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-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.Table;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-/**
- * Dialog that shows a list of items with icon and label.
- */
-public class ListDialog extends SelectionDialog {
-
- private static final int WIDTH_IN_CHARACTERS= 55;
-
- private IStructuredContentProvider fContentProvider;
- private ILabelProvider fLabelProvider;
- private Object fInput;
- private TableViewer fViewer;
- private boolean fCreateCancelButton= true;
-
- public ListDialog(Shell parent, Object input, String title, String message, IStructuredContentProvider sp, ILabelProvider lp) {
- super(parent);
- setTitle(title);
- setMessage(message);
- fInput= input;
- fContentProvider= sp;
- fLabelProvider= lp;
- }
-
- public void setCreateCancelButton(boolean value) {
- fCreateCancelButton= value;
- }
-
- /*
- * Overrides method from Dialog
- */
- protected Label createMessageArea(Composite composite) {
- Label label = new Label(composite,SWT.WRAP);
- label.setText(getMessage());
- GridData gd= new GridData(GridData.FILL_BOTH);
- gd.widthHint= convertWidthInCharsToPixels(WIDTH_IN_CHARACTERS);
- label.setLayoutData(gd);
- applyDialogFont(label);
- return label;
- }
-
- /*
- * Overrides method from Dialog
- */
- protected Control createDialogArea(Composite container) {
- Composite parent= (Composite) super.createDialogArea(container);
- createMessageArea(parent);
- fViewer= new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- fViewer.setContentProvider(fContentProvider);
-
- final Table table= fViewer.getTable();
- table.addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- if (fCreateCancelButton)
- okPressed();
- }
- });
- fViewer.setLabelProvider(fLabelProvider);
- fViewer.setInput(fInput);
- List initialSelection= getInitialElementSelections();
- if (initialSelection != null)
- fViewer.setSelection(new StructuredSelection(initialSelection));
- GridData gd= new GridData(GridData.FILL_BOTH);
- gd.heightHint= convertHeightInCharsToPixels(15);
- gd.widthHint= convertWidthInCharsToPixels(WIDTH_IN_CHARACTERS);
- table.setLayoutData(gd);
- applyDialogFont(table);
- return table;
- }
-
- /*
- * Overrides method from Dialog
- */
- protected void createButtonsForButtonBar(Composite parent) {
- if (! fCreateCancelButton)
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- else
- super.createButtonsForButtonBar(parent);
- }
-
- /*
- * Overrides method from Dialog
- */
- protected void okPressed() {
- // Build a list of selected children.
- ISelection selection= fViewer.getSelection();
- if (selection instanceof IStructuredSelection)
- setResult(((IStructuredSelection)fViewer.getSelection()).toList());
- super.okPressed();
- }
-}
-
-
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/MessageLine.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/MessageLine.java
deleted file mode 100644
index 8678516e26b..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/MessageLine.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.search.internal.ui.util;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * A message line. It distinguishs between "normal" messages and errors.
- * Setting an error message hides a currently displayed message until
- * <code>clearErrorMessage</code> is called.
- */
-public class MessageLine extends CLabel {
-
- private String fMessageText;
- private String fErrorText;
-
- private Color fDefaultColor;
- private RGB fErrorRGB;
- private Color fErrorColor;
-
- private static RGB fgErrorRGB= new RGB(200, 0, 0);
-
- /**
- * Creates a new message line as a child of the given parent.
- * Error message will be shown with in the rgb color 200,0,0.
- */
- public MessageLine(Composite parent) {
- this(parent, SWT.LEFT);
- }
-
- /**
- * Creates a new message line as a child of the parent and with the given SWT stylebits.
- * Error message will be shown with in the rgb color 200,0,0.
- */
- public MessageLine(Composite parent, int style) {
- super(parent, style);
- fDefaultColor= getForeground();
- fErrorRGB= fgErrorRGB;
- }
-
- /**
- * Creates a new message line as a child of the parent and with the given SWT stylebits.
- * Error message will be shown with in the given rgb color.
- */
- public MessageLine(Composite parent, int style, RGB errorRGB) {
- super(parent, style);
- fDefaultColor= getForeground();
- fErrorRGB= errorRGB;
- }
-
- /**
- * Clears the currently displayed error message and redisplayes
- * the message which was active before the error message was set.
- */
- public void clearErrorMessage() {
- setErrorMessage(null);
- }
-
- /**
- * Clears the currently displayed message.
- */
- public void clearMessage() {
- setMessage(null);
- }
-
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public String getErrorMessage() {
- return fErrorText;
- }
-
- /**
- * Get the currently displayed message.
- * @return The message. If no message is displayed <code>null</code> is returned.
- */
- public String getMessage() {
- return fMessageText;
- }
-
- /**
- * Sets the default error color used by all message lines.
- * Note: a call to this method only affects newly created MessageLines not existing ones.
- */
- public static void setDefaultErrorColor(RGB color) {
- fgErrorRGB= color;
- }
-
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message) {
- fErrorText= message;
-
- if (message == null) {
- setMessage(fMessageText);
- } else {
- if (fErrorColor == null) {
- fErrorColor= new Color(getDisplay(), fErrorRGB);
- addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- getErrorColor().dispose();
- }
- });
- }
- setForeground(fErrorColor);
- setText(message);
- }
- }
-
- /**
- * 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
- */
- public void setMessage(String message) {
- fMessageText= message;
- if (message == null)
- message= ""; //$NON-NLS-1$
- if (fErrorText == null) {
- setForeground(fDefaultColor);
- setText(message);
- }
- }
-
- protected Color getErrorColor() {
- return fErrorColor;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/PixelConverter.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/PixelConverter.java
deleted file mode 100644
index 4a8bee42bab..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/PixelConverter.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.search.internal.ui.util;
-
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.widgets.Control;
-
-import org.eclipse.jface.dialogs.Dialog;
-
-public class PixelConverter {
-
- private FontMetrics fFontMetrics;
-
- public PixelConverter(Control control) {
- GC gc = new GC(control);
- gc.setFont(control.getFont());
- fFontMetrics= gc.getFontMetrics();
- gc.dispose();
- }
-
- /**
- * @see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int)
- */
- public int convertHeightInCharsToPixels(int chars) {
- return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars);
- }
-
- /**
- * @see org.eclipse.jface.dialogs.DialogPage#convertHorizontalDLUsToPixels(int)
- */
- public int convertHorizontalDLUsToPixels(int dlus) {
- return Dialog.convertHorizontalDLUsToPixels(fFontMetrics, dlus);
- }
-
- /**
- * @see org.eclipse.jface.dialogs.DialogPage#convertVerticalDLUsToPixels(int)
- */
- public int convertVerticalDLUsToPixels(int dlus) {
- return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
- }
-
- /**
- * @see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int)
- */
- public int convertWidthInCharsToPixels(int chars) {
- return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);
- }
-
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/RowLayouter.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/RowLayouter.java
deleted file mode 100644
index a8540b94b99..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/RowLayouter.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.search.internal.ui.util;
-
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Control;
-
-import org.eclipse.jface.util.Assert;
-
-public class RowLayouter {
-
- public int spanHorizontalAlignment= -1;
- public int spanGrabExcessHorizontalSpace= -1;
- public int spanHorizontalSpan= -1;
- public int spanHorizontalIndent= -1;
- public int spanWidthHint= -1;
-
- public int spanVerticalAlignment= -1;
- public int spanGrabExcessVerticalSpace= -1;
- public int spanVerticalSpan= -1;
- public int spanHeightHint= -1;
-
- private int fNumColumns;
- private boolean fOrder;
- private Control fLastControl;
- private GridData[] fDefaultGridDatas= new GridData[4];
-
- public RowLayouter(int numColumns) {
- this(numColumns, false);
- }
-
- public RowLayouter(int numColumns, boolean order) {
- fNumColumns= numColumns;
- fOrder= order;
- }
-
- public void setDefaultSpan() {
- spanHorizontalAlignment= GridData.FILL;
- spanGrabExcessHorizontalSpace= 1;
- }
-
- public void perform(Control c1) {
- perform(new Control[] {c1}, 0);
- }
-
- public void perform(Control c1, Control c2, int span) {
- perform(new Control[] {c1, c2}, span);
- }
-
- public void perform(Control c1, Control c2, Control c3, int span) {
- perform(new Control[] {c1, c2, c3}, span);
- }
-
- public void perform(Control[] controls, int spanColumn) {
- int numColumns= numColumns();
- Assert.isTrue(controls.length <= numColumns);
- order(controls);
- int gridIndex= 0;
- for (int i= 0; i < controls.length; i++) {
- Control control= controls[i];
- GridData gd= (GridData)control.getLayoutData();
- if (gd == null)
- gd= getGridData(gridIndex);
-
- if (i == spanColumn) {
- int span= numColumns - (controls.length - 1);
- gridIndex+= span;
- if (gd == null)
- gd= new GridData();
- applyDelta(gd);
- gd.horizontalSpan= span;
- } else {
- gridIndex++;
- }
- control.setLayoutData(gd);
- }
- }
-
- private void applyDelta(GridData gd) {
- if (spanHorizontalAlignment != -1)
- gd.horizontalAlignment= spanHorizontalAlignment;
-
- if (spanGrabExcessHorizontalSpace != -1) {
- if (spanGrabExcessHorizontalSpace == 0)
- gd.grabExcessHorizontalSpace= false;
- else
- gd.grabExcessHorizontalSpace= true;
- }
-
-
- if (spanHorizontalSpan != -1)
- gd.horizontalSpan= spanHorizontalSpan;
-
- if (spanHorizontalIndent != -1)
- gd.horizontalIndent= spanHorizontalIndent;
-
- if (spanWidthHint != -1)
- gd.widthHint= spanWidthHint;
-
- if (spanVerticalAlignment != -1)
- gd.verticalAlignment= spanVerticalAlignment;
-
- if (spanGrabExcessVerticalSpace != -1) {
- if (spanGrabExcessVerticalSpace == 0)
- gd.grabExcessVerticalSpace= false;
- else
- gd.grabExcessVerticalSpace= true;
- }
-
- if (spanVerticalSpan != -1)
- gd.verticalSpan= spanVerticalSpan;
-
- if (spanHeightHint != -1)
- gd.heightHint= spanHeightHint;
- }
- public void setDefaultGridData(GridData gd, int index) {
- if (index >= fDefaultGridDatas.length) {
- GridData[] newDatas= new GridData[index + 4];
- System.arraycopy(fDefaultGridDatas, 0, newDatas, 0, fDefaultGridDatas.length);
- fDefaultGridDatas= newDatas;
- }
- fDefaultGridDatas[index]= gd;
- }
-
- public GridData getGridData(int index) {
- if (index > fDefaultGridDatas.length)
- return null;
-
- return cloneGridData(fDefaultGridDatas[index]);
- }
-
- public int numColumns() {
- return fNumColumns;
- }
-
- protected void order(Control[] controls) {
- if (!fOrder)
- return;
-
- for (int i= 0; i < controls.length; i++) {
- Control control= controls[i];
- control.moveBelow(fLastControl);
- fLastControl= control;
- }
- }
-
- protected GridData cloneGridData(GridData gd) {
- if (gd == null)
- return null;
-
- GridData result= new GridData();
- result.horizontalAlignment= gd.horizontalAlignment;
- result.grabExcessHorizontalSpace= gd.grabExcessHorizontalSpace;
- result.horizontalSpan= gd.horizontalSpan;
- result.horizontalIndent= gd.horizontalIndent;
- result.widthHint= gd.widthHint;
-
- result.verticalAlignment= gd.verticalAlignment;
- result.grabExcessVerticalSpace= gd.grabExcessVerticalSpace;
- result.verticalSpan= gd.verticalSpan;
- result.heightHint= gd.heightHint;
- return result;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/SWTUtil.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/SWTUtil.java
deleted file mode 100644
index 83cd7e562a8..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/SWTUtil.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.search.internal.ui.util;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DragSource;
-import org.eclipse.swt.dnd.DropTarget;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Caret;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Widget;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-
-/**
- * Utility class to simplify access to some SWT resources.
- */
-public class SWTUtil {
-
- /**
- * Returns the standard display to be used. The method first checks, if
- * the thread calling this method has an associated disaply. If so, this
- * display is returned. Otherwise the method returns the default display.
- */
- public static Display getStandardDisplay() {
- Display display;
- display= Display.getCurrent();
- if (display == null)
- display= Display.getDefault();
- return display;
- }
-
- /**
- * Returns the shell for the given widget. If the widget doesn't represent
- * a SWT object that manage a shell, <code>null</code> is returned.
- *
- * @return the shell for the given widget
- */
- public static Shell getShell(Widget widget) {
- if (widget instanceof Control)
- return ((Control)widget).getShell();
- if (widget instanceof Caret)
- return ((Caret)widget).getParent().getShell();
- if (widget instanceof DragSource)
- return ((DragSource)widget).getControl().getShell();
- if (widget instanceof DropTarget)
- return ((DropTarget)widget).getControl().getShell();
- if (widget instanceof Menu)
- return ((Menu)widget).getParent().getShell();
- if (widget instanceof ScrollBar)
- return ((ScrollBar)widget).getParent().getShell();
-
- return null;
- }
-
-
- /**
- * Returns a width hint for a button control.
- */
- public static int getButtonWidthHint(Button button) {
- if (button.getFont().equals(JFaceResources.getDefaultFont()))
- button.setFont(JFaceResources.getDialogFont());
- PixelConverter converter= new PixelConverter(button);
- int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- }
-
- /**
- * Returns a height hint for a button control.
- */
- public static int getButtonHeightHint(Button button) {
- if (button.getFont().equals(JFaceResources.getDefaultFont()))
- button.setFont(JFaceResources.getDialogFont());
- PixelConverter converter= new PixelConverter(button);
- return converter.convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- }
-
-
- /**
- * Sets width and height hint for the button control.
- * <b>Note:</b> This is a NOP if the button's layout data is not
- * an instance of <code>GridData</code>.
- *
- * @param the button for which to set the dimension hint
- */
- public static void setButtonDimensionHint(Button button) {
- Assert.isNotNull(button);
- Object gd= button.getLayoutData();
- if (gd instanceof GridData) {
- ((GridData)gd).heightHint= getButtonHeightHint(button);
- ((GridData)gd).widthHint= getButtonWidthHint(button);
- }
- }
-
- public static int getTableHeightHint(Table table, int rows) {
- if (table.getFont().equals(JFaceResources.getDefaultFont()))
- table.setFont(JFaceResources.getDialogFont());
- int result= table.getItemHeight() * rows + table.getHeaderHeight();
- if (table.getLinesVisible())
- result+= table.getGridLineWidth() * (rows - 1);
- return result;
- }
-
-
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/TypeFilteringDialog.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/TypeFilteringDialog.java
deleted file mode 100644
index 485d59572df..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/TypeFilteringDialog.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.search.internal.ui.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-
-import org.eclipse.ui.IFileEditorMapping;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.FileEditorMappingContentProvider;
-import org.eclipse.ui.dialogs.FileEditorMappingLabelProvider;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.search.internal.ui.ISearchHelpContextIds;
-import org.eclipse.search.internal.ui.SearchMessages;
-
-/**
- * The TypeFilteringDialog is a SelectionDialog that allows the user to select a file editor.
- * XXX: Workbench should offer this dialog (public API), see: bug 2763: TypeFilteringDialog should be public API
- */
-public class TypeFilteringDialog extends SelectionDialog {
-
- private Collection fInitialSelections;
-
- // the visual selection widget group
- private CheckboxTableViewer fListViewer;
-
- // sizing constants
- private final static int SIZING_SELECTION_WIDGET_HEIGHT= 250;
- private final static int SIZING_SELECTION_WIDGET_WIDTH= 300;
-
- private Text fUserDefinedText;
-
- private IFileEditorMapping[] fCurrentInput;
- /**
- * Creates a type selection dialog using the supplied entries. Set the initial selections to those
- * whose extensions match the preselections.
- */
- public TypeFilteringDialog(Shell parentShell, Collection preselections) {
- super(parentShell);
- setTitle(SearchMessages.getString("TypesFiltering.title")); //$NON-NLS-1$
- fInitialSelections= preselections;
- setMessage(SearchMessages.getString("TypesFiltering.message")); //$NON-NLS-1$
- }
-
- /**
- * Add the selection and deselection buttons to the dialog.
- * @param composite org.eclipse.swt.widgets.Composite
- */
- private void addSelectionButtons(Composite composite) {
-
- Composite buttonComposite= new Composite(composite, SWT.RIGHT);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
- buttonComposite.setLayout(layout);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
- data.grabExcessHorizontalSpace= true;
- composite.setData(data);
-
- Button selectButton =
- createButton(
- buttonComposite,
- IDialogConstants.SELECT_ALL_ID,
- SearchMessages.getString("TypesFiltering.selectAll"), //$NON-NLS-1$
- false);
-
- SelectionListener listener= new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- getListViewer().setAllChecked(true);
- }
- };
- selectButton.addSelectionListener(listener);
-
- Button deselectButton =
- createButton(
- buttonComposite,
- IDialogConstants.DESELECT_ALL_ID,
- SearchMessages.getString("TypesFiltering.deselectAll"), //$NON-NLS-1$
- false);
-
- listener= new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- getListViewer().setAllChecked(false);
-
- }
- };
- deselectButton.addSelectionListener(listener);
-
- }
-
- /**
- * Add the currently-specified extensions.
- */
- private void addUserDefinedEntries(List result) {
-
- StringTokenizer tokenizer =
- new StringTokenizer(fUserDefinedText.getText(), FileTypeEditor.TYPE_DELIMITER);
-
- //Allow the *. and . prefix and strip out the extension
- while (tokenizer.hasMoreTokens()) {
- String currentExtension= tokenizer.nextToken().trim();
- if (!currentExtension.equals("")) //$NON-NLS-1$
- result.add(currentExtension);
- }
- }
-
- /**
- * Visually checks the previously-specified elements in this dialog's list
- * viewer.
- */
- private void checkInitialSelections() {
-
- IFileEditorMapping editorMappings[] =
- PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings();
- ArrayList selectedMappings= new ArrayList();
-
- for (int i= 0; i < editorMappings.length; i++) {
- IFileEditorMapping mapping= editorMappings[i];
- if (fInitialSelections.contains(mapping.getLabel())) {
- fListViewer.setChecked(mapping, true);
- selectedMappings.add(mapping.getLabel());
- }
- }
-
- //Now add in the ones not selected to the user defined list
- Iterator initialIterator= fInitialSelections.iterator();
- StringBuffer entries= new StringBuffer();
- boolean first= true;
- while (initialIterator.hasNext()) {
- String nextExtension= (String)initialIterator.next();
- if (!selectedMappings.contains(nextExtension)) {
- if (!first) {
- entries.append(FileTypeEditor.TYPE_DELIMITER);
- entries.append(" "); //$NON-NLS-1$
- }
- first= false;
- entries.append(nextExtension);
- }
- }
- fUserDefinedText.setText(entries.toString());
- }
-
- /* (non-Javadoc)
- * Method declared in Window.
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, ISearchHelpContextIds.TYPE_FILTERING_DIALOG);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite= (Composite)super.createDialogArea(parent);
-
- createMessageArea(composite);
-
- fListViewer= CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- GridData data= new GridData(GridData.FILL_BOTH);
- data.heightHint= SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint= SIZING_SELECTION_WIDGET_WIDTH;
- fListViewer.getTable().setLayoutData(data);
-
- fListViewer.setLabelProvider(FileEditorMappingLabelProvider.INSTANCE);
- fListViewer.setContentProvider(FileEditorMappingContentProvider.INSTANCE);
-
- addSelectionButtons(composite);
-
- createUserEntryGroup(composite);
-
- initializeViewer();
-
- // initialize page
- if (fInitialSelections != null && !fInitialSelections.isEmpty())
- checkInitialSelections();
-
- applyDialogFont(composite);
- return composite;
- }
-
- /**
- * Create the group that shows the user defined entries for the dialog.
- * @param parent the parent this is being created in.
- */
- private void createUserEntryGroup(Composite parent) {
-
- // destination specification group
- Composite userDefinedGroup= new Composite(parent, SWT.NONE);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
- userDefinedGroup.setLayout(layout);
- userDefinedGroup.setLayoutData(
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
-
- new Label(userDefinedGroup, SWT.NONE).setText(
- SearchMessages.getString("TypesFiltering.otherExtensions")); //$NON-NLS-1$
-
- // user defined entry field
- fUserDefinedText= new Text(userDefinedGroup, SWT.SINGLE | SWT.BORDER);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- fUserDefinedText.setLayoutData(data);
- }
-
- /**
- * Return the input to the dialog.
- */
- private IFileEditorMapping[] getInput() {
-
- //Filter the mappings to be just those with a wildcard extension
- if (fCurrentInput == null) {
- List wildcardEditors= new ArrayList();
- IFileEditorMapping[] allMappings =
- PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings();
- for (int i= 0; i < allMappings.length; i++) {
- if (allMappings[i].getName().equals("*")) //$NON-NLS-1$
- wildcardEditors.add(allMappings[i]);
- }
- fCurrentInput= new IFileEditorMapping[wildcardEditors.size()];
- wildcardEditors.toArray(fCurrentInput);
- }
-
- return fCurrentInput;
- }
-
- /**
- * Initializes this dialog's viewer after it has been laid out.
- */
- private void initializeViewer() {
- fListViewer.setInput(getInput());
- }
-
- /**
- * The <code>ListSelectionDialog</code> implementation of this
- * <code>Dialog</code> method builds a list of the selected elements for later
- * retrieval by the client and closes this dialog.
- */
- protected void okPressed() {
-
- // Get the input children.
- IFileEditorMapping[] children= getInput();
-
- List list= new ArrayList();
-
- // Build a list of selected children.
- for (int i= 0; i < children.length; ++i) {
- IFileEditorMapping element= children[i];
- if (fListViewer.getChecked(element))
- list.add(element.getLabel());
- }
-
- addUserDefinedEntries(list);
- setResult(list);
- super.okPressed();
- }
-
- protected CheckboxTableViewer getListViewer() {
- return fListViewer;
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/IActionGroupFactory.java b/org.eclipse.search/search/org/eclipse/search/ui/IActionGroupFactory.java
deleted file mode 100644
index f22876e545b..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/IActionGroupFactory.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.search.ui;
-
-import org.eclipse.ui.actions.ActionGroup;
-
-/**
- * Allows to specify an <code>ActionGroup</code> factory
- * which will be used by the Search view to create an
- * <code>ActionGroup</code> which is used to build the
- * actions bars and the context menu.
- * <p>
- * Note: Local tool bar contributions are not supported in 2.0.
- * </p>
- *
- * Clients can implement this interface and pass an
- * instance to the search result view.
- *
- * @see org.eclipse.ui.actions.ActionGroup
- * @see ISearchResultView#searchStarted
- * @since 2.0
- */
-public interface IActionGroupFactory {
-
- /**
- * Creates an <code>ActionGroup</code> for a Search view.
- *
- * @param searchView the search result view for which the group is made
- * @see org.eclipse.ui.actions.ActionGroup
- */
- ActionGroup createActionGroup(ISearchResultView searchView);
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/IContextMenuConstants.java b/org.eclipse.search/search/org/eclipse/search/ui/IContextMenuConstants.java
deleted file mode 100644
index ca20099c63a..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/IContextMenuConstants.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.search.ui;
-
-import org.eclipse.ui.IWorkbenchActionConstants;
-
-/**
- * Constants for menu groups used in context menus for Search views and editors.
- * <p>
- * This interface declares constants only; it is not intended to be implemented.
- * </p>
- *
- * @since 2.0
- */
-public interface IContextMenuConstants {
-
- /**
- * Pop-up menu: name of group for goto actions (value <code>"group.open"</code>).
- * <p>
- * Examples for open actions are:
- * <ul>
- * <li>Go Into</li>
- * <li>Go To</li>
- * </ul>
- * </p>
- */
- public static final String GROUP_GOTO= "group.goto"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for open actions (value <code>"group.open"</code>).
- * <p>
- * Examples for open actions are:
- * <ul>
- * <li>Open To</li>
- * <li>Open With</li>
- * </ul>
- * </p>
- */
- public static final String GROUP_OPEN= "group.open"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for show actions (value <code>"group.show"</code>).
- * <p>
- * Examples for show actions are:
- * <ul>
- * <li>Show in Navigator</li>
- * <li>Show in Type Hierarchy</li>
- * </ul>
- * </p>
- */
- public static final String GROUP_SHOW= "group.show"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for new actions (value <code>"group.new"</code>).
- * <p>
- * Examples for new actions are:
- * <ul>
- * <li>Create new class</li>
- * <li>Create new interface</li>
- * </ul>
- * </p>
- */
- public static final String GROUP_NEW= "group.new"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for build actions (value <code>"group.build"</code>).
- */
- public static final String GROUP_BUILD= "group.build"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for reorganize actions (value <code>"group.reorganize"</code>).
- */
- public static final String GROUP_REORGANIZE= IWorkbenchActionConstants.GROUP_REORGANIZE;
-
- /**
- * Pop-up menu: name of group for code generation or refactoring actions (
- * value <code>"group.generate"</code>).
- */
- public static final String GROUP_GENERATE= "group.generate"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for search actions (value <code>"group.search"</code>).
- */
- public static final String GROUP_SEARCH= "group.search"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for additional actions (value <code>"group.additions"</code>).
- */
- public static final String GROUP_ADDITIONS= "additions"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for viewer setup actions (value <code>"group.viewerSetup"</code>).
- */
- public static final String GROUP_VIEWER_SETUP= "group.viewerSetup"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for properties actions (value <code>"group.properties"</code>).
- */
- public static final String GROUP_PROPERTIES= "group.properties"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for remove match actions (value <code>"group.removeMatches"</code>).
- * @since 2.1
- */
- public static final String GROUP_REMOVE_MATCHES= "group.removeMatches"; //$NON-NLS-1$
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/IContextMenuContributor.java b/org.eclipse.search/search/org/eclipse/search/ui/IContextMenuContributor.java
deleted file mode 100644
index 96741e19566..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/IContextMenuContributor.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.search.ui;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.IInputSelectionProvider;
-
-/**
- * Specify how clients can add menu items
- * to the context menu of the search result view.
- * A class that contributes context menu items
- * must implement this interface and pass an
- * instance of itself to the search result view.
- *
- * @see ISearchResultView#searchStarted
- */
-public interface IContextMenuContributor {
-
- /**
- * Contributes menu items to the given context menu appropriate for the
- * given selection.
- *
- * @param menu the menu to which the items are added
- * @param inputProvider the selection and input provider
- */
- public void fill(IMenuManager menu, IInputSelectionProvider inputProvider);
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/IGroupByKeyComputer.java b/org.eclipse.search/search/org/eclipse/search/ui/IGroupByKeyComputer.java
deleted file mode 100644
index 776ff356334..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/IGroupByKeyComputer.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.search.ui;
-
-import org.eclipse.core.resources.IMarker;
-
-/**
- * Computes the key by which the markers in the search result view
- * are grouped.
- */
-public interface IGroupByKeyComputer {
-
- /**
- * Computes and returns key by which the given marker is grouped.
- *
- * @param marker the marker for which the key must be computed
- * @return an object that will be used as the key for that marker,
- * <code>null</code> if the marker seems to be invalid
- */
- public Object computeGroupByKey(IMarker marker);
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/IReplacePage.java b/org.eclipse.search/search/org/eclipse/search/ui/IReplacePage.java
deleted file mode 100644
index 11abd3dd388..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/IReplacePage.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.search.ui;
-
-/**
- * An extension interface to <code>ISearchPage</code>. If clients implement
- * <code>IReplacePage</code> in addition to <code>ISearchPage</code>, a
- * "Replace" button will be shown in the search dialog.
- *
- * @since 3.0
- */
-public interface IReplacePage {
-
- /**
- * Performs the replace action for this page.
- * The search dialog calls this method when the Replace
- * button is pressed.
- *
- * @return <code>true</code> if the dialog can be closed after execution
- */
- public boolean performReplace();
-
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/ISearchPage.java b/org.eclipse.search/search/org/eclipse/search/ui/ISearchPage.java
deleted file mode 100644
index 76fea75eb6e..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/ISearchPage.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.search.ui;
-
-import org.eclipse.jface.dialogs.IDialogPage;
-
-/**
- * Defines a page inside the search dialog.
- * Clients can contribute their own search page to the
- * dialog by implementing this interface, typically as a subclass
- * of <code>DialogPage</code>.
- * <p>
- * The search dialog calls the <code>performAction</code> method when the Search
- * button is pressed.
- * <p>
- *
- * @see org.eclipse.jface.dialogs.IDialogPage
- * @see org.eclipse.jface.dialogs.DialogPage
- */
-public interface ISearchPage extends IDialogPage {
-
- /**
- * Performs the action for this page.
- * The search dialog calls this method when the Search
- * button is pressed.
- *
- * @return <code>true</code> if the dialog can be closed after execution
- */
- public boolean performAction();
-
- /**
- * Sets the container of this page.
- * The search dialog calls this method to initialize this page.
- * Implementations may store the reference to the container.
- *
- * @param container the container for this page
- */
- public void setContainer(ISearchPageContainer container);
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/ISearchPageContainer.java b/org.eclipse.search/search/org/eclipse/search/ui/ISearchPageContainer.java
deleted file mode 100644
index 27f6f4cdec9..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/ISearchPageContainer.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.ui;
-
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.ui.IWorkingSet;
-
-/**
- * Offers client access to the search dialog.
- * A search page can enable or disable the dialog's action
- * button and get an operation context to perform the action.
- * The dialog itself cannot be accessed directly.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface ISearchPageContainer {
-
- /**
- * Workspace scope (value <code>0</code>).
- *
- * @since 2.0
- */
- public static final int WORKSPACE_SCOPE= 0;
-
- /**
- * Selection scope (value <code>1</code>).
- *
- * @since 2.0
- */
- public static final int SELECTION_SCOPE= 1;
-
- /**
- * Working set scope (value <code>2</code>).
- *
- * @since 2.0
- */
- public static final int WORKING_SET_SCOPE= 2;
-
- /**
- * Current Project scope (value <code>3</code>).
- *
- * @since 3.0
- */
- public static final int SELECTED_PROJECTS_SCOPE= 3;
-
- /**
- * Returns the selection with which this container was opened.
- *
- * @return the selection passed to this container when it was opened
- */
- public ISelection getSelection();
-
- /**
- * Returns the context for the search operation.
- * This context allows progress to be shown inside the search dialog.
- *
- * @return the <code>IRunnableContext</code> for the search operation
- */
- public IRunnableContext getRunnableContext();
-
- /**
- * Sets the enable state of the perform action button
- * of this container.
- *
- * @param state <code>true</code> to enable the button which performs the action
- */
- public void setPerformActionEnabled(boolean state);
-
- /**
- * Returns search container's selected scope.
- * The scope is WORKSPACE_SCOPE, SELECTED_PROJECTS_SCOPE, SELECTION_SCOPE or WORKING_SET_SCOPE.
- *
- * @return the selected scope
- * @since 2.0
- */
- public int getSelectedScope();
-
- /**
- * Sets the selected scope of this search page container.
- * The scope is WORKSPACE_SCOPE, SELECTED_PROJECTS_SCOPE, SELECTION_SCOPE or WORKING_SET_SCOPE.
- *
- * @return the selected scope
- * @since 2.0
- */
- public void setSelectedScope(int scope);
-
- /**
- * Tells whether a valid scope is selected.
- *
- * @return a <code>true</code> if a valid scope is selected in this search page container
- * @since 2.0
- */
- public boolean hasValidScope();
-
- /**
- * Returns the selected working sets of this container.
- *
- * @return an array with the selected working sets or <code>null</code> if the scope is not WORKING_SET_SCOPE
- * @since 2.0
- */
- public IWorkingSet[] getSelectedWorkingSets();
-
- /**
- * Sets the selected working sets of this container.
- *
- * @param workingSets an array of IWorkingSet
- * @since 2.0
- */
- public void setSelectedWorkingSets(IWorkingSet[] workingSets);
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/ISearchPageScoreComputer.java b/org.eclipse.search/search/org/eclipse/search/ui/ISearchPageScoreComputer.java
deleted file mode 100644
index e0caced8766..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/ISearchPageScoreComputer.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.search.ui;
-
-/**
- * Computes a score that is used by the search dialog
- * to find the best fitting page for a selection when opened.
- * The score has no upper limit but must be at least
- * <code>LOWEST</code>. Higher values means the page is better
- * suited for the given selection input.
- * <p>
- * For example, a Java-specific search page score computer could test
- * if the page is a Java search page and returns high scores
- * for Java elements as selection input.
- * </p>
- */
-public interface ISearchPageScoreComputer {
-
- /**
- * Invalid score value indicating a score is unknown or undecided.
- */
- public static final int UNKNOWN= -1;
-
- /**
- * Lowest possible valid score.
- */
- public static final int LOWEST= 0;
-
- /**
- * Computes and returns a score indicating how good the page with the given
- * id can handle the given input element.
- * The search page id appears as the <code>id</code> attribute of the
- * <code>&lt;page&gt;</code> element contributed to the
- * search pages extension point (<code>"org.eclipse.search.searchPages"</code>).
- *
- * @param pageId the string id of the page for which the score is computed
- * @param input the object based on which the page should open
- * @return a score higher or equal to <code>LOWEST</code>, or
- * <code>UNKNOWN</code> if this computer cannot decide
- */
- public int computeScore(String pageId, Object input);
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java b/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java
deleted file mode 100644
index b8ae3133e01..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.ui;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.ui.IViewPart;
-
-/**
- * Provides client access to the search result view.
- * Each element in the view is a <code>ISearchResultViewEntry</code>,
- * which groups markers based on the <code>groupByKey</code> provided
- * by the client each time when adding a match. If every match should
- * show up in the search result view then the match itself can be used
- * as key.
- * <p>
- * The search result view has id <code>"org.eclipse.search.SearchResultView"</code>.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface ISearchResultView extends IViewPart {
-
- /**
- * Informs the view that a search has started.
- * Provides all necessary information to create an entry in the search result
- * view.
- * If every match should show up in the search result view then the match
- * itself can be used as key.
- *
- * @param groupFactory the action group factory
- * or <code>null</code> if no factory is provided.
- * @param singularLabel the label to be used for this search occurrence
- * if there is one match
- * or <code>null</code> if the pluralLabelPattern should be used
- * @param pluralLabelPattern the label pattern to be used for this search occurrence
- * if there are more than one matches or none.
- * This string may contain {0} which will be replace by the match count
- * @param imageDescriptor the image descriptor to be used for this search occurrence,
- * or <code>null</code> if this search should not have an image
- * @param pageId the id of the search page which started the search
- * @param labelProvider the label provider used by this search result view
- * or <code>null</code> if the default provider should be used.
- * The default label provider shows the resource name and the corresponding image.
- * @param gotoAction the action used by the view to go to a marker
- * @param groupByKeyComputer the computer used by the view to compute the key for a marker
- * @param operation the runnable used by the view to repeat the search
- *
- * @see IActionGroupFactory
- * @since 2.0
- */
- public void searchStarted(
- IActionGroupFactory groupFactory,
- String singularLabel,
- String pluralLabelPattern,
- ImageDescriptor imageDescriptor,
- String pageId,
- ILabelProvider labelProvider,
- IAction gotoAction,
- IGroupByKeyComputer groupByKeyComputer,
- IRunnableWithProgress operation);
-
- /**
- * Returns the current selection of the search result view
- *
- * @return the current selection of the search result view
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection
- */
- public ISelection getSelection();
-
- /**
- * Informs the view that a search has started.
- * Provides all necessary information to create an entry in the search result
- * view.
- * If every match should show up in the search result view then the match
- * itself can be used as key.
- *
- * @param pageId the id of the search page which started the search
- * @param label the label to be used for this search occurrence
- * @param imageDescriptor the image descriptor to be used for this search occurrence,
- * or <code>null</code> if this search should not have an image
- * @param contributor the context menu contributor
- * or <code>null</code> if no context menu is contributed
- * @param labelProvider the label provider used by this search result view
- * or <code>null</code> if the default provider should be used.
- * The default label provider shows the resource name and the corresponding image.
- * @param gotoAction the action used by the view to go to a marker
- * @param groupByKeyComputer the computer used by the view to compute the key for a marker
- * @param operation the runnable used by the view to repeat the search
- * @deprecated As of build > 20011107, replaced by the new version with additonal parameter
- */
- public void searchStarted(
- String pageId,
- String label,
- ImageDescriptor imageDescriptor,
- IContextMenuContributor contributor,
- ILabelProvider labelProvider,
- IAction gotoAction,
- IGroupByKeyComputer groupByKeyComputer,
- IRunnableWithProgress operation);
-
- /**
- * Informs the view that a search has started.
- * Provides all necessary information to create an entry in the search result
- * view.
- * If every match should show up in the search result view then the match
- * itself can be used as key.
- *
- * @param pageId the id of the search page which started the search
- * @param singularLabel the label to be used for this search occurrence
- * if there is one match
- * or <code>null</code> if the pluralLabelPattern should be used
- * @param pluralLabelPattern the label pattern to be used for this search occurrence
- * if there are more than one matches or none.
- * This string may contain {0} which will be replace by the match count
- * @param imageDescriptor the image descriptor to be used for this search occurrence,
- * or <code>null</code> if this search should not have an image
- * @param contributor the context menu contributor
- * or <code>null</code> if no context menu is contributed
- * @param labelProvider the label provider used by this search result view
- * or <code>null</code> if the default provider should be used.
- * The default label provider shows the resource name and the corresponding image.
- * @param gotoAction the action used by the view to go to a marker
- * @param groupByKeyComputer the computer used by the view to compute the key for a marker
- * @param operation the runnable used by the view to repeat the search
- * @since 2.0
- * @deprecated As of build > 20020514, replaced by the new version which provides an action group factory
- */
- public void searchStarted(
- String pageId,
- String singularLabel,
- String pluralLabelPattern,
- ImageDescriptor imageDescriptor,
- IContextMenuContributor contributor,
- ILabelProvider labelProvider,
- IAction gotoAction,
- IGroupByKeyComputer groupByKeyComputer,
- IRunnableWithProgress operation);
-
- /**
- * Informs the view that the search has finished.
- * This method must also be called in case of the search
- * fails or has been canceled.
- */
- public void searchFinished();
-
- /**
- * Informs the view that a match has been found.
- * Provides all necessary information to create a search result entry in this
- * view.
- * <p>
- * Note: It is the clients responsibility to create the marker for this match.
- * </p>
- *
- * @param description the text description of the match
- * @param groupByKey the <code>Object</code> by which this match is grouped
- * @param marker the marker for this match
- * @param resource the marker's resource passed for optimization
- */
- public void addMatch(String description, Object groupByKey, IResource resource, IMarker marker);
-
- /**
- * Returns the label provider of a search result view.
- *
- * @return the label provider of a search result view or <code>null</code>
- * @since 2.0
- */
- public ILabelProvider getLabelProvider();
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultViewEntry.java b/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultViewEntry.java
deleted file mode 100644
index 08a4c408fcc..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultViewEntry.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.search.ui;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-
-/**
- * Specifies a search result view entry.
- * This entry provides information about the markers
- * it groups by a client defined key. Each entry in the search
- * result view corresponds to a different key.
- * <p>
- * The UI allows stepping through this entry's markers grouped by the key.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface ISearchResultViewEntry {
-
- /**
- * Returns the key by which this entry's markers
- * are logically grouped. A line in a text could be such a key.
- * Clients supply this key as a parameter to <code>ISearchResultView.addMatch</code>.
- *
- * @return the common resource of this entry's markers
- * @see ISearchResultView#addMatch
- */
- public Object getGroupByKey();
-
- /**
- * Returns the resource to which this entry's markers are attached.
- * This is a convenience method for <code>getSelectedMarker().getResource()</code>.
- *
- * @return the common resource of this entry's markers
- */
- public IResource getResource();
-
- /**
- * Returns the number of markers grouped by this entry.
- *
- * @return the number of markers
- */
- public int getMatchCount();
-
- /**
- * Returns the selected marker of this entry, or the first one
- * if no marker is selected.
- * A search results view entry can group markers
- * which the UI allows the user to step through them while
- * this entry remains selected.
- *
- * @return the selected marker inside this entry, or
- * <code>null</code> if the entry has no markers
- */
- public IMarker getSelectedMarker();
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/SearchUI.java b/org.eclipse.search/search/org/eclipse/search/ui/SearchUI.java
deleted file mode 100644
index f89aaa537b6..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/SearchUI.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.search.ui;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.ui.IWorkbenchWindow;
-
-import org.eclipse.search.internal.ui.OpenSearchDialogAction;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.internal.ui.SearchPluginImages;
-import org.eclipse.search.internal.ui.SearchPreferencePage;
-
-/**
- * The central class for access to the Search Plug-in's User Interface.
- * This class cannot be instantiated; all functionality is provided by
- * static methods.
- *
- * Features provided:
- * <ul>
- * <li>convenient access to the search result view of the active workbench
- * window.</li>
- * </ul>
- *
- * @see ISearchResultView
- */
-public final class SearchUI {
-
- /**
- * Search Plug-in Id (value <code>"org.eclipse.search"</code>).
- */
- public static final String PLUGIN_ID= "org.eclipse.search"; //$NON-NLS-1$
-
- /**
- * Search marker type (value <code>"org.eclipse.search.searchmarker"</code>).
- *
- * @see org.eclipse.core.resources.IMarker
- */
- public static final String SEARCH_MARKER= PLUGIN_ID + ".searchmarker"; //$NON-NLS-1$
-
- /**
- * Line marker attribute (value <code>"line"</code>)
- * The value of the marker attribute is the line which contains the text search match.
- *
- * @see org.eclipse.core.resources.IMarker#getAttribute
- */
- public static final String LINE= "line"; //$NON-NLS-1$
-
- /**
- * Potential match marker attribute
- * (value <code>"potentialMatch"</code>).
- * <p>
- * This optional marker attribute tells whether a marker is
- * a potential or an exact match.
- * The marker is considered an exact match if the attribute is missing.
- * </p>
- * <p>
- * Potential matches are shown with a different background color in
- * the Search view. The color can be changed in the Search preferences.
- * </p>
- *
- * @see org.eclipse.core.resources.IMarker#getAttribute
- * @since 2.0
- */
- public static final String POTENTIAL_MATCH= "potentialMatch"; //$NON-NLS-1$
-
- /**
- * Id of the Search result view
- * (value <code>"org.eclipse.search.SearchResultView"</code>).
- */
- public static final String SEARCH_RESULT_VIEW_ID= "org.eclipse.search.SearchResultView"; //$NON-NLS-1$
-
- /**
- * Id of the Search action set
- * (value <code>"org.eclipse.search.searchActionSet"</code>).
- *
- * @since 2.0
- */
- public static final String ACTION_SET_ID= PLUGIN_ID + ".searchActionSet"; //$NON-NLS-1$
-
- /**
- * Activates the search result view in the active page of the
- * active workbench window. This call has no effect (but returns <code>true</code>
- * if the search result view is already activated.
- *
- * @return <code>true</code> if the search result view could be activated
- */
- public static boolean activateSearchResultView() {
- return SearchPlugin.activateSearchResultView();
- }
-
- /**
- * Opens the search dialog.
- * If <code>pageId</code> is specified and a corresponding page
- * is found then it is brought to top.
- *
- * @param pageId the page to select or <code>null</code>
- * if the best fitting page should be selected
- * @since 2.0
- */
- public static void openSearchDialog(IWorkbenchWindow window, String pageId) {
- new OpenSearchDialogAction(window, pageId).run();
- }
-
- /**
- * Returns the search result view of the active page of the
- * active workbench window.
- *
- * @return the search result view or <code>null</code>
- * if there is no active search result view
- */
- public static ISearchResultView getSearchResultView() {
- return SearchPlugin.getSearchResultView();
- }
-
- /**
- * Returns the shared search marker image.
- * Normally, editors show this icon in their vertical ruler.
- * This image is owned by the search UI plug-in and must not be disposed
- * by clients.
- *
- * @return the shared image
- */
- public static Image getSearchMarkerImage() {
- return SearchPluginImages.get(SearchPluginImages.IMG_OBJ_SEARCHMARKER);
- }
-
- /**
- * Returns the preference whether editors should be reused
- * when showing search results.
- *
- * The goto action can decide to use or ignore this preference.
- *
- * @return <code>true</code> if editors should be reused for showing search results
- * @since 2.0
- */
- public static boolean reuseEditor() {
- return SearchPreferencePage.isEditorReused();
- }
-
- /**
- * Returns the preference whether a search engine is
- * allowed to report potential matches or not.
- * <p>
- * Search engines which can report inexact matches must
- * respect this preference i.e. they should not report
- * inexact matches if this method returns <code>true</code>
- * </p>
- * @return <code>true</code> if search engine must not report inexact matches
- * @since 2.1
- */
- public static boolean arePotentialMatchesIgnored() {
- return SearchPreferencePage.arePotentialMatchesIgnored();
- }
-
- /**
- * Returns the ID of the default perspective.
- * <p>
- * The perspective with this ID will be used to show the Search view.
- * If no default perspective is set then the Search view will
- * appear in the current perspective.
- * </p>
- * @return the ID of the default perspective <code>null</code> if no default perspective is set
- * @since 2.1
- */
- public static String getDefaultPerspectiveId() {
- return SearchPreferencePage.getDefaultPerspectiveId();
- }
-
- /**
- * Block instantiation.
- */
- private SearchUI() {
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/package.html b/org.eclipse.search/search/org/eclipse/search/ui/package.html
deleted file mode 100644
index f92908814cb..00000000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/package.html
+++ /dev/null
@@ -1,25 +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.75 [en] (WinNT; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides classes and interfaces for search pages.
-New search dialog pages can be contributed via a plug-in extension point.
-This package provides the interfaces and classes to implement these dialog
-pages and offers hooks to populate the search result view.
-<h2>
-Package Specification</h2>
-Each search dialog page must implement <tt>ISearchPage</tt>. A search page
-has access to its container (<tt>ISearchPageContainer</tt>) to modify search
-dialog properties. The class <tt>SearchUI</tt> can activate the search
-results view and provide access to the active search results view (<tt>ISearchResultView</tt>).
-<p>It is the clients responsibility to create a marker for each match and
-then report the match to the search result view together with a key (<tt>groupByKey</tt>).
-Each key corresponds to a search result view entry (<tt>ISearchResultViewEntry</tt>)
-which allows to step through the markers grouped by the key.
-</body>
-</html>
diff --git a/org.eclipse.text/.classpath b/org.eclipse.text/.classpath
deleted file mode 100644
index f2a7ad8ee11..00000000000
--- a/org.eclipse.text/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="projection"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.text/.cvsignore b/org.eclipse.text/.cvsignore
deleted file mode 100644
index c5e82d74585..00000000000
--- a/org.eclipse.text/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/org.eclipse.text/.project b/org.eclipse.text/.project
deleted file mode 100644
index c4a55eef3bc..00000000000
--- a/org.eclipse.text/.project
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.text</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.runtime.compatibility</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.text/about.html b/org.eclipse.text/about.html
deleted file mode 100644
index 9db411aab99..00000000000
--- a/org.eclipse.text/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 (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). 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, &quot;Program&quot; 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 (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) 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/org.eclipse.text/build.properties b/org.eclipse.text/build.properties
deleted file mode 100644
index 8bcb44e94fa..00000000000
--- a/org.eclipse.text/build.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-bin.includes = plugin.properties,\
- plugin.xml,\
- *.jar,\
- about.html
-source.text.jar = src/,\
- projection/
diff --git a/org.eclipse.text/plugin.properties b/org.eclipse.text/plugin.properties
deleted file mode 100644
index af35084f37d..00000000000
--- a/org.eclipse.text/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= Text
-providerName= Eclipse.org
diff --git a/org.eclipse.text/plugin.xml b/org.eclipse.text/plugin.xml
deleted file mode 100644
index 6ebd1665eb3..00000000000
--- a/org.eclipse.text/plugin.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.text"
- name="%pluginName"
- version="3.0.0"
- provider-name="%providerName">
-
- <runtime>
- <library name="text.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.jface.text,org.eclipse.text.edits"/>
- </library>
- </runtime>
-
- <requires>
- <import plugin="org.eclipse.core.runtime.compatibility" optional="true"/>
- </requires>
-
-</plugin>
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/CoordinatesTranslator.java b/org.eclipse.text/projection/org/eclipse/jface/text/CoordinatesTranslator.java
deleted file mode 100644
index b2b5547a015..00000000000
--- a/org.eclipse.text/projection/org/eclipse/jface/text/CoordinatesTranslator.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-import java.util.Arrays;
-import java.util.Comparator;
-
-/**
- * Implementation of <code>IDocumentInformationMapping</code> matching <code>ProjectionDocument</code> and
- * <code>ProjectionDocumentManager</code>. The parent document is considered the original document, the projection
- * document is considered the image document.<p>
- * This class is for internal use only.
- * @since 2.1
- */
-public class CoordinatesTranslator implements IDocumentInformationMapping {
-
- /** The parent document */
- private IDocument fParentDocument;
- /** The position category used to manage the projected regions of the parent document */
-// private String fParentCategory;
- /** The projection document */
- private ProjectionDocument fProjectionDocument;
- /** The position category to manage the fragments of the projection document. */
-// private String fProjectionCategory;
-
- /**
- * Creates a new mapping between the given parent document and the given projection document.
- *
- * @param parent the parent document
- * @param parentCategory the position category of the parent document used to manage the projected regions
- * @param projection the projection document
- * @param projectionCategory the position category of the projection document used to manage the fragments
- */
- public CoordinatesTranslator(IDocument parent, String parentCategory, ProjectionDocument projection, String projectionCategory) {
- fParentDocument= parent;
-// fParentCategory= parentCategory;
- fProjectionDocument= projection;
-// fProjectionCategory= projectionCategory;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toOriginOffset(int)
- */
- public int toOriginOffset(int imageOffset) throws BadLocationException {
- Fragment fragment= (Fragment) getPositionOfOffset(fProjectionDocument, ProjectionDocument.FRAGMENT_CATEGORY, imageOffset);
- if (fragment == null) {
- if (imageOffset == 0)
- return 0;
- throw new BadLocationException();
- }
-
- int relative= imageOffset - fragment.offset;
- return fragment.getOrigin().offset + relative;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toOriginRegion(org.eclipse.jface.text.IRegion)
- */
- public IRegion toOriginRegion(IRegion imageRegion) throws BadLocationException {
-
- int projectionOffset= imageRegion.getOffset();
- int projectionLength= imageRegion.getLength();
-
- if (projectionLength == 0) {
- if (projectionOffset == 0 && projectionLength == fProjectionDocument.getLength())
- return new Region(0, fParentDocument.getLength());
- return new Region(toOriginOffset(projectionOffset), 0);
- }
-
- int o1= toOriginOffset(projectionOffset);
- int o2= toOriginOffset(projectionOffset + projectionLength -1);
- return new Region(o1, o2 - o1 + 1);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toOriginLines(int)
- */
- public IRegion toOriginLines(int imageLine) throws BadLocationException {
-
- IRegion projectionDocumentRegion= fProjectionDocument.getLineInformation(imageLine);
- IRegion parentDocumentRegion= toOriginRegion(projectionDocumentRegion);
-
- int startLine= fParentDocument.getLineOfOffset(parentDocumentRegion.getOffset());
- if (parentDocumentRegion.getLength() == 0)
- return new Region(startLine, 0);
-
- int endLine= fParentDocument.getLineOfOffset(parentDocumentRegion.getOffset() + parentDocumentRegion.getLength() -1);
- return new Region(startLine, endLine - startLine);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toOriginLine(int)
- */
- public int toOriginLine(int imageLine) throws BadLocationException {
- IRegion lines= toOriginLines(imageLine);
- if (lines.getLength() > 0)
- throw new IllegalStateException();
- return lines.getOffset();
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toImageOffset(int)
- */
- public int toImageOffset(int originOffset) throws BadLocationException {
- ProjectionPosition projection= (ProjectionPosition) getPositionOfOffset(fParentDocument, ProjectionDocumentManager.PROJECTION_DOCUMENTS, originOffset);
- if (projection != null)
- return translateOffset(projection, originOffset, projection.getFragment());
- // not included
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toImageRegion(org.eclipse.jface.text.IRegion)
- */
- public IRegion toImageRegion(IRegion originRegion) throws BadLocationException {
-
- if (originRegion.getLength() == 0) {
- int projectionOffset= toImageOffset(originRegion.getOffset());
- return projectionOffset == -1 ? null : new Region(projectionOffset, 0);
- }
-
- Position[] positions= getPositionsOfRange(fParentDocument, ProjectionDocumentManager.PROJECTION_DOCUMENTS, originRegion, null);
- if (positions != null && positions.length > 0) {
- ProjectionPosition projection= (ProjectionPosition) positions[0];
-
- int offset= originRegion.getOffset();
- int length= originRegion.getLength();
-
- int delta= projection.getOffset() - offset;
- if (delta > 0) {
- offset += delta;
- length -= delta;
- }
- int start= translateOffset(projection, offset, projection.getFragment());
-
- projection= (ProjectionPosition) positions[positions.length -1];
- int decrease= 0;
- int endOffset= offset + length;
- if (length > 0)
- decrease= 1;
- endOffset -= decrease;
-
- delta= endOffset - (projection.getOffset() + Math.max(projection.getLength() -1, 0));
- if (delta > 0)
- endOffset -= delta;
-
- int end= translateOffset(projection, endOffset, projection.getFragment());
- return new Region(start, end - start + decrease);
- }
-
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toImageLine(int)
- */
- public int toImageLine(int originLine) throws BadLocationException {
-
- IRegion parentDocumentRegion= fParentDocument.getLineInformation(originLine);
- IRegion projectionDocumentRegion= toImageRegion(parentDocumentRegion);
- if (projectionDocumentRegion == null)
- return -1;
-
- int startLine= fProjectionDocument.getLineOfOffset(projectionDocumentRegion.getOffset());
- if (projectionDocumentRegion.getLength() == 0)
- return startLine;
-
- int endLine= fProjectionDocument.getLineOfOffset(projectionDocumentRegion.getOffset() + projectionDocumentRegion.getLength() -1);
- if (endLine != startLine)
- throw new IllegalStateException();
-
- return startLine;
- }
-
-
- //-----------------------------------------------------------------------------------------------------------------------------------
-
- /**
- * Translates the given offset relative to the given origin position into an
- * offset relative to the given target position.
- *
- * @param origin the origin position
- * @param originOffset the offset relative to <code>originOffset</code>
- * @param target the target position
- * @return <code>originOffset</code> translated to the given target position
- */
- private int translateOffset(Position origin, int originOffset, Position target) {
- int relative= originOffset - origin.offset;
- return target.offset + relative;
- }
-
- /**
- * Returns the position of the given category of the given document that includes the given offset
- * or <code>null</code> if there is no such position.
- *
- * @param document the document
- * @param category the position category of <code>document</code>
- * @param offset the offset into <code>document</code>
- * @return the position including the given offset or <code>null</code>
- * @throws BadLocationException if <code>offset</code> is not valid in the given document
- */
- private Position getPositionOfOffset(IDocument document, String category, int offset) throws BadLocationException {
- try {
- int index= getPositionIndexOfOffset(document, category, offset, 0);
- if (index > -1) {
- Position[] positions= document.getPositions(category);
- return positions[index];
- }
- } catch (BadPositionCategoryException x) {
- }
- return null;
- }
-
- /**
- * Returns an array of positions of the given category that cover the given range of the document.
- *
- * @param document the document
- * @param category the position category of <code>document</code>
- * @param range the range of <code>document</code>
- * @param comparator the comparator to sort the array to be returned
- * @return an array of positions that cover the given range in the given document
- */
- private Position[] getPositionsOfRange(IDocument document, String category, IRegion range, Comparator comparator) {
-
- int offset= range.getOffset();
- int length= range.getLength();
-
- try {
-
- int start= getPositionIndexOfOffset(document, category, offset, length);
- int end= getPositionIndexOfOffset(document, category, offset + length -1, 1 - length);
-
- if (start > -1 && end > -1) {
-
- Position[] positions= document.getPositions(category);
-
- if (start == end)
- return new Position[] { positions[start] };
-
- Position[] result= new Position[end - start + 1];
- for (int i= start; i <= end; i++)
- result[i - start]= positions[i];
-
- if (comparator != null)
- Arrays.sort(result, comparator);
-
- return result;
- }
-
- } catch (BadPositionCategoryException e) {
- } catch (BadLocationException e) {
- }
-
- return new Position[0];
- }
-
- /**
- * Returns the index of the position of the given category of the given document that includes the
- * given offset. <code>direction</code> indicates the direction into which the algorithm should search.
- *
- * @param document the document
- * @param category the position category of <code>document</code>
- * @param offset the offset into <code>document</code>
- * @param direction the search direction
- * @return the index of the position
- * @throws BadPositionCategoryException if <code>category</code> is not valid in <code>document</code>
- * @throws BadLocationException if <code>offset</code> is not valid in <code>document</code>
- */
- private int getPositionIndexOfOffset(IDocument document, String category, int offset, int direction ) throws BadPositionCategoryException, BadLocationException{
-
- Position[] positions= document.getPositions(category);
- if (positions != null && positions.length > 0) {
-
- // test for inclusion
- int index= document.computeIndexInCategory(category, offset);
- if (index < positions.length && positions[index].includes(offset))
- return index;
- if (index > 0 && positions[index -1].includes(offset))
- return index -1;
-
- // find next accorrding to direction
- if (direction != 0) {
- if (direction > 0) {
- if (index < positions.length && positions[index].overlapsWith(offset, direction))
- return index;
- } else {
- if (index > 0 && positions[index -1].overlapsWith(offset + direction, -direction))
- return index -1;
- }
- }
- }
-
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#getCoverage()
- */
- public IRegion getCoverage() {
- Position coverage= fProjectionDocument.getParentDocumentCoverage();
- return new Region(coverage.getOffset(), coverage.getLength());
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toClosestImageLine(int)
- */
- public int toClosestImageLine(int originLine) throws BadLocationException {
- try {
-
- int modelLineOffset= fParentDocument.getLineOffset(originLine);
- int index= fParentDocument.computeIndexInCategory(ProjectionDocumentManager.PROJECTION_DOCUMENTS, modelLineOffset);
- Position[] projections= fParentDocument.getPositions(ProjectionDocumentManager.PROJECTION_DOCUMENTS);
-
- if (index < projections.length) {
- Position p= projections[index -1];
- int delta1= modelLineOffset - (p.getOffset() + p.getLength());
- p= projections[index];
- int delta2= modelLineOffset - (p.getOffset() + p.getLength());
- if (delta1 < delta2) {
- p= projections[index -1];
- originLine= fParentDocument.getLineOfOffset(p.getOffset() + Math.max(p.getLength() -1, 0));
- } else {
- originLine= fParentDocument.getLineOfOffset(p.getOffset());
- }
- } else if (projections.length > 0) {
- Position p= projections[index -1];
- originLine= fParentDocument.getLineOfOffset(p.getOffset() + Math.max(p.getLength() -1, 0));
- } else {
- return 0;
- }
-
- return toImageLine(originLine);
-
- } catch (BadLocationException x) {
- } catch (BadPositionCategoryException x) {
- }
-
- return 0;
- }
-}
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/Fragment.java b/org.eclipse.text/projection/org/eclipse/jface/text/Fragment.java
deleted file mode 100644
index e33c40a0224..00000000000
--- a/org.eclipse.text/projection/org/eclipse/jface/text/Fragment.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.text;
-
-import org.eclipse.jface.text.Position;
-
-/**
- * Represents a fragment of a <code>ProjectionDocument</code>.<p>
- * This class is for internal use only.
- *
- * @since 2.1
- */
-public class Fragment extends Position {
-
- /** Position representing the corresponding range in the parent document. */
- private Position fOrigin;
-
- /**
- * Creates new position representing a fragment.
- *
- * @param offset the offset of the fragment
- * @param length the length of the fragment
- * @param origin the cooresponding range in the parent document
- */
- public Fragment(int offset, int length, Position origin) {
- super(offset, length);
- fOrigin= origin;
- }
-
- /**
- * Returns the corresponding range in the parent document.
- * @return the corresponding range in the parent document
- */
- public Position getOrigin() {
- return fOrigin;
- }
-
- /**
- * Sets the corresponding range in the parent document.
- * @param origin the cooresponding range in the parent document
- */
- public void setOrigin(Position origin) {
- fOrigin= origin;
- }
-}
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/FragmentUpdater.java b/org.eclipse.text/projection/org/eclipse/jface/text/FragmentUpdater.java
deleted file mode 100644
index e24c8efffc2..00000000000
--- a/org.eclipse.text/projection/org/eclipse/jface/text/FragmentUpdater.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.jface.text;
-
-
-/**
- * The position updater used to adapt the fragments of a projection document to
- * changes of the master document. The updater supports two modes: a shifting mode
- * and a non shifting mode. In the shifting mode the updater behaves identical to the
- * <code>DefaultPositionUpdater</code>. In non shifting mode, if an insertion happens at
- * a fragment's offset, the fragment is extended rather than shifted. Also, the
- * last fragment is extended if an inserte operation happens at the end of the fragment.<p>
- * This class is for internal use only.
- *
- * @since 2.1
- */
-public class FragmentUpdater extends DefaultPositionUpdater {
-
- /** Indicates whether this updater is in shift mode. */
- private boolean fShiftMode= false;
- /** Indicates whether the positon currently being updated represents the last fragment. */
- private boolean fIsLast= false;
-
- /**
- * Creates the fragment updater for the given category.
- *
- * @param fragmentCategory the position category used for managing the fragments of a projection document
- */
- protected FragmentUpdater(String fragmentCategory) {
- super(fragmentCategory);
- }
-
- /**
- * Enables/disables the shift mode of this updater.
- *
- * @param enable <code>true</code> if shift mode should be enabled
- */
- public void enableShiftMode(boolean enable) {
- fShiftMode= enable;
- }
-
- /**
- * If an insertion happens at a fragment's offset, the fragment is extended
- * rather than shifted. Also, the last fragment is extended if an inserte operation
- * happens at the end of the fragment.
- */
- protected void adaptToInsert() {
-
- if (fShiftMode) {
- super.adaptToInsert();
- return;
- }
-
- int myStart= fPosition.offset;
- int myEnd= fPosition.offset + fPosition.length - (fIsLast ? 0 : 1);
- myEnd= Math.max(myStart, myEnd);
-
- int yoursStart= fOffset;
- int yoursEnd= fOffset + fReplaceLength -1;
- yoursEnd= Math.max(yoursStart, yoursEnd);
-
- if (myEnd < yoursStart)
- return;
-
- if (fLength <= 0) {
-
- if (myStart <= yoursStart)
- fPosition.length += fReplaceLength;
- else
- fPosition.offset += fReplaceLength;
-
- } else {
-
- if (myStart <= yoursStart && fOriginalPosition.offset <= yoursStart)
- fPosition.length += fReplaceLength;
- else
- fPosition.offset += fReplaceLength;
- }
- }
-
- /*
- * @see IPositionUpdater#update(DocumentEvent event)
- */
- public void update(DocumentEvent event) {
-
- try {
-
- Position[] category= event.getDocument().getPositions(getCategory());
-
- fOffset= event.getOffset();
- fLength= event.getLength();
- fReplaceLength= (event.getText() == null ? 0 : event.getText().length());
- fDocument= event.getDocument();
-
- for (int i= 0; i < category.length; i++) {
-
- fPosition= category[i];
- fIsLast= (i == category.length -1);
-
- fOriginalPosition.offset= fPosition.offset;
- fOriginalPosition.length= fPosition.length;
-
- if (notDeleted())
- adaptToReplace();
- }
-
- } catch (BadPositionCategoryException x) {
- // do nothing
- }
- }
-}
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionDocument.java b/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionDocument.java
deleted file mode 100644
index 5cd17f7e3d7..00000000000
--- a/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionDocument.java
+++ /dev/null
@@ -1,834 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-import java.util.Arrays;
-import java.util.Comparator;
-
-
-
-/**
- * A <code>ProjectionDocument</code> represents a projection of its master document.
- * The contents of a projection document is a sequence of fragments of the master document, i.e.
- * the projection document can be thought as being constructed from the master document by
- * not copying the whole master document by omitting serveral ranges of the master document. <p>
- * The projection document utilizes its master document as <code>ITextStore</code>.<p>
- * This class if for internal use only.
- *
- * @since 2.1
- */
-public final class ProjectionDocument extends AbstractDocument {
-
- /** The position category used by <code>ProjectionDocument</code>s to manage the fragments they consist of. */
- final public static String FRAGMENT_CATEGORY= "__fragment_category"; //$NON-NLS-1$
-
- /** The parent document */
- private IDocument fParentDocument;
- /** The parent document as document extension */
- private IDocumentExtension fExtension;
- /** The position category defining the projection */
- private String fProjectionCategory;
- /** The document event issued by the parent document */
- private DocumentEvent fParentEvent;
- /** The document event issued and to be issued by the projection document */
- private SlaveDocumentEvent fEvent;
- /** Indicates whether the projection document initiated a parent document update or not */
- private boolean fIsUpdating= false;
- /** The position updater for the positions managing the fragments */
- private FragmentUpdater fFragmentUpdater= new FragmentUpdater(FRAGMENT_CATEGORY);
-
- /**
- * Creates a projection document for the given parent document.
- *
- * @param parentDocument the parent Document
- * @param projectionCategory the document position category whose positions define the projection of the parent document
- */
- public ProjectionDocument(IDocument parentDocument, String projectionCategory) {
- super();
-
- fParentDocument= parentDocument;
- if (fParentDocument instanceof IDocumentExtension)
- fExtension= (IDocumentExtension) fParentDocument;
-
- ITextStore s= new ProjectionTextStore(this);
- ILineTracker tracker= new DefaultLineTracker();
-
- setTextStore(s);
- setLineTracker(tracker);
-
- completeInitialization();
-
- initializeProjection(projectionCategory);
- tracker.set(s.get(0, s.getLength()));
- }
-
- /**
- * Initializes the projection document from the parent document based on the given projection category.
- *
- * @param projectionCategory the document position category whose positions define the projection of the parent document
- */
- private void initializeProjection(String projectionCategory) {
-
- fProjectionCategory= projectionCategory;
-
- try {
-
- addPositionCategory(FRAGMENT_CATEGORY);
- addPositionUpdater(fFragmentUpdater);
-
- int offset= 0;
- Position[] patch= fParentDocument.getPositions(fProjectionCategory);
- for (int i= 0; i < patch.length; i++) {
- Position p= patch[i];
- addPosition(FRAGMENT_CATEGORY, new Fragment(offset, p.length, p));
- offset += p.length;
- }
-
- } catch (BadPositionCategoryException x) {
- } catch (BadLocationException x) {
- }
- }
-
- /**
- * Creates a fragment from a postion of the parent document.
- *
- * @param parentPosition a position of the parent document
- * @return the fragment representing the range given by the parent position
- */
- public Fragment createFragment(Position parentPosition) {
- try {
-
- int index= fParentDocument.computeIndexInCategory(fProjectionCategory, parentPosition.offset);
- if (index <= 0)
- return new Fragment(0, parentPosition.length, parentPosition);
-
- Position[] fragments= getPositions(FRAGMENT_CATEGORY);
- Position p= fragments[index -1];
- return new Fragment(p.offset + p.length, parentPosition.length, parentPosition);
-
- } catch (BadPositionCategoryException e) {
- } catch (BadLocationException e) {
- }
-
- return null;
- }
-
- /**
- * Returns the index of the position of the given category of the given document that includes the
- * given offset. <code>direction</code> indicates the direction into which the algorithm should search.
- *
- * @param document the document
- * @param category the position category of <code>document</code>
- * @param offset the offset into <code>document</code>
- * @param direction the search direction
- * @return the index of the position
- * @throws BadPositionCategoryException if <code>category</code> is not valid in <code>document</code>
- * @throws BadLocationException if <code>offset</code> is not valid in <code>document</code>
- */
- private int getPositionOfOffset(IDocument document, String category, int offset, int direction ) throws BadPositionCategoryException, BadLocationException{
-
- Position[] positions= document.getPositions(category);
- if (positions != null && positions.length > 0) {
-
- // test for inclusion
- int index= document.computeIndexInCategory(category, offset);
- if (index < positions.length && positions[index].includes(offset))
- return index;
- if (index > 0 && positions[index -1].includes(offset))
- return index -1;
-
- // find next accorrding to direction
- if (direction != 0) {
- if (direction > 0) {
- if (index < positions.length && positions[index].overlapsWith(offset, direction))
- return index;
- } else {
- if (index > 0 && positions[index -1].overlapsWith(offset + direction, -direction))
- return index -1;
- }
- }
- }
-
- return -1;
- }
-
- /**
- * Returns the position which is used to manage a parent
- * document range represented in this projection document and that
- * includes or is close to the given parent document offset. The distance
- * is computed based on the given direction hint.
- *
- * @param offsetInParent the parent document offset
- * @param direction the direction hint used for computing the distance
- * @return position the parent document position including or near to the parent document offset
- */
- private Position getParentDocumentPositionOfOffset(int offsetInParent, int direction ) {
- try {
-
- int index= getPositionOfOffset(fParentDocument, fProjectionCategory, offsetInParent, direction);
- if (index > -1) {
- Position[] positions= fParentDocument.getPositions(fProjectionCategory);
- return positions[index];
- }
-
- } catch (BadPositionCategoryException x) {
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
- /**
- * Returns the offset in the projection document corresponding to the
- * given parent document offset.
- *
- * @param offsetInParent the parent document offset
- * @return the projection document offset corresponding to the given parent document offset
- */
- private int toProjectionDocumentOffset(int offsetInParent, int direction) {
-
- Position p= getParentDocumentPositionOfOffset(offsetInParent, direction);
- if (p == null)
- return -1;
-
- int relative= offsetInParent - p.offset;
-
- if (direction > 0) {
- if (relative < 0)
- relative= 0;
- } else if (direction < 0) {
- if (relative >= p.length)
- relative= p.length -1;
- }
-
- Fragment f= findCorrespondingFragment(p);
- return f.offset + relative;
- }
-
- /**
- * Creates a position describing the projection document range corresponding to
- * the given parent document range.
- *
- * @param offsetInParent the parent document offset
- * @param lengthInParent the parent document lengh
- * @return position describing the projection document range corresponding to the given parent document range
- */
- public Position computeProjectionDocumentPosition(int offsetInParent, int lengthInParent) {
-
- Position p= getParentDocumentCoverage();
- if (p != null) {
-
- if (p.overlapsWith(offsetInParent, lengthInParent)) {
-
- int o1= toProjectionDocumentOffset(offsetInParent, lengthInParent);
- if (o1 == -1)
- return null;
-
- if (lengthInParent == 0)
- return new Position(o1, 0);
-
- int o2= toProjectionDocumentOffset(offsetInParent + lengthInParent -1, 1 - lengthInParent);
- if (o2 == -1)
- return null;
-
- return new Position(o1, o2 - o1 + 1);
-
- } else if (p.getOffset() + p.getLength() == offsetInParent + lengthInParent) {
-
- Position[] fragments= getFragmentation();
- if (fragments != null && fragments.length > 0) {
- Position last= fragments[fragments.length -1];
- return new Position(last.getOffset() + last.getLength());
- }
- }
- }
-
- return null;
- }
-
- /**
- * Returns the offset in the parent document that corresponds to the given offset in this
- * projection document.
- *
- * @param offset the offset in the projection document
- * @return the corresponding parent document offset
- * @throws BadLocationException if <code>offset</code> is not valid in this projection document
- */
- public int toParentDocumentOffset(int offset) throws BadLocationException {
- Fragment fragment= getFragmentOfOffset(offset);
-
- if (fragment == null) {
-
-// if (offset == 0)
-// return 0;
-// throw new BadLocationException();
-
- Position[] fragmentation= getFragmentation();
- if (fragmentation != null && fragmentation.length > 0) {
- Fragment last= (Fragment) fragmentation[fragmentation.length -1];
- if (last.offset + last.length == offset) {
- Position origin= last.getOrigin();
- return origin.offset + origin.length;
- }
- }
-
- throw new BadLocationException();
- }
-
- int relative= offset - fragment.offset;
- return fragment.getOrigin().offset + relative;
- }
-
- /**
- * Computes and returns the region of the parent document that corresponds to the given region of the
- * projection document.
- *
- * @param offset the offset of the projection document region
- * @param length the length of the projection document region
- * @return the corresponding region of the parent document
- * @throws BadLocationException if the given projection document region is not valid
- */
- public IRegion computeParentDocumentRegion(int offset, int length) throws BadLocationException {
-
- if (length == 0) {
- if (offset == 0 && length == getLength())
- return new Region(0, fParentDocument.getLength());
- return new Region(toParentDocumentOffset(offset), 0);
- }
-
- int o1= toParentDocumentOffset(offset);
- int o2= toParentDocumentOffset(offset + length -1);
- return new Region(o1, o2 - o1 + 1);
- }
-
- /**
- * Removes all fragments and thereby clears this projection document.
- */
- public void removeAllFragments() {
- Position[] projection= getProjection();
- if (projection == null)
- return;
-
- for (int i= 0; i < projection.length; i++) {
- try {
- removeFragment(projection[i]);
- } catch (BadLocationException e) {
- }
- }
- }
-
- /**
- * Add a new fragment of the parent document to this projection document.
- *
- * @param offsetInParent offset of the parent document range
- * @param lengthInParent length of the parent document range
- * @return returns the position representing the parent document range in this projection document
- * @throws BadLocationException
- */
- public void addFragment(int offsetInParent, int lengthInParent) throws BadLocationException {
-
- if (lengthInParent == 0)
- return;
-
- try {
-
- ProjectionPosition p= new ProjectionPosition(this, offsetInParent, lengthInParent);
- fParentDocument.addPosition(fProjectionCategory, p);
-
- Fragment fragment= createFragment(p);
- p.setFragment(fragment);
- fireDocumentProjectionChanged(new DocumentEvent(this, fragment.offset, 0, fParentDocument.get(offsetInParent, lengthInParent)));
- addPosition(FRAGMENT_CATEGORY, fragment);
-
-
- getTracker().set(getStore().get(0, getStore().getLength()));
-
- } catch (BadPositionCategoryException x) {
- }
-
- }
-
- /**
- * Joins all fragments that represent neighboring regions in the parent document.
- */
- public void joinFragments() {
- try {
- while (joinTwoFragments()) {}
- } catch (BadPositionCategoryException x) {
- }
- }
-
- /**
- * Joins the first two fragments that represent neighboring regions of the parent document.
- * @return <code>true</code> if two segments have been joined, <code>false</code> otherwise
- * @throws BadPositionCategoryException
- */
- private boolean joinTwoFragments() throws BadPositionCategoryException {
- Position[] projection= getProjection();
- if (projection != null && projection.length > 0) {
- Position previous= projection[0];
- for (int i= 1; i < projection.length; i++) {
- Position current= projection[i];
- if (previous.offset + previous.length == current.offset) {
- join(previous, current);
- return true;
- }
- previous= current;
- }
- }
- return false;
- }
-
- /**
- * Joins the fragments of this projection document that correspond to the two given,
- * neighboring ranges of the parent document.
- *
- * @param p1 lower range in the parent document
- * @param p2 higher range of the parent document
- * @throws BadPositionCategoryException if the fragment position category is not defined in this projection document
- */
- private void join(Position p1, Position p2) throws BadPositionCategoryException {
- // remove p2
- Fragment fragment= findCorrespondingFragment(p2);
- removePosition(FRAGMENT_CATEGORY, fragment);
- fParentDocument.removePosition(fProjectionCategory, p2);
- // extend p1 by length of p2
- fragment= findCorrespondingFragment(p1);
- fragment.length += p2.length;
- p1.length += p2.length;
- }
-
- /**
- * Removes the fragment that corresponds to the given parent document range.
- *
- * @param parentPosition the position representing the parent document range
- * @throws BadLocationException if the fragment position category is not defined in this projection document
- */
- public void removeFragment(Position parentPosition) throws BadLocationException {
- try {
-
- Fragment fragment= findCorrespondingFragment(parentPosition);
- if (fragment != null) {
- removePosition(FRAGMENT_CATEGORY, fragment);
- fParentDocument.removePosition(fProjectionCategory, parentPosition);
- fireDocumentProjectionChanged(new DocumentEvent(this, fragment.offset, fragment.length, null));
- getTracker().set(getStore().get(0, getStore().getLength()));
- }
-
- } catch (BadPositionCategoryException x) {
- }
- }
-
- /**
- * Returns the list of fragments whose corresponding ranges in the parent document overlap with
- * the specifed range of the parent document.
- *
- * @param offsetInParent the offset of the parent document range
- * @param lengthInParent the length of the parent document range
- * @return the list of affected fragments
- */
- public Position[] getAffectedFragments(int offsetInParent, int lengthInParent) {
-
- Position p= computeProjectionDocumentPosition(offsetInParent, lengthInParent);
- if (p == null)
- return null;
-
- Fragment[] f= getFragmentsOfRange(p.offset, p.length);
- if (f == null)
- return null;
-
- Position[] result= new Position[f.length];
- for (int i= 0; i < f.length; i++)
- result[i]= f[i].getOrigin();
- return result;
- }
-
- /**
- * Finds the fragment that represents the given parent document range in this projection document.
- *
- * @param parentPosition the parent document range
- * @return the fragment representing the given parent document range
- */
- private Fragment findCorrespondingFragment(Position parentPosition) {
- try {
- Position[] fragments= getPositions(FRAGMENT_CATEGORY);
- for (int i= 0; i < fragments.length; i++) {
- Fragment f= (Fragment) fragments[i];
- if (parentPosition.equals(f.getOrigin()))
- return f;
- }
- } catch (BadPositionCategoryException x) {
- }
-
- return null;
- }
-
- /**
- * Returns the fragment that contains the given offset.
- *
- * @param offset the offset
- * @return the fragment that contains the given offset
- * @throws BadLocationException if <code>offset</code> is not a valid offset
- */
- protected Fragment getFragmentOfOffset(int offset) throws BadLocationException {
- try {
- int index= getPositionOfOffset(this, FRAGMENT_CATEGORY, offset, 0);
- if (index > -1) {
- Position[] fragments= getPositions(FRAGMENT_CATEGORY);
- return (Fragment) fragments[index];
- }
- } catch (BadPositionCategoryException x) {
- }
- return null;
- }
-
- /**
- * Returns the minimal consecutive list of fragments that completely covers the given range.
- *
- * @param offset the offset of the range
- * @param length the length of the range
- * @return the minimal consecutive list of fragments convering the given range
- */
- protected Fragment[] getFragmentsOfRange(int offset, int length) {
-
- try {
-
- int start= getPositionOfOffset(this, FRAGMENT_CATEGORY, offset, length);
- int end= getPositionOfOffset(this, FRAGMENT_CATEGORY, offset + length -1, 1 - length);
-
- if (start > -1 && end > -1) {
-
- Position[] positions= getPositions(FRAGMENT_CATEGORY);
-
- if (start == end)
- return new Fragment[] { (Fragment) positions[start] };
-
- Fragment[] result= new Fragment[end - start + 1];
- for (int i= start; i <= end; i++)
- result[i - start]= (Fragment) positions[i];
- sortFragments(result);
- return result;
- }
-
- } catch (BadPositionCategoryException e) {
- } catch (BadLocationException e) {
- }
-
- return new Fragment[0];
- }
-
- /**
- * Sorts a list of fragments based on the offsets of their corresponding ranges in the parent document.
- *
- * @param result the list for fragments
- */
- private void sortFragments(Object[] result) {
-
- Comparator comparator= new Comparator() {
-
- public int compare(Object o1, Object o2) {
- Fragment f1= (Fragment) o1;
- Fragment f2= (Fragment) o2;
- return f1.getOrigin().getOffset() - f2.getOrigin().getOffset();
- }
-
- public boolean equals(Object obj) {
- return false;
- }
- };
-
- Arrays.sort(result, comparator);
- }
-
- /**
- * Returns the minimal range of the parent document that covers all ranges that
- * correspond to the fragments of this projection document.
- *
- * @return a position describing the minimal parent document range covering all fragments
- */
- public Position getParentDocumentCoverage() {
- Position[] projection= getProjection();
- if (projection != null && projection.length > 0) {
- Position first=projection[0];
- Position last= projection[projection.length -1];
- return new Position(first.offset, last.offset - first.offset + last.length);
- }
- return new Position(0, 0);
- }
-
- /**
- * The projection of the parent document has been changed by inserting or removing
- * new fragments into this projection document. The projection change is described in
- * the given <code>DocumentEvent</code>. All positions managed by this projection
- * document must be adapted accordingly.
- *
- * @param event the document event
- */
- private void fireDocumentProjectionChanged(DocumentEvent event) {
- fFragmentUpdater.enableShiftMode(true);
- try {
- updatePositions(event);
- } finally {
- fFragmentUpdater.enableShiftMode(false);
- }
- }
-
- /**
- * Returns parent document.
- *
- * @return the parent document
- */
- public IDocument getParentDocument() {
- return fParentDocument;
- }
-
- /**
- * Returns the ranges of the parent document that correspond to the fragments of this
- * projection document.
- *
- * @return the ranges of the parent document corresponding to the fragments
- */
- public Position[] getProjection() {
- try {
- return fParentDocument.getPositions(fProjectionCategory);
- } catch (BadPositionCategoryException x) {
- }
- return null;
- }
-
- /**
- * Returns the list of all fragments of this projection document.
- *
- * @return the list of all fragments of this projection document
- */
- public Position[] getFragmentation() {
- try {
-
- Position[] fragmentation= getPositions(FRAGMENT_CATEGORY);
- sortFragments(fragmentation);
- return fragmentation;
-
- } catch (BadPositionCategoryException x) {
- }
- return null;
- }
-
- /**
- * Transforms a document event of the parent document into a projection document
- * based document event.
- *
- * @param e the parent document event
- * @return the slave document event
- */
- private SlaveDocumentEvent normalize(DocumentEvent e) {
-
- Position c= computeProjectionDocumentPosition(e.getOffset(), e.getLength());
-
- if (c != null) {
- if (c.length == 0) {
- int insertLength= e.getText() == null ? 0 : e.getText().length();
- if (insertLength == 0)
- return null;
- }
- return new SlaveDocumentEvent(this, c.offset, c.length, e.getText(), e);
- }
-
- return null;
- }
-
- /**
- * When called, this projection document is informed about a forthcoming change
- * of its parent document. This projection document checks whether the parent
- * document change affects it and if so informs all document listeners.
- *
- * @param event the parent document event
- */
- public void parentDocumentAboutToBeChanged(DocumentEvent event) {
- fParentEvent= event;
- fEvent= normalize(event);
- if (fEvent != null)
- delayedFireDocumentAboutToBeChanged();
- }
-
- /**
- * When called, this projection document is informed about a change of its parent document.
- * If this projection document is affected it informs all of its document listeners.
- *
- * @param event the parent document event
- */
- public void parentDocumentChanged(DocumentEvent event) {
- if ( !fIsUpdating && event == fParentEvent && fEvent != null) {
- try {
- getTracker().replace(fEvent.getOffset(), fEvent.getLength(), fEvent.getText());
- fireDocumentChanged(fEvent);
- } catch (BadLocationException x) {
- Assert.isLegal(false);
- }
- }
- }
-
- /*
- * @see AbstractDocument#fireDocumentAboutToBeChanged(DocumentEvent)
- */
- protected void fireDocumentAboutToBeChanged(DocumentEvent event) {
- // delay it until there is a notification from the parent document
- // otherwise there it is expensive to construct the parent document information
- }
-
- /**
- * Fires the slave document event as about-to-be-changed event to all registed listeners.
- */
- private void delayedFireDocumentAboutToBeChanged() {
- super.fireDocumentAboutToBeChanged(fEvent);
- }
-
- /**
- * Ignores the given event and sends the semantically equal slave document event instead.
- *
- * @param event the event to be ignored
- */
- protected void fireDocumentChanged(DocumentEvent event) {
- super.fireDocumentChanged(fEvent);
- }
-
- /*
- * @see IDocument#replace(int, int, String)
- */
- public void replace(int offset, int length, String text) throws BadLocationException {
- try {
- fIsUpdating= true;
- if (fExtension != null)
- fExtension.stopPostNotificationProcessing();
-
- super.replace(offset, length, text);
-
- } finally {
- fIsUpdating= false;
- if (fExtension != null)
- fExtension.resumePostNotificationProcessing();
- }
- }
-
- /*
- * @see IDocument#set(String)
- */
- public void set(String text) {
- try {
- fIsUpdating= true;
- if (fExtension != null)
- fExtension.stopPostNotificationProcessing();
-
- super.set(text);
-
- } finally {
- fIsUpdating= false;
- if (fExtension != null)
- fExtension.resumePostNotificationProcessing();
- }
- }
-
- /*
- * @see IDocumentExtension#registerPostNotificationReplace(IDocumentListener, IDocumentExtension.IReplace)
- */
- public void registerPostNotificationReplace(IDocumentListener owner, IDocumentExtension.IReplace replace) {
- if (!fIsUpdating)
- throw new UnsupportedOperationException();
- super.registerPostNotificationReplace(owner, replace);
- }
-
-
- /**
- * Convenience method for removing and adapting the fragments whose corresponding
- * ranges in the parent document are included or overlap with the given range of the
- * parent document.
- *
- * @param offsetInParent the offset of the parent document range
- * @param lengthInParent the length of the parent document range
- */
- public void hide(int offsetInParent, int lengthInParent) {
-
- IDocument parent= getParentDocument();
- Position[] effected= getAffectedFragments(offsetInParent, lengthInParent);
-
- try {
-
- if (effected == null) {
- // populate new document with two new fragments, the left and the right of the hidden region
- int end= offsetInParent + lengthInParent;
- addFragment(0, offsetInParent);
- addFragment(end, parent.getLength() - end);
- } else if (effected.length == 1) {
- // the only affected fragment must be splitted into two
- Position fragment= effected[0];
- removeFragment(fragment);
- addFragment(fragment.offset, offsetInParent - fragment.offset);
- int secondOffset= offsetInParent + lengthInParent;
- addFragment(secondOffset, fragment.offset + fragment.length - secondOffset);
- } else {
- // first expand and than collapse
- internalShow(offsetInParent, lengthInParent, effected);
- hide(offsetInParent, lengthInParent);
- }
-
- joinFragments();
-
- } catch (BadLocationException x) {
- }
- }
-
- /**
- * Convenience method for adding fragments or adapting existing fragments so that their corresponding
- * ranges in the parent document include the given range of the parent document.
- *
- * @param offsetInParent the offset of the parent document range
- * @param lengthInParent the length of the parent document range
- */
- public void show(int offsetInParent, int lengthInParent) {
-
- Position[] effected= getAffectedFragments(offsetInParent, lengthInParent);
- if (effected == null || effected.length == 0) {
- try {
- addFragment(offsetInParent, lengthInParent);
- joinFragments();
- } catch (BadLocationException x) {
- }
- return;
- }
-
- internalShow(offsetInParent, lengthInParent, effected);
- joinFragments();
-
- }
-
- /**
- * Removes the given fragments and inserts a new fragment whose parent document
- * range corresponds the given range of the parent document.
- *
- * @param offsetInParent the offset of the parent document range
- * @param lengthInParent the length of the parent document range
- * @param effected the list for fragments to be removed
- */
- private void internalShow(int offsetInParent, int lengthInParent, Position[] effected) {
- try {
-
- int size= effected.length;
- for (int i= 0; i < size; i++)
- removeFragment(effected[i]);
-
- int offset= Math.min(offsetInParent, effected[0].offset);
- int end= Math.max(offsetInParent + lengthInParent, effected[size -1].offset + effected[size -1].length);
- addFragment(offset, end - offset);
-
- } catch (BadLocationException x) {
- }
- }
-}
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionDocumentManager.java b/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionDocumentManager.java
deleted file mode 100644
index 51d825d6359..00000000000
--- a/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionDocumentManager.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.jface.text;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-
-
-/**
- * <code>ProjectionDocumentManager</code> is one particular implementation of
- * <code>ISlaveDocumentManager</code>. This manager creates so called projection
- * documents as slave documents for given master documents.<p>
- *
- * A projection document represents a particular projection of the parent
- * document and is accordingly adapted to changes of the parent document.
- * Vice versa, the parent document is accordingly adapted to changes of
- * its child documents. The manager does not maintain any particular management
- * structure but utilizes mechanisms given by <code>IDocument</code> such
- * as position categories and position updaters. <p>
- * This class if for internal use only.
- *
- * @since 2.1
- */
-public final class ProjectionDocumentManager implements IDocumentListener, ISlaveDocumentManager {
-
-
- /**
- * Name of the position category used to keep track of the parent document
- * ranges that correspond to the fragments of the projection documents.
- */
- public final static String PROJECTION_DOCUMENTS= "__projectiondocuments"; //$NON-NLS-1$
-
-
-// static class ProjectionDocumentPartitioner implements IDocumentPartitioner {
-//
-// protected ProjectionDocument fProjectionDocument;
-// protected IDocument fParentDocument;
-//
-// protected ProjectionDocumentPartitioner() {
-// }
-//
-// /*
-// * @see IDocumentPartitioner#getPartition(int)
-// */
-// public ITypedRegion getPartition(int offset) {
-// try {
-// offset += fProjectionDocument.getParentDocumentRange().getOffset();
-// return fParentDocument.getPartition(offset);
-// } catch (BadLocationException x) {
-// }
-//
-// return null;
-// }
-//
-// /*
-// * @see IDocumentPartitioner#computePartitioning(int, int)
-// */
-// public ITypedRegion[] computePartitioning(int offset, int length) {
-// try {
-// offset += fProjectionDocument.getParentDocumentRange().getOffset();
-// return fParentDocument.computePartitioning(offset, length);
-// } catch (BadLocationException x) {
-// }
-//
-// return null;
-// }
-//
-// /*
-// * @see IDocumentPartitioner#getContentType(int)
-// */
-// public String getContentType(int offset) {
-// try {
-// offset += fProjectionDocument.getParentDocumentRange().getOffset();
-// return fParentDocument.getContentType(offset);
-// } catch (BadLocationException x) {
-// }
-//
-// return null;
-// }
-//
-// /*
-// * @see IDocumentPartitioner#getLegalContentTypes()
-// */
-// public String[] getLegalContentTypes() {
-// return fParentDocument.getLegalContentTypes();
-// }
-//
-// /*
-// * @see IDocumentPartitioner#documentChanged(DocumentEvent)
-// */
-// public boolean documentChanged(DocumentEvent event) {
-// // ignore as the parent does this for us
-// return false;
-// }
-//
-// /*
-// * @see IDocumentPartitioner#documentAboutToBeChanged(DocumentEvent)
-// */
-// public void documentAboutToBeChanged(DocumentEvent event) {
-// // ignore as the parent does this for us
-// }
-//
-// /*
-// * @see IDocumentPartitioner#disconnect()
-// */
-// public void disconnect() {
-// fProjectionDocument= null;
-// fParentDocument= null;
-// }
-//
-// /*
-// * @see IDocumentPartitioner#connect(IDocument)
-// */
-// public void connect(IDocument childDocument) {
-// Assert.isTrue(childDocument instanceof ProjectionDocument);
-// fProjectionDocument= (ProjectionDocument) childDocument;
-// fParentDocument= fProjectionDocument.getParentDocument();
-// }
-// };
-
-
-
- /** The position updater shared by all master documents which have projection documents */
- private IPositionUpdater fProjectionPositionUpdater;
- /** Registry for master documents and their projection documents. */
- private Map fRegistar= new HashMap();
-
-
- /**
- * Returns the projection position updater. If necessary, it is dynamically created.
- *
- * @return the child position updater
- */
- protected IPositionUpdater getProjectionPositionUpdater() {
- if (fProjectionPositionUpdater == null)
- fProjectionPositionUpdater= new FragmentUpdater(PROJECTION_DOCUMENTS);
- return fProjectionPositionUpdater;
- }
-
- /**
- * Registers the given projection document for the given master document.
- *
- * @param parent the master document
- * @param projection the projection document
- */
- private void add(IDocument parent, ProjectionDocument projection) {
- List list= (List) fRegistar.get(parent);
- if (list == null) {
- list= new ArrayList(1);
- fRegistar.put(parent, list);
- }
- list.add(projection);
- }
-
- /**
- * Unregisters the given projection document from its master.
- *
- * @param parent the master document
- * @param projection the projection document
- */
- private void remove(IDocument parent, ProjectionDocument projection) {
- List list= (List) fRegistar.get(parent);
- if (list != null) {
- list.remove(projection);
- if (list.size() == 0)
- fRegistar.remove(parent);
- }
- }
-
- /**
- * Returns whether the given document is a master document.
- *
- * @param parent the document
- * @return <code>true</code> if the given document is a master document known to this manager
- */
- private boolean hasProjection(IDocument parent) {
- return (fRegistar.get(parent) instanceof List);
- }
-
- /**
- * Returns an iterator enumerating all projection documents registered for the given document or
- * <code>null</code> if the document is not a known master document.
- *
- * @param parent the document
- * @return an iterator for all registered projection documents or <code>null</code>
- */
- private Iterator getProjectionsIterator(IDocument parent) {
- List list= (List) fRegistar.get(parent);
- if (list != null)
- return list.iterator();
- return null;
- }
-
- /**
- * Informs all projection documents of the master document that issued the given document event.
- *
- * @param about indicates whether the change is about to happen or alread happend
- * @param event the document event which will be processed to inform the projection documents
- */
- protected void fireDocumentEvent(boolean about, DocumentEvent event) {
- IDocument parent= event.getDocument();
- Iterator e= getProjectionsIterator(parent);
- if (e == null)
- return;
-
- while (e.hasNext()) {
- ProjectionDocument document= (ProjectionDocument) e.next();
- if (about)
- document.parentDocumentAboutToBeChanged(event);
- else
- document.parentDocumentChanged(event);
- }
- }
-
- /*
- * @see IDocumentListener#documentChanged(DocumentEvent)
- */
- public void documentChanged(DocumentEvent event) {
- fireDocumentEvent(false, event);
- }
-
- /*
- * @see IDocumentListener#documentAboutToBeChanged(DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- fireDocumentEvent(true, event);
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#createMasterSlaveMapping(org.eclipse.jface.text.IDocument)
- */
- public IDocumentInformationMapping createMasterSlaveMapping(IDocument slave) {
- if (slave instanceof ProjectionDocument) {
- ProjectionDocument projectionDocument= (ProjectionDocument) slave;
- return new CoordinatesTranslator(projectionDocument.getParentDocument(), PROJECTION_DOCUMENTS, projectionDocument, ProjectionDocument.FRAGMENT_CATEGORY);
- }
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#createSlaveDocument(org.eclipse.jface.text.IDocument)
- */
- public IDocument createSlaveDocument(IDocument master) {
- if (!master.containsPositionCategory(PROJECTION_DOCUMENTS)) {
- master.addPositionCategory(PROJECTION_DOCUMENTS);
- master.addPositionUpdater(getProjectionPositionUpdater());
- master.addDocumentListener(this);
- }
-
- ProjectionDocument slave= new ProjectionDocument(master, PROJECTION_DOCUMENTS);
-// IDocumentPartitioner partitioner= new ProjectionDocumentPartitioner();
-// slave.setDocumentPartitioner(partitioner);
-// partitioner.connect(master);
-
- add(master, slave);
- return slave;
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#freeSlaveDocument(org.eclipse.jface.text.IDocument)
- */
- public void freeSlaveDocument(IDocument slave) {
-
- if ( !(slave instanceof ProjectionDocument))
- return;
-
- ProjectionDocument projectionDocument= (ProjectionDocument) slave;
-
-// projectionDocument.getDocumentPartitioner().disconnect();
-
- IDocument parent= projectionDocument.getParentDocument();
- remove(parent, projectionDocument);
-
- try {
- if (!hasProjection(parent)) {
- parent.removeDocumentListener(this);
- parent.removePositionUpdater(getProjectionPositionUpdater());
- parent.removePositionCategory(PROJECTION_DOCUMENTS);
- }
- } catch (BadPositionCategoryException x) {
- }
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#getMasterDocument(org.eclipse.jface.text.IDocument)
- */
- public IDocument getMasterDocument(IDocument slave) {
- if (slave instanceof ProjectionDocument)
- return ((ProjectionDocument) slave).getParentDocument();
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#isSlaveDocument(org.eclipse.jface.text.IDocument)
- */
- public boolean isSlaveDocument(IDocument document) {
- return (document instanceof ProjectionDocument);
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#setAutoExpandMode(org.eclipse.jface.text.IDocument, boolean)
- */
- public void setAutoExpandMode(IDocument slave, boolean autoExpand) {
- // TODO
- }
-}
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionPosition.java b/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionPosition.java
deleted file mode 100644
index 30fca736574..00000000000
--- a/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionPosition.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.jface.text;
-
-/**
- * Represents the corresponding parent document range of a fragment of a <code>ProjectionDocument</code>.<p>
- * This calss is for internal use only.
- *
- * @since 2.1
- */
-public class ProjectionPosition extends Position {
-
- /** The projection document. */
-// private IDocument fProjectionDocument;
- /** The corresponding fragment. */
- private Fragment fFragment;
-
- /**
- * Creates a new position representing the corresponding range of a fragment.
- *
- * @param projectionDocument the projection document
- * @param offset the offset of the range of the parent document
- * @param length the length of the range of the parent document
- */
- public ProjectionPosition(IDocument projectionDocument, int offset, int length) {
- super(offset, length);
-// fProjectionDocument= projectionDocument;
- }
-
- /**
- * Sets the corresponding fragment.
- *
- * @param fragment the corresponding fragment
- */
- public void setFragment(Fragment fragment) {
- fFragment= fragment;
- }
-
- /**
- * Returns the corresponding fragment.
- * @return the corresponding fragment
- */
- public Fragment getFragment() {
- return fFragment;
- }
-
-// /**
-// * Changed to be compatible to the position updater behavior
-// * @see Position#overlapsWith(int, int)
-// */
-// public boolean overlapsWith(int offset, int length) {
-// boolean append= (offset == this.offset + this.length) && length == 0;
-// return append || super.overlapsWith(offset, length);
-// }
-}
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionPositionUpdater.java b/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionPositionUpdater.java
deleted file mode 100644
index 310e9066054..00000000000
--- a/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionPositionUpdater.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-import org.eclipse.jface.text.DefaultPositionUpdater;
-
-/**
- * The position updater used to adapt the positions corresponding to the fragments of
- * projection documents. The startegy of this updater differs from the
- * <code>DefaultPositionUpdater</code>. If an insertion happens at a start offset of a
- * range corresponding to a fragment, the range is extended rather than shifted. Also, if
- * text is added right behind the end of such a range, the range is extended rather than
- * kept stable.<p>
- * This class is for internal use only.
- *
- * @since 2.1
- */
-public class ProjectionPositionUpdater extends DefaultPositionUpdater {
-
- /**
- * Creates the position updater for the given category.
- *
- * @param category the category used to manage the positions representing the ranges corresponding to fragments
- */
- protected ProjectionPositionUpdater(String category) {
- super(category);
- }
-
- /**
- * Projection document ranges cannot be deleted other then by calling
- * <code>ProjectionDocumentManager#removeFragment</code>.
- * @return <code>true</code>
- */
- protected boolean notDeleted() {
- return true;
- }
-
- /**
- * If an insertion happens at a start offset of a
- * range corresponding to a fragment, the range is extended rather than shifted. Also, if
- * text is added right behind the end of such a range, the range is extended rather than
- * kept stable.
- */
- protected void adaptToInsert() {
-
- int myStart= fPosition.offset;
- int myEnd= fPosition.offset + fPosition.length;
- myEnd= Math.max(myStart, myEnd);
-
- int yoursStart= fOffset;
- int yoursEnd= fOffset + fReplaceLength -1;
- yoursEnd= Math.max(yoursStart, yoursEnd);
-
- if (myEnd < yoursStart)
- return;
-
- if (myStart <= yoursStart)
- fPosition.length += fReplaceLength;
- else
- fPosition.offset += fReplaceLength;
- }
-}
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionTextStore.java b/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionTextStore.java
deleted file mode 100644
index 288010c4aff..00000000000
--- a/org.eclipse.text/projection/org/eclipse/jface/text/ProjectionTextStore.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-
-/**
- * The text store of a <code>ProjectionDocument</code>. Implements the projection onto
- * the master document.<p>
- * This class is for internal use only.
- *
- * @since 2.1
- */
-public class ProjectionTextStore implements ITextStore {
-
- /** The projection document */
- private ProjectionDocument fProjectionDocument;
-
- /**
- * Creates a new projection text store for the given projection document.
- *
- * @param projectionDocument the projection document
- */
- public ProjectionTextStore(ProjectionDocument projectionDocument) {
- fProjectionDocument= projectionDocument;
- }
-
- /**
- * Computes the offset in the parent document that corresponds to the given offset.
- *
- * @param offset the offset
- * @return the corresponding parent document offset
- */
- private int computeParentDocumentOffset(int offset) {
- try {
- return fProjectionDocument.toParentDocumentOffset(offset);
- } catch (BadLocationException x) {
- throw new RuntimeException();
- }
- }
-
- /*
- * @see ITextStore#set(String)
- */
- public void set(String contents) {
-
- try {
-
- Position[] projection= fProjectionDocument.getProjection();
- if (projection != null && projection.length > 0) {
- Position first=projection[0];
- Position last= projection[projection.length -1];
- int length= last.offset - first.offset + last.length;
- getParentDocument().replace(first.getOffset(), length, contents);
- } else {
- getParentDocument().set(contents);
- }
-
- } catch (BadLocationException x) {
- }
- }
-
- /*
- * @see ITextStore#replace(int, int, String)
- */
- public void replace(int offset, int length, String text) {
-
- try {
-
- int endoffset= length > 0 ? offset + length -1 : offset;
- int o2= computeParentDocumentOffset(endoffset);
- if (length > 0)
- ++ o2;
-
- offset= computeParentDocumentOffset(offset);
- length= o2 - offset;
-
- getParentDocument().replace(offset, length, text);
-
- } catch (BadLocationException x) {
- // ignored as surrounding document should have handled this
- }
- }
-
- /*
- * @see ITextStore#getLength()
- */
- public int getLength() {
- Position[] projection= fProjectionDocument.getProjection();
- if (projection == null || projection.length == 0)
- return 0;
-
- int length= 0;
- for (int i= 0; i < projection.length; i++)
- length += projection[i].length;
- return length;
- }
-
- /*
- * @see ITextStore#get(int, int)
- */
- public String get(int offset, int length) {
- try {
-
- Fragment[] fragments= fProjectionDocument.getFragmentsOfRange(offset, length);
- if (fragments == null || fragments.length == 0)
- return ""; //$NON-NLS-1$
-
- StringBuffer buffer= new StringBuffer();
- for (int i= 0; i < fragments.length; i++) {
- Position p= fragments[i].getOrigin();
- buffer.append(getParentDocument().get(p.offset, p.length));
- }
-
- offset -= fragments[0].offset;
- return buffer.substring(offset, offset + length);
-
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
- /**
- * Returns the parent document of the store's document.
- *
- * @return the parent document of the store's document
- */
- private IDocument getParentDocument() {
- return fProjectionDocument.getParentDocument();
- }
-
- /*
- * @see ITextStore#get(int)
- */
- public char get(int offset) {
- try {
- int o= computeParentDocumentOffset(offset);
- return getParentDocument().getChar(o);
- } catch (BadLocationException x) {
- }
-
- return (char) 0;
- }
-}
diff --git a/org.eclipse.text/scripts/exportplugin.xml b/org.eclipse.text/scripts/exportplugin.xml
deleted file mode 100644
index 335b97039e6..00000000000
--- a/org.eclipse.text/scripts/exportplugin.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<project name="Export Text" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.text" />
- <property name="version" value="_3.0.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}/text.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <zip zipfile="${dest}/textsrc.zip">
- <fileset dir="src" />
- <fileset dir="projection"/>
- </zip>
- </target>
-</project>
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java b/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
deleted file mode 100644
index 1e426e73fee..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
+++ /dev/null
@@ -1,1285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.PatternSyntaxException;
-
-
-/**
- * Abstract implementation of <code>IDocument</code>.
- * Implements the complete contract of <code>IDocument</code>, <code>IDocumentExtension</code>,
- * and <code>IDocumentExtension2</code>.<p>
- *
- * An <code>AbstractDocument</code> supports the following implementation plug-ins:
- * <ul>
- * <li> a text store for storing and managing the document's content,
- * <li> a line tracker to map character positions to line numbers and vice versa
- * </ul>
- * The document can dynamically change the text store when switching between
- * sequential rewrite mode and normal mode.<p>
- *
- * This class must be subclassed. Subclasses must configure which implementation
- * plug-ins the document should use. Subclasses are not intended to overwrite existing methods.
- *
- * @see IDocument
- * @see ITextStore
- * @see ILineTracker
- */
-public abstract class AbstractDocument implements IDocument, IDocumentExtension, IDocumentExtension2, IDocumentExtension3, IRepairableDocument {
-
- /**
- * Inner class to bundle a registered post notification replace operation together with its
- * owner.
- *
- * @since 2.0
- */
- static private class RegisteredReplace {
- /** The owner of this replace operation. */
- IDocumentListener fOwner;
- /** The replace operation */
- IDocumentExtension.IReplace fReplace;
-
- /**
- * Creates a new bundle object.
- * @param owner the document listener owning the replace operation
- * @param replace the replace operation
- */
- RegisteredReplace(IDocumentListener owner, IDocumentExtension.IReplace replace) {
- fOwner= owner;
- fReplace= replace;
- }
- }
-
-
- /** The document's text store */
- private ITextStore fStore;
- /** The document's line tracker */
- private ILineTracker fTracker;
- /** The registered document listeners */
- private List fDocumentListeners;
- /** The registered prenotified document listeners */
- private List fPrenotifiedDocumentListeners;
- /** The registered document partitioning listeners */
- private List fDocumentPartitioningListeners;
- /** All positions managed by the document */
- private Map fPositions;
- /** All registered document position updaters */
- private List fPositionUpdaters;
- /**
- * The list of post notification changes
- * @since 2.0
- */
- private List fPostNotificationChanges;
- /**
- * The reentrance count for post notification changes.
- * @since 2.0
- */
- private int fReentranceCount= 0;
- /**
- * Indicates whether post notification change processing has been stopped.
- * @since 2.0
- */
- private int fStoppedCount= 0;
- /**
- * Indicates whether the registration of post notification changes should be
- * ignored.
- * @since 2.1
- */
- private boolean fAcceptPostNotificationReplaces= true;
- /**
- * Indicates whether the notification of listeners has been stopped.
- * @since 2.1
- */
- private int fStoppedListenerNotification= 0;
- /**
- * The document event to be sent after listener notification has been resumed.
- * @since 2.1
- */
- private DocumentEvent fDeferredDocumentEvent;
- /**
- * The registered document partitioners.
- * @since 3.0
- */
- private Map fDocumentPartitioners;
- /**
- * The partitioning changed event.
- * @since 3.0
- */
- private DocumentPartitioningChangedEvent fDocumentPartitioningChangedEvent;
- /**
- * The find/replace document adapter.
- * @since 3.0
- */
- private FindReplaceDocumentAdapter fFindReplaceDocumentAdapter;
-
-
- /**
- * The default constructor does not perform any configuration
- * but leaves it to the clients who must first initialize the
- * implementation plug-ins and then call <code>completeInitialization</code>.
- * Results in the construction of an empty document.
- */
- protected AbstractDocument() {
- }
-
-
- //--- accessor to fields -------------------------------
-
- /**
- * Returns the document's text store. Assumes that the
- * document has been initialized with a text store.
- *
- * @return the document's text store
- */
- protected ITextStore getStore() {
- Assert.isNotNull(fStore);
- return fStore;
- }
-
- /**
- * Returns the document's line tracker. Assumes that the
- * document has been initialized with a line tracker.
- *
- * @return the document's line tracker
- */
- protected ILineTracker getTracker() {
- Assert.isNotNull(fTracker);
- return fTracker;
- }
-
- /**
- * Returns the document's document listeners.
- *
- * @return the document's document listeners
- */
- protected List getDocumentListeners() {
- return fDocumentListeners;
- }
-
- /**
- * Returns the document's partitioning listeners .
- *
- * @return the document's partitioning listeners
- */
- protected List getDocumentPartitioningListeners() {
- return fDocumentPartitioningListeners;
- }
-
- /**
- * Returns all positions managed by the document grouped by category.
- *
- * @return the document's positions
- */
- protected Map getDocumentManagedPositions() {
- return fPositions;
- }
-
- /*
- * @see IDocument#getDocumentPartitioner
- */
- public IDocumentPartitioner getDocumentPartitioner() {
- return getDocumentPartitioner(DEFAULT_PARTITIONING);
- }
-
-
-
- //--- implementation configuration interface ------------
-
- /**
- * Sets the document's text store.
- * Must be called at the beginning of the constructor.
- *
- * @param store the document's text store
- */
- protected void setTextStore(ITextStore store) {
- fStore= store;
- }
-
- /**
- * Sets the document's line tracker.
- * Must be called at the beginnng of the constructor.
- *
- * @param tracker the document's line tracker
- */
- protected void setLineTracker(ILineTracker tracker) {
- fTracker= tracker;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#setDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner)
- */
- public void setDocumentPartitioner(IDocumentPartitioner partitioner) {
- setDocumentPartitioner(DEFAULT_PARTITIONING, partitioner);
- }
-
- /**
- * Initializes document listeners, positions, and position updaters.
- * Must be called inside the constructor after the implementation plug-ins
- * have been set.
- */
- protected void completeInitialization() {
-
- fPositions= new HashMap();
- fPositionUpdaters= new ArrayList();
- fDocumentListeners= new ArrayList();
- fPrenotifiedDocumentListeners= new ArrayList();
- fDocumentPartitioningListeners= new ArrayList();
-
- addPositionCategory(DEFAULT_CATEGORY);
- addPositionUpdater(new DefaultPositionUpdater(DEFAULT_CATEGORY));
- }
-
-
- //-------------------------------------------------------
-
- /*
- * @see org.eclipse.jface.text.IDocument#addDocumentListener(org.eclipse.jface.text.IDocumentListener)
- */
- public void addDocumentListener(IDocumentListener listener) {
- Assert.isNotNull(listener);
- if (! fDocumentListeners.contains(listener))
- fDocumentListeners.add(listener);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#removeDocumentListener(org.eclipse.jface.text.IDocumentListener)
- */
- public void removeDocumentListener(IDocumentListener listener) {
- Assert.isNotNull(listener);
- fDocumentListeners.remove(listener);
- }
-
- /*
- * @see IDocument#addPrenotifiedDocumentListener(IDocumentListener)
- */
- public void addPrenotifiedDocumentListener(IDocumentListener listener) {
- Assert.isNotNull(listener);
- if (! fPrenotifiedDocumentListeners.contains(listener))
- fPrenotifiedDocumentListeners.add(listener);
- }
-
- /*
- * @see IDocument#removePrenotifiedDocumentListener(IDocumentListener)
- */
- public void removePrenotifiedDocumentListener(IDocumentListener listener) {
- Assert.isNotNull(listener);
- fPrenotifiedDocumentListeners.remove(listener);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#addDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener)
- */
- public void addDocumentPartitioningListener(IDocumentPartitioningListener listener) {
- Assert.isNotNull(listener);
- if (! fDocumentPartitioningListeners.contains(listener))
- fDocumentPartitioningListeners.add(listener);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#removeDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener)
- */
- public void removeDocumentPartitioningListener(IDocumentPartitioningListener listener) {
- Assert.isNotNull(listener);
- fDocumentPartitioningListeners.remove(listener);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#addPosition(java.lang.String, org.eclipse.jface.text.Position)
- */
- public void addPosition(String category, Position position) throws BadLocationException, BadPositionCategoryException {
-
- if ((0 > position.offset) || (0 > position.length) || (position.offset + position.length > getLength()))
- throw new BadLocationException();
-
- if (category == null)
- throw new BadPositionCategoryException();
-
- List list= (List) fPositions.get(category);
- if (list == null)
- throw new BadPositionCategoryException();
-
- list.add(computeIndexInPositionList(list, position.offset), position);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#addPosition(org.eclipse.jface.text.Position)
- */
- public void addPosition(Position position) throws BadLocationException {
- try {
- addPosition(DEFAULT_CATEGORY, position);
- } catch (BadPositionCategoryException e) {
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#addPositionCategory(java.lang.String)
- */
- public void addPositionCategory(String category) {
-
- if (category == null)
- return;
-
- if (!containsPositionCategory(category))
- fPositions.put(category, new ArrayList());
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#addPositionUpdater(org.eclipse.jface.text.IPositionUpdater)
- */
- public void addPositionUpdater(IPositionUpdater updater) {
- insertPositionUpdater(updater, fPositionUpdaters.size());
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#containsPosition(java.lang.String, int, int)
- */
- public boolean containsPosition(String category, int offset, int length) {
-
- if (category == null)
- return false;
-
- List list= (List) fPositions.get(category);
- if (list == null)
- return false;
-
- int size= list.size();
- if (size == 0)
- return false;
-
- int index= computeIndexInPositionList(list, offset);
- if (index < size) {
- Position p= (Position) list.get(index);
- while (p != null && p.offset == offset) {
- if (p.length == length)
- return true;
- ++ index;
- p= (index < size) ? (Position) list.get(index) : null;
- }
- }
-
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#containsPositionCategory(java.lang.String)
- */
- public boolean containsPositionCategory(String category) {
- if (category != null)
- return fPositions.containsKey(category);
- return false;
- }
-
-
- /**
- * Computes the index in the list of positions at which a position with the given
- * offset would be inserted. The position is supposed to become the first in this list
- * of all positions with the same offset.
- *
- * @param positions the list in which the index is computed
- * @param offset the offset for which the index is computed
- * @return the computed index
- *
- * @see IDocument#computeIndexInCategory(String, int)
- */
- protected int computeIndexInPositionList(List positions, int offset) {
-
- if (positions.size() == 0)
- return 0;
-
- int left= 0;
- int right= positions.size() -1;
- int mid= 0;
- Position p= null;
-
- while (left < right) {
-
- mid= (left + right) / 2;
-
- p= (Position) positions.get(mid);
- if (offset < p.getOffset()) {
- if (left == mid)
- right= left;
- else
- right= mid -1;
- } else if (offset > p.getOffset()) {
- if (right == mid)
- left= right;
- else
- left= mid +1;
- } else if (offset == p.getOffset()) {
- left= right= mid;
- }
-
- }
-
- int pos= left;
- p= (Position) positions.get(pos);
- if (offset > p.getOffset()) {
- // append to the end
- pos++;
- } else {
- // entry will became the first of all entries with the same offset
- do {
- --pos;
- if (pos < 0)
- break;
- p= (Position) positions.get(pos);
- } while (offset == p.getOffset());
- ++pos;
- }
-
- Assert.isTrue(0 <= pos && pos <= positions.size());
-
- return pos;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#computeIndexInCategory(java.lang.String, int)
- */
- public int computeIndexInCategory(String category, int offset) throws BadLocationException, BadPositionCategoryException {
-
- if (0 > offset || offset > getLength())
- throw new BadLocationException();
-
- List c= (List) fPositions.get(category);
- if (c == null)
- throw new BadPositionCategoryException();
-
- return computeIndexInPositionList(c, offset);
- }
-
- /**
- * Fires the document partitioning changed notification to all registered
- * document partitioning listeners. Uses a robust iterator.
- *
- * @deprecated use <code>fireDocumentPartitioningChanged(IRegion)</code> instead
- */
- protected void fireDocumentPartitioningChanged() {
-
- if (fDocumentPartitioningListeners != null && fDocumentPartitioningListeners.size() > 0) {
-
- List list= new ArrayList(fDocumentPartitioningListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IDocumentPartitioningListener l= (IDocumentPartitioningListener) e.next();
- l.documentPartitioningChanged(this);
- }
- }
- }
-
- /**
- * Fires the document partitioning changed notification to all registered
- * document partitioning listeners. Uses a robust iterator.
- *
- * @param region the region in which partitioning has changed
- *
- * @see IDocumentPartitioningListenerExtension
- * @since 2.0
- * @deprecated use <code>fireDocumentPartitioningChanged(DocumentPartitioningChangedEvent)</code> instead
- */
- protected void fireDocumentPartitioningChanged(IRegion region) {
-
- if (fDocumentPartitioningListeners != null && fDocumentPartitioningListeners.size() > 0) {
-
- List list= new ArrayList(fDocumentPartitioningListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IDocumentPartitioningListener l= (IDocumentPartitioningListener) e.next();
- if (l instanceof IDocumentPartitioningListenerExtension)
- ((IDocumentPartitioningListenerExtension) l).documentPartitioningChanged(this, region);
- else
- l.documentPartitioningChanged(this);
- }
- }
- }
-
- /**
- * Fires the document partitioning changed notification to all registered
- * document partitioning listeners. Uses a robust iterator.
- *
- * @param event the document partitioning changed event
- *
- * @see IDocumentPartitioningListenerExtension2
- * @since 3.0
- */
- protected void fireDocumentPartitioningChanged(DocumentPartitioningChangedEvent event) {
- if (fDocumentPartitioningListeners == null || fDocumentPartitioningListeners.size() == 0)
- return;
-
- List list= new ArrayList(fDocumentPartitioningListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IDocumentPartitioningListener l= (IDocumentPartitioningListener) e.next();
- if (l instanceof IDocumentPartitioningListenerExtension2) {
- IDocumentPartitioningListenerExtension2 extension2= (IDocumentPartitioningListenerExtension2) l;
- extension2.documentPartitioningChanged(event);
- } else if (l instanceof IDocumentPartitioningListenerExtension) {
- IDocumentPartitioningListenerExtension extension= (IDocumentPartitioningListenerExtension) l;
- extension.documentPartitioningChanged(this, event.getCoverage());
- } else {
- l.documentPartitioningChanged(this);
- }
- }
-
- }
-
- /**
- * Fires the given document event to all registers document listeners informing them
- * about the forthcoming document manipulation. Uses a robust iterator.
- *
- * @param event the event to be sent out
- */
- protected void fireDocumentAboutToBeChanged(DocumentEvent event) {
-
- // IDocumentExtension
- if (fReentranceCount == 0)
- flushPostNotificationChanges();
-
- if (fDocumentPartitioners != null) {
- Iterator e= fDocumentPartitioners.values().iterator();
- while (e.hasNext()) {
- IDocumentPartitioner p= (IDocumentPartitioner) e.next();
- p.documentAboutToBeChanged(event);
- }
- }
-
- if (fPrenotifiedDocumentListeners.size() > 0) {
-
- List list= new ArrayList(fPrenotifiedDocumentListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IDocumentListener l= (IDocumentListener) e.next();
- l.documentAboutToBeChanged(event);
- }
- }
-
- if (fDocumentListeners.size() > 0) {
-
- List list= new ArrayList(fDocumentListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IDocumentListener l= (IDocumentListener) e.next();
- l.documentAboutToBeChanged(event);
- }
- }
- }
-
-
- /**
- * Updates document partitioning and document positions according to the
- * specification given by the document event.
- *
- * @param event the document event describing the change to which structures must be adapted
- */
- protected void updateDocumentStructures(DocumentEvent event) {
-
- if (fDocumentPartitioners != null) {
- fDocumentPartitioningChangedEvent= new DocumentPartitioningChangedEvent(this);
- Iterator e= fDocumentPartitioners.keySet().iterator();
- while (e.hasNext()) {
- String partitioning= (String) e.next();
- IDocumentPartitioner partitioner= (IDocumentPartitioner) fDocumentPartitioners.get(partitioning);
- if (partitioner instanceof IDocumentPartitionerExtension) {
- IDocumentPartitionerExtension extension= (IDocumentPartitionerExtension) partitioner;
- IRegion r= extension.documentChanged2(event);
- if (r != null)
- fDocumentPartitioningChangedEvent.setPartitionChange(partitioning, r.getOffset(), r.getLength());
- } else {
- if (partitioner.documentChanged(event))
- fDocumentPartitioningChangedEvent.setPartitionChange(partitioning, 0, event.getDocument().getLength());
- }
- }
- }
-
- if (fPositions.size() > 0)
- updatePositions(event);
- }
-
- /**
- * Notifies all listeners about the given document change.
- * Uses a robust iterator. <p>
- * Executes all registered post notification replace operation.
- *
- * @param event the event to be sent out.
- */
- protected void doFireDocumentChanged(DocumentEvent event) {
- boolean changed= fDocumentPartitioningChangedEvent != null && !fDocumentPartitioningChangedEvent.isEmpty();
- IRegion change= changed ? fDocumentPartitioningChangedEvent.getCoverage() : null;
- doFireDocumentChanged(event, changed, change);
- }
-
- /**
- * Notifies all listeners about the given document change.
- * Uses a robust iterator. <p>
- * Executes all registered post notification replace operation.
- *
- * @param event the event to be sent out
- * @param firePartitionChange <code>true</code> if a partition change notification should be sent
- * @param partitionChange the region whose partitioning changed
- * @since 2.0
- * @deprecated use doFireDocumentChanged2(DocumentEvent) instead; this method will be removed
- */
- protected void doFireDocumentChanged(DocumentEvent event, boolean firePartitionChange, IRegion partitionChange) {
- doFireDocumentChanged2(event);
- }
-
- /**
- * Notifies all listeners about the given document change.
- * Uses a robust iterator. <p>
- * Executes all registered post notification replace operation.
- *
- * @param event the event to be sent out
- * @since 3.0
- * @deprecated this method will be renamed to <code>doFireDocumentChanged</code>
- */
- protected void doFireDocumentChanged2(DocumentEvent event) {
-
- DocumentPartitioningChangedEvent p= fDocumentPartitioningChangedEvent;
- fDocumentPartitioningChangedEvent= null;
- if (p != null && !p.isEmpty())
- fireDocumentPartitioningChanged(p);
-
- if (fPrenotifiedDocumentListeners.size() > 0) {
-
- List list= new ArrayList(fPrenotifiedDocumentListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IDocumentListener l= (IDocumentListener) e.next();
- l.documentChanged(event);
- }
- }
-
- if (fDocumentListeners.size() > 0) {
-
- List list= new ArrayList(fDocumentListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IDocumentListener l= (IDocumentListener) e.next();
- l.documentChanged(event);
- }
- }
-
- // IDocumentExtension
- ++ fReentranceCount;
- try {
- if (fReentranceCount == 1)
- executePostNotificationChanges();
- } finally {
- -- fReentranceCount;
- }
- }
-
- /**
- * Updates the internal document structures and informs all document listeners
- * if listener notification has been enabled. Otherwise it remembers the event
- * to be sent to the listeners on resume.
- *
- * @param event the document event to be sent out
- */
- protected void fireDocumentChanged(DocumentEvent event) {
- updateDocumentStructures(event);
-
- if (fStoppedListenerNotification == 0)
- doFireDocumentChanged(event);
- else
- fDeferredDocumentEvent= event;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#getChar(int)
- */
- public char getChar(int pos) throws BadLocationException {
- if ((0 > pos) || (pos >= getLength()))
- throw new BadLocationException();
- return getStore().get(pos);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#getContentType(int)
- */
- public String getContentType(int offset) throws BadLocationException {
- String contentType= null;
- try {
- contentType= getContentType(DEFAULT_PARTITIONING, offset);
- Assert.isNotNull(contentType);
- } catch (BadPartitioningException e) {
- Assert.isTrue(false);
- }
- return contentType;
- }
-
- /*
- * @see IDocument#getLegalContentTypes()
- */
- public String[] getLegalContentTypes() {
- String[] contentTypes= null;
- try {
- contentTypes= getLegalContentTypes(DEFAULT_PARTITIONING);
- Assert.isNotNull(contentTypes);
- } catch (BadPartitioningException e) {
- Assert.isTrue(false);
- }
- return contentTypes;
- }
-
- /*
- * @see IDocument#getLength()
- */
- public int getLength() {
- return getStore().getLength();
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#getLineDelimiter(int)
- */
- public String getLineDelimiter(int line) throws BadLocationException {
- return getTracker().getLineDelimiter(line);
- }
-
- /*
- * @see IDocument#getLegalLineDelimiters()
- */
- public String[] getLegalLineDelimiters() {
- return getTracker().getLegalLineDelimiters();
- }
-
- /*
- * @see IDocument#getLineLength(int)
- */
- public int getLineLength(int line) throws BadLocationException {
- return getTracker().getLineLength(line);
- }
-
- /*
- * @see IDocument#getLineOfOffset(int)
- */
- public int getLineOfOffset(int pos) throws BadLocationException {
- return getTracker().getLineNumberOfOffset(pos);
- }
-
- /*
- * @see IDocument#getLineOffset(int)
- */
- public int getLineOffset(int line) throws BadLocationException {
- return getTracker().getLineOffset(line);
- }
-
- /*
- * @see IDocument#getLineInformation(int)
- */
- public IRegion getLineInformation(int line) throws BadLocationException {
- return getTracker().getLineInformation(line);
- }
-
- /*
- * @see IDocument#getLineInformationOfOffset(int)
- */
- public IRegion getLineInformationOfOffset(int offset) throws BadLocationException {
- return getTracker().getLineInformationOfOffset(offset);
- }
-
- /*
- * @see IDocument#getNumberOfLines()
- */
- public int getNumberOfLines() {
- return getTracker().getNumberOfLines();
- }
-
- /*
- * @see IDocument#getNumberOfLines(int, int)
- */
- public int getNumberOfLines(int offset, int length) throws BadLocationException {
- return getTracker().getNumberOfLines(offset, length);
- }
-
- /*
- * @see IDocument#computeNumberOfLines(String)
- */
- public int computeNumberOfLines(String text) {
- return getTracker().computeNumberOfLines(text);
- }
-
- /*
- * @see IDocument#getPartition(int)
- */
- public ITypedRegion getPartition(int offset) throws BadLocationException {
- ITypedRegion partition= null;
- try {
- partition= getPartition(DEFAULT_PARTITIONING, offset);
- Assert.isNotNull(partition);
- } catch (BadPartitioningException e) {
- Assert.isTrue(false);
- }
- return partition;
- }
-
- /*
- * @see IDocument#computePartitioning(int, int)
- */
- public ITypedRegion[] computePartitioning(int offset, int length) throws BadLocationException {
- ITypedRegion[] partitioning= null;
- try {
- partitioning= computePartitioning(DEFAULT_PARTITIONING, offset, length);
- Assert.isNotNull(partitioning);
- } catch (BadPartitioningException e) {
- Assert.isTrue(false);
- }
- return partitioning;
- }
-
- /*
- * @see IDocument#getPositions(String)
- */
- public Position[] getPositions(String category) throws BadPositionCategoryException {
-
- if (category == null)
- throw new BadPositionCategoryException();
-
- List c= (List) fPositions.get(category);
- if (c == null)
- throw new BadPositionCategoryException();
-
- Position[] positions= new Position[c.size()];
- c.toArray(positions);
- return positions;
- }
-
- /*
- * @see IDocument#getPositionCategories()
- */
- public String[] getPositionCategories() {
- String[] categories= new String[fPositions.size()];
- Iterator keys= fPositions.keySet().iterator();
- for (int i= 0; i < categories.length; i++)
- categories[i]= (String) keys.next();
- return categories;
- }
-
- /*
- * @see IDocument#getPositionUpdaters()
- */
- public IPositionUpdater[] getPositionUpdaters() {
- IPositionUpdater[] updaters= new IPositionUpdater[fPositionUpdaters.size()];
- fPositionUpdaters.toArray(updaters);
- return updaters;
- }
-
- /*
- * @see IDocument#get()
- */
- public String get() {
- return getStore().get(0, getLength());
- }
-
- /*
- * @see IDocument#get(int, int)
- */
- public String get(int pos, int length) throws BadLocationException {
- int myLength= getLength();
- if ((0 > pos) || (0 > length) || (pos + length > myLength))
- throw new BadLocationException();
- return getStore().get(pos, length);
- }
-
- /*
- * @see IDocument#insertPositionUpdater(IPositionUpdater, int)
- */
- public void insertPositionUpdater(IPositionUpdater updater, int index) {
-
- for (int i= fPositionUpdaters.size() - 1; i >= 0; i--) {
- if (fPositionUpdaters.get(i) == updater)
- return;
- }
-
- if (index == fPositionUpdaters.size())
- fPositionUpdaters.add(updater);
- else
- fPositionUpdaters.add(index, updater);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#removePosition(java.lang.String, org.eclipse.jface.text.Position)
- */
- public void removePosition(String category, Position position) throws BadPositionCategoryException {
-
- if (position == null)
- return;
-
- if (category == null)
- throw new BadPositionCategoryException();
-
- List c= (List) fPositions.get(category);
- if (c == null)
- throw new BadPositionCategoryException();
-
- // remove based on identity not equality
- int size= c.size();
- for (int i= 0; i < size; i++) {
- if (position == c.get(i)) {
- c.remove(i);
- return;
- }
- }
- }
-
- /*
- * @see IDocument#removePosition(Position)
- */
- public void removePosition(Position position) {
- try {
- removePosition(DEFAULT_CATEGORY, position);
- } catch (BadPositionCategoryException e) {
- }
- }
-
- /*
- * @see IDocument#removePositionCategory(String)
- */
- public void removePositionCategory(String category) throws BadPositionCategoryException {
-
- if (category == null)
- return;
-
- if ( !containsPositionCategory(category))
- throw new BadPositionCategoryException();
-
- fPositions.remove(category);
- }
-
- /*
- * @see IDocument#removePositionUpdater(IPositionUpdater)
- */
- public void removePositionUpdater(IPositionUpdater updater) {
- for (int i= fPositionUpdaters.size() - 1; i >= 0; i--) {
- if (fPositionUpdaters.get(i) == updater) {
- fPositionUpdaters.remove(i);
- return;
- }
- }
- }
-
- /*
- * @see IDocument#replace(int, int, String)
- */
- public void replace(int pos, int length, String text) throws BadLocationException {
- if ((0 > pos) || (0 > length) || (pos + length > getLength()))
- throw new BadLocationException();
-
- DocumentEvent e= new DocumentEvent(this, pos, length, text);
- fireDocumentAboutToBeChanged(e);
-
- getStore().replace(pos, length, text);
- getTracker().replace(pos, length, text);
-
- fireDocumentChanged(e);
- }
-
- /*
- * @see IDocument#set(String)
- */
- public void set(String text) {
- int length= getStore().getLength();
- DocumentEvent e= new DocumentEvent(this, 0, length, text);
- fireDocumentAboutToBeChanged(e);
-
- getStore().set(text);
- getTracker().set(text);
-
- fireDocumentChanged(e);
- }
-
- /**
- * Updates all positions of all categories to the change
- * described by the document event. All registered document
- * updaters are called in the sequence they have been arranged.
- * Uses a robust iterator.
- *
- * @param event the document event describing the change to which to adapt the positions
- */
- protected void updatePositions(DocumentEvent event) {
- List list= new ArrayList(fPositionUpdaters);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IPositionUpdater u= (IPositionUpdater) e.next();
- u.update(event);
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IDocument#search(int, java.lang.String, boolean, boolean, boolean)
- */
- public int search(int startPosition, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord) throws BadLocationException {
- try {
- IRegion region= getFindReplaceDocumentAdapter().search(startPosition, findString, forwardSearch, caseSensitive, wholeWord, false);
- if (region == null)
- return -1;
- else
- return region.getOffset();
- } catch (IllegalStateException ex) {
- return -1;
- } catch (PatternSyntaxException ex) {
- return -1;
- }
- }
-
- /**
- * Returns the find/replace adapter for this document.
- *
- * @return this document's find/replace document adapter
- * @since 3.0
- */
- private FindReplaceDocumentAdapter getFindReplaceDocumentAdapter() {
- if (fFindReplaceDocumentAdapter == null)
- fFindReplaceDocumentAdapter= new FindReplaceDocumentAdapter(this);
-
- return fFindReplaceDocumentAdapter;
- }
-
- /**
- * Flushes all registered post notification changes.
- *
- * @since 2.0
- */
- private void flushPostNotificationChanges() {
- if (fPostNotificationChanges != null)
- fPostNotificationChanges.clear();
- }
-
- /**
- * Executes all registered post notification changes. The process is
- * repeated until no new post notification changes are added.
- *
- * @since 2.0
- */
- private void executePostNotificationChanges() {
-
- if (fStoppedCount > 0)
- return;
-
- while (fPostNotificationChanges != null) {
- List changes= fPostNotificationChanges;
- fPostNotificationChanges= null;
-
- Iterator e= changes.iterator();
- while (e.hasNext()) {
- RegisteredReplace replace = (RegisteredReplace) e.next();
- replace.fReplace.perform(this, replace.fOwner);
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentExtension2#acceptPostNotificationReplaces()
- * @since 2.1
- */
- public void acceptPostNotificationReplaces() {
- fAcceptPostNotificationReplaces= true;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentExtension2#ignorePostNotificationReplaces()
- * @since 2.1
- */
- public void ignorePostNotificationReplaces() {
- fAcceptPostNotificationReplaces= false;
- }
-
- /*
- * @see IDocumentExtension#registerPostNotificationReplace(IDocumentListener, IDocumentExtension.IReplace)
- * @since 2.0
- */
- public void registerPostNotificationReplace(IDocumentListener owner, IDocumentExtension.IReplace replace) {
- if (fAcceptPostNotificationReplaces) {
- if (fPostNotificationChanges == null)
- fPostNotificationChanges= new ArrayList(1);
- fPostNotificationChanges.add(new RegisteredReplace(owner, replace));
- }
- }
-
- /*
- * @see IDocumentExtension#stopPostNotificationProcessing()
- * @since 2.0
- */
- public void stopPostNotificationProcessing() {
- ++ fStoppedCount;
- }
-
- /*
- * @see IDocumentExtension#resumePostNotificationProcessing()
- * @since 2.0
- */
- public void resumePostNotificationProcessing() {
- -- fStoppedCount;
- if (fStoppedCount == 0 && fReentranceCount == 0)
- executePostNotificationChanges();
- }
-
- /*
- * @see IDocumentExtension#startSequentialRewrite(boolean)
- * @since 2.0
- */
- public void startSequentialRewrite(boolean normalized) {
- }
-
- /*
- * @see IDocumentExtension#stopSequentialRewrite()
- * @since 2.0
- */
- public void stopSequentialRewrite() {
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentExtension2#resumeListenerNotification()
- * @since 2.1
- */
- public void resumeListenerNotification() {
- -- fStoppedListenerNotification;
- if (fStoppedListenerNotification == 0) {
- resumeDocumentListenerNotification();
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentExtension2#stopListenerNotification()
- * @since 2.1
- */
- public void stopListenerNotification() {
- ++ fStoppedListenerNotification;
- }
-
- /**
- * Resumes the document listener notification by sending out the remembered
- * partition changed and document event.
- *
- * @since 2.1
- */
- private void resumeDocumentListenerNotification() {
- if (fDeferredDocumentEvent != null) {
- DocumentEvent event= fDeferredDocumentEvent;
- fDeferredDocumentEvent= null;
- doFireDocumentChanged(event);
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentExtension3#computePartitioning(java.lang.String, int, int)
- * @since 3.0
- */
- public ITypedRegion[] computePartitioning(String partitioning, int offset, int length) throws BadLocationException, BadPartitioningException {
- if ((0 > offset) || (0 > length) || (offset + length > getLength()))
- throw new BadLocationException();
- IDocumentPartitioner partitioner= getDocumentPartitioner(partitioning);
- if (partitioner != null)
- return partitioner.computePartitioning(offset, length);
- if (DEFAULT_PARTITIONING.equals(partitioning))
- return new TypedRegion[] { new TypedRegion(offset, length, DEFAULT_CONTENT_TYPE) };
- throw new BadPartitioningException();
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentExtension3#getContentType(java.lang.String, int)
- * @since 3.0
- */
- public String getContentType(String partitioning, int offset) throws BadLocationException, BadPartitioningException {
- if ((0 > offset) || (offset > getLength()))
- throw new BadLocationException();
- IDocumentPartitioner partitioner= getDocumentPartitioner(partitioning);
- if (partitioner != null)
- return partitioner.getContentType(offset);
- if (DEFAULT_PARTITIONING.equals(partitioning))
- return DEFAULT_CONTENT_TYPE;
- throw new BadPartitioningException();
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentExtension3#getDocumentPartitioner(java.lang.String)
- * @since 3.0
- */
- public IDocumentPartitioner getDocumentPartitioner(String partitioning) {
- return fDocumentPartitioners != null ? (IDocumentPartitioner) fDocumentPartitioners.get(partitioning) : null;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentExtension3#getLegalContentTypes(java.lang.String)
- * @since 3.0
- */
- public String[] getLegalContentTypes(String partitioning) throws BadPartitioningException {
- IDocumentPartitioner partitioner= getDocumentPartitioner(partitioning);
- if (partitioner != null)
- return partitioner.getLegalContentTypes();
- if (DEFAULT_PARTITIONING.equals(partitioning))
- return new String[] { DEFAULT_CONTENT_TYPE };
- throw new BadPartitioningException();
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentExtension3#getPartition(java.lang.String, int)
- * @since 3.0
- */
- public ITypedRegion getPartition(String partitioning, int offset) throws BadLocationException, BadPartitioningException {
- if ((0 > offset) || (offset > getLength()))
- throw new BadLocationException();
- IDocumentPartitioner partitioner= getDocumentPartitioner(partitioning);
- if (partitioner != null)
- return partitioner.getPartition(offset);
- if (DEFAULT_PARTITIONING.equals(partitioning))
- return new TypedRegion(0, getLength(), DEFAULT_CONTENT_TYPE);
- throw new BadPartitioningException();
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentExtension3#getPartitionings()
- * @since 3.0
- */
- public String[] getPartitionings() {
- if (fDocumentPartitioners == null)
- return new String[0];
- String[] partitionings= new String[fDocumentPartitioners.size()];
- fDocumentPartitioners.keySet().toArray(partitionings);
- return partitionings;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentExtension3#setDocumentPartitioner(java.lang.String, org.eclipse.jface.text.IDocumentPartitioner)
- * @since 3.0
- */
- public void setDocumentPartitioner(String partitioning, IDocumentPartitioner partitioner) {
- if (partitioner == null) {
- if (fDocumentPartitioners != null) {
- fDocumentPartitioners.remove(partitioning);
- if (fDocumentPartitioners.size() == 0)
- fDocumentPartitioners= null;
- }
- } else {
- if (fDocumentPartitioners == null)
- fDocumentPartitioners= new HashMap();
- fDocumentPartitioners.put(partitioning, partitioner);
- }
- DocumentPartitioningChangedEvent event= new DocumentPartitioningChangedEvent(this);
- event.setPartitionChange(partitioning, 0, getLength());
- fireDocumentPartitioningChanged(event);
- }
-
- /*
- * @see org.eclipse.jface.text.IRepairableDocument#repairLineInformation()
- * @since 3.0
- */
- public void repairLineInformation() {
- getTracker().set(get());
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/AbstractLineTracker.java b/org.eclipse.text/src/org/eclipse/jface/text/AbstractLineTracker.java
deleted file mode 100644
index 02a328c3a31..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/AbstractLineTracker.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.jface.text;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-
-/**
- * Abstract implementation of <code>ILineTracker</code>. It lets the
- * definition of line delimiters to subclasses. Assuming that '\n' is
- * the only line delimiter, this abstract implementation defines the
- * following line scheme:
- * <ul>
- * <li> "" -> [0,0]
- * <li> "a" -> [0,1]
- * <li> "\n" -> [0,1], [1,0]
- * <li> "a\n" -> [0,2], [2,0]
- * <li> "a\nb" -> [0,2], [2,1]
- * <li> "a\nbc\n" -> [0,2], [2,3], [5,0]
- * </ul>
- * This class must be subclassed.
- */
-public abstract class AbstractLineTracker implements ILineTracker {
-
-
- /**
- * Combines the information of the occurence of a line delimiter.
- * <code>delimiterIndex</code> is the index where a line delimiter
- * starts, whereas <code>delimiterLength</code>, indicates the length
- * of the delimiter.
- */
- protected static class DelimiterInfo {
- public int delimiterIndex;
- public int delimiterLength;
- public String delimiter;
- }
-
-
- /** The line information */
- private List fLines= new ArrayList();
- /** The length of the tracked text */
- private int fTextLength;
-
-
- /**
- * Creates a new line tracker.
- */
- protected AbstractLineTracker() {
- }
-
- /**
- * Binary search for the line at a given offset.
- *
- * @param offset the offset whose line should be found
- * @return the line of the offset
- */
- private int findLine(int offset) {
-
- if (fLines.size() == 0)
- return -1;
-
- int left= 0;
- int right= fLines.size() -1;
- int mid= 0;
- Line line= null;
-
- while (left < right) {
-
- mid= (left + right) / 2;
-
- line= (Line) fLines.get(mid);
- if (offset < line.offset) {
- if (left == mid)
- right= left;
- else
- right= mid -1;
- } else if (offset > line.offset) {
- if (right == mid)
- left= right;
- else
- left= mid +1;
- } else if (offset == line.offset) {
- left= right= mid;
- }
- }
-
- line= (Line) fLines.get(left);
- if (line.offset > offset)
- -- left;
- return left;
- }
-
- /**
- * Returns the number of lines covered by the specified text range.
- *
- * @param startLine the line where the text range starts
- * @param offset the start offset of the text range
- * @param length the length of the text range
- * @return the number of lines covered by this text range
- * @exception BadLocationException if range is undefined in this tracker
- */
- private int getNumberOfLines(int startLine, int offset, int length) throws BadLocationException {
-
- if (length == 0)
- return 1;
-
- int target= offset + length;
-
- Line l= (Line) fLines.get(startLine);
-
- if (l.delimiter == null)
- return 1;
-
- if (l.offset + l.length > target)
- return 1;
-
- if (l.offset + l.length == target)
- return 2;
-
- return getLineNumberOfOffset(target) - startLine + 1;
- }
-
- /*
- * @see ILineTracker#getLineLength(int)
- */
- public int getLineLength(int line) throws BadLocationException {
-
- int lines= fLines.size();
-
- if (line < 0 || line > lines)
- throw new BadLocationException();
-
- if (lines == 0 || lines == line)
- return 0;
-
- Line l= (Line) fLines.get(line);
- return l.length;
- }
-
- /*
- * @see ILineTracker#getLineNumberOfOffset(int)
- */
- public int getLineNumberOfOffset(int position) throws BadLocationException {
-
- if (position > fTextLength)
- throw new BadLocationException();
-
- if (position == fTextLength) {
-
- int lastLine= fLines.size() - 1;
- if (lastLine < 0)
- return 0;
-
- Line l= (Line) fLines.get(lastLine);
- return (l.delimiter != null ? lastLine + 1 : lastLine);
- }
-
- return findLine(position);
- }
-
- /*
- * @see ILineTracker#getLineInformationOfOffset(int)
- */
- public IRegion getLineInformationOfOffset(int position) throws BadLocationException {
- if (position > fTextLength)
- throw new BadLocationException();
-
- if (position == fTextLength) {
- int size= fLines.size();
- if (size == 0)
- return new Region(0, 0);
- Line l= (Line) fLines.get(size - 1);
- return (l.delimiter != null ? new Line(fTextLength, 0) : new Line(fTextLength - l.length, l.length));
- }
-
- return getLineInformation(findLine(position));
- }
-
- /*
- * @see ILineTracker#getLineInformation(int)
- */
- public IRegion getLineInformation(int line) throws BadLocationException {
-
- int lines= fLines.size();
-
- if (line < 0 || line > lines)
- throw new BadLocationException();
-
- if (lines == 0)
- return new Line(0, 0);
-
- if (line == lines) {
- Line l= (Line) fLines.get(line - 1);
- return new Line(l.offset + l.length, 0);
- }
-
- Line l= (Line) fLines.get(line);
- return (l.delimiter != null ? new Line(l.offset, l.length - l.delimiter.length()) : l);
- }
-
- /*
- * @see ILineTracker#getLineOffset(int)
- */
- public int getLineOffset(int line) throws BadLocationException {
-
- int lines= fLines.size();
-
- if (line < 0 || line > lines)
- throw new BadLocationException();
-
- if (lines == 0)
- return 0;
-
- if (line == lines) {
- Line l= (Line) fLines.get(line - 1);
- return l.offset + l.length;
- }
-
- Line l= (Line) fLines.get(line);
- return l.offset;
- }
-
- /*
- * @see ILineTracker#getNumberOfLines()
- */
- public int getNumberOfLines() {
-
- int lines= fLines.size();
-
- if (lines == 0)
- return 1;
-
- Line l= (Line) fLines.get(lines - 1);
- return (l.delimiter != null ? lines + 1 : lines);
- }
-
- /*
- * @see ILineTracker#getNumberOfLines(int, int)
- */
- public int getNumberOfLines(int position, int length) throws BadLocationException {
-
- if (position < 0 || position + length > fTextLength)
- throw new BadLocationException();
-
- if (length == 0) // optimization
- return 1;
-
- return getNumberOfLines(getLineNumberOfOffset(position), position, length);
- }
-
- /*
- * @see ILineTracker#computeNumberOfLines(String)
- */
- public int computeNumberOfLines(String text) {
- int count= 0;
- int start= 0;
- DelimiterInfo delimiterInfo= nextDelimiterInfo(text, start);
- while (delimiterInfo != null && delimiterInfo.delimiterIndex > -1) {
- ++count;
- start= delimiterInfo.delimiterIndex + delimiterInfo.delimiterLength;
- delimiterInfo= nextDelimiterInfo(text, start);
- }
- return count;
- }
-
-
- /* ----------------- manipulation ------------------------------ */
-
-
- /**
- * Returns the info of the first delimiter found in the given
- * text starting at the given offset.
- *
- * @param text the text to be searched
- * @param offset the offset in the given text
- * @return the info of the first found delimiter or <code>null</code> if
- * there is no such info
- */
- protected abstract DelimiterInfo nextDelimiterInfo(String text, int offset);
-
-
- /**
- * Creates the line structure for the given text. Newly created lines
- * are inserted into the line structure starting at the given
- * position. Returns the number of newly created lines.
- *
- * @param text the text for which to create a line structure
- * @param insertPosition the position at which the newly created lines are inserted
- * into the tracker's line structure
- * @param offset the offset of all newly created lines
- * @return the number of newly created lines
- */
- private int createLines(String text, int insertPosition, int offset) {
-
- int count= 0;
- int start= 0;
- DelimiterInfo delimiterInfo= nextDelimiterInfo(text, 0);
-
-
- while (delimiterInfo != null && delimiterInfo.delimiterIndex > -1) {
-
- int index= delimiterInfo.delimiterIndex + (delimiterInfo.delimiterLength - 1);
-
- if (insertPosition + count >= fLines.size())
- fLines.add(new Line(offset + start, offset + index, delimiterInfo.delimiter));
- else
- fLines.add(insertPosition + count, new Line(offset + start, offset + index, delimiterInfo.delimiter));
-
- ++count;
- start= index + 1;
- delimiterInfo= nextDelimiterInfo(text, start);
- }
-
- if (start < text.length()) {
- if (insertPosition + count < fLines.size()) {
- // there is a line below the current
- Line l= (Line) fLines.get(insertPosition + count);
- int delta= text.length() - start;
- l.offset -= delta;
- l.length += delta;
- } else {
- fLines.add(new Line(offset + start, offset + text.length() - 1, null));
- ++count;
- }
- }
-
- return count;
- }
-
- /**
- * Keeps track of the line information when text is inserted.
- * Returns the number of inserted lines.
- *
- * @param lineNumber the line at which the insert happens
- * @param offset at which the insert happens
- * @param text the inserted text
- * @return the number of inserted lines
- * @exception BadLocationException if offset is invalid in this tracker
- */
- private int insert(int lineNumber, int offset, String text) throws BadLocationException {
-
- if (text == null || text.length() == 0)
- return 0;
-
- fTextLength += text.length();
-
- int size= fLines.size();
-
- if (size == 0 || lineNumber >= size)
- return createLines(text, size, offset);
-
- Line line= (Line) fLines.get(lineNumber);
- DelimiterInfo delimiterInfo= nextDelimiterInfo(text, 0);
- if (delimiterInfo == null || delimiterInfo.delimiterIndex == -1) {
- line.length += text.length();
- return 0;
- }
-
-
- // as there is a line break, split line but do so only if rest of line is not of length 0
- int restLength= line.offset + line.length - offset;
- if (restLength > 0) {
- // determine start and end of the second half of the splitted line
- Line lineRest= new Line(offset, restLength);
- lineRest.delimiter= line.delimiter;
- // shift it by the inserted text
- lineRest.offset += text.length();
- // and insert in line structure
- fLines.add(lineNumber + 1, lineRest);
- }
-
- // adapt the beginning of the splitted line
- line.delimiter= delimiterInfo.delimiter;
- int nextStart= offset + delimiterInfo.delimiterIndex + delimiterInfo.delimiterLength;
- line.length= nextStart - line.offset;
-
- // insert lines for the remaining text
- text= text.substring(delimiterInfo.delimiterIndex + delimiterInfo.delimiterLength);
- return createLines(text, lineNumber + 1, nextStart) + 1;
- }
-
- /**
- * Keeps track of the line information when text is removed. Returns
- * whether the line at which the deletion start will thereby be deleted.
- *
- * @param lineNumber the lineNumber at which the deletion starts
- * @param offset the offset of the first deleted character
- * @param length the number of deleted characters
- * @return whethere the start line of the deletion has been deleted
- * @exception BadLocationException if position is unkown to the tracker
- */
- private boolean remove(int lineNumber, int offset, int length) throws BadLocationException {
-
- if (length == 0)
- return false;
-
- int removedLineEnds= getNumberOfLines(lineNumber, offset, length) - 1;
- Line line= (Line) fLines.get(lineNumber);
-
- if ((lineNumber == fLines.size() - 1) && removedLineEnds > 0) {
- line.length -= length;
- line.delimiter= null;
- } else {
-
- ++ lineNumber;
- for (int i= 1; i <= removedLineEnds; i++) {
-
- if (lineNumber == fLines.size()) {
- line.delimiter= null;
- break;
- }
-
- Line line2= (Line) fLines.get(lineNumber);
- line.length += line2.length;
- line.delimiter= line2.delimiter;
- fLines.remove(lineNumber);
- }
- line.length -= length;
- }
-
- fTextLength -= length;
-
- if (line.length == 0) {
- fLines.remove(line);
- return true;
- }
-
- return false;
- }
-
- /**
- * Adapts the offset of all lines with line numbers greater than the specified
- * one to the given delta.
- *
- * @param lineNumber the line number after which to start
- * @param delta the offset delta to be applied
- */
- private void adaptLineOffsets(int lineNumber, int delta) {
- int size= fLines.size();
- for (int i= lineNumber + 1; i < size; i++) {
- Line l= (Line) fLines.get(i);
- l.offset += delta;
- }
- }
-
- /*
- * @see ILineTracker#replace(int, int, String)
- */
- public void replace(int position, int length, String text) throws BadLocationException {
-
- int firstLine= getLineNumberOfOffset(position);
- int insertLineNumber= firstLine;
-
- if (remove(firstLine, position, length))
- -- firstLine;
-
- int lastLine= firstLine + insert(insertLineNumber, position, text);
-
-// int lines= fLines.size();
-// if (lines > 0) {
-//
-// // try to collapse the first and the second line if second line is empty
-// if (0 <= firstLine && firstLine + 1 < lines) {
-// Line l2= (Line) fLines.get(firstLine + 1);
-// if (l2.delimiter != null && l2.length == l2.delimiter.length()) {
-// // line is empty
-//
-// // append empty line to precessor
-// Line l1= (Line) fLines.get(firstLine);
-// StringBuffer buffer= new StringBuffer();
-// buffer.append(l1.delimiter);
-// buffer.append(l2.delimiter);
-//
-// // test whether this yields just one line rather then two
-// DelimiterInfo info= nextDelimiterInfo(buffer.toString(), 0);
-// if (info != null && info.delimiterIndex == 0 && info.delimiterLength == buffer.length()) {
-// l1.length += l2.length;
-// l1.delimiter += l2.delimiter;
-// fLines.remove(firstLine + 1);
-// -- lastLine;
-// }
-// }
-// }
-//
-// // try to collapse the last inserted line with the following line
-// if (lastLine < lines) {
-// Line l2= (Line) fLines.get(lastLine);
-// if (l2.delimiter != null && l2.length == l2.delimiter.length()) {
-// // line is empty
-//
-// // append empty line to precessor
-// Line l1= (Line) fLines.get(lastLine -1);
-// StringBuffer buffer= new StringBuffer();
-// buffer.append(l1.delimiter);
-// buffer.append(l2.delimiter);
-//
-// // test whether this yields just one line rather then two
-// DelimiterInfo info= nextDelimiterInfo(buffer.toString(), 0);
-// if (info != null && info.delimiterIndex == 0 && info.delimiterLength == buffer.length()) {
-// l1.length += l2.length;
-// l1.delimiter += l2.delimiter;
-// fLines.remove(lastLine);
-// }
-// }
-// }
-// }
-
- int delta= -length;
- if (text != null)
- delta= text.length() + delta;
-
- if (delta != 0)
- adaptLineOffsets(lastLine, delta);
- }
-
- /*
- * @see ILineTracker#set(String)
- */
- public void set(String text) {
- fLines.clear();
- if (text != null) {
- fTextLength= text.length();
- createLines(text, 0, 0);
- }
- }
-
- /*
- * @see ILineTracker#getLineDelimiter(int)
- */
- public String getLineDelimiter(int line) throws BadLocationException {
-
- int lines= fLines.size();
-
- if (line < 0 || line > lines)
- throw new BadLocationException();
-
- if (lines == 0)
- return null;
-
- if (line == lines)
- return null;
-
- Line l= (Line) fLines.get(line);
- return l.delimiter;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/Assert.java b/org.eclipse.text/src/org/eclipse/jface/text/Assert.java
deleted file mode 100644
index 40d65aba2a1..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/Assert.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-
-/**
- * <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/org.eclipse.text/src/org/eclipse/jface/text/BadLocationException.java b/org.eclipse.text/src/org/eclipse/jface/text/BadLocationException.java
deleted file mode 100644
index 8348b1f8281..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/BadLocationException.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.text;
-
-
-
-/**
- * Indicates the attempt to access a non-existing position.
- * The attempt has been performed on a text store such as a document or string.
- */
-public class BadLocationException extends Exception {
-
- /**
- * Creates a new bad location exception.
- */
- public BadLocationException() {
- super();
- }
-
- /**
- * Creates a new bad location exception.
- *
- * @param message the exception message
- */
- public BadLocationException(String message) {
- super(message);
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/BadPartitioningException.java b/org.eclipse.text/src/org/eclipse/jface/text/BadPartitioningException.java
deleted file mode 100644
index fc69e3ae9e3..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/BadPartitioningException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.jface.text;
-
-/**
- * Represents the attempt to refer to a non-existing document partitioning.
- * @see org.eclipse.jface.text.IDocument
- * @see org.eclipse.jface.text.IDocumentExtension3
- * @since 3.0
- */
-public class BadPartitioningException extends Exception {
-
- /**
- * Creates a new bad partitioning exception.
- */
- public BadPartitioningException() {
- }
-
- /**
- * Creates a new bad partitioning exception.
- *
- * @param message message describing the exception
- */
- public BadPartitioningException(String message) {
- super(message);
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/BadPositionCategoryException.java b/org.eclipse.text/src/org/eclipse/jface/text/BadPositionCategoryException.java
deleted file mode 100644
index c838292f156..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/BadPositionCategoryException.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.text;
-
-
-
-/**
- * Indicates the attempt to access a non-existing position
- * category in a document.
- *
- * @see IDocument
- */
-public class BadPositionCategoryException extends Exception {
-
- /**
- * Creates a new bad position category exception.
- */
- public BadPositionCategoryException() {
- super();
- }
-
- /**
- * Creates a new bad position category exception.
- *
- * @param message the exception's message
- */
- public BadPositionCategoryException(String message) {
- super(message);
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/ChildDocument.java b/org.eclipse.text/src/org/eclipse/jface/text/ChildDocument.java
deleted file mode 100644
index 6dc10869da1..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/ChildDocument.java
+++ /dev/null
@@ -1,453 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-
-
-/**
- * A child document is one particular example of a slave document. Child documents
- * are created by the <code>ChildDocumentManager</code>, an implementation of
- * <code>ISlaveDocumentManager</code>.<p>
- *
- * A child document represents one consequetive range of its master document.
- * The master document is called parent document. The child document is always in sync
- * with its parent document by utilizing the parent document as its <code>ITextStore</code>.<p>
- *
- * This class is for internal use only.
- *
- * @see ITextStore
- */
-public final class ChildDocument extends AbstractDocument {
-
-
- /**
- * Implements <code>ITextStore</code> based on <code>IDocument</code>.
- */
- class TextStore implements ITextStore {
-
- /*
- * @see ITextStore#set(String)
- */
- public void set(String txt) {
- try {
- fParentDocument.replace(fRange.getOffset(), fRange.getLength(), txt);
- } catch (BadLocationException x) {
- // cannot happen
- }
- }
-
- /*
- * @see ITextStore#replace(int, int, String)
- */
- public void replace(int offset, int length, String txt) {
- try {
- fParentDocument.replace(fRange.getOffset() + offset, length, txt);
- } catch (BadLocationException x) {
- // ignored as surrounding document should have handled this
- }
- }
-
- /*
- * @see ITextStore#getLength()
- */
- public int getLength() {
- return fRange.getLength();
- }
-
- /*
- * @see ITextStore#get(int, int)
- */
- public String get(int offset, int length) {
- try {
- return fParentDocument.get(fRange.getOffset() + offset, length);
- } catch (BadLocationException x) {
- }
-
- return "";
- }
-
- /*
- * @see ITextStore#get(int)
- */
- public char get(int offset) {
- try {
- return fParentDocument.getChar(fRange.getOffset() + offset);
- } catch (BadLocationException x) {
- }
-
- return (char) 0;
- }
- }
-
-
-
- /** The parent document */
- private IDocument fParentDocument;
- /**
- * The parent document as <code>IDocumentExtension</code>
- * @since 2.0
- */
- private IDocumentExtension fExtension;
- /**
- * The parent document as <code>IDocumentExtension2</code>
- * @since 2.1
- */
- private IDocumentExtension2 fExtension2;
- /** The section inside the parent document */
- private Position fRange;
- /** The document event issued by the parent document */
- private DocumentEvent fParentEvent;
- /** The document event issued and to be issued by the child document */
- private DocumentEvent fEvent;
- /** Indicates whether the child document initiated a parent document update or not */
- private boolean fIsUpdating= false;
- /**
- * The expected document content after the parent document changed.
- * @since 2.1
- */
- private String fExpectedContent;
- /**
- * The length of this child document prior to the change of the parent document
- * @since 2.1
- */
- private int fRememberedLength;
- /**
- * Indicates whether this document is in auto expand mode.
- * @since 2.1
- */
- private boolean fIsAutoExpanding= false;
-
-
- /**
- * Creates a child document for the given range of the given parent document.
- *
- * @param parentDocument the parent Document
- * @param range the parent document range covered by the child document
- */
- public ChildDocument(IDocument parentDocument, Position range) {
- super();
-
- fParentDocument= parentDocument;
- if (fParentDocument instanceof IDocumentExtension)
- fExtension= (IDocumentExtension) fParentDocument;
- if (fParentDocument instanceof IDocumentExtension2)
- fExtension2= (IDocumentExtension2) fParentDocument;
-
- fRange= range;
-
- ITextStore s= new TextStore();
- ILineTracker tracker= new DefaultLineTracker();
- tracker.set(s.get(0, fRange.getLength()));
-
- setTextStore(s);
- setLineTracker(tracker);
-
- completeInitialization();
- }
-
- /**
- * Sets the child document's parent document range.
- *
- * @param offset the offset of the parent document range
- * @param length the length of the parent document range
- */
- public void setParentDocumentRange(int offset, int length) throws BadLocationException {
-
- if (offset < 0 || length < 0 || offset + length > fParentDocument.getLength())
- throw new BadLocationException();
-
- fRange.setOffset(offset);
- fRange.setLength(length);
-
- getTracker().set(fParentDocument.get(offset, length));
- }
-
- /**
- * Returns parent document
- *
- * @return the parent document
- */
- public IDocument getParentDocument() {
- return fParentDocument;
- }
-
- /**
- * Returns the range of the parent document covered by this child document.
- *
- * @return the child document's parent document range
- */
- public Position getParentDocumentRange() {
- return fRange;
- }
-
- /**
- * <p>Transforms a document event of the parent document into a child document
- * based document event. This method considers whether the document is in
- * auto expand mode.</p>
- * This method is public for test purposes only.
- *
- * @param e the parent document event
- * @return the child document event
- */
- public DocumentEvent normalize(DocumentEvent event) {
-
- int delta= event.getOffset() - fRange.getOffset();
-
- if (isAutoExpandEvent(event)) {
-
- if (delta < 0) {
- int eventEndOffset= event.getOffset() + event.getLength();
-
- if (eventEndOffset <= fRange.getOffset()) {
-
- // case 1
- StringBuffer buffer= new StringBuffer();
- if (event.getText() != null)
- buffer.append(event.getText());
- try {
- buffer.append(fParentDocument.get(eventEndOffset, -delta - event.getLength()));
- } catch (BadLocationException e) {
- // should not happen as the event is a valid parent document event
- }
-
- return new SlaveDocumentEvent(this, 0, 0, buffer.toString(), event);
-
- } else {
-
- // cases 2 and 3
- int length= Math.min(eventEndOffset - fRange.getOffset(), fRange.getLength());
- return new SlaveDocumentEvent(this, 0, length, event.getText(), event);
- }
-
- } else {
- int rangeEndOffset= fRange.getOffset() + fRange.getLength();
-
- if (event.getOffset() >= rangeEndOffset) {
-
- // case 5
- StringBuffer buffer= new StringBuffer();
- try {
- buffer.append(fParentDocument.get(rangeEndOffset, event.getOffset() - rangeEndOffset));
- } catch (BadLocationException e) {
- // should not happen as this event is a valid parent document event
- }
- if (event.getText() != null)
- buffer.append(event.getText());
-
- return new SlaveDocumentEvent(this, fRange.getLength(), 0, buffer.toString(), event);
-
- } else {
-
- // case 4 and 6
- int offset= event.getOffset() - fRange.getOffset();
- int length= Math.min(rangeEndOffset - event.getOffset(), event.getLength());
- return new SlaveDocumentEvent(this, offset, length, event.getText(), event);
- }
- }
-
- } else if (fRange.overlapsWith(event.fOffset, event.fLength)) {
-
- int offset= delta < 0 ? 0 : delta;
- int length= delta < 0 ? event.fLength + delta : event.fLength;
- if (offset + length > fRange.getLength())
- length= fRange.getLength() - offset;
-
- return new SlaveDocumentEvent(this, offset, length, event.fText, event);
- }
-
- return null;
- }
-
- /**
- * When called this child document is informed about a forthcoming change
- * of its parent document. This child document checks whether the parent
- * document change affects it and if so informs all document listeners.
- *
- * @param event the parent document event
- */
- public void parentDocumentAboutToBeChanged(DocumentEvent event) {
-
- fParentEvent= event;
-
- fEvent= normalize(event);
- if (fEvent != null) {
-
- StringBuffer buffer= new StringBuffer(get());
- fRememberedLength= buffer.length();
- buffer.replace(fEvent.fOffset, fEvent.fOffset+ fEvent.fLength, fEvent.fText == null ? "" : fEvent.fText); //$NON-NLS-1$
- fExpectedContent= buffer.toString();
-
- delayedFireDocumentAboutToBeChanged();
- }
- }
-
- /**
- * When called this child document is informed about a change of its parent document.
- * If this child document is affected it informs all of its document listeners.
- *
- * @param event the parent document event
- */
- public void parentDocumentChanged(DocumentEvent event) {
- if ( !fIsUpdating && event == fParentEvent && fEvent != null) {
- try {
-
- if (!fExpectedContent.equals(get())) {
- // patch the event
- fEvent.fOffset= 0;
- fEvent.fLength= fRememberedLength;
- fEvent.fText= get();
- }
-
- fRememberedLength= 0;
- fExpectedContent= null;
-
- getTracker().replace(fEvent.fOffset, fEvent.fLength, fEvent.fText);
- fireDocumentChanged(fEvent);
-
- } catch (BadLocationException x) {
- Assert.isLegal(false);
- }
- }
- }
-
- /*
- * @see AbstractDocument#fireDocumentAboutToBeChanged(DocumentEvent)
- */
- protected void fireDocumentAboutToBeChanged(DocumentEvent event) {
- // delay it until there is a notification from the parent document
- // otherwise there it is expensive to construct the parent document information
- }
-
- /**
- * Fires the child document event as about-to-be-changed event to all
- * registed listeners.
- */
- private void delayedFireDocumentAboutToBeChanged() {
- super.fireDocumentAboutToBeChanged(fEvent);
- }
-
- /**
- * Ignores the given event and sends the similar child document event instead.
- *
- * @param event the event to be ignored
- */
- protected void fireDocumentChanged(DocumentEvent event) {
- super.fireDocumentChanged(fEvent);
- }
-
- /*
- * @see IDocument#replace(int, int, String)
- * @since 2.0
- */
- public void replace(int offset, int length, String text) throws BadLocationException {
- try {
- fIsUpdating= true;
- if (fExtension != null)
- fExtension.stopPostNotificationProcessing();
-
- if ((0 > offset) || (0 > length) || (offset + length > getLength()))
- throw new BadLocationException();
-
- DocumentEvent event= new DocumentEvent(this, offset, length, text);
- fireDocumentAboutToBeChanged(event);
-
- try {
-
- if (fExtension2 != null)
- fExtension2.stopListenerNotification();
-
- getStore().replace(offset, length, text);
- getTracker().replace(offset, length, text);
- updateDocumentStructures(fEvent);
-
- } finally {
- if (fExtension2 != null)
- fExtension2.resumeListenerNotification();
- }
-
- doFireDocumentChanged(fEvent);
-
- } finally {
- fIsUpdating= false;
- if (fExtension != null)
- fExtension.resumePostNotificationProcessing();
- }
- }
-
- /*
- * @see IDocument#set(String)
- * @since 2.0
- */
- public void set(String text) {
- try {
- fIsUpdating= true;
- if (fExtension != null)
- fExtension.stopPostNotificationProcessing();
-
- int length= getStore().getLength();
- DocumentEvent event= new DocumentEvent(this, 0, length, text);
- fireDocumentAboutToBeChanged(event);
-
- try {
-
- if (fExtension2 != null)
- fExtension2.stopListenerNotification();
-
- getStore().set(text);
- getTracker().set(text);
- updateDocumentStructures(fEvent);
-
- } finally {
- if (fExtension2 != null)
- fExtension2.resumeListenerNotification();
- }
-
- doFireDocumentChanged(fEvent);
-
- } finally {
- fIsUpdating= false;
- if (fExtension != null)
- fExtension.resumePostNotificationProcessing();
- }
- }
-
- /*
- * @see IDocumentExtension#registerPostNotificationReplace(IDocumentListener, IDocumentExtension.IReplace)
- * @since 2.0
- */
- public void registerPostNotificationReplace(IDocumentListener owner, IDocumentExtension.IReplace replace) {
- if (!fIsUpdating)
- throw new UnsupportedOperationException();
- super.registerPostNotificationReplace(owner, replace);
- }
-
- /**
- * Sets the auto expand mode of this document.
- *
- * @param autoExpand <code>true</code> if auto expanding, <code>false</code> otherwise
- * @since 2.1
- */
- public void setAutoExpandMode(boolean autoExpand) {
- fIsAutoExpanding= autoExpand;
- }
-
- /**
- * Returns whether the given document might cause this document to auto expand.
- * This default implementation always answers with its auto expand state.
- *
- * @param event the document event
- * @return <code>true</code> if the given event might cause this document to auto expand
- */
- public boolean isAutoExpandEvent(DocumentEvent event) {
- return fIsAutoExpanding;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/ChildDocumentManager.java b/org.eclipse.text/src/org/eclipse/jface/text/ChildDocumentManager.java
deleted file mode 100644
index 4f47cfcf13e..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/ChildDocumentManager.java
+++ /dev/null
@@ -1,464 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-
-/**
- * <code>ChildDocumentManager</code> is one particular implementation of
- * <code>ISlaveDocumentManager</code>. This manager creates so called child
- * documents as slave documents for given master documents.<p>
- *
- * A child document represents a particular range of the parent
- * document and is accordingly adapted to changes of the parent document.
- * Vice versa, the parent document is accordingly adapted to changes of
- * its child documents. The manager does not maintain any particular management
- * structure but utilizes mechanisms given by <code>IDocument</code> such
- * as position categories and position updaters. <p>
- *
- * For internal use only.
- */
-public final class ChildDocumentManager implements IDocumentListener, ISlaveDocumentManager {
-
-
- /**
- * Name of the position category used to keep track of the ranges of the parent documents
- * that correspond to child documents.
- */
- public final static String CHILDDOCUMENTS= "__childdocuments"; //$NON-NLS-1$
-
-
- /**
- * Positions which are used to mark the child documents offset ranges into
- * the parent documents. This position uses as bidirectional reference as
- * it knows the child document as well as the parent document.
- */
- static class ChildPosition extends Position {
-
- /** The parent document. */
- public IDocument fParentDocument;
- /* The child document */
- public ChildDocument fChildDocument;
-
- /**
- * Creates a new child position for the given parent document.
- * @param parentDocument the parent document
- * @param offset the offset into the parent document
- * @param length the length in the parent document
- */
- public ChildPosition(IDocument parentDocument, int offset, int length) {
- super(offset, length);
- fParentDocument= parentDocument;
- }
-
- /**
- * Changed to be compatible to the position updater behavior
- * @see Position#overlapsWith(int, int)
- */
- public boolean overlapsWith(int offset, int length) {
- boolean append= (offset == this.offset + this.length) && length == 0;
- return append || super.overlapsWith(offset, length);
- }
- }
-
-
- /**
- * The position updater used to adapt the positions representing
- * the child document ranges to changes of the parent document.
- */
- static class ChildPositionUpdater extends DefaultPositionUpdater {
-
- /** Cached document event */
- private DocumentEvent fDocumentEvent;
-
- /**
- * Creates the position updated.
- */
- protected ChildPositionUpdater() {
- super(CHILDDOCUMENTS);
- }
-
- /**
- * Child document ranges cannot be deleted other then by calling
- * freeChildDocument.
- */
- protected boolean notDeleted() {
- return true;
- }
-
- /*
- * @see org.eclipse.jface.text.DefaultPositionUpdater#update(org.eclipse.jface.text.DocumentEvent)
- */
- public void update(DocumentEvent event) {
- try {
- fDocumentEvent= event;
- super.update(event);
- } finally {
- fDocumentEvent= null;
- }
- }
-
- /**
- * If an insertion happens at a child document's start offset, the
- * position is extended rather than shifted. Also, if something is added
- * right behind the end of the position, the position is extended rather
- * than kept stable.
- *
- * In auto expand mode the position is always streched to contain the
- * whole area of the change.
- */
- protected void adaptToInsert() {
-
- int myStart= fPosition.offset;
- int myEnd= fPosition.offset + fPosition.length;
- boolean isAutoExpanding= isAutoExpanding();
-
- if (fLength != 0 && fOffset < myEnd && !isAutoExpanding) {
- super.adaptToInsert();
- return;
- }
-
- int yoursStart= fOffset;
- int yoursEnd= fOffset + fReplaceLength -1;
- yoursEnd= Math.max(yoursStart, yoursEnd);
-
- if (myEnd < yoursStart) {
- if (isAutoExpanding)
- fPosition.length= yoursEnd - myStart + 1;
- return;
- }
-
- if (myStart <= yoursStart)
- fPosition.length += fReplaceLength;
- else { // yoursStart < myStart
- if (isAutoExpanding) {
- fPosition.offset= yoursStart;
- fPosition.length += (myStart - yoursStart + fReplaceLength);
- } else {
- fPosition.offset += fReplaceLength;
- }
- }
- }
-
- /**
- * Returns whether the child documents should automatically expand to include
- * any parent document change.
- *
- * @return <code>true</code> if auto expanding, <code>false</code> otherwise
- * @since 2.1
- */
- private boolean isAutoExpanding() {
- if (fPosition instanceof ChildPosition) {
- ChildPosition position= (ChildPosition) fPosition;
- return position.fChildDocument.isAutoExpandEvent(fDocumentEvent);
- }
- return false;
- }
- }
-
- /**
- * The child document partitioner uses the parent document to answer all questions.
- */
- static class ChildPartitioner implements IDocumentPartitioner {
-
- /** The child document. */
- protected ChildDocument fChildDocument;
- /** The parent document */
- protected IDocument fParentDocument;
- /**
- * The parent document as <code>IDocumentExtensions3</code>.
- * @since 3.0
- */
- protected IDocumentExtension3 fParentDocument3;
- /**
- * The partitioning of this partitioner.
- * @since 3.0
- */
- protected String fPartitioning;
-
- /**
- * Creates a new child document partitioner for the given document
- * partitioning.
- *
- * @param partitioning the document partitioning
- * @since 3.0
- */
- protected ChildPartitioner(String partitioning) {
- fPartitioning= partitioning;
- }
-
- /**
- * Creates a new child document partitioner.
- */
- protected ChildPartitioner() {
- fPartitioning= null;
- }
-
- /*
- * @see IDocumentPartitioner#getPartition(int)
- */
- public ITypedRegion getPartition(int offset) {
- try {
- offset += fChildDocument.getParentDocumentRange().getOffset();
- if (fParentDocument3 != null)
- return fParentDocument3.getPartition(fPartitioning, offset);
- return fParentDocument.getPartition(offset);
- } catch (BadLocationException x) {
- } catch (BadPartitioningException x) {
- }
-
- return null;
- }
-
- /*
- * @see IDocumentPartitioner#computePartitioning(int, int)
- */
- public ITypedRegion[] computePartitioning(int offset, int length) {
- try {
- offset += fChildDocument.getParentDocumentRange().getOffset();
- if (fParentDocument3 != null)
- return fParentDocument3.computePartitioning(fPartitioning, offset, length);
- return fParentDocument.computePartitioning(offset, length);
- } catch (BadLocationException x) {
- } catch (BadPartitioningException x) {
- }
-
- return null;
- }
-
- /*
- * @see IDocumentPartitioner#getContentType(int)
- */
- public String getContentType(int offset) {
- try {
- offset += fChildDocument.getParentDocumentRange().getOffset();
- if (fParentDocument3 != null)
- return fParentDocument3.getContentType(fPartitioning, offset);
- return fParentDocument.getContentType(offset);
- } catch (BadLocationException x) {
- } catch (BadPartitioningException x) {
- }
-
- return null;
- }
-
- /*
- * @see IDocumentPartitioner#getLegalContentTypes()
- */
- public String[] getLegalContentTypes() {
- if (fParentDocument3 != null)
- try {
- return fParentDocument3.getLegalContentTypes(fPartitioning);
- } catch (BadPartitioningException x) {
- return new String[0];
- }
- return fParentDocument.getLegalContentTypes();
- }
-
- /*
- * @see IDocumentPartitioner#documentChanged(DocumentEvent)
- */
- public boolean documentChanged(DocumentEvent event) {
- // ignore as the parent does this for us
- return false;
- }
-
- /*
- * @see IDocumentPartitioner#documentAboutToBeChanged(DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- // ignore as the parent does this for us
- }
-
- /*
- * @see IDocumentPartitioner#disconnect()
- */
- public void disconnect() {
- fChildDocument= null;
- fParentDocument= null;
- fParentDocument3= null;
- }
-
- /*
- * @see IDocumentPartitioner#connect(IDocument)
- */
- public void connect(IDocument childDocument) {
- Assert.isTrue(childDocument instanceof ChildDocument);
- fChildDocument= (ChildDocument) childDocument;
- fParentDocument= fChildDocument.getParentDocument();
- if (fParentDocument instanceof IDocumentExtension3)
- fParentDocument3= (IDocumentExtension3) fParentDocument;
- }
- }
-
-
-
- /** The position updater shared by all documents which have child documents */
- private IPositionUpdater fChildPositionUpdater;
-
-
- /**
- * Returns the child position updater. If necessary, it is dynamically created.
- *
- * @return the child position updater
- */
- protected IPositionUpdater getChildPositionUpdater() {
- if (fChildPositionUpdater == null)
- fChildPositionUpdater= new ChildPositionUpdater();
- return fChildPositionUpdater;
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#createSlaveDocument(org.eclipse.jface.text.IDocument)
- */
- public IDocument createSlaveDocument(IDocument master) {
-
- if (!master.containsPositionCategory(CHILDDOCUMENTS)) {
- master.addPositionCategory(CHILDDOCUMENTS);
- master.addPositionUpdater(getChildPositionUpdater());
- master.addDocumentListener(this);
- }
-
- ChildPosition pos= new ChildPosition(master, 0, 0);
- try {
- master.addPosition(CHILDDOCUMENTS, pos);
- } catch (BadPositionCategoryException x) {
- // cannot happen
- } catch (BadLocationException x) {
- // (0, 0) is OK
- }
-
- ChildDocument child= new ChildDocument(master, pos);
- if (master instanceof IDocumentExtension3) {
- IDocumentExtension3 extension3= (IDocumentExtension3) master;
- String[] partitionings= extension3.getPartitionings();
- for (int i= 0; i < partitionings.length; i++) {
- IDocumentPartitioner partitioner= new ChildPartitioner(partitionings[i]);
- child.setDocumentPartitioner(partitionings[i], partitioner);
- partitioner.connect(child);
- }
- } else {
- IDocumentPartitioner partitioner= new ChildPartitioner();
- child.setDocumentPartitioner(partitioner);
- partitioner.connect(child);
- }
-
- pos.fChildDocument= child;
-
- return child;
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#freeSlaveDocument(org.eclipse.jface.text.IDocument)
- */
- public void freeSlaveDocument(IDocument slave) {
-
- if (! (slave instanceof ChildDocument))
- return;
-
- ChildDocument childDocument= (ChildDocument) slave;
-
- String[] partitionings= childDocument.getPartitionings();
- for (int i= 0; i < partitionings.length; i ++) {
- IDocumentPartitioner partitioner= childDocument.getDocumentPartitioner(partitionings[i]);
- if (partitioner != null)
- partitioner.disconnect();
- }
-
- ChildPosition pos= (ChildPosition) childDocument.getParentDocumentRange();
- IDocument parent= pos.fParentDocument;
-
- try {
- parent.removePosition(CHILDDOCUMENTS, pos);
- Position[] category= parent.getPositions(CHILDDOCUMENTS);
- if (category.length == 0) {
- parent.removeDocumentListener(this);
- parent.removePositionUpdater(getChildPositionUpdater());
- parent.removePositionCategory(CHILDDOCUMENTS);
- }
- } catch (BadPositionCategoryException x) {
- // cannot happen
- }
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#createMasterSlaveMapping(org.eclipse.jface.text.IDocument)
- */
- public IDocumentInformationMapping createMasterSlaveMapping(IDocument slave) {
- if (slave instanceof ChildDocument)
- return new ParentChildMapping((ChildDocument) slave);
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#getMasterDocument(org.eclipse.jface.text.IDocument)
- */
- public IDocument getMasterDocument(IDocument slave) {
- if (slave instanceof ChildDocument)
- return ((ChildDocument) slave).getParentDocument();
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#isSlaveDocument(org.eclipse.jface.text.IDocument)
- */
- public boolean isSlaveDocument(IDocument document) {
- return (document instanceof ChildDocument);
- }
-
- /**
- * Informs all child documents of the document which issued this document event.
- *
- * @param about indicates whether the change is about to happen or alread happend
- * @param event the document event which will be processed to inform child documents
- */
- protected void fireDocumentEvent(boolean about, DocumentEvent event) {
- try {
-
- IDocument parent= event.getDocument();
- Position[] children= parent.getPositions(CHILDDOCUMENTS);
- for (int i= 0; i < children.length; i++) {
- Object o= children[i];
- if (o instanceof ChildPosition) {
- ChildPosition pos= (ChildPosition) o;
- if (about)
- pos.fChildDocument.parentDocumentAboutToBeChanged(event);
- else
- pos.fChildDocument.parentDocumentChanged(event);
- }
- }
- } catch (BadPositionCategoryException x) {
- // cannot happen
- }
- }
-
- /*
- * @see IDocumentListener#documentChanged(DocumentEvent)
- */
- public void documentChanged(DocumentEvent event) {
- fireDocumentEvent(false, event);
- }
-
- /*
- * @see IDocumentListener#documentAboutToBeChanged(DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- fireDocumentEvent(true, event);
- }
-
- /*
- * @see org.eclipse.jface.text.ISlaveDocumentManager#setAutoExpandMode(org.eclipse.jface.text.IDocument, boolean)
- */
- public void setAutoExpandMode(IDocument slaveDocument, boolean autoExpand) {
- if (slaveDocument instanceof ChildDocument)
- ((ChildDocument) slaveDocument).setAutoExpandMode(autoExpand);
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/ConfigurableLineTracker.java b/org.eclipse.text/src/org/eclipse/jface/text/ConfigurableLineTracker.java
deleted file mode 100644
index 301b64c41d2..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/ConfigurableLineTracker.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.jface.text;
-
-
-
-
-/**
- * Standard implementation of a generic <code>ILineTracker</code>.
- * The line tracker can be configured with the set of legal line delimiters.
- * Line delimiters are unconstrainted. The line delimiters are used to
- * compute the tracker's line structure. In the case of overlapping line delimiters,
- * the longest line delimiter is given precedence of the shorter ones.<p>
- * This class is not intended to be subclassed.
- */
-public class ConfigurableLineTracker extends AbstractLineTracker {
-
-
- /** The strings which are considered being the line delimiter */
- private String[] fDelimiters;
- /** A predefined delimiter info which is always reused as return value */
- private DelimiterInfo fDelimiterInfo= new DelimiterInfo();
-
-
- /**
- * Creates a standard line tracker for the given line delimiters.
- *
- * @param legalLineDelimiters the tracker's legal line delimiters,
- * may not be <code>null</code> and must be longer than 0
- */
- public ConfigurableLineTracker(String[] legalLineDelimiters) {
- Assert.isTrue(legalLineDelimiters != null && legalLineDelimiters.length > 0);
- fDelimiters= legalLineDelimiters;
- }
-
- /*
- * @see ILineDelimiter@getLegalLineDelimiters()
- */
- public String[] getLegalLineDelimiters() {
- return fDelimiters;
- }
-
- /*
- * @see AbstractLineTracker#nextDelimiterInfo(String, int)
- */
- protected DelimiterInfo nextDelimiterInfo(String text, int offset) {
- int[] info= TextUtilities.indexOf(fDelimiters, text, offset);
- if (info[0] == -1)
- return null;
-
- fDelimiterInfo.delimiterIndex= info[0];
- fDelimiterInfo.delimiter= fDelimiters[info[1]];
- fDelimiterInfo.delimiterLength= fDelimiterInfo.delimiter.length();
- return fDelimiterInfo;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/DefaultLineTracker.java b/org.eclipse.text/src/org/eclipse/jface/text/DefaultLineTracker.java
deleted file mode 100644
index f7d68bba574..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/DefaultLineTracker.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.text;
-
-
-
-
-/**
- * Standard implementation of <code>ILineTracker</code>.
- * The line tracker considers the three common line
- * delimiters which are '\n', '\r', '\r\n'.<p>
- * This class is not intended to be subclassed.
- */
-public class DefaultLineTracker extends AbstractLineTracker {
-
- /** The predefined delimiters of this tracker */
- public final static String[] DELIMITERS= { "\r", "\n", "\r\n" }; //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-2$
- /** A predefined delimiter info which is always reused as return value */
- private DelimiterInfo fDelimiterInfo= new DelimiterInfo();
-
-
- /**
- * Creates a standard line tracker.
- */
- public DefaultLineTracker() {
- }
-
- /*
- * @see ILineDelimiter@getLegalLineDelimiters()
- */
- public String[] getLegalLineDelimiters() {
- return DELIMITERS;
- }
-
- /*
- * @see AbstractLineTracker#nextDelimiterInfo(String, int)
- */
- protected DelimiterInfo nextDelimiterInfo(String text, int offset) {
-
- char ch;
- int length= text.length();
- for (int i= offset; i < length; i++) {
-
- ch= text.charAt(i);
- if (ch == '\r') {
-
- if (i + 1 < length) {
- if (text.charAt(i + 1) == '\n') {
- fDelimiterInfo.delimiter= DELIMITERS[2];
- fDelimiterInfo.delimiterIndex= i;
- fDelimiterInfo.delimiterLength= 2;
- return fDelimiterInfo;
- }
- }
-
- fDelimiterInfo.delimiter= DELIMITERS[0];
- fDelimiterInfo.delimiterIndex= i;
- fDelimiterInfo.delimiterLength= 1;
- return fDelimiterInfo;
-
- } else if (ch == '\n') {
-
- fDelimiterInfo.delimiter= DELIMITERS[1];
- fDelimiterInfo.delimiterIndex= i;
- fDelimiterInfo.delimiterLength= 1;
- return fDelimiterInfo;
- }
- }
-
- return null;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/DefaultPositionUpdater.java b/org.eclipse.text/src/org/eclipse/jface/text/DefaultPositionUpdater.java
deleted file mode 100644
index 96bae42a36f..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/DefaultPositionUpdater.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.jface.text;
-
-
-/**
- * Default implementation of <code>IPositionUpdater</code>.
- * A default position updater must be configured with the position category
- * whose positions it will update. Other position categories are not affected
- * by this updater.<p>
- * This implementation follows the following specification:
- * <ul>
- * <li> Inserting or deleting text before the position shifts the position accordingly.
- * <li> Inserting text at the position offset shifts the position accordingly.
- * <li> Inserting or deleting text completely surrounded by the position shrinks or stretches the position.
- * <li> Inserting or deleting text after a position does not affect the position.
- * <li> Deleting text which completly contains the position deletes the position.
- * <li> Replacing text overlapping with the position considered as a sequence of first
- * deleting the replaced text and afterwards inserting the new text. Thus, a
- * position might first be shifted and shrink and then be stretched.
- * </ul>
- * This class can be used as is or be adapted by subclasses. Fields are protected to
- * allow subclasses direct access. Because of the frequency with which position updaters
- * are used this is a performance decision.
- */
-public class DefaultPositionUpdater implements IPositionUpdater {
-
- /** The position category the updater draws responsible for */
- private String fCategory;
-
- /** Caches the currently investigated position */
- protected Position fPosition;
- /**
- * Remembers the original state of the investigated position
- * @since 2.1
- */
- protected Position fOriginalPosition= new Position(0, 0);
- /** Caches the offset of the replaced text */
- protected int fOffset;
- /** Caches the length of the replaced text */
- protected int fLength;
- /** Caches the length of the newly inserted text */
- protected int fReplaceLength;
- /** Catches the document */
- protected IDocument fDocument;
-
-
- /**
- * Creates a new default positon updater for the given category.
- *
- * @param category the category the updater is responsible for
- */
- public DefaultPositionUpdater(String category) {
- fCategory= category;
- }
-
- /**
- * Returns the category this updater is resonsible for.
- *
- * @return the category this updater is resonsible for
- */
- protected String getCategory() {
- return fCategory;
- }
-
- /**
- * Adapts the currently investigated position to an insertion.
- */
- protected void adaptToInsert() {
-
- int myStart= fPosition.offset;
- int myEnd= fPosition.offset + fPosition.length -1;
- myEnd= Math.max(myStart, myEnd);
-
- int yoursStart= fOffset;
- int yoursEnd= fOffset + fReplaceLength -1;
- yoursEnd= Math.max(yoursStart, yoursEnd);
-
- if (myEnd < yoursStart)
- return;
-
- if (fLength <= 0) {
-
- if (myStart < yoursStart)
- fPosition.length += fReplaceLength;
- else
- fPosition.offset += fReplaceLength;
-
- } else {
-
- if (myStart <= yoursStart && fOriginalPosition.offset <= yoursStart)
- fPosition.length += fReplaceLength;
- else
- fPosition.offset += fReplaceLength;
- }
- }
-
- /**
- * Adapts the currently investigated position to a deletion.
- */
- protected void adaptToRemove() {
-
- int myStart= fPosition.offset;
- int myEnd= fPosition.offset + fPosition.length -1;
- myEnd= Math.max(myStart, myEnd);
-
- int yoursStart= fOffset;
- int yoursEnd= fOffset + fLength -1;
- yoursEnd= Math.max(yoursStart, yoursEnd);
-
- if (myEnd < yoursStart)
- return;
-
- if (myStart <= yoursStart) {
-
- if (yoursEnd <= myEnd)
- fPosition.length -= fLength;
- else
- fPosition.length -= (myEnd - yoursStart +1);
-
- } else if (yoursStart < myStart) {
-
- if (yoursEnd < myStart)
- fPosition.offset -= fLength;
- else {
- fPosition.offset -= (myStart - yoursStart);
- fPosition.length -= (yoursEnd - myStart +1);
- }
-
- }
-
- // validate position to allowed values
- if (fPosition.offset < 0)
- fPosition.offset= 0;
-
- if (fPosition.length < 0)
- fPosition.length= 0;
- }
-
- /**
- * Adapts the currently investigated position to the replace operation.
- * First it checks whether the change replaces the whole range of the position.
- * If not, it performs first the deletion of the previous text and afterwards
- * the insertion of the new text.
- */
- protected void adaptToReplace() {
-
- if (fPosition.offset == fOffset && fPosition.length == fLength && fPosition.length > 0) {
-
- // replace the whole range of the position
- fPosition.length += (fReplaceLength - fLength);
- if (fPosition.length < 0) {
- fPosition.offset += fPosition.length;
- fPosition.length= 0;
- }
-
- } else {
-
- if (fLength > 0)
- adaptToRemove();
-
- if (fReplaceLength > 0)
- adaptToInsert();
- }
- }
-
- /**
- * Determines whether the currently investigated position has been deleted by
- * the replace operation specified in the current event. If so, it deletes
- * the position and removes it from the document's position category.
- *
- * @return <code>true</code> if position has been deleted
- */
- protected boolean notDeleted() {
-
- if (fOffset < fPosition.offset && (fPosition.offset + fPosition.length < fOffset + fLength)) {
-
- fPosition.delete();
-
- try {
- fDocument.removePosition(fCategory, fPosition);
- } catch (BadPositionCategoryException x) {
- }
-
- return false;
- }
-
- return true;
- }
-
- /*
- * @see IPositionUpdater#update(DocumentEvent event)
- */
- public void update(DocumentEvent event) {
-
- try {
-
-
- fOffset= event.getOffset();
- fLength= event.getLength();
- fReplaceLength= (event.getText() == null ? 0 : event.getText().length());
- fDocument= event.getDocument();
-
- Position[] category= fDocument.getPositions(fCategory);
- for (int i= 0; i < category.length; i++) {
-
- fPosition= category[i];
- fOriginalPosition.offset= fPosition.offset;
- fOriginalPosition.length= fPosition.length;
-
- if (notDeleted())
- adaptToReplace();
- }
-
- } catch (BadPositionCategoryException x) {
- // do nothing
- }
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/Document.java b/org.eclipse.text/src/org/eclipse/jface/text/Document.java
deleted file mode 100644
index b3fa42bc8ba..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/Document.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.text;
-
-
-/**
- * Default document implementation. Uses a <code>GapTextStore</code> as default
- * text store and a <code>SequentialRewriteTextStore</code> when in sequential
- * rewrite mode. The used line tracker considers the following strings as line delimiters
- * "\n", "\r", "\r\n". The document is ready to use. It has a default position
- * category for which a default position updater is installed.
- *
- * @see org.eclipse.jface.text.GapTextStore
- * @see org.eclipse.jface.text.SequentialRewriteTextStore
- */
-public class Document extends AbstractDocument {
-
-
- /**
- * Creates a new empty document.
- */
- public Document() {
- super();
- setTextStore(new GapTextStore(50, 300));
- setLineTracker(new DefaultLineTracker());
- completeInitialization();
- }
-
- /**
- * Creates a new document with the given initial content.
- *
- * @param initialContent the document's initial content
- */
- public Document(String initialContent) {
- super();
- setTextStore(new GapTextStore(50, 300));
- setLineTracker(new DefaultLineTracker());
- getStore().set(initialContent);
- getTracker().set(initialContent);
- completeInitialization();
- }
-
- /*
- * @see IDocumentExtension#startSequentialRewrite(boolean)
- * @since 2.0
- */
- public void startSequentialRewrite(boolean normalized) {
- ITextStore store= new SequentialRewriteTextStore(getStore());
- setTextStore(store);
- }
-
- /*
- * @see IDocumentExtension#stopSequentialRewrite()
- * @since 2.0
- */
- public void stopSequentialRewrite() {
- if (getStore() instanceof SequentialRewriteTextStore) {
- SequentialRewriteTextStore srws= (SequentialRewriteTextStore) getStore();
- ITextStore source= srws.getSourceStore();
- setTextStore(source);
- srws.dispose();
- }
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java b/org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java
deleted file mode 100644
index f63ed663975..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.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.jface.text;
-
-
-/**
- * Specification of changes applied to documents.
- * All changes are represented as replace commands, i.e.
- * specifying a document range whose text gets replaced with different text.
- * In addition to this information, the event also contains the changed document.
- *
- * @see IDocument
- */
-public class DocumentEvent {
-
- /** The changed document */
- public IDocument fDocument;
- /** The document offset */
- public int fOffset;
- /** Length of the replaced document text */
- public int fLength;
- /** Text inserted into the document */
- public String fText;
-
- /**
- * Creates a new document event.
- *
- * @param doc the changed document
- * @param offset the offset of the replaced text
- * @param length the length of the replaced text
- * @param text the substitution text
- */
- public DocumentEvent(IDocument doc, int offset, int length, String text) {
-
- Assert.isNotNull(doc);
- Assert.isTrue(offset >= 0);
- Assert.isTrue(length >= 0);
-
- fDocument= doc;
- fOffset= offset;
- fLength= length;
- fText= text;
- }
-
- /**
- * Creates a new uninitialized document event.
- */
- public DocumentEvent() {
- }
-
- /**
- * Returns the changed document.
- *
- * @return the changed document
- */
- public IDocument getDocument() {
- return fDocument;
- }
-
- /**
- * Returns the offset of the change
- *
- * @return the offset of the change
- */
- public int getOffset() {
- return fOffset;
- }
-
- /**
- * Returns the length of the replaced text.
- *
- * @return the length of the replaced text
- */
- public int getLength() {
- return fLength;
- }
-
- /**
- * Returns the text that has been inserted.
- *
- * @return the text that has been inserted
- */
- public String getText() {
- return fText;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/DocumentPartitioningChangedEvent.java b/org.eclipse.text/src/org/eclipse/jface/text/DocumentPartitioningChangedEvent.java
deleted file mode 100644
index 3b852c65574..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/DocumentPartitioningChangedEvent.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.jface.text;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * Event describing the change of document partitionings.
- *
- * @see org.eclipse.jface.text.IDocumentExtension3
- * @since 3.0
- */
-public class DocumentPartitioningChangedEvent {
-
- /** The document whose partitionings changed */
- private final IDocument fDocument;
- /** The map of partitionings to changed regions. */
- private final Map fMap= new HashMap();
-
-
- /**
- * Creates a new document partitioning changed event for the given document.
- *
- * @param document the changed document
- */
- public DocumentPartitioningChangedEvent(IDocument document) {
- fDocument= document;
- }
-
- /**
- * Returns the changed document.
- *
- * @return the changed document
- */
- public IDocument getDocument() {
- return fDocument;
- }
-
- /**
- * Returns the changed region of the given partitioning or <code>null</code>
- * if the given partitioning did not change.
- *
- * @param partitioning the partitioning
- * @return the changed regionn of the given partitioning or <code>null</code>
- */
- public IRegion getChangedRegion(String partitioning) {
- return (IRegion) fMap.get(partitioning);
- }
-
-
- /**
- * Returns the set of changed partitionings.
- *
- * @return the set of changed partitionings
- */
- public String[] getChangedPartitionings() {
- String[] partitionings= new String[fMap.size()];
- fMap.keySet().toArray(partitionings);
- return partitionings;
- }
-
- /**
- * Sets the specified range as changed region for the given partitioning.
- *
- * @param partitioning the partitioning
- * @param offset the region offset
- * @param length the region length
- */
- public void setPartitionChange(String partitioning, int offset, int length) {
- Assert.isNotNull(partitioning);
- fMap.put(partitioning, new Region(offset, length));
- }
-
- /**
- * Returns <code>true</code> if the set of changed partitionings is empty. <code>false</code>
- * otherwise.
- *
- * @return <code>true</code> if the set of changed partitionings is empty.
- */
- public boolean isEmpty() {
- return fMap.isEmpty();
- }
-
- /**
- * Returns the coverage of this event. This is the minimal region that contains all
- * changed regions of all changed partitionings.
- *
- * @return the coverage of this event
- */
- public IRegion getCoverage() {
- if (fMap.isEmpty())
- return new Region(0, 0);
-
- int offset= -1;
- int endOffset= -1;
- Iterator e= fMap.values().iterator();
- while (e.hasNext()) {
- IRegion r= (IRegion) e.next();
-
- if (offset < 0 || r.getOffset() < offset)
- offset= r.getOffset();
-
- int end= r.getOffset() + r.getLength();
- if (end > endOffset)
- endOffset= end;
- }
-
- return new Region(offset, endOffset - offset);
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java b/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java
deleted file mode 100644
index f8ac27b304d..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-
-/**
- * Adapts {@link org.eclipse.jface.text.IDocument} for doing search and
- * replace operations.
- *
- * @since 3.0
- */
-public class FindReplaceDocumentAdapter implements CharSequence {
-
- // Shortcuts to findReplace opertion codes
- private static final FindReplaceOperationCode FIND_FIRST= FindReplaceOperationCode.FIND_FIRST;
- private static final FindReplaceOperationCode FIND_NEXT= FindReplaceOperationCode.FIND_NEXT;
- private static final FindReplaceOperationCode REPLACE= FindReplaceOperationCode.REPLACE;
- private static final FindReplaceOperationCode REPLACE_FIND_NEXT= FindReplaceOperationCode.REPLACE_FIND_NEXT;
-
- /**
- * The adapted document.
- */
- private IDocument fDocument;
-
- /**
- * State for findReplace.
- */
- private FindReplaceOperationCode fFindReplaceState= null;
-
- /**
- * The matcher used in findReplace.
- */
- private Matcher fFindReplaceMatcher;
-
- /**
- * The match offset from the last findReplace call.
- */
- private int fFindReplaceMatchOffset;
-
- /**
- * Constructs a new find replace document adapter.
- *
- * @param document the adapted document
- */
- public FindReplaceDocumentAdapter(IDocument document) {
- Assert.isNotNull(document);
- fDocument= document;
- }
-
- /**
- * Returns the region of a given search string in the document based on a set of search criteria.
- *
- * @param startOffset document offset at which search starts
- * @param findString the string to find
- * @param forwardSearch the search direction
- * @param caseSensitive indicates whether lower and upper case should be distinguished
- * @param wholeWord indicates whether the findString should be limited by white spaces as
- * defined by Character.isWhiteSpace. Must not be used in combination with <code>regExSearch</code>.
- * @param regExSearch if <code>true</code> findString represents a regular expression
- * Must not be used in combination with <code>regExSearch</code>.
- * @return the find or replace region or <code>null</code> if there was no match
- * @throws BadLocationException if startOffset is an invalid document offset
- * @throws PatternSyntaxException if a regular expression has invalid syntax
- */
- public IRegion search(int startOffset, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord, boolean regExSearch) throws BadLocationException {
- Assert.isTrue(!(regExSearch && wholeWord));
-
- // Adjust offset to special meaning of -1
- if (startOffset == -1 && forwardSearch)
- startOffset= 0;
- if (startOffset == -1 && !forwardSearch)
- startOffset= length() - 1;
-
- return findReplace(FIND_FIRST, startOffset, findString, null, forwardSearch, caseSensitive, wholeWord, regExSearch);
- }
-
- /**
- * Stateful findReplace executes a FIND, REPLACE, REPLACE_FIND or FIND_FIRST operation.
- * In case of REPLACE and REPLACE_FIND it sends a <code>DocumentEvent</code> to all
- * registered <code>IDocumentListener</code>.
- *
- * @param startOffset document offset at which search starts
- * this value is only used in the FIND_FIRST operation and otherwise ignored
- * @param findString the string to find
- * this value is only used in the FIND_FIRST operation and otherwise ignored
- * @param replaceString the string to replace the current match
- * this value is only used in the REPLACE and REPLACE_FIND operations and otherwise ignored
- * @param forwardSearch the search direction
- * @param caseSensitive indicates whether lower and upper case should be distinguished
- * @param wholeWord indicates whether the findString should be limited by white spaces as
- * defined by Character.isWhiteSpace. Must not be used in combination with <code>regExSearch</code>.
- * @param regExSearch if <code>true</code> this operation represents a regular expression
- * Must not be used in combination with <code>wholeWord</code>.
- * @param operationCode specifies what kind of operation is executed
- * @return the find or replace region or <code>null</code> if there was no match
- * @throws BadLocationException if startOffset is an invalid document offset
- * @throws IllegalStateException if a REPLACE or REPLACE_FIND operation is not preceded by a successful FIND operation
- * @throws PatternSyntaxException if a regular expression has invalid syntax
- *
- * @see FindReplaceOperationCode#FIND_FIRST
- * @see FindReplaceOperationCode#FIND_NEXT
- * @see FindReplaceOperationCode#REPLACE
- * @see FindReplaceOperationCode#REPLACE_FIND_NEXT
- */
- public IRegion findReplace(FindReplaceOperationCode operationCode, int startOffset, String findString, String replaceText, boolean forwardSearch, boolean caseSensitive, boolean wholeWord, boolean regExSearch) throws BadLocationException {
-
- // Validate option combinations
- Assert.isTrue(!(regExSearch && wholeWord));
-
- // Validate state
- if ((operationCode == REPLACE || operationCode == REPLACE_FIND_NEXT) && (fFindReplaceState != FIND_FIRST && fFindReplaceState != FIND_NEXT))
- throw new IllegalStateException("illegal findReplace state: cannot replace without preceding find"); //$NON-NLS-1$
-
- if (operationCode == FIND_FIRST) {
- // Reset
-
- if (findString == null || findString.length() == 0)
- return null;
-
- // Validate start offset
- if (startOffset < 0 || startOffset >= length())
- throw new BadLocationException();
-
- int patternFlags= 0;
-
- if (regExSearch)
- patternFlags |= Pattern.MULTILINE;
-
- if (!caseSensitive)
- patternFlags |= Pattern.CASE_INSENSITIVE;
-
- if (wholeWord)
- findString= "\\b" + findString + "\\b"; //$NON-NLS-1$ //$NON-NLS-2$
-
- if (!regExSearch && !wholeWord)
- findString= asRegPattern(findString);
-
- fFindReplaceMatchOffset= startOffset;
- if (fFindReplaceMatcher != null && fFindReplaceMatcher.pattern().pattern().equals(findString) && fFindReplaceMatcher.pattern().flags() == patternFlags) {
- /*
- * Commented out for optimazation:
- * The call is not needed since FIND_FIRST uses find(int) which resets the matcher
- */
- // fFindReplaceMatcher.reset();
- } else {
- Pattern pattern= Pattern.compile(findString, patternFlags);
- fFindReplaceMatcher= pattern.matcher(this);
- }
- }
-
- // Set state
- fFindReplaceState= operationCode;
-
- if (operationCode == REPLACE || operationCode == REPLACE_FIND_NEXT) {
- if (regExSearch) {
- Pattern pattern= fFindReplaceMatcher.pattern();
- Matcher replaceTextMatcher= pattern.matcher(fFindReplaceMatcher.group());
- try {
- replaceText= replaceTextMatcher.replaceFirst(replaceText);
- } catch (IndexOutOfBoundsException ex) {
- throw new PatternSyntaxException(ex.getLocalizedMessage(), replaceText, -1);
- }
- }
-
- int offset= fFindReplaceMatcher.start();
- fDocument.replace(offset, fFindReplaceMatcher.group().length(), replaceText);
-
- if (operationCode == REPLACE) {
- return new Region(offset, replaceText.length());
- }
- }
-
- if (operationCode == FIND_FIRST || operationCode == FIND_NEXT) {
- if (forwardSearch) {
-
- boolean found= false;
- if (operationCode == FIND_FIRST)
- found= fFindReplaceMatcher.find(startOffset);
- else
- found= fFindReplaceMatcher.find();
-
- fFindReplaceState= operationCode;
-
- if (found && fFindReplaceMatcher.group().length() > 0) {
- return new Region(fFindReplaceMatcher.start(), fFindReplaceMatcher.group().length());
- } else {
- return null;
- }
- } else { // backward search
-
- boolean found= fFindReplaceMatcher.find(0);
- int index= -1;
- int length= -1;
- while (found && fFindReplaceMatcher.start() <= fFindReplaceMatchOffset) {
- index= fFindReplaceMatcher.start();
- length= fFindReplaceMatcher.group().length();
- found= fFindReplaceMatcher.find(index + 1);
- }
- fFindReplaceMatchOffset= index;
- if (index > -1) {
- // must set matcher to correct position
- fFindReplaceMatcher.find(index);
- return new Region(index, length);
- } else
- return null;
- }
- }
- return null;
- }
-
- /**
- * Converts a non-regex string to a pattern
- * that can be used with the regex search engine.
- *
- * @param string the non-regex pattern
- * @return the string converted to a regex pattern
- */
- private String asRegPattern(String string) {
- StringBuffer out= new StringBuffer(string.length());
- boolean quoting= false;
-
- for (int i= 0, length= string.length(); i < length; i++) {
- char ch= string.charAt(i);
- if (ch == '\\') {
- if (quoting) {
- out.append("\\E"); //$NON-NLS-1$
- quoting= false;
- }
- out.append("\\\\"); //$NON-NLS-1$
- continue;
- }
- if (!quoting) {
- out.append("\\Q"); //$NON-NLS-1$
- quoting= true;
- }
- out.append(ch);
- }
- if (quoting)
- out.append("\\E"); //$NON-NLS-1$
-
- return out.toString();
- }
-
- /**
- * Subsitutes the previous match with the given text.
- * Sends a <code>DocumentEvent</code> to all registered <code>IDocumentListener</code>.
- *
- * @param length the length of the specified range
- * @param text the substitution text
- * @param isRegExReplace if <code>true</code> <code>text</code> represents a regular expression
- * @return the replace region or <code>null</code> if there was no match
- * @throws BadLocationException if startOffset is an invalid document offset
- * @throws IllegalStateException if a REPLACE or REPLACE_FIND operation is not preceded by a successful FIND operation
- * @throws PatternSyntaxException if a regular expression has invalid syntax
- *
- * @see DocumentEvent
- * @see IDocumentListener
- */
- public IRegion replace(String text, boolean regExReplace) throws BadLocationException {
- return findReplace(FindReplaceOperationCode.REPLACE, -1, null, text, false, false, false, regExReplace);
- }
-
- // ---------- CharSequence implementation ----------
-
- /*
- * @see java.lang.CharSequence#length()
- */
- public int length() {
- return fDocument.getLength();
- }
-
- /*
- * @see java.lang.CharSequence#charAt(int)
- */
- public char charAt(int index) {
- try {
- return fDocument.getChar(index);
- } catch (BadLocationException e) {
- throw new IndexOutOfBoundsException();
- }
- }
-
- /*
- * @see java.lang.CharSequence#subSequence(int, int)
- */
- public CharSequence subSequence(int start, int end) {
- try {
- return fDocument.get(start, end - start);
- } catch (BadLocationException e) {
- throw new IndexOutOfBoundsException();
- }
- }
-
- /*
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return fDocument.get();
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceOperationCode.java b/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceOperationCode.java
deleted file mode 100644
index c348699fa80..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceOperationCode.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.jface.text;
-
-
-/**
- * Enumeration type declaring the available findReplace operation codes.
- *
- * @see org.eclipse.jface.text.FindReplaceDocumentAdapter#findReplace(int, String, String, boolean, boolean, boolean, boolean, int)
- * @since 3.0
- */
-public final class FindReplaceOperationCode {
-
- /**
- * The operation code's name.
- */
- private final String fName;
-
- /**
- * Creates and returns a new findReplace operation code.
- */
- private FindReplaceOperationCode(String operationName) {
- Assert.isNotNull(operationName);
- fName= operationName;
- }
-
- /*
- * @see Object#toString()
- */
- public String toString() {
- return fName;
- }
-
- /**
- * findReplace operation code used to find the first match.
- */
- public static final FindReplaceOperationCode FIND_FIRST= new FindReplaceOperationCode("findFirst"); //$NON-NLS-1$
-
- /**
- * findReplace operation code to find the next match.
- */
- public static final FindReplaceOperationCode FIND_NEXT= new FindReplaceOperationCode("findNext"); //$NON-NLS-1$
-
- /**
- * findReplace operation code to replace the current match.
- * This operation must be preceded by a <code>FIND_FIRST</code> or <code>FIND_NEXT</code> operation.
- */
- public static final FindReplaceOperationCode REPLACE= new FindReplaceOperationCode("replace"); //$NON-NLS-1$
-
- /**
- * findReplace operation code to replace the current match and find the next one.
- * This operation must be preceded by a <code>FIND_FIRST</code> or <code>FIND_NEXT</code> operation.
- */
- public static final FindReplaceOperationCode REPLACE_FIND_NEXT= new FindReplaceOperationCode("replaceAndFindNext"); //$NON-NLS-1$
-} \ No newline at end of file
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java b/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
deleted file mode 100644
index e0946cb613f..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-
-
-
-/**
- * Implements a gap managing text store. The gap text store
- * relies on the assumption that subsequent changes of a document are co-located.
- * The start of the gap is always moved to the location of the last change. The
- * size of the gap varies between the low water mark and the high water mark. <p>
- * This class is not intended to be subclassed.
- */
-public class GapTextStore implements ITextStore {
-
- /** The store's content */
- private char[] fContent= new char[0];
- /** Starting index of the gap */
- private int fGapStart= -1;
- /** End index of the gap */
- private int fGapEnd= -1;
-
- /** The high water mark. If the gap is larger than this, it will be shrunken */
- private int fHighWatermark;
- /** The low water mark, If this gap is smaller than this, it will be extended */
- private int fLowWatermark;
-
- /**
- * Creates a new empty text store using the specified low and high watermarks.
- *
- * @param lowWatermark if this gap is ever smaller than this, it will automatically be extended
- * @param highWatermark if the gap is ever larger than this, it will automatically be shrunken
- */
- public GapTextStore(int lowWatermark, int highWatermark) {
- Assert.isTrue(lowWatermark < highWatermark);
- fLowWatermark= lowWatermark;
- fHighWatermark= highWatermark;
- }
-
- /**
- * Adjusts the gap so that is at the right offset and capable of handling
- * the addition of a specified number of characters without having to be shifted.
- * The <code>sizeHint</code> represents the range that will be filled afterwards.
- * If the gap is already at the right offset, it must only be
- * resized if it will be no longer between the low and high watermark. However,
- * on delete (sizeHint &lt; 0) at the edges of the gap, the gap is only enlarged.
- *
- * @param offset the offset at which the change happens
- * @param sizeHint the number of character which will be inserted
- */
- private void adjustGap(int offset, int sizeHint) {
-
- if (offset == fGapStart) {
- int size= (fGapEnd - fGapStart) - sizeHint;
- if (fLowWatermark <= size && size <= fHighWatermark)
- return;
- }
-
- moveAndResizeGap(offset, sizeHint);
- }
-
- /**
- * Moves the gap to the specified offset and adjust its size to the
- * anticipated change size. The given size represents the expected
- * range of the gap that will be filled after the gap has been moved.
- * Thus the gap is resized to actual size + the specified size and
- * moved to the given offset.
- *
- * @param offset the offset where the gap is moved to
- * @param size the anticipated size of the change
- */
- private void moveAndResizeGap(int offset, int size) {
-
- char[] content= null;
- int oldSize= fGapEnd - fGapStart;
- int newSize= fHighWatermark + size;
-
-
- if (newSize < 0) {
-
- if (oldSize > 0) {
- content= new char[fContent.length - oldSize];
- System.arraycopy(fContent, 0, content, 0, fGapStart);
- System.arraycopy(fContent, fGapEnd, content, fGapStart, content.length - fGapStart);
- fContent= content;
- }
- fGapStart= fGapEnd= offset;
- return;
- }
-
-
- content= new char[fContent.length + (newSize - oldSize)];
-
- int newGapStart= offset;
- int newGapEnd= newGapStart + newSize;
-
- if (oldSize == 0) {
-
- System.arraycopy(fContent, 0, content, 0, newGapStart);
- System.arraycopy(fContent, newGapStart, content, newGapEnd, content.length - newGapEnd);
-
- } else if (newGapStart < fGapStart) {
-
- int delta= fGapStart - newGapStart;
- System.arraycopy(fContent, 0, content, 0, newGapStart);
- System.arraycopy(fContent, newGapStart, content, newGapEnd, delta);
- System.arraycopy(fContent, fGapEnd, content, newGapEnd + delta, fContent.length - fGapEnd);
-
- } else {
-
- int delta= newGapStart - fGapStart;
- System.arraycopy(fContent, 0, content, 0, fGapStart);
- System.arraycopy(fContent, fGapEnd, content, fGapStart, delta);
- System.arraycopy(fContent, fGapEnd + delta, content, newGapEnd, content.length - newGapEnd);
- }
-
-
- fContent= content;
- fGapStart= newGapStart;
- fGapEnd= newGapEnd;
- }
-
- /*
- * @see ITextStore#get(int)
- */
- public char get(int offset) {
-
- if (offset < fGapStart)
- return fContent[offset];
-
- int gapLength= fGapEnd - fGapStart;
- return fContent[offset + gapLength];
- }
-
- /*
- * @see ITextStore#get(int, int)
- */
- public String get(int offset, int length) {
-
- int end= offset + length;
-
- if (fContent == null)
- return ""; //$NON-NLS-1$
-
- if (end <= fGapStart)
- return new String(fContent, offset, length);
-
- if (fGapStart < offset) {
- int gapLength= fGapEnd - fGapStart;
- return new String(fContent, offset + gapLength , length);
- }
-
- StringBuffer buf= new StringBuffer();
- buf.append(fContent, offset, fGapStart - offset);
- buf.append(fContent, fGapEnd, end - fGapStart);
- return buf.toString();
- }
-
- /*
- * @see ITextStore#getLength()
- */
- public int getLength() {
- int length= fGapEnd - fGapStart;
- return (fContent.length - length);
- }
-
-
- /*
- * @see ITextStore#replace(int, int, String)
- */
- public void replace(int offset, int length, String text) {
-
- int textLength= (text == null ? 0 : text.length());
-
- // handle delete at the edges of the gap
- if (textLength == 0) {
- if (offset <= fGapStart && offset + length >= fGapStart && fGapStart > -1 && fGapEnd > -1) {
- length -= fGapStart - offset;
- fGapStart= offset;
- fGapEnd += length;
- return;
- }
- }
-
- // move gap
- adjustGap(offset + length, textLength - length);
-
- // overwrite
- int min= Math.min(textLength, length);
- for (int i= offset, j= 0; i < offset + min; i++, j++)
- fContent[i]= text.charAt(j);
-
- if (length > textLength) {
- // enlarge the gap
- fGapStart -= (length - textLength);
- } else if (textLength > length) {
- // shrink gap
- fGapStart += (textLength - length);
- for (int i= length; i < textLength; i++)
- fContent[offset + i]= text.charAt(i);
- }
- }
-
- /**
- * Sets the content to <code>text</code> and removes the gap
- * since there are no sensible predictions about
- * where the next change will occur.
- * @see ITextStore#set(String)
- */
- public void set(String text) {
-
- if (text == null)
- text= ""; //$NON-NLS-1$
-
- fContent= text.toCharArray();
-
- fGapStart= -1;
- fGapEnd= -1;
- }
-
- /**
- * Returns a copy of the content of this text store.
- * For internal use only.
- *
- * @return a copy of the content of this text store
- */
- protected String getContentAsString() {
- return new String(fContent);
- }
-
- /**
- * Returns the start index of the gap managed by this text store.
- * For internal use only.
- *
- * @return the start index of the gap managed by this text store
- */
- protected int getGapStartIndex() {
- return fGapStart;
- }
-
- /**
- * Returns the end index of the gap managed by this text store.
- * For internal use only.
- *
- * @return the end index of the gap managed by this text store
- */
- protected int getGapEndIndex() {
- return fGapEnd;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java
deleted file mode 100644
index 19cb981877b..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java
+++ /dev/null
@@ -1,571 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-
-/**
- * An <code>IDocument</code> represents text providing support for
- * <ul>
- * <li> text manipulation
- * <li> positions
- * <li> partitions
- * <li> line information
- * <li> search
- * <li> document change listeners
- * <li> document partition change listeners
- * </ul>
- *
- * A document allows to set its content and to manipulate it. For manipulation
- * a document provides the <code>replace</code> method which substitutes a given
- * string for a specified text range in the document. On each document change, all
- * registered document listeners are informed exactly once.
- *
- * Positions are stickers to the document's text that are updated when the
- * document is changed. Positions are updated by <code>IPositionUpdater</code>s. Position
- * updaters are managed as a list. The list defines the sequence in which position
- * updaters are invoked.This way, position updaters may rely on each other.
- * Positions are grouped into categories. A category is a ordered list of positions.
- * the document defines the order of position in a category based on the position's offset
- * based on the implementation of the method <code>computeIndexInCategory</code>.
- * Each document must support a default position category whose name is specified by this
- * interface.<p>
- *
- * A document can be considered consisting of a sequence of not overlapping partitions.
- * A partition is defined by its offset, its length, and its type. Partitions are
- * updated on every document manipulation and ensured to be up-to-date when the document
- * listeners are informed. A document uses an <code>IDocumentPartitioner</code> to
- * manage its partitions. A document may be unpartitioned which happens when there is no
- * partitioner. In this case, the document is considered as one single partition of a
- * default type. The default type is specified by this interface. If a document change
- * changes the document's partitioning all registered partitioning listeners are
- * informed exactly once.<p>
- *
- * An <code>IDocument</code> provides methods to map line numbers and character
- * positions onto each other based on the document's line delimiters. When moving text
- * between documents using different line delimiters, the text must be converted to
- * use the target document's line delimiters. <p>
- *
- * <code>IDocument</code> throws <code>BadLocationException</code> if the parameters of
- * queries or manipulation requests are not inside the bounds of the document. The purpose
- * of this style of exception handling is
- * <ul>
- * <li> prepare document for multi-thread access
- * <li> allow clients to implement backtracking recovery methods
- * <li> prevent clients from upfront contract checking when dealing with documents.
- * </ul>
- * Clients may implement this interface or use the default implementation provided
- * by <code>AbstractDocument</code> and <code>Document</code>.
- *
- * @see Position
- * @see IPositionUpdater
- * @see IDocumentPartitioner
- * @see ILineTracker
- * @see IDocumentListener
- * @see IDocumentPartitioningListener
- */
-public interface IDocument {
-
-
- /**
- * The identifier of the default position category.
- */
- final static String DEFAULT_CATEGORY= "__dflt_position_category"; //$NON-NLS-1$
-
- /**
- * The identifier of the default partition content type.
- */
- final static String DEFAULT_CONTENT_TYPE= "__dftl_partition_content_type"; //$NON-NLS-1$
-
-
-
-
- /* --------------- text access and manipulation --------------------------- */
-
- /**
- * Returns the character at the given document offset in this document.
- *
- * @param offset a document offset
- * @return the character at the offset
- * @exception BadLocationException if the offset is invalid in this document
- */
- char getChar(int offset) throws BadLocationException;
-
- /**
- * Returns the number of characters in this document.
- *
- * @return the number of characters in this document
- */
- int getLength();
-
- /**
- * Returns this document's complete text.
- *
- * @return the document's complete text
- */
- String get();
-
- /**
- * Returns this document's text for the specified range.
- *
- * @param offset the document offset
- * @param length the length of the specified range
- * @return the document's text for the specified range
- * @exception BadLocationException if the range is invalid in this document
- */
- String get(int offset, int length) throws BadLocationException;
-
- /**
- * Replaces the content of the document with the given text.
- * Sends a <code>DocumentEvent</code> to all registered <code>IDocumentListener</code>.
- * This method is a convenience method for <code>
- * replace(0, getLength(), text)</code>.
- *
- * @param text the new content of the document
- *
- * @see DocumentEvent
- * @see IDocumentListener
- */
- void set(String text);
-
- /**
- * Subsitutes the given text for the specified document range.
- * Sends a <code>DocumentEvent</code> to all registered <code>IDocumentListener</code>.
- *
- * @param offset the document offset
- * @param length the length of the specified range
- * @param text the substitution text
- * @exception BadLocationException if the offset is invalid in this document
- *
- * @see DocumentEvent
- * @see IDocumentListener
- */
- void replace(int offset, int length, String text) throws BadLocationException;
-
- /**
- * Registers the document listener with the document. After registration
- * the IDocumentListener is informed about each change of this document.
- * If the listener is already registered nothing happens.<p>
- * An <code>IDocumentListener</code> may call back to this method
- * when being inside a document notification.
- *
- * @param listener the listener to be registered
- */
- void addDocumentListener(IDocumentListener listener);
-
- /**
- * Removes the listener from the document's list of document listeners.
- * If the listener is not registered with the document nothing happens.<p>
- * An <code>IDocumentListener</code> may call back to this method
- * when being inside a document notification.
- *
- * @param listener the listener to be removed
- */
- void removeDocumentListener(IDocumentListener listener);
-
- /**
- * Adds the given document listener as one which is notified before
- * those document listeners added with <code>addDocumentListener</code>
- * are notified. If the given listener is also registered using
- * <code>addDocumentListener</code> it will be notified twice.
- * If the listener is already registered nothing happens.<p>
- *
- * This method is not for public use, it may only be called by
- * implementers of <code>IDocumentAdapter</code> and only if those
- * implementers need to implement <code>IDocumentListener</code>.
- *
- * @param documentAdapter the listener to be added as prenotified document listener
- */
- void addPrenotifiedDocumentListener(IDocumentListener documentAdapter);
-
- /**
- * Removes the given document listener from the document's list of
- * prenotified document listeners. If the listener is not registered
- * with the document nothing happens. <p>
- *
- * This method is not for public use, it may only be called by
- * implementers of <code>IDocumentAdapter</code> and only if those
- * implementers need to implement <code>IDocumentListener</code>.
- *
- * @param documentAdapter the listener to be removed
- *
- * @see #addPrenotifiedDocumentListener(IDocumentListener)
- */
- void removePrenotifiedDocumentListener(IDocumentListener documentAdapter);
-
-
-
- /* -------------------------- positions ----------------------------------- */
-
- /**
- * Adds a new position category to the document. If the position category
- * already exists nothing happens.
- *
- * @param category the category to be added
- */
- void addPositionCategory(String category);
-
- /**
- * Deletes the position category from the document. All positions
- * in this category are thus deleted as well.
- *
- * @param category the category to be removed
- * @exception BadPositionCategoryException if category is undefined in this document
- */
- void removePositionCategory(String category) throws BadPositionCategoryException;
-
- /**
- * Returns all position categories of this document. This
- * includes the default position category.
- *
- * @return the document's position categories
- */
- String[] getPositionCategories();
-
- /**
- * Checks the presence of the specified position category.
- *
- * @param category the category to check
- * @return <code>true</code> if category is defined
- */
- boolean containsPositionCategory(String category);
-
- /**
- * Adds the position to the document's default position category.
- * This is a convenience method for <code>addPosition(DEFAULT_CATEGORY, position)</code>.
- *
- * @param position the position to be added
- * @exception BadLocationException if position describes an invalid range in this document
- */
- void addPosition(Position position) throws BadLocationException;
-
- /**
- * Removes the given position from the document's default position category.
- * This is a convenience method for <code>removePosition(DEFAULT_CATEGORY, position)</code>.
- *
- * @param position the position to be removed
- */
- void removePosition(Position position);
-
- /**
- * Adds the position to the specified position category of the document.
- * A position that has been added to a position category is updated on each
- * change applied to the document. Positions may be added multiple times.
- * The order of the category is maintained.
- *
- * @param category the category to which to add
- * @param position the position to be added
- * @exception BadLocationException if position describes an invalid range in this document
- * @exception BadPositionCategoryException if the category is undefined in this document
- */
- void addPosition(String category, Position position) throws BadLocationException, BadPositionCategoryException;
-
- /**
- * Removes the given position from the specified position category.
- * If the position is not part of the specified category nothing happens.
- * If the position has been added multiple times, only the first occurence is deleted.
- *
- * @param category the category from which to delete
- * @param position the position to be deleted
- * @exception BadPositionCategoryException if category is undefined in this document
- */
- void removePosition(String category, Position position) throws BadPositionCategoryException;
-
- /**
- * Returns all positions of the given position category.
- * The positions are ordered according to the category's order.
- * Manipulating this list does not affect the document, but manipulating the
- * position does affect the document.
- *
- * @param category the category
- * @return the list of all positions
- * @exception BadPositionCategoryException if category is undefined in this document
- */
- Position[] getPositions(String category) throws BadPositionCategoryException;
-
- /**
- * Determines whether a position described by the parameters is managed by this document.
- *
- * @param category the category to check
- * @param offset the offset of the position to find
- * @param length the length of the position to find
- * @return <code>true</code> if position is found
- */
- boolean containsPosition(String category, int offset, int length);
-
- /**
- * Computes the index at which a <code>Position</code> with the
- * specified offset would be inserted into the given category. As the
- * ordering inside a category only depends on the offset, the index must be
- * choosen to be the first of all positions with the same offset.
- *
- * @param category the category in which would be added
- * @param offset the position offset to be considered
- * @return the index into the category
- * @exception BadLocationException if offset is invalid in this document
- * @exception BadPositionCategoryException if category is undefined in this document
- */
- int computeIndexInCategory(String category, int offset) throws BadLocationException, BadPositionCategoryException;
-
- /**
- * Appends a new position updater to the document's list of position updaters.
- * Position updaters may be added multiple times.<p>
- * An <code>IPositionUpdater</code> may call back to this method
- * when being inside a document notification.
- *
- * @param updater the updater to be added
- */
- void addPositionUpdater(IPositionUpdater updater);
-
- /**
- * Removes the position updater from the document's list of position updaters.
- * If the position updater has multiple occurences only the first occurence is
- * removed. If the position updater is not registered with this document, nothing
- * happens.<p>
- * An <code>IPositionUpdater</code> may call back to this method
- * when being inside a document notification.
- *
- * @param updater the updater to be removed
- */
- void removePositionUpdater(IPositionUpdater updater);
-
- /**
- * Inserts the position updater at the specified index in the document's
- * list of position updaters. Positions updaters may be inserted multiple times.<p>
- * An <code>IPositionUpdater</code> may call back to this method
- * when being inside a document notification.
- *
- * @param updater the updater to be inserted
- * @param index the index in the document's updater list
- */
- void insertPositionUpdater(IPositionUpdater updater, int index);
-
- /**
- * Returns the list of position updaters attached to the document.
- *
- * @return the list of position updaters
- */
- IPositionUpdater[] getPositionUpdaters();
-
-
-
-
- /* -------------------------- partitions ---------------------------------- */
-
- /**
- * Returns the set of legal content types of document partitions.
- * This set can be empty. The set can contain more content types than
- * contained by the result of <code>getPartitioning(0, getLength())</code>.
- *
- * @return the set of legal content types
- */
- String[] getLegalContentTypes();
-
- /**
- * Returns the type of the document partition containing the given offset.
- * This is a convenience method for <code>getPartition(offset).getType()</code>.
- *
- * @param offset the document offset
- * @return the partition type
- * @exception BadLocationException if offset is invalid in this document
- */
- String getContentType(int offset) throws BadLocationException;
-
- /**
- * Returns the document partition in which the position is located.
- *
- * @param offset the document offset
- * @return a specification of the partition
- * @exception BadLocationException if offset is invalid in this document
- */
- ITypedRegion getPartition(int offset) throws BadLocationException;
-
- /**
- * Computes the partitioning of the given document range using the
- * document's partitioner.
- *
- * @param offset the document offset at which the range starts
- * @param length the length of the document range
- * @return a specification of the range's partitioning
- * @exception BadLocationException if the range is invalid in this document
- */
- ITypedRegion[] computePartitioning(int offset, int length) throws BadLocationException;
-
- /**
- * Registers the document partitioning listener with the document. After registration
- * the document partitioning listener is informed about each partition change
- * cause by a document manipulation or by changing the document's partitioner.
- * If a document partitioning listener is also
- * a document listener, the following notification sequence is guaranteed if a
- * document manipulation changes the document partitioning:
- * <ul>
- * <li>listener.documentAboutToBeChanged(DocumentEvent);
- * <li>listener.documentPartitioningChanged();
- * <li>listener.documentChanged(DocumentEvent);
- * </ul>
- * If the listener is already registered nothing happens.<p>
- * An <code>IDocumentPartitioningListener</code> may call back to this method
- * when being inside a document notification.
- *
- * @param listener the listener to be added
- */
- void addDocumentPartitioningListener(IDocumentPartitioningListener listener);
-
- /**
- * Removes the listener from this document's list of document partitioning
- * listeners. If the listener is not registered with the document nothing
- * happens.<p>
- * An <code>IDocumentPartitioningListener</code> may call back to this method
- * when being inside a document notification.
- *
- * @param listener the listener to be removed
- */
- void removeDocumentPartitioningListener(IDocumentPartitioningListener listener);
-
- /**
- * Sets this document's partitioner. The caller of this method is responsible for
- * disconnecting the document's old partitioner from the document and to
- * connect the new partitioner to the document. Informs all document partitioning
- * listeners about this change.
- *
- * @param the document's new partitioner
- *
- * @see IDocumentPartitioningListener
- */
- void setDocumentPartitioner(IDocumentPartitioner partitioner);
-
- /**
- * Returns this document's partitioner.
- *
- * @return this document's partitioner
- */
- IDocumentPartitioner getDocumentPartitioner();
-
-
-
- /* ---------------------- line information -------------------------------- */
-
- /**
- * Returns the length of the given line including the line's delimiter.
- *
- * @param line the line of interest
- * @return the length of the line
- * @exception BadLocationException if the line number is invalid in this document
- */
- int getLineLength(int line) throws BadLocationException;
-
- /**
- * Returns the number of the line at which the character of the specified position is located.
- * The first line has the line number 0. A new line starts directly after a line
- * delimiter. <code>(pos == document length)</code> is a valid argument also there is no
- * corresponding character.
- *
- * @param offset the document offset
- * @return the number of the line
- * @exception BadLocationException if the offset is invalid in this document
- */
- int getLineOfOffset(int offset) throws BadLocationException;
-
- /**
- * Determines the offset of the first character of the given line.
- *
- * @param line the line of interest
- * @return the document offset
- * @exception BadLocationException if the line number is invalid in this document
- */
- int getLineOffset(int line) throws BadLocationException;
-
- /**
- * Returns a description of the specified line. The line is described by its
- * offset and its length excluding the line's delimiter.
- *
- * @param line the line of interest
- * @return a line description
- * @exception BadLocationException if the line number is invalid in this document
- */
- IRegion getLineInformation(int line) throws BadLocationException;
-
- /**
- * Returns a description of the line at the given offset.
- * The description contains the offset and the length of the line
- * excluding the line's delimiter.
- *
- * @param offset the offset whose line should be described
- * @return a region describing the line
- * @exception BadLocationException if offset is invalid in this document
- */
- IRegion getLineInformationOfOffset(int offset) throws BadLocationException;
-
- /**
- * Returns the number of lines in this document
- *
- * @return the number of lines in this document
- */
- int getNumberOfLines();
-
- /**
- * Returns the number of lines which are occupied by a given text range.
- *
- * @param offset the offset of the specified text range
- * @param length the length of the specified text range
- * @return the number of lines occupied by the specified range
- * @exception BadLocationException if specified range is invalid in this tracker
- */
- int getNumberOfLines(int offset, int length) throws BadLocationException;
-
- /**
- * Computes the number of lines in the given text. For a given
- * implementer of this interface this method returns the same
- * result as <code>set(text); getNumberOfLines()</code>.
- *
- * @param text the text whose number of lines should be computed
- * @return the number of lines in the given text
- */
- int computeNumberOfLines(String text);
-
-
- /* ------------------ line delimiter conversion --------------------------- */
-
- /**
- * Returns the document's legal line delimiters.
- *
- * @return the document's legal line delimiters
- */
- String[] getLegalLineDelimiters();
-
- /**
- * Returns the line delimiter of that line or <code>null</code> if the
- * line is not closed with a line delimiter.
- *
- * @param line the line of interest
- * @return the line's delimiter or <code>null</code> if line does not have a delimiter
- * @exception BadLocationException if the line number is invalid in this document
- */
- String getLineDelimiter(int line) throws BadLocationException;
-
-
- /* ---------------------------- search ------------------------------------ */
-
- /**
- * Returns the offset of a given search string in the document based on a set of search criteria.
- *
- * @param startOffset document offset at which search starts
- * @param findString the string to find
- * @param forwardSearch the search direction
- * @param caseSensitive indicates whether lower and upper case should be distinguished
- * @param wholeWord indicates whether the findString should be limited by white spaces as
- * defined by Character.isWhiteSpace
- * @return the offset of the first occurence of findString based on the parameters or -1 if no match is found
- * @exception BadLocationException if startOffset is an invalid document offset
- * @deprecated as of 3.0 search is provided by {@link FindReplaceDocumentAdapter}
- */
- int search(int startOffset, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord) throws BadLocationException;
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension.java
deleted file mode 100644
index 3bce61447a1..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension.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.text;
-
-/**
- * Extension interface for <code>IDocument</code>. <p>
- *
- * It introduces the notion of sequentially rewriting a document. This is to tell a
- * document that a sequence of non-overlapping replace operation is about to be
- * performed.<p>
- *
- * Is also introduces the concept of post notification replaces. This is, a document
- * listener who is informed about a document change can cause a derived document
- * change. As the listener is not allowed to directly modify the document, it can
- * register a replace operation that is performed directly after all document listeners
- * have been notified.
- *
- * @since 2.0
- */
-public interface IDocumentExtension {
-
- /**
- * Interface for a post notification replace operation.
- */
- public interface IReplace {
-
- /**
- * Executes the replace operation on the given document.
- * @param document the document to be changed
- * @param owner the owner of this replace operation
- */
- void perform(IDocument document, IDocumentListener owner);
- };
-
- /**
- * Callback for document listeners to be used inside <code>documentChanged</code>
- * to register a post notification replace operation on the document notifying them.
- *
- * @param owner the owner of the replace operation
- * @param the replace operation to be executed
- * @exception UnsupportedOperationException if <code>registerPostNotificationReplace</code>
- * is not supported by this document
- */
- void registerPostNotificationReplace(IDocumentListener owner, IReplace replace) throws UnsupportedOperationException;
-
- /**
- * Stops the processing of registered post notification replace operations until
- * <code>resumePostNotificationProcessing</code> is called.
- */
- void stopPostNotificationProcessing();
-
- /**
- * Resumes the processing of post notification replace operations. If the queue of registered
- * <code>IDocumentExtension.IReplace</code> objects is not empty, they are immediately processed if the
- * document is not inside a replace operation. If the document is inside a replace operation,
- * they are processed directly after the replace operation has finished.
- */
- void resumePostNotificationProcessing();
-
- /**
- * Tells the document that it is about to be sequentially rewritten. That is a
- * sequence of non-overlapping replace operations will be performed on it. The
- * <code>normalize</code> flag indicates whether the rewrite is preformed from
- * the start of the document to its end or from an arbitrary start offset.
- *
- * @param normalize <code>true</code> if performed from the start to the end of the document
- */
- void startSequentialRewrite(boolean normalize);
-
- /**
- * Tells the document that the sequential rewrite has been finished.
- */
- void stopSequentialRewrite();
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension2.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension2.java
deleted file mode 100644
index c785a6761ff..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension2.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.text;
-
-/**
- * Extension interface for <code>IDocument</code>. <p>
- * It adds configurability to the mechanism of post notification replaces and allows to
- * postpone document listener notification.
- *
- * @since 2.1
- */
-public interface IDocumentExtension2 {
-
- /**
- * Tells the receiver to ignore calls to
- * <code>registerPostNotificationReplace</code> until
- * <code>acceptPostNotificationReplaces</code> is called.
- */
- void ignorePostNotificationReplaces();
-
- /**
- * Tells the receiver to accept calls to
- * <code>registerPostNotificationReplace</code> until
- * <code>ignorePostNotificationReplaces</code> is called.
- */
- void acceptPostNotificationReplaces();
-
- /**
- * Can be called prior to a <code>replace</code> operation. After the
- * <code>replace</code> <code>resumeListenerNotification</code> must be
- * called. The affect of these calls is that no document listener is notified
- * until <code>resumeListenerNotification</code> is called. This allows clients
- * to update structure before any listener is informed about the change.<p>
- * Listener notification can only be stopped for a single document manipulation.
- * Otherwise, document change notifications will be lost.
- */
- void stopListenerNotification();
-
- /**
- * Resumes the notification of document listeners which must previously
- * have been stopped by a call to <code>stopListenerNotification</code>.
- */
- void resumeListenerNotification();
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension3.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension3.java
deleted file mode 100644
index fbea0a81231..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension3.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.jface.text;
-
-/**
- * Extension interface for <code>IDocument</code>. Adds the concept of multiple partitionings.
- *
- * @since 3.0
- */
-public interface IDocumentExtension3 {
-
- /**
- * The identifier of the default partitioning.
- */
- final static String DEFAULT_PARTITIONING= "__dftl_partitioning"; //$NON-NLS-1$
-
-
- /**
- * Returns the exisiting partitionings for this document. This includes
- * the default partitioning.
- *
- * @return the existing partitionings for this document
- */
- String[] getPartitionings();
-
- /**
- * Returns the set of legal content types of document partitions for the given partitioning
- * This set can be empty. The set can contain more content types than contained by the
- * result of <code>getPartitioning(partitioning, 0, getLength())</code>.
- *
- * @param partitioning the partitioning for which to return the legal content types
- * @return the set of legal content types
- * @exception BadPartitioningException if partitioning is invalid for this document
- */
- String[] getLegalContentTypes(String partitioning) throws BadPartitioningException;
-
- /**
- * Returns the type of the document partition containing the given offset for the
- * given partitioning. This is a convenience method for
- * <code>getPartition(partitioning, offset).getType()</code>.
- *
- * @param partitioning the partitioning
- * @param offset the document offset
- * @return the partition type
- * @exception BadLocationException if offset is invalid in this document
- * @exception BadPartitioningException if partitioning is invalid for this document
- */
- String getContentType(String partitioning, int offset) throws BadLocationException, BadPartitioningException;
-
- /**
- * Returns the document partition of the given partitioning in which the given offset is located.
- *
- * @param partitioning the document partitioning
- * @param offset the document offset
- * @return a specification of the partition
- * @exception BadLocationException if offset is invalid in this document
- * @exception BadPartitioningException if partitioning is invalid for this document
- */
- ITypedRegion getPartition(String partitioning, int offset) throws BadLocationException, BadPartitioningException;
-
- /**
- * Computes the partitioning of the given document range based on the given partitioning.
- *
- * @param partitioning the document's partitioning
- * @param offset the document offset at which the range starts
- * @param length the length of the document range
- * @return a specification of the range's partitioning
- * @exception BadLocationException if the range is invalid in this document
- */
- ITypedRegion[] computePartitioning(String partitioning, int offset, int length) throws BadLocationException, BadPartitioningException;
-
- /**
- * Sets this document's partitioner. The caller of this method is responsible for
- * disconnecting the document's old partitioner from the document and to
- * connect the new partitioner to the document. Informs all document partitioning
- * listeners about this change.
- *
- * @param partitioning the partitioning for which to set the partitioner
- * @param the document's new partitioner
- * @see IDocumentPartitioningListener
- */
- void setDocumentPartitioner(String partitioning, IDocumentPartitioner partitioner);
-
- /**
- * Returns the partitioner for the given partitioning or <code>null</code> if
- * no partitioner is registered.
- *
- * @return the partitioner for the given partitioning
- */
- IDocumentPartitioner getDocumentPartitioner(String partitioning);
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentInformationMapping.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentInformationMapping.java
deleted file mode 100644
index 6332309963c..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentInformationMapping.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.jface.text;
-
-
-/**
- * A <code>IDocumentInformationMapping</code> represents a mapping between the coordinates of two
- * <code>IDocument</code> objects: the original and the image. The document information mapping
- * can translate document information such as line numbers or character ranges given for the original into
- * the corresponding information of the image and wise versa.
- *
- * @since 2.1
- */
-public interface IDocumentInformationMapping {
-
- /**
- * Returns the minimal region of the original document that completely comprises all of the image document
- * or <code>null</code> if there is no such region.
- *
- * @return the minimal region of the original document comprising the image document or <code>null</code>
- */
- IRegion getCoverage();
-
- /**
- * Returns the offset in the original document that corresponds to the given offset in the image document
- * or <code>-1</code> if there is no such offset
- *
- * @param imageOffset the offset in the image document
- * @return the corresponding offset in the original document or <code>-1</code>
- * @throws BadLocationException if <code>imageOffset</code> is not a valid offset in the image document
- */
- int toOriginOffset(int imageOffset) throws BadLocationException;
-
- /**
- * Returns the minimal region of the original document that completely comprises the given region of the
- * image document or <code>null</code> if there is no such region.
- *
- * @param imageRegion the region of the image document
- * @return the minimal region of the original document comprising the given region of the image document
- * @throws BadLocationException if <code>imageRegion</code> is not a valid region of the image document
- */
- IRegion toOriginRegion(IRegion imageRegion) throws BadLocationException;
-
- /**
- * Returns the range of lines of the original document that corresponds to the given line of the image document or
- * <code>null</code> if there are no such lines.
- *
- * @param imageLine the line of the image document
- * @return the corresponding lines of the original document or <code>null</code>
- * @throws BadLocationException if <code>imageLine</code> is not a valid line number in the image document
- */
- IRegion toOriginLines(int imageLine) throws BadLocationException;
-
- /**
- * Returns the line of the original document that corresponds to the given line of the image document or
- * <code>-1</code> if there is no such line.
- *
- * @param imageLine the line of the image document
- * @return the corresponding line of the original document or <code>-1</code>
- * @throws BadLocationException if <code>imageLine</code> is not a valid line number in the image document
- */
- int toOriginLine(int imageLine) throws BadLocationException;
-
-
-
- /**
- * Returns the offset in the image document that corresponds to the given offset in the original document
- * or <code>-1</code> if there is no such offset
- *
- * @param originOffset the offset in the original document
- * @return the corresponding offset in the image document or <code>-1</code>
- * @throws BadLocationException if <code>originOffset</code> is not a valid offset in the original document
- */
- int toImageOffset(int originOffset) throws BadLocationException;
-
- /**
- * Returns the minimal region of the image document that completely comprises the given region of the
- * original document or <code>null</code> if there is no such region.
- *
- * @param originRegion the region of the original document
- * @return the minimal region of the image document comprising the given region of the original document or <code>null</code>
- * @throws BadLocationException if <code>originRegion</code> is not a valid region of the original document
- */
- IRegion toImageRegion(IRegion originRegion) throws BadLocationException;
-
- /**
- * Returns the line of the image document that corresponds to the given line of the original document or
- * <code>-1</code> if there is no such line.
- *
- * @param originLine the line of the original document
- * @return the corresponding line of the image document or <code>-1</code>
- * @throws BadLocationException if <code>originLine</code> is not a valid line number in the original document
- */
- int toImageLine(int originLine) throws BadLocationException;
-
- /**
- * Returns the line of the image document whose corresponding line in the original document
- * is closest to the given line in the original document.
- *
- * @param originLine the line in the original document
- * @return the line in the image document that corresponds best to the given line in the original document
- * @throws BadLocationException if <code>originLine</code>is not a valid line in the original document
- */
- int toClosestImageLine(int originLine) throws BadLocationException;
-} \ No newline at end of file
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentListener.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentListener.java
deleted file mode 100644
index 6111bf7270b..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentListener.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.text;
-
-
-
-/**
- * Interface for objects which are interested in getting informed about
- * document changes. A listener is informed about document changes before
- * they are applied and after they have been applied. It is ensured that
- * the document event passed into the listener is the same for the two
- * notifications, i.e. the two document events can be checked using object identity.
- * Clients may implement this interface.
- */
-public interface IDocumentListener {
-
-
- /**
- * The manipulation described by the document event will be performed.
- *
- * @param event the document event describing the document change
- */
- void documentAboutToBeChanged(DocumentEvent event);
-
- /**
- * The manipulation described by the document event has been performed.
- *
- * @param event the document event describing the document change
- */
- void documentChanged(DocumentEvent event);
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioner.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioner.java
deleted file mode 100644
index f0c86998ae9..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioner.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.jface.text;
-
-
-
-/**
- * A document partitioner divides a document into a set
- * of disjoint text partitions. Each partition has a content type, an
- * offset, and a length. The document partitioner is connected to one document
- * and informed about all changes of this document before any of the
- * document's document listeners. A document partitioner can thus
- * incrementally update on the receipt of a document change event.
- * Clients may implement this interface or use the standard
- * implementation <code>RuleBasedDocumentPartitioner</code>.
- *
- * @see IDocument
- */
-public interface IDocumentPartitioner {
-
- /**
- * Connects the partitioner to a document.
- * Connect indicates the begin of the usage of the receiver
- * as partitioner of the given document. Thus, resources the partitioner
- * needs to be operational for this document should be allocated.<p>
- * The caller of this method must ensure that this partitioner is
- * also set as the document's document partitioner.
- *
- * @param document the document to be connected to
- */
- void connect(IDocument document);
-
- /**
- * Disconnects the partitioner from the document it is connected to.
- * Disconnect indicates the end of the usage of the receiver as
- * partitioner of the connected document. Thus, resources the partitioner
- * needed to be operation for its connected document should be deallocated.<p>
- * The caller of this method should also must ensure that this partitioner is
- * no longer the document's partitioner.
- */
- void disconnect();
-
- /**
- * Informs about a forthcoming document change. Will be called by the
- * connected document and is not intended to be used by clients
- * other than the connected document.
- *
- * @param event the event describing the forthcoming change
- */
- void documentAboutToBeChanged(DocumentEvent event);
-
- /**
- * The document has been changed. The partitioner updates
- * the document's partitioning and returns whether the structure of the
- * document partitioning has been changed, i.e. whether partitions
- * have been added or removed. Will be called by the connected document and
- * is not intended to be used by clients other than the connected document.
- *
- * @param event the event describing the document change
- * @return <code>true</code> if partitioning changed
- */
- boolean documentChanged(DocumentEvent event);
-
- /**
- * Returns the set of all legal content types of this partitioner.
- * I.e. any result delivered by this partitioner may not contain a content type
- * which would not be included in this method's result.
- *
- * @return the set of legal content types
- */
- String[] getLegalContentTypes();
-
- /**
- * Returns the content type of the partition containing the
- * given offset in the connected document. There must be a
- * document connected to this partitioner.
- *
- * @param offset the offset in the connected document
- * @return the content type of the offset's partition
- */
- String getContentType(int offset);
-
- /**
- * Returns the partitioning of the given range of the connected
- * document. There must be a document connected to this partitioner.
- *
- * @param offset the offset of the range of interest
- * @param length the length of the range of interest
- * @return the partitioning of the range
- */
- ITypedRegion[] computePartitioning(int offset, int length);
-
- /**
- * Returns the partition containing the given offset of
- * the connected document. There must be a document connected to this
- * partitioner.
- *
- * @param offset the offset for which to determine the partition
- * @return the partition containing the offset
- */
- ITypedRegion getPartition(int offset);
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitionerExtension.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitionerExtension.java
deleted file mode 100644
index a7d636c15e8..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitionerExtension.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.text;
-
-
-/**
- * Extension interface for <code>IDocumentPartitioner</code>. Extends the original
- * concept of a document partitioner by returning the minimal region that includes all
- * partition changes caused by the invocation of the document partitioner.
- *
- * The method <code>documentChanged2</code> is considered the replacement of
- * <code>IDocumentPartitioner.documentChanged</code>.
- *
- * @since 2.0
-
-*/
-public interface IDocumentPartitionerExtension {
-
- /**
- * The document has been changed. The partitioner updates
- * the document's partitioning and returns the minimal region that comprises
- * all partition changes caused by the given document event. This method returns
- * <code>null</code> if the partitioning did not change.<p>
- *
- * Will be called by the connected document and is not intended to be used by
- * clients other than the connected document.
- *
- * @param event the event describing the document change
- * @return the region of the document in which the partition type changed
- */
- IRegion documentChanged2(DocumentEvent event);
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitionerExtension2.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitionerExtension2.java
deleted file mode 100644
index bc4a25a63b3..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitionerExtension2.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.text;
-
-
-/**
- * Extension interface for <code>IDocumentPartitioner</code>. Extends the original
- * concept of a document partitioner to answer the position categories that are used
- * to manage the partitioning information.
- *
- * @since 3.0
-
-*/
-public interface IDocumentPartitionerExtension2 {
-
- /**
- * Returns the position categories that this partitoners uses in order to manage
- * the partitioning information of the documents. Returns <code>null</code> if
- * no position category is used.
- *
- * @return the position categories used to manage partitioning information
- */
- String[] getManagingPositionCategories();
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListener.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListener.java
deleted file mode 100644
index 320f499e3b0..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListener.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.text;
-
-
-
-/**
- * Interface of objects which are interested in getting informed
- * about changes of a document's partitioning. Clients may
- * implement this interface.
- *
- * @see IDocument
- * @see IDocumentPartitioner
- */
-public interface IDocumentPartitioningListener {
-
- /**
- * The partitioning of the given document changed.
- *
- * @param document the document whose partitioning changed
- *
- * @see IDocument#addDocumentPartitioningListener
- */
- void documentPartitioningChanged(IDocument document);
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListenerExtension.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListenerExtension.java
deleted file mode 100644
index 8f1b4e37f51..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListenerExtension.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.text;
-
-
-/**
- * Extension interface for <code>IDocumentPartitioningListener</code>. Extends the original
- * partitioning listener concept by telling the listener the minimal region that comprises all
- * partitioning changes.
- *
- * @see org.eclipse.jface.text.IDocumentPartitionerExtension
- * @since 2.0
- */
-public interface IDocumentPartitioningListenerExtension {
-
- /**
- * The partitioning of the given document changed in the given region.
- *
- * @param document the document whose partitioning changed
- * @param region the region in which the partitioning changed
- * @see IDocument#addDocumentPartitioningListener
- */
- void documentPartitioningChanged(IDocument document, IRegion region);
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListenerExtension2.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListenerExtension2.java
deleted file mode 100644
index 229149ec185..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListenerExtension2.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.jface.text;
-
-/**
- * Extension interface to <code>|DocumentPartitioningListener</code>. Replaces the previous concepts.
- *
- * @since 3.0
- */
-public interface IDocumentPartitioningListenerExtension2 {
-
- /**
- * Signals the change of document partitionings.
- *
- * @param event the event describing the change
- * @see IDocument#addDocumentPartitioningListener
- */
- void documentPartitioningChanged(DocumentPartitioningChangedEvent event);
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/ILineTracker.java b/org.eclipse.text/src/org/eclipse/jface/text/ILineTracker.java
deleted file mode 100644
index 837b845c65e..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/ILineTracker.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.text;
-
-
-/**
- * A line tracker maps character positions to line numbers and vice versa.
- * Initially the line tracker is informed about its underlying text
- * in order to initialize the mapping information. After that, the line
- * tracker is informed about all changes of the underlying text allowing
- * for incremental updates of the mapping information. It is the client's
- * responsibility to actively inform the line tacker about text changes.
- * For example, when using a line tracker in combination with a document
- * the document controls the line tracker.<p>
- * Clients may implement this interface or use the standard implementation
- * <code>DefaultLineTracker</code>.
- */
-public interface ILineTracker {
-
- /**
- * Returns the strings this tracker considers as legal line delimiters.
- *
- * @return the legal line delimiters
- */
- String[] getLegalLineDelimiters();
-
- /**
- * Returns the line delimiter of the specified line. Returns <code>null</code> if the
- * line is not closed with a line delimiter.
- *
- * @param line the line whose line delimiter is queried
- * @return the line's delimiter or <code>null</code> if line does not have a delimiter
- * @exception BadLocationException if the line number is invalid in this tracker's line structure
- */
- String getLineDelimiter(int line) throws BadLocationException;
-
- /**
- * Computes the number of lines in the given text.
- *
- * @param text the text whose number of lines should be computed
- * @return the number of lines in the given text
- */
- int computeNumberOfLines(String text);
-
- /**
- * Returns the number of lines.
- *
- * @return the number of lines in this tracker's line structure
- */
- int getNumberOfLines();
-
- /**
- * Returns the number of lines which are occupied by a given text range.
- *
- * @param offset the offset of the specified text range
- * @param length the length of the specified text range
- * @return the number of lines occupied by the specified range
- * @exception BadLocationException if specified range is unknown to this tracker
- */
- int getNumberOfLines(int offset, int length) throws BadLocationException;
-
- /**
- * Returns the position of the first character of the specified line.
- *
- * @param line the line of interest
- * @return offset of the first character of the line
- * @exception BadLocationException if the line is unknown to this tracker
- */
- int getLineOffset(int line) throws BadLocationException;
-
- /**
- * Returns length of the specified line including the line's delimiter.
- *
- * @param line the line of interest
- * @return the length of the line
- * @exception BadLocationException if line is unknown to this tracker
- */
- int getLineLength(int line) throws BadLocationException;
-
- /**
- * Returns the line number the character at the given offset belongs to.
- *
- * @param offset the offset whose line number to be determined
- * @return the number of the line the offset is on
- * @exception BadLocationException if the offset is invalid in this tracker
- */
- int getLineNumberOfOffset(int offset) throws BadLocationException;
-
- /**
- * Returns a line description of the line at the given offset.
- * The description contains the start offset and the length of the line
- * excluding the line's delimiter.
- *
- * @param offset the offset whose line should be described
- * @return a region describing the line
- * @exception BadLocationException if offset is invalid in this tracker
- */
- IRegion getLineInformationOfOffset(int offset) throws BadLocationException;
-
- /**
- * Returns a line description of the given line. The description
- * contains the start offset and the length of the line excluding the line's
- * delimiter.
- *
- * @param line the line that should be described
- * @return a region describing the line
- * @exception BadLocationException if line is unknown to this tracker
- */
- IRegion getLineInformation(int line) throws BadLocationException;
-
- /**
- * Informs the line tracker about the specified change in the tracked text.
- *
- * @param offset the offset of the replaced text
- * @param length the length of the replaced text
- * @param text the substitution text
- * @exception BadLocationException if specified range is unknown to this tracker
- */
- void replace(int offset, int length, String text) throws BadLocationException;
-
- /**
- * Sets the tracked text to the specified text.
- *
- * @param text the new tracked text
- */
- void set(String text);
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IPositionUpdater.java b/org.eclipse.text/src/org/eclipse/jface/text/IPositionUpdater.java
deleted file mode 100644
index 44e48f9519c..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IPositionUpdater.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.text;
-
-
-/**
- * A position updater is responsible for adapting document positions.
- * When installed on a document, the position updater updates the
- * document's positions to changes applied to this document. Document
- * updaters can be selective, i.e. they might only update positions of
- * a certain category.<p>
- * Position updaters are of primary importance for the definition of
- * the semantics of positions.<p>
- * Clients may implement this interface or use the standard implementation
- * <code>DefaultPositionUpdater</code>.
- *
- * @see IDocument
- * @see Position
- */
-public interface IPositionUpdater {
-
- /**
- * Adapts positions to the change specified by the document event.
- * It is ensured that the document's partitioning has been adapted to
- * this document change and that all the position updaters which have
- * a smaller index in the document's position updater list have been called.
- *
- * @param event the document event describing the document change
- */
- void update(DocumentEvent event);
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IRegion.java b/org.eclipse.text/src/org/eclipse/jface/text/IRegion.java
deleted file mode 100644
index 3c80bbd3f05..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IRegion.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.text;
-
-
-/**
- * A region describes a certain range in an indexed text store.
- * Text stores are for example documents or strings. A region is
- * defined by its offset into the text store and its length.<p>
- * A region is considered a value object. Its offset or length
- * do not change over time. <p>
- * Clients may implement this interface or use the standard implementation
- * <code>Region</code>.
- */
-public interface IRegion {
-
- /**
- * Returns the length of the region.
- *
- * @return the length of the region
- */
- int getLength();
-
- /**
- * Returns the offset of the region.
- *
- * @return the offset of the region
- */
- int getOffset();
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocument.java b/org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocument.java
deleted file mode 100644
index 69dbdafe757..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocument.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.jface.text;
-
-/**
- * Interface implemented by <code>IDocument</code> implementers that offer
- * repair methods on their documents. The following repair methods are
- * provided:
- * <ul>
- * <li>repairing line information</li>
- * </ul>
- *
- * @since 3.0
- */
-public interface IRepairableDocument {
-
-
- /**
- * Repairs the line information of this document.
- */
- void repairLineInformation();
-
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/ISlaveDocumentManager.java b/org.eclipse.text/src/org/eclipse/jface/text/ISlaveDocumentManager.java
deleted file mode 100644
index 98e9d4828ea..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/ISlaveDocumentManager.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.jface.text;
-
-/**
- * Slave documents are documents whose contents is defined in terms of a master
- * document. Thus, slave documents usually reflect a projection of the master document.
- * Slave documents are causally connected to the master document. This means, changes
- * of the master document have immediate effect in the slave document and vice versa.<p>
- *
- * A slave document manager creates slave documents for given master documents. manages the
- * life cycle of the slave documents and keeps track of the information flow between
- * master and slave documents. The slave document manager defines the construction rules of the
- * slave documents in terms of the master document.<p>
- *
- * @since 2.1
- */
-public interface ISlaveDocumentManager {
-
- /**
- * Creates a new slave document for the given master document. The slave document
- * is causally connected to its master document until <code>freeSlaveDocument</code>
- * is called. The connection between the newly created slave document and the master
- * document is managed by this slave document manager.
- *
- * @param master the master document
- * @return the newly created slave document
- * @see ISlaveDocumentManager#freeSlaveDocument(IDocument)
- */
- IDocument createSlaveDocument(IDocument master);
-
- /**
- * Frees the given slave document. If the given document is not a slave document known
- * to this slave document manager, this call does not have any effect. A slave
- * document is known to this slave document manager if it has been created by
- * this manager using <code>createSlaveDocument</code>.
- *
- * @param slave the slave document to be freed
- */
- void freeSlaveDocument(IDocument slave);
-
- /**
- * Creates a new document information mapping between the given slave document and
- * its master document. Returns <code>null</code> if the given document is unknown
- * to this slave document manager.
- *
- * @param slave the slave document
- * @return a document information mapping between the slave document and its master document or
- * <code>null</code>
- */
- IDocumentInformationMapping createMasterSlaveMapping(IDocument slave);
-
- /**
- * Returns the master document of the given slave document or <code>null</code> if the
- * given document is unknown to this slave document manager.
- *
- * @param slave the slave document
- * @return the master document of the given slave document or <code>null</code>
- */
- IDocument getMasterDocument(IDocument slave);
-
- /**
- * Returns whether the given document is a slave document known to this slave document manager. A slave document
- * is known to this slave document manager, if the document has been created by this manager.
- *
- * @param document the document to be checked whether it is a slave document known to this manager
- * @return <code>true</code> if the document is a slave document, <code>false</code> otherwise
- */
- boolean isSlaveDocument(IDocument document);
-
- /**
- * Sets the given slave document's auto expand mode. In auto expand mode, a
- * slave document is automatically adapted to reflect all changes applied to it's master document.
- * Assume a master document contains 30 lines and the slave is defined to contain the lines 11-20.
- * In auto expand mode, when the master document is changed at line 8, the slave document is expanded
- * to contain the lines 8-20.<p>
- * This call is without effect if the given document is unknown to this slave document manager.
- *
- * @param slave the slave whose auto expand mode should be set
- * @param autoExpand <code>true</code> for auto expand, <code>false</code> otherwise
- */
- void setAutoExpandMode(IDocument slave, boolean autoExpand);
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/ITextStore.java b/org.eclipse.text/src/org/eclipse/jface/text/ITextStore.java
deleted file mode 100644
index b11b23aeb12..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/ITextStore.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.jface.text;
-
-
-/**
- * Interface for storing and managing text.
- * Provides access to the stored text and allows to manipulate it.
- * Clients may implement this interface or use <code>GapTextStore</code>.
- */
-public interface ITextStore {
-
- /**
- * Returns the character at the specified offset.
- *
- * @param offset the offset in this text store
- * @return the character at this offset
- */
- char get(int offset);
-
- /**
- * Returns the text of the specified character range.
- *
- * @param offset the offset of the range
- * @param length the length of the range
- * @return the text of the range
- */
- String get(int offset, int length);
-
- /**
- * Returns number of characters stored in this text store.
- *
- * @return the number of characters stored in this text store
- */
- int getLength();
-
- /**
- * Replaces the specified character range with the given text.
- * <code>replace(getLength(), 0, "some text")</code> is a valid
- * call and appends text to the end of the text store.
- *
- * @param offset the offset of the range to be replaced
- * @param length the number of characters to be replaced
- * @param text the substitution text
- */
- void replace(int offset, int length, String text);
-
- /**
- * Replace the content of the text store with the given text.
- * Convenience method for <code>replace(0, getLength(), text</code>.
- *
- * @param text the new content of the text store
- */
- void set(String text);
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/ITypedRegion.java b/org.eclipse.text/src/org/eclipse/jface/text/ITypedRegion.java
deleted file mode 100644
index 2ea31627acd..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/ITypedRegion.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.text;
-
-
-
-/**
- * Describes a region of an indexed text store such as document or string.
- * The region consists of offset, length, and type. The type is defines as
- * a string. A typed region can, e.g., be used to described document partitions.
- * Clients may implement this interface or use the standard impementation
- * <code>TypedRegion</code>.
- */
-public interface ITypedRegion extends IRegion {
-
- /**
- * Returns the content type of the region.
- *
- * @return the content type of the region
- */
- String getType();
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/Line.java b/org.eclipse.text/src/org/eclipse/jface/text/Line.java
deleted file mode 100644
index 86dfd604c33..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/Line.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.text;
-
-
-
-/**
- * Describes a line as a particular number of characters beginning at
- * a particular offset, consisting of a particular number of characters,
- * and being closed with a particular line delimiter.
- */
-class Line implements IRegion {
-
- /** The offset of the line */
- public int offset;
- /** The length of the line */
- public int length;
- /** The delimiter of this line */
- public String delimiter;
-
- /**
- * Creates a new Line.
- *
- * @param offset the offset of the line
- * @param end the last including character offset of the line
- * @param delimiter the line's delimiter
- */
- public Line(int offset, int end, String delimiter) {
- this.offset= offset;
- this.length= (end - offset) +1;
- this.delimiter= delimiter;
- }
-
- /**
- * Creates a new Line.
- *
- * @param offset the offset of the line
- * @param length the length of the line
- */
- public Line(int offset, int length) {
- this.offset= offset;
- this.length= length;
- this.delimiter= null;
- }
-
- /*
- * @see IRegion#getOffset()
- */
- public int getOffset() {
- return offset;
- }
-
- /*
- * @see IRegion#getLength()
- */
- public int getLength() {
- return length;
- }
-}
-
-
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/ParentChildMapping.java b/org.eclipse.text/src/org/eclipse/jface/text/ParentChildMapping.java
deleted file mode 100644
index 4016f59ee97..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/ParentChildMapping.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.jface.text;
-
-/**
- * Implementation of <code>IDocumentInformationMapping</code> matching <code>ChildDocument</code> and
- * <code>ChildDocumentManager</code>. The parent document is considered the original document, the child
- * document is considered the image document.
- */
-public class ParentChildMapping implements IDocumentInformationMapping {
-
- /** The parent document */
- private IDocument fParentDocument;
- /** The child document */
- private ChildDocument fChildDocument;
-
-
- /**
- * Creates a new document mapping between the parent document of the given
- * child document and the child document.
- *
- * @param childDocument
- */
- public ParentChildMapping(ChildDocument childDocument) {
- fParentDocument= childDocument.getParentDocument();
- fChildDocument= childDocument;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#getCoverage()
- */
- public IRegion getCoverage() {
- Position p= fChildDocument.getParentDocumentRange();
- return new Region(p.getOffset(), p.getLength());
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toOriginOffset(int)
- */
- public int toOriginOffset(int imageOffset) throws BadLocationException {
- int anchorOffset= fChildDocument.getParentDocumentRange().getOffset();
- return anchorOffset + imageOffset;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toOriginRegion(org.eclipse.jface.text.IRegion)
- */
- public IRegion toOriginRegion(IRegion imageRegion) throws BadLocationException {
- int anchorOffset= fChildDocument.getParentDocumentRange().getOffset();
- return new Region(anchorOffset + imageRegion.getOffset(), imageRegion.getLength());
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toOriginLines(int)
- */
- public IRegion toOriginLines(int imageLine) throws BadLocationException {
- IRegion imageDocumentRegion= fChildDocument.getLineInformation(imageLine);
- IRegion originDocumentRegion= toOriginRegion(imageDocumentRegion);
-
- int startLine= fParentDocument.getLineOfOffset(originDocumentRegion.getOffset());
- if (originDocumentRegion.getLength() == 0)
- return new Region(startLine, 0);
-
- int endLine= fParentDocument.getLineOfOffset(originDocumentRegion.getOffset() + originDocumentRegion.getLength() -1);
- return new Region(startLine, endLine - startLine);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toOriginLine(int)
- */
- public int toOriginLine(int imageLine) throws BadLocationException {
- int anchorOffset= fChildDocument.getParentDocumentRange().getOffset();
- return fParentDocument.getLineOfOffset(anchorOffset) + imageLine;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toImageOffset(int)
- */
- public int toImageOffset(int originOffset) throws BadLocationException {
- Position p= fChildDocument.getParentDocumentRange();
- if (p.includes(originOffset))
- return originOffset - p.getOffset();
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toImageRegion(org.eclipse.jface.text.IRegion)
- */
- public IRegion toImageRegion(IRegion originRegion) throws BadLocationException {
-
- int offset= originRegion.getOffset();
- int length= originRegion.getLength();
-
- if (length < 0) {
- length= -length;
- offset -= length;
- }
-
- Position p= fChildDocument.getParentDocumentRange();
- if (p.overlapsWith(offset, length)) {
-
- if (offset < p.getOffset())
- offset= p.getOffset();
-
- int end= offset + length;
- int e= p.getOffset() + p.getLength();
- if (end > e)
- end= e;
-
- offset -= p.getOffset();
- end -= p.getOffset();
-
- if (originRegion.getLength() < 0)
- return new Region(end, offset - end);
- return new Region(offset, end - offset);
- }
-
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toImageLine(int)
- */
- public int toImageLine(int originLine) throws BadLocationException {
- int anchorOffset= fChildDocument.getParentDocumentRange().getOffset();
- int startLine= fParentDocument.getLineOfOffset(anchorOffset);
-
- int imageLine= originLine - startLine;
- if (imageLine < 0 || imageLine > fChildDocument.getNumberOfLines())
- return -1;
- return imageLine;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentInformationMapping#toClosestImageLine(int)
- */
- public int toClosestImageLine(int originLine) throws BadLocationException {
- int anchorOffset= fChildDocument.getParentDocumentRange().getOffset();
- int startLine= fParentDocument.getLineOfOffset(anchorOffset);
-
- int imageLine= originLine - startLine;
- if (imageLine < 0)
- return 0;
-
- int maxLine= fChildDocument.getNumberOfLines();
- if (imageLine > maxLine)
- return maxLine;
-
- return imageLine;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/Position.java b/org.eclipse.text/src/org/eclipse/jface/text/Position.java
deleted file mode 100644
index b88cf273cf7..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/Position.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-
-/**
- * Positions describe text ranges of a document. Positions are
- * adapted to changes applied to that document. The text range
- * is specified by an offset and a length. Positions can be marked as
- * deleted. Deleted positions are considered to no longer represent
- * a valid text range in the managing document. <p>
- * Positions attached to documents are ususally updated by position updaters.
- * Because position updaters are freely defineable and because of the
- * frequence in which they are used, the fields of a position are made
- * publicly accessible. Clients other than position updaters are not
- * allowed to access these public fields.
- *
- * @see IDocument
- */
-public class Position {
-
- /** The offset of the position */
- public int offset;
- /** The length of the position */
- public int length;
- /** Indicates whether the position has been deleted */
- public boolean isDeleted;
-
- /**
- * Creates a new position with the given offset and length 0.
- *
- * @param offset the position offset, must be >= 0
- */
- public Position(int offset) {
- this(offset, 0);
- }
-
- /**
- * Creates a new position with the given offset and length.
- *
- * @param offset the position offset, must be >= 0
- * @param length the position length, must be >= 0
- */
- public Position(int offset, int length) {
- Assert.isTrue(offset >= 0);
- Assert.isTrue(length >= 0);
- this.offset= offset;
- this.length= length;
- }
-
- /**
- * Creates a new uninitialized position.
- */
- protected Position() {
- }
-
- /*
- * @see Object#hashCode
- */
- public int hashCode() {
- int deleted= isDeleted ? 0 : 1;
- return (offset << 24) | (length << 16) | deleted;
- }
-
- /**
- * Marks this position as deleted.
- */
- public void delete() {
- isDeleted= true;
- }
-
- /**
- * Marks this position as not deleted.
- * @since 2.0
- */
- public void undelete() {
- isDeleted= false;
- }
-
- /*
- * @see Object#equals(Object)
- */
- public boolean equals(Object other) {
- if (other instanceof Position) {
- Position rp= (Position) other;
- return (rp.offset == offset) && (rp.length == length);
- }
- return super.equals(other);
- }
-
- /**
- * Returns the length of this position.
- *
- * @return the length of this position
- */
- public int getLength() {
- return length;
- }
-
- /**
- * Returns the offset of this position.
- *
- * @return the length of this position
- */
- public int getOffset() {
- return offset;
- }
-
- /**
- * Checks whether the given offset is inside
- * of this position's text range.
- *
- * @param offset the offset to check
- * @return <code>true</code> if offset is inside of this position
- */
- public boolean includes(int offset) {
-
- if (isDeleted)
- return false;
-
- return (this.offset <= offset) && (offset < this.offset + length);
- }
-
- /**
- * Checks whether the intersection of the given text range
- * and the text range represented by this position is empty
- * or not.
- *
- * @param offset the offset of the range to check
- * @param length the length of the range to check
- * @return <code>true</code> if intersection is not empty
- */
- public boolean overlapsWith(int offset, int length) {
-
- if (isDeleted)
- return false;
-
- int end= offset + length;
- int thisEnd= this.offset + this.length;
-
- if (length > 0) {
- if (this.length > 0)
- return this.offset < end && offset < thisEnd;
- return offset <= this.offset && this.offset < end;
- }
-
- if (this.length > 0)
- return this.offset <= offset && offset < thisEnd;
- return this.offset == offset;
- }
-
- /**
- * Returns whether this position has been deleted or not.
- *
- * @return <code>true</code> if position has been deleted
- */
- public boolean isDeleted() {
- return isDeleted;
- }
-
- /**
- * Changes the length of this position to the given length.
- *
- * @param length the new length of this position
- */
- public void setLength(int length) {
- Assert.isTrue(length >= 0);
- this.length= length;
- }
-
- /**
- * Changes the offset of this position to the given offset.
- *
- * @param offset the new offset of this position
- */
- public void setOffset(int offset) {
- Assert.isTrue(offset >= 0);
- this.offset= offset;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/Region.java b/org.eclipse.text/src/org/eclipse/jface/text/Region.java
deleted file mode 100644
index 7ca94e04581..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/Region.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.text;
-
-
-
-/**
- * A default implementation of the <code>IRegion</code> interface.
- */
-public class Region implements IRegion {
-
- /** The region offset */
- private int fOffset;
- /** The region length */
- private int fLength;
-
- /**
- * Create a new region.
- *
- * @param offset the offset of the region
- * @param length the length of the region
- */
- public Region(int offset, int length) {
- fOffset= offset;
- fLength= length;
- }
-
- /*
- * @see IRegion#getLength()
- */
- public int getLength() {
- return fLength;
- }
-
- /*
- * @see IRegion#getOffset()
- */
- public int getOffset() {
- return fOffset;
- }
-
- /**
- * Two regions are equal if they have the same offset and length.
- *
- * @see Object#equals(Object)
- */
- public boolean equals(Object o) {
- if (o instanceof IRegion) {
- IRegion r= (IRegion) o;
- return r.getOffset() == fOffset && r.getLength() == fLength;
- }
- return false;
- }
-
- /*
- * @see Object#hashCode()
- */
- public int hashCode() {
- return (fOffset << 24) | (fLength << 16);
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/SequentialRewriteTextStore.java b/org.eclipse.text/src/org/eclipse/jface/text/SequentialRewriteTextStore.java
deleted file mode 100644
index 3e3ffabc568..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/SequentialRewriteTextStore.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-
-/**
- * A text store that optimizes a given source text store for sequential rewriting.
- * While rewritten it keeps a list of replace command that serve as patches for
- * the source store. Only on request, the source store is indeed manipulated
- * by applying the patch commands to the source text store.
- *
- * @since 2.0
- */
-public class SequentialRewriteTextStore implements ITextStore {
-
- /**
- * A buffered replace command.
- */
- private static class Replace {
- public int newOffset;
- public final int offset;
- public final int length;
- public final String text;
-
- public Replace(int offset, int newOffset, int length, String text) {
- this.newOffset= newOffset;
- this.offset= offset;
- this.length= length;
- this.text= text;
- }
- }
-
- /** The list of buffered replacements. */
- private List fReplaceList;
- /** The source text store */
- private ITextStore fSource;
- /** A flag to enforce sequential access. */
- private static final boolean ASSERT_SEQUENTIALITY= false;
-
-
- /**
- * Creates a new sequential rewrite store for the given source store.
- *
- * @param source the source text store
- */
- public SequentialRewriteTextStore(ITextStore source) {
- fReplaceList= new LinkedList();
- fSource= source;
- }
-
- /**
- * Returns the source store of this rewrite store.
- *
- * @return the source store of this rewrite store
- */
- public ITextStore getSourceStore() {
- commit();
- return fSource;
- }
-
- /*
- * @see ITextStore#replace(int, int, String)
- */
- public void replace(int offset, int length, String text) {
-
- if (fReplaceList.size() == 0) {
- fReplaceList.add(new Replace(offset, offset, length, text));
-
- } else {
- Replace firstReplace= (Replace) fReplaceList.get(0);
- Replace lastReplace= (Replace) fReplaceList.get(fReplaceList.size() - 1);
-
- // backward
- if (offset + length <= firstReplace.newOffset) {
- int delta= text.length() - length;
- if (delta != 0) {
- for (Iterator i= fReplaceList.iterator(); i.hasNext(); ) {
- Replace replace= (Replace) i.next();
- replace.newOffset += delta;
- }
- }
-
- fReplaceList.add(0, new Replace(offset, offset, length, text));
-
- // forward
- } else if (offset >= lastReplace.newOffset + lastReplace.text.length()) {
- int delta= getDelta(lastReplace);
- fReplaceList.add(new Replace(offset - delta, offset, length, text));
-
- } else if (ASSERT_SEQUENTIALITY) {
- throw new IllegalArgumentException();
-
- } else {
- commit();
- fSource.replace(offset, length, text);
- }
- }
- }
-
- /*
- * @see ITextStore#set(String)
- */
- public void set(String text) {
- fSource.set(text);
- fReplaceList.clear();
- }
-
- /*
- * @see ITextStore#get(int, int)
- */
- public String get(int offset, int length) {
-
- if (fReplaceList.size() == 0) {
- return fSource.get(offset, length);
-
- } else {
- Replace firstReplace= (Replace) fReplaceList.get(0);
- Replace lastReplace= (Replace) fReplaceList.get(fReplaceList.size() - 1);
-
- // before
- if (offset + length <= firstReplace.newOffset) {
- return fSource.get(offset, length);
-
- // after
- } else if (offset >= lastReplace.newOffset + lastReplace.text.length()) {
- int delta= getDelta(lastReplace);
- return fSource.get(offset - delta, length);
-
- } else if (ASSERT_SEQUENTIALITY) {
- throw new IllegalArgumentException();
-
- } else {
-
- int delta= 0;
- for (Iterator i= fReplaceList.iterator(); i.hasNext(); ) {
- Replace replace= (Replace) i.next();
-
- if (offset + length < replace.newOffset) {
- return fSource.get(offset - delta, length);
-
- } else if (offset >= replace.newOffset && offset + length <= replace.newOffset + replace.text.length()) {
- return replace.text.substring(offset - replace.newOffset, offset - replace.newOffset + length);
-
- } else if (offset >= replace.newOffset + replace.text.length()) {
- delta= getDelta(replace);
- continue;
-
- } else {
- commit();
- return fSource.get(offset, length);
- }
- }
-
- return fSource.get(offset - delta, length);
- }
- }
- }
-
- /**
- * Returns the difference between the offset in the source store and the "same" offset in the
- * rewrite store after the replace operation.
- *
- * @param replace the replace command
- */
- private static final int getDelta(Replace replace) {
- return replace.newOffset - replace.offset + replace.text.length() - replace.length;
- }
-
- /*
- * @see ITextStore#get(int)
- */
- public char get(int offset) {
- if (fReplaceList.size() == 0) {
- return fSource.get(offset);
-
- } else {
- Replace firstReplace= (Replace) fReplaceList.get(0);
- Replace lastReplace= (Replace) fReplaceList.get(fReplaceList.size() - 1);
-
- // before
- if (offset < firstReplace.newOffset) {
- return fSource.get(offset);
-
- // after
- } else if (offset >= lastReplace.newOffset + lastReplace.text.length()) {
- int delta= getDelta(lastReplace);
- return fSource.get(offset - delta);
-
- } else if (ASSERT_SEQUENTIALITY) {
- throw new IllegalArgumentException();
-
- } else {
-
- int delta= 0;
- for (Iterator i= fReplaceList.iterator(); i.hasNext(); ) {
- Replace replace= (Replace) i.next();
-
- if (offset < replace.newOffset)
- return fSource.get(offset - delta);
-
- else if (offset < replace.newOffset + replace.text.length())
- return replace.text.charAt(offset - replace.newOffset);
-
- delta= getDelta(replace);
- }
-
- return fSource.get(offset - delta);
- }
- }
- }
-
- /*
- * @see ITextStore#getLength()
- */
- public int getLength() {
- if (fReplaceList.size() == 0) {
- return fSource.getLength();
-
- } else {
- Replace lastReplace= (Replace) fReplaceList.get(fReplaceList.size() - 1);
- return fSource.getLength() + getDelta(lastReplace);
- }
- }
-
- /**
- * Disposes this rewrite store.
- */
- public void dispose() {
- fReplaceList= null;
- fSource= null;
- }
-
- /**
- * Commits all buffered replace commands.
- */
- private void commit() {
-
- if (fReplaceList.size() == 0)
- return;
-
- StringBuffer buffer= new StringBuffer();
-
- int delta= 0;
- for (Iterator i= fReplaceList.iterator(); i.hasNext(); ) {
- Replace replace= (Replace) i.next();
-
- int offset= buffer.length() - delta;
- buffer.append(fSource.get(offset, replace.offset - offset));
- buffer.append(replace.text);
- delta= getDelta(replace);
- }
-
- int offset= buffer.length() - delta;
- buffer.append(fSource.get(offset, fSource.getLength() - offset));
-
- fSource.set(buffer.toString());
- fReplaceList.clear();
- }
-
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/SlaveDocumentEvent.java b/org.eclipse.text/src/org/eclipse/jface/text/SlaveDocumentEvent.java
deleted file mode 100644
index 60fcd52909a..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/SlaveDocumentEvent.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.text;
-
-/**
- * A slave document event represents a master document event as a slave-relative
- * document event. It also carries the master document event.
- */
-public class SlaveDocumentEvent extends DocumentEvent {
-
- /** The master document event */
- private DocumentEvent fMasterEvent;
-
- /**
- * Creates a new slave document event.
- *
- * @param doc the slave document
- * @param offset the offset in the slave document
- * @param length the length in the slave document
- * @param text the substitution text
- * @param masterEvent the master document event
- */
- public SlaveDocumentEvent(IDocument doc, int offset, int length, String text, DocumentEvent masterEvent) {
- super(doc, offset, length, text);
- fMasterEvent= masterEvent;
- }
-
- /**
- * Returns this event's master event.
- *
- * @return this event's master event
- */
- public DocumentEvent getMasterEvent() {
- return fMasterEvent;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java b/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
deleted file mode 100644
index 42bed0f8163..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
+++ /dev/null
@@ -1,488 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.text;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * Collection of text functions.
- */
-public class TextUtilities {
-
- /**
- * Default line delimiters used by these text functons.
- */
- public final static String[] DELIMITERS= new String[] { "\n", "\r", "\r\n" }; //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
-
- /**
- * Default line delimiters used by these text functions.
- *
- * @deprecated use DELIMITERS instead
- */
- public final static String[] fgDelimiters= DELIMITERS;
-
-
-
- /**
- * Determines which one of default line delimiters appears first in the list. If none of them the
- * hint is returned.
- *
- * @param text the text to be checked
- * @param hint the line delimiter hint
- */
- public static String determineLineDelimiter(String text, String hint) {
- try {
- int[] info= indexOf(DELIMITERS, text, 0);
- return DELIMITERS[info[1]];
- } catch (ArrayIndexOutOfBoundsException x) {
- }
- return hint;
- }
-
- /**
- * Returns the starting position and the index of the longest matching search string
- * in the given text that is greater than the given offset. Returns <code>[-1, -1]</code>
- * if no match can be found.
- *
- * @param searchStrings the strings to search for
- * @param text the text to be searched
- * @param offset the offset at which to start the search
- * @return an <code>int[]</code> with two elements" the first is the starting offset, the second the index of the found
- * search string in the given <code>searchStrings</code> array, returns <code>[-1, -1]</code> if no match exists
- */
- public static int[] indexOf(String[] searchStrings, String text, int offset) {
-
- int[] result= { -1, -1 };
- int zeroIndex= -1;
-
- for (int i= 0; i < searchStrings.length; i++) {
-
- int length= searchStrings[i].length();
-
- if (length == 0) {
- zeroIndex= i;
- continue;
- }
-
- int index= text.indexOf(searchStrings[i], offset);
- if (index >= 0) {
-
- if (result[0] == -1) {
- result[0]= index;
- result[1]= i;
- } else if (index < result[0]) {
- result[0]= index;
- result[1]= i;
- } else if (index == result[0] && length > searchStrings[result[1]].length()) {
- result[0]= index;
- result[1]= i;
- }
- }
- }
-
- if (zeroIndex > -1 && result[0] == -1) {
- result[0]= 0;
- result[1]= zeroIndex;
- }
-
- return result;
- }
-
- /**
- * Returns the index of the longest search string with which the given text ends or
- * <code>-1</code> if none matches.
- *
- * @param searchStrings the strings to search for
- * @param text the text to search
- * @return the index in <code>searchStrings</code> of the longest string with which <code>text</code> ends or <code>-1</code>
- */
- public static int endsWith(String[] searchStrings, String text) {
-
- int index= -1;
-
- for (int i= 0; i < searchStrings.length; i++) {
- if (text.endsWith(searchStrings[i])) {
- if (index == -1 || searchStrings[i].length() > searchStrings[index].length())
- index= i;
- }
- }
-
- return index;
- }
-
- /**
- * Returns the index of the longest search string with which the given text starts or <code>-1</code>
- * if none matches.
- *
- * @param searchStrings the strings to search for
- * @param text the text to search
- * @return the index in <code>searchStrings</code> of the longest string with which <code>text</code> starts or <code>-1</code>
- */
- public static int startsWith(String[] searchStrings, String text) {
-
- int index= -1;
-
- for (int i= 0; i < searchStrings.length; i++) {
- if (text.startsWith(searchStrings[i])) {
- if (index == -1 || searchStrings[i].length() > searchStrings[index].length())
- index= i;
- }
- }
-
- return index;
- }
-
- /**
- * Returns the index of the first compare string that equals the given text or <code>-1</code>
- * if none is equal.
- *
- * @param compareStrings the strings to compare with
- * @param text the text to check
- * @return the index of the first equal compare string or <code>-1</code>
- */
- public static int equals(String[] compareStrings, String text) {
- for (int i= 0; i < compareStrings.length; i++) {
- if (text.equals(compareStrings[i]))
- return i;
- }
- return -1;
- }
-
- /**
- * Returns a document event which is an accumulation of a list of document events,
- * <code>null</code> if the list of documentEvents is empty.
- * The document of the document events are ignored.
- *
- * @param unprocessedDocument the document to which the document events would be applied
- * @param documentEvents the list of document events to merge
- * @return returns the merged document event
- * @throws BadLocationException might be thrown if document is not in the correct state with respect to document events
- */
- public static DocumentEvent mergeUnprocessedDocumentEvents(IDocument unprocessedDocument, List documentEvents) throws BadLocationException {
-
- if (documentEvents.size() == 0)
- return null;
-
- final Iterator iterator= documentEvents.iterator();
- final DocumentEvent firstEvent= (DocumentEvent) iterator.next();
-
- // current merged event
- final IDocument document= unprocessedDocument;
- int offset= firstEvent.getOffset();
- int length= firstEvent.getLength();
- final StringBuffer text= new StringBuffer(firstEvent.getText() == null ? "" : firstEvent.getText()); //$NON-NLS-1$
-
- while (iterator.hasNext()) {
-
- final int delta= text.length() - length;
-
- final DocumentEvent event= (DocumentEvent) iterator.next();
- final int eventOffset= event.getOffset();
- final int eventLength= event.getLength();
- final String eventText= event.getText() == null ? "" : event.getText(); //$NON-NLS-1$
-
- // event is right from merged event
- if (eventOffset > offset + length + delta) {
- final String string= document.get(offset + length, (eventOffset - delta) - (offset + length));
- text.append(string);
- text.append(eventText);
-
- length= (eventOffset - delta) + eventLength - offset;
-
- // event is left from merged event
- } else if (eventOffset + eventLength < offset) {
- final String string= document.get(eventOffset + eventLength, offset - (eventOffset + eventLength));
- text.insert(0, string);
- text.insert(0, eventText);
-
- length= offset + length - eventOffset;
- offset= eventOffset;
-
- // events overlap eachother
- } else {
- final int start= Math.max(0, eventOffset - offset);
- final int end= Math.min(text.length(), eventLength + eventOffset - offset);
- text.replace(start, end, eventText);
-
- offset= Math.min(offset, eventOffset);
- final int totalDelta= delta + eventText.length() - eventLength;
- length= text.length() - totalDelta;
- }
- }
-
- return new DocumentEvent(document, offset, length, text.toString());
- }
-
- /**
- * Returns a document event which is an accumulation of a list of document events,
- * <code>null</code> if the list of document events is empty.
- * The document events being merged must all refer to the same document, to which
- * the document changes have been already applied.
- *
- * @param documentEvents the list of document events to merge
- * @return returns the merged document event
- * @throws BadLocationException might be thrown if document is not in the correct state with respect to document events
- */
- public static DocumentEvent mergeProcessedDocumentEvents(List documentEvents) throws BadLocationException {
-
- if (documentEvents.size() == 0)
- return null;
-
- final ListIterator iterator= documentEvents.listIterator(documentEvents.size());
- final DocumentEvent firstEvent= (DocumentEvent) iterator.previous();
-
- // current merged event
- final IDocument document= firstEvent.getDocument();
- int offset= firstEvent.getOffset();
- int length= firstEvent.getLength();
- int textLength= firstEvent.getText() == null ? 0 : firstEvent.getText().length();
-
- while (iterator.hasPrevious()) {
-
- final int delta= length - textLength;
-
- final DocumentEvent event= (DocumentEvent) iterator.previous();
- final int eventOffset= event.getOffset();
- final int eventLength= event.getLength();
- final int eventTextLength= event.getText() == null ? 0 : event.getText().length();
-
- // event is right from merged event
- if (eventOffset > offset + textLength + delta) {
- length= (eventOffset - delta) - (offset + textLength) + length + eventLength;
- textLength= (eventOffset - delta) + eventTextLength - offset;
-
- // event is left from merged event
- } else if (eventOffset + eventTextLength < offset) {
- length= offset - (eventOffset + eventTextLength) + length + eventLength;
- textLength= offset + textLength - eventOffset;
- offset= eventOffset;
-
- // events overlap eachother
- } else {
- final int start= Math.max(0, eventOffset - offset);
- final int end= Math.min(length, eventTextLength + eventOffset - offset);
- length += eventLength - (end - start);
-
- offset= Math.min(offset, eventOffset);
- final int totalDelta= delta + eventLength - eventTextLength;
- textLength= length - totalDelta;
- }
- }
-
- final String text= document.get(offset, textLength);
- return new DocumentEvent(document, offset, length, text);
- }
-
- /**
- * Removes all connected document partitioners from the given document and stores them
- * under their partitioning name in a map. This map is returned. After this method has been called
- * the given document is no longer connected to any document partitioner.
- *
- * @param document the document
- * @return the map containing the removed partitioners
- */
- public static Map removeDocumentPartitioners(IDocument document) {
- Map partitioners= new HashMap();
- if (document instanceof IDocumentExtension3) {
- IDocumentExtension3 extension3= (IDocumentExtension3) document;
- String[] partitionings= extension3.getPartitionings();
- for (int i= 0; i < partitionings.length; i++) {
- IDocumentPartitioner partitioner= extension3.getDocumentPartitioner(partitionings[i]);
- if (partitioner != null) {
- extension3.setDocumentPartitioner(partitionings[i], null);
- partitioner.disconnect();
- partitioners.put(partitionings[i], partitioner);
- }
- }
- } else {
- IDocumentPartitioner partitioner= document.getDocumentPartitioner();
- if (partitioner != null) {
- document.setDocumentPartitioner(null);
- partitioner.disconnect();
- partitioners.put(IDocumentExtension3.DEFAULT_PARTITIONING, partitioner);
- }
- }
- return partitioners;
- }
-
- /**
- * Connects the given document with all document partitioners stored in the given map under
- * their partitioning name. This method cleans the given map.
- *
- * @param document the document
- * @param partitioners the map containing the partitioners to be connected
- * @since 3.0
- */
- public static void addDocumentPartitioners(IDocument document, Map partitioners) {
- if (document instanceof IDocumentExtension3) {
- IDocumentExtension3 extension3= (IDocumentExtension3) document;
- Iterator e= partitioners.keySet().iterator();
- while (e.hasNext()) {
- String partitioning= (String) e.next();
- IDocumentPartitioner partitioner= (IDocumentPartitioner) partitioners.get(partitioning);
- partitioner.connect(document);
- extension3.setDocumentPartitioner(partitioning, partitioner);
- }
- partitioners.clear();
- } else {
- IDocumentPartitioner partitioner= (IDocumentPartitioner) partitioners.get(IDocumentExtension3.DEFAULT_PARTITIONING);
- partitioner.connect(document);
- document.setDocumentPartitioner(partitioner);
- }
- }
-
- /**
- * Returns the content type at the given offset of the given document.
- *
- * @param document the document
- * @param partitioning the partitioning to be used
- * @param offset the offset
- * @return the content type at the given offset of the document
- * @throws BadLocationException if offset is invalid in the document
- * @since 3.0
- */
- public static String getContentType(IDocument document, String partitioning, int offset) throws BadLocationException {
- if (document instanceof IDocumentExtension3) {
- IDocumentExtension3 extension3= (IDocumentExtension3) document;
- try {
- return extension3.getContentType(partitioning, offset);
- } catch (BadPartitioningException x) {
- return IDocument.DEFAULT_CONTENT_TYPE;
- }
- } else {
- return document.getContentType(offset);
- }
- }
-
- /**
- * Returns the partition of the given offset of the given document.
- *
- * @param document the document
- * @param partitioning the partitioning to be used
- * @param offset the offset
- * @return the content type at the given offset of this viewer's input document
- * @throws BadLocationException if offset is invalid in the given document
- * @since 3.0
- */
- public static ITypedRegion getPartition(IDocument document, String partitioning, int offset) throws BadLocationException {
- if (document instanceof IDocumentExtension3) {
- IDocumentExtension3 extension3= (IDocumentExtension3) document;
- try {
- return extension3.getPartition(partitioning, offset);
- } catch (BadPartitioningException x) {
- return new TypedRegion(0, document.getLength(), IDocument.DEFAULT_CONTENT_TYPE);
- }
- } else {
- return document.getPartition(offset);
- }
- }
-
- /**
- * Computes and returns the partitioning for the given region of the given document for the given partitioning name.
- *
- * @param document the document
- * @param partitioning the partitioning name
- * @param offset the region offset
- * @param length the region length
- * @return the partitioning for the given region of the given document for the given partitioning name
- * @throws BadLocationException if the given region is invalid for the given document
- * @since 3.0
- */
- public static ITypedRegion[] computePartitioning(IDocument document, String partitioning, int offset, int length) throws BadLocationException {
- if (document instanceof IDocumentExtension3) {
- IDocumentExtension3 extension3= (IDocumentExtension3) document;
- try {
- return extension3.computePartitioning(partitioning, offset, length);
- } catch (BadPartitioningException x) {
- return new ITypedRegion[0];
- }
- } else {
- return document.computePartitioning(offset, length);
- }
- }
-
- /**
- * Computes and returns the partition managing position categories for the
- * given document or <code>null</code> if this was impossible.
- *
- * @param document the document
- * @return the partition managing position categories
- * @since 3.0
- */
- public static String[] computePartitionManagingCategories(IDocument document) {
- if (document instanceof IDocumentExtension3) {
- IDocumentExtension3 extension3= (IDocumentExtension3) document;
- String[] partitionings= extension3.getPartitionings();
- if (partitionings != null) {
- Set categories= new HashSet();
- for (int i= 0; i < partitionings.length; i++) {
- IDocumentPartitioner p= extension3.getDocumentPartitioner(partitionings[i]);
- if (p instanceof IDocumentPartitionerExtension2) {
- IDocumentPartitionerExtension2 extension2= (IDocumentPartitionerExtension2) p;
- String[] c= extension2.getManagingPositionCategories();
- if (c != null) {
- for (int j= 0; j < c.length; j++)
- categories.add(c[j]);
- }
- }
- }
- String[] result= new String[categories.size()];
- categories.toArray(result);
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the default line delimiter for the given document. This is either the delimiter of the first line, or the platform line delimiter if it is
- * a legal line delimiter or the first one of the legal line delimiters. The default line delimiter should be used when performing document
- * manipulations that span multiple lines.
- *
- * @param document the document
- * @return the document's default line delimiter
- * @since 3.0
- */
- public static String getDefaultLineDelimiter(IDocument document) {
-
- String lineDelimiter= null;
-
- try {
- lineDelimiter= document.getLineDelimiter(0);
- } catch (BadLocationException x) {
- }
-
- if (lineDelimiter == null) {
- String sysLineDelimiter= System.getProperty("line.separator"); //$NON-NLS-1$
- String[] delimiters= document.getLegalLineDelimiters();
- Assert.isTrue(delimiters.length > 0);
- for (int i= 0; i < delimiters.length; i++) {
- if (delimiters[i].equals(sysLineDelimiter)) {
- lineDelimiter= sysLineDelimiter;
- break;
- }
- }
-
- if (lineDelimiter == null)
- lineDelimiter= delimiters[0];
- }
-
- return lineDelimiter;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/TypedPosition.java b/org.eclipse.text/src/org/eclipse/jface/text/TypedPosition.java
deleted file mode 100644
index 328bc3db954..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/TypedPosition.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.text;
-
-
-
-/**
- * Convenience class for position like typed regions.
- */
-public class TypedPosition extends Position {
-
- /** The type of the region described by this position */
- private String fType;
-
- /**
- * Creates a position along the given specification.
- *
- * @param offset the offset of this position
- * @param length the length of this position
- * @param type the type of this position
- */
- public TypedPosition(int offset, int length, String type) {
- super(offset, length);
- fType= type;
- }
-
- /**
- * Creates a position based on the typed region.
- *
- * @param region the typed region
- */
- public TypedPosition(ITypedRegion region) {
- super(region.getOffset(), region.getLength());
- fType= region.getType();
- }
-
- /**
- * Returns the type of the position
- *
- * @return the type of this position
- */
- public String getType() {
- return fType;
- }
-
- /*
- * @see Object#equals
- */
- public boolean equals(Object o) {
- if (o instanceof TypedPosition) {
- if (super.equals(o)) {
- TypedPosition p= (TypedPosition) o;
- return (fType == null && p.getType() == null) || fType.equals(p.getType());
- }
- }
- return false;
- }
-
- /*
- * @see Object#hashCode
- */
- public int hashCode() {
- int type= fType == null ? 0 : fType.hashCode();
- return super.hashCode() | type;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/TypedRegion.java b/org.eclipse.text/src/org/eclipse/jface/text/TypedRegion.java
deleted file mode 100644
index 0a7b1229d45..00000000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/TypedRegion.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.text;
-
-
-
-/**
- * Default implementation of <code>ITypedRegion</code>.
- */
-public class TypedRegion extends Region implements ITypedRegion {
-
- /** The region's type */
- private String fType;
-
- /**
- * Creates a typed region based on the given specification.
- *
- * @param offset the region's offset
- * @param length the region's length
- * @param type the region's type
- */
- public TypedRegion(int offset, int length, String type) {
- super(offset, length);
- fType= type;
- }
-
- /*
- * @see ITypedRegion#getType()
- */
- public String getType() {
- return fType;
- }
-
- /**
- * Two typed positions are equal if they have the same offset, length, and type.
- *
- * @see Object#equals(java.lang.Object)
- */
- public boolean equals(Object o) {
- if (o instanceof TypedRegion) {
- TypedRegion r= (TypedRegion) o;
- return super.equals(r) && ((fType == null && r.getType() == null) || fType.equals(r.getType()));
- }
- return false;
- }
-
- /*
- * @see Object#hashCode()
- */
- public int hashCode() {
- int type= fType == null ? 0 : fType.hashCode();
- return super.hashCode() | type;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/CopySourceEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/CopySourceEdit.java
deleted file mode 100644
index d66c640981a..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/CopySourceEdit.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.text.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * A copy source edit denotes the source of a copy operation. Copy
- * source edits are only valid inside an edit tree if they have a
- * corresponding traget edit. Furthermore the corresponding
- * target edit can't be a direct or indirect child of the source
- * edit. Violating one of two requirements will result in a <code>
- * MalformedTreeException</code> when executing the edit tree.
- * <p>
- * A copy source edit can manange an optional source modifier. A
- * source modifier can provide a set of replace edits which will
- * to applied to the source before it gets inserted at the target
- * position.
- *
- * @see org.eclipse.text.edits.CopyTargetEdit
- *
- * @since 3.0
- */
-public final class CopySourceEdit extends TextEdit {
-
- private CopyTargetEdit fTarget;
- private ISourceModifier fModifier;
-
- private String fSourceContent;
- private TextEdit fSourceRoot;
-
- private static class PartialCopier extends TextEditVisitor {
- TextEdit fResult;
- List fParents= new ArrayList();
- TextEdit fCurrentParent;
-
- public static TextEdit perform(TextEdit source) {
- PartialCopier copier= new PartialCopier();
- source.accept(copier);
- return copier.fResult;
- }
- private void manageCopy(TextEdit copy) {
- if (fResult == null)
- fResult= copy;
- if (fCurrentParent != null) {
- fCurrentParent.addChild(copy);
- }
- fParents.add(fCurrentParent);
- fCurrentParent= copy;
- }
- public void postVisit(TextEdit edit) {
- fCurrentParent= (TextEdit)fParents.remove(fParents.size() - 1);
- }
- public boolean visitNode(TextEdit edit) {
- manageCopy(edit.doCopy());
- return true;
- }
- public boolean visit(CopySourceEdit edit) {
- manageCopy(new RangeMarker(edit.getOffset(), edit.getLength()));
- return true;
- }
- public boolean visit(CopyTargetEdit edit) {
- manageCopy(new InsertEdit(edit.getOffset(), edit.getSourceEdit().getContent()));
- return true;
- }
- public boolean visit(MoveSourceEdit edit) {
- manageCopy(new DeleteEdit(edit.getOffset(), edit.getLength()));
- return true;
- }
- public boolean visit(MoveTargetEdit edit) {
- manageCopy(new InsertEdit(edit.getOffset(), edit.getSourceEdit().getContent()));
- return true;
- }
- }
-
- /**
- * Constructs a new copy source edit.
- *
- * @param offset the edit's offset
- * @param length the edit's length
- */
- public CopySourceEdit(int offset, int length) {
- super(offset, length);
- }
-
- /**
- * Constructs a new copy source edit.
- *
- * @param offset the edit's offset
- * @param length the edit's length
- * @param target the edit's target
- */
- public CopySourceEdit(int offset, int length, CopyTargetEdit target) {
- this(offset, length);
- setTargetEdit(target);
- }
-
- /*
- * Copy Constructor
- */
- private CopySourceEdit(CopySourceEdit other) {
- super(other);
- if (other.fModifier != null)
- fModifier= other.fModifier.copy();
- }
-
- /**
- * Returns the associated traget edit or <code>null</code>
- * if no target edit is associated yet.
- *
- * @return the target edit or <code>null</code>
- */
- public CopyTargetEdit getTargetEdit() {
- return fTarget;
- }
-
- /**
- * Sets the target edit.
- *
- * @param edit the new target edit.
- *
- * @exception MalformedTreeException is thrown if the target edit
- * is a direct or indirect child of the source edit
- */
- public void setTargetEdit(CopyTargetEdit edit) throws MalformedTreeException {
- Assert.isNotNull(edit);
- if (fTarget != edit) {
- fTarget= edit;
- fTarget.setSourceEdit(this);
- }
- }
-
- /**
- * Returns the current source modifier or <code>null</code>
- * if no source modifier is set.
- *
- * @return the source modifier
- */
- public ISourceModifier getSourceModifier() {
- return fModifier;
- }
-
- /**
- * Sets the optional source modifier.
- *
- * @param modifier the source modifier or <code>null</code>
- * if no source modification is need.
- */
- public void setSourceModifier(ISourceModifier modifier) {
- fModifier= modifier;
- }
-
- /* non Java-doc
- * @see TextEdit#doCopy
- */
- protected TextEdit doCopy() {
- return new CopySourceEdit(this);
- }
-
- /* (non-Javadoc)
- * @see TextEdit#accept0
- */
- protected void accept0(TextEditVisitor visitor) {
- boolean visitChildren = visitor.visit(this);
- if (visitChildren) {
- acceptChildren(visitor);
- }
- }
-
- //---- API for CopyTargetEdit ------------------------------------------------
-
- /* package */ String getContent() {
- // The source content can be null if the edit wasn't executed
- // due to an exclusion list of the text edit processor. Return
- // the empty string which can be moved without any harm.
- if (fSourceContent == null)
- return ""; //$NON-NLS-1$
- return fSourceContent;
- }
-
- /* package */ void clearContent() {
- fSourceContent= null;
- }
-
- /* non Java-doc
- * @see TextEdit#postProcessCopy
- */
- protected void postProcessCopy(TextEditCopier copier) {
- if (fTarget != null) {
- CopySourceEdit source= (CopySourceEdit)copier.getCopy(this);
- CopyTargetEdit target= (CopyTargetEdit)copier.getCopy(fTarget);
- if (source != null && target != null)
- source.setTargetEdit(target);
- }
- }
-
- //---- consistency check ----------------------------------------------------
-
- /* package */ int traverseConsistencyCheck(TextEditProcessor processor, IDocument document, List sourceEdits) {
- int result= super.traverseConsistencyCheck(processor, document, sourceEdits);
- // Since source computation takes place in a recursive fashion (see
- // performSourceComputation) we only do something if we don't have a
- // computated source already.
- if (fSourceContent == null) {
- if (sourceEdits.size() <= result) {
- List list= new ArrayList();
- list.add(this);
- for (int i= sourceEdits.size(); i < result; i++)
- sourceEdits.add(null);
- sourceEdits.add(list);
- } else {
- List list= (List)sourceEdits.get(result);
- if (list == null) {
- list= new ArrayList();
- sourceEdits.add(result, list);
- }
- list.add(this);
- }
- }
- return result;
- }
-
- /* package */ void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException {
- if (fTarget == null)
- throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopySourceEdit.no_target")); //$NON-NLS-1$
- if (fTarget.getSourceEdit() != this)
- throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopySourceEdit.different_source")); //$NON-NLS-1$
- }
-
- //---- source computation -------------------------------------------------------
-
- /* package */ void traverseSourceComputation(TextEditProcessor processor, IDocument document) {
- if (processor.considerEdit(this)) {
- performSourceComputation(processor, document);
- }
- }
-
- /* package */ void performSourceComputation(TextEditProcessor processor, IDocument document) {
- try {
- MultiTextEdit root= new MultiTextEdit(getOffset(), getLength());
- root.internalSetChildren(internalGetChildren());
- fSourceContent= document.get(getOffset(), getLength());
- fSourceRoot= PartialCopier.perform(root);
- fSourceRoot.moveTree(-getOffset());
- if (fSourceRoot.hasChildren()) {
- EditDocument subDocument= new EditDocument(fSourceContent);
- fSourceRoot.apply(subDocument, TextEdit.NONE);
- if (needsTransformation())
- applyTransformation(subDocument);
- fSourceContent= subDocument.get();
- fSourceRoot= null;
- } else {
- if (needsTransformation()) {
- EditDocument subDocument= new EditDocument(fSourceContent);
- applyTransformation(subDocument);
- fSourceContent= subDocument.get();
- }
- }
- } catch (BadLocationException cannotHappen) {
- Assert.isTrue(false);
- }
- }
-
- private boolean needsTransformation() {
- return fModifier != null;
- }
-
- private void applyTransformation(IDocument document) throws MalformedTreeException {
- TextEdit newEdit= new MultiTextEdit(0, document.getLength());
- ReplaceEdit[] replaces= fModifier.getModifications(document.get());
- for (int i= 0; i < replaces.length; i++) {
- newEdit.addChild(replaces[i]);
- }
- try {
- newEdit.apply(document, TextEdit.NONE);
- } catch (BadLocationException cannotHappen) {
- Assert.isTrue(false);
- }
- }
-
- //---- document updating ----------------------------------------------------------------
-
- /* package */ int performDocumentUpdating(IDocument document) throws BadLocationException {
- fDelta= 0;
- return fDelta;
- }
-
- //---- region updating ----------------------------------------------------------------
-
- /* non Java-doc
- * @see TextEdit#deleteChildren
- */
- /* package */ boolean deleteChildren() {
- return false;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/CopyTargetEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/CopyTargetEdit.java
deleted file mode 100644
index ca12247ebff..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/CopyTargetEdit.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.text.edits;
-
-import java.util.List;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * A copy target edit denotes the target of a copy operation. Copy
- * target edits are only valid inside an edit tree if they have a
- * corresponding source edit. Furthermore a target edit can't
- * can't be a direct or indirect child of the associated source edit.
- * Violating one of two requirements will result in a <code>
- * MalformedTreeException</code> when executing the edit tree.
- * <p>
- * Copy target edits can't be used as a parent for other edits.
- * Trying to add an edit to a copy target edit results in a <code>
- * MalformedTreeException</code> as well.
- *
- * @see org.eclipse.text.edits.CopySourceEdit
- *
- * @since 3.0
- */
-public final class CopyTargetEdit extends TextEdit {
-
- private CopySourceEdit fSource;
-
- /**
- * Constructs a new copy target edit
- *
- * @param offset the edit's offset
- */
- public CopyTargetEdit(int offset) {
- super(offset, 0);
- }
-
- /**
- * Constructs an new copy target edit
- *
- * @param offset the edit's offset
- * @param source the corresponding source edit
- */
- public CopyTargetEdit(int offset, CopySourceEdit source) {
- this(offset);
- setSourceEdit(source);
- }
-
- /*
- * Copy constructor
- */
- private CopyTargetEdit(CopyTargetEdit other) {
- super(other);
- }
-
- /**
- * Returns the associated source edit or <code>null</code>
- * if no source edit is associated yet.
- *
- * @return the source edit or <code>null</code>
- */
- public CopySourceEdit getSourceEdit() {
- return fSource;
- }
-
- /**
- * Sets the source edit.
- *
- * @param edit the source edit
- *
- * @exception MalformedTreeException is thrown if the target edit
- * is a direct or indirect child of the source edit
- */
- public void setSourceEdit(CopySourceEdit edit) throws MalformedTreeException {
- Assert.isNotNull(edit);
- if (fSource != edit) {
- fSource= edit;
- fSource.setTargetEdit(this);
- TextEdit parent= getParent();
- while (parent != null) {
- if (parent == fSource)
- throw new MalformedTreeException(parent, this, TextEditMessages.getString("CopyTargetEdit.wrong_parent")); //$NON-NLS-1$
- parent= parent.getParent();
- }
- }
- }
-
- /* non Java-doc
- * @see TextEdit#doCopy
- */
- protected TextEdit doCopy() {
- return new CopyTargetEdit(this);
- }
-
- /* non Java-doc
- * @see TextEdit#postProcessCopy
- */
- protected void postProcessCopy(TextEditCopier copier) {
- if (fSource != null) {
- CopyTargetEdit target= (CopyTargetEdit)copier.getCopy(this);
- CopySourceEdit source= (CopySourceEdit)copier.getCopy(fSource);
- if (target != null && source != null)
- target.setSourceEdit(source);
- }
- }
-
- /* (non-Javadoc)
- * @see TextEdit#accept0
- */
- protected void accept0(TextEditVisitor visitor) {
- boolean visitChildren = visitor.visit(this);
- if (visitChildren) {
- acceptChildren(visitor);
- }
- }
-
- /* non Java-doc
- * @see TextEdit#traverseConsistencyCheck
- */
- /* package */ int traverseConsistencyCheck(TextEditProcessor processor, IDocument document, List sourceEdits) {
- return super.traverseConsistencyCheck(processor, document, sourceEdits) + 1;
- }
-
- /* non Java-doc
- * @see TextEdit#performConsistencyCheck
- */
- /* package */ void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException {
- if (fSource == null)
- throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopyTargetEdit.no_source")); //$NON-NLS-1$
- if (fSource.getTargetEdit() != this)
- throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopyTargetEdit.different_target")); //$NON-NLS-1$
- }
-
- /* non Java-doc
- * @see TextEdit#performDocumentUpdating
- */
- /* package */ int performDocumentUpdating(IDocument document) throws BadLocationException {
- String source= fSource.getContent();
- document.replace(getOffset(), getLength(), source);
- fDelta= source.length() - getLength();
- fSource.clearContent();
- return fDelta;
- }
-
- /* non Java-doc
- * @see TextEdit#deleteChildren
- */
- /* package */ boolean deleteChildren() {
- return false;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/CopyingRangeMarker.java b/org.eclipse.text/src/org/eclipse/text/edits/CopyingRangeMarker.java
deleted file mode 100644
index ccf99f67a57..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/CopyingRangeMarker.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.text.edits;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * A <code>CopyingRangeMarker</code> can be used to track positions when executing
- * text edits. Additionally a copying range marker stores a local copy of the
- * text it captures when it gets executed.
- *
- * @since 3.0
- */
-public final class CopyingRangeMarker extends TextEdit {
-
- private String fText;
-
- /**
- * Creates a new <tt>CopyRangeMarker</tt> for the given
- * offset and length.
- *
- * @param offset the marker's offset
- * @param length the marker's length
- */
- public CopyingRangeMarker(int offset, int length) {
- super(offset, length);
- }
-
- /*
- * Copy constructor
- */
- private CopyingRangeMarker(CopyingRangeMarker other) {
- super(other);
- fText= other.fText;
- }
-
- /* non Java-doc
- * @see TextEdit#doCopy
- */
- protected TextEdit doCopy() {
- return new CopyingRangeMarker(this);
- }
-
- /*
- * @see TextEdit#accept0
- */
- protected void accept0(TextEditVisitor visitor) {
- boolean visitChildren = visitor.visit(this);
- if (visitChildren) {
- acceptChildren(visitor);
- }
- }
-
- /* non Java-doc
- * @see TextEdit#performDocumentUpdating
- */
- /* package */ int performDocumentUpdating(IDocument document) throws BadLocationException {
- fText= document.get(getOffset(), getLength());
- fDelta= 0;
- return fDelta;
- }
-
- /* non Java-doc
- * @see TextEdit#deleteChildren
- */
- /* package */ boolean deleteChildren() {
- return false;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/DeleteEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/DeleteEdit.java
deleted file mode 100644
index cb0f8ede6e1..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/DeleteEdit.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.text.edits;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * Text edit to delete a range in a document.
- * <p>
- * A delete edit is equivalent to <code>ReplaceEdit(
- * offset, length, "")</code>.
- *
- * @since 3.0
- */
-public final class DeleteEdit extends TextEdit {
-
- /**
- * Constructs a new delete edit.
- *
- * @param offset the offset of the range to replace
- * @param length the length of the range to replace
- */
- public DeleteEdit(int offset, int length) {
- super(offset, length);
- }
-
- /*
- * Copy constructor
- */
- private DeleteEdit(DeleteEdit other) {
- super(other);
- }
-
- /* non Java-doc
- * @see TextEdit#doCopy
- */
- protected TextEdit doCopy() {
- return new DeleteEdit(this);
- }
-
- /* (non-Javadoc)
- * @see TextEdit#accept0
- */
- protected void accept0(TextEditVisitor visitor) {
- boolean visitChildren = visitor.visit(this);
- if (visitChildren) {
- acceptChildren(visitor);
- }
- }
-
- /* non Java-doc
- * @see TextEdit#performDocumentUpdating
- */
- /* package */ int performDocumentUpdating(IDocument document) throws BadLocationException {
- document.replace(getOffset(), getLength(), ""); //$NON-NLS-1$
- fDelta= -getLength();
- return fDelta;
- }
-
- /* non Java-doc
- * @see TextEdit#deleteChildren
- */
- /* package */ boolean deleteChildren() {
- return true;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java b/org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java
deleted file mode 100644
index ef599db5272..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/EditDocument.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.text.edits;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.IDocumentPartitioningListener;
-import org.eclipse.jface.text.IPositionUpdater;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Position;
-
-/* package */ class EditDocument implements IDocument {
-
- private StringBuffer fBuffer;
-
- public EditDocument(String content) {
- fBuffer= new StringBuffer(content);
- }
-
- public void addDocumentListener(IDocumentListener listener) {
- throw new UnsupportedOperationException();
- }
-
- public void addDocumentPartitioningListener(IDocumentPartitioningListener listener) {
- throw new UnsupportedOperationException();
- }
-
- public void addPosition(Position position) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public void addPosition(String category, Position position) throws BadLocationException, BadPositionCategoryException {
- throw new UnsupportedOperationException();
- }
-
- public void addPositionCategory(String category) {
- throw new UnsupportedOperationException();
- }
-
- public void addPositionUpdater(IPositionUpdater updater) {
- throw new UnsupportedOperationException();
- }
-
- public void addPrenotifiedDocumentListener(IDocumentListener documentAdapter) {
- throw new UnsupportedOperationException();
- }
-
- public int computeIndexInCategory(String category, int offset) throws BadLocationException, BadPositionCategoryException {
- throw new UnsupportedOperationException();
- }
-
- public int computeNumberOfLines(String text) {
- throw new UnsupportedOperationException();
- }
-
- public ITypedRegion[] computePartitioning(int offset, int length) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public boolean containsPosition(String category, int offset, int length) {
- throw new UnsupportedOperationException();
- }
-
- public boolean containsPositionCategory(String category) {
- throw new UnsupportedOperationException();
- }
-
- public String get() {
- return fBuffer.toString();
- }
-
- public String get(int offset, int length) throws BadLocationException {
- char[] result= new char[length];
- fBuffer.getChars(offset, offset + length, result, 0);
- return new String(result);
- }
-
- public char getChar(int offset) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public String getContentType(int offset) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public IDocumentPartitioner getDocumentPartitioner() {
- throw new UnsupportedOperationException();
- }
-
- public String[] getLegalContentTypes() {
- throw new UnsupportedOperationException();
- }
-
- public String[] getLegalLineDelimiters() {
- throw new UnsupportedOperationException();
- }
-
- public int getLength() {
- return fBuffer.length();
- }
-
- public String getLineDelimiter(int line) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public IRegion getLineInformation(int line) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public IRegion getLineInformationOfOffset(int offset) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public int getLineLength(int line) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public int getLineOffset(int line) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public int getLineOfOffset(int offset) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public int getNumberOfLines() {
- throw new UnsupportedOperationException();
- }
-
- public int getNumberOfLines(int offset, int length) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public ITypedRegion getPartition(int offset) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public String[] getPositionCategories() {
- throw new UnsupportedOperationException();
- }
-
- public Position[] getPositions(String category) throws BadPositionCategoryException {
- throw new UnsupportedOperationException();
- }
-
- public IPositionUpdater[] getPositionUpdaters() {
- throw new UnsupportedOperationException();
- }
-
- public void insertPositionUpdater(IPositionUpdater updater, int index) {
- throw new UnsupportedOperationException();
- }
-
- public void removeDocumentListener(IDocumentListener listener) {
- throw new UnsupportedOperationException();
- }
-
- public void removeDocumentPartitioningListener(IDocumentPartitioningListener listener) {
- throw new UnsupportedOperationException();
- }
-
- public void removePosition(Position position) {
- throw new UnsupportedOperationException();
- }
-
- public void removePosition(String category, Position position) throws BadPositionCategoryException {
- throw new UnsupportedOperationException();
- }
-
- public void removePositionCategory(String category) throws BadPositionCategoryException {
- throw new UnsupportedOperationException();
- }
-
- public void removePositionUpdater(IPositionUpdater updater) {
- throw new UnsupportedOperationException();
- }
-
- public void removePrenotifiedDocumentListener(IDocumentListener documentAdapter) {
- throw new UnsupportedOperationException();
- }
-
- public void replace(int offset, int length, String text) throws BadLocationException {
- fBuffer.replace(offset, offset + length, text);
- }
-
- public int search(int startOffset, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord) throws BadLocationException {
- throw new UnsupportedOperationException();
- }
-
- public void set(String text) {
- throw new UnsupportedOperationException();
- }
-
- public void setDocumentPartitioner(IDocumentPartitioner partitioner) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/ISourceModifier.java b/org.eclipse.text/src/org/eclipse/text/edits/ISourceModifier.java
deleted file mode 100644
index bab1fcca18a..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/ISourceModifier.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.text.edits;
-
-/**
- * A source modifier can be used to modify the source of
- * a move or copy edit before it gets inserted at the target
- * position. This is useful if the text to be copied has to
- * be modified before it is inserted without changing the
- * original source.
- *
- * @since 3.0
- */
-public interface ISourceModifier {
- /**
- * Returns the modification to be done to the passed
- * string in form of replace edits. The set of returned
- * replace edits must modify disjoint text regions.
- * Violating this requirement will result in a <code>
- * BadLocationException</code> while executing the
- * associated move or copy edit.
- * <p>
- * The caller of this method is responsible to apply
- * the returned edits to the passed source.
- *
- * @param source the source to be copied or moved
- * @return an array of <code>ReplaceEdits</code>
- * describing the modifications.
- */
- public ReplaceEdit[] getModifications(String source);
-
- /**
- * Creates a copy of this source modifier object. The copy will
- * be used in a different text edit object. So it should be
- * created in a way that is doesn't conflict with other text edits
- * refering to this source modifier.
- *
- * @return the copy of the source modifier
- */
- public ISourceModifier copy();
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/InsertEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/InsertEdit.java
deleted file mode 100644
index b716f5d98d5..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/InsertEdit.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.text.edits;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * Text edit to insert a text at a given position in a
- * document.
- * <p>
- * An insert edit is equivalent to <code>ReplaceEdit(offset, 0, text)
- * </code>
- *
- * @since 3.0
- */
-public final class InsertEdit extends TextEdit {
-
- private String fText;
-
- /**
- * Constructs a new insert edit.
- *
- * @param offset the insertion offset
- * @param text the text to insert
- */
- public InsertEdit(int offset, String text) {
- super(offset, 0);
- fText= text;
- }
-
- /*
- * Copy constructor
- */
- private InsertEdit(InsertEdit other) {
- super(other);
- fText= other.fText;
- }
-
- /**
- * Returns the new text inserted at the offset denoted
- * by this edit.
- *
- * @return the edit's text.
- */
- public String getText() {
- return fText;
- }
-
- /* non Java-doc
- * @see TextEdit#doCopy
- */
- protected TextEdit doCopy() {
- return new InsertEdit(this);
- }
-
- /* (non-Javadoc)
- * @see TextEdit#accept0
- */
- protected void accept0(TextEditVisitor visitor) {
- boolean visitChildren = visitor.visit(this);
- if (visitChildren) {
- acceptChildren(visitor);
- }
- }
-
- /* non Java-doc
- * @see TextEdit#performDocumentUpdating
- */
- /* package */ int performDocumentUpdating(IDocument document) throws BadLocationException {
- document.replace(getOffset(), getLength(), fText);
- fDelta= fText.length() - getLength();
- return fDelta;
- }
-
- /* non Java-doc
- * @see TextEdit#deleteChildren
- */
- /* package */ boolean deleteChildren() {
- return false;
- }
-
- /* non Java-doc
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return super.toString() + " <<" + fText; //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/MalformedTreeException.java b/org.eclipse.text/src/org/eclipse/text/edits/MalformedTreeException.java
deleted file mode 100644
index f5baec919a3..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/MalformedTreeException.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.text.edits;
-
-/**
- * Thrown to indicate that an edit got added to a parent edit
- * but the child edit somehow conflicts with the parent or
- * one of it siblings.
- *
- * @see TextEdit#add(TextEdit)
- *
- * @since 3.0
- */
-public class MalformedTreeException extends RuntimeException {
-
- private TextEdit fParent;
- private TextEdit fChild;
-
- /**
- * Constructs a new malformed tree exception.
- *
- * @param parent the parent edit
- * @param child the child edit
- * @param message the detail message
- */
- public MalformedTreeException(TextEdit parent, TextEdit child, String message) {
- super(message);
- fParent= parent;
- fChild= child;
- }
-
- /**
- * Returns the parent edit that caused the exception.
- *
- * @return the parent edit
- */
- public TextEdit getParent() {
- return fParent;
- }
-
- /**
- * Returns the child edit that caused the exception.
- *
- * @return the child edit
- */
- public TextEdit getChild() {
- return fChild;
- }
-
- /* package */ void setParent(TextEdit parent) {
- fParent= parent;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/Messages.properties b/org.eclipse.text/src/org/eclipse/text/edits/Messages.properties
deleted file mode 100644
index 486880f2fbc..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/Messages.properties
+++ /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
-###############################################################################
-
-TextEdit.range_outside= Range of child edit lies outside of parent edit
-TextEdit.overlapping= Overlapping text edits
-TextEdit.deleted_edit= Cannot add deleted edit
-
-CopySourceEdit.no_target= No target edit provided.
-CopySourceEdit.different_source= Target edit has different source edit.
-
-CopyTargetEdit.no_source= No source edit provided.
-CopyTargetEdit.different_target= Source edit has different target edit.
-CopyTargetEdit.wrong_parent=Source edit must not be the parent of the target.
-
-MoveSourceEdit.no_target= No target edit provided.
-MoveSourceEdit.different_source= Target edit has different source edit.
-
-MoveTargetEdit.no_source= No source edit provided.
-MoveTargetEdit.different_target= Source edit has different target edit.
-MoveTargetEdit.wrong_parent=Source edit must not be the parent of the target.
-
-TextEditProcessor.invalid_length=End position lies outside of document range
-
-UndoEdit.no_children=Can\'t add children to an undo edit
-UndoEdit.can_not_be_added=Can\'t add an undo edit to another edit
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java
deleted file mode 100644
index 3d02b356366..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.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.text.edits;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-
-/**
- * A move source edit denotes the source of a move operation. Move
- * source edits are only valid inside an edit tree if they have a
- * corresponding traget edit. Furthermore the corresponding target
- * edit can't be a direct or indirect child of the source edit.
- * Violating one of two requirements will result in a <code>
- * MalformedTreeException</code> when executing the edit tree.
- * <p>
- * A move source edit can manange an optional source modifier. A
- * source modifier can provide a set of replace edits which will
- * to applied to the source before it gets inserted at the target
- * position.
- *
- * @see org.eclipse.text.edits.MoveTargetEdit
- * @see org.eclipse.text.edits.CopySourceEdit
- *
- * @since 3.0
- */
-public final class MoveSourceEdit extends TextEdit {
-
- private MoveTargetEdit fTarget;
- private ISourceModifier fModifier;
-
- private String fSourceContent;
- private MultiTextEdit fSourceRoot;
-
- /**
- * Constructs a new move source edit.
- *
- * @param offset the edit's offset
- * @param length the edit's length
- */
- public MoveSourceEdit(int offset, int length) {
- super(offset, length);
- }
-
- /**
- * Constructs a new copy source edit.
- *
- * @param offset the edit's offset
- * @param length the edit's length
- * @param target the edit's target
- */
- public MoveSourceEdit(int offset, int length, MoveTargetEdit target) {
- this(offset, length);
- setTargetEdit(target);
- }
-
- /*
- * Copy constructor
- */
- private MoveSourceEdit(MoveSourceEdit other) {
- super(other);
- if (other.fModifier != null)
- fModifier= other.fModifier.copy();
- }
-
- /**
- * Returns the associated traget edit or <code>null</code>
- * if no target edit is associated yet.
- *
- * @return the target edit or <code>null</code>
- */
- public MoveTargetEdit getTargetEdit() {
- return fTarget;
- }
-
- /**
- * Sets the target edit.
- *
- * @param edit the new target edit.
- *
- * @exception MalformedTreeException is thrown if the target edit
- * is a direct or indirect child of the source edit
- */
- public void setTargetEdit(MoveTargetEdit edit) {
- fTarget= edit;
- fTarget.setSourceEdit(this);
- }
-
- /**
- * Returns the current source modifier or <code>null</code>
- * if no source modifier is set.
- *
- * @return the source modifier
- */
- public ISourceModifier getSourceModifier() {
- return fModifier;
- }
-
- /**
- * Sets the optional source modifier.
- *
- * @param modifier the source modifier or <code>null</code>
- * if no source modification is need.
- */
- public void setSourceModifier(ISourceModifier modifier) {
- fModifier= modifier;
- }
-
- //---- API for MoveTargetEdit ---------------------------------------------
-
- /* package */ String getContent() {
- // The source content can be null if the edit wasn't executed
- // due to an exclusion list of the text edit processor. Return
- // the empty string which can be moved without any harm.
- if (fSourceContent == null)
- return ""; //$NON-NLS-1$
- return fSourceContent;
- }
-
- /* package */ MultiTextEdit getRoot() {
- return fSourceRoot;
- }
-
- /* package */ void clearContent() {
- fSourceContent= null;
- fSourceRoot= null;
- }
-
- //---- Copying -------------------------------------------------------------
-
- /* non Java-doc
- * @see TextEdit#doCopy
- */
- protected TextEdit doCopy() {
- return new MoveSourceEdit(this);
- }
-
- /* non Java-doc
- * @see TextEdit#postProcessCopy
- */
- protected void postProcessCopy(TextEditCopier copier) {
- if (fTarget != null) {
- MoveSourceEdit source= (MoveSourceEdit)copier.getCopy(this);
- MoveTargetEdit target= (MoveTargetEdit)copier.getCopy(fTarget);
- if (source != null && target != null)
- source.setTargetEdit(target);
- }
- }
-
- //---- Visitor -------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see TextEdit#accept0
- */
- protected void accept0(TextEditVisitor visitor) {
- boolean visitChildren = visitor.visit(this);
- if (visitChildren) {
- acceptChildren(visitor);
- }
- }
-
- //---- consistency check ----------------------------------------------------------------
-
- /* package */ int traverseConsistencyCheck(TextEditProcessor processor, IDocument document, List sourceEdits) {
- int result= super.traverseConsistencyCheck(processor, document, sourceEdits);
- // Since source computation takes place in a recursive fashion (see
- // performSourceComputation) we only do something if we don't have a
- // computated source already.
- if (fSourceContent == null) {
- if (sourceEdits.size() <= result) {
- List list= new ArrayList();
- list.add(this);
- for (int i= sourceEdits.size(); i < result; i++)
- sourceEdits.add(null);
- sourceEdits.add(list);
- } else {
- List list= (List)sourceEdits.get(result);
- if (list == null) {
- list= new ArrayList();
- sourceEdits.add(result, list);
- }
- list.add(this);
- }
- }
- return result;
- }
-
- /* package */ void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException {
- if (fTarget == null)
- throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveSourceEdit.no_target")); //$NON-NLS-1$
- if (fTarget.getSourceEdit() != this)
- throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveSourceEdit.different_source")); //$NON-NLS-1$
- }
-
- //---- source computation --------------------------------------------------------------
-
- /* package */ void traverseSourceComputation(TextEditProcessor processor, IDocument document) {
- if (processor.considerEdit(this)) {
- performSourceComputation(processor, document);
- }
- }
-
- /* package */ void performSourceComputation(TextEditProcessor processor, IDocument document) {
- try {
- TextEdit[] children= removeChildren();
- if (children.length > 0) {
- String content= document.get(getOffset(), getLength());
- EditDocument subDocument= new EditDocument(content);
- fSourceRoot= new MultiTextEdit(getOffset(), getLength());
- fSourceRoot.addChildren(children);
- fSourceRoot.moveTree(-getOffset());
- int processingStyle= getStyle(processor);
- fSourceRoot.apply(subDocument, processingStyle);
- if (needsTransformation())
- applyTransformation(subDocument, processingStyle);
- fSourceContent= subDocument.get();
- } else {
- fSourceContent= document.get(getOffset(), getLength());
- if (needsTransformation()) {
- EditDocument subDocument= new EditDocument(fSourceContent);
- applyTransformation(subDocument, getStyle(processor));
- fSourceContent= subDocument.get();
- }
- }
- } catch (BadLocationException cannotHappen) {
- Assert.isTrue(false);
- }
- }
-
- private int getStyle(TextEditProcessor processor) {
- // we never need undo while performing local edits.
- if ((processor.getStyle() & TextEdit.UPDATE_REGIONS) != 0)
- return TextEdit.UPDATE_REGIONS;
- return TextEdit.NONE;
- }
-
- //---- document updating ----------------------------------------------------------------
-
- /* package */ int performDocumentUpdating(IDocument document) throws BadLocationException {
- document.replace(getOffset(), getLength(), ""); //$NON-NLS-1$
- fDelta= -getLength();
- return fDelta;
- }
-
- //---- region updating --------------------------------------------------------------
-
- /* non Java-doc
- * @see TextEdit#deleteChildren
- */
- /* package */ boolean deleteChildren() {
- return false;
- }
-
- //---- content transformation --------------------------------------------------
-
- private boolean needsTransformation() {
- return fModifier != null;
- }
-
- private void applyTransformation(IDocument document, int style) throws MalformedTreeException {
- if ((style & TextEdit.UPDATE_REGIONS) != 0 && fSourceRoot != null) {
- Map editMap= new HashMap();
- TextEdit newEdit= createEdit(editMap);
- List replaces= new ArrayList(Arrays.asList(fModifier.getModifications(document.get())));
- insertEdits(newEdit, replaces);
- try {
- newEdit.apply(document, style);
- } catch (BadLocationException cannotHappen) {
- Assert.isTrue(false);
- }
- restorePositions(editMap);
- } else {
- MultiTextEdit newEdit= new MultiTextEdit(0, document.getLength());
- TextEdit[] replaces= fModifier.getModifications(document.get());
- for (int i= 0; i < replaces.length; i++) {
- newEdit.addChild(replaces[i]);
- }
- try {
- newEdit.apply(document, style);
- } catch (BadLocationException cannotHappen) {
- Assert.isTrue(false);
- }
- }
- }
-
- private TextEdit createEdit(Map editMap) {
- MultiTextEdit result= new MultiTextEdit(0, fSourceRoot.getLength());
- editMap.put(result, fSourceRoot);
- createEdit(fSourceRoot, result, editMap);
- return result;
- }
-
- private static void createEdit(TextEdit source, TextEdit target, Map editMap) {
- TextEdit[] children= source.getChildren();
- for (int i= 0; i < children.length; i++) {
- TextEdit child= children[i];
- RangeMarker marker= new RangeMarker(child.getOffset(), child.getLength());
- target.addChild(marker);
- editMap.put(marker, child);
- createEdit(child, marker, editMap);
- }
- }
-
- private void insertEdits(TextEdit root, List edits) {
- while(edits.size() > 0) {
- ReplaceEdit edit= (ReplaceEdit)edits.remove(0);
- insert(root, edit, edits);
- }
- }
- private static void insert(TextEdit parent, ReplaceEdit edit, List edits) {
- if (!parent.hasChildren()) {
- parent.addChild(edit);
- return;
- }
- TextEdit[] children= parent.getChildren();
- // First dive down to find the right parent.
- for (int i= 0; i < children.length; i++) {
- TextEdit child= children[i];
- if (child.covers(edit)) {
- insert(child, edit, edits);
- return;
- } else if (edit.covers(child)) {
- parent.removeChild(i);
- edit.addChild(child);
- } else {
- IRegion intersect= intersect(edit, child);
- if (intersect != null) {
- ReplaceEdit[] splits= splitEdit(edit, intersect);
- insert(child, splits[0], edits);
- edits.add(splits[1]);
- }
- }
- }
- parent.addChild(edit);
- }
-
- public static IRegion intersect(TextEdit op1, TextEdit op2) {
- int offset1= op1.getOffset();
- int length1= op1.getLength();
- int end1= offset1 + length1 - 1;
- int offset2= op2.getOffset();
- if (end1 < offset2)
- return null;
- int length2= op2.getLength();
- int end2= offset2 + length2 - 1;
- if (end2 < offset1)
- return null;
- if (offset1 < offset2) {
- int end= Math.max(end1, end2);
- return new Region(offset2, end - offset2 + 1);
- } else {
- int end= Math.max(end1, end2);
- return new Region(offset1, end - offset1 + 1);
- }
- }
-
- private static ReplaceEdit[] splitEdit(ReplaceEdit edit, IRegion intersect) {
- if (edit.getOffset() != intersect.getOffset()) {
- return splitIntersectRight(edit, intersect);
- } else {
- return splitIntersectLeft(edit, intersect);
- }
- }
-
- private static ReplaceEdit[] splitIntersectRight(ReplaceEdit edit, IRegion intersect) {
- ReplaceEdit[] result= new ReplaceEdit[2];
- // this is the actual delete. We use replace to only deal with one type
- result[0]= new ReplaceEdit(intersect.getOffset(), intersect.getLength(), ""); //$NON-NLS-1$
- result[1]= new ReplaceEdit(
- edit.getOffset(),
- intersect.getOffset() - edit.getOffset(),
- edit.getText());
- return result;
- }
-
- private static ReplaceEdit[] splitIntersectLeft(ReplaceEdit edit, IRegion intersect) {
- ReplaceEdit[] result= new ReplaceEdit[2];
- result[0]= new ReplaceEdit(intersect.getOffset(), intersect.getLength(), edit.getText());
- result[1]= new ReplaceEdit( // this is the actual delete. We use replace to only deal with one type
- intersect.getOffset() + intersect.getLength(),
- edit.getLength() - intersect.getLength(),
- ""); //$NON-NLS-1$
- return result;
- }
-
- private static void restorePositions(Map editMap) {
- for (Iterator iter= editMap.keySet().iterator(); iter.hasNext();) {
- TextEdit marker= (TextEdit)iter.next();
- TextEdit edit= (TextEdit)editMap.get(marker);
- if (marker.isDeleted()) {
- edit.markAsDeleted();
- } else {
- edit.adjustOffset(marker.getOffset() - edit.getOffset());
- edit.adjustLength(marker.getLength() - edit.getLength());
- }
- }
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/MoveTargetEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/MoveTargetEdit.java
deleted file mode 100644
index a9da7e27bba..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/MoveTargetEdit.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.text.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * A move target edit denotes the target of a move operation. Move
- * target edits are only valid inside an edit tree if they have a
- * corresponding source edit. Furthermore a target edit can't
- * can't be a direct or indirect child of its associated source edit.
- * Violating one of two requirements will result in a <code>
- * MalformedTreeException</code> when executing the edit tree.
- * <p>
- * Move target edits can't be used as a parent for other edits.
- * Trying to add an edit to a move target edit results in a <code>
- * MalformedTreeException</code> as well.
- *
- * @see org.eclipse.text.edits.MoveSourceEdit
- * @see org.eclipse.text.edits.CopyTargetEdit
- *
- * @since 3.0
- */
-public final class MoveTargetEdit extends TextEdit {
-
- private MoveSourceEdit fSource;
-
- /**
- * Constructs a new move target edit
- *
- * @param offset the edit's offset
- */
- public MoveTargetEdit(int offset) {
- super(offset, 0);
- }
-
- /**
- * Constructs an new move target edit
- *
- * @param offset the edit's offset
- * @param source the corresponding source edit
- */
- public MoveTargetEdit(int offset, MoveSourceEdit source) {
- this(offset);
- setSourceEdit(source);
- }
-
- /*
- * Copy constructor
- */
- private MoveTargetEdit(MoveTargetEdit other) {
- super(other);
- }
-
- /**
- * Returns the associated source edit or <code>null</code>
- * if no source edit is associated yet.
- *
- * @return the source edit or <code>null</code>
- */
- public MoveSourceEdit getSourceEdit() {
- return fSource;
- }
-
- /**
- * Sets the source edit.
- *
- * @param edit the source edit
- *
- * @exception MalformedTreeException is thrown if the target edit
- * is a direct or indirect child of the source edit
- */
- public void setSourceEdit(MoveSourceEdit edit) {
- if (fSource != edit) {
- fSource= edit;
- fSource.setTargetEdit(this);
- TextEdit parent= getParent();
- while (parent != null) {
- if (parent == fSource)
- throw new MalformedTreeException(parent, this, TextEditMessages.getString("MoveTargetEdit.wrong_parent")); //$NON-NLS-1$
- parent= parent.getParent();
- }
- }
- }
-
- /* non Java-doc
- * @see TextEdit#doCopy
- */
- protected TextEdit doCopy() {
- return new MoveTargetEdit(this);
- }
-
- /* non Java-doc
- * @see TextEdit#postProcessCopy
- */
- protected void postProcessCopy(TextEditCopier copier) {
- if (fSource != null) {
- MoveTargetEdit target= (MoveTargetEdit)copier.getCopy(this);
- MoveSourceEdit source= (MoveSourceEdit)copier.getCopy(fSource);
- if (target != null && source != null)
- target.setSourceEdit(source);
- }
- }
-
- /* (non-Javadoc)
- * @see TextEdit#accept0
- */
- protected void accept0(TextEditVisitor visitor) {
- boolean visitChildren = visitor.visit(this);
- if (visitChildren) {
- acceptChildren(visitor);
- }
- }
-
- //---- consistency check ----------------------------------------------------------
-
- /* non Java-doc
- * @see TextEdit#traverseConsistencyCheck
- */
- /* package */ int traverseConsistencyCheck(TextEditProcessor processor, IDocument document, List sourceEdits) {
- return super.traverseConsistencyCheck(processor, document, sourceEdits) + 1;
- }
-
- /* non Java-doc
- * @see TextEdit#performConsistencyCheck
- */
- /* package */ void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException {
- if (fSource == null)
- throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveTargetEdit.no_source")); //$NON-NLS-1$
- if (fSource.getTargetEdit() != this)
- throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveTargetEdit.different_target")); //$NON-NLS-1$
- }
-
- //---- document updating ----------------------------------------------------------------
-
- /* non Java-doc
- * @see TextEdit#performDocumentUpdating
- */
- /* package */ int performDocumentUpdating(IDocument document) throws BadLocationException {
- String source= fSource.getContent();
- document.replace(getOffset(), getLength(), source);
- fDelta= source.length() - getLength();
-
- MultiTextEdit sourceRoot= fSource.getRoot();
- if (sourceRoot != null) {
- sourceRoot.moveTree(getOffset());
- TextEdit[] sourceChildren= sourceRoot.removeChildren();
- List children= new ArrayList(sourceChildren.length);
- for (int i= 0; i < sourceChildren.length; i++) {
- TextEdit child= sourceChildren[i];
- child.internalSetParent(this);
- children.add(child);
- }
- internalSetChildren(children);
- }
- fSource.clearContent();
- return fDelta;
- }
-
- //---- region updating --------------------------------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.text.edits.TextEdit#traversePassThree
- */
- /* package */ int traverseRegionUpdating(TextEditProcessor processor, IDocument document, int accumulatedDelta, boolean delete) {
- // the children got already updated / normalized while they got removed
- // from the source edit. So we only have to adjust the offset computed to
- // far.
- if (delete) {
- deleteTree();
- } else {
- moveTree(accumulatedDelta);
- }
- return accumulatedDelta + fDelta;
- }
-
- /* package */ boolean deleteChildren() {
- return false;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/MultiTextEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/MultiTextEdit.java
deleted file mode 100644
index b1eaa0fa2a2..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/MultiTextEdit.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.text.edits;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-
-/**
- * A multi text edit can be used to aggregate several edits into
- * one edit. The edit itself doesn't modify a document.
- * <p>
- * Clients are allowed to implement subclasses of a multi text
- * edit.Subclasses must implement <code>doCopy()</code> to ensure
- * the a copy of the right type is created. Not implementing
- * <code>doCopy()</code> in subclasses will result in an assertion
- * failure during copying.
- *
- * @since 3.0
- */
-public class MultiTextEdit extends TextEdit {
-
- private boolean fDefined;
-
- /**
- * Creates a new <code>MultiTextEdit</code>. The range
- * of the edit is determined by the range of its children.
- *
- * Adding this edit to a parent edit sets its range to the
- * range covered by its children. If the edit doesn't have
- * any children its offset is set to the parent's offset
- * and its length is set to 0.
- */
- public MultiTextEdit() {
- super(0, Integer.MAX_VALUE);
- fDefined= false;
- }
-
- /**
- * Creates a new </code>MultiTextEdit</code> for the given
- * range. Adding a child to this edit which isn't covered
- * by the given range will result in an exception.
- *
- * @param offset the edit's offset
- * @param length the edit's length.
- * @see TextEdit#add(TextEdit)
- */
- public MultiTextEdit(int offset, int length) {
- super(offset, length);
- fDefined= true;
- }
-
- /*
- * Copy constructor.
- */
- protected MultiTextEdit(MultiTextEdit other) {
- super(other);
- }
-
- /**
- * Checks the edit's integrity.
- * <p>
- * Note that this method <b>should only be called</b> by the edit
- * framework and not by normal clients.</p>
- *<p>
- * This default implementation does nothing. Subclasses may override
- * if needed.</p>
- *
- * @exception MalformedTreeException if the edit isn't in a valid state
- * and can therefore not be executed
- */
- protected void checkIntegrity() throws MalformedTreeException {
- // does nothing
- }
-
- /* non Java-doc
- * @see TextEdit#copy
- */
- protected TextEdit doCopy() {
- Assert.isTrue(MultiTextEdit.class == getClass(), "Subclasses must reimplement copy0"); //$NON-NLS-1$
- return new MultiTextEdit(this);
- }
-
- /* (non-Javadoc)
- * @see TextEdit#accept0
- */
- protected void accept0(TextEditVisitor visitor) {
- boolean visitChildren = visitor.visit(this);
- if (visitChildren) {
- acceptChildren(visitor);
- }
- }
-
- /* non Java-doc
- * @see TextEdit#performConsistencyCheck
- */
- /* package */ void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException {
- checkIntegrity();
- }
-
- /* non Java-doc
- * @see TextEdit#performDocumentUpdating
- */
- /* package */ int performDocumentUpdating(IDocument document) throws BadLocationException {
- fDelta= 0;
- return fDelta;
- }
-
- /* non Java-doc
- * @see TextEdit#deleteChildren
- */
- /* package */ boolean deleteChildren() {
- return false;
- }
-
- /* package */ void aboutToBeAdded(TextEdit parent) {
- defineRegion(parent.getOffset());
- }
-
- /* package */ void defineRegion(int parentOffset) {
- if (fDefined)
- return;
- if (hasChildren()) {
- IRegion region= getCoverage(getChildren());
- internalSetOffset(region.getOffset());
- internalSetLength(region.getLength());
- } else {
- internalSetOffset(parentOffset);
- internalSetLength(0);
- }
- fDefined= true;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/RangeMarker.java b/org.eclipse.text/src/org/eclipse/text/edits/RangeMarker.java
deleted file mode 100644
index 248fe2a66f7..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/RangeMarker.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.text.edits;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * A range marker can be used to track positions when executing
- * text edits.
- *
- * @since 3.0
- */
-public final class RangeMarker extends TextEdit {
-
- /**
- * Creates a new range marker for the given offset and length.
- *
- * @param offset the marker's offset
- * @param length the marker's length
- */
- public RangeMarker(int offset, int length) {
- super(offset, length);
- }
-
- /*
- * Copy constructor
- */
- private RangeMarker(RangeMarker other) {
- super(other);
- }
-
- /* non Java-doc
- * @see TextEdit#copy
- */
- protected TextEdit doCopy() {
- return new RangeMarker(this);
- }
-
- /* (non-Javadoc)
- * @see TextEdit#accept0
- */
- protected void accept0(TextEditVisitor visitor) {
- boolean visitChildren = visitor.visit(this);
- if (visitChildren) {
- acceptChildren(visitor);
- }
- }
-
- /* non Java-doc
- * @see TextEdit#performDocumentUpdating
- */
- /* package */ int performDocumentUpdating(IDocument document) throws BadLocationException {
- fDelta= 0;
- return fDelta;
- }
-
- /* non Java-doc
- * @see TextEdit#deleteChildren
- */
- /* package */ boolean deleteChildren() {
- return false;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/ReplaceEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/ReplaceEdit.java
deleted file mode 100644
index b693351b1e4..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/ReplaceEdit.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.text.edits;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * Text edit to replace a range in a document with a different
- * string.
- *
- * @since 3.0
- */
-public final class ReplaceEdit extends TextEdit {
-
- private String fText;
-
- /**
- * Constructs a new replace edit.
- *
- * @param offset the offset of the range to replace
- * @param length the length of the range to replace
- * @param text the new text
- */
- public ReplaceEdit(int offset, int length, String text) {
- super(offset, length);
- Assert.isNotNull(text);
- fText= text;
- }
-
- /*
- * Copy constructor
- *
- * @param other the edit to copy from
- */
- private ReplaceEdit(ReplaceEdit other) {
- super(other);
- fText= other.fText;
- }
-
- /**
- * Returns the new text replacing the text denoted
- * by the edit.
- *
- * @return the edit's text.
- */
- public String getText() {
- return fText;
- }
-
- /* non Java-doc
- * @see TextEdit#doCopy
- */
- protected TextEdit doCopy() {
- return new ReplaceEdit(this);
- }
-
- /* (non-Javadoc)
- * @see TextEdit#accept0
- */
- protected void accept0(TextEditVisitor visitor) {
- boolean visitChildren = visitor.visit(this);
- if (visitChildren) {
- acceptChildren(visitor);
- }
- }
-
- /* non Java-doc
- * @see TextEdit#performDocumentUpdating
- */
- /* package */ int performDocumentUpdating(IDocument document) throws BadLocationException {
- document.replace(getOffset(), getLength(), fText);
- fDelta= fText.length() - getLength();
- return fDelta;
- }
-
- /* non Java-doc
- * @see TextEdit#deleteChildren
- */
- /* package */ boolean deleteChildren() {
- return true;
- }
-
- /* non Java-doc
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return super.toString() + " <<" + fText; //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java
deleted file mode 100644
index 042d60b531c..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java
+++ /dev/null
@@ -1,822 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.text.edits;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-
-/**
- * A text edit describes an elementary text manipulation operation. Edits are
- * executed by applying them to a document (e.g. an instance of <code>IDocument
- * </code>).
- * <p>
- * Text edits form a tree. Clients can navigate the tree upwards, from child to
- * parent, as well as downwards. Newly created edits are unparented. New edits
- * are added to the tree by calling one of the <code>add</code> methods on a parent
- * edit.
- * <p>
- * An edit tree is well formed in the following sense:
- * <ul>
- * <li>a parent edit covers all its children</li>
- * <li>children don't overlap</li>
- * <li>an edit with length 0 can't have any children</li>
- * </ul>
- * Any manipulation of the tree that violates one of the above requirements results
- * in a <code>MalformedTreeException</code>.
- * <p>
- * Insert edits are represented by an edit of length 0. If more than one insert
- * edit exists at the same offset then the edits are executed in the order in which
- * they have been added to a parent. The following code example:
- * <pre>
- * IDocument document= new Document("org");
- * MultiEdit edit= new MultiEdit();
- * edit.add(new InsertEdit(0, "www.");
- * edit.add(new InsertEdit(0, "eclipse.");
- * edit.apply(document);
- * </pre>
- * therefore results in string: "www.eclipse.org".
- *
- * <p>
- * This class isn't intended to be subclassed outside of the edit framework. Clients
- * are only allowed to subclass <code>MultiTextEdit</code>.
- *
- * @see TextBufferEditor
- *
- * @since 3.0
- */
-public abstract class TextEdit {
-
- /**
- * Flags indicating that either <code>CREATE_UNDO</code> nor
- * <code>UPDATE_REGIONS</code> is set.
- */
- public static final int NONE= 0;
-
- /**
- * Flags indicating that applying an edit tree to a document
- * is supposed to create a corresponding undo edit. If not
- * specified <code>null</code> is returned from method <code>
- * apply</code>.
- */
- public static final int CREATE_UNDO= 1 << 0;
-
- /**
- * Flag indicating that the edit's region will be updated to
- * reflect its position in the changed document. If not specified
- * when applying an edit tree to a document the edit's region will
- * be arbitrary. It is even not guaranteed that the tree is still
- * well formed.
- */
- public static final int UPDATE_REGIONS= 1 << 1;
-
- private static class InsertionComparator implements Comparator {
- public int compare(Object o1, Object o2) {
- TextEdit edit1 = (TextEdit) o1;
- TextEdit edit2 = (TextEdit) o2;
-
- int offset1 = edit1.getOffset();
- int length1 = edit1.getLength();
-
- int offset2 = edit2.getOffset();
- int length2 = edit2.getLength();
-
- // make sure that a duplicate insertion point at the same offet is
- // inserted last. Have to double check with the spec. It says the
- // with identical values there is no guarantee which one will be
- // found.
- if (offset1 == offset2 && length1 == 0 && length2 == 0) {
- return -1;
- }
- if (offset1 + length1 - 1 < offset2) {
- return -1;
- }
- if (offset2 + length2 - 1 < offset1) {
- return 1;
- }
- throw new MalformedTreeException(
- null, edit1,
- TextEditMessages.getString("TextEdit.overlapping")); //$NON-NLS-1$
- }
- }
-
- private static final TextEdit[] EMPTY_ARRAY= new TextEdit[0];
- private static final InsertionComparator INSERTION_COMPARATOR= new InsertionComparator();
-
- private static final int DELETED_VALUE= -1;
-
- private int fOffset;
- private int fLength;
-
- /* package */ TextEdit fParent;
- /* package */ List fChildren;
-
- /* package */ int fDelta;
-
- /**
- * Create a new text edit. Parent is initialized to <code>
- * null<code> and the edit doesn't have any children.
- */
- protected TextEdit(int offset, int length) {
- Assert.isTrue(offset >= 0 && length >= 0);
- fOffset= offset;
- fLength= length;
- fDelta= 0;
- }
-
- /**
- * Copy constrcutor
- *
- * @param source the source to copy form
- */
- protected TextEdit(TextEdit source) {
- fOffset= source.fOffset;
- fLength= source.fLength;
- fDelta= 0;
- }
-
- //---- Region management -----------------------------------------------
-
- /**
- * Returns the range that this edit is manipulating. The returned
- * <code>IRegion</code> contains the edit's offset and length at
- * the point in time when this call is made. Any subsequent changes
- * to the edit's offset and length aren't reflected in the returned
- * region object.
- * <p>
- * Creating a region for a deleted edit will result in an assertion
- * failure.
- *
- * @return the manipulated region
- */
- public final IRegion getRegion() {
- return new Region(fOffset, fLength);
- }
-
- /**
- * Returns the offset of the edit. An offset is a 0-based
- * character index. Returns <code>-1</code> if the edit
- * is marked as deleted
- *
- * @return the offset of the edit
- */
- public final int getOffset() {
- return fOffset;
- }
-
- /**
- * Returns the length of the edit. Returns <code>-1</code>
- * if the edit is marked as deleted.
- *
- * @return the length of the edit
- */
- public final int getLength() {
- return fLength;
- }
-
- /**
- * Returns the inclusive end position of this edit. The inclusive end
- * position denotes the last character of the region manipulated by
- * this edit. The returned value is the result of the following
- * calculation:
- * <pre>
- * getOffset() + getLength() - 1;
- * <pre>
- *
- * @return the inclusive end position
- */
- public final int getInclusiveEnd() {
- return fOffset + fLength - 1;
- }
-
- /**
- * Returns the exclusive end position of this edit. The exclusive end
- * position denotes the next character of the region manipulated by
- * this edit. The returned value is the result of the following
- * calculation:
- * <pre>
- * getOffset() + getLength();
- * </pre>
- *
- * @return the exclusive end position
- */
- public final int getExclusiveEnd() {
- return fOffset + fLength;
- }
-
- /**
- * Returns whether this edit has been deleted or not.
- *
- * @return <code>true</code> if the edit has been
- * deleted; otherwise <code>false</code> is returned.
- */
- public final boolean isDeleted() {
- return fOffset == DELETED_VALUE && fLength == DELETED_VALUE;
- }
-
- /**
- * Returns <code>true</code> if the edit covers the given edit
- * <code>other</code>. If the length of the edit is zero <code>
- * false</code> is returned. An insert edit can't cover any other
- * edit, even if the other edit has the same offset and length.
- *
- * @param other the other edit
- * @return <code>true<code> if the edit covers the other edit;
- * otherwise <code>false</code> is returned.
- * @see Regions#covers(IRegion, IRegion)
- */
- public final boolean covers(TextEdit other) {
- if (fLength == 0) { // an insert edit can't cover anything
- return false;
- } else {
- int otherOffset= other.fOffset;
- return fOffset <= otherOffset && otherOffset + other.fLength <= fOffset + fLength;
- }
- }
-
- //---- parent and children management -----------------------------
-
- /**
- * Returns the edit's parent. The method returns <code>null</code>
- * if this edit hasn't been add to another edit.
- *
- * @return the edit's parent
- */
- public final TextEdit getParent() {
- return fParent;
- }
-
- /**
- * Adds the given edit <code>child</code> to this edit.
- *
- * @param child the child edit to add
- * @exception <code>MalformedTreeException<code> is thrown if the child
- * edit can't be added to this edit. This is the case if the child
- * overlaps with one of its siblings or if the child edit's region
- * isn't fully covered by this edit.
- */
- public final void addChild(TextEdit child) throws MalformedTreeException {
- internalAdd(child);
- }
-
- /**
- * Adds all edits in <code>edits</code> to this edit.
- *
- * @param edits the text edits to add
- * @exception <code>MalformedTreeException</code> is thrown if one of
- * the given edits can't be added to this edit.
- *
- * @see #addChild(TextEdit)
- */
- public final void addChildren(TextEdit[] edits) throws MalformedTreeException {
- for (int i= 0; i < edits.length; i++) {
- internalAdd(edits[i]);
- }
- }
-
- /**
- * Removes the edit specified by the given index from the list
- * of children. Returns the child edit that was removed from
- * the list of children. The parent of the returned edit is
- * set to <code>null</code>.
- *
- * @param index the index of the edit to remove
- * @return the removed edit
- * @exception <code>IndexOutOfBoundsException</code> if the index
- * is out of range
- */
- public final TextEdit removeChild(int index) {
- if (fChildren == null)
- throw new IndexOutOfBoundsException("Index: " + index + " Size: 0"); //$NON-NLS-1$//$NON-NLS-2$
- TextEdit result= (TextEdit)fChildren.remove(index);
- result.internalSetParent(null);
- if (fChildren.isEmpty())
- fChildren= null;
- return result;
- }
-
- /**
- * Removes the first occurrence of the given child from the list
- * of children.
- *
- * @param child the child to be removed
- * @return <code>true</code> if the edit contained the given
- * child; otherwise <code>false</code> is returned
- */
- public final boolean removeChild(TextEdit child) {
- Assert.isNotNull(child);
- if (fChildren == null)
- return false;
- boolean result= fChildren.remove(child);
- if (result) {
- child.internalSetParent(null);
- if (fChildren.isEmpty())
- fChildren= null;
- }
- return result;
- }
-
- /**
- * Removes all child edits from and returns them. The parent
- * of the removed edits is set to <code>null</code>.
- *
- * @return an array of the removed edits
- */
- public final TextEdit[] removeChildren() {
- if (fChildren == null)
- return EMPTY_ARRAY;
- int size= fChildren.size();
- TextEdit[] result= new TextEdit[size];
- for (int i= 0; i < size; i++) {
- result[i]= (TextEdit)fChildren.get(i);
- result[i].internalSetParent(null);
- }
- fChildren= null;
- return result;
- }
-
- /**
- * Returns <code>true</code> if this edit has children. Otherwise
- * <code>false</code> is returned.
- *
- * @return <code>true</code> if this edit has children; otherwise
- * <code>false</code> is returned
- */
- public final boolean hasChildren() {
- return fChildren != null && ! fChildren.isEmpty();
- }
-
- /**
- * Returns the edit's children. If the edit doesn't have any
- * children an empty array is returned.
- *
- * @return the edit's children
- */
- public final TextEdit[] getChildren() {
- if (fChildren == null)
- return EMPTY_ARRAY;
- return (TextEdit[])fChildren.toArray(new TextEdit[fChildren.size()]);
- }
-
- /**
- * Returns the size of the managed children.
- *
- * @return the size of the children
- */
- public final int getChildrenSize() {
- if (fChildren == null)
- return 0;
- return fChildren.size();
- }
-
- /**
- * Returns the text range spawned by the given array of text edits.
- * The method requires that the given array contains at least one
- * edit. If all edits passed are deleted the method returns <code>
- * null</code>.
- *
- * @param edits an array of edits
- * @return the text range spawned by the given array of edits or
- * <code>null</code> if all edits are marked as deleted
- */
- public static IRegion getCoverage(TextEdit[] edits) {
- Assert.isTrue(edits != null && edits.length > 0);
-
- int offset= Integer.MAX_VALUE;
- int end= Integer.MIN_VALUE;
- int deleted= 0;
- for (int i= 0; i < edits.length; i++) {
- TextEdit edit= edits[i];
- if (edit.isDeleted()) {
- deleted++;
- } else {
- offset= Math.min(offset, edit.getOffset());
- end= Math.max(end, edit.getExclusiveEnd());
- }
- }
- if (edits.length == deleted) {
- return null;
- } else {
- return new Region(offset, end - offset);
- }
- }
-
- /*
- * Hook called before this edit gets added to the passed
- * parent.
- */
- /* package */ void aboutToBeAdded(TextEdit parent) {
- }
-
- //---- Object methods ------------------------------------------------------
-
- /**
- * The <code>Edit</code> implementation of this <code>Object</code>
- * method uses object identity (==).
- *
- * @param obj the other object
- * @return <code>true</code> iff <code>this == obj</code>; otherwise
- * <code>false</code> is returned
- *
- * @see Object#equals(java.lang.Object)
- */
- public final boolean equals(Object obj) {
- return this == obj; // equivalent to Object.equals
- }
-
- /**
- * The <code>Edit</code> implementation of this <code>Object</code>
- * method calls uses <code>Object#hashCode()</code> to compute its
- * hash code.
- *
- * @return the object's hash code value
- *
- * @see Object#hashCode()
- */
- public final int hashCode() {
- return super.hashCode();
- }
-
- /* non Java-doc
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer buffer= new StringBuffer("{"); //$NON-NLS-1$
- String name= getClass().getName();
- int index= name.lastIndexOf('.');
- if (index != -1) {
- buffer.append(name.substring(index + 1));
- } else {
- buffer.append(name);
- }
- buffer.append(" } "); //$NON-NLS-1$
- if (isDeleted()) {
- buffer.append("[deleted]"); //$NON-NLS-1$
- } else {
- buffer.append("["); //$NON-NLS-1$
- buffer.append(fOffset);
- buffer.append(","); //$NON-NLS-1$
- buffer.append(fLength);
- buffer.append("]"); //$NON-NLS-1$
- }
- return buffer.toString();
- }
-
- //---- Copying -------------------------------------------------------------
-
- /**
- * Creates a deep copy of the edit tree rooted at this
- * edit.
- *
- * @return a deep copy of the edit tree
- * @see #doCopy()
- */
- public final TextEdit copy() {
- TextEditCopier copier= new TextEditCopier(this);
- return copier.perform();
- }
-
- /**
- * Creates and returns a copy of this edit. The copy method should be
- * implemented in a way so that the copy can executed without causing
- * any harm to the original edit. Implementors of this method are
- * responsible for creating deep or shallow copies of referenced
- * object to fullfil this requirement.
- * <p>
- * Implementers of this method should use the copy constructor <code>
- * Edit#Edit(Edit source) to initialize the edit part of the copy.
- * Implementors aren't responsible to actually copy the children or
- * to set the right parent.
- * <p>
- * This method <b>should not be called</b> from outside the framework.
- * Please use <code>copy</code> to create a copy of a edit tree.
- *
- * @return a copy of this edit.
- * @see #copy()
- * @see #postProcessCopy(TextEditCopier)
- * @see TextEditCopier
- */
- protected abstract TextEdit doCopy();
-
- /**
- * This method is called on every edit of the copied tree to do some
- * postprocessing like connected an edit to a different edit in the tree.
- * <p>
- * This default implementation does nothing
- *
- * @param copier the copier that manages a map between original and
- * copied edit.
- * @see TextEditCopier
- */
- protected void postProcessCopy(TextEditCopier copier) {
- }
-
- //---- Visitor support -------------------------------------------------
-
- /**
- * Accepts the given visitor on a visit of the current edit.
- *
- * @param visitor the visitor object
- * @exception IllegalArgumentException if the visitor is null
- */
- public final void accept(TextEditVisitor visitor) {
- Assert.isNotNull(visitor);
- // begin with the generic pre-visit
- visitor.preVisit(this);
- // dynamic dispatch to internal method for type-specific visit/endVisit
- accept0(visitor);
- // end with the generic post-visit
- visitor.postVisit(this);
- }
-
- /**
- * Accepts the given visitor on a type-specific visit of the current edit.
- * This method must be implemented in all concrete text edits.
- * <p>
- * General template for implementation on each concrete TextEdit class:
- * <pre>
- * <code>
- * boolean visitChildren = visitor.visit(this);
- * if (visitChildren) {
- * acceptChildren(visitor);
- * }
- * </code>
- * </pre>
- * Note that the caller (<code>accept</code>) takes care of invoking
- * <code>visitor.preVisit(this)</code> and <code>visitor.postVisit(this)</code>.
- * </p>
- *
- * @param visitor the visitor object
- */
- protected abstract void accept0(TextEditVisitor visitor);
-
-
- /**
- * Accepts the given visitor on the edits children.
- * <p>
- * This method must be used by the concrete implementations of
- * <code>accept</code> to traverse list-values properties; it
- * encapsulates the proper handling of on-the-fly changes to the list.
- * </p>
- *
- * @param visitor the visitor object
- */
- protected final void acceptChildren(TextEditVisitor visitor) {
- if (fChildren == null)
- return;
- Iterator iterator= fChildren.iterator();
- while (iterator.hasNext()) {
- TextEdit curr= (TextEdit) iterator.next();
- curr.accept(visitor);
- }
- }
-
- //---- Execution -------------------------------------------------------
-
- /**
- * Applies the edit tree rooted by this edit to the given document. To check
- * if the edit tree can be applied to the document either catch <code>
- * MalformedTreeException</code> or use <code>TextEditProcessor</code> to
- * execute an edit tree.
- *
- * @param document the document to be manipulated
- * @param style flags controlling the execution of the edit tree. Valid
- * flags are: <code>CREATE_UNDO</code> and </code>UPDATE_REGIONS</code>.
- * @return a undo edit, if <code>CREATE_UNDO</code> is specified. Otherwise
- * <code>null</code> is returned.
- *
- * @exception MalformedTreeException is thrown if the tree isn't
- * in a valid state. This exception is thrown before any edit
- * is executed. So the document is still in its original state.
- * @exception BadLocationException is thrown if one of the edits
- * in the tree can't be executed. The state of the document is
- * undefined if this exception is thrown.
- *
- * @see #checkIntegrity()
- * @see #perform(IDocument)
- * @see TextEditProcessor#performEdits()
- */
- public final UndoEdit apply(IDocument document, int style) throws MalformedTreeException, BadLocationException {
- try {
- TextEditProcessor processor= new TextEditProcessor(document, this, style);
- return processor.performEdits();
- } finally {
- // unconnect from text edit processor
- fParent= null;
- }
- }
-
- /**
- * Applies the edit tree rooted by this edit to the given document. This
- * method is a convinence method for <code>apply(document, CREATE_UNDO | UPDATE_REGIONS)
- * </code>
- *
- * @see #apply(IDocument, int)
- */
- public final UndoEdit apply(IDocument document) throws MalformedTreeException, BadLocationException {
- return apply(document, CREATE_UNDO | UPDATE_REGIONS);
- }
-
- /* package */ UndoEdit dispatchPerformEdits(TextEditProcessor processor) throws BadLocationException {
- return processor.executeDo();
- }
-
- /* package */ void dispatchCheckIntegrity(TextEditProcessor processor) throws MalformedTreeException {
- processor.checkIntegrityDo();
- }
-
- //---- internal state accessors ----------------------------------------------------------
-
- /* package */ void internalSetParent(TextEdit parent) {
- if (parent != null)
- Assert.isTrue(fParent == null);
- fParent= parent;
- }
-
- /* package */ void internalSetOffset(int offset) {
- Assert.isTrue(offset >= 0);
- fOffset= offset;
- }
-
- /* package */ void internalSetLength(int length) {
- Assert.isTrue(length >= 0);
- fLength= length;
- }
-
- /* package */ List internalGetChildren() {
- return fChildren;
- }
-
- /* package */ void internalSetChildren(List children) {
- fChildren= children;
- }
-
- /* package */ void internalAdd(TextEdit child) throws MalformedTreeException {
- child.aboutToBeAdded(this);
- if (child.isDeleted())
- throw new MalformedTreeException(this, child, TextEditMessages.getString("TextEdit.deleted_edit")); //$NON-NLS-1$
- if (!covers(child))
- throw new MalformedTreeException(this, child, TextEditMessages.getString("TextEdit.range_outside")); //$NON-NLS-1$
- if (fChildren == null) {
- fChildren= new ArrayList(2);
- }
- int index= computeInsertionIndex(child);
- fChildren.add(index, child);
- child.internalSetParent(this);
- }
-
- private int computeInsertionIndex(TextEdit edit) {
- int size= fChildren.size();
- if (size == 0)
- return 0;
- TextEdit last= (TextEdit)fChildren.get(size - 1);
- if (last.getExclusiveEnd() <= edit.getOffset())
- return size;
- try {
- return -Collections.binarySearch(fChildren, edit,INSERTION_COMPARATOR) -1;
- } catch(MalformedTreeException e) {
- e.setParent(this);
- throw e;
- }
- }
-
- //---- Offset & Length updating -------------------------------------------------
-
- /**
- * Adjusts the edits offset according to the given
- * delta. This method doesn't update any children.
- *
- * @param delta the delta of the text replace operation
- */
- /* package */ void adjustOffset(int delta) {
- if (isDeleted())
- return;
- fOffset+= delta;
- Assert.isTrue(fOffset >= 0);
- }
-
- /**
- * Adjusts the edits length according to the given
- * delta. This method doesn't update any children.
- *
- * @param delta the delta of the text replace operation
- */
- /* package */ void adjustLength(int delta) {
- if (isDeleted())
- return;
- fLength+= delta;
- Assert.isTrue(fLength >= 0);
- }
-
- /**
- * Marks the edit as deleted. This method doesn't update
- * any children.
- */
- /* package */ void markAsDeleted() {
- fOffset= DELETED_VALUE;
- fLength= DELETED_VALUE;
- }
-
- //---- Edit processing ----------------------------------------------
-
- /* package */ int traverseConsistencyCheck(TextEditProcessor processor, IDocument document, List sourceEdits) {
- int result= 0;
- if (fChildren != null) {
- for (int i= fChildren.size() - 1; i >= 0; i--) {
- TextEdit child= (TextEdit)fChildren.get(i);
- result= Math.max(result, child.traverseConsistencyCheck(processor, document, sourceEdits));
- }
- }
- if (processor.considerEdit(this)) {
- performConsistencyCheck(processor, document);
- }
- return result;
- }
-
- /* package */ void performConsistencyCheck(TextEditProcessor processor, IDocument document) {
- }
-
- /* package */ void traverseSourceComputation(TextEditProcessor processor, IDocument document) {
- }
-
- /* package */ void performSourceComputation(TextEditProcessor processor, IDocument document) {
- }
-
- /* package */ int traverseDocumentUpdating(TextEditProcessor processor, IDocument document) throws BadLocationException {
- int delta= 0;
- if (fChildren != null) {
- for (int i= fChildren.size() - 1; i >= 0; i--) {
- TextEdit child= (TextEdit)fChildren.get(i);
- delta+= child.traverseDocumentUpdating(processor, document);
- }
- }
- if (processor.considerEdit(this)) {
- if (delta != 0)
- adjustLength(delta);
- int r= performDocumentUpdating(document);
- if (r != 0)
- adjustLength(r);
- delta+= r;
- }
- return delta;
- }
-
- /* package */ abstract int performDocumentUpdating(IDocument document) throws BadLocationException;
-
- /* package */ int traverseRegionUpdating(TextEditProcessor processor, IDocument document, int accumulatedDelta, boolean delete) {
- performRegionUpdating(accumulatedDelta, delete);
- if (fChildren != null) {
- boolean childDelete= delete || deleteChildren();
- for (Iterator iter= fChildren.iterator(); iter.hasNext();) {
- TextEdit child= (TextEdit)iter.next();
- accumulatedDelta= child.traverseRegionUpdating(processor, document, accumulatedDelta, childDelete);
- }
- }
- return accumulatedDelta + fDelta;
- }
-
- /* package */ void performRegionUpdating(int accumulatedDelta, boolean delete) {
- if (delete)
- markAsDeleted();
- else
- adjustOffset(accumulatedDelta);
- }
-
- /* package */ abstract boolean deleteChildren();
-
- /* package */ void moveTree(int delta) {
- adjustOffset(delta);
- if (fChildren != null) {
- for (Iterator iter= fChildren.iterator(); iter.hasNext();) {
- ((TextEdit)iter.next()).moveTree(delta);
- }
- }
- }
-
- /* package */ void deleteTree() {
- markAsDeleted();
- if (fChildren != null) {
- for (Iterator iter= fChildren.iterator(); iter.hasNext();) {
- TextEdit child= (TextEdit)iter.next();
- child.deleteTree();
- }
- }
- }
-}
-
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/TextEditCopier.java b/org.eclipse.text/src/org/eclipse/text/edits/TextEditCopier.java
deleted file mode 100644
index af542e40d6e..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/TextEditCopier.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.text.edits;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.text.Assert;
-
-/**
- * Copies a tree of text edits. A text edit copier keeps a map
- * between original and new text edits. It can be used to map
- * a copy back to its original edit.
- *
- * @since 3.0
- */
-public final class TextEditCopier {
-
- private TextEdit fEdit;
- private Map fCopies;
-
- /**
- * Constructs a new <code>TextEditCopier</code> for the
- * given edit. The actual copy is done by calling <code>
- * perform</code>.
- *
- * @param edit the edit to copy
- *
- * @see #perform()
- */
- public TextEditCopier(TextEdit edit) {
- super();
- Assert.isNotNull(edit);
- fEdit= edit;
- fCopies= new HashMap();
- }
-
- /**
- * Performs the actual copying.
- *
- * @return the copy
- */
- public TextEdit perform() {
- TextEdit result= doCopy(fEdit);
- if (result != null) {
- for (Iterator iter= fCopies.keySet().iterator(); iter.hasNext();) {
- TextEdit edit= (TextEdit)iter.next();
- edit.postProcessCopy(this);
- }
- }
- return result;
- }
-
- /**
- * Returns the copy for the original text edit.
- *
- * @param original the original for which the copy
- * is requested
- * @return the copy of the original edit or <code>null</code>
- * if the original isn't managed by this copier
- */
- public TextEdit getCopy(TextEdit original) {
- Assert.isNotNull(original);
- return (TextEdit)fCopies.get(original);
- }
-
- //---- helper methods --------------------------------------------
-
- private TextEdit doCopy(TextEdit edit) {
- TextEdit result= edit.doCopy();
- List children= edit.internalGetChildren();
- if (children != null) {
- List newChildren= new ArrayList(children.size());
- for (Iterator iter= children.iterator(); iter.hasNext();) {
- TextEdit childCopy= doCopy((TextEdit)iter.next());
- childCopy.internalSetParent(result);
- newChildren.add(childCopy);
- }
- result.internalSetChildren(newChildren);
- }
- addCopy(edit, result);
- return result;
- }
-
- private void addCopy(TextEdit original, TextEdit copy) {
- fCopies.put(original, copy);
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/TextEditMessages.java b/org.eclipse.text/src/org/eclipse/text/edits/TextEditMessages.java
deleted file mode 100644
index 1b9c1f720ad..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/TextEditMessages.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.text.edits;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/* package */ class TextEditMessages {
-
- private static final String BUNDLE_NAME= "org.eclipse.text.edits.Messages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME);
-
- private TextEditMessages() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-
- public static String getFormattedString(String key, Object arg) {
- return getFormattedString(key, new Object[] { arg });
- }
-
- public static String getFormattedString(String key, Object[] args) {
- return MessageFormat.format(getString(key), args);
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/TextEditProcessor.java b/org.eclipse.text/src/org/eclipse/text/edits/TextEditProcessor.java
deleted file mode 100644
index 47b7678590c..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/TextEditProcessor.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.text.edits;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * A <code>TextEditProcessor</code> manages a set of edits and applies
- * them as a whole to an <code>IDocument</code>.
- * <p>
- * This class isn't intended to be subclassed.
- *
- * @see org.eclipse.text.edits.TextEdit#apply(IDocument)
- *
- * @since 3.0
- */
-public class TextEditProcessor {
-
- private IDocument fDocument;
- private TextEdit fRoot;
- private int fStyle;
-
- private boolean fChecked;
- private MalformedTreeException fException;
-
- private List fSourceEdits;
-
- /**
- * Constructs a new edit processor for the given
- * document.
- *
- * @param document the document to manipulate
- * @param root the root of the text edit tree describing
- * the modifications. By passing a text edit a a text edit
- * processor the ownership of the edit is transfered to the
- * text edit processors. Clients must not modify the edit
- * (e.g adding new children) any longer.
- */
- public TextEditProcessor(IDocument document, TextEdit root, int style) {
- Assert.isNotNull(document);
- Assert.isNotNull(root);
- fDocument= document;
- fRoot= root;
- if (fRoot instanceof MultiTextEdit)
- ((MultiTextEdit)fRoot).defineRegion(0);
- fStyle= style;
- }
-
- /**
- * Returns the document to be manipulated.
- *
- * @return the document
- */
- public IDocument getDocument() {
- return fDocument;
- }
-
- /**
- * Returns the edit processor's root edit.
- *
- * @return the processor's root edit
- */
- public TextEdit getRoot() {
- return fRoot;
- }
-
- /**
- * Returns the style bits of the text edit processor
- *
- * @return the style bits
- * @see TextEdit#CREATE_UNDO
- * @see TextEdit#UPDATE_POSITIONS
- */
- public int getStyle() {
- return fStyle;
- }
-
- /**
- * Checks if the processor can execute all its edits.
- *
- * @return <code>true</code> if the edits can be executed. Return <code>false
- * </code>otherwise. One major reason why edits cannot be executed are wrong
- * offset or length values of edits. Calling perform in this case will very
- * likely end in a <code>BadLocationException</code>.
- */
- public boolean canPerformEdits() {
- try {
- fRoot.dispatchCheckIntegrity(this);
- fChecked= true;
- } catch (MalformedTreeException e) {
- fException= e;
- return false;
- }
- return true;
- }
-
- /**
- * Executes the text edits.
- *
- * @return an object representing the undo of the executed edits
- * @exception MalformedTreeException is thrown if the edit tree isn't
- * in a valid state. This exception is thrown before any edit is executed.
- * So the document is still in its original state.
- * @exception BadLocationException is thrown if one of the edits in the
- * tree can't be executed. The state of the document is undefined if this
- * exception is thrown.
- */
- public UndoEdit performEdits() throws MalformedTreeException, BadLocationException {
- if (!fChecked) {
- fRoot.dispatchCheckIntegrity(this);
- } else {
- if (fException != null)
- throw fException;
- }
- return fRoot.dispatchPerformEdits(this);
- }
-
- /* non Java-doc
- * Class isn't intended to be sublcassed
- */
- protected boolean considerEdit(TextEdit edit) {
- return true;
- }
-
- //---- checking --------------------------------------------------------------------
-
- /* package */ void checkIntegrityDo() throws MalformedTreeException {
- fSourceEdits= new ArrayList();
- fRoot.traverseConsistencyCheck(this, fDocument, fSourceEdits);
- if (fRoot.getExclusiveEnd() > fDocument.getLength())
- throw new MalformedTreeException(null, fRoot, TextEditMessages.getString("TextEditProcessor.invalid_length")); //$NON-NLS-1$
- }
-
- /* package */ void checkIntegrityUndo() {
- if (fRoot.getExclusiveEnd() > fDocument.getLength())
- throw new MalformedTreeException(null, fRoot, TextEditMessages.getString("TextEditProcessor.invalid_length")); //$NON-NLS-1$
- }
-
- //---- execution --------------------------------------------------------------------
-
- /* package */ UndoEdit executeDo() throws BadLocationException {
- UndoCollector collector= new UndoCollector(fRoot);
- try {
- if (createUndo())
- collector.connect(fDocument);
- computeSources();
- fRoot.traverseDocumentUpdating(this, fDocument);
- if (updateRegions()) {
- fRoot.traverseRegionUpdating(this, fDocument, 0, false);
- }
- } finally {
- collector.disconnect(fDocument);
- }
- return collector.undo;
- }
-
- private void computeSources() {
- for (Iterator iter= fSourceEdits.iterator(); iter.hasNext();) {
- List list= (List)iter.next();
- if (list != null) {
- for (Iterator edits= list.iterator(); edits.hasNext();) {
- TextEdit edit= (TextEdit)edits.next();
- edit.traverseSourceComputation(this, fDocument);
- }
- }
- }
- }
-
- /* package */ UndoEdit executeUndo() throws BadLocationException {
- UndoCollector collector= new UndoCollector(fRoot);
- try {
- if (createUndo())
- collector.connect(fDocument);
- TextEdit[] edits= fRoot.getChildren();
- for (int i= edits.length - 1; i >= 0; i--) {
- edits[i].performDocumentUpdating(fDocument);
- }
- } finally {
- collector.disconnect(fDocument);
- }
- return collector.undo;
- }
-
- private boolean createUndo() {
- return (fStyle & TextEdit.CREATE_UNDO) != 0;
- }
-
- private boolean updateRegions() {
- return (fStyle & TextEdit.UPDATE_REGIONS) != 0;
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/TextEditVisitor.java b/org.eclipse.text/src/org/eclipse/text/edits/TextEditVisitor.java
deleted file mode 100644
index 3146561eafa..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/TextEditVisitor.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.text.edits;
-
-/**
- * A visitor for text edits.
- * <p>
- * For each different concrete text edit type <it>T</it> there is a method:
- * <ul>
- * <li><code>public boolean visit(<it>T</it> node)</code> - Visits the given edit to
- * perform some arbitrary operation. If <code>true </code> is returned, the given edit's
- * child edits will be visited next; however, if <code>false</code> is returned, the
- * given edit's child edits will not be visited. The default implementation provided by
- * this class calls a generic method <code>visitNode(<it>Testedit</it> node)</code>.
- * Subclasses may reimplement these method as needed.</li>
- * </ul>
- * </p>
- * <p>
- * In addition, there are methods for visiting text edits in the
- * abstract, regardless of node type:
- * <ul>
- * <li><code>public void preVisit(TextEdit edit)</code> - Visits
- * the given edit to perform some arbitrary operation.
- * This method is invoked prior to the appropriate type-specific
- * <code>visit</code> method.
- * The default implementation of this method does nothing.
- * Subclasses may reimplement this method as needed.</li>
- *
- * <li><code>public void postVisit(TextEdit edit)</code> - Visits
- * the given edit to perform some arbitrary operation.
- * This method is invoked after the appropriate type-specific
- * <code>endVisit</code> method.
- * The default implementation of this method does nothing.
- * Subclasses may reimplement this method as needed.</li>
- * </ul>
- * </p>
- * <p>
- * For edits with chldren, the child nodes are visited in increasing order.
- * </p>
- *
- * @see TextEdit#accept
- * @since 3.0
- */
-public class TextEditVisitor {
-
- /**
- * Visits the given text edit prior to the type-specific visit.
- * (before <code>visit</code>).
- * <p>
- * The default implementation does nothing. Subclasses may reimplement.
- * </p>
- *
- * @param node the node to visit
- */
- public void preVisit(TextEdit edit) {
- // default implementation: do nothing
- }
-
- /**
- * Visits the given text edit following the type-specific visit
- * (after <code>endVisit</code>).
- * <p>
- * The default implementation does nothing. Subclasses may reimplement.
- * </p>
- *
- * @param node the node to visit
- */
- public void postVisit(TextEdit edit) {
- // default implementation: do nothing
- }
-
- /**
- * Visits the given text edit. This method is called by default from
- * type-specific visits. It is not called by a edit's accept method.
- * The default implementation returns <code>true</code>.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visitNode(TextEdit edit) {
- return true;
- }
-
- /**
- * Visists a <code>CopySourceEdit</code> instance.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visit(CopySourceEdit edit) {
- return visitNode(edit);
- }
-
- /**
- * Visists a <code>CopyTargetEdit</code> instance.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visit(CopyTargetEdit edit) {
- return visitNode(edit);
- }
-
- /**
- * Visists a <code>MoveSourceEdit</code> instance.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visit(MoveSourceEdit edit) {
- return visitNode(edit);
- }
-
- /**
- * Visists a <code>MoveTargetEdit</code> instance.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visit(MoveTargetEdit edit) {
- return visitNode(edit);
- }
-
- /**
- * Visists a <code>RangeMarker</code> instance.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visit(RangeMarker edit) {
- return visitNode(edit);
- }
-
- /**
- * Visists a <code>CopyingRangeMarker</code> instance.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visit(CopyingRangeMarker edit) {
- return visitNode(edit);
- }
-
- /**
- * Visists a <code>DeleteEdit</code> instance.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visit(DeleteEdit edit) {
- return visitNode(edit);
- }
-
- /**
- * Visists a <code>InsertEdit</code> instance.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visit(InsertEdit edit) {
- return visitNode(edit);
- }
-
- /**
- * Visists a <code>ReplaceEdit</code> instance.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visit(ReplaceEdit edit) {
- return visitNode(edit);
- }
-
- /**
- * Visists a <code>UndoEdit</code> instance.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visit(UndoEdit edit) {
- return visitNode(edit);
- }
-
- /**
- * Visists a <code>MultiTextEdit</code> instance.
- *
- * @return If <code>true</code> is returned, the given node's child
- * nodes will be visited next; however, if <code>false</code> is
- * returned, the given node's child nodes will not be visited.
- */
- public boolean visit(MultiTextEdit edit) {
- return visitNode(edit);
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/TreeIterationInfo.java b/org.eclipse.text/src/org/eclipse/text/edits/TreeIterationInfo.java
deleted file mode 100644
index 2cf0873da39..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/TreeIterationInfo.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.text.edits;
-
-import org.eclipse.jface.text.Assert;
-
-
-/* package */ class TreeIterationInfo {
-
- public static interface Visitor {
- public void visit(TextEdit edit);
- }
-
- private int fMark= -1;
- private TextEdit[][] fEditStack= new TextEdit[10][];
- private int[] fIndexStack= new int[10];
-
- public int getSize() {
- return fMark + 1;
- }
- public void push(TextEdit[] edits) {
- if (++fMark == fEditStack.length) {
- TextEdit[][] t1= new TextEdit[fEditStack.length * 2][];
- System.arraycopy(fEditStack, 0, t1, 0, fEditStack.length);
- fEditStack= t1;
- int[] t2= new int[fEditStack.length];
- System.arraycopy(fIndexStack, 0, t2, 0, fIndexStack.length);
- fIndexStack= t2;
- }
- fEditStack[fMark]= edits;
- fIndexStack[fMark]= -1;
- }
- public void setIndex(int index) {
- fIndexStack[fMark]= index;
- }
- public void pop() {
- fEditStack[fMark]= null;
- fIndexStack[fMark]= -1;
- fMark--;
- }
- public void accept(Visitor visitor) {
- for (int i= fMark; i >= 0; i--) {
- Assert.isTrue(fIndexStack[i] >= 0);
- int start= fIndexStack[i] + 1;
- TextEdit[] edits= fEditStack[i];
- for (int s= start; s < edits.length; s++) {
- visitor.visit(edits[s]);
- }
- }
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/UndoCollector.java b/org.eclipse.text/src/org/eclipse/text/edits/UndoCollector.java
deleted file mode 100644
index dd4b58fa4eb..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/UndoCollector.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.text.edits;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-
-
-/* package */ class UndoCollector implements IDocumentListener {
-
- protected UndoEdit undo;
- private int fOffset;
- private int fLength;
-
- public UndoCollector(TextEdit root) {
- fOffset= root.getOffset();
- fLength= root.getLength();
- }
-
- public void connect(IDocument document) {
- document.addDocumentListener(this);
- undo= new UndoEdit();
- }
-
- public void disconnect(IDocument document) {
- if (undo != null) {
- document.removeDocumentListener(this);
- undo.defineRegion(fOffset, fLength);
- }
- }
-
- public void documentChanged(DocumentEvent event) {
- fLength+= getDelta(event);
- }
-
- private static int getDelta(DocumentEvent event) {
- String text= event.getText();
- return (text == null ? -event.getLength() : text.length()) - event.getLength();
- }
-
- public void documentAboutToBeChanged(DocumentEvent event) {
- int offset= event.getOffset();
- int currentLength= event.getLength();
- String currentText= null;
- try {
- currentText= event.getDocument().get(offset, currentLength);
- } catch (BadLocationException cannotHappen) {
- Assert.isTrue(false, "Can't happen"); //$NON-NLS-1$
- }
-
- undo.add(new ReplaceEdit(offset, event.getText().length(), currentText));
- }
-}
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/UndoEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/UndoEdit.java
deleted file mode 100644
index 584f6105ca9..00000000000
--- a/org.eclipse.text/src/org/eclipse/text/edits/UndoEdit.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.text.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * This class encapsulates the reverse changes of an executed text
- * edit tree. To apply an undo memento to a document use method
- * <code>apply(IDocument)</code>.
- * <p>
- * Clients can add additional children to an undo edit nor can they
- * add an undo edit as a child to another edit. Doing so results in
- * both cases in a <code>MalformedTreeException<code>.
- *
- * @since 3.0
- */
-public final class UndoEdit extends TextEdit {
-
- /* package */ UndoEdit() {
- super(0, Integer.MAX_VALUE);
- }
-
- private UndoEdit(UndoEdit other) {
- super(other);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.text.edits.TextEdit#internalAdd(org.eclipse.text.edits.TextEdit)
- */
- /* package */ void internalAdd(TextEdit child) throws MalformedTreeException {
- throw new MalformedTreeException(null, this, TextEditMessages.getString("UndoEdit.no_children")); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.text.edits.MultiTextEdit#aboutToBeAdded(org.eclipse.text.edits.TextEdit)
- */
- /* package */ void aboutToBeAdded(TextEdit parent) {
- throw new MalformedTreeException(parent, this, TextEditMessages.getString("UndoEdit.can_not_be_added")); //$NON-NLS-1$
- }
-
- /* package */ UndoEdit dispatchPerformEdits(TextEditProcessor processor) throws BadLocationException {
- return processor.executeUndo();
- }
-
- /* package */ void dispatchCheckIntegrity(TextEditProcessor processor) throws MalformedTreeException {
- processor.checkIntegrityUndo();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.text.edits.TextEdit#doCopy()
- */
- protected TextEdit doCopy() {
- return new UndoEdit(this);
- }
-
- /* (non-Javadoc)
- * @see TextEdit#accept0
- */
- protected void accept0(TextEditVisitor visitor) {
- boolean visitChildren = visitor.visit(this);
- if (visitChildren) {
- acceptChildren(visitor);
- }
- }
-
- /* (non-Javadoc)
- * @see TextEdit#performDocumentUpdating
- */
- /* package */ int performDocumentUpdating(IDocument document) throws BadLocationException {
- fDelta= 0;
- return fDelta;
- }
-
- /* package */ void add(ReplaceEdit edit) {
- List children= internalGetChildren();
- if (children == null) {
- children= new ArrayList(2);
- internalSetChildren(children);
- }
- children.add(edit);
- }
-
- /* package */ void defineRegion(int offset, int length) {
- internalSetOffset(offset);
- internalSetLength(length);
- }
-
- /* package */ boolean deleteChildren() {
- return false;
- }
-}
-
diff --git a/org.eclipse.ui.editors/.classpath b/org.eclipse.ui.editors/.classpath
deleted file mode 100644
index 065ac06e197..00000000000
--- a/org.eclipse.ui.editors/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.ui.editors/.cvsignore b/org.eclipse.ui.editors/.cvsignore
deleted file mode 100644
index c5e82d74585..00000000000
--- a/org.eclipse.ui.editors/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/org.eclipse.ui.editors/.project b/org.eclipse.ui.editors/.project
deleted file mode 100644
index 6c81c4813c3..00000000000
--- a/org.eclipse.ui.editors/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.editors</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.filebuffers</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.jface.text</project>
- <project>org.eclipse.ui</project>
- <project>org.eclipse.ui.ide</project>
- <project>org.eclipse.ui.workbench.texteditor</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.ui.editors/_buildnotes_text_2_0.html b/org.eclipse.ui.editors/_buildnotes_text_2_0.html
deleted file mode 100644
index f20e3346528..00000000000
--- a/org.eclipse.ui.editors/_buildnotes_text_2_0.html
+++ /dev/null
@@ -1,971 +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="Microsoft FrontPage 4.0">
- <meta name="Author" content="IBM">
- <title>Eclipse Platform Release Notes - Desktop</title>
-</head>
-<body>
-
-<h1>
-Eclipse Platform Build Notes</h1>
-
-<h1>
-Text Editor Support (including JFace Text)</h1>
-
-<p><br>Eclipse SDK Build 20020601
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-Introduced the concept of setRedraw(boolean) on text viewers. See ITextViewerExtension.setRedraw(boolean).
-This allows to avoid any UI updating while manipulating the viewer's document.
-While redraw == false, the viewer selection is still available, i.e. setSelectedRange
-and getSelectedRange can be used and always refer to the actual state of
-the viewer's document. However, no selection change event and no view port
-changes are sent out. TextEvent (See ITextListener) has been extented to
-carry the viewer's redraw flag.</li>
-
-<li>
-Introduced the concept of&nbsp; a "sequential rewrite mode" on documents.
-See IDocumentExtension. This informs a document about an upcoming sequence
-of non-overlapping consecutive replace commands. If capable the document
-can use this information to operate on an optimized text store. In JFace
-Text, Document operates on a SequentialRewriteTextStore during this period.</li>
-
-<li>
-Reworked text shifting, line delimiter conversion, and find/replace to
-use the newly introduced concepts.</li>
-
-<li>
-Reworked the reactivation behavior of text hovers.</li>
-
-<li>
-Pushed text hover information computation in a background thread.</li>
-
-<li>
-Reactivated and extended the concept of widget token management. See IWidgetTokenOwner,
-IWidgetTokenKeeper.</li>
-
-<li>
-Extended text operations so that they can externally be enabled/disabled.
-See ITextOperationTargetExtension. Currently, this is only used for content
-assist in the source viewer. All other text operations ignore the enable
-flag.</li>
-
-<li>
-Improved incremental search behavior.</li>
-
-<li>
-Further code cleanup.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-See bugzilla.
-<p>
-<hr WIDTH="100%">
-<br>Eclipse SDK Build 20020517
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-The ruler context menu action are initialized correctly when invoked over
-keyboard shortcut. (Ctrl+W)</li>
-
-<li>
-Added delete line actions ([Esc 0] Ctrl+K with emacs key bindings) to text
-editor</li>
-
-<li>
-Added support for setting/clearing/swapping a mark (emacs style selection)</li>
-
-<li>
-Code Cleanup</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-See bugzilla.
-<p>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20020514
-<h2>
-Breaking API changes</h2>
-IVerticalRulerInfo.addMouseListener/removeMouseListener have been removed
-again. The vertical ruler now provides a control that shares its listeners
-with its children.
-<p>IDocumentProviderExtension.getStatus(Object element) returns an IStatus
-connected with the given element. The status can be used to relate any
-relevant kind of status information with an element for which a provider
-manages a document.
-<h2>
-Other highlights</h2>
-Introduced a StatusTextEditor. The status text editor checks the status
-flag managed for its input element by the editor' document provider. If
-the status is not-OK, a different control is shown. By default an InfoForm
-is shown. Subclasses can change what is shown or subclass InfoForm.
-<p>StorageDocumentProvider and FileDocumentProvider honor the workbench's
-encoding settings. In addition, encoding support is provided by standard
-text editor. File can be viewed using different encodings. Save always
-uses the workbench's encoding setting. Custom editors can leverage the
-support by including the EncodingActionGroup into their menus. The encoding
-support uses the newly introduced status text editor.
-<p>Text hover timeout when typing has been improved. It's now always 1500ms.
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-See bugzilla.
-<br>&nbsp;
-<p>
-<hr WIDTH="100%">
-<br>&nbsp;
-<br>&nbsp;
-<p>Eclipse SDK Build 20020508
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-The context menu of the vertical ruler can be opened with Ctrl+W when using
-the default key binding. Accelerator for the emac's key binding is still
-to be defined.</li>
-
-<li>
-Added support for composite vertical ruler. See CompositeVerticalRuler.&nbsp;
-A composite vertical ruler is configured with ruler columns. Two ruler
-columns are provided by default: AnnotationRulerColumn and LineNumberRulerColumn.</li>
-
-<li>
-Performance changes to the reconciling mechanism in JFace Text.</li>
-
-<li>
-Changes in handling read only files: All modifying text actions are disabled
-by default.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#15071 convert line delimiters - one os missing
-<br>&nbsp;
-<p>
-<hr WIDTH="100%">
-<br>&nbsp;
-<p>Eclipse SDK Build 20020430
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-Introduced the concepts of state dependent actions, i.e. actions which
-change their enabling state depending on whether the editor's input is
-read only or not.</li>
-
-<li>
-Added line delimiter conversion actions for DOS, UNIX and Mac.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-
-<p><br>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20020423
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-Viewport clipping in the vertical ruler</li>
-
-<li>
-Improved painting of range indicator</li>
-
-<li>
-Fixed problem in position handling in AbstractDocument</li>
-
-<li>
-Improved handling of delete in GapTextStore</li>
-
-<li>
-Changes in partition parsing: Introduced the concept of a partition token
-scanner which can resume scanning in the middle of&nbsp; token range.&nbsp;
-The basic assumption is that partition delimiters don't contain line delimiters.
-Partition token scanners can be built with rules implementing IPredicateRule.
-A predicate rule can start evaluation between their start and end sequence.
-PatternRule has been adapted.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-
-<p><br>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20020418
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-Added method <i>undelete</i> to Position.</li>
-
-<li>
-AbstractMarkerAnnotationModel better supports heterogenous sets of annotations.</li>
-
-<li>
-DefaultUndoManager causes selection changes when executing undo/redo to
-ensure correct enabling/disabling of selection dependent actions.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-
-<p><br>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20020411
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-Enabled annotation models for more fine grained change notification</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#13358 incremental find: displays little squares after you press 'delete'
-<br>#13283 Find/Replace: Close button too small
-<br>#13459 Typing tab with selection in middle of line shifts right
-<p>
-<hr WIDTH="100%">
-<br>&nbsp;
-<br>&nbsp;
-<p>Eclipse SDK Build 20020409
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-Added support for external contribution of ruler actions. I.e. plugins
-can contribute actions to the context menu of an editor's vertical ruler&nbsp;
-by specifying those actions in their plugin.xml file.</li>
-
-<li>
-In the default key binding Ctrl+ArrowUp and Ctrl+ArrowDown are bound to
-scroll a single line without moving the cursor.</li>
-
-<li>
-AnnotationModel is be used from several threads.</li>
-
-<li>
-TextViewer implements ITextViewerExtensions which supports the stacking
-of VerifyKeyListeners. A listener that is prepended to the list of verify
-key listeners can take over the control over all key strokes not bound
-as menu item accelerators.</li>
-
-<li>
-The scheme according to which an editor calls Workspace.validateEdit has
-been reworked.</li>
-
-<li>
-The editor hooks to the Revert action in the File menu.</li>
-
-<li>
-AbstractTextEditor supports property dependent actions similar to selection
-or content dependent actions.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#11215 Editor task creation actions should use TaskPropertiesDialog
-<br># 9761 Line has to be selected from beginning when using the 'Tab'
-<br>#10806 call validateEdit() again before any further changes
-<br>#11480 READ/WRITE not updated on focus change
-<br>#12901 P2 Find/Replace should keep last selection highlighted
-<p>
-<hr WIDTH="100%">
-<br>&nbsp;
-<p>Eclipse SDK Build 20020402
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-fixed a problem in the TextViewer's handleDipose method</li>
-
-<li>
-AbstractMarkerAnnotationModel can now deal with a heterogenous set of annotations</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-
-<p><br>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20020326
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-Enabled key binding support</li>
-
-<li>
-dialog-less incremental search (improvements)</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-
-<p><br>
-<hr WIDTH="100%">
-<br>&nbsp;
-<p>Eclipse SDK Build 20020318
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-All find operations can be limited to a scope using the find replace dialog.
-Multi-line selections serve as scope.</li>
-
-<li>
-Emacs-like incremental search (Ctrl-J) is now part of AbstractTextEditor.</li>
-
-<li>
-Preparations for key binding support</li>
-
-<br>&nbsp;</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#2280 Undo does not jump to undone location (1GEK1G5)
-<br>#7381 Search results block hover help for problems
-<br>#7954 Content assist off the edge of the display
-<br>#10141 Shift Left/Right disabled unless selection is "full lines".
-<br>#11047 Index out of bounds on text hover
-<br>#11148 Syntax coloring lost on revert
-<br>#11377 Code assist leaks threads
-<br>#11433 NPE opening editor when some plugins disabled
-<br>&nbsp;
-<br>&nbsp;
-<p>
-<hr WIDTH="100%">
-<br>&nbsp;
-<p>Eclipse SDK Build 20020312
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-All editors based on AbstractTextEditor now support <i>Find Next</i> and
-<i>Find
-Previous. </i>Both actions are selection aware, i.e. having a word selected
-when invoking <i>Find Next </i>searches for the next appearance of the
-selected word.</li>
-
-<li>
-A first cut of incremental search is implemented accessible via the Find/Replace
-dialog.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#5191 EC DCR: Add keyboard accelerator for "Find Next"
-<br>#5710 Emacs-like isearch (aka "incremental search")
-<br>#10489 Indention a template results in NPE
-<br>#2698 Opening Default Text Editor not showing right icon in the file
-tab (1GI7GK2)
-<br>#7954 Content assist off the edge of the display
-<br>#9964&nbsp; nor P3 Syntax highlight and comments bug
-<br>#11047&nbsp; nor P2 Index out of bounds on text hover
-<br>&nbsp;
-<p>
-<hr WIDTH="100%">
-<br>&nbsp;
-<p>Eclipse SDK Build 20020305
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#8652 ctl-space doesn't wrk for content assist in Java editor when
-<br>#8910 @link-tag in Javadoc display broken
-<br>#9576 Method argument hints not as smart as code assist
-<br>#10315 Syntax highlighting glitch
-<br>#10422 Incorrect syntax highlighting for comments
-<br>#10721 Syntax highlighting lost in Java editor after replace with r
-<br>&nbsp;
-<p>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20020212
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-Added IContextInformationExtension to support context information positions
-not equal to completion position (related to #4366).</li>
-
-<li>
-Added preference store keys for system default background/foreground colors
-(related to #5811).</li>
-
-<li>
-Reworked handling of read-only resources and state changes of resources.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#2635 Find should remember last string if selection empty (1GHFMYL
-<br>#5380 Error hover doesn't appear
-<br>#7483 NPE during revert in Java editor
-<br>#2575 [JFace Text] BUG - org.eclipse.ui.texteditor inconsistency (1GGLRU6)
-<br>#5969 Find dialog placement needs improvement
-<br>#5811 Pref to set editor background color
-<br>#5819 Code formatter doesn't work well with else if on next line
-<br>&nbsp;
-<p>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20020129
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#5819 Code formatter doesn't work well with else if on next line
-<p>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20020122
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#4324 EC: Find/replace gets stuck in infinite loop (1GLCBZE)
-<br>#3736 DCR: Go to line - would be nice to show valid range (1GEHSDX)
-<p>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20020115
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#4335 Find/Replace should come up with first history entry (1GEL5NS)
-<br>#4338 Find/change history is never pruned (1GHDUJW)
-<br>#4342 TextViewer.setTopIndex doesn't take horizontal scrollbar into
-account (1GIFYC7)
-<br>#4343 Text hidden inserted by code assist (1GJ9PGK)
-<br>#6701 Code assist: java hint not properly aligned
-<br>#6379 StatusLine 'Writeable' is not readable
-<p>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20020108
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#3833 Javadoc hover appears under code assist window (1GF0K3T)
-<br>#4363 Two Java Doc hovers
-<p>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20011218
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#1614 Current line in Debugger should start at center of source ed
-<br>#5000 Context menu IDs not fully qualified
-<br>#5959 Text editor: SEVERE - Revert should be undoable
-<br>#6075 NPE while editing in compare view
-<br>#6318 F2 window accessability issues
-<br>#4367 Argument hover doesn't work for nested method call
-<br>#4964 Automatic Code Assist needs to be smarter
-<br>#4966 Automatic Code Assist needs to be smarter #2
-<br>#4967 Automatic Code Assist needs to be smarter #3
-<br>#4968 Automatic Code Assist needs to be smarter #4
-<br>#4969 Automatic Code Assist needs to be smarter #5
-<br>#4999 Automatic Code Assist needs to be smarter #7
-<br>#6589 ctrl+insert, shift+insert incorrectly flips the insert/overw
-<br>#3467 Horizontal scrolling when stepping through errors (1GE6AF1)
-<br>#4041 out of sync error message after copying resources (1GGR6VZ)
-<br>#6699 Save should not flush undo stack
-<br>#4071 Format option loses place in editor (1GHQFU6)
-<p>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20011211
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#1614 Current line in Debugger should start at center of source editor
-(1GETH7J)
-<br>#3467 Horizontal scrolling when stepping through errors (1GE6AF1)
-<p>
-<hr WIDTH="100%">
-<br>&nbsp;
-<p>Eclipse SDK Build 20011206
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-Support for read-only but modifiable resources in editors. For this reason
-AbstractTextEditor now calls validateState if its document provider also
-implement IDocumentProviderExtension. The calls are issued:
-<ul>
-<li>
-when an editor is marked dirty</li>
-
-<li>
-when an editor saves its document to its input</li>
-
-<li>
-when a dirty resource is moved (if allowed)</li>
-</ul>
-Calling validateState may cause changes to the isModifiable and isReadOnly
-properties of the editor's input.
-<br>FileDocumentProvider implements validateState by calling IWorkspace.validateEdit
-on the input file.
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20011204
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-Perparations for supporting the concept of read-only but modifiable resources
-in editors.
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#6203 SEVERE: typing in java editor causes OutOfMemoryError in JDK 1.4
-<br>#6263 Extra closing braces inserted
-<p>
-<hr WIDTH="100%">
-<br>&nbsp;
-<p>Eclipse SDK Build 20011127
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-An BasicTextEditorActionContributor now contributes three status fields
-into the window's status line. Each field is dedicated to show information
-of a particular category. The categories are defined in ITextEditorActionConstants.
-A new interface ITextEditorExtension has been introduced. On activation,
-implementing editors of this interface are informed about the status fields
-they can use to publish status information. AbstractTextEditor implements
-ITextEditorExtension. Subclasses of AbstractTextEditor can get access to
-the editor's current status fields using the method getStatusField(String
-category). By default, AbstractTextEditor publishes the following information:
-cursor position, input mode, reade only state of its input. Subclasses
-may change this behavior by overriding updateStatusField(String category)
-or callers of this method.</li>
-
-<li>
-The default text editor uses the feature described above and now provides
-status information.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#4071&nbsp;&nbsp;&nbsp; Format option loses place in editor (1GHQFU6)
-<br>#6168&nbsp;&nbsp;&nbsp; code assist preference (auto complete) does
-not work
-<br>#6087&nbsp;&nbsp;&nbsp; NPE closing content assist from DisplayView
-on exit
-<br>#6013&nbsp;&nbsp;&nbsp; Repeatable Java editor hang in 200111115
-<br>#4947&nbsp;&nbsp;&nbsp; No indication of Insert/Overwrite mode
-<p>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20011120
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-Change to AbstractHoverInformationControlManager to reset the hover location
-on a time basis.</li>
-
-<li>
-Added configuration method to ContentAssistant to automatically insert
-a single proposal.</li>
-
-<li>
-Behavioral configuration methods such as enableAutoInsert, enableAutoActivation,
-and setAutoActivationDelay can now be called when after the content assistant
-has been installed.</li>
-
-<li>
-Context information popup recomputes size after style information has been
-applied.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports closed</h2>
-#2569&nbsp;&nbsp;&nbsp; [JFace Text] Content assist list truncated (1GG1W9B)
-<br>#2904&nbsp;&nbsp;&nbsp; [JFace Text] PropagatingFontFieldEditor has
-moved (1GKKL13)
-<br>#1824&nbsp;&nbsp;&nbsp; [JFace Text] 50 reconciling threads for 4 editors
-opened (1GFXMV8)
-<br>&nbsp;
-<p>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 20011101
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-
-<ul>
-<li>
-introduction of setDocumentContent(IDocument, IEditorInput) on StorageDocumentProvider.</li>
-
-<li>
-introduction of IDocumentExtension (see JavaDoc)</li>
-
-<li>
-AbstractDocument implements IDocumentExtension</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-Instances of DefaultInformationControl are wider than necessary.
-<h2>
-Problem reports fixed</h2>
-
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 206
-<h2>
-Breaking API changes</h2>
-Corrected spelling of&nbsp; "anchor" in AbstractInformationControlManager
-and its subclasses.
-<h2>
-Other highlights</h2>
-
-<h2>
-Known deficiencies</h2>
-Instances of DefaultInformationControl are wider than necessary.
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5066">#5066&nbsp;&nbsp;&nbsp;
-Code Assist: Thread created / not removed</a>
-<br><a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5120">#5120&nbsp;&nbsp;&nbsp;
-Empty popup doc in java editor</a>
-<br><a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=3473">#3473&nbsp;&nbsp;
-mnemonics (1GF25DN)</a>
-<p>
-<hr WIDTH="100%">
-<br>&nbsp;
-<p>Eclipse SDK Build 204
-<h2>
-Breaking API changes</h2>
-
-<h2>
-Other highlights</h2>
-For more information about the following issue please see JavaDoc of the
-classes
-<ul>
-<li>
-Several improvements of the new hover infrastructure, such as customizable
-SWT styles.</li>
-
-<li>
-Improved look of the content assist window.</li>
-
-<li>
-Content assist supports customizable completion characters, i.e. each completion
-proposal can specify which characters trigger its insertion.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-Instances of DefaultInformationControl are wider than necessary.
-<h2>
-Problem reports fixed</h2>
-
-<p><br>
-<hr WIDTH="100%">
-<br>&nbsp;
-<p>Eclipse SDK Build 203
-<h2>
-Breaking API changes</h2>
-&nbsp; package:&nbsp;&nbsp; org.eclipse.jface.text
-<br>&nbsp; interface:&nbsp;&nbsp; IHoverInfoPresenter
-<br>&nbsp; change:&nbsp;&nbsp; removed interface
-<br>&nbsp; change type: breaking API change for implementers of IHoverInfoPresenter
-<h2>
-Other highlights</h2>
-For more information about the following issue please see JavaDoc of the
-classes
-<ul>
-<li>
-Complete rework of hover popups (previously a package private mechanism
-hidden from clients). There is now the concept of an IInformationControl
-and an IInformationControlCreator. Everywhere where floating windows are
-used to present some kind of information, now IInformationControl is used.
-More precise, the according component is equiped with an IInformationControlCreator
-and creates the IInformationControl instance when needed. So clients can
-set an IInformationControlCreator on a TextViewer and a SourceViewer. They&nbsp;
-use it&nbsp; to create the text hover window and the annotation bar hover
-window respectively. DefaultInformationControl&nbsp; is a StyledText-based
-default implementation of IInformationControl. Clients may implement IInformationControl
-directly and inject their custom information control creator.</li>
-
-<li>
-AbstractInformationControlManager and its subclasses abstractly&nbsp; implement
-the process of providing a SWT control with support for floating information
-windows. This covers layout, positioning, content, and visibility of the
-floating window. They offer a broad customization space such as layout
-strategies, colors, etc.</li>
-
-<li>
-TextViewer hovers, annotation bar hovers, additional info on completion
-proposals in the content assistant, etc. benefit from the new infrastructure.
-UI improvements are especially visible in the layout behavior.</li>
-
-<li>
-Introduced the concept of an information presenter. An information presenter
-shows information on a context derivved subject on request. See IInformationPresenter
-for details as well as SourceViewer and SourceViewerConfiguration for how
-to use it.</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-Instances of DefaultInformationControl are wider than necessary.
-<h2>
-Problem reports fixed</h2>
-
-<p><br>
-<hr WIDTH="100%">
-<p>Eclipse SDK Build 200
-<h2>
-Breaking API changes</h2>
-&nbsp; package:&nbsp;&nbsp; org.eclipse.jface.text
-<br>&nbsp; interface:&nbsp;&nbsp; ITextViewer
-<br>&nbsp; change:&nbsp;&nbsp; added method public void invalidateTextPresentation(
-)
-<br>&nbsp; change type: breaking API change for implementers of ITextViewer
-<p>&nbsp; package:&nbsp;&nbsp; org.eclipse.jface.text
-<br>&nbsp; interface:&nbsp;&nbsp; ITextViewer
-<br>&nbsp; change:&nbsp;&nbsp; added method public void setDefaultPrefixes(String[]
-defaultPrefixes, String contentType)
-<br>&nbsp; change type: breaking API change for implementers of ITextViewer
-<p>&nbsp; package:&nbsp;&nbsp; org.eclipse.jface.text
-<br>&nbsp; interface:&nbsp;&nbsp; ITextViewer
-<br>&nbsp; change:&nbsp;&nbsp; removed method&nbsp; void setDefaultPrefix(String
-defaultPrefix, String contentType)
-<br>&nbsp; change type: breaking API change for implementers of ITextViewer
-<p>&nbsp; package:&nbsp;&nbsp; org.eclipse.jface.text.rules
-<br>&nbsp; class:&nbsp;&nbsp; RuleBasedDamagerRepairer
-<br>&nbsp; change:&nbsp;&nbsp; deprecated constructor&nbsp; public RuleBasedDamagerRepairer(RuleBasedScanner
-scanner, TextAttribute defaultTextAttribute)
-<br>&nbsp; change type: breaking API change for clients of RuleBasedDamagerRepairer
-<h2>
-Other highlights</h2>
-For more information about the following issue please see JavaDoc of the
-classes
-<ul>
-<li>
-IContextInformationValidator implementers may also implement IContextInformationPresenter
-to style context information</li>
-
-<li>
-ITextHover implementers may also implement IHoverInfoPresenter to style
-hover information</li>
-
-<li>
-PropagatingFontFieldEditor has been introduced</li>
-
-<li>
-MonoReconciler has been introduced to support partition independent reconciling</li>
-
-<li>
-Token has been reimplemented, supports setData method now</li>
-
-<li>
-RuleBasedScanner now supports&nbsp; public void setDefaultReturnToken(IToken
-defaultReturnToken). This token is returned if no rule can fire.</li>
-
-<li>
-TextPresentation now supports&nbsp; public static void applyTextPresentation(TextPresentation
-presentation, StyledText text)</li>
-
-<li>
-BasicMarkerUpdater has been marked as final</li>
-
-<li>
-SelectMarkerRulerAction has been introduced</li>
-
-<li>
-WorkbenchChainedTextFontFieldEditor has been introduced</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-1GJ65EW: ITPSRCEDIT:WINNT - ResourceMarkerAnnotaionModel: unnecessary fireModelChange
-<br>1GIYR3X: ITPSRCEDIT:ALL - NL: word select (double click) in Java comments
-<br>1GGYYWK: ITPJUI:ALL - Dismissing editor with code assist up causes
-lots of Internal Errors
-<br>1GEUOZ9: ITPJUI:ALL - Confusing UI for multiline Bookmarks and Tasks
-<br>1GII2RZ: ITPJUI:WINNT - AssertionFailed Ex. in Java editor
-<br>1GIYQ9K: ITPUI:WINNT - StyledText swallows Shift+TAB
-<br>1GIJZOO: ITPSRCEDIT:ALL - Gotodialog's edit field has no initial focus
-
-</body>
-</html>
diff --git a/org.eclipse.ui.editors/_buildnotes_text_2_1.html b/org.eclipse.ui.editors/_buildnotes_text_2_1.html
deleted file mode 100644
index f4e50d39871..00000000000
--- a/org.eclipse.ui.editors/_buildnotes_text_2_1.html
+++ /dev/null
@@ -1,267 +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.76 [en] (Windows NT 5.0; U) [Netscape]">
- <meta name="Author" content="IBM">
- <title>Eclipse Platform Release Notes - Desktop</title>
-</head>
-<body>
-
-<h1>
-Eclipse Platform Build Notes</h1>
-
-<h1>
-Platform Text</h1>
-
-<p><br>Eclipse SDK Build 20030205
-<h2>
-What's new</h2>
-
-<ul>
-<li>
-Added new layout anchor option "GLOBAL" to the AbstractInformationControlManager.
-Information controls that are opened using this anchor are placed in the
-middle of the subject control.</li>
-
-<li>
-Changed all internal usages of SWT defined modifiers to the generic modifiers
-MOD?</li>
-
-<li>
-Moved "Go to Line" action into the Navigate menu</li>
-
-<li>
-The default text editor now supports:</li>
-
-<ul>
-<li>
-line numbers</li>
-
-<li>
-cursor line highlighting</li>
-
-<li>
-overview ruler</li>
-
-<li>
-error annotations</li>
-</ul>
-
-<li>
-The overview ruler can now be configured to show an header. The header
-shows the presence of annotations of a certain type.</li>
-</ul>
-
-<h2>
-Problem reports closed</h2>
-
-<blockquote>See bugzilla.</blockquote>
-
-<hr>
-<p>Eclipse SDK Build 20030128
-<h2>
-What's new</h2>
-
-<ul>
-<li>
-Introduced painter infrastructure at text viewer level. The following predefined
-painters are available:</li>
-
-<ul>
-<li>
-AnnotationPainter</li>
-
-<ul>
-<li>
-represents annotations given in the viewer's annotation model as squiggly
-lines in the text widget</li>
-
-<li>
-can be configured along annotation types and colors</li>
-</ul>
-
-<li>
-CursorLinePainter</li>
-
-<ul>
-<li>
-highlights the background of the current line (i.e. the line in which the
-cursor resides)</li>
-
-<li>
-color can be configured</li>
-</ul>
-
-<li>
-MargingPainter</li>
-
-<ul>
-<li>
-draws a vertical line at a certain column</li>
-
-<li>
-color and column can be configured</li>
-</ul>
-
-<li>
-MatchingCharacterPainter</li>
-
-<ul>
-<li>
-highlights the character matching the character close to the current cursor
-position by drawing a bounding box around the character</li>
-
-<li>
-must be configured with a strategy for finding the matching character (ICharacterPairMatcher)</li>
-
-<li>
-color can be configured</li>
-</ul>
-</ul>
-
-<li>
-Painters can dynamically be attached to a source viewer. API is defined
-in&nbsp; the interface ITextViewerExtension2. The TextViewer manages its
-painters using a PaintManager.</li>
-
-<li>
-Introduced the concept of an overview ruler at the source viewer level.
-The API is defined in the interface ISourceViewerExtension.</li>
-
-<li>
-Introduced a helper class SourceViewerDecorationSupport at the text editor
-framework that can be used by editors to manage and configure painters.
-This includes the initialization of painters from preferences and the reaction
-on preference changes.</li>
-
-<li>
-Changed validateEdit behavior for&nbsp; the find/replace case. validateEdit
-is now called directly in front of the first text replace operation.</li>
-
-<li>
-Global action definition ids have been introduced for computing content
-completion proposals and computing content context information.</li>
-
-<li>
-ITextViewerExtension2 now offers API to remove all registered text hovers
-for a given content type</li>
-</ul>
-
-<h2>
-Problem reports closed</h2>
-
-<blockquote>See bugzilla.</blockquote>
-
-<h1>
-
-<hr></h1>
-Eclipse SDK Build 20030107
-<h2>
-What's new</h2>
-
-<ul>
-<li>
-New attribute&nbsp;<span style="font-weight: bold;">symbolicFontName</span>
-has been added to <tt>org.eclipse.ui.editors</tt> extension point. See
-the extension point documentation for more details. If the attribute is
-provided then the text editors use it as primary source for setting the
-text editor font.</li>
-</ul>
-
-<h2>
-Problem reports closed</h2>
-
-<blockquote>See bugzilla.</blockquote>
-
-<hr>
-<h1>
-Eclipse Platform Build Notes</h1>
-
-<h1>
-Platform Text</h1>
-Eclipse SDK Build 20021203
-<h2>
-What's new</h2>
-
-<ul>
-<li>
-Introduced goto to last edit position</li>
-</ul>
-
-<h2>
-Problem reports closed</h2>
-
-<blockquote>See bugzilla.</blockquote>
-
-<hr>
-<p>Eclipse SDK Build 20021008
-<h2>
-What's new</h2>
-
-<ul>
-<li>
-Introduced smart behavior for Home/End key</li>
-
-<li>
-Infrastructure for eating code assist including visual indication of text
-to be replaced</li>
-</ul>
-
-<h2>
-Problem reports closed</h2>
-
-<blockquote>See bugzilla.</blockquote>
-
-<hr>
-<p>Eclipse SDK Build 20021001
-<h2>
-What's new</h2>
-
-<ul>
-<li>
-Applied patch for incremental search to behave more like Emacs</li>
-
-<li>
-Applied patch for delete line to copy to clipboard (Emacs behaviour)</li>
-</ul>
-
-<h2>
-Problem reports closed</h2>
-
-<blockquote>See bugzilla.</blockquote>
-
-<hr>
-<p>Eclipse SDK Build 20020903
-<h2>
-What's new</h2>
-
-<ul>
-<li>
-Adaptable line number ruler width</li>
-
-<li>
-Resizable content assist proposal popup</li>
-
-<li>
-Pre 2.0 build notes have been moved to buildnotes_text_2_0.html</li>
-</ul>
-
-<h2>
-Known deficiencies</h2>
-
-<ul>
-<li>
-Size of content assist proposal popup is not persisted over session boundaries</li>
-
-<li>
-Size of content assist proposal popup is not editor type specific</li>
-</ul>
-
-<h2>
-Problem reports closed</h2>
-
-<blockquote>See bugzilla.</blockquote>
-
-</body>
-</html>
diff --git a/org.eclipse.ui.editors/about.html b/org.eclipse.ui.editors/about.html
deleted file mode 100644
index 9db411aab99..00000000000
--- a/org.eclipse.ui.editors/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 (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). 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, &quot;Program&quot; 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 (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) 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/org.eclipse.ui.editors/build.properties b/org.eclipse.ui.editors/build.properties
deleted file mode 100644
index eb64b179297..00000000000
--- a/org.eclipse.ui.editors/build.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
-###############################################################################
-source.editors.jar = src/
-bin.includes = *.jar,\
- plugin.xml,\
- plugin.properties,\
- about.html,\
- icons/
-src.includes = about.html,\
- schema/
diff --git a/org.eclipse.ui.editors/buildnotes_text.html b/org.eclipse.ui.editors/buildnotes_text.html
deleted file mode 100644
index d1b6d0423f6..00000000000
--- a/org.eclipse.ui.editors/buildnotes_text.html
+++ /dev/null
@@ -1,302 +0,0 @@
-<!--
- DO NOT EDIT THIS FILE WITH HTML EDITORS
--->
-
-<!DOCTYPE doctype 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.76 [en] (Windows NT 5.0; U) [Netscape]">
- <title>Eclipse Platform Build Notes - Text</title>
-</head>
-
-<body>
-<h1>
-Eclipse Platform Build Notes<br>
-Text</h1>
-To see which bugs have been addressed in one of the builds simply open the <a href="http://bugs.eclipse.org/bugs/query.cgi?short_desc_type=allwordssubstr&amp;product=Platform&amp;component=Text&amp;long_desc_type=allwordssubstr&amp;long_desc=&amp;bug_file_loc_type=allwordssubstr&amp;bug_file_loc=&amp;keywords_type=allwords&amp;keywords=&amp;emailtype1=substring&amp;email1=&amp;emailtype2=substring&amp;email2=&amp;bugidtype=include&amp;bug_id=&amp;votes=&amp;changedin=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;namedcmd=Assigned&amp;newqueryname=&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=">Platform-Text bugzilla query page</a>, select status, resolution and the time frame.
-<br>
-<br>
-<br>
-========== Eclipse Build Input December 18th 2003 ==========<br>
-<pre>
-This build contains several changes and additions to the annotation mechanism.
-
-1) Annotation Types
-
-There is now the explicit notion of an annotation type. See Annotation.getType() and Annotation.setType().
-The type of an annotation can change over it's lifetime. A new extension point has been added for the declaration
-of annotation types: "org.eclipse.ui.editors.annotationTypes". An annotation type has a name and can be declared
-as being a subtype of another declared annotation type. An annotation type declaration may also use the attributes
-"markerType" and "markerSeverity" in order to specify that markers of a given type and a given severity should be
-represented in text editors as annotations of a particular annotation type. The attributes "markerType" and
-"markerSeverity" in the "org.eclipse.ui.editors.markerAnnotationSpecification" should no longer be used. Marker
-annotation specifications are thus becoming independent from markers and the name thus misleading. However, the
-name is kept in order to ensure backward compatibility.
-
-Instances of subclasses of AbstractMarkerAnnotationModel automatically detect and set the correct annotation
-types for annotations they create from markers. In order to programmatically retrieve the annotation type for
-a given marker or a given pair of markerType and markerSeverity use org.eclipse.ui.texteditor.AnnotationTypeLookup.
-
-Access to the hierarchy of annotation types is provided by AnnotationTypeHierarchy. For a given annotation type
-name you can get an AnnotationType that provides information about the chain of super types and a method to check
-whether an annotation type given as name is a subtype. You can also retrieve the information from
-IAnnotationAccessExtension. DefaultMarkerAnnotationAccess implements this interface.
-
-2) MarkerAnnotationSpecification
-
-The annotation type is the key with which to find the associated marker annotation specification. As annotation
-types can extend other annotation types, there is an implicit relation between marker annotation specifications
-as well. Therefore a marker annotation specification for a given annotation type is completed by the marker
-annotation specifications given for the super types of the given annotation type. Therefore, marker annotation
-specification do not have to be complete as this was required before. Marker annotation specifications are
-reified by AnnotationPreferences. By using org.eclipse.ui.texteditor.AnnotationPreferenceLookup, you can retrieve
-an annotation preference for a given annotation type that transparently performs the completion of the preference
-along the annotation super type chain.
-
-3) Painting annotation
-
-Marker annotation specification has been extended with three addition attributed in order to allow the definition
-of custom appearances of a given annotation type in the vertical ruler. These attributes are: "icon", "symbolicIcon",
-and "annotationImageProvider". The value for "icon" is the path to a file containing the icon image. The value of
-"symbolicIcon" can be one of "error", "warning", "info", "task", "bookmark". The attribute "symbolicIcon" is used
-to tell the platform that annotation should be depicted with the same images that are used by the platform to
-present errors, warnings, infos, tasks, and bookmarks respectively. The value of "annotationImageProvider" is a
-class implementing org.eclipse.ui.texteditor.IAnnotationImageProvider that allows for a full custom annotation
-presentation.
-
-The vertical ruler uses it's associated IAnnotationAccess/IAnnotationAccessExtension to draw annotations.
-The vertical ruler does not call Annotation.paint any longer. In general, Annotations are no longer supposed
-to draw themselves. The "paint" and "getLayer" methods have been deprecated in order to make annotation eventually
-UI independent. DefaultMarkerAnnotationAccess serves as default implementation of IAnnotationAccess/IAnnotationAccessExtension.
-DefaultMarkerAnnotationAccess implements the following strategy for painting annotations: If an annotation implements
-IAnnotationPresentation, IAnnotationPresentation.paint is called. If not, the annotation image provider is looked up
-in the annotation preference. The annotation image provider is only available if specified and if the plug-in defining
-the enclosing marker annotation specification has already been loaded. If there is an annotation image provider, the
-call is forwarded to it. If not, the specified "icon" is looked up. "symbolicIcon" is used as the final fallback. For
-drawing annotations, the annotation presentation layer is relevant. DefaultMarkerAnnotationAccess looks up the presentation
-layer using the following strategy: If the annotation preference specifies a presentation layer, the specified layer is
-used. If there is no layer and the annotation implements IAnnotationPresentation, IAnnotationPresentation.getLayer is used
-otherwise the default presentation layer (which is 0) is returned.
-
-4) Additions to Annotation
-
-Annotations additionally support: a message, a flag to indicate whether the annotation is marked as deleted, a
-flag to indicate whether the annotation is persistent or temporary.
-
-5) Migration
-
-The following annotation types are declared by the org.eclipse.ui.editors plug-in:
-
- &ltextension point="org.eclipse.ui.editors.annotationTypes"&gt
- &lttype
- name="org.eclipse.ui.workbench.texteditor.error"
- markerType="org.eclipse.core.resources.problemmarker"
- markerSeverity="2"&gt
- &lt/type&gt
- &lttype
- name="org.eclipse.ui.workbench.texteditor.warning"
- markerType="org.eclipse.core.resources.problemmarker"
- markerSeverity="1"&gt
- &lt/type&gt
- &lttype
- name="org.eclipse.ui.workbench.texteditor.info"
- markerType="org.eclipse.core.resources.problemmarker"
- markerSeverity="0"&gt
- &lt/type&gt
- &lttype
- name="org.eclipse.ui.workbench.texteditor.task"
- markerType="org.eclipse.core.resources.taskmarker"&gt
- &lt/type&gt
- &lttype
- name="org.eclipse.ui.workbench.texteditor.bookmark"
- markerType="org.eclipse.core.resources.bookmark"&gt
- &lt/type&gt
- &lt/extension&gt
-
-The defined markerAnnotationSpecification extension no longer provide "markerType" and "markerSeverity"
-attributes. They define the "symbolicIcon" attribute with the according value. Thus, MarkerAnnotation.paint
-and MarkerAnnotation.getLayer are not called any longer, i.e. overriding these methods does not have
-any effect.
-</pre>
-<br>
-<br>
-========== Eclipse Build Input November 11th 2003 ==========<br>
-<pre>
-- Finished annotation background painter
-- Added new concept of ITextPresentationListener which should be used by clients
- to apply a presentation style (e.g. color, bold) to the text. Clients using
- the StyledText.*styleRange* API methods should convert to this new API. A
- ITextPresentationListener can be added and removed from a text viewer (see
- ITextViewerExtension4)
-</pre>
-<br>
-<br>
-
-========== Eclipse Build Input October 28th 2003 ==========<br>
-<pre>
-- Vertical ruler annotations can be disabled via editor's Annotation preference
- page.
-- Added support to set background for annotations
- - annotation background painter <work in progress>
- - key/value attributes to "org.eclipse.ui.workbench.texteditor.markerAnnotationSpecification" extension-point
- - updated annotation preference page to show this attribute
- - enabled this feature for Search annotations
-</pre>
-<br>
-<br>
-========== Eclipse Build Input October 21th 2003 ==========<br>
-<pre>
-- Incremental find has its own editor status line field (findField)
-- IStatusField has been extended (IStatusFieldExtension) with the following concepts:
- - set error text and image
- - set tool tip
- - control visibility
-</pre>
-<br>
-<br>
-========== Eclipse Build Input October 7th 2003 ==========<br>
-<pre>
-- Find/Replace dialog now offers content assist for regular expression search and replace
-- Changes found by Quickdiff are now ordinary annotations. I.e. they can serve as
- navigation target, can be shown in the overview ruler, and in the text. Their presentation
- colors can also be configured.
-- "Open External File" can be found in the Files menu. It opens files which are not workspace files
- with the associated editor or the default text editor if no editor is specified. Text editors support
- external files.
-</pre>
-<br>
-<br>
-========== Eclipse Build Input September 30th 2003 ==========<br>
-<pre>
-- Find/Replace dialog now supports regular expression search and replace
-- Quick Diff annotations can now be displayed on the overview ruler and support Go to Next / Previous
-</pre>
-<br>
-<br>
-========== Eclipse Build Input August 26th 2003 ==========<br>
-<pre>
-- Improved overview ruler:
- - can now handle annotations on same layer
- - added tool tip text to overview ruler header
- - tool tip text for disabled annotation no longer appears
- - click on overview ruler item respects layer
- - clicking on same overview ruler item jumps to next annotation
-- several bugs fixed
-</pre>
-<br>
-<br>
-========== Eclipse Build Input August 19th 2003 ==========<br>
-<pre>
-- added concept of reconcile step: a reconcile step is one of n steps of a
- reconcile strategy that consists of several steps. See the Java Family example
- to see it in action.
-- added concept of translator: a translator translates a given file into another
- language. The translator is also responsible to provide line mapping information
- for the translation and to compute which offset in an original line corresponds
- to a given offset in a target line. See the Java Family example to see it in action.
-- TextEditor extends now ExtendedTextEditor, an additional layer combining features
- used in rich editors, such as the annotation, line number and overview rulers,
- the print margin, current text highlighting, and quick diff.
-- several bugs fixed
-</pre>
-<br>
-<br>
-========== Eclipse Build Input August 12th 2003 ==========<br>
-<pre>
-- the marker annotation specification can now be used to specify if the annotation
- should allow to be a navigation target. For details read the documentation of
- org.eclipse.workbench.texteditor.markerAnnotationSpecification extension point.
-- several bugs fixed
-</pre>
-<br>
-<br>
-========== Eclipse Build Input July 29th 2003 ==========<br>
-<pre>
-- several bugs fixed
-</pre>
-<br>
-<br>
-========== Eclipse Build Input July 22th 2003 ==========<br>
-<pre>
-- several bugs fixed
-</pre>
-<br>
-<br>
-========== Eclipse Build Input July 16th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- several bugs fixed
-- Improvements and framework changes for the light weight change indication. Change indication
- can now happen in the line number ruler or a dedicated change ruler column.
-</pre>
-<br>
-<br>
-========== Eclipse Build Input July 8th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- several bugs fixed
-- The TextViewer sends out time-out based selection changed events for
- caret position changes for clients registered as post selection changed listeners.
-- The default text editor supports a light weight change indicator integrated with the line number ruler.
- Can be globally enabled on the Text Editor preference page. Can be enabled/disabled for the current editor
- in the editor's context menu or using the short cut "Ctrl+Shift+Q".
-- Text frameworks have been extended to support light weight diffing.
-</pre>
-<br>
-<br>
-========== Eclipse Build Input June 17th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- several bugs fixed
-- The TextViewer sends out time-out based selection changed events for caret position changes.
-- added extension interfaces which allow completion proposals to specify their custom
- information control creator
-</pre>
-<br>
-<br>
-========== Eclipse Build Input June 4th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- several bugs fixed
-- The TextViewer sends out time-out based selection changed events for caret position changes.
-- added extension interfaces which allow text hovers and information providers to specify their custom
- information control creator
-- text editors support three typing modes: Overwrite, Insert, Smart Insert
- - typing modes are toggled by INS in the default key binding
- - each mode is represented with its own caret
- - modes can be disabled per editor, i.e. when toggling insert modes, disabled modes will not be selected
-- status line contribution items can now be associated with an action that is called when double clicking the status item
-</pre>
-<br>
-<br>
-========== Eclipse Build Input May 13th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- several bugs fixed
-- released new features:
- - Insert new line above the caret line (ui name: "Smart Enter (Inverse)", default key binding: Ctrl+Shift+Enter)
- - Insert new line after the caret line (ui name: "Smart Enter", default key binding: Shift+Enter)
- - Move selected lines upwards (ui name: "Move Lines Up", default key binding: Alt+Arrow_UP)
- - Move selected lines down (ui name: "Move Lines Down", default key binding: Alt+Arrow_Down)
- - Change case of selection to upper case (ui name: "To Upper Case", default key binding: Ctrl+Shift+X)
- - Change case of selection to lower case (ui name: "To Lower Case", default key binding: Ctrl+Shift+Y)
-</pre>
-<br>
-<br>
-========== Eclipse Build Input April 29th 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- several bugs fixed
-</pre>
-<br>
-<br>
-========== Eclipse Build Input April 22nd 2003 ==========<br>
-<!-- Add what's new below and end each line with br tag -->
-<pre>
-- several bugs fixed
-</pre>
-<br>
-<br>
-</body></html> \ No newline at end of file
diff --git a/org.eclipse.ui.editors/icons/full/ctool16/next_nav.gif b/org.eclipse.ui.editors/icons/full/ctool16/next_nav.gif
deleted file mode 100644
index 8392f3345c5..00000000000
--- a/org.eclipse.ui.editors/icons/full/ctool16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.editors/icons/full/ctool16/prev_nav.gif b/org.eclipse.ui.editors/icons/full/ctool16/prev_nav.gif
deleted file mode 100644
index 9b278e6fa81..00000000000
--- a/org.eclipse.ui.editors/icons/full/ctool16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.editors/icons/full/dtool16/next_nav.gif b/org.eclipse.ui.editors/icons/full/dtool16/next_nav.gif
deleted file mode 100644
index 6cbeced2629..00000000000
--- a/org.eclipse.ui.editors/icons/full/dtool16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.editors/icons/full/dtool16/prev_nav.gif b/org.eclipse.ui.editors/icons/full/dtool16/prev_nav.gif
deleted file mode 100644
index a3441a06280..00000000000
--- a/org.eclipse.ui.editors/icons/full/dtool16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.editors/icons/full/etool16/next_nav.gif b/org.eclipse.ui.editors/icons/full/etool16/next_nav.gif
deleted file mode 100644
index 03b7af34278..00000000000
--- a/org.eclipse.ui.editors/icons/full/etool16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.editors/icons/full/etool16/prev_nav.gif b/org.eclipse.ui.editors/icons/full/etool16/prev_nav.gif
deleted file mode 100644
index dd65c5235b5..00000000000
--- a/org.eclipse.ui.editors/icons/full/etool16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.editors/icons/full/obj16/file_obj.gif b/org.eclipse.ui.editors/icons/full/obj16/file_obj.gif
deleted file mode 100644
index 6b86d079780..00000000000
--- a/org.eclipse.ui.editors/icons/full/obj16/file_obj.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.editors/migration_guidelines.html b/org.eclipse.ui.editors/migration_guidelines.html
deleted file mode 100644
index 4e37371b62c..00000000000
--- a/org.eclipse.ui.editors/migration_guidelines.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE doctype 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"><title>Platform Text Breaking API changes</title></head><body text="#000000" bgcolor="#ffffff">
-&nbsp;
-<table border="0" cellspacing="5" cellpadding="2" width="100%">
- <tbody>
- <tr>
- <td align="left" width="72%"> <font size="+3"><b>Platform Text -
-Breaking API changes from R2.1 to R3.0</b></font> <font size="-2" color="#8080ff"><br>
-</font></td>
- </tr>
- <tr>
- <td>
- <ul>
- <li><span style="font-weight: bold; font-style: italic;">org.eclipse.jface.text.source.AnnotationModel.addAnnotation(Annotation, Position, boolean)</span>:
-changed signature to throw <code>org.eclipse.jface.text.BadLocationException</code>
-in order to add support for better handling of invalid document
-positions. Only clients which extend (i.e. call super) this method will be
-broken. To fix the problem either catch the exception from the super
-call or change the signature in the extended method. The latter is
-suggested since clients should decide how to handle invalid document
-positions.<br>
-</li>
- <li><span style="font-weight: bold; font-style: italic;">org.eclipse.ui.texteditor.TextEditorAction.canModifyEditor()</span>:
-added predicate method that checks whether the action's editor can be modified. The method calls different methods on the underlying editor depending on
-which interfaces the editor implements. The method will call <code>ITextEditorExtension2.isEditorInputModifiable()</code> if it is available. Modifing actions
-can call the method when updating their enablement state.<br>
-</li>
- <li><span style="font-weight: bold; font-style: italic;">org.eclipse.ui.texteditor.TextEditorAction.validateEdit()</span>:
- added predicate method that checks and updates the modifiable state of the action's editor. The method calls different methods on the underlying editor depending on
- which interfaces the editor implements. The method will call <code>ITextEditorExtension2.validateEditorInputState()</code> if it is available. Modifing actions
- can call the method before running modifing the editor's content.<br>
-</li>
- <li><span style="font-weight: bold; font-style: italic;">org.eclipse.ui.texteditor.ExtendedTextEditor</span>:
- A new intermediate class layer has been added between <code>StatusTextEditor</code> and other editors, namely <code>TextEditor</code> and <code>JavaEditor</code>. The additional layer
- includes features found commonly in advanced editors (and especially source editors) such as:
- <ul>
- <li>a vertical ruler to display annotations, line numbers, and quick diff information</li>
- <li>an overview ruler</li>
- <li>current line hightlighting,</li>
- <li>and print margin display</li>
- </ul>
- Implementors of an editor may choose to extend <code>ExtendedTextEditor</code> instead of <code>TextEditor</code>.
- <br>
-</li>
- </ul>
- </td>
- </tr>
- <tr>
- <td> <font size="-1"> This document lists the breaking API
-changes that occurred between R2.1 and R3.0 and how to migrate from the
-R2.1 API to the R3.0 API. </font> </td>
- </tr>
- </tbody>
-</table>
-<p> </p>
-</body></html> \ No newline at end of file
diff --git a/org.eclipse.ui.editors/plugin.properties b/org.eclipse.ui.editors/plugin.properties
deleted file mode 100644
index 925d4aff4b7..00000000000
--- a/org.eclipse.ui.editors/plugin.properties
+++ /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
-###############################################################################
-pluginName= Default Text Editor
-providerName= Eclipse.org
-
-ExtPoint.markerUpdater= Marker Updater
-ExtPoint.documentProvider= Document Provider
-ExtPoint.markerAnnotationSpecification= Marker Annotation Specification
-ExtPoint.annotationTypes= Annotation Types
-
-command.custom.description = Change the encoding to a custom encoding
-command.custom.name = Custom Encoding
-command.iso_8859_1.description = Change the encoding to ISO-8859-1
-command.iso_8859_1.name = ISO-8859-1 Encoding
-command.system.description = Change the encoding to the system encoding
-command.system.name = System Encoding
-command.us_ascii.description = Change the encoding to US ASCII
-command.us_ascii.name = US ASCII Encoding
-command.utf_16.description = Change the encoding to UTF-16
-command.utf_16.name = UTF-16 Encoding
-command.utf_16be.description = Change the encoding to UTF-16BE
-command.utf_16be.name = UTF-16BE Encoding
-command.utf_16le.description = Change the encoding to UTF-16LE
-command.utf_16le.name = UTF-16LE Encoding
-command.utf_8.description = Change the encoding to UTF-8
-command.utf_8.name = UTF-8 Encoding
-openExternalFile.label= Open External File...
-openExternalFile.description= Opens an External File
-ActionDefinition.quickDiff.name= Quick Diff Toggle
-ActionDefinition.quickDiff.description= Toggles display of quick diff information on the line number ruler
-
-Editors.DefaultTextEditor= Text Editor
-PreferencePages.TextEditor= Text Editor
-
-lastSaveReferenceProvider.label= Version on &Disk
-
-AddTask.label=Add &Task...
-AddTask.tooltip=Add Task...
-AddBookmark.label=Add Boo&kmark...
-AddBookmark.tooltip=Add Bookmark...
-quickdiff.toggle.enable= Enable &QuickDiff
-
-Dummy.label=
-
-openExternalFileActionSet.label= Open External Files
-textEditorAnnotationNavigationActionSet.label= Annotation Navigation
-
-goToPreviousAnnotation.label= Go to Previous Annotation
-goToPreviousAnnotation.tooltip= Go to Previous Annotation
-goToNextAnnotation.label= Go to Next Annotation
-goToNextAnnotation.tooltip= Go to Next Annotation
-
-errors.label= Errors
-warnings.label= Warnings
-infos.label= Infos
-tasks.label= Tasks
-bookmarks.label= Bookmarks
-changes.label= Diff Changes
-additions.label= Diff Additions
-deletions.label= Diff Deletions
diff --git a/org.eclipse.ui.editors/plugin.xml b/org.eclipse.ui.editors/plugin.xml
deleted file mode 100644
index 45350203773..00000000000
--- a/org.eclipse.ui.editors/plugin.xml
+++ /dev/null
@@ -1,491 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.ui.editors"
- name="%pluginName"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.ui.internal.editors.text.EditorsPlugin">
-
- <runtime>
- <library name="editors.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.ui.texteditor,org.eclipse.ui.editors.text,org.eclipse.ui.internal,org.eclipse.ui.internal.editors.quickdiff"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.runtime.compatibility" optional="true"/>
- <import plugin="org.eclipse.ui.ide"/>
- <import plugin="org.eclipse.ui.workbench.texteditor"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.jface.text"/>
- <import plugin="org.eclipse.core.filebuffers"/>
- <import plugin="org.eclipse.core.resources"/>
- </requires>
-
-
- <extension-point id="documentProviders" name="%ExtPoint.documentProviders" schema="schema/documentProviders.exsd"/>
- <extension-point id="markerUpdaters" name="%ExtPoint.markerUpdaters" schema="schema/markerUpdaters.exsd"/>
- <extension-point id="markerAnnotationSpecification" name="%ExtPoint.markerAnnotationSpecification" schema="schema/markerAnnotationSpecification.exsd"/>
- <extension-point id="annotationTypes" name="%ExtPoint.annotationTypes" schema="schema/annotationTypes.exsd"/>
-
- <extension
- point="org.eclipse.ui.commands">
- <command
- name="%command.us_ascii.name"
- description="%command.us_ascii.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.encoding.us-ascii">
- </command>
- <command
- name="%command.iso_8859_1.name"
- description="%command.iso_8859_1.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.encoding.iso-8859-1">
- </command>
- <command
- name="%command.utf_8.name"
- description="%command.utf_8.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.encoding.utf-8">
- </command>
- <command
- name="%command.utf_16be.name"
- description="%command.utf_16be.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.encoding.utf-16be">
- </command>
- <command
- name="%command.utf_16le.name"
- description="%command.utf_16le.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.encoding.utf-16le">
- </command>
- <command
- name="%command.utf_16.name"
- description="%command.utf_16.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.encoding.utf-16">
- </command>
- <command
- name="%command.system.name"
- description="%command.system.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.encoding.system">
- </command>
- <command
- name="%command.custom.name"
- description="%command.custom.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.encoding.custom">
- </command>
- <command
- name="%openExternalFile.label"
- category="org.eclipse.ui.category.file"
- description="%openExternalFile.description"
- id="org.eclipse.ui.edit.text.openExternalFile">
- </command>
- <command
- name="%ActionDefinition.quickDiff.name"
- category="org.eclipse.ui.category.edit"
- description="%ActionDefinition.quickDiff.description"
- id="org.eclipse.quickdiff.toggle">
- </command>
- <keyBinding
- string="Ctrl+Shift+Q"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.quickdiff.toggle"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- </extension>
- <extension
- point="org.eclipse.ui.editors">
- <editor
- name="%Editors.DefaultTextEditor"
- extensions="txt"
- icon="icons/full/obj16/file_obj.gif"
- class="org.eclipse.ui.editors.text.TextEditor"
- contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
- id="org.eclipse.ui.DefaultTextEditor">
- </editor>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%PreferencePages.TextEditor"
- category="org.eclipse.ui.preferencePages.Editors"
- class="org.eclipse.ui.internal.editors.text.TextEditorPreferencePage2"
- id="org.eclipse.ui.preferencePages.TextEditor">
- </page>
- </extension>
- <extension
- point="org.eclipse.ui.editors.documentProviders">
- <provider
- class="org.eclipse.ui.editors.text.TextFileDocumentProvider"
- inputTypes="org.eclipse.ui.IStorageEditorInput"
- id="org.eclipse.ui.editors.text.StorageDocumentProvider">
- </provider>
- </extension>
- <extension
- point="org.eclipse.ui.editors.documentProviders">
- <provider
- class="org.eclipse.ui.editors.text.TextFileDocumentProvider"
- inputTypes="org.eclipse.ui.internal.editors.text.JavaFileEditorInput"
- id="org.eclipse.ui.editors.text.ExternalFileDocumentProvider">
- </provider>
- </extension>
- <extension
- point="org.eclipse.ui.editors.markerUpdaters">
- <updater
- class="org.eclipse.ui.texteditor.BasicMarkerUpdater"
- id="org.eclipse.ui.texteditor.BasicMarkerUpdater">
- </updater>
- </extension>
- <extension
- point="org.eclipse.ui.workbench.texteditor.quickDiffReferenceProvider">
- <referenceprovider
- default="true"
- label="%lastSaveReferenceProvider.label"
- class="org.eclipse.ui.internal.editors.quickdiff.LastSaveReferenceProvider"
- id="org.eclipse.ui.internal.editors.quickdiff.LastSaveReferenceProvider">
- </referenceprovider>
- </extension>
- <extension
- point="org.eclipse.ui.popupMenus">
- <viewerContribution
- targetID="#TextRulerContext"
- id="org.eclipse.ui.texteditor.ruler.context.actions">
- <action
- label="%AddTask.label"
- helpContextId="org.eclipse.ui.AddTask_action_context"
- class="org.eclipse.ui.texteditor.TaskRulerAction"
- tooltip="%AddTask.tooltip"
- menubarPath="additions"
- id="org.eclipse.ui.texteditor.TaskRulerAction">
- </action>
- <action
- label="%AddBookmark.label"
- helpContextId="org.eclipse.ui.bookmark_action_context"
- class="org.eclipse.ui.texteditor.BookmarkRulerAction"
- tooltip="%AddBookmark.tooltip"
- menubarPath="additions"
- id="org.eclipse.ui.texteditor.BookmarkRulerAction">
- </action>
- <action
- label="%quickdiff.toggle.enable"
- style="push"
- helpContextId="quickdiff.toggle"
- class="org.eclipse.ui.texteditor.quickdiff.QuickDiffToggleAction"
- menubarPath="quickdiff"
- id="quickdiff.toggle">
- </action>
- </viewerContribution>
- <viewerContribution
- targetID="#RulerContext"
- id="org.eclipse.ui.texteditor.ruler.context.actions">
- <action
- label="%AddTask.label"
- helpContextId="org.eclipse.ui.AddTask_action_context"
- class="org.eclipse.ui.texteditor.TaskRulerAction"
- tooltip="%AddTask.tooltip"
- menubarPath="additions"
- id="org.eclipse.ui.texteditor.TaskRulerAction">
- </action>
- <action
- label="%AddBookmark.label"
- helpContextId="org.eclipse.ui.bookmark_action_context"
- class="org.eclipse.ui.texteditor.BookmarkRulerAction"
- tooltip="%AddBookmark.tooltip"
- menubarPath="additions"
- id="org.eclipse.ui.texteditor.BookmarkRulerAction">
- </action>
- <action
- label="%quickdiff.toggle.enable"
- style="push"
- helpContextId="quickdiff.toggle"
- class="org.eclipse.ui.texteditor.quickdiff.QuickDiffToggleAction"
- menubarPath="quickdiff"
- id="quickdiff.toggle">
- </action>
- </viewerContribution>
- </extension>
- <extension
- point="org.eclipse.ui.editorActions">
- <editorContribution
- targetID="org.eclipse.ui.DefaultTextEditor"
- id="org.eclipse.ui.texteditor.ruler.actions">
- <action
- label="%Dummy.label"
- helpContextId="org.eclipse.ui.bookmark_action_context"
- class="org.eclipse.ui.texteditor.BookmarkRulerAction"
- actionID="RulerDoubleClick"
- id="org.eclipse.ui.texteditor.BookmarkRulerAction">
- </action>
- <action
- label="%Dummy.label"
- class="org.eclipse.ui.texteditor.SelectRulerAction"
- actionID="RulerClick"
- id="org.eclipse.ui.texteditor.SelectRulerAction">
- </action>
- </editorContribution>
- <editorContribution
- targetID="org.eclipse.ui.DefaultTextEditor"
- id="org.eclipse.quickdiff.editoractions.texteditor">
- <action
- definitionId="org.eclipse.quickdiff.toggle"
- label="%quickdiff.toggle.enable"
- class="org.eclipse.ui.texteditor.quickdiff.QuickDiffToggleAction"
- id="org.eclipse.ui.texteditor.quickdiff.QuickDiffToggleAction">
- </action>
- </editorContribution>
- </extension>
- <extension
- point="org.eclipse.ui.actionSets">
- <actionSet
- label="%openExternalFileActionSet.label"
- visible="true"
- id="org.eclipse.ui.edit.text.actionSet.openExternalFile">
- <action
- definitionId="org.eclipse.ui.edit.text.openExternalFile"
- label="%openExternalFile.label"
- helpContextId="open_text_editor_action_context"
- class="org.eclipse.ui.internal.editors.text.OpenExternalFileAction"
- tooltip="%openExternalFile.description"
- menubarPath="file/new.ext"
- id="org.eclipse.ui.edit.text.openExternalFile">
- </action>
- </actionSet>
- <actionSet
- label="%textEditorAnnotationNavigationActionSet.label"
- visible="false"
- id="org.eclipse.ui.edit.text.actionSet.annotationNavigation">
- <action
- allowLabelUpdate="true"
- style="pulldown"
- id="org.eclipse.ui.edit.text.gotoPreviousAnnotation"
- toolbarPath="org.eclipse.ui.workbench.navigate/history.group"
- hoverIcon="icons/full/ctool16/prev_nav.gif"
- class="org.eclipse.ui.internal.editors.text.PreviousPulldownActionDelegate"
- definitionId="org.eclipse.ui.navigate.previous"
- disabledIcon="icons/full/dtool16/prev_nav.gif"
- icon="icons/full/etool16/prev_nav.gif"
- label="%goToPreviousAnnotation.label"
- retarget="true"
- tooltip="%goToPreviousAnnotation.tooltip">
- </action>
- <action
- allowLabelUpdate="true"
- style="pulldown"
- id="org.eclipse.ui.edit.text.gotoNextAnnotation"
- toolbarPath="org.eclipse.ui.workbench.navigate/history.group"
- hoverIcon="icons/full/ctool16/next_nav.gif"
- class="org.eclipse.ui.internal.editors.text.NextPulldownActionDelegate"
- definitionId="org.eclipse.ui.navigate.next"
- disabledIcon="icons/full/dtool16/next_nav.gif"
- icon="icons/full/etool16/next_nav.gif"
- label="%goToNextAnnotation.label"
- retarget="true"
- tooltip="%goToNextAnnotation.tooltip">
- </action>
- </actionSet>
- </extension>
- <extension
- point="org.eclipse.ui.editors.markerAnnotationSpecification">
- <specification
- annotationType="org.eclipse.ui.workbench.texteditor.error"
- textPreferenceKey="errorIndication"
- presentationLayer="6"
- highlightPreferenceValue="false"
- showInNextPrevDropdownToolbarAction="true"
- textPreferenceValue="true"
- isGoToPreviousNavigationTargetKey="isErrorGoToPreviousNavigationTarget"
- label="%errors.label"
- colorPreferenceKey="errorIndicationColor"
- showInNextPrevDropdownToolbarActionKey="showErrorInNextPrevDropdownToolbarAction"
- symbolicIcon="error"
- isGoToNextNavigationTargetKey="isErrorGoToNextNavigationTarget"
- isGoToNextNavigationTarget="true"
- overviewRulerPreferenceKey="errorIndicationInOverviewRuler"
- verticalRulerPreferenceValue="true"
- highlightPreferenceKey="errorIndicationHighlighting"
- isGoToPreviousNavigationTarget="true"
- verticalRulerPreferenceKey="errorIndicationInVerticalRuler"
- contributesToHeader="true"
- colorPreferenceValue="255,0,128"
- overviewRulerPreferenceValue="true">
- </specification>
- <specification
- annotationType="org.eclipse.ui.workbench.texteditor.warning"
- textPreferenceKey="warningIndication"
- presentationLayer="5"
- highlightPreferenceValue="false"
- showInNextPrevDropdownToolbarAction="true"
- textPreferenceValue="true"
- isGoToPreviousNavigationTargetKey="isWarningGoToPreviousNavigationTarget"
- label="%warnings.label"
- colorPreferenceKey="warningIndicationColor"
- showInNextPrevDropdownToolbarActionKey="showWarningInNextPrevDropdownToolbarAction"
- symbolicIcon="warning"
- isGoToNextNavigationTargetKey="isWarningGoToNextNavigationTarget"
- isGoToNextNavigationTarget="true"
- overviewRulerPreferenceKey="warningIndicationInOverviewRuler"
- verticalRulerPreferenceValue="true"
- highlightPreferenceKey="warningIndicationHighlighting"
- isGoToPreviousNavigationTarget="true"
- verticalRulerPreferenceKey="warningIndicationInVerticalRuler"
- contributesToHeader="true"
- colorPreferenceValue="244,200,45"
- overviewRulerPreferenceValue="true">
- </specification>
- <specification
- annotationType="org.eclipse.ui.workbench.texteditor.info"
- textPreferenceKey="infoIndication"
- presentationLayer="4"
- highlightPreferenceValue="false"
- showInNextPrevDropdownToolbarAction="true"
- textPreferenceValue="false"
- isGoToPreviousNavigationTargetKey="isInfoGoToPreviousNavigationTarget"
- label="%infos.label"
- colorPreferenceKey="infoIndicationColor"
- showInNextPrevDropdownToolbarActionKey="showInfoInNextPrevDropdownToolbarAction"
- symbolicIcon="info"
- isGoToNextNavigationTargetKey="isInfoGoToNextNavigationTarget"
- isGoToNextNavigationTarget="false"
- overviewRulerPreferenceKey="infoIndicationInOverviewRuler"
- verticalRulerPreferenceValue="true"
- highlightPreferenceKey="infoIndicationHighlighting"
- isGoToPreviousNavigationTarget="false"
- verticalRulerPreferenceKey="infoIndicationInVerticalRuler"
- contributesToHeader="false"
- colorPreferenceValue="244,200,45"
- overviewRulerPreferenceValue="true">
- </specification>
- <specification
- annotationType="org.eclipse.ui.workbench.texteditor.task"
- textPreferenceKey="taskIndication"
- presentationLayer="2"
- highlightPreferenceValue="false"
- showInNextPrevDropdownToolbarAction="true"
- textPreferenceValue="false"
- isGoToPreviousNavigationTargetKey="isTaskGoToPreviousNavigationTarget"
- label="%tasks.label"
- colorPreferenceKey="taskIndicationColor"
- showInNextPrevDropdownToolbarActionKey="showTaskInNextPrevDropdownToolbarAction"
- symbolicIcon="task"
- isGoToNextNavigationTargetKey="isTaskGoToNextNavigationTarget"
- isGoToNextNavigationTarget="false"
- overviewRulerPreferenceKey="taskIndicationInOverviewRuler"
- verticalRulerPreferenceValue="true"
- highlightPreferenceKey="taskIndicationHighlighting"
- isGoToPreviousNavigationTarget="false"
- verticalRulerPreferenceKey="taskIndicationInVerticalRuler"
- contributesToHeader="false"
- colorPreferenceValue="0,128,255"
- overviewRulerPreferenceValue="true">
- </specification>
- <specification
- annotationType="org.eclipse.ui.workbench.texteditor.bookmark"
- textPreferenceKey="bookmarkIndication"
- presentationLayer="1"
- highlightPreferenceValue="false"
- showInNextPrevDropdownToolbarAction="true"
- textPreferenceValue="false"
- isGoToPreviousNavigationTargetKey="isBookmarkGoToPreviousNavigationTarget"
- label="%bookmarks.label"
- colorPreferenceKey="bookmarkIndicationColor"
- showInNextPrevDropdownToolbarActionKey="showBookmarkInNextPrevDropdownToolbarAction"
- symbolicIcon="bookmark"
- isGoToNextNavigationTargetKey="isBookmarkGoToNextNavigationTarget"
- isGoToNextNavigationTarget="false"
- overviewRulerPreferenceKey="bookmarkIndicationInOverviewRuler"
- verticalRulerPreferenceValue="true"
- highlightPreferenceKey="bookmarkIndicationHighlighting"
- isGoToPreviousNavigationTarget="false"
- verticalRulerPreferenceKey="bookmarkIndicationInVerticalRuler"
- contributesToHeader="false"
- colorPreferenceValue="34,164,99"
- overviewRulerPreferenceValue="true">
- </specification>
- <specification
- annotationType="org.eclipse.ui.workbench.texteditor.quickdiffChange"
- colorPreferenceValue="204,163,205"
- isGoToPreviousNavigationTarget="false"
- isGoToPreviousNavigationTargetKey="isChangeGoToPreviousNavigationTarget"
- showInNextPrevDropdownToolbarAction="true"
- isGoToNextNavigationTarget="false"
- isGoToNextNavigationTargetKey="isChangeGoToNextNavigationTarget"
- colorPreferenceKey="changeIndicationColor"
- showInNextPrevDropdownToolbarActionKey="showChangeInNextPrevDropdownToolbarAction"
- contributesToHeader="false"
- overviewRulerPreferenceValue="false"
- presentationLayer="2"
- label="%changes.label"
- textPreferenceValue="false"
- textPreferenceKey="changeIndication"
- overviewRulerPreferenceKey="changeIndicationInOverviewRuler">
- </specification>
- <specification
- annotationType="org.eclipse.ui.workbench.texteditor.quickdiffAddition"
- colorPreferenceValue="188,188,222"
- isGoToPreviousNavigationTarget="false"
- isGoToPreviousNavigationTargetKey="isAdditionGoToPreviousNavigationTarget"
- showInNextPrevDropdownToolbarAction="false"
- isGoToNextNavigationTarget="false"
- isGoToNextNavigationTargetKey="isAdditionGoToNextNavigationTarget"
- colorPreferenceKey="additionIndicationColor"
- showInNextPrevDropdownToolbarActionKey="showAdditionInNextPrevDropdownToolbarAction"
- contributesToHeader="false"
- overviewRulerPreferenceValue="false"
- presentationLayer="2"
- label="%additions.label"
- textPreferenceValue="false"
- textPreferenceKey="additionIndication"
- overviewRulerPreferenceKey="additionIndicationInOverviewRuler">
- </specification>
- <specification
- annotationType="org.eclipse.ui.workbench.texteditor.quickdiffDeletion"
- colorPreferenceValue="0,0,0"
- isGoToPreviousNavigationTarget="false"
- isGoToPreviousNavigationTargetKey="isDeletionGoToPreviousNavigationTarget"
- showInNextPrevDropdownToolbarAction="false"
- isGoToNextNavigationTarget="false"
- isGoToNextNavigationTargetKey="isDeletionGoToNextNavigationTarget"
- colorPreferenceKey="deletionIndicationColor"
- showInNextPrevDropdownToolbarActionKey="showDeletionInNextPrevDropdownToolbarAction"
- contributesToHeader="false"
- overviewRulerPreferenceValue="false"
- presentationLayer="2"
- label="%deletions.label"
- textPreferenceValue="false"
- textPreferenceKey="deletionIndication"
- overviewRulerPreferenceKey="deletionIndicationInOverviewRuler">
- </specification>
- </extension>
-
- <extension point="org.eclipse.ui.editors.annotationTypes">
- <type
- name="org.eclipse.ui.workbench.texteditor.error"
- markerType="org.eclipse.core.resources.problemmarker"
- markerSeverity="2">
- </type>
- <type
- name="org.eclipse.ui.workbench.texteditor.warning"
- markerType="org.eclipse.core.resources.problemmarker"
- markerSeverity="1">
- </type>
- <type
- name="org.eclipse.ui.workbench.texteditor.info"
- markerType="org.eclipse.core.resources.problemmarker"
- markerSeverity="0">
- </type>
- <type
- name="org.eclipse.ui.workbench.texteditor.task"
- markerType="org.eclipse.core.resources.taskmarker">
- </type>
- <type
- name="org.eclipse.ui.workbench.texteditor.bookmark"
- markerType="org.eclipse.core.resources.bookmark">
- </type>
- </extension>
-
-</plugin>
diff --git a/org.eclipse.ui.editors/schema/annotationTypes.exsd b/org.eclipse.ui.editors/schema/annotationTypes.exsd
deleted file mode 100644
index ab02975372b..00000000000
--- a/org.eclipse.ui.editors/schema/annotationTypes.exsd
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ui.editors">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.ui.editors" id="annotationTypes" name="Annotation Types"/>
- </appInfo>
- <documentation>
- [Enter description of this extension point.]
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="type"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <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>
- </complexType>
- </element>
-
- <element name="type">
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="markerType" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="super" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="markerSeverity">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="0">
- </enumeration>
- <enumeration value="1">
- </enumeration>
- <enumeration value="2">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.ui.editors/schema/documentProviders.exsd b/org.eclipse.ui.editors/schema/documentProviders.exsd
deleted file mode 100644
index 3dce37c4766..00000000000
--- a/org.eclipse.ui.editors/schema/documentProviders.exsd
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ui.editors">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.ui.editors" id="documentProviders" name="Document Providers"/>
- </appInfo>
- <documentation>
- This extension point is used to define mappings between file types and document providers or between types of editor inputs and document providers that can be used by editors. Document providers must implement the interface &lt;samp&gt;org.eclipse.ui.texteditor.IDocumentProvider&lt;/samp&gt;. Editor inputs must be instance of &lt;samp&gt;org.eclipse.ui.IEditorInput&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="provider" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="provider">
- <complexType>
- <attribute name="extensions" type="string">
- <annotation>
- <documentation>
- a comma separated list of file extensions
- </documentation>
- </annotation>
- </attribute>
- <attribute name="inputTypes" type="string">
- <annotation>
- <documentation>
- a comma separated list of qualified editor input class names
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- the qualified name of the document provider class
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- the unique id of this provider
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0 (originally named org.eclipse.ui.documentProviders)
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- &lt;pre&gt;
-&lt;extension point=&quot;org.eclipse.ui.editors.documentProviders&quot;&gt;
- &lt;provider
- extensions=&quot;.jav&quot;
- class=&quot;org.eclipse.ui.examples.javaeditor.JavaDocumentProvider&quot;
- id=&quot;org.eclipse.ui.examples.javaeditor.JavaDocumentProvider&quot;&gt;
- &lt;/provider&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;p&gt;
-This example registers &lt;samp&gt;org.eclipse.ui.examples.javaeditor.JavaDocumentProvider&lt;/samp&gt; as the default provider for files with the extension &quot;.jav&quot;.
-&lt;p&gt;
-&lt;pre&gt;
-&lt;extension point=&quot;org.eclipse.ui.editors.documentProviders&quot;&gt;
- &lt;provider
- inputTypes=&quot;org.eclipse.ui.IStorageEditorInput&quot;
- class=&quot;org.eclipse.ui.editors.text.FileDocumentProvider&quot;
- id=&quot;org.eclipse.ui.editors.text.FileDocumentProvider&quot;&gt;
- &lt;/provider&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
-This example registers &lt;samp&gt;org.eclipse.ui.editors.text.FileDocumentProvider&lt;/samp&gt; as the default provider for all editor inputs that are &lt;samp&gt;instance of org.eclipse.ui.IStorageEditorInput&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Document providers registered for a file extension have precedence over those registered for input types. Document providers must implement the interface &lt;samp&gt;org.eclipse.ui.texteditor.IDocumentProvider&lt;/samp&gt;. Editor inputs must be instance of &lt;samp&gt;org.eclipse.ui.IEditorInput&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;a href=&quot;hglegal.htm&quot;&gt;
-&lt;img SRC=&quot;ngibmcpy.gif&quot; ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot; BORDER=0 height=14 width=324&gt;
-&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.ui.editors/schema/markerAnnotationSpecification.exsd b/org.eclipse.ui.editors/schema/markerAnnotationSpecification.exsd
deleted file mode 100644
index ef5d7d89c36..00000000000
--- a/org.eclipse.ui.editors/schema/markerAnnotationSpecification.exsd
+++ /dev/null
@@ -1,309 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ui.editors">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.ui.editors" id="markerAnnotationSpecification" name="Marker Annotation Specification"/>
- </appInfo>
- <documentation>
- This extension point is used to define presentation properties of markers. Extensions provided for this extension point can be accessed using org.eclipse.ui.texteditor.MarkerAnnotationPreferences.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="specification"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <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>
- </complexType>
- </element>
-
- <element name="specification">
- <complexType>
- <attribute name="annotationType" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="colorPreferenceKey" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="overviewRulerPreferenceKey" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="verticalRulerPreferenceKey" type="string">
- <annotation>
- <documentation>
- The preference key for the show in vertical ruler preference.
-since: 3.0
- </documentation>
- </annotation>
- </attribute>
- <attribute name="textPreferenceKey" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="label" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="highlightPreferenceKey" type="string">
- <annotation>
- <documentation>
- The preference key for highlighting in text.
-since: 3.0
- </documentation>
- </annotation>
- </attribute>
- <attribute name="markerType" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="colorPreferenceValue" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="markerSeverity">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="0">
- </enumeration>
- <enumeration value="1">
- </enumeration>
- <enumeration value="2">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="presentationLayer" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="overviewRulerPreferenceValue" type="boolean">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="verticalRulerPreferenceValue" type="boolean">
- <annotation>
- <documentation>
- The default value for showing in vertical ruler.
-since: 3.0
- </documentation>
- </annotation>
- </attribute>
- <attribute name="textPreferenceValue" type="boolean">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="highlightPreferenceValue" type="boolean">
- <annotation>
- <documentation>
- The default value for highlighting in text.
-since: 3.0
- </documentation>
- </annotation>
- </attribute>
- <attribute name="contributesToHeader" type="boolean">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="showInNextPrevDropdownToolbarActionKey" type="string">
- <annotation>
- <documentation>
- The preference key for the visibility in the next/previous drop down toolbar action.
-since: 3.0
- </documentation>
- </annotation>
- </attribute>
- <attribute name="showInNextPrevDropdownToolbarAction" type="boolean">
- <annotation>
- <documentation>
- The default value for the visibility in the next/previous drop down toolbar action.
-since: 3.0
- </documentation>
- </annotation>
- </attribute>
- <attribute name="isGoToNextNavigationTargetKey" type="string">
- <annotation>
- <documentation>
- The preference key for go to next navigation enablement.
-since: 3.0
- </documentation>
- </annotation>
- </attribute>
- <attribute name="isGoToNextNavigationTarget" type="boolean">
- <annotation>
- <documentation>
- The default value for go to next navigation enablement.
-since: 3.0
- </documentation>
- </annotation>
- </attribute>
- <attribute name="isGoToPreviousNavigationTargetKey" type="string">
- <annotation>
- <documentation>
- The preference key for go to previous navigation enablement.
-since: 3.0
- </documentation>
- </annotation>
- </attribute>
- <attribute name="isGoToPreviousNavigationTarget" type="boolean">
- <annotation>
- <documentation>
- The default value for go to previous navigation enablement.
-since: 3.0
- </documentation>
- </annotation>
- </attribute>
- <attribute name="icon" type="string">
- <annotation>
- <documentation>
- The path to the icon to be drawn for annotations of this annotation type.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="symbolicIcon">
- <annotation>
- <documentation>
- The symbolic name of the image that should be drawn to represent annotation of this annotation type. The image is only used when there is no vertical ruler icon specified for this annotation type. Possible values are: &quot;error&quot;, &quot;warning&quot;, &quot;info&quot;, &quot;task&quot;, &quot;bookmark&quot;.
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="error">
- </enumeration>
- <enumeration value="warning">
- </enumeration>
- <enumeration value="info">
- </enumeration>
- <enumeration value="task">
- </enumeration>
- <enumeration value="bookmark">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="annotationImageProvider" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0 (originally named org.eclipse.ui.workbench.texteditor.markerAnnotationSpecification)
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.ui.editors/schema/markerUpdaters.exsd b/org.eclipse.ui.editors/schema/markerUpdaters.exsd
deleted file mode 100644
index a6e9953f6d2..00000000000
--- a/org.eclipse.ui.editors/schema/markerUpdaters.exsd
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ui.editors">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.ui.editors" id="markerUpdaters" name="Marker Updaters"/>
- </appInfo>
- <documentation>
- This extension point is used for registering marker update strategies with marker annotation models. A resource that is opened in a text editor is associated with a marker annotation model. For each marker attached to the resource this model manages a position that is updated with each change applied to the text in the editor. If the resource is saved, the text in the editor and the position managed for a marker are passed over to the registered marker update strategies. These strategies can then update the marker&apos;s attributes based on the text and the position. Marker update strategies are requested to implement the interface &lt;samp&gt;org.eclipse.ui.texteditor.IMarkerUpdater&lt;/samp&gt;. The update strategies can be registered either for a particular marker type or all marker types. The latter by omitting any marker type in the extension.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="updater" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="updater">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- the unique id of this provider
- </documentation>
- </annotation>
- </attribute>
- <attribute name="markerType" type="string">
- <annotation>
- <documentation>
- the name of the marker type
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- the qualified name of the marker updater class
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0 (originally named org.eclipse.ui.markerUpdaters)
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- &lt;pre&gt;
-&lt;extension point= &quot;org.eclipse.ui.editors.markerUpdaters&quot;&gt;
- &lt;updater
- id=&quot;org.eclipse.jdt.ui.markerUpdaters.JavaSearchMarkerUpdater&quot;
- class=&quot;org.eclipse.jdt.internal.ui.search.JavaSearchMarkerUpdater&quot;
- markerType=&quot;org.eclipse.search.searchmarker&quot;&gt;
- &lt;/updater&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;p&gt;
-This example registers &lt;samp&gt;org.eclipse.jdt.internal.ui.search.JavaSearchMarkerUpdater&lt;/samp&gt; as a marker updater for all markers of the
-type &lt;samp&gt;org.eclipse.search.searchmarker&lt;/samp&gt; including all its derived types.
-&lt;/p&gt;
-&lt;pre&gt;
-&lt;extension point= &quot;org.eclipse.ui.editors.markerUpdaters&quot;&gt;
- &lt;updater
- id=&quot;org.eclipse.ui.texteditor.BasicMarkerUpdater&quot;
- class=&quot;org.eclipse.ui.texteditor.BasicMarkerUpdater&quot;&gt;
- &lt;/updater&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;p&gt;
-This example registers &lt;samp&gt;org.eclipse.ui.texteditor.BasicMarkerUpdater&lt;/samp&gt; as a marker updater independent from the type of the marker.
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Registered marker updaters have to implement the interface &lt;samp&gt;org.eclipse.ui.texteditor.IMarkerUpdater&lt;/samp&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.ui.editors/scripts/exportplugin.xml b/org.eclipse.ui.editors/scripts/exportplugin.xml
deleted file mode 100644
index 4448589d992..00000000000
--- a/org.eclipse.ui.editors/scripts/exportplugin.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<project name="Default Text Editor" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.ui.editors" />
- <property name="version" value="_3.0.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}/editors.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <copy todir= "${dest}/icons">
- <fileset dir="icons"/>
- </copy>
- <zip zipfile="${dest}/editorssrc.zip">
- <fileset dir="src" />
- </zip>
- </target>
-</project>
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/DefaultEncodingSupport.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/DefaultEncodingSupport.java
deleted file mode 100644
index f30cc558266..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/DefaultEncodingSupport.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.ui.editors.text;
-
-
-import java.io.CharConversionException;
-import java.io.UnsupportedEncodingException;
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Preferences;
-
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.StatusTextEditor;
-
-
-
-/**
- * The standard implementation of <code>IEncodingSupport</code>.
- * @since 2.0
- */
-public class DefaultEncodingSupport implements IEncodingSupport {
-
- /** Internal property change listener. */
- private Preferences.IPropertyChangeListener fPropertyChangeListener;
- /** The editor this support is associated with. */
- private StatusTextEditor fTextEditor;
- /** The action group of this support. */
- private EncodingActionGroup fEncodingActionGroup;
-
- /**
- * Creates a new encoding support.
- */
- public DefaultEncodingSupport() {
- super();
- }
-
- /**
- * Associates this encoding support to the given text editor and initializes this encoding.
- *
- * @param textEditor the editor
- */
- public void initialize(StatusTextEditor textEditor) {
-
- fTextEditor= textEditor;
-
- fPropertyChangeListener= new Preferences.IPropertyChangeListener() {
- public void propertyChange(Preferences.PropertyChangeEvent e) {
- if (ResourcesPlugin.PREF_ENCODING.equals(e.getProperty()))
- setEncoding(null, false); // null means: use default
- }
- };
-
- Preferences p= ResourcesPlugin.getPlugin().getPluginPreferences();
- p.addPropertyChangeListener(fPropertyChangeListener);
-
- fEncodingActionGroup= new EncodingActionGroup(fTextEditor);
- fEncodingActionGroup.update();
- }
-
- /**
- * Disposes this encoding support.
- */
- public void dispose() {
- Preferences p= ResourcesPlugin.getPlugin().getPluginPreferences();
- p.removePropertyChangeListener(fPropertyChangeListener);
-
- fEncodingActionGroup.dispose();
- fEncodingActionGroup= null;
-
- fTextEditor= null;
- }
-
- /**
- * Resets this encoding support. Should be called if, e.g., the input element of the
- * associated editor changed.
- */
- public void reset() {
- fEncodingActionGroup.update();
- }
-
- /**
- * Sets the encoding of the editor's input to the given value. If <code>overwrite</code> is
- * <code>true</code> the value is set even if the encoding is already set.
- *
- * @param encoding the new encoding
- * @param overwrite <code>true</code> if current encoding should be overwritten
- */
- protected void setEncoding(String encoding, boolean overwrite) {
- IDocumentProvider p= fTextEditor.getDocumentProvider();
- if (p instanceof IStorageDocumentProvider) {
- IEditorInput input= fTextEditor.getEditorInput();
- IStorageDocumentProvider provider= (IStorageDocumentProvider)p;
- String current= provider.getEncoding(input);
- String defaultEncoding= provider.getDefaultEncoding();
-
- if (current != null && current.equals(defaultEncoding))
- provider.setEncoding(input, encoding);
-
- else if (!fTextEditor.isDirty()) {
- String internal= encoding == null ? "" : encoding; //$NON-NLS-1$
- boolean apply= (overwrite || current == null) && !internal.equals(current);
- if (apply) {
- provider.setEncoding(fTextEditor.getEditorInput(), encoding);
- Runnable encodingSetter=
- new Runnable() {
- public void run() {
- fTextEditor.doRevertToSaved();
- fTextEditor.updatePartControl(fTextEditor.getEditorInput());
- }
- };
- Display display= fTextEditor.getSite().getShell().getDisplay();
- if (display != null && !display.isDisposed())
- BusyIndicator.showWhile(display, encodingSetter);
- else
- encodingSetter.run();
- }
- }
- fEncodingActionGroup.update();
- }
- }
-
- /*
- * @see IEncodingSupport#setEncoding(String)
- */
- public void setEncoding(String encoding) {
- setEncoding(encoding, true);
- }
-
- /*
- * @see IEncodingSupport#getEncoding()
- */
- public String getEncoding() {
- IDocumentProvider p= fTextEditor.getDocumentProvider();
- if (p instanceof IStorageDocumentProvider) {
- IStorageDocumentProvider provider= (IStorageDocumentProvider) p;
- return provider.getEncoding(fTextEditor.getEditorInput());
- }
- return null;
- }
-
- /*
- * @see IEncodingSupport#getDefaultEncoding()
- */
- public String getDefaultEncoding() {
- IDocumentProvider p= fTextEditor.getDocumentProvider();
- if (p instanceof IStorageDocumentProvider) {
- IStorageDocumentProvider provider= (IStorageDocumentProvider) p;
- return provider.getDefaultEncoding();
- }
- return null;
- }
-
- /**
- * Returns a status header for the given status.
- *
- * @param status the status
- * @return a status header for the given status.
- */
- public String getStatusHeader(IStatus status) {
- Throwable t= status.getException();
-
- if (t instanceof CharConversionException)
- return TextEditorMessages.getString("Editor.error.unreadable_encoding.header"); //$NON-NLS-1$
-
- if (t instanceof UnsupportedEncodingException)
- return TextEditorMessages.getString("Editor.error.unsupported_encoding.header"); //$NON-NLS-1$
-
- return null;
- }
-
- /**
- * Returns a banner for the given status.
- *
- * @param status the status
- * @return a banner for the given status.
- */
- public String getStatusBanner(IStatus status) {
- Throwable t= status.getException();
-
- if (t instanceof CharConversionException)
- return TextEditorMessages.getString("Editor.error.unreadable_encoding.banner"); //$NON-NLS-1$
-
- if (t instanceof UnsupportedEncodingException)
- return TextEditorMessages.getString("Editor.error.unsupported_encoding.banner"); //$NON-NLS-1$
-
- return null;
-
- }
-
- /**
- * Returns a status message if any.
- *
- * @param status the status
- * @return a status message indicating encoding problems or <code>null</code> otherwise
- */
- public String getStatusMessage(IStatus status) {
- Throwable t= status.getException();
- if (t instanceof CharConversionException || t instanceof UnsupportedEncodingException) {
-
- String encoding= getEncoding();
- if (encoding == null)
- encoding= getDefaultEncoding();
-
- if (t instanceof CharConversionException) {
- if (encoding != null)
- return MessageFormat.format(TextEditorMessages.getString("Editor.error.unreadable_encoding.message_arg"), new Object[] { encoding }); //$NON-NLS-1$
- return TextEditorMessages.getString("Editor.error.unreadable_encoding.message"); //$NON-NLS-1$
- }
-
- if (t instanceof UnsupportedEncodingException) {
- if (encoding != null)
- return MessageFormat.format(TextEditorMessages.getString("Editor.error.unsupported_encoding.message_arg"), new Object[] { encoding }); //$NON-NLS-1$
- return TextEditorMessages.getString("Editor.error.unsupported_encoding.message"); //$NON-NLS-1$
- }
- }
-
- return null;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java
deleted file mode 100644
index 216d7bd4f63..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java
+++ /dev/null
@@ -1,393 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.editors.text;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.window.Window;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.ui.texteditor.ResourceAction;
-import org.eclipse.ui.texteditor.RetargetTextEditorAction;
-import org.eclipse.ui.texteditor.TextEditorAction;
-
-
-/**
- * Action group for encoding actions.
- * @since 2.0
- */
-public class EncodingActionGroup extends ActionGroup {
-
- /**
- * Action for setting the encoding of the editor to the value this action has
- * been initialized with.
- */
- static class PredefinedEncodingAction extends TextEditorAction {
-
- /** The target encoding of this action. */
- private String fEncoding;
- /** The action label. */
- private String fLabel;
- /** Indicates whether the target encoding is the default encoding. */
- private boolean fIsDefault;
-
- /**
- * Creates a new action for the given specification.
- *
- * @param bundle the resource bundle
- * @param prefix the prefix for lookups from the resource bundle
- * @param encoding the target encoding
- * @param editor the target editor
- */
- public PredefinedEncodingAction(ResourceBundle bundle, String prefix, String encoding, ITextEditor editor) {
- super(bundle, prefix, editor);
- fEncoding= encoding;
- if (prefix == null)
- setText(encoding);
- fLabel= getText();
- }
-
- /**
- * Creates a new action for the given specification.
- *
- * @param bundle the resource bundle
- * @param encoding the target encoding
- * @param editor the target editor
- */
- public PredefinedEncodingAction(ResourceBundle bundle, String encoding, ITextEditor editor) {
- super(bundle, null, editor);
- fEncoding= encoding;
- setText(encoding);
- fLabel= getText();
- }
-
- /**
- * Returns the encoding support of the action's editor.
- *
- * @return the encoding support of the action's editor or <code>null</code> if none
- */
- private IEncodingSupport getEncodingSupport() {
- ITextEditor editor= getTextEditor();
- if (editor != null)
- return (IEncodingSupport) editor.getAdapter(IEncodingSupport.class);
- return null;
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- IEncodingSupport s= getEncodingSupport();
- if (s != null)
- s.setEncoding(fIsDefault ? null : fEncoding);
- }
-
- /**
- * Returns the encoding currently used in the given editor.
- *
- * @param editor the editor
- * @return the encoding currently used in the given editor or <code>null</code> if no encoding support is installed
- */
- private String getEncoding(ITextEditor editor) {
- IEncodingSupport s= getEncodingSupport();
- if (s != null)
- return s.getEncoding();
- return null;
- }
-
- /**
- * Returns the default encoding for the given editor.
- *
- * @param editor the editor
- * @return the default encoding for the given editor or <code>null</code> if no encoding support is installed
- */
- private String getDefaultEncoding(ITextEditor editor) {
- IEncodingSupport s= getEncodingSupport();
- if (s != null)
- return s.getDefaultEncoding();
- return null;
- }
-
- /*
- * @see IUpdate#update()
- */
- public void update() {
-
- if (fEncoding == null) {
- setEnabled(false);
- return;
- }
-
- ITextEditor editor= getTextEditor();
- if (editor == null) {
- setEnabled(false);
- return;
- }
-
- // update label
- String encoding= getDefaultEncoding(editor);
- if (encoding != null) {
- fIsDefault= fEncoding.equals(encoding);
- setText(fIsDefault ? fLabel + DEFAULT_SUFFIX : fLabel);
- }
-
- // update enable state
- if (editor.isDirty())
- setEnabled(false);
- else
- setEnabled(true);
-
- // update checked state
- String current= getEncoding(editor);
- if (fIsDefault)
- setChecked(current == null);
- else
- setChecked(fEncoding.equals(current));
- }
- }
-
- /**
- * Sets the encoding of an editor to the value that has interactively been defined.
- */
- static class CustomEncodingAction extends TextEditorAction {
-
-
- /*
- * @see org.eclipse.ui.texteditor.TextEditorAction#TextEditorAction(ResourceBundle, String, ITextEditor)
- */
- protected CustomEncodingAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
- super(bundle, prefix, editor);
- }
-
- /*
- * @see IUpdate#update()
- */
- public void update() {
- ITextEditor editor= getTextEditor();
- setEnabled(editor != null && !editor.isDirty());
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
-
- ITextEditor editor= getTextEditor();
- if (editor == null)
- return;
-
- IEncodingSupport encodingSupport= (IEncodingSupport) editor.getAdapter(IEncodingSupport.class);
- if (encodingSupport == null)
- return;
-
- String title= TextEditorMessages.getString("Editor.ConvertEncoding.Custom.dialog.title"); //$NON-NLS-1$
- String message= TextEditorMessages.getString("Editor.ConvertEncoding.Custom.dialog.message"); //$NON-NLS-1$
- IInputValidator inputValidator = new IInputValidator() {
- public String isValid(String newText) {
- return (newText == null || newText.length() == 0) ? " " : null; //$NON-NLS-1$
- }
- };
-
- String initialValue= encodingSupport.getEncoding();
- if (initialValue == null)
- initialValue= encodingSupport.getDefaultEncoding();
- if (initialValue == null)
- initialValue= ""; //$NON-NLS-1$
-
- InputDialog d= new InputDialog(editor.getSite().getShell(), title, message, initialValue, inputValidator); //$NON-NLS-1$
- if (d.open() == Window.OK)
- encodingSupport.setEncoding(d.getValue());
- }
- }
-
-
- /** Suffix added to the default encoding action. */
- private static final String DEFAULT_SUFFIX= " " + TextEditorMessages.getString("Editor.ConvertEncoding.default_suffix"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /** List of predefined encodings. */
- private static final String[][] ENCODINGS;
-
- /** The default encoding. */
- private static final String SYSTEM_ENCODING;
-
- /**
- * Initializer: computes the set of predefined encoding actions.
- */
- static {
-
- String[][] encodings= {
- { IEncodingActionsConstants.US_ASCII, IEncodingActionsHelpContextIds.US_ASCII, IEncodingActionsDefinitionIds.US_ASCII },
- { IEncodingActionsConstants.ISO_8859_1, IEncodingActionsHelpContextIds.ISO_8859_1, IEncodingActionsDefinitionIds.ISO_8859_1 },
- { IEncodingActionsConstants.UTF_8, IEncodingActionsHelpContextIds.UTF_8, IEncodingActionsDefinitionIds.UTF_8 },
- { IEncodingActionsConstants.UTF_16BE, IEncodingActionsHelpContextIds.UTF_16BE, IEncodingActionsDefinitionIds.UTF_16BE },
- { IEncodingActionsConstants.UTF_16LE, IEncodingActionsHelpContextIds.UTF_16LE, IEncodingActionsDefinitionIds.UTF_16LE },
- { IEncodingActionsConstants.UTF_16, IEncodingActionsHelpContextIds.UTF_16, IEncodingActionsDefinitionIds.UTF_16 }
- };
-
- String system= System.getProperty("file.encoding"); //$NON-NLS-1$
- if (system != null) {
-
- int i;
- for (i= 0; i < encodings.length; i++) {
- if (encodings[i][0].equals(system))
- break;
- }
-
- if (i != encodings.length) {
- // bring default in first position
- String[] s= encodings[i];
- encodings[i]= encodings[0];
- encodings[0]= s;
- // forget default encoding as it's already in the list
- system= null;
- }
- }
-
- SYSTEM_ENCODING= system;
- ENCODINGS= encodings;
- }
-
-
-
- /** List of encoding actions of this group. */
- private List fRetargetActions= new ArrayList();
-
- /**
- * Creates a new encoding action group for an action bar contributor.
- */
- public EncodingActionGroup() {
-
- ResourceBundle b= TextEditorMessages.getResourceBundle();
-
- if (SYSTEM_ENCODING != null)
- fRetargetActions.add(new RetargetTextEditorAction(b, "Editor.ConvertEncoding.System.", IEncodingActionsConstants.SYSTEM, IAction.AS_RADIO_BUTTON)); //$NON-NLS-1$
-
- for (int i= 0; i < ENCODINGS.length; i++)
- fRetargetActions.add(new RetargetTextEditorAction(b, "Editor.ConvertEncoding." + ENCODINGS[i][0] + ".", ENCODINGS[i][0], IAction.AS_RADIO_BUTTON)); //$NON-NLS-1$ //$NON-NLS-2$
-
- fRetargetActions.add(new RetargetTextEditorAction(b, "Editor.ConvertEncoding.Custom.", IEncodingActionsConstants.CUSTOM, IAction.AS_PUSH_BUTTON)); //$NON-NLS-1$
- }
-
- /*
- * @see ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
- */
- public void fillActionBars(IActionBars actionBars) {
- IMenuManager menuManager= actionBars.getMenuManager();
- IMenuManager editMenu= menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
- if (editMenu != null) {
- MenuManager subMenu= new MenuManager(TextEditorMessages.getString("Editor.ConvertEncoding.submenu.label")); //$NON-NLS-1$
-
- Iterator e= fRetargetActions.iterator();
- while (e.hasNext())
- subMenu.add((IAction) e.next());
-
- editMenu.add(subMenu);
- }
- }
-
- /**
- * Retargets this action group to the given editor.
- *
- * @param editor the text editor to which the group should be retargeted
- */
- public void retarget(ITextEditor editor) {
- Iterator e= fRetargetActions.iterator();
- while (e.hasNext()) {
- RetargetTextEditorAction a= (RetargetTextEditorAction) e.next();
- a.setAction(editor == null ? null : editor.getAction(a.getId()));
- }
- }
-
-
- //------------------------------------------------------------------------------------------
-
-
- /** Text editor this group is associated with. */
- private ITextEditor fTextEditor;
-
- /**
- * Creates a new encoding action group for the given editor.
- *
- * @param editor the text editor
- */
- public EncodingActionGroup(ITextEditor editor) {
-
- fTextEditor= editor;
- ResourceBundle b= TextEditorMessages.getResourceBundle();
-
- ResourceAction a;
- if (SYSTEM_ENCODING != null) {
- a= new PredefinedEncodingAction(b, SYSTEM_ENCODING, editor);
- a.setHelpContextId(IEncodingActionsHelpContextIds.SYSTEM);
- a.setActionDefinitionId(IEncodingActionsDefinitionIds.SYSTEM);
- editor.setAction(IEncodingActionsConstants.SYSTEM, a);
- }
-
- for (int i= 0; i < ENCODINGS.length; i++) {
- a= new PredefinedEncodingAction(b, "Editor.ConvertEncoding." + ENCODINGS[i][0] + ".", ENCODINGS[i][0], editor); //$NON-NLS-1$ //$NON-NLS-2$
- a.setHelpContextId( ENCODINGS[i][1]);
- a.setActionDefinitionId( ENCODINGS[i][2]);
- editor.setAction(ENCODINGS[i][0], a);
- }
-
- a= new CustomEncodingAction(b, "Editor.ConvertEncoding." + IEncodingActionsConstants.CUSTOM + ".", editor); //$NON-NLS-1$ //$NON-NLS-2$
- a.setHelpContextId(IEncodingActionsHelpContextIds.CUSTOM);
- a.setActionDefinitionId(IEncodingActionsDefinitionIds.CUSTOM);
- editor.setAction(IEncodingActionsConstants.CUSTOM, a);
- }
-
- /**
- * Updates all actions of this action group.
- */
- public void update() {
-
- IAction a= fTextEditor.getAction(IEncodingActionsConstants.SYSTEM);
- if (a instanceof IUpdate)
- ((IUpdate) a).update();
-
- for (int i= 0; i < ENCODINGS.length; i++) {
- a= fTextEditor.getAction(ENCODINGS[i][0]);
- if (a instanceof IUpdate)
- ((IUpdate) a).update();
- }
-
- a= fTextEditor.getAction(IEncodingActionsConstants.CUSTOM);
- if (a instanceof IUpdate)
- ((IUpdate) a).update();
- }
-
- /*
- * @see ActionGroup#dispose()
- */
- public void dispose() {
- if (fTextEditor != null) {
- fTextEditor.setAction(IEncodingActionsConstants.SYSTEM, null);
- for (int i= 0; i < ENCODINGS.length; i++)
- fTextEditor.setAction(ENCODINGS[i][0], null);
- fTextEditor.setAction(IEncodingActionsConstants.CUSTOM, null);
-
- fTextEditor= null;
- }
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
deleted file mode 100644
index cc4eae64802..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
+++ /dev/null
@@ -1,804 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.editors.text;
-
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IFile;
-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.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.operation.IRunnableContext;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.IAnnotationModel;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ContainerGenerator;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
-import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel;
-
-
-
-/**
- * Shareable document provider specialized for file resources (<code>IFile</code>).
- * <p>
- * This class may be instantiated or be subclassed.</p>
- */
-public class FileDocumentProvider extends StorageDocumentProvider {
-
- /**
- * Qualified name for the encoding key.
- *
- * @since 2.1
- */
- private static final QualifiedName ENCODING_KEY = new QualifiedName("org.eclipse.ui.editors", "encoding"); //$NON-NLS-1$ //$NON-NLS-2$
- /**
- * The runnable context for that provider.
- * @since 3.0
- */
- private WorkspaceOperationRunner fOperationRunner;
-
- /**
- * Runnable encapsulating an element state change. This runnable ensures
- * that a element change failed message is sent out to the element state listeners
- * in case an exception occurred.
- *
- * @since 2.0
- */
- protected class SafeChange implements Runnable {
-
- /** The input that changes. */
- private IFileEditorInput fInput;
-
- /**
- * Creates a new safe runnable for the given input.
- *
- * @param input the input
- */
- public SafeChange(IFileEditorInput input) {
- fInput= input;
- }
-
- /**
- * Execute the change.
- * Subclass responsibility.
- *
- * @param input the input
- * @exception an exception in case of error
- */
- protected void execute(IFileEditorInput input) throws Exception {
- }
-
- /*
- * @see java.lang.Runnable#run()
- */
- public void run() {
-
- if (getElementInfo(fInput) == null) {
- fireElementStateChangeFailed(fInput);
- return;
- }
-
- try {
- execute(fInput);
- } catch (Exception e) {
- fireElementStateChangeFailed(fInput);
- }
- }
- }
-
-
- /**
- * Synchronizes the document with external resource changes.
- */
- protected class FileSynchronizer implements IResourceChangeListener, IResourceDeltaVisitor {
-
- /** The file editor input. */
- protected IFileEditorInput fFileEditorInput;
- /**
- * A flag indicating whether this synchronizer is installed or not.
- *
- * @since 2.1
- */
- protected boolean fIsInstalled= false;
-
- /**
- * Creates a new file synchronizer. Is not yet installed on a resource.
- *
- * @param fileEditorInput the editor input to be synchronized
- */
- public FileSynchronizer(IFileEditorInput fileEditorInput) {
- fFileEditorInput= fileEditorInput;
- }
-
- /**
- * Creates a new file synchronizer which is not yet installed on a resource.
- *
- * @param fileEditorInput the editor input to be synchronized
- * @deprecated use FileSynchronizer(IFileEditorInput)
- */
- public FileSynchronizer(FileEditorInput fileEditorInput) {
- fFileEditorInput= fileEditorInput;
- }
-
- /**
- * Returns the file wrapped by the file editor input.
- *
- * @return the file wrapped by the editor input associated with that synchronizer
- */
- protected IFile getFile() {
- return fFileEditorInput.getFile();
- }
-
- /**
- * Installs the synchronizer on the input's file.
- */
- public void install() {
- getFile().getWorkspace().addResourceChangeListener(this);
- fIsInstalled= true;
- }
-
- /**
- * Uninstalls the synchronizer from the input's file.
- */
- public void uninstall() {
- getFile().getWorkspace().removeResourceChangeListener(this);
- fIsInstalled= false;
- }
-
- /*
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent e) {
- IResourceDelta delta= e.getDelta();
- try {
- if (delta != null && fIsInstalled)
- delta.accept(this);
- } catch (CoreException x) {
- handleCoreException(x, TextEditorMessages.getString("FileDocumentProvider.resourceChanged")); //$NON-NLS-1$
- }
- }
-
- /*
- * @see IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
- */
- public boolean visit(IResourceDelta delta) throws CoreException {
-
- if (delta != null && getFile().equals(delta.getResource())) {
-
- Runnable runnable= null;
-
- switch (delta.getKind()) {
- case IResourceDelta.CHANGED:
- if ((IResourceDelta.CONTENT & delta.getFlags()) != 0) {
- FileInfo info= (FileInfo) getElementInfo(fFileEditorInput);
- if (info != null && !info.fCanBeSaved && computeModificationStamp(getFile()) != info.fModificationStamp) {
- runnable= new SafeChange(fFileEditorInput) {
- protected void execute(IFileEditorInput input) throws Exception {
- handleElementContentChanged(input);
- }
- };
- }
- }
- break;
- case IResourceDelta.REMOVED:
- if ((IResourceDelta.MOVED_TO & delta.getFlags()) != 0) {
- final IPath path= delta.getMovedToPath();
- runnable= new SafeChange(fFileEditorInput) {
- protected void execute(IFileEditorInput input) throws Exception {
- handleElementMoved(input, path);
- }
- };
- } else {
- FileInfo info= (FileInfo) getElementInfo(fFileEditorInput);
- if (info != null && !info.fCanBeSaved) {
- runnable= new SafeChange(fFileEditorInput) {
- protected void execute(IFileEditorInput input) throws Exception {
- handleElementDeleted(input);
- }
- };
- }
- }
- break;
- }
-
- if (runnable != null)
- update(runnable);
- }
-
- return true; // because we are sitting on files anyway
- }
-
- /**
- * Posts the update code "behind" the running operation.
- *
- * @param runnable the update code
- */
- protected void update(Runnable runnable) {
-
- if (runnable instanceof SafeChange)
- fireElementStateChanging(fFileEditorInput);
-
- 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();
- }
- }
- }
-
-
-
- /**
- * Bundle of all required information to allow files as underlying document resources.
- */
- protected class FileInfo extends StorageInfo {
-
- /** The file synchronizer. */
- public FileSynchronizer fFileSynchronizer;
- /** The time stamp at which this provider changed the file. */
- public long fModificationStamp= IResource.NULL_STAMP;
-
- /**
- * Creates and returns a new file info.
- *
- * @param document the document
- * @param model the annotation model
- * @param fileSynchronizer the file synchronizer
- */
- public FileInfo(IDocument document, IAnnotationModel model, FileSynchronizer fileSynchronizer) {
- super(document, model);
- fFileSynchronizer= fileSynchronizer;
- }
- }
-
-
- /**
- * Creates and returns a new document provider.
- */
- public FileDocumentProvider() {
- super();
- }
-
- /**
- * Overrides <code>StorageDocumentProvider#setDocumentContent(IDocument, IEditorInput)</code>.
- *
- * @deprecated use file encoding based version
- * @since 2.0
- */
- protected boolean setDocumentContent(IDocument document, IEditorInput editorInput) throws CoreException {
- if (editorInput instanceof IFileEditorInput) {
- IFile file= ((IFileEditorInput) editorInput).getFile();
- setDocumentContent(document, file.getContents(false));
- return true;
- }
- return super.setDocumentContent(document, editorInput);
- }
-
- /*
- * @see StorageDocumentProvider#setDocumentContent(IDocument, IEditorInput, String)
- * @since 2.0
- */
- protected boolean setDocumentContent(IDocument document, IEditorInput editorInput, String encoding) throws CoreException {
- if (editorInput instanceof IFileEditorInput) {
- IFile file= ((IFileEditorInput) editorInput).getFile();
- setDocumentContent(document, file.getContents(false), encoding);
- return true;
- }
- return super.setDocumentContent(document, editorInput, encoding);
- }
-
- /*
- * @see AbstractDocumentProvider#createAnnotationModel(Object)
- */
- protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
- if (element instanceof IFileEditorInput) {
- IFileEditorInput input= (IFileEditorInput) element;
- return new ResourceMarkerAnnotationModel(input.getFile());
- }
-
- return super.createAnnotationModel(element);
- }
-
- /**
- * Checks whether the given resource has been changed on the
- * local file system by comparing the actual time stamp with the
- * cached one. If the resource has been changed, a <code>CoreException</code>
- * is thrown.
- *
- * @param cachedModificationStamp the chached modification stamp
- * @param resource the resource to check
- * @exception CoreException if resource has been changed on the file system
- */
- protected void checkSynchronizationState(long cachedModificationStamp, IResource resource) throws CoreException {
- if (cachedModificationStamp != computeModificationStamp(resource)) {
- Status status= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IResourceStatus.OUT_OF_SYNC_LOCAL, TextEditorMessages.getString("FileDocumentProvider.error.out_of_sync"), null); //$NON-NLS-1$
- throw new CoreException(status);
- }
- }
-
- /**
- * Computes the initial modification stamp for the given resource.
- *
- * @param resource the resource
- * @return the modification stamp
- */
- protected long computeModificationStamp(IResource resource) {
- long modificationStamp= resource.getModificationStamp();
-
- IPath path= resource.getLocation();
- if (path == null)
- return modificationStamp;
-
- modificationStamp= path.toFile().lastModified();
- return modificationStamp;
- }
-
- /*
- * @see IDocumentProvider#getModificationStamp(Object)
- */
- public long getModificationStamp(Object element) {
-
- if (element instanceof IFileEditorInput) {
- IFileEditorInput input= (IFileEditorInput) element;
- return computeModificationStamp(input.getFile());
- }
-
- return super.getModificationStamp(element);
- }
-
- /*
- * @see IDocumentProvider#getSynchronizationStamp(Object)
- */
- public long getSynchronizationStamp(Object element) {
-
- if (element instanceof IFileEditorInput) {
- FileInfo info= (FileInfo) getElementInfo(element);
- if (info != null)
- return info.fModificationStamp;
- }
-
- return super.getSynchronizationStamp(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#doSynchronize(java.lang.Object)
- */
- protected void doSynchronize(Object element, IProgressMonitor monitor) throws CoreException {
- if (element instanceof IFileEditorInput) {
-
- IFileEditorInput input= (IFileEditorInput) element;
-
- FileInfo info= (FileInfo) getElementInfo(element);
- if (info != null) {
-
- if (info.fFileSynchronizer != null) {
- info.fFileSynchronizer.uninstall();
- refreshFile(input.getFile(), monitor);
- info.fFileSynchronizer.install();
- } else {
- refreshFile(input.getFile(), monitor);
- }
-
- handleElementContentChanged((IFileEditorInput) element);
- }
- return;
-
- }
- super.doSynchronize(element, monitor);
- }
-
- /*
- * @see IDocumentProvider#isDeleted(Object)
- */
- public boolean isDeleted(Object element) {
-
- if (element instanceof IFileEditorInput) {
- IFileEditorInput input= (IFileEditorInput) element;
-
- IPath path= input.getFile().getLocation();
- if (path == null)
- return true;
-
- return !path.toFile().exists();
- }
-
- return super.isDeleted(element);
- }
-
- /*
- * @see AbstractDocumentProvider#doSaveDocument(IProgressMonitor, Object, IDocument, boolean)
- */
- protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
- if (element instanceof IFileEditorInput) {
-
- IFileEditorInput input= (IFileEditorInput) element;
-
- try {
-
- String encoding= getEncoding(input);
- if (encoding == null)
- encoding= getDefaultEncoding();
- InputStream stream= new ByteArrayInputStream(document.get().getBytes(encoding));
- IFile file= input.getFile();
-
- if (file.exists()) {
-
- FileInfo info= (FileInfo) getElementInfo(element);
-
- if (info != null && !overwrite)
- checkSynchronizationState(info.fModificationStamp, file);
-
- // inform about the upcoming content change
- fireElementStateChanging(element);
- try {
- file.setContents(stream, overwrite, true, monitor);
- } catch (CoreException x) {
- // inform about failure
- fireElementStateChangeFailed(element);
- throw x;
- } catch (RuntimeException x) {
- // inform about failure
- fireElementStateChangeFailed(element);
- throw x;
- }
-
- // If here, the editor state will be flipped to "not dirty".
- // Thus, the state changing flag will be reset.
-
- if (info != null) {
-
- ResourceMarkerAnnotationModel model= (ResourceMarkerAnnotationModel) info.fModel;
- model.updateMarkers(info.fDocument);
-
- info.fModificationStamp= computeModificationStamp(file);
- }
-
- } else {
- try {
- monitor.beginTask(TextEditorMessages.getString("FileDocumentProvider.task.saving"), 2000); //$NON-NLS-1$
- ContainerGenerator generator = new ContainerGenerator(file.getParent().getFullPath());
- generator.generateContainer(new SubProgressMonitor(monitor, 1000));
- file.create(stream, false, new SubProgressMonitor(monitor, 1000));
- }
- finally {
- monitor.done();
- }
- }
-
- } catch (IOException x) {
- String message= (x.getMessage() != null ? x.getMessage() : ""); //$NON-NLS-1$
- IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, message, x);
- throw new CoreException(s);
- }
-
- } else {
- super.doSaveDocument(monitor, element, document, overwrite);
- }
- }
-
- /*
- * @see AbstractDocumentProvider#createElementInfo(Object)
- */
- protected ElementInfo createElementInfo(Object element) throws CoreException {
- if (element instanceof IFileEditorInput) {
-
- IFileEditorInput input= (IFileEditorInput) element;
-
- try {
- refreshFile(input.getFile());
- } catch (CoreException x) {
- handleCoreException(x,TextEditorMessages.getString("FileDocumentProvider.createElementInfo")); //$NON-NLS-1$
- }
-
- IDocument d= null;
- IStatus s= null;
-
- try {
- d= createDocument(element);
- } catch (CoreException x) {
- s= x.getStatus();
- d= createEmptyDocument();
- }
-
- IAnnotationModel m= createAnnotationModel(element);
- FileSynchronizer f= new FileSynchronizer(input);
- f.install();
-
- FileInfo info= new FileInfo(d, m, f);
- info.fModificationStamp= computeModificationStamp(input.getFile());
- info.fStatus= s;
- info.fEncoding= getPersistedEncoding(input);
-
- return info;
- }
-
- return super.createElementInfo(element);
- }
-
- /*
- * @see AbstractDocumentProvider#disposeElementInfo(Object, ElementInfo)
- */
- protected void disposeElementInfo(Object element, ElementInfo info) {
- if (info instanceof FileInfo) {
- FileInfo fileInfo= (FileInfo) info;
- if (fileInfo.fFileSynchronizer != null)
- fileInfo.fFileSynchronizer.uninstall();
- }
-
- super.disposeElementInfo(element, info);
- }
-
- /**
- * Updates the element info to a change of the file content and sends out
- * appropriate notifications.
- *
- * @param fileEditorInput the input of an text editor
- */
- protected void handleElementContentChanged(IFileEditorInput fileEditorInput) {
- FileInfo info= (FileInfo) getElementInfo(fileEditorInput);
- if (info == null)
- return;
-
- IDocument document= createEmptyDocument();
- IStatus status= null;
-
- try {
-
- try {
- refreshFile(fileEditorInput.getFile());
- } catch (CoreException x) {
- handleCoreException(x, "FileDocumentProvider.handleElementContentChanged"); //$NON-NLS-1$
- }
-
- setDocumentContent(document, fileEditorInput, info.fEncoding);
-
- } catch (CoreException x) {
- status= x.getStatus();
- }
-
- String newContent= document.get();
-
- if ( !newContent.equals(info.fDocument.get())) {
-
- // set the new content and fire content related events
- fireElementContentAboutToBeReplaced(fileEditorInput);
-
- removeUnchangedElementListeners(fileEditorInput, info);
-
- info.fDocument.removeDocumentListener(info);
- info.fDocument.set(newContent);
- info.fCanBeSaved= false;
- info.fModificationStamp= computeModificationStamp(fileEditorInput.getFile());
- info.fStatus= status;
-
- addUnchangedElementListeners(fileEditorInput, info);
-
- fireElementContentReplaced(fileEditorInput);
-
- } else {
-
- removeUnchangedElementListeners(fileEditorInput, info);
-
- // fires only the dirty state related event
- info.fCanBeSaved= false;
- info.fModificationStamp= computeModificationStamp(fileEditorInput.getFile());
- info.fStatus= status;
-
- addUnchangedElementListeners(fileEditorInput, info);
-
- fireElementDirtyStateChanged(fileEditorInput, false);
- }
- }
-
- /**
- * Sends out the notification that the file serving as document input has been moved.
- *
- * @param fileEditorInput the input of an text editor
- * @param path the path of the new location of the file
- */
- protected void handleElementMoved(IFileEditorInput fileEditorInput, IPath path) {
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IFile newFile= workspace.getRoot().getFile(path);
- fireElementMoved(fileEditorInput, newFile == null ? null : new FileEditorInput(newFile));
- }
-
- /**
- * Sends out the notification that the file serving as document input has been deleted.
- *
- * @param fileEditorInput the input of an text editor
- */
- protected void handleElementDeleted(IFileEditorInput fileEditorInput) {
- fireElementDeleted(fileEditorInput);
- }
-
- /*
- * @see AbstractDocumentProvider#getElementInfo(Object)
- * It's only here to circumvent visibility issues with certain compilers.
- */
- protected ElementInfo getElementInfo(Object element) {
- return super.getElementInfo(element);
- }
-
- /*
- * @see AbstractDocumentProvider#doValidateState(Object, Object)
- * @since 2.0
- */
- protected void doValidateState(Object element, Object computationContext) throws CoreException {
-
- if (element instanceof IFileEditorInput) {
- IFileEditorInput input= (IFileEditorInput) element;
- FileInfo info= (FileInfo) getElementInfo(input);
- if (info != null) {
- IFile file= input.getFile();
- if (file.isReadOnly()) { // do not use cached state here
- IWorkspace workspace= file.getWorkspace();
- workspace.validateEdit(new IFile[] { file }, computationContext);
- }
- }
- }
-
- super.doValidateState(element, computationContext);
- }
-
- /*
- * @see IDocumentProviderExtension#isModifiable(Object)
- * @since 2.0
- */
- public boolean isModifiable(Object element) {
- if (!isStateValidated(element)) {
- if (element instanceof IFileEditorInput)
- return true;
- }
- return super.isModifiable(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#doResetDocument(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void doResetDocument(Object element, IProgressMonitor monitor) throws CoreException {
- if (element instanceof IFileEditorInput) {
- IFileEditorInput input= (IFileEditorInput) element;
- try {
- refreshFile(input.getFile(), monitor);
- } catch (CoreException x) {
- handleCoreException(x,TextEditorMessages.getString("FileDocumentProvider.resetDocument")); //$NON-NLS-1$
- }
- }
-
- super.doResetDocument(element, monitor);
-
- IAnnotationModel model= getAnnotationModel(element);
- if (model instanceof AbstractMarkerAnnotationModel) {
- AbstractMarkerAnnotationModel markerModel= (AbstractMarkerAnnotationModel) model;
- markerModel.resetMarkers();
- }
- }
-
- /**
- * Refreshes the given file resource.
- *
- * @param file
- * @throws a CoreException if the refresh fails
- * @since 2.1
- */
- protected void refreshFile(IFile file) throws CoreException {
- refreshFile(file, getProgressMonitor());
- }
-
- /**
- * Refreshes the given file resource.
- *
- * @param file the file to be refreshed
- * @param monitor the progress monitor
- * @throws a CoreException if the refresh fails
- * @since 3.0
- */
- protected void refreshFile(IFile file, IProgressMonitor monitor) throws CoreException {
- try {
- file.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- } catch (OperationCanceledException x) {
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension3#isSynchronized(java.lang.Object)
- * @since 3.0
- */
- public boolean isSynchronized(Object element) {
- if (element instanceof IFileEditorInput) {
- if (getElementInfo(element) != null) {
- IFileEditorInput input= (IFileEditorInput) element;
- IResource resource= input.getFile();
- return resource.isSynchronized(IResource.DEPTH_ZERO);
- }
- return false;
- }
- return super.isSynchronized(element);
- }
-
- // --------------- Encoding support ---------------
-
- /**
- * Returns the persited encoding for the given element.
- *
- * @param element the element for which to get the persisted encoding
- * @since 2.1
- */
- protected String getPersistedEncoding(Object element) {
- if (element instanceof IFileEditorInput) {
- IFileEditorInput editorInput= (IFileEditorInput)element;
- IFile file= editorInput.getFile();
- if (file != null)
- try {
- return file.getPersistentProperty(ENCODING_KEY);
- } catch (CoreException ex) {
- return null;
- }
- }
- return null;
- }
-
- /**
- * Persists the given encoding for the given element.
- *
- * @param element the element for which to store the persisted encoding
- * @param encoding the encoding
- * @since 2.1
- */
- protected void persistEncoding(Object element, String encoding) throws CoreException {
- if (element instanceof IFileEditorInput) {
- IFileEditorInput editorInput= (IFileEditorInput)element;
- IFile file= editorInput.getFile();
- if (file != null)
- file.setPersistentProperty(ENCODING_KEY, encoding);
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#getOperationRunner(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
- if (fOperationRunner == null)
- fOperationRunner = new WorkspaceOperationRunner();
- fOperationRunner.setProgressMonitor(monitor);
- return fOperationRunner;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsConstants.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsConstants.java
deleted file mode 100644
index 9f8b0df6096..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsConstants.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.editors.text;
-
-/**
- * Defines the names of the encoding actions.
- * <p>
- * This interface contains constants only; it is not intended to be implemented.</p>
- *
- * @since 2.0
- */
-public interface IEncodingActionsConstants {
-
- /**
- * Name of the action to change the encoding into US ASCII.
- * Value is <code>"US-ASCII"</code>.
- */
- static final String US_ASCII= "US-ASCII"; //$NON-NLS-1$
-
- /**
- * Name of the action to change the encoding into ISO-8859-1.
- * Value is <code>"ISO-8859-1"</code>.
- */
- static final String ISO_8859_1= "ISO-8859-1"; //$NON-NLS-1$
-
- /**
- * Name of the action to change the encoding into UTF-8.
- * Value is <code>"UTF-8"</code>.
- */
- static final String UTF_8= "UTF-8"; //$NON-NLS-1$
-
- /**
- * Name of the action to change the encoding into UTF-16BE.
- * Value is <code>"UTF-16BE"</code>.
- */
- static final String UTF_16BE= "UTF-16BE"; //$NON-NLS-1$
-
- /**
- * Name of the action to change the encoding into UTF-16LE.
- * Value is <code>"UTF-16LE"</code>.
- */
- static final String UTF_16LE= "UTF-16LE"; //$NON-NLS-1$
-
- /**
- * Name of the action to change the encoding into UTF-16.
- * Value is <code>"UTF-16"</code>.
- */
- static final String UTF_16= "UTF-16"; //$NON-NLS-1$
-
- /**
- * Name of the action to change the encoding into the system encoding.
- * Value is <code>"System"</code>.
- */
- static final String SYSTEM= "System"; //$NON-NLS-1$
-
- /**
- * Name of the action to change the encoding into a custom encoding.
- * Value is <code>"Custom"</code>.
- */
- static final String CUSTOM= "Custom"; //$NON-NLS-1$
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsDefinitionIds.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsDefinitionIds.java
deleted file mode 100644
index 644a131e5c0..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsDefinitionIds.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.editors.text;
-
-
-/**
- * Defines the definition ids for the encoding actions.
- * <p>
- * This interface contains constants only; it is not intended to be implemented.</p>
- *
- * @since 2.0
- */
-public interface IEncodingActionsDefinitionIds {
- /**
- * Action definition id of the action to change the encoding into US ASCII.
- * Value is <code>"org.eclipse.ui.edit.text.encoding.us-ascii"</code>.
- */
- public static final String US_ASCII= "org.eclipse.ui.edit.text.encoding.us-ascii"; //$NON-NLS-1$
-
- /**
- * Action definition id of the action to change the encoding into ISO-8859-1.
- * Value is <code>"org.eclipse.ui.edit.text.encoding.iso-8859-1"</code>.
- */
- public static final String ISO_8859_1= "org.eclipse.ui.edit.text.encoding.iso-8859-1"; //$NON-NLS-1$
-
- /**
- * Action definition id of the action to change the encoding into UTF-8.
- * Value is <code>"org.eclipse.ui.edit.text.encoding.utf-8"</code>.
- */
- public static final String UTF_8= "org.eclipse.ui.edit.text.encoding.utf-8"; //$NON-NLS-1$
-
- /**
- * Action definition id of the action to change the encoding into UTF-16BE.
- * Value is <code>"org.eclipse.ui.edit.text.encoding.utf-16be"</code>.
- */
- public static final String UTF_16BE= "org.eclipse.ui.edit.text.encoding.utf-16be"; //$NON-NLS-1$
-
- /**
- * Action definition id of the action to change the encoding into UTF-16LE.
- * Value is <code>"org.eclipse.ui.edit.text.encoding.utf-16le"</code>.
- */
- public static final String UTF_16LE= "org.eclipse.ui.edit.text.encoding.utf-16le"; //$NON-NLS-1$
-
- /**
- * Action definition id of the action to change the encoding into UTF-16.
- * Value is <code>"org.eclipse.ui.edit.text.encoding.utf-16"</code>.
- */
- public static final String UTF_16= "org.eclipse.ui.edit.text.encoding.utf-16"; //$NON-NLS-1$
-
- /**
- * Action definition id of the action to change the encoding into the system encoding.
- * Value is <code>"org.eclipse.ui.edit.text.encoding.system"</code>.
- */
- public static final String SYSTEM= "org.eclipse.ui.edit.text.encoding.system"; //$NON-NLS-1$
-
- /**
- * Action definition id of the action to change the encoding into a custom encoding.
- * Value is <code>"org.eclipse.ui.edit.text.encoding.custom"</code>.
- */
- public static final String CUSTOM= "org.eclipse.ui.edit.text.encoding.custom"; //$NON-NLS-1$
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsHelpContextIds.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsHelpContextIds.java
deleted file mode 100644
index 58cf76ea9ec..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingActionsHelpContextIds.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.editors.text;
-
-
-import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
-
-/**
- * Help context ids for the encoding actions.
- * <p>
- * This interface contains constants only; it is not intended to be implemented.</p>
- *
- * @since 2.0
- */
-public interface IEncodingActionsHelpContextIds {
-
- /**
- * Help id of the action to change the encoding into US ASCII.
- * Default value: <code>"org.eclipse.ui.US-ASCII_action_context"</code>
- */
- public static final String US_ASCII= IAbstractTextEditorHelpContextIds.PREFIX + IEncodingActionsConstants.US_ASCII + IAbstractTextEditorHelpContextIds.ACTION_POSTFIX;
-
- /**
- * Help id of the action to change the encoding into ISO-8859-1.
- * Default value: <code>"org.eclipse.ui.ISO-8859-1_action_context"</code>
- */
- public static final String ISO_8859_1= IAbstractTextEditorHelpContextIds.PREFIX + IEncodingActionsConstants.ISO_8859_1 + IAbstractTextEditorHelpContextIds.ACTION_POSTFIX;
-
- /**
- * Help id of the action to change the encoding into UTF-8
- * Default value: <code>"org.eclipse.ui.UTF-8_action_context"</code>
- */
- public static final String UTF_8= IAbstractTextEditorHelpContextIds.PREFIX + IEncodingActionsConstants.UTF_8 + IAbstractTextEditorHelpContextIds.ACTION_POSTFIX;
-
- /**
- * Help id of the action to change the encoding into UTF-16BE.
- * Default value: <code>"org.eclipse.ui.UTF-16BE_action_context"</code>
- */
- public static final String UTF_16BE= IAbstractTextEditorHelpContextIds.PREFIX + IEncodingActionsConstants.UTF_16BE + IAbstractTextEditorHelpContextIds.ACTION_POSTFIX;
-
- /**
- * Help id of the action to change the encoding into UTF-16LE.
- * Default value: <code>"org.eclipse.ui.UTF-16LE_action_context"</code>
- */
- public static final String UTF_16LE= IAbstractTextEditorHelpContextIds.PREFIX + IEncodingActionsConstants.UTF_16LE + IAbstractTextEditorHelpContextIds.ACTION_POSTFIX;
-
- /**
- * Help id of the action to change the encoding into UTF-16.
- * Default value: <code>"org.eclipse.ui.UTF-16_action_context"</code>
- */
- public static final String UTF_16= IAbstractTextEditorHelpContextIds.PREFIX + IEncodingActionsConstants.UTF_16 + IAbstractTextEditorHelpContextIds.ACTION_POSTFIX;
-
- /**
- * Help id of the action to change the encoding into the system encoding.
- * Default value: <code>"org.eclipse.ui.System_action_context"</code>
- */
- public static final String SYSTEM= IAbstractTextEditorHelpContextIds.PREFIX + IEncodingActionsConstants.SYSTEM + IAbstractTextEditorHelpContextIds.ACTION_POSTFIX;
-
- /**
- * Help id of the action to change the encoding into a custom encoding.
- * Default value: <code>"org.eclipse.ui.Custom_action_context"</code>
- */
- public static final String CUSTOM= IAbstractTextEditorHelpContextIds.PREFIX + IEncodingActionsConstants.CUSTOM + IAbstractTextEditorHelpContextIds.ACTION_POSTFIX;
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingSupport.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingSupport.java
deleted file mode 100644
index 741e0dad272..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IEncodingSupport.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.editors.text;
-
-/**
- * Interface to be implemented by objects supporting character encodings.
- *
- * @since 2.0
- */
-public interface IEncodingSupport{
-
- /**
- * Sets the character encoding.
- *
- * @param encoding the character encoding
- */
- void setEncoding(String encoding);
-
- /**
- * Returns the character encoding.
- *
- * @return the character encoding
- */
- String getEncoding();
-
- /**
- * Returns the default character encoding.
- *
- * @return the default character encoding
- */
- String getDefaultEncoding();
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ILocationProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ILocationProvider.java
deleted file mode 100644
index eba510215af..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ILocationProvider.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.ui.editors.text;
-
-import org.eclipse.core.runtime.IPath;
-
-/**
- * @since 3.0
- */
-public interface ILocationProvider {
-
- /**
- * Returns the location of the given object or <code>null</code>.
- * <p>
- * The provided location is either a full path of a workspace resource or
- * an absolute path in the local file system.
- * </p>
- *
- * @return the location of the given object or <code>null</code>
- */
- IPath getPath(Object element);
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ISchedulingRuleProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ISchedulingRuleProvider.java
deleted file mode 100644
index 871a4b9d59b..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ISchedulingRuleProvider.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.editors.text;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-/**
- * A scheduling rule provider provides a scheduling rule which
- * can be used when running operations.
- *
- * @since 3.0
- */
-public interface ISchedulingRuleProvider {
-
- /**
- * Returns the scheduling rule.
- *
- * @return a scheduling rule or <code>null</code> if none
- */
- ISchedulingRule getSchedulingRule();
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IStorageDocumentProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IStorageDocumentProvider.java
deleted file mode 100644
index 0c0303905a0..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IStorageDocumentProvider.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.editors.text;
-
-
-/**
- * Document provider for <code>IStorage</code> based domain elements.
- * Basically incorporates the concept of character encoding.
- *
- * @since 2.0
- */
-public interface IStorageDocumentProvider {
-
- /**
- * Returns the default character encoding used by this provider.
- *
- * @return the default character encoding used by this provider
- */
- String getDefaultEncoding();
-
- /**
- * Returns the character encoding for the given element, or
- * <code>null</code> if the element is not managed by this provider.
- *
- * @param element the element
- * @return the encoding for the given element
- */
- String getEncoding(Object element);
-
- /**
- * Sets the encoding for the given element. If <code>encoding</code>
- * is <code>null</code> the workbench's character encoding should be used.
- *
- * @param element the element
- * @param encoding the encoding to be used
- */
- void setEncoding(Object element, String encoding);
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ITextEditorHelpContextIds.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ITextEditorHelpContextIds.java
deleted file mode 100644
index 03cdf03db36..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ITextEditorHelpContextIds.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.editors.text;
-
-import org.eclipse.ui.ide.IDEActionFactory;
-import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
-
-/**
- * Help context ids for the text editor.
- * <p>
- * This interface contains constants only; it is not intended to be implemented.</p>
- */
-public interface ITextEditorHelpContextIds extends IAbstractTextEditorHelpContextIds {
-
- /**
- * Id for the text editor preference page.
- * Value: <code>"org.eclipse.ui.text_editor_preference_page_context"</code>.
- */
- public static final String TEXT_EDITOR_PREFERENCE_PAGE= PREFIX + "text_editor_preference_page_context"; //$NON-NLS-1$
-
- /**
- * Id for the text editor.
- * Value: <code>"org.eclipse.ui.text_editor_context"</code>.
- */
- public static final String TEXT_EDITOR= PREFIX + "text_editor_context"; //$NON-NLS-1$
-
- /**
- * Help context id for the Add Bookmark action.
- * Value: <code>"org.eclipse.ui.bookmark_action_context"</code>
- *
- * @since 3.0
- */
- public static final String BOOKMARK_ACTION= PREFIX + IDEActionFactory.BOOKMARK.getId() + ACTION_POSTFIX;
-
- /**
- * Help context id for the Add Task action.
- * Value: <code>"org.eclipse.ui.addTask_action_context"</code>
- *
- * @since 3.0
- */
- public static final String ADD_TASK_ACTION= PREFIX + IDEActionFactory.ADD_TASK.getId() + ACTION_POSTFIX;
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/StorageDocumentProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/StorageDocumentProvider.java
deleted file mode 100644
index 8feee578581..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/StorageDocumentProvider.java
+++ /dev/null
@@ -1,420 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.editors.text;
-
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.operation.IRunnableContext;
-
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.IAnnotationModel;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.AbstractDocumentProvider;
-
-/**
- * Shareable document provider specialized for <code>IStorage</code>s.
- */
-public class StorageDocumentProvider extends AbstractDocumentProvider implements IStorageDocumentProvider {
-
- /**
- * Default file size.
- *
- * @since 2.1
- */
- protected final static int DEFAULT_FILE_SIZE= 15 * 1024;
-
-
- /**
- * Bundle of all required information to allow <code>IStorage</code> as underlying document resources.
- * @since 2.0
- */
- protected class StorageInfo extends ElementInfo {
-
- /** The flag representing the cached state whether the storage is modifiable. */
- public boolean fIsModifiable= false;
- /** The flag representing the cached state whether the storage is read-only. */
- public boolean fIsReadOnly= true;
- /** The flag representing the need to update the cached flag. */
- public boolean fUpdateCache= true;
- /** The encoding used to create the document from the storage or <code>null</code> for workbench encoding. */
- public String fEncoding;
-
- /**
- * Creates a new storage info.
- *
- * @param document the document
- * @param model the annotation model
- */
- public StorageInfo(IDocument document, IAnnotationModel model) {
- super(document, model);
- fEncoding= null;
- }
- }
-
- /**
- * Creates a new document provider.
- *
- * @since 2.0
- */
- public StorageDocumentProvider() {
- super();
- }
-
- /**
- * Intitializes the given document with the given stream.
- *
- * @param document the document to be initialized
- * @param contentStream the stream which delivers the document content
- * @exception CoreException if the given stream can not be read
- *
- * @deprecated use encoding based version instead
- */
- protected void setDocumentContent(IDocument document, InputStream contentStream) throws CoreException {
- setDocumentContent(document, contentStream, null);
- }
-
- /**
- * Intitializes the given document with the given stream using the given encoding.
- *
- * @param document the document to be initialized
- * @param contentStream the stream which delivers the document content
- * @param encoding the character encoding for reading the given stream
- * @exception CoreException if the given stream can not be read
- * @since 2.0
- */
- protected void setDocumentContent(IDocument document, InputStream contentStream, String encoding) throws CoreException {
-
- Reader in= null;
-
- try {
-
- if (encoding == null)
- encoding= getDefaultEncoding();
-
- in= new BufferedReader(new InputStreamReader(contentStream, encoding), DEFAULT_FILE_SIZE);
- StringBuffer buffer= new StringBuffer(DEFAULT_FILE_SIZE);
- char[] readBuffer= new char[2048];
- int n= in.read(readBuffer);
- while (n > 0) {
- buffer.append(readBuffer, 0, n);
- n= in.read(readBuffer);
- }
-
- document.set(buffer.toString());
-
- } catch (IOException x) {
- String message= (x.getMessage() != null ? x.getMessage() : ""); //$NON-NLS-1$
- IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, message, x);
- throw new CoreException(s);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException x) {
- }
- }
- }
- }
-
- /**
- * Intitializes the given document from the given editor input using the default character encoding.
- *
- * @param document the document to be initialized
- * @param editorInput the input from which to derive the content of the document
- * @return <code>true</code> if the document content could be set, <code>false</code> otherwise
- * @exception CoreException if the given editor input cannot be accessed
- * @deprecated use the encoding based version instead
- * @since 2.0
- */
- protected boolean setDocumentContent(IDocument document, IEditorInput editorInput) throws CoreException {
- return setDocumentContent(document, editorInput, null);
- }
-
- /**
- * Intitializes the given document from the given editor input using the given character encoding.
- *
- * @param document the document to be initialized
- * @param editorInput the input from which to derive the content of the document
- * @param encoding the character encoding used to read the editor input
- * @return <code>true</code> if the document content could be set, <code>false</code> otherwise
- * @exception CoreException if the given editor input cannot be accessed
- * @since 2.0
- */
- protected boolean setDocumentContent(IDocument document, IEditorInput editorInput, String encoding) throws CoreException {
- if (editorInput instanceof IStorageEditorInput) {
- IStorage storage= ((IStorageEditorInput) editorInput).getStorage();
- setDocumentContent(document, storage.getContents(), encoding);
- return true;
- }
- return false;
- }
-
- /*
- * @see AbstractDocumentProvider#createAnnotationModel(Object)
- */
- protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
- return null;
- }
-
- /**
- * Factory method for creating empty documents.
- * @return the newly created document
- * @since 2.1
- */
- protected IDocument createEmptyDocument() {
- return new Document();
- }
-
- /*
- * @see AbstractDocumentProvider#createDocument(Object)
- */
- protected IDocument createDocument(Object element) throws CoreException {
-
- if (element instanceof IEditorInput) {
- IDocument document= createEmptyDocument();
- if (setDocumentContent(document, (IEditorInput) element, getEncoding(element))) {
- setupDocument(element, document);
- return document;
- }
- }
-
- return null;
- }
-
- /**
- * Sets up the given document as it would be provided for the given element. The
- * content of the document is not changed. This default implementation is empty.
- * Subclasses may reimplement.
- *
- * @param element the blue-print element
- * @param document the document to set up
- * @since 3.0
- */
- protected void setupDocument(Object element, IDocument document) {
- }
-
- /*
- * @see AbstractDocumentProvider#createElementInfo(Object)
- * @since 2.0
- */
- protected ElementInfo createElementInfo(Object element) throws CoreException {
- if (element instanceof IStorageEditorInput) {
-
- IDocument document= null;
- IStatus status= null;
-
- try {
- document= createDocument(element);
- } catch (CoreException x) {
- status= x.getStatus();
- document= createEmptyDocument();
- }
-
- ElementInfo info= new StorageInfo(document, createAnnotationModel(element));
- info.fStatus= status;
- ((StorageInfo)info).fEncoding= getPersistedEncoding(element);
-
- return info;
- }
-
- return super.createElementInfo(element);
- }
-
- /*
- * @see AbstractDocumentProvider#doSaveDocument(IProgressMonitor, Object, IDocument, boolean)
- */
- protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
- }
-
- /**
- * Defines the standard procedure to handle <code>CoreExceptions</code>. Exceptions
- * are written to the plug-in log.
- *
- * @param exception the exception to be logged
- * @param message the message to be logged
- * @since 2.0
- */
- protected void handleCoreException(CoreException exception, String message) {
- ILog log= Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog();
-
- if (message != null)
- log.log(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, exception));
- else
- log.log(exception.getStatus());
- }
-
- /**
- * Updates the internal cache for the given input.
- *
- * @param input the input whose cache will be updated
- * @since 2.0
- */
- protected void updateCache(IStorageEditorInput input) throws CoreException {
- StorageInfo info= (StorageInfo) getElementInfo(input);
- if (info != null) {
- try {
- IStorage storage= input.getStorage();
- if (storage != null) {
- boolean readOnly= storage.isReadOnly();
- info.fIsReadOnly= readOnly;
- info.fIsModifiable= !readOnly;
- }
- } catch (CoreException x) {
- handleCoreException(x, TextEditorMessages.getString("StorageDocumentProvider.updateCache")); //$NON-NLS-1$
- }
- info.fUpdateCache= false;
- }
- }
-
- /*
- * @see IDocumentProviderExtension#isReadOnly(Object)
- * @since 2.0
- */
- public boolean isReadOnly(Object element) {
- if (element instanceof IStorageEditorInput) {
- StorageInfo info= (StorageInfo) getElementInfo(element);
- if (info != null) {
- if (info.fUpdateCache) {
- try {
- updateCache((IStorageEditorInput) element);
- } catch (CoreException x) {
- handleCoreException(x, TextEditorMessages.getString("StorageDocumentProvider.isReadOnly")); //$NON-NLS-1$
- }
- }
- return info.fIsReadOnly;
- }
- }
- return super.isReadOnly(element);
- }
-
- /*
- * @see IDocumentProviderExtension#isModifiable(Object)
- * @since 2.0
- */
- public boolean isModifiable(Object element) {
- if (element instanceof IStorageEditorInput) {
- StorageInfo info= (StorageInfo) getElementInfo(element);
- if (info != null) {
- if (info.fUpdateCache) {
- try {
- updateCache((IStorageEditorInput) element);
- } catch (CoreException x) {
- handleCoreException(x, TextEditorMessages.getString("StorageDocumentProvider.isModifiable")); //$NON-NLS-1$
- }
- }
- return info.fIsModifiable;
- }
- }
- return super.isModifiable(element);
- }
-
- /*
- * @see AbstractDocumentProvider#doUpdateStateCache(Object)
- * @since 2.0
- */
- protected void doUpdateStateCache(Object element) throws CoreException {
- if (element instanceof IStorageEditorInput) {
- StorageInfo info= (StorageInfo) getElementInfo(element);
- if (info != null)
- info.fUpdateCache= true;
- }
- super.doUpdateStateCache(element);
- }
-
- /*
- * @see IStorageDocumentProvider#getDefaultEncoding()
- * @since 2.0
- */
- public String getDefaultEncoding() {
- return ResourcesPlugin.getEncoding();
- }
-
- /*
- * @see IStorageDocumentProvider#getEncoding(Object)
- * @since 2.0
- */
- public String getEncoding(Object element) {
- if (element instanceof IStorageEditorInput) {
- StorageInfo info= (StorageInfo) getElementInfo(element);
- if (info != null)
- return info.fEncoding;
- else
- return getPersistedEncoding(element);
- }
- return null;
- }
-
- /*
- * @see IStorageDocumentProvider#setEncoding(Object, String)
- * @since 2.0
- */
- public void setEncoding(Object element, String encoding) {
- if (element instanceof IStorageEditorInput) {
- StorageInfo info= (StorageInfo) getElementInfo(element);
- if (info != null) {
- info.fEncoding= encoding;
- try {
- persistEncoding(element, encoding);
- } catch (CoreException ex) {
- // XXX: log
- }
- }
- }
- }
-
- /**
- * Returns the persited encoding for the given element.
- *
- * @param element the element for which to get the persisted encoding
- * @since 2.1
- */
- protected String getPersistedEncoding(Object element) {
- // Default is to do use return the default encoding
- return null;
- }
-
- /**
- * Persists the given encoding for the given element.
- *
- * @param element the element for which to store the persisted encoding
- * @param encoding the encoding
- * @since 2.1
- */
- protected void persistEncoding(Object element, String encoding) throws CoreException {
- // Default is to do nothing
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#getOperationRunner(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
- return null;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditor.java
deleted file mode 100644
index ca9533a9f3b..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditor.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.editors.text;
-
-
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.window.Window;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.dialogs.SaveAsDialog;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.ConvertLineDelimitersAction;
-import org.eclipse.ui.texteditor.ExtendedTextEditor;
-import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import org.eclipse.ui.texteditor.ResourceAction;
-
-import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-
-
-
-/**
- * The standard text editor for file resources (<code>IFile</code>).
- * <p>
- * This editor has id <code>"org.eclipse.ui.DefaultTextEditor"</code>.
- * The editor's context menu has id <code>#TextEditorContext</code>.
- * The editor's ruler context menu has id <code>#TextRulerContext</code>.
- * </p>
- * <p>
- * The workbench will automatically instantiate this class when the default
- * editor is needed for a workbench window.
- * </p>
- */
-public class TextEditor extends ExtendedTextEditor {
-
- /**
- * The encoding support for the editor.
- * @since 2.0
- */
- protected DefaultEncodingSupport fEncodingSupport;
-
-
- /**
- * Creates a new text editor.
- */
- public TextEditor() {
- super();
- initializeKeyBindingScopes();
- setSourceViewerConfiguration(new TextSourceViewerConfiguration());
- initializeEditor();
- }
-
- /**
- * Initializes this editor.
- */
- protected void initializeEditor() {
- setEditorContextMenuId("#TextEditorContext"); //$NON-NLS-1$
- setRulerContextMenuId("#TextRulerContext"); //$NON-NLS-1$
- setHelpContextId(ITextEditorHelpContextIds.TEXT_EDITOR);
- setPreferenceStore(EditorsPlugin.getDefault().getPreferenceStore());
- configureInsertMode(SMART_INSERT, false);
- setInsertMode(INSERT);
- }
-
- /**
- * Initializes the key binding scopes of this editor.
- *
- * @since 2.1
- */
- protected void initializeKeyBindingScopes() {
- setKeyBindingScopes(new String[] { "org.eclipse.ui.textEditorScope" }); //$NON-NLS-1$
- }
-
- /*
- * @see IWorkbenchPart#dispose()
- * @since 2.0
- */
- public void dispose() {
- if (fEncodingSupport != null) {
- fEncodingSupport.dispose();
- fEncodingSupport= null;
- }
-
- super.dispose();
- }
-
- /*
- * @see AbstractTextEditor#doSaveAs()
- * @since 2.1
- */
- public void doSaveAs() {
- if (askIfNonWorkbenchEncodingIsOk())
- super.doSaveAs();
- }
-
- /*
- * @see AbstractTextEditor#doSave(IProgressMonitor)
- * @since 2.1
- */
- public void doSave(IProgressMonitor monitor){
- if (askIfNonWorkbenchEncodingIsOk())
- super.doSave(monitor);
- else
- monitor.setCanceled(true);
- }
-
- /**
- * Installs the encoding support on the given text editor.
- * <p>
- * Subclasses may override to install their own encoding
- * support or to disable the default encoding support.
- * </p>
- * @since 2.1
- */
- protected void installEncodingSupport() {
- fEncodingSupport= new DefaultEncodingSupport();
- fEncodingSupport.initialize(this);
- }
-
- /**
- * Asks the user if it is ok to store in non-workbench encoding.
- *
- * @return <true> if the user wants to continue or if no encoding support has been installed
- * @since 2.1
- */
- private boolean askIfNonWorkbenchEncodingIsOk() {
-
- if (fEncodingSupport == null)
- return true;
-
- IDocumentProvider provider= getDocumentProvider();
- if (provider instanceof IStorageDocumentProvider) {
- IEditorInput input= getEditorInput();
- IStorageDocumentProvider storageProvider= (IStorageDocumentProvider)provider;
- String encoding= storageProvider.getEncoding(input);
- String defaultEncoding= storageProvider.getDefaultEncoding();
- if (encoding != null && !encoding.equals(defaultEncoding)) {
- Shell shell= getSite().getShell();
- String title= TextEditorMessages.getString("Editor.warning.save.nonWorkbenchEncoding.title"); //$NON-NLS-1$
- String msg;
- if (input != null)
- msg= MessageFormat.format(TextEditorMessages.getString("Editor.warning.save.nonWorkbenchEncoding.message1"), new String[] {input.getName(), encoding});//$NON-NLS-1$
- else
- msg= MessageFormat.format(TextEditorMessages.getString("Editor.warning.save.nonWorkbenchEncoding.message2"), new String[] {encoding});//$NON-NLS-1$
- return MessageDialog.openQuestion(shell, title, msg);
- }
- }
- return true;
- }
-
- /**
- * The <code>TextEditor</code> implementation of this <code>AbstractTextEditor</code>
- * method asks the user for the workspace path of a file resource and saves the document there.
- *
- * @param progressMonitor the progress monitor to be used
- */
- protected void performSaveAs(IProgressMonitor progressMonitor) {
- Shell shell= getSite().getShell();
- IEditorInput input= getEditorInput();
-
- SaveAsDialog dialog= new SaveAsDialog(shell);
-
- IFile original= (input instanceof IFileEditorInput) ? ((IFileEditorInput) input).getFile() : null;
- if (original != null)
- dialog.setOriginalFile(original);
-
- dialog.create();
-
- IDocumentProvider provider= getDocumentProvider();
- if (provider == null) {
- // editor has programatically been closed while the dialog was open
- return;
- }
-
- if (provider.isDeleted(input) && original != null) {
- String message= MessageFormat.format(TextEditorMessages.getString("Editor.warning.save.delete"), new Object[] { original.getName() }); //$NON-NLS-1$
- dialog.setErrorMessage(null);
- dialog.setMessage(message, IMessageProvider.WARNING);
- }
-
- if (dialog.open() == Window.CANCEL) {
- if (progressMonitor != null)
- progressMonitor.setCanceled(true);
- return;
- }
-
- IPath filePath= dialog.getResult();
- if (filePath == null) {
- if (progressMonitor != null)
- progressMonitor.setCanceled(true);
- return;
- }
-
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IFile file= workspace.getRoot().getFile(filePath);
- final IEditorInput newInput= new FileEditorInput(file);
-
- boolean success= false;
- try {
-
- provider.aboutToChange(newInput);
- provider.saveDocument(progressMonitor, newInput, provider.getDocument(input), true);
- success= true;
-
- } catch (CoreException x) {
-
- String title= TextEditorMessages.getString("Editor.error.save.title"); //$NON-NLS-1$
- String msg= MessageFormat.format(TextEditorMessages.getString("Editor.error.save.message"), new Object[] { x.getMessage() }); //$NON-NLS-1$
-
- IStatus status= x.getStatus();
- if (status != null) {
- switch (status.getSeverity()) {
- case IStatus.INFO:
- MessageDialog.openInformation(shell, title, msg);
- break;
- case IStatus.WARNING:
- MessageDialog.openWarning(shell, title, msg);
- break;
- default:
- MessageDialog.openError(shell, title, msg);
- }
- } else {
- MessageDialog.openError(shell, title, msg);
- }
-
- } finally {
- provider.changed(newInput);
- if (success)
- setInput(newInput);
- }
-
- if (progressMonitor != null)
- progressMonitor.setCanceled(!success);
- }
-
- /*
- * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
- */
- public boolean isSaveAsAllowed() {
- return true;
- }
-
- /*
- * @see AbstractTextEditor#createActions()
- * @since 2.0
- */
- protected void createActions() {
- super.createActions();
-
- ResourceAction action= new ConvertLineDelimitersAction(TextEditorMessages.getResourceBundle(), "Editor.ConvertToWindows.", this, "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.CONVERT_LINE_DELIMITERS_TO_WINDOWS);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONVERT_LINE_DELIMITERS_TO_WINDOWS);
- setAction(ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_WINDOWS, action);
-
- action= new ConvertLineDelimitersAction(TextEditorMessages.getResourceBundle(), "Editor.ConvertToUNIX.", this, "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.CONVERT_LINE_DELIMITERS_TO_UNIX);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONVERT_LINE_DELIMITERS_TO_UNIX);
- setAction(ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_UNIX, action);
-
- action= new ConvertLineDelimitersAction(TextEditorMessages.getResourceBundle(), "Editor.ConvertToMac.", this, "\r"); //$NON-NLS-1$ //$NON-NLS-2$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.CONVERT_LINE_DELIMITERS_TO_MAC);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONVERT_LINE_DELIMITERS_TO_MAC);
- setAction(ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_MAC, action);
-
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=17709
- markAsStateDependentAction(ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_WINDOWS, true);
- markAsStateDependentAction(ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_UNIX, true);
- markAsStateDependentAction(ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_MAC, true);
-
- installEncodingSupport();
- }
-
- /*
- * @see StatusTextEditor#getStatusHeader(IStatus)
- * @since 2.0
- */
- protected String getStatusHeader(IStatus status) {
- if (fEncodingSupport != null) {
- String message= fEncodingSupport.getStatusHeader(status);
- if (message != null)
- return message;
- }
- return super.getStatusHeader(status);
- }
-
- /*
- * @see StatusTextEditor#getStatusBanner(IStatus)
- * @since 2.0
- */
- protected String getStatusBanner(IStatus status) {
- if (fEncodingSupport != null) {
- String message= fEncodingSupport.getStatusBanner(status);
- if (message != null)
- return message;
- }
- return super.getStatusBanner(status);
- }
-
- /*
- * @see StatusTextEditor#getStatusMessage(IStatus)
- * @since 2.0
- */
- protected String getStatusMessage(IStatus status) {
- if (fEncodingSupport != null) {
- String message= fEncodingSupport.getStatusMessage(status);
- if (message != null)
- return message;
- }
- return super.getStatusMessage(status);
- }
-
- /*
- * @see AbstractTextEditor#doSetInput(IEditorInput)
- * @since 2.0
- */
- protected void doSetInput(IEditorInput input) throws CoreException {
- super.doSetInput(input);
- if (fEncodingSupport != null)
- fEncodingSupport.reset();
- }
-
- /*
- * @see IAdaptable#getAdapter(java.lang.Class)
- * @since 2.0
- */
- public Object getAdapter(Class adapter) {
- if (IEncodingSupport.class.equals(adapter))
- return fEncodingSupport;
- return super.getAdapter(adapter);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#updatePropertyDependentActions()
- * @since 2.0
- */
- protected void updatePropertyDependentActions() {
- super.updatePropertyDependentActions();
- if (fEncodingSupport != null)
- fEncodingSupport.reset();
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorActionContributor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorActionContributor.java
deleted file mode 100644
index 8b2b6b3123b..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorActionContributor.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.editors.text;
-
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.ide.IDEActionFactory;
-import org.eclipse.ui.texteditor.BasicTextEditorActionContributor;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.texteditor.RetargetTextEditorAction;
-
-/**
- * Manages the installation and deinstallation of global actions for the default text editor.
- * <p>
- * If instantiated and used as-is, this contributor connects global actions and adds actions
- * for line delimiter conversion and encoding support.</p>
- *
- * @since 2.0
- */
-public class TextEditorActionContributor extends BasicTextEditorActionContributor {
-
- /** Convert to Windows action. */
- private RetargetTextEditorAction fConvertToWindows;
- /** Convert to UNIX action. */
- private RetargetTextEditorAction fConvertToUNIX;
- /** Convert to Mac action. */
- private RetargetTextEditorAction fConvertToMac;
- /** Encoding action group */
- private EncodingActionGroup fEncodingActionGroup;
-
-
- /**
- * Creates a new contributor.
- */
- public TextEditorActionContributor() {
- super();
-
- // line delimiter conversion
- fConvertToWindows= new RetargetTextEditorAction(TextEditorMessages.getResourceBundle(), "Editor.ConvertToWindows."); //$NON-NLS-1$
- fConvertToUNIX= new RetargetTextEditorAction(TextEditorMessages.getResourceBundle(), "Editor.ConvertToUNIX."); //$NON-NLS-1$
- fConvertToMac= new RetargetTextEditorAction(TextEditorMessages.getResourceBundle(), "Editor.ConvertToMac."); //$NON-NLS-1$
-
- // character encoding
- fEncodingActionGroup= new EncodingActionGroup();
- }
-
- /**
- * Internally sets the active editor to the actions provided by this contributor.
- * Cannot be overridden by subclasses.
- *
- * @param part the editor
- */
- private void doSetActiveEditor(IEditorPart part) {
-
- ITextEditor textEditor= null;
- if (part instanceof ITextEditor)
- textEditor= (ITextEditor) part;
-
- IActionBars actionBars= getActionBars();
- if (actionBars != null) {
- actionBars.setGlobalActionHandler(IDEActionFactory.ADD_TASK.getId(), getAction(textEditor, IDEActionFactory.ADD_TASK.getId()));
- actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(textEditor, IDEActionFactory.BOOKMARK.getId()));
- }
-
- // line delimiter conversion
- fConvertToWindows.setAction(getAction(textEditor, ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_WINDOWS));
- fConvertToUNIX.setAction(getAction(textEditor, ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_UNIX));
- fConvertToMac.setAction(getAction(textEditor, ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_MAC));
-
- // character encoding
- fEncodingActionGroup.retarget(textEditor);
- }
-
- /*
- * @see IEditorActionBarContributor#setActiveEditor(org.eclipse.ui.IEditorPart)
- */
- public void setActiveEditor(IEditorPart part) {
- super.setActiveEditor(part);
- doSetActiveEditor(part);
- }
-
- /*
- * @see EditorActionBarContributor#init(org.eclipse.ui.IActionBars)
- */
- public void init(IActionBars bars) {
- super.init(bars);
-
- // line delimiter conversion
- IMenuManager menuManager= bars.getMenuManager();
- IMenuManager editMenu= menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
- if (editMenu != null) {
- MenuManager subMenu= new MenuManager(TextEditorMessages.getString("Editor.ConvertLineDelimiters.label")); //$NON-NLS-1$
-
- subMenu.add(fConvertToWindows);
- subMenu.add(fConvertToUNIX);
- subMenu.add(fConvertToMac);
-
- editMenu.add(subMenu);
- }
-
- // character encoding
- fEncodingActionGroup.fillActionBars(bars);
- }
-
- /*
- * @see IEditorActionBarContributor#dispose()
- */
- public void dispose() {
- doSetActiveEditor(null);
- super.dispose();
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.java
deleted file mode 100644
index d339bde8dc8..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.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.editors.text;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-class TextEditorMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.editors.text.TextEditorMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private TextEditorMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.properties b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.properties
deleted file mode 100644
index 121654ecf39..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.properties
+++ /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
-###############################################################################
-
-PreferencePage.description=Default Text Editor Settings
-PreferencePage.fontEditor=Text Font:
-
-FileDocumentProvider.createElementInfo=FileDocumentProvider.createElementInfo
-FileDocumentProvider.error.out_of_sync=Has been changed on the file system
-FileDocumentProvider.resourceChanged=FileDocumentProvider.resourceChanged
-FileDocumentProvider.task.saving=Saving
-FileDocumentProvider.updateContent=FileDocumentProvider.updateContent
-FileDocumentProvider.resetDocument=FileDocumentProvider.resetDocument
-
-StorageDocumentProvider.updateCache=StorageDocumentProvider.updateCache
-StorageDocumentProvider.isReadOnly=StorageDocumentProvider.isReadOnly
-StorageDocumentProvider.isModifiable=StorageDocumentProvider.isModifiable
-
-Editor.error.save.message=Save could not be completed. {0}
-Editor.error.save.title=Problems During Save As...
-Editor.warning.save.delete=The original file ''{0}'' has been deleted.
-
-Editor.warning.save.nonWorkbenchEncoding.title= Save Resource In Non-Workbench Encoding
-Editor.warning.save.nonWorkbenchEncoding.message1= {0} will be saved in \" {1} \" encoding which is not the current workbench encoding. This can result in conflicts with other tools. Continue anyway?
-Editor.warning.save.nonWorkbenchEncoding.message2= The resource will be saved in \" {0} \" encoding which is not the current platform encoding. This can result in conflicts with other tools. Continue anyway?
-
-Editor.AddMenu.label=&Add
-
-Editor.ConvertLineDelimiters.label=C&onvert Line Delimiters To
-
-Editor.ConvertToWindows.label=&Windows
-Editor.ConvertToWindows.tooltip=Converts line delimiters to Windows
-Editor.ConvertToWindows.image=
-Editor.ConvertToWindows.description=Converts line delimiters to Windows
-
-Editor.ConvertToUNIX.label=&UNIX
-Editor.ConvertToUNIX.tooltip=Converts line delimiters to UNIX
-Editor.ConvertToUNIX.image=
-Editor.ConvertToUNIX.description=Converts line delimiters to UNIX
-
-Editor.ConvertToMac.label=&Mac
-Editor.ConvertToMac.tooltip=Converts line delimiters to Mac
-Editor.ConvertToMac.image=
-Editor.ConvertToMac.description=Converts line delimiters to Mac
-
-
-Editor.error.unreadable_encoding.header=Character Encoding Problems
-Editor.error.unreadable_encoding.banner=
-Editor.error.unreadable_encoding.message_arg=This file is unreadable using the \"{0}\" character encoding.
-Editor.error.unreadable_encoding.message=This file is unreadable using the current character encoding.
-
-Editor.error.unsupported_encoding.header=Unsupported Character Encoding
-Editor.error.unsupported_encoding.banner=
-Editor.error.unsupported_encoding.message_arg=Character encoding \"{0}\" is not supported by this platform.
-Editor.error.unsupported_encoding.message= The current character encoding is not supported by this platform.
-
-Editor.ConvertEncoding.submenu.label=E&ncoding
-
-Editor.ConvertEncoding.default_suffix=(default)
-
-Editor.ConvertEncoding.System.label=Platform encoding
-Editor.ConvertEncoding.System.tooltip=Use the platform character encoding
-Editor.ConvertEncoding.System.image=
-Editor.ConvertEncoding.System.description=Use the platform character encoding
-
-Editor.ConvertEncoding.US-ASCII.label=ASCII
-Editor.ConvertEncoding.US-ASCII.tooltip=Use the US-ASCII character encoding
-Editor.ConvertEncoding.US-ASCII.image=
-Editor.ConvertEncoding.US-ASCII.description=Use the US-ASCII character encoding
-
-Editor.ConvertEncoding.ISO-8859-1.label=Latin 1
-Editor.ConvertEncoding.ISO-8859-1.tooltip=Use the ISO-8859-1 character encoding
-Editor.ConvertEncoding.ISO-8859-1.image=
-Editor.ConvertEncoding.ISO-8859-1.description=Use the ISO-8859-1 character encoding
-
-Editor.ConvertEncoding.UTF-8.label=UTF-8
-Editor.ConvertEncoding.UTF-8.tooltip=Use the UTF-8 character encoding
-Editor.ConvertEncoding.UTF-8.image=
-Editor.ConvertEncoding.UTF-8.description=Use the UTF-8 character encoding
-
-Editor.ConvertEncoding.UTF-16BE.label=UTF-16 (big-endian)
-Editor.ConvertEncoding.UTF-16BE.tooltip=Use the UTF-16BE character encoding
-Editor.ConvertEncoding.UTF-16BE.image=
-Editor.ConvertEncoding.UTF-16BE.description=Use the UTF-16BE character encoding
-
-Editor.ConvertEncoding.UTF-16LE.label=UTF-16 (little-endian)
-Editor.ConvertEncoding.UTF-16LE.tooltip=Use the UTF-16LE character encoding
-Editor.ConvertEncoding.UTF-16LE.image=
-Editor.ConvertEncoding.UTF-16LE.description=Use the UTF-16LE character encoding
-
-Editor.ConvertEncoding.UTF-16.label=UTF-16
-Editor.ConvertEncoding.UTF-16.tooltip=Use the UTF-16 character encoding
-Editor.ConvertEncoding.UTF-16.image=
-Editor.ConvertEncoding.UTF-16.description=Use the UTF-16 character encoding
-
-Editor.ConvertEncoding.Custom.label=&Others...
-Editor.ConvertEncoding.Custom.tooltip=Use a custom character encoding
-Editor.ConvertEncoding.Custom.image=
-Editor.ConvertEncoding.Custom.description=Use a custom character encoding
-Editor.ConvertEncoding.Custom.dialog.title=Character Encoding
-Editor.ConvertEncoding.Custom.dialog.message=Enter the name of the character encoding:
-
-Editor.AddTask.label=&Task...
-Editor.AddTask.tooltip=Add Task
-Editor.AddTask.image=
-Editor.AddTask.description=Add Task
-Editor.AddTask.dialog.title=Add Task
-Editor.AddTask.dialog.message=Enter Task description
-Editor.AddTask.error.dialog.title=Add Task
-Editor.AddTask.error.dialog.message=Problems adding new task
-
-NullProvider.error= ERROR \ No newline at end of file
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferenceConstants.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferenceConstants.java
deleted file mode 100644
index ef081657b5b..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferenceConstants.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.editors.text;
-
-
-import org.eclipse.jface.preference.IPreferenceStore;
-
-import org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants;
-
-
-/**
- * Preference constants used in the default text editor preference store.
- * @since 2.1
- */
-public class TextEditorPreferenceConstants {
-
- /**
- * Prevent initialization.
- */
- private TextEditorPreferenceConstants() {
- }
-
- /**
- * A named preference that controls whether the current line highlighting is turned on or off
- * (value <code>"currentLine"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- * @deprecated as of 3.0 replaced by {@link org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants}
- */
- public final static String EDITOR_CURRENT_LINE= "currentLine"; //$NON-NLS-1$
-
- /**
- * A named preference that holds the color used to highlight the current line
- * (value <code>"currentLineColor"</code>).
- * <p>
- * The preference value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>.
- * </p>
- * @see org.eclipse.jface.resource.StringConverter
- * @see org.eclipse.jface.preference.PreferenceConverter
- * @deprecated as of 3.0 replaced by {@link org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants}
- */
- public final static String EDITOR_CURRENT_LINE_COLOR= "currentLineColor"; //$NON-NLS-1$
-
- /**
- * A named preference that controls whether the print margin is turned on or off
- * (value <code>"printMargin"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- * @deprecated as of 3.0 replaced by {@link org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants}
- */
- public final static String EDITOR_PRINT_MARGIN= "printMargin"; //$NON-NLS-1$
-
- /**
- * A named preference that holds the color used to render the print margin
- * (value <code>"printMarginColor"</code>).
- * <p>
- * The preference value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>.
- * </p>
- * @see org.eclipse.jface.resource.StringConverter
- * @see org.eclipse.jface.preference.PreferenceConverter
- * @deprecated as of 3.0 replaced by {@link org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants}
- */
- public final static String EDITOR_PRINT_MARGIN_COLOR= "printMarginColor"; //$NON-NLS-1$
-
- /**
- * Print margin column
- * (value <code>"printMarginColumn"</code>).
- * <p>
- * The preference value is of type <code>int</code>.
- * </p>
- * @deprecated as of 3.0 replaced by {@link org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants}
- */
- public final static String EDITOR_PRINT_MARGIN_COLUMN= "printMarginColumn"; //$NON-NLS-1$
-
- /**
- * A named preference that controls whether the editor shows unknown
- * indicators in text (squiggly lines).
- * (value <code>"othersIndication"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- * @since 2.1
- * @deprecated as of 3.0 replaced by {@link org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants}
- */
- public final static String EDITOR_UNKNOWN_INDICATION= "othersIndication"; //$NON-NLS-1$
-
- /**
- * A named preference that holds the color used to render unknown indicators
- * (value <code>"othersIndicationColor"</code>).
- * <p>
- * The preference value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>.
- * </p>
- * @see #EDITOR_UNKNOWN_INDICATION
- * @see org.eclipse.jface.resource.StringConverter
- * @see org.eclipse.jface.preference.PreferenceConverter
- * @since 2.1
- * @deprecated as of 3.0 replaced by {@link org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants}
- */
- public final static String EDITOR_UNKNOWN_INDICATION_COLOR= "othersIndicationColor"; //$NON-NLS-1$
-
- /**
- * A named preference that controls whether the overview ruler shows unknown indicators
- * (value <code>"othersIndicationInOverviewRuler"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- * @since 2.1
- * @deprecated as of 3.0 replaced by {@link org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants}
- */
- public final static String EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER= "othersIndicationInOverviewRuler"; //$NON-NLS-1$
-
- /**
- * A named preference that controls if the overview ruler is shown in the UI
- * (value <code>"overviewRuler"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- * @deprecated as of 3.0 replaced by {@link org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants}
- */
- public final static String EDITOR_OVERVIEW_RULER= "overviewRuler"; //$NON-NLS-1$
-
- /**
- * A named preference that controls if the line number ruler is shown in the UI
- * (value <code>"lineNumberRuler"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- * @deprecated as of 3.0 replaced by {@link org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants}
- */
- public final static String EDITOR_LINE_NUMBER_RULER= "lineNumberRuler"; //$NON-NLS-1$
-
- /**
- * A named preference that holds the color used to render line numbers inside the line number ruler
- * (value <code>"lineNumberColor"</code>).
- * <p>
- * The preference value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>.
- * </p>
- * @see org.eclipse.jface.resource.StringConverter
- * @see org.eclipse.jface.preference.PreferenceConverter
- * @see #EDITOR_LINE_NUMBER_RULER
- * @deprecated as of 3.0 replaced by {@link org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants}
- */
- public final static String EDITOR_LINE_NUMBER_RULER_COLOR= "lineNumberColor"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_PROBLEM_INDICATION= "problemIndication"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_PROBLEM_INDICATION_COLOR= "problemIndicationColor"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_WARNING_INDICATION= "warningIndication"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_WARNING_INDICATION_COLOR= "warningIndicationColor"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_INFO_INDICATION= "infoIndication"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_INFO_INDICATION_COLOR= "infoIndicationColor"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_TASK_INDICATION= "taskIndication"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_TASK_INDICATION_COLOR= "taskIndicationColor"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_BOOKMARK_INDICATION= "bookmarkIndication"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_BOOKMARK_INDICATION_COLOR= "bookmarkIndicationColor"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_SEARCH_RESULT_INDICATION= "searchResultIndication"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_SEARCH_RESULT_INDICATION_COLOR= "searchResultIndicationColor"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER= "errorIndicationInOverviewRuler"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER= "warningIndicationInOverviewRuler"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_INFO_INDICATION_IN_OVERVIEW_RULER= "infoIndicationInOverviewRuler"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER= "taskIndicationInOverviewRuler"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER= "bookmarkIndicationInOverviewRuler"; //$NON-NLS-1$
-
- /**
- * @deprecated
- */
- public final static String EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER= "searchResultIndicationInOverviewRuler"; //$NON-NLS-1$
-
- /**
- * Initializes the given preference store with the default values.
- *
- * @param store the preference store to be initialized
- */
- public static void initializeDefaultValues(IPreferenceStore store) {
-
- // set defaults from ExtendedTextEditor
- ExtendedTextEditorPreferenceConstants.initializeDefaultValues(store);
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferencePage.java
deleted file mode 100644
index 54b63dd6195..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferencePage.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.editors.text;
-
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.FontFieldEditor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.resource.JFaceResources;
-
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.texteditor.AbstractTextEditor;
-
-/**
- * A preference page to set the font used in the default text editor.
- * <p>
- * This preference page uses the text editor's preference bundle and
- * uses the key <code>"PreferencePage.description"</code> to look up
- * the page description. In addition, it uses <code>"PreferencePage.fontEditor"</code>
- * for the editor description.
- * </p>
- * @deprecated As of 2.1 fonts are managed by the workbench
- */
-public class TextEditorPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
- /**
- * Indicates whether the preferences that this page maniulates have been initialized.
- *
- * @since 2.0
- */
- private static boolean fgInitialized= false;
-
- /**
- * Creates and returns the text editor preference page.
- */
- public TextEditorPreferencePage() {
- super(GRID);
-
- setDescription(TextEditorMessages.getString("PreferencePage.description")); //$NON-NLS-1$
- Plugin plugin= Platform.getPlugin("org.eclipse.ui.workbench"); //$NON-NLS-1$
- if (plugin instanceof AbstractUIPlugin) {
- AbstractUIPlugin uiPlugin= (AbstractUIPlugin) plugin;
- setPreferenceStore(uiPlugin.getPreferenceStore());
- }
- }
-
- /*
- * @see IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
- WorkbenchHelp.setHelp(getControl(), ITextEditorHelpContextIds.TEXT_EDITOR_PREFERENCE_PAGE);
- }
-
- /*
- * @see FieldEditorPreferencePage#createFieldEditors()
- */
- public void createFieldEditors() {
- addField(new FontFieldEditor(JFaceResources.TEXT_FONT, TextEditorMessages.getString("PreferencePage.fontEditor"), getFieldEditorParent())); //$NON-NLS-1$
- }
-
- /*
- * @see IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /**
- * Initialzes the defaults for the given store.
- *
- * @param store the preference store
- * @since 2.0
- */
- public static void initDefaults(IPreferenceStore store) {
-
- if (fgInitialized)
- return;
-
- fgInitialized= true;
-
- Font font= JFaceResources.getTextFont();
- if (font != null) {
- FontData[] data= font.getFontData();
- if (data != null && data.length > 0)
- PreferenceConverter.setDefault(store, JFaceResources.TEXT_FONT, data[0]);
- }
-
- Display display= Display.getDefault();
- Color color= display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
- PreferenceConverter.setDefault(store, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, color.getRGB());
- store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, true);
-
- color= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
- PreferenceConverter.setDefault(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, color.getRGB());
- store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true);
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java
deleted file mode 100644
index 8554d5af856..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java
+++ /dev/null
@@ -1,1002 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.ui.editors.text;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import org.eclipse.core.internal.filebuffers.ContainerGenerator;
-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.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.filebuffers.IFileBuffer;
-import org.eclipse.core.filebuffers.IFileBufferListener;
-import org.eclipse.core.filebuffers.IFileBufferManager;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.IAnnotationModel;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.IDocumentProviderExtension;
-import org.eclipse.ui.texteditor.IDocumentProviderExtension2;
-import org.eclipse.ui.texteditor.IDocumentProviderExtension3;
-import org.eclipse.ui.texteditor.IElementStateListener;
-import org.eclipse.ui.texteditor.IElementStateListenerExtension;
-import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel;
-
-/**
- * @since 3.0
- */
-public class TextFileDocumentProvider implements IDocumentProvider, IDocumentProviderExtension, IDocumentProviderExtension2, IDocumentProviderExtension3, IStorageDocumentProvider {
-
- /**
- * Opertion created by the document provider and to be executed by the providers runnable context.
- */
- protected static abstract class DocumentProviderOperation implements IRunnableWithProgress, ISchedulingRuleProvider {
-
- /**
- * The actual functionality of this operation.
- *
- * @throws CoreException
- */
- protected abstract void execute(IProgressMonitor monitor) throws CoreException;
-
- /*
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- execute(monitor);
- } catch (CoreException x) {
- throw new InvocationTargetException(x);
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.ISchedulingRuleProvider#getSchedulingRule()
- */
- public ISchedulingRule getSchedulingRule() {
- return ResourcesPlugin.getWorkspace().getRoot();
- }
- }
-
- static protected class NullProvider implements IDocumentProvider, IDocumentProviderExtension, IDocumentProviderExtension2, IDocumentProviderExtension3, IStorageDocumentProvider {
-
- static final private IStatus STATUS_ERROR= new Status(IStatus.ERROR, EditorsPlugin.getPluginId(), IStatus.INFO, TextEditorMessages.getString("NullProvider.error"), null); //$NON-NLS-1$
-
- public void connect(Object element) throws CoreException {}
- public void disconnect(Object element) {}
- public IDocument getDocument(Object element) { return null; }
- public void resetDocument(Object element) throws CoreException {}
- public void saveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {}
- public long getModificationStamp(Object element) { return 0; }
- public long getSynchronizationStamp(Object element) { return 0; }
- public boolean isDeleted(Object element) { return true; }
- public boolean mustSaveDocument(Object element) { return false; }
- public boolean canSaveDocument(Object element) { return false; }
- public IAnnotationModel getAnnotationModel(Object element) { return null; }
- public void aboutToChange(Object element) {}
- public void changed(Object element) {}
- public void addElementStateListener(IElementStateListener listener) {}
- public void removeElementStateListener(IElementStateListener listener) {}
- public boolean isReadOnly(Object element) { return true; }
- public boolean isModifiable(Object element) { return false; }
- public void validateState(Object element, Object computationContext) throws CoreException {}
- public boolean isStateValidated(Object element) { return true; }
- public void updateStateCache(Object element) throws CoreException {}
- public void setCanSaveDocument(Object element) {}
- public IStatus getStatus(Object element) { return STATUS_ERROR; }
- public void synchronize(Object element) throws CoreException {}
- public void setProgressMonitor(IProgressMonitor progressMonitor) {}
- public IProgressMonitor getProgressMonitor() { return new NullProgressMonitor(); }
- public boolean isSynchronized(Object element) { return true; }
- public String getDefaultEncoding() { return null; }
- public String getEncoding(Object element) { return null; }
- public void setEncoding(Object element, String encoding) {}
- }
-
- static protected class FileInfo {
- public Object fElement;
- public int fCount;
- public ITextFileBuffer fTextFileBuffer;
- public IAnnotationModel fModel;
- public boolean fCachedReadOnlyState;
- }
-
- static private class SingleElementIterator implements Iterator {
-
- private Object fElement;
-
- public SingleElementIterator(Object element) {
- fElement= element;
- }
-
- /*
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return fElement != null;
- }
-
- /*
- * @see java.util.Iterator#next()
- */
- public Object next() {
- if (fElement != null) {
- Object result= fElement;
- fElement= null;
- return result;
- }
- throw new NoSuchElementException();
- }
-
- /*
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
- }
-
- protected class FileBufferListener implements IFileBufferListener {
-
- public FileBufferListener() {
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedFileListener#bufferContentAboutToBeReplaced(org.eclipse.core.buffer.text.IBufferedFile)
- */
- public void bufferContentAboutToBeReplaced(IFileBuffer file) {
- List list= new ArrayList(fElementStateListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IElementStateListener l= (IElementStateListener) e.next();
- Iterator i= getElements(file);
- while (i.hasNext())
- l.elementContentAboutToBeReplaced(i.next());
- }
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedFileListener#bufferContentReplaced(org.eclipse.core.buffer.text.IBufferedFile)
- */
- public void bufferContentReplaced(IFileBuffer file) {
- List list= new ArrayList(fElementStateListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IElementStateListener l= (IElementStateListener) e.next();
- Iterator i= getElements(file);
- while (i.hasNext())
- l.elementContentReplaced(i.next());
- }
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedFileListener#stateChanging(org.eclipse.core.buffer.text.IBufferedFile)
- */
- public void stateChanging(IFileBuffer file) {
- Iterator i= getElements(file);
- while (i.hasNext())
- fireElementStateChanging(i.next());
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedFileListener#dirtyStateChanged(org.eclipse.core.buffer.text.IBufferedFile, boolean)
- */
- public void dirtyStateChanged(IFileBuffer file, boolean isDirty) {
- List list= new ArrayList(fElementStateListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IElementStateListener l= (IElementStateListener) e.next();
- Iterator i= getElements(file);
- while (i.hasNext())
- l.elementDirtyStateChanged(i.next(), isDirty);
- }
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedFileListener#stateValidationChanged(org.eclipse.core.buffer.text.IBufferedFile, boolean)
- */
- public void stateValidationChanged(IFileBuffer file, boolean isStateValidated) {
- List list= new ArrayList(fElementStateListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- Object l= e.next();
- if (l instanceof IElementStateListenerExtension) {
- IElementStateListenerExtension x= (IElementStateListenerExtension) l;
- Iterator i= getElements(file);
- while (i.hasNext())
- x.elementStateValidationChanged(i.next(), isStateValidated);
- }
- }
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedFileListener#underlyingFileMoved(org.eclipse.core.buffer.text.IBufferedFile, org.eclipse.core.runtime.IPath)
- */
- public void underlyingFileMoved(IFileBuffer file, IPath newLocation) {
- IWorkspace workspace=ResourcesPlugin.getWorkspace();
- IFile newFile= workspace.getRoot().getFile(newLocation);
- IEditorInput input= newFile == null ? null : new FileEditorInput(newFile);
- List list= new ArrayList(fElementStateListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IElementStateListener l= (IElementStateListener) e.next();
- Iterator i= getElements(file);
- while (i.hasNext())
- l.elementMoved(i.next(), input);
- }
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedFileListener#underlyingFileDeleted(org.eclipse.core.buffer.text.IBufferedFile)
- */
- public void underlyingFileDeleted(IFileBuffer file) {
- List list= new ArrayList(fElementStateListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- IElementStateListener l= (IElementStateListener) e.next();
- Iterator i= getElements(file);
- while (i.hasNext())
- l.elementDeleted(i.next());
- }
- }
-
- /*
- * @see org.eclipse.core.buffer.text.IBufferedFileListener#stateChangeFailed(org.eclipse.core.buffer.text.IBufferedFile)
- */
- public void stateChangeFailed(IFileBuffer file) {
- Iterator i= getElements(file);
- while (i.hasNext())
- fireElementStateChangeFailed(i.next());
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBufferListener#bufferCreated(org.eclipse.core.filebuffers.IFileBuffer)
- */
- public void bufferCreated(IFileBuffer buffer) {
- // ignore
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IFileBufferListener#bufferDisposed(org.eclipse.core.filebuffers.IFileBuffer)
- */
- public void bufferDisposed(IFileBuffer buffer) {
- // ignore
- }
- }
-
- /** The parent document provider */
- private IDocumentProvider fParentProvider;
- /** Element information of all connected elements */
- private final Map fFileInfoMap= new HashMap();
- /** Map from file buffers to their connected elements */
- private final Map fFileBufferMap= new HashMap();
- /** The list of element state listeners */
- private List fElementStateListeners= new ArrayList();
- /** The file buffer listener */
- private final IFileBufferListener fFileBufferListener= new FileBufferListener();
- /** The progress monitor */
- private IProgressMonitor fProgressMonitor;
- /** The operation runner */
- private WorkspaceOperationRunner fOperationRunner;
-
-
- public TextFileDocumentProvider() {
- this(null);
- }
-
- public TextFileDocumentProvider(IDocumentProvider parentProvider) {
- IFileBufferManager manager= FileBuffers.getTextFileBufferManager();
- manager.addFileBufferListener(fFileBufferListener);
- manager.setSynchronizationContext(new UISynchronizationContext());
- if (parentProvider != null)
- setParentDocumentProvider(parentProvider);
- }
-
- final public void setParentDocumentProvider(IDocumentProvider parentProvider) {
-
- Assert.isTrue(parentProvider instanceof IDocumentProviderExtension);
- Assert.isTrue(parentProvider instanceof IDocumentProviderExtension2);
- Assert.isTrue(parentProvider instanceof IDocumentProviderExtension3);
- Assert.isTrue(parentProvider instanceof IStorageDocumentProvider);
-
- fParentProvider= parentProvider;
- if (fParentProvider == null)
- fParentProvider= new NullProvider();
- }
-
- /**
- * Returns the parent document provider.
- *
- * @return the parent document provider
- */
- final protected IDocumentProvider getParentProvider() {
- if (fParentProvider == null)
- fParentProvider= new StorageDocumentProvider();
- return fParentProvider;
- }
-
- /**
- * Returns the runnable context for this document provider.
- *
- * @return the runnable context for this document provider
- */
- protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
- if (fOperationRunner == null)
- fOperationRunner = new WorkspaceOperationRunner();
- fOperationRunner.setProgressMonitor(monitor);
- return fOperationRunner;
- }
-
- /**
- * Executes the given operation in the providers runnable context.
- *
- * @param operation the operation to be executes
- * @param monitor the progress monitor
- * @exception CoreException the operation's core exception
- */
- protected void executeOperation(DocumentProviderOperation operation, IProgressMonitor monitor) throws CoreException {
- try {
- IRunnableContext runner= getOperationRunner(monitor);
- if (runner != null)
- runner.run(false, false, operation);
- else
- operation.run(monitor);
- } catch (InvocationTargetException x) {
- Throwable e= x.getTargetException();
- if (e instanceof CoreException)
- throw (CoreException) e;
- String message= (e.getMessage() != null ? e.getMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, EditorsPlugin.getPluginId(), IStatus.ERROR, message, e));
- } catch (InterruptedException x) {
- String message= (x.getMessage() != null ? x.getMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.CANCEL, EditorsPlugin.getPluginId(), IStatus.OK, message, x));
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#connect(java.lang.Object)
- */
- public void connect(Object element) throws CoreException {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info == null) {
-
- info= createFileInfo(element);
- if (info == null) {
- getParentProvider().connect(element);
- return;
- }
-
- info.fElement= element;
- fFileInfoMap.put(element, info);
- storeFileBufferMapping(element, info);
- }
- ++ info.fCount;
- }
-
- /**
- * Updates the file buffer map with a new releation between the file buffer
- * of the given info and the given element;
- *
- * @param element the element
- * @param info the element info
- */
- private void storeFileBufferMapping(Object element, FileInfo info) {
- Object value= fFileBufferMap.get(info.fTextFileBuffer);
-
- if (value instanceof List) {
- List list= (List) value;
- list.add(element);
- return;
- }
-
- if (value == null) {
- value= element;
- } else {
- List list= new ArrayList(2);
- list.add(value);
- list.add(element);
- value= list;
- }
- fFileBufferMap.put(info.fTextFileBuffer, value);
- }
-
- protected FileInfo createEmptyFileInfo() {
- return new FileInfo();
- }
-
- protected FileInfo createFileInfo(Object element) throws CoreException {
-
- IPath location= null;
- if (element instanceof IAdaptable) {
- IAdaptable adaptable= (IAdaptable) element;
- ILocationProvider provider= (ILocationProvider) adaptable.getAdapter(ILocationProvider.class);
- if (provider != null)
- location= provider.getPath(element);
- }
-
- if (location != null) {
- ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
- manager.connect(location, getProgressMonitor());
- manager.requestSynchronizationContext(location);
- ITextFileBuffer fileBuffer= manager.getTextFileBuffer(location);
-
- FileInfo info= createEmptyFileInfo();
- info.fTextFileBuffer= fileBuffer;
- info.fCachedReadOnlyState= isSystemFileReadOnly(info);
-
- IFile file= FileBuffers.getWorkspaceFileAtLocation(location);
- if (file != null && file.exists())
- info.fModel= createAnnotationModel(file);
- return info;
- }
- return null;
- }
-
- protected IAnnotationModel createAnnotationModel(IFile file) {
- return new ResourceMarkerAnnotationModel(file);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#disconnect(java.lang.Object)
- */
- public void disconnect(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
-
- if (info == null) {
- getParentProvider().disconnect(element);
- return;
- }
-
- if (info.fCount == 1) {
-
- fFileInfoMap.remove(element);
- removeFileBufferMapping(element, info);
- disposeFileInfo(element, info);
-
- } else
- -- info.fCount;
- }
-
- /**
- * Removes the relation between the file buffer of the given info and the
- * given element from the file buffer mapping.
- *
- * @param element the element
- * @param info the given element info
- */
- private void removeFileBufferMapping(Object element, FileInfo info) {
- Object value= fFileBufferMap.get(info.fTextFileBuffer);
- if (value == null)
- return;
-
- if (value instanceof List) {
- List list= (List) value;
- list.remove(element);
- if (list.size() == 1)
- fFileBufferMap.put(info.fTextFileBuffer, list.get(0));
- } else if (value == element) {
- fFileBufferMap.remove(info.fTextFileBuffer);
- }
- }
-
- protected void disposeFileInfo(Object element, FileInfo info) {
- IFileBufferManager manager= FileBuffers.getTextFileBufferManager();
- try {
- IPath location= info.fTextFileBuffer.getLocation();
- manager.releaseSynchronizationContext(location);
- manager.disconnect(location, getProgressMonitor());
- } catch (CoreException x) {
- handleCoreException(x, "FileDocumentProvider.disposeElementInfo"); //$NON-NLS-1$
- }
- }
-
- /**
- *Returns an iterator for all the elements that are connected to this file buffer.
- *
- * @param file the file buffer
- * @return an iterator for all elements connected with the given file buffer
- */
- protected Iterator getElements(IFileBuffer file) {
- Object value= fFileBufferMap.get(file);
- if (value instanceof List)
- return new ArrayList((List) value).iterator();
- return new SingleElementIterator(value);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#getDocument(java.lang.Object)
- */
- public IDocument getDocument(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return info.fTextFileBuffer.getDocument();
- return getParentProvider().getDocument(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#resetDocument(java.lang.Object)
- */
- public void resetDocument(Object element) throws CoreException {
- final FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null) {
- DocumentProviderOperation operation= new DocumentProviderOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- info.fTextFileBuffer.revert(monitor);
- }
- /*
- * @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#getSchedulingRule()
- */
- public ISchedulingRule getSchedulingRule() {
- if (info.fElement instanceof IFileEditorInput)
- return ((IFileEditorInput)info.fElement).getFile();
- else
- return null;
- }
- };
- executeOperation(operation, getProgressMonitor());
- } else {
- getParentProvider().resetDocument(element);
- }
- }
-
- /*
- * @see IDocumentProvider#saveDocument(IProgressMonitor, Object, IDocument, boolean)
- */
- public final void saveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
-
- if (element == null)
- return;
-
- DocumentProviderOperation operation= createSaveOperation(element, document, overwrite);
- if (operation != null)
- executeOperation(operation, monitor);
- else
- getParentProvider().saveDocument(monitor, element, document, overwrite);
- }
-
- protected DocumentProviderOperation createSaveOperation(final Object element, final IDocument document, final boolean overwrite) throws CoreException {
- final FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null) {
-
- if (info.fTextFileBuffer.getDocument() != document) {
- Status status= new Status(IStatus.WARNING, EditorsPlugin.getPluginId(), IStatus.ERROR, "not the same document", null); //$NON-NLS-1$
- throw new CoreException(status);
- }
-
- return new DocumentProviderOperation() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- commitFileBuffer(monitor, info, overwrite);
- }
- /*
- * @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#getSchedulingRule()
- */
- public ISchedulingRule getSchedulingRule() {
- if (info.fElement instanceof IFileEditorInput)
- return ((IFileEditorInput)info.fElement).getFile().getParent();
- else
- return null;
- }
- };
-
- } else if (element instanceof IFileEditorInput) {
-
- final IFile file= ((IFileEditorInput) element).getFile();
- return new DocumentProviderOperation() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- createFileFromDocument(monitor, file, document);
- }
- /*
- * @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#getSchedulingRule()
- */
- public ISchedulingRule getSchedulingRule() {
- IResource existingParent= file.getParent();
- while (!existingParent.exists())
- existingParent= existingParent.getParent();
- return existingParent;
- }
- };
- }
-
- return null;
- }
-
- protected void commitFileBuffer(IProgressMonitor monitor, FileInfo info, boolean overwrite) throws CoreException {
- Assert.isNotNull(info);
- info.fTextFileBuffer.commit(monitor, overwrite);
- if (info.fModel instanceof AbstractMarkerAnnotationModel) {
- AbstractMarkerAnnotationModel model= (AbstractMarkerAnnotationModel) info.fModel;
- model.updateMarkers(info.fTextFileBuffer.getDocument());
- }
- }
-
- protected void createFileFromDocument(IProgressMonitor monitor, IFile file, IDocument document) throws CoreException {
- try {
- monitor.beginTask("Saving", 2000);
- InputStream stream= new ByteArrayInputStream(document.get().getBytes(getDefaultEncoding()));
- ContainerGenerator generator = new ContainerGenerator(file.getWorkspace(), file.getParent().getFullPath());
- generator.generateContainer(new SubProgressMonitor(monitor, 1000));
- file.create(stream, false, new SubProgressMonitor(monitor, 1000));
- } catch (UnsupportedEncodingException x) {
- String message= (x.getMessage() != null ? x.getMessage() : ""); //$NON-NLS-1$
- IStatus s= new Status(IStatus.ERROR, EditorsPlugin.getPluginId(), IStatus.OK, message, x);
- throw new CoreException(s);
- } finally {
- monitor.done();
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#getModificationStamp(java.lang.Object)
- */
- public long getModificationStamp(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return info.fTextFileBuffer.getModifcationStamp();
- return getParentProvider().getModificationStamp(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#getSynchronizationStamp(java.lang.Object)
- */
- public long getSynchronizationStamp(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return 0;
- return getParentProvider().getSynchronizationStamp(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#isDeleted(java.lang.Object)
- */
- public boolean isDeleted(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null) {
- File file= getSystemFile(info);
- return file == null ? true : !file.exists();
- }
- return getParentProvider().isDeleted(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#mustSaveDocument(java.lang.Object)
- */
- public boolean mustSaveDocument(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return (info.fCount == 1) && info.fTextFileBuffer.isDirty();
- return getParentProvider().mustSaveDocument(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#canSaveDocument(java.lang.Object)
- */
- public boolean canSaveDocument(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return info.fTextFileBuffer.isDirty();
- return getParentProvider().canSaveDocument(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#getAnnotationModel(java.lang.Object)
- */
- public IAnnotationModel getAnnotationModel(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return info.fModel;
- return getParentProvider().getAnnotationModel(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#aboutToChange(java.lang.Object)
- */
- public void aboutToChange(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info == null)
- getParentProvider().aboutToChange(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#changed(java.lang.Object)
- */
- public void changed(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info == null)
- getParentProvider().changed(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#addElementStateListener(org.eclipse.ui.texteditor.IElementStateListener)
- */
- public void addElementStateListener(IElementStateListener listener) {
- Assert.isNotNull(listener);
- if (!fElementStateListeners.contains(listener))
- fElementStateListeners.add(listener);
- getParentProvider().addElementStateListener(listener);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProvider#removeElementStateListener(org.eclipse.ui.texteditor.IElementStateListener)
- */
- public void removeElementStateListener(IElementStateListener listener) {
- Assert.isNotNull(listener);
- fElementStateListeners.remove(listener);
- getParentProvider().removeElementStateListener(listener);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#isReadOnly(java.lang.Object)
- */
- public boolean isReadOnly(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return info.fCachedReadOnlyState;
- return ((IDocumentProviderExtension) getParentProvider()).isReadOnly(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#isModifiable(java.lang.Object)
- */
- public boolean isModifiable(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return info.fTextFileBuffer.isStateValidated() ? !isSystemFileReadOnly(info) : true;
- return ((IDocumentProviderExtension) getParentProvider()).isModifiable(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#validateState(java.lang.Object, java.lang.Object)
- */
- public void validateState(Object element, final Object computationContext) throws CoreException {
- final FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null) {
- DocumentProviderOperation operation= new DocumentProviderOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- info.fTextFileBuffer.validateState(monitor, computationContext);
- }
- /*
- * @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#getSchedulingRule()
- */
- public ISchedulingRule getSchedulingRule() {
- // XXX: waiting for clients (e.g. Team providers) to support scheduling rules (see bug 46753)
- return ResourcesPlugin.getWorkspace().getRoot();
-// if (info.fElement instanceof IFileEditorInput)
-// return ((IFileEditorInput)info.fElement).getFile().getParent();
-// else
-// return null;
- }
- };
- executeOperation(operation, getProgressMonitor());
- } else
- ((IDocumentProviderExtension) getParentProvider()).validateState(element, computationContext);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#isStateValidated(java.lang.Object)
- */
- public boolean isStateValidated(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return info.fTextFileBuffer.isStateValidated();
- return ((IDocumentProviderExtension) getParentProvider()).isStateValidated(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#updateStateCache(java.lang.Object)
- */
- public void updateStateCache(Object element) throws CoreException {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null) {
- boolean isReadOnly= isSystemFileReadOnly(info);
- // See http://bugs.eclipse.org/bugs/show_bug.cgi?id=14469 for the dirty bit check
- if (!info.fCachedReadOnlyState && isReadOnly && info.fTextFileBuffer.isDirty())
- info.fTextFileBuffer.resetStateValidation();
- info.fCachedReadOnlyState= isReadOnly;
- } else {
- ((IDocumentProviderExtension) getParentProvider()).updateStateCache(element);
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#setCanSaveDocument(java.lang.Object)
- */
- public void setCanSaveDocument(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info == null)
- ((IDocumentProviderExtension) getParentProvider()).setCanSaveDocument(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#getStatus(java.lang.Object)
- */
- public IStatus getStatus(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return info.fTextFileBuffer.getStatus();
- return ((IDocumentProviderExtension) getParentProvider()).getStatus(element);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#synchronize(java.lang.Object)
- */
- public void synchronize(Object element) throws CoreException {
- final FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null) {
- DocumentProviderOperation operation= new DocumentProviderOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- info.fTextFileBuffer.revert(monitor);
- }
- /*
- * @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#getSchedulingRule()
- */
- public ISchedulingRule getSchedulingRule() {
- if (info.fElement instanceof IFileEditorInput)
- return ((IFileEditorInput)info.fElement).getFile().getParent();
- else
- return null;
- }
- };
- executeOperation(operation, getProgressMonitor());
- } else {
- ((IDocumentProviderExtension) getParentProvider()).synchronize(element);
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension2#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void setProgressMonitor(IProgressMonitor progressMonitor) {
- fProgressMonitor= progressMonitor;
- ((IDocumentProviderExtension2) getParentProvider()).setProgressMonitor(progressMonitor);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension2#getProgressMonitor()
- */
- public IProgressMonitor getProgressMonitor() {
- return fProgressMonitor;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension3#isSynchronized(java.lang.Object)
- */
- public boolean isSynchronized(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return info.fTextFileBuffer.isSynchronized();
- return ((IDocumentProviderExtension3) getParentProvider()).isSynchronized(element);
- }
-
- /*
- * @see org.eclipse.ui.editors.text.IStorageDocumentProvider#getDefaultEncoding()
- */
- public String getDefaultEncoding() {
- return FileBuffers.getTextFileBufferManager().getDefaultEncoding();
- }
-
- /*
- * @see org.eclipse.ui.editors.text.IStorageDocumentProvider#getEncoding(java.lang.Object)
- */
- public String getEncoding(Object element) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- return info.fTextFileBuffer.getEncoding();
- return ((IStorageDocumentProvider) getParentProvider()).getEncoding(element);
- }
-
- /*
- * @see org.eclipse.ui.editors.text.IStorageDocumentProvider#setEncoding(java.lang.Object, java.lang.String)
- */
- public void setEncoding(Object element, String encoding) {
- FileInfo info= (FileInfo) fFileInfoMap.get(element);
- if (info != null)
- info.fTextFileBuffer.setEncoding(encoding);
- else
- ((IStorageDocumentProvider) getParentProvider()).setEncoding(element, encoding);
- }
-
- /**
- * Defines the standard procedure to handle <code>CoreExceptions</code>. Exceptions
- * are written to the plug-in log.
- *
- * @param exception the exception to be logged
- * @param message the message to be logged
- */
- protected void handleCoreException(CoreException exception, String message) {
- ILog log= Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog();
- IStatus status= message != null ? new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, exception) : exception.getStatus();
- log.log(status);
- }
-
- protected File getSystemFile(FileInfo info) {
- IPath path= info.fTextFileBuffer.getLocation();
- return FileBuffers.getSystemFileAtLocation(path);
- }
-
- protected boolean isSystemFileReadOnly(FileInfo info) {
- File file= getSystemFile(info);
- return file == null ? true : !file.canWrite();
- }
-
- protected FileInfo getFileInfo(Object element) {
- return (FileInfo) fFileInfoMap.get(element);
- }
-
- protected Iterator getConnectedElementsIterator() {
- return new HashSet(fFileInfoMap.keySet()).iterator();
- }
-
- protected Iterator getFileInfosIterator() {
- return new ArrayList(fFileInfoMap.values()).iterator();
- }
-
- protected void fireElementStateChanging(Object element) {
- List list= new ArrayList(fElementStateListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- Object l= e.next();
- if (l instanceof IElementStateListenerExtension) {
- IElementStateListenerExtension x= (IElementStateListenerExtension) l;
- x.elementStateChanging(element);
- }
- }
- }
-
- protected void fireElementStateChangeFailed(Object element) {
- List list= new ArrayList(fElementStateListeners);
- Iterator e= list.iterator();
- while (e.hasNext()) {
- Object l= e.next();
- if (l instanceof IElementStateListenerExtension) {
- IElementStateListenerExtension x= (IElementStateListenerExtension) l;
- x.elementStateChangeFailed(element);
- }
- }
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java
deleted file mode 100644
index 8e1cbdbc3ef..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.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.editors.text;
-
-import org.eclipse.jface.text.source.IAnnotationHover;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-
-/**
- * SourceViewer configuration for the text editor.
- *
- * @since 3.0
- */
-public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
-
- /**
- * A noop implementation of <code>IAnnotationHover</code> that will trigger the text editor
- * to set up annotation hover support.
- */
- private static class NullHover implements IAnnotationHover {
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationHover#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer, int)
- */
- public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
- return null;
- }
-
- }
-
- /*
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer)
- */
- public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
- return new NullHover();
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/UISynchronizationContext.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/UISynchronizationContext.java
deleted file mode 100644
index 2911b5bbe95..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/UISynchronizationContext.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.ui.editors.text;
-
-import org.eclipse.core.filebuffers.ISynchronizationContext;
-
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Synchronization context for file buffers whose documents are shown in the UI.
- * The synchronization runnable is executed in the UI thread.
- *
- * @since 3.0
- */
-public class UISynchronizationContext implements ISynchronizationContext {
-
- /*
- * @see org.eclipse.core.filebuffers.ISynchronizationContext#run(java.lang.Runnable)
- */
- public void run(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/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/WorkspaceOperationRunner.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/WorkspaceOperationRunner.java
deleted file mode 100644
index f10622124f7..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/WorkspaceOperationRunner.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.editors.text;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-
-import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
-
-/**
- * @since 3.0
- */
-public class WorkspaceOperationRunner implements IRunnableContext {
-
- private IProgressMonitor fProgressMonitor;
-
- public WorkspaceOperationRunner() {
- }
-
- /**
- * Sets the progress monitor.
- *
- * @param progressMonitor the progress monitor to set
- */
- public void setProgressMonitor(IProgressMonitor progressMonitor) {
- fProgressMonitor= progressMonitor;
- }
-
- /**
- * Returns the progress monitor. It there is no progress monitor the monitor\
- * is set to the <code>NullProgressMonitor</code>.
- *
- * @return the progress monitor
- */
- public IProgressMonitor getProgressMonitor() {
- if (fProgressMonitor == null)
- fProgressMonitor= new NullProgressMonitor();
- return fProgressMonitor;
- }
-
- /*
- * @see org.eclipse.jface.operation.IRunnableContext#run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
- */
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- if (runnable instanceof ISchedulingRuleProvider)
- run(fork, cancelable, runnable, ((ISchedulingRuleProvider)runnable).getSchedulingRule());
- else
- run(fork, cancelable, runnable, ResourcesPlugin.getWorkspace().getRoot());
- }
-
- /*
- * @see org.eclipse.jface.operation.IRunnableContext#run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
- */
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable, ISchedulingRule schedulingRule) throws InvocationTargetException, InterruptedException {
- WorkspaceModifyDelegatingOperation operation= new WorkspaceModifyDelegatingOperation(runnable, schedulingRule);
- operation.run(getProgressMonitor());
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/package.html b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/package.html
deleted file mode 100644
index 7e26e13bc9e..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/package.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.51 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a standard text editor and a file-based document
-provider.
-</body>
-</html>
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java
deleted file mode 100644
index 99d55676d3b..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.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.ui.internal.editors.quickdiff;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.jobs.IJobManager;
-
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.editors.text.IStorageDocumentProvider;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.IElementStateListener;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.quickdiff.IQuickDiffProviderImplementation;
-
-/**
- * Default provider for the quickdiff display - the saved document is taken as the reference.
- *
- * @since 3.0
- */
-public class LastSaveReferenceProvider implements IQuickDiffProviderImplementation, IElementStateListener {
-
- /** <code>true</code> if the document has been read. */
- private boolean fDocumentRead= false;
- /** The reference document - might be <code>null</code> even if <code>fDocumentRead</code> is <code>true</code>. */
- private IDocument fReference= null;
- /** Our unique id that makes us comparable to another instance of the same provider. See extension point reference. */
- private String fId;
- /** The current document provider. */
- private IDocumentProvider fDocumentProvider;
- /** The current editor input. */
- private IEditorInput fEditorInput;
- /** Private lock noone else will synchronize on. */
- private final Object fLock= new Object();
- /** The progress monitor for a currently running <code>getReference</code> operation, or <code>null</code>. */
- private IProgressMonitor fProgressMonitor;
-
- /*
- * @see org.eclipse.ui.editors.quickdiff.IQuickDiffReferenceProvider#getReference()
- */
- public IDocument getReference(IProgressMonitor monitor) {
- if (!fDocumentRead)
- readDocument(monitor);
- return fReference;
- }
-
- /*
- * @see org.eclipse.ui.editors.quickdiff.IQuickDiffReferenceProvider#dispose()
- */
- public void dispose() {
- IDocumentProvider provider= fDocumentProvider;
- if (provider != null)
- provider.removeElementStateListener(this);
-
- IProgressMonitor monitor= fProgressMonitor;
- if (monitor != null) {
- monitor.setCanceled(true);
- }
-
- synchronized (fLock) {
- fEditorInput= null;
- fDocumentProvider= null;
- fReference= null;
- fDocumentRead= false;
- fProgressMonitor= null;
- }
- }
-
- /*
- * @see org.eclipse.ui.editors.quickdiff.IQuickDiffReferenceProvider#getId()
- */
- public String getId() {
- return fId;
- }
-
- /*
- * @see org.eclipse.ui.editors.quickdiff.IQuickDiffProviderImplementation#setActiveEditor(org.eclipse.ui.texteditor.ITextEditor)
- */
- public void setActiveEditor(ITextEditor targetEditor) {
-
- IDocumentProvider provider= null;
- IEditorInput input= null;
- if (targetEditor != null) {
- provider= targetEditor.getDocumentProvider();
- input= targetEditor.getEditorInput();
- }
-
- // dispose if the editor input or document provider have changed
- // note that they may serve multiple editors
- if (provider != fDocumentProvider || input != fEditorInput) {
- dispose();
- synchronized (fLock) {
- fDocumentProvider= provider;
- fEditorInput= input;
- }
- }
- }
-
- /*
- * @see org.eclipse.ui.editors.quickdiff.IQuickDiffProviderImplementation#isEnabled()
- */
- public boolean isEnabled() {
- return fEditorInput != null && fDocumentProvider != null;
- }
-
- /*
- * @see org.eclipse.ui.editors.quickdiff.IQuickDiffProviderImplementation#setId(java.lang.String)
- */
- public void setId(String id) {
- fId= id;
- }
-
- /**
- * Reads in the saved document into <code>fReference</code>.
- *
- * @param monitor a progress monitor, or <code>null</code>
- */
- private void readDocument(IProgressMonitor monitor) {
-
- // protect against concurrent disposal
- IDocumentProvider prov= fDocumentProvider;
- IEditorInput inp= fEditorInput;
- IDocument doc= fReference;
-
- if (prov instanceof IStorageDocumentProvider && inp instanceof IFileEditorInput) {
-
- IFileEditorInput input= (IFileEditorInput) inp;
- IStorageDocumentProvider provider= (IStorageDocumentProvider) prov;
-
- if (doc == null)
- doc= new Document();
-
- // addElementStateListener adds at most once - no problem to call repeatedly
- ((IDocumentProvider)provider).addElementStateListener(this);
-
- IJobManager jobMgr= Platform.getJobManager();
- IFile file= input.getFile();
-
- try {
- fProgressMonitor= monitor;
- jobMgr.beginRule(file, monitor);
-
- InputStream stream= getFileContents(file);
- if (stream == null)
- return;
-
- String encoding= getEncoding(input, provider);
- if (encoding == null)
- return;
-
- setDocumentContent(doc, stream, encoding, monitor);
-
- } catch (IOException e) {
- return;
- } finally {
- jobMgr.endRule(file);
- fProgressMonitor= null;
- }
-
- if (monitor != null && monitor.isCanceled())
- return;
-
-
- // update state
- synchronized (fLock) {
- if (fDocumentProvider == provider && fEditorInput == input) {
- // only update state if our provider / input pair has not been updated in between (dispose or setActiveEditor)
- fReference= doc;
- fDocumentRead= true;
- }
- }
-
- }
- }
-
- /* utility methods */
-
- /**
- * Gets the contents of <code>file</code> as an input stream.
- *
- * @param file the <code>IFile</code> which we want the content for
- * @return an input stream for the file's content
- */
- private static InputStream getFileContents(IFile file) {
- InputStream stream= null;
- try {
- if (file != null)
- stream= file.getContents();
-
- } catch (CoreException e) {
- }
- return stream;
- }
-
- /**
- * Returns the encoding of the file corresponding to <code>input</code>. If no encoding can
- * be found, the default encoding as returned by <code>provider.getDefaultEncoding()</code> is
- * returned.
- *
- * @param input the current editor input
- * @param provider the current document provider
- * @return the encoding for the file corresponding to <code>input</code>, or the default encoding
- */
- private static String getEncoding(IFileEditorInput input, IStorageDocumentProvider provider) {
- String encoding= provider.getEncoding(input);
- if (encoding == null)
- encoding= provider.getDefaultEncoding();
- return encoding;
- }
-
- /**
- * Intitializes the given document with the given stream using the given encoding.
- *
- * @param document the document to be initialized
- * @param contentStream the stream which delivers the document content
- * @param encoding the character encoding for reading the given stream
- * @param monitor a progress monitor for cancellation, or <code>null</code>
- * @exception IOException if the given stream can not be read
- */
- private static void setDocumentContent(IDocument document, InputStream contentStream, String encoding, IProgressMonitor monitor) throws IOException {
- Reader in= null;
- try {
- final int DEFAULT_FILE_SIZE= 15 * 1024;
-
- in= new BufferedReader(new InputStreamReader(contentStream, encoding), DEFAULT_FILE_SIZE);
- StringBuffer buffer= new StringBuffer(DEFAULT_FILE_SIZE);
- char[] readBuffer= new char[2048];
- int n= in.read(readBuffer);
- while (n > 0) {
- if (monitor != null && monitor.isCanceled())
- return;
-
- buffer.append(readBuffer, 0, n);
- n= in.read(readBuffer);
- }
-
- document.set(buffer.toString());
-
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException x) {
- }
- }
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IElementStateListener#elementDirtyStateChanged(java.lang.Object, boolean)
- */
- public void elementDirtyStateChanged(Object element, boolean isDirty) {
- if (!isDirty && element == fEditorInput) {
- // document has been saved or reverted - recreate reference
- readDocument(null);
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IElementStateListener#elementContentAboutToBeReplaced(java.lang.Object)
- */
- public void elementContentAboutToBeReplaced(Object element) {
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IElementStateListener#elementContentReplaced(java.lang.Object)
- */
- public void elementContentReplaced(Object element) {
- if (element == fEditorInput) {
- // document has been reverted or replaced
- readDocument(null);
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IElementStateListener#elementDeleted(java.lang.Object)
- */
- public void elementDeleted(Object element) {
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IElementStateListener#elementMoved(java.lang.Object, java.lang.Object)
- */
- public void elementMoved(Object originalElement, Object movedElement) {
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ColorEditor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ColorEditor.java
deleted file mode 100644
index f9ab94721eb..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ColorEditor.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.internal.editors.text;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.ColorDialog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.resource.JFaceResources;
-
-/**
- * A "button" of a certain color determined by the color picker.
- *
- * @since 2.1
- */
-class ColorEditor {
-
- /** The extent. */
- private Point fExtent;
- /** The image for the push button. */
- private Image fImage;
- /** The current RGB color value. */
- private RGB fColorValue;
- /** The current color. */
- private Color fColor;
- /** The image push button which open the color dialog. */
- private Button fButton;
-
- /**
- * Creates and returns a new color editor.
- *
- * @param parent the parent composite of this color editor
- */
- public ColorEditor(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;
- }
- }
- });
- }
-
- /**
- * Returns the current RGB color value.
- *
- * @return an rgb with the current color value
- */
- public RGB getColorValue() {
- return fColorValue;
- }
-
- /**
- * Sets the current RGB color value.
- *
- * @param rgb the new value for the rgb color value
- */
- public void setColorValue(RGB rgb) {
- fColorValue= rgb;
- updateColorImage();
- }
-
- /**
- * Returns the image push button.
- *
- * @return the button which shows the current color as image
- */
- public Button getButton() {
- return fButton;
- }
-
- /**
- * Updates the color of the button image.
- */
- 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);
- }
-
-
- /**
- * Computes the size for the image.
- *
- * @param window the window on which to render the image
- * @return the point with the image size
- */
- protected 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;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java
deleted file mode 100644
index 7eed390fd4b..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.editors.text;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-
-import org.eclipse.jface.text.source.ISharedTextColors;
-
-import org.eclipse.ui.editors.text.TextEditorPreferenceConstants;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.texteditor.AnnotationPreferenceLookup;
-import org.eclipse.ui.texteditor.AnnotationTypeHierarchy;
-import org.eclipse.ui.texteditor.AnnotationTypeLookup;
-import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
-
-/**
- * Represents the editors plug-in. It provides a series of convenience methods such as
- * access to the shared text colors and the log.
- *
- * @since 2.1
- */
-public class EditorsPlugin extends AbstractUIPlugin {
-
- private static EditorsPlugin fgInstance;
-
- public static EditorsPlugin getDefault() {
- return fgInstance;
- }
-
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- public static String getPluginId() {
- return getDefault().getDescriptor().getUniqueIdentifier();
- }
-
- public static void logErrorMessage(String message) {
- if (message == null)
- message= ""; //$NON-NLS-1$
- log(new Status(IStatus.ERROR, getPluginId(), IEditorsStatusConstants.INTERNAL_ERROR, message, null));
- }
-
- public static void logErrorStatus(String message, IStatus status) {
- if (status == null) {
- logErrorMessage(message);
- return;
- }
- MultiStatus multi= new MultiStatus(getPluginId(), IEditorsStatusConstants.INTERNAL_ERROR, message, null);
- multi.add(status);
- log(multi);
- }
-
- public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, getPluginId(), IEditorsStatusConstants.INTERNAL_ERROR, TextEditorMessages.getString("EditorsPlugin.internal_error"), e)); //$NON-NLS-1$
- }
-
-
-
- private FileEditorInputAdapterFactory fFileEditorInputAdapterFactory;
- private ISharedTextColors fSharedTextColors;
- private AnnotationTypeLookup fAnnotationTypeLookup;
- private AnnotationPreferenceLookup fAnnotationPreferenceLookup;
- private AnnotationTypeHierarchy fAnnotationTypeHierarchy;
-
-
- public EditorsPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- fgInstance= this;
- }
-
-
- /*
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeDefaultPreferences(org.eclipse.jface.preference.IPreferenceStore)
- */
- protected void initializeDefaultPreferences(IPreferenceStore store) {
- MarkerAnnotationPreferences.initializeDefaultValues(store);
- TextEditorPreferenceConstants.initializeDefaultValues(store);
- }
-
- /*
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#startup()
- */
- public void startup() throws CoreException {
- super.startup();
- fFileEditorInputAdapterFactory= new FileEditorInputAdapterFactory();
- IAdapterManager manager= Platform.getAdapterManager();
- manager.registerAdapters(fFileEditorInputAdapterFactory, IFile.class);
- }
-
- /*
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#shutdown()
- */
- public void shutdown() throws CoreException {
- IAdapterManager manager= Platform.getAdapterManager();
- manager.unregisterAdapters(fFileEditorInputAdapterFactory);
-
- if (fSharedTextColors != null) {
- fSharedTextColors.dispose();
- fSharedTextColors= null;
- }
-
- fAnnotationTypeLookup= null;
- fAnnotationPreferenceLookup= null;
- fAnnotationTypeHierarchy= null;
-
- super.shutdown();
- }
-
- /**
- * Returns the shared text colors of this plug-in.
- *
- * @return the shared text colors
- * @since 3.0
- */
- public ISharedTextColors getSharedTextColors() {
- if (fSharedTextColors == null)
- fSharedTextColors= new SharedTextColors();
- return fSharedTextColors;
- }
-
- /**
- * Returns the annotation type lookup of this plug-in.
- *
- * @return the annotation type lookup
- * @since 3.0
- */
- public AnnotationTypeLookup getAnnotationTypeLookup() {
- if (fAnnotationTypeLookup == null)
- fAnnotationTypeLookup= new AnnotationTypeLookup();
- return fAnnotationTypeLookup;
- }
-
- /**
- * Returns the annotation preference lookup of this plug-in.
- *
- * @return the annotation preference lookup
- * @since 3.0
- */
- public AnnotationPreferenceLookup getAnnotationPreferenceLookup() {
- if (fAnnotationPreferenceLookup == null)
- fAnnotationPreferenceLookup= new AnnotationPreferenceLookup();
- return fAnnotationPreferenceLookup;
- }
-
- /**
- * Returns the annotation type hierarchy for this plug-in.
- *
- * @return the annotation type hierarchy
- * @since 3.0
- */
- public AnnotationTypeHierarchy getAnnotationTypeHierarchy() {
- if (fAnnotationTypeHierarchy == null)
- fAnnotationTypeHierarchy= new AnnotationTypeHierarchy();
- return fAnnotationTypeHierarchy;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/FileEditorInputAdapterFactory.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/FileEditorInputAdapterFactory.java
deleted file mode 100644
index 389629e9bf0..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/FileEditorInputAdapterFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-
-package org.eclipse.ui.internal.editors.text;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.editors.text.ILocationProvider;
-
-/**
- * @since 3.0
- */
-public class FileEditorInputAdapterFactory implements IAdapterFactory {
-
- private static class LocationProvider implements ILocationProvider {
- /*
- * @see org.eclipse.ui.editors.text.ILocationProvider#getLocation(java.lang.Object)
- */
- public IPath getPath(Object element) {
- if (element instanceof IFileEditorInput) {
- IFileEditorInput input= (IFileEditorInput) element;
- return input.getFile().getFullPath();
- }
- return null;
- }
- }
-
- /** The list of provided adapters. */
- private static final Class[] ADAPTER_LIST= new Class[] { ILocationProvider.class };
-
- /** The provided location provider */
- private ILocationProvider fLocationProvider= new LocationProvider();
-
- /*
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (ILocationProvider.class.equals(adapterType)) {
- if (adaptableObject instanceof IFile)
- return fLocationProvider;
- }
- return null;
- }
-
- /*
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
- return ADAPTER_LIST;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IEditorsStatusConstants.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IEditorsStatusConstants.java
deleted file mode 100644
index 39442e9f70c..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IEditorsStatusConstants.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.ui.internal.editors.text;
-
-/**
- * Defines plug-in-specific status codes.
- *
- * @see org.eclipse.core.runtime.IStatus#getCode()
- * @see org.eclipse.core.runtime.Status#Status(int, java.lang.String, int, java.lang.String, java.lang.Throwable)
- * @since 2.1
- */
-interface IEditorsStatusConstants {
-
- /**
- * Status constant indicating that an internal error occurred.
- * Value: <code>1001</code>
- */
- public static final int INTERNAL_ERROR= 10001;
-
- }
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/JavaFileEditorInput.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/JavaFileEditorInput.java
deleted file mode 100644
index cecb958a0bb..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/JavaFileEditorInput.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.ui.internal.editors.text;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.editors.text.ILocationProvider;
-
-/**
- * @since 3.0
- */
-public class JavaFileEditorInput implements IEditorInput, ILocationProvider {
-
- private File fFile;
-
- public JavaFileEditorInput(File file) {
- super();
- fFile= file;
- }
- /*
- * @see org.eclipse.ui.IEditorInput#exists()
- */
- public boolean exists() {
- return fFile.exists();
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- public String getName() {
- return fFile.getName();
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getPersistable()
- */
- public IPersistableElement getPersistable() {
- return null;
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- public String getToolTipText() {
- return fFile.getAbsolutePath();
- }
-
- /*
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (ILocationProvider.class.equals(adapter))
- return this;
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /*
- * @see org.eclipse.ui.editors.text.ILocationProvider#getPath(java.lang.Object)
- */
- public IPath getPath(Object element) {
- if (element instanceof JavaFileEditorInput) {
- JavaFileEditorInput input= (JavaFileEditorInput) element;
- return new Path(input.fFile.getAbsolutePath());
- }
- return null;
- }
-
- /*
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object o) {
- if (o == this)
- return true;
-
- if (o instanceof JavaFileEditorInput) {
- JavaFileEditorInput input = (JavaFileEditorInput) o;
- return fFile.equals(input.fFile);
- }
-
- return false;
- }
-
- /*
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fFile.hashCode();
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPreviousPulldownActionDelegate.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPreviousPulldownActionDelegate.java
deleted file mode 100644
index 63d33bd9460..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPreviousPulldownActionDelegate.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.editors.text;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
-import org.eclipse.ui.texteditor.AnnotationPreference;
-import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
-
-/**
- * The abstract class for next and previous pulldown action delegates.
- *
- * @since 3.0
- */
-public abstract class NextPreviousPulldownActionDelegate extends Action implements IMenuCreator, IWorkbenchWindowPulldownDelegate2 {
-
- /** The cached menu. */
- private Menu fMenu;
-
- /** The preference store */
- private IPreferenceStore fStore;
-
- /** Action for handling menu item selection. */
- private static class NavigationEnablementAction extends Action {
-
- /** The preference store. */
- private IPreferenceStore fStore;
-
- /** The preference key for the value in the store. */
- private String fKey;
-
- /**
- * Creates a named navigation enablement action.
- *
- * @param name the name of this action.
- */
- public NavigationEnablementAction(String name, IPreferenceStore store, String key) {
- super(name, IAction.AS_CHECK_BOX);
- fStore= store;
- fKey= key;
- setChecked(fStore.getBoolean(fKey));
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- fStore.setValue(fKey, isChecked());
- }
- }
-
- /**
- * Returns the preference key to be used in the
- * <code>NavigationEnablementAction</code>.
- *
- * @return the preference key or <code>null</code> if the key is not defined in XML
- */
- public abstract String getPreferenceKey(AnnotationPreference annotationPreference);
-
- /*
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
- public Menu getMenu(Control parent) {
- if (fMenu != null)
- fMenu.dispose();
-
- fMenu= new Menu(parent);
- fillMenu(fMenu);
-
- return fMenu;
- }
-
- /**
- * Creates a next previous action delegate.
- */
- public NextPreviousPulldownActionDelegate() {
- fStore= EditorsPlugin.getDefault().getPreferenceStore();
- }
-
- /*
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
- public Menu getMenu(Menu parent) {
- if (fMenu == null) {
- fMenu= new Menu(parent);
- fillMenu(fMenu);
- }
-
- return fMenu;
- }
-
- /*
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- fMenu= null;
- }
- }
-
- /**
- * Fills the given menu using marker
- * annotation preferences.
- *
- * @param menu the menu to fill
- */
- private void fillMenu(Menu menu) {
- IAction[] actions= getActionsFromDescriptors();
-
- for (int i= 0; i < actions.length; i++) {
- ActionContributionItem item= new ActionContributionItem(actions[i]);
- item.fill(menu, -1);
- }
- }
-
- /**
- * Creates actions using marker
- * annotation preferences.
- *
- * @return the navigation enablement actions
- */
- private IAction[] getActionsFromDescriptors() {
- MarkerAnnotationPreferences fMarkerAnnotationPreferences= new MarkerAnnotationPreferences();
- ArrayList containers= new ArrayList();
-
- Iterator iter= fMarkerAnnotationPreferences.getAnnotationPreferences().iterator();
- while (iter.hasNext()) {
- AnnotationPreference preference= (AnnotationPreference)iter.next();
- String key= preference.getShowInNextPrevDropdownToolbarActionKey();
- if (key != null && fStore.getBoolean(key)) {
- String preferenceKey= getPreferenceKey(preference);
-
- /*
- * Fixes bug 41689
- * This code can be simplified if we decide that
- * we don't allow to use different settings for go to
- * previous and go to next annotation.
- */
- preferenceKey= preference.getIsGoToNextNavigationTargetKey();
-
- if (preferenceKey != null)
- containers.add(new NavigationEnablementAction(preference.getPreferenceLabel(), fStore, preferenceKey));
- }
- }
-
- return (IAction[]) containers.toArray(new Action[containers.size()]);
- }
-
- /*
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- }
-
- /*
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- }
-
- /*
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPulldownActionDelegate.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPulldownActionDelegate.java
deleted file mode 100644
index 2ca4a1a440a..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPulldownActionDelegate.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.internal.editors.text;
-
-import org.eclipse.ui.texteditor.AnnotationPreference;
-
-/**
- * The next pulldown action delegate.
- *
- * @since 3.0
- */
-public class NextPulldownActionDelegate extends NextPreviousPulldownActionDelegate {
-
- /*
- * @see org.eclipse.ui.internal.texteditor.NextPreviousPulldownActionDelegate#getPreferenceKey(AnnotationPreference)
- */
- public String getPreferenceKey(AnnotationPreference annotationPreference) {
- return annotationPreference.getIsGoToNextNavigationTargetKey();
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OpenExternalFileAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OpenExternalFileAction.java
deleted file mode 100644
index 34761344be8..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OpenExternalFileAction.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.ui.internal.editors.text;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
-
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
-import org.eclipse.ui.part.FileEditorInput;
-
-/**
- * @since 3.0
- */
-public class OpenExternalFileAction extends Action implements IWorkbenchWindowActionDelegate {
-
- static class FileLabelProvider extends LabelProvider {
- /*
- * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- if (element instanceof IFile) {
- IPath path= ((IFile) element).getFullPath();
- return path != null ? path.toString() : ""; //$NON-NLS-1$
- }
- return super.getText(element);
- }
- }
-
-
- private IWorkbenchWindow fWindow;
-
- public OpenExternalFileAction() {
- setEnabled(true);
- }
-
- /*
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
- */
- public void dispose() {
- fWindow= null;
- }
-
- /*
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- fWindow= window;
- }
-
- /*
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- run();
- }
-
- /*
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- private File queryFile() {
- FileDialog dialog= new FileDialog(fWindow.getShell(), SWT.OPEN);
- dialog.setText(TextEditorMessages.getString("OpenExternalFileAction.dialog.text")); //$NON-NLS-1$
- String path= dialog.open();
- if (path != null)
- return new File(path);
- return null;
- }
-
- /*
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- File file= queryFile();
- if (file != null && file.exists()) {
- IEditorInput input= createEditorInput(file);
- String editorId= getEditorId(file);
- IWorkbenchPage page= fWindow.getActivePage();
- try {
- page.openEditor(input, editorId);
- } catch (PartInitException e) {
- e.printStackTrace();
- }
- }
- }
-
- private String getEditorId(File file) {
- IWorkbench workbench= fWindow.getWorkbench();
- IEditorRegistry editorRegistry= workbench.getEditorRegistry();
- IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName());
- if (descriptor != null)
- return descriptor.getId();
- return "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
- }
-
- private IEditorInput createEditorInput(File file) {
- IFile workspaceFile= getWorkspaceFile(file);
- if (workspaceFile != null)
- return new FileEditorInput(workspaceFile);
- return new JavaFileEditorInput(file);
- }
-
- private IFile getWorkspaceFile(File file) {
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IPath location= new Path(file.getAbsolutePath());
- IFile[] files= workspace.getRoot().findFilesForLocation(location);
- if (files == null || files.length == 0)
- return null;
- if (files.length == 1)
- return files[0];
- return selectWorkspaceFile(files);
- }
-
- private IFile selectWorkspaceFile(IFile[] files) {
- ElementListSelectionDialog dialog= new ElementListSelectionDialog(fWindow.getShell(), new FileLabelProvider());
- dialog.setElements(files);
- dialog.setTitle("Select Workspace File");
- dialog.setMessage("The selected file is referenced by multiple linked resources in the workspace.\nPlease select the workspace resource you want to use to open the file.");
- if (dialog.open() == Window.OK)
- return (IFile) dialog.getFirstResult();
- return null;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OverlayPreferenceStore.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OverlayPreferenceStore.java
deleted file mode 100644
index e0a4c122ca2..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OverlayPreferenceStore.java
+++ /dev/null
@@ -1,514 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.editors.text;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-/**
- * An overlaying preference store.
- *
- * @since 2.1
- */
-class OverlayPreferenceStore implements IPreferenceStore {
-
-
- /**
- * Descriptor used to denote data types.
- */
- public static final class TypeDescriptor {
- private TypeDescriptor() {
- }
- }
-
- public static final TypeDescriptor BOOLEAN= new TypeDescriptor();
- public static final TypeDescriptor DOUBLE= new TypeDescriptor();
- public static final TypeDescriptor FLOAT= new TypeDescriptor();
- public static final TypeDescriptor INT= new TypeDescriptor();
- public static final TypeDescriptor LONG= new TypeDescriptor();
- public static final TypeDescriptor STRING= new TypeDescriptor();
-
- /**
- * Data structure for the overlay key.
- */
- public static class OverlayKey {
-
- TypeDescriptor fDescriptor;
- String fKey;
-
- public OverlayKey(TypeDescriptor descriptor, String key) {
- fDescriptor= descriptor;
- fKey= key;
- }
- }
-
- /*
- * @see IPropertyChangeListener
- */
- private class PropertyListener implements IPropertyChangeListener {
-
- /*
- * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- OverlayKey key= findOverlayKey(event.getProperty());
- if (key != null)
- propagateProperty(fParent, key, fStore);
- }
- }
-
-
- /** The parent preference store. */
- private IPreferenceStore fParent;
- /** This store. */
- private IPreferenceStore fStore;
- /** The keys of this store. */
- private OverlayKey[] fOverlayKeys;
- /** The property listener. */
- private PropertyListener fPropertyListener;
-
-
- /**
- * Creates and returns a new overlay preference store.
- *
- * @param parent the parent preference store
- * @param overlayKeys the overlay keys
- */
- public OverlayPreferenceStore(IPreferenceStore parent, OverlayKey[] overlayKeys) {
- fParent= parent;
- fOverlayKeys= overlayKeys;
- fStore= new PreferenceStore();
- }
-
- /**
- * Tries to find and return the overlay key for the given preference key string.
- *
- * @param key the preference key string
- * @return the overlay key or <code>null</code> if none can be found
- */
- private OverlayKey findOverlayKey(String key) {
- for (int i= 0; i < fOverlayKeys.length; i++) {
- if (fOverlayKeys[i].fKey.equals(key))
- return fOverlayKeys[i];
- }
- return null;
- }
-
- /**
- * Tells whether the given preference key string is
- * covered by this overlay store.
- *
- * @param key the preference key string
- * @return <code>true</code> if this overlay store covers the given key
- */
- private boolean covers(String key) {
- return (findOverlayKey(key) != null);
- }
-
- /**
- * Propagates the given overlay key from the orgin to the target preference store.
- *
- * @param orgin the source preference store
- * @param key the overlay key
- * @param target the preference store to which the key is propagated
- */
- private void propagateProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target) {
-
- if (orgin.isDefault(key.fKey)) {
- if (!target.isDefault(key.fKey))
- target.setToDefault(key.fKey);
- return;
- }
-
- TypeDescriptor d= key.fDescriptor;
- if (BOOLEAN == d) {
-
- boolean originValue= orgin.getBoolean(key.fKey);
- boolean targetValue= target.getBoolean(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (DOUBLE == d) {
-
- double originValue= orgin.getDouble(key.fKey);
- double targetValue= target.getDouble(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (FLOAT == d) {
-
- float originValue= orgin.getFloat(key.fKey);
- float targetValue= target.getFloat(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (INT == d) {
-
- int originValue= orgin.getInt(key.fKey);
- int targetValue= target.getInt(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (LONG == d) {
-
- long originValue= orgin.getLong(key.fKey);
- long targetValue= target.getLong(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (STRING == d) {
-
- String originValue= orgin.getString(key.fKey);
- String targetValue= target.getString(key.fKey);
- if (targetValue != null && originValue != null && !targetValue.equals(originValue))
- target.setValue(key.fKey, originValue);
-
- }
- }
-
- /**
- * Propagates all overlay keys from this store to the parent store.
- */
- public void propagate() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- propagateProperty(fStore, fOverlayKeys[i], fParent);
- }
-
- /**
- * Loads the given key from the orgin into the target.
- *
- * @param orgin the source preference store
- * @param key the overlay key
- * @param target the preference store to which the key is propagated
- * @param forceInitialization if <code>true</code> the value in the target gets initialized before loading
- */
- private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target, boolean forceInitialization) {
- TypeDescriptor d= key.fDescriptor;
- if (BOOLEAN == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, true);
- target.setValue(key.fKey, orgin.getBoolean(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey));
-
- } else if (DOUBLE == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1.0D);
- target.setValue(key.fKey, orgin.getDouble(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey));
-
- } else if (FLOAT == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1.0F);
- target.setValue(key.fKey, orgin.getFloat(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey));
-
- } else if (INT == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1);
- target.setValue(key.fKey, orgin.getInt(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey));
-
- } else if (LONG == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1L);
- target.setValue(key.fKey, orgin.getLong(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey));
-
- } else if (STRING == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, "1"); //$NON-NLS-1$
- target.setValue(key.fKey, orgin.getString(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultString(key.fKey));
-
- }
- }
-
- /**
- * Loads the values from the parent into this store.
- */
- public void load() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- loadProperty(fParent, fOverlayKeys[i], fStore, true);
- }
-
- /**
- * Loads the default values.
- */
- public void loadDefaults() {
- for (int i= 0; i < fOverlayKeys.length; i++)
- setToDefault(fOverlayKeys[i].fKey);
- }
-
- /**
- * Starts to listen for changes.
- */
- public void start() {
- if (fPropertyListener == null) {
- fPropertyListener= new PropertyListener();
- fParent.addPropertyChangeListener(fPropertyListener);
- }
- }
-
- /**
- * Stops to listen for changes.
- */
- public void stop() {
- if (fPropertyListener != null) {
- fParent.removePropertyChangeListener(fPropertyListener);
- fPropertyListener= null;
- }
- }
-
- /*
- * @see IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- fStore.addPropertyChangeListener(listener);
- }
-
- /*
- * @see IPreferenceStore#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- fStore.removePropertyChangeListener(listener);
- }
-
- /*
- * @see IPreferenceStore#firePropertyChangeEvent(java.lang.String, java.lang.Object, java.lang.Object)
- */
- public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
- fStore.firePropertyChangeEvent(name, oldValue, newValue);
- }
-
- /*
- * @see IPreferenceStore#contains(java.lang.String)
- */
- public boolean contains(String name) {
- return fStore.contains(name);
- }
-
- /*
- * @see IPreferenceStore#getBoolean(java.lang.String)
- */
- public boolean getBoolean(String name) {
- return fStore.getBoolean(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultBoolean(java.lang.String)
- */
- public boolean getDefaultBoolean(String name) {
- return fStore.getDefaultBoolean(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultDouble(java.lang.String)
- */
- public double getDefaultDouble(String name) {
- return fStore.getDefaultDouble(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultFloat(String)
- */
- public float getDefaultFloat(String name) {
- return fStore.getDefaultFloat(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultInt(String)
- */
- public int getDefaultInt(String name) {
- return fStore.getDefaultInt(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultLong(String)
- */
- public long getDefaultLong(String name) {
- return fStore.getDefaultLong(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultString(String)
- */
- public String getDefaultString(String name) {
- return fStore.getDefaultString(name);
- }
-
- /*
- * @see IPreferenceStore#getDouble(String)
- */
- public double getDouble(String name) {
- return fStore.getDouble(name);
- }
-
- /*
- * @see IPreferenceStore#getFloat(String)
- */
- public float getFloat(String name) {
- return fStore.getFloat(name);
- }
-
- /*
- * @see IPreferenceStore#getInt(String)
- */
- public int getInt(String name) {
- return fStore.getInt(name);
- }
-
- /*
- * @see IPreferenceStore#getLong(String)
- */
- public long getLong(String name) {
- return fStore.getLong(name);
- }
-
- /*
- * @see IPreferenceStore#getString(String)
- */
- public String getString(String name) {
- return fStore.getString(name);
- }
-
- /*
- * @see IPreferenceStore#isDefault(String)
- */
- public boolean isDefault(String name) {
- return fStore.isDefault(name);
- }
-
- /*
- * @see IPreferenceStore#needsSaving()
- */
- public boolean needsSaving() {
- return fStore.needsSaving();
- }
-
- /*
- * @see IPreferenceStore#putValue(String, String)
- */
- public void putValue(String name, String value) {
- if (covers(name))
- fStore.putValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, double)
- */
- public void setDefault(String name, double value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, float)
- */
- public void setDefault(String name, float value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, int)
- */
- public void setDefault(String name, int value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, long)
- */
- public void setDefault(String name, long value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, String)
- */
- public void setDefault(String name, String value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, boolean)
- */
- public void setDefault(String name, boolean value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setToDefault(String)
- */
- public void setToDefault(String name) {
- fStore.setToDefault(name);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, double)
- */
- public void setValue(String name, double value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, float)
- */
- public void setValue(String name, float value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, int)
- */
- public void setValue(String name, int value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, long)
- */
- public void setValue(String name, long value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, String)
- */
- public void setValue(String name, String value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, boolean)
- */
- public void setValue(String name, boolean value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/PreviousPulldownActionDelegate.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/PreviousPulldownActionDelegate.java
deleted file mode 100644
index 812b58d4ae3..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/PreviousPulldownActionDelegate.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.internal.editors.text;
-
-import org.eclipse.ui.texteditor.AnnotationPreference;
-
-/**
- * The previous pulldown action delegate.
- *
- * @since 3.0
- */
-public class PreviousPulldownActionDelegate extends NextPreviousPulldownActionDelegate {
-
- /*
- * @see org.eclipse.ui.internal.texteditor.NextPreviousPulldownActionDelegate#getPreferenceKey(AnnotationPreference)
- */
- public String getPreferenceKey(AnnotationPreference annotationPreference) {
- return annotationPreference.getIsGoToPreviousNavigationTargetKey();
- }
-
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.java
deleted file mode 100644
index 5047227c194..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.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.internal.editors.text;
-
-import java.util.Iterator;
-import org.eclipse.swt.widgets.Display;
-import java.util.Map;
-import java.util.HashMap;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.jface.text.source.ISharedTextColors;
-import org.eclipse.swt.graphics.RGB;
-
-/*
- * @see org.eclipse.jface.text.source.ISharedTextColors
- * @since 2.1
- */
-class SharedTextColors implements ISharedTextColors {
-
- /** The display table. */
- private Map fDisplayTable;
-
- /** Creates an returns a shared color manager. */
- public SharedTextColors() {
- super();
- }
-
- /*
- * @see ISharedTextColors#getColor(RGB)
- */
- public Color getColor(RGB rgb) {
- if (rgb == null)
- return null;
-
- if (fDisplayTable == null)
- fDisplayTable= new HashMap(2);
-
- Display display= Display.getCurrent();
-
- Map colorTable= (Map) fDisplayTable.get(display);
- if (colorTable == null) {
- colorTable= new HashMap(10);
- fDisplayTable.put(display, colorTable);
- }
-
- Color color= (Color) colorTable.get(rgb);
- if (color == null) {
- color= new Color(display, rgb);
- colorTable.put(rgb, color);
- }
-
- return color;
- }
-
- /*
- * @see ISharedTextColors#dispose()
- */
- public void dispose() {
- if (fDisplayTable != null) {
- Iterator j= fDisplayTable.values().iterator();
- while (j.hasNext()) {
- Iterator i= ((Map) j.next()).values().iterator();
- while (i.hasNext())
- ((Color) i.next()).dispose();
- }
- }
- }
-
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/StatusInfo.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/StatusInfo.java
deleted file mode 100644
index 291a467913b..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/StatusInfo.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.internal.editors.text;
-
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.jface.util.Assert;
-
-/**
- * A settable IStatus.
- * Can be an error, warning, info or ok. For error, info and warning states,
- * a message describes the problem.
- *
- * @since 2.1
- */
-class StatusInfo implements IStatus {
-
- /** The message of this status. */
- private String fStatusMessage;
- /** The severity of this status. */
- private int fSeverity;
-
- /**
- * Creates a status set to OK (no message).
- */
- public StatusInfo() {
- this(OK, null);
- }
-
- /**
- * Creates a status with the given severity and message.
- *
- * @param severity the severity of this status: ERROR, WARNING, INFO and OK.
- * @param message the message of this status. Applies only for ERROR,
- * WARNING and INFO.
- */
- public StatusInfo(int severity, String message) {
- fStatusMessage= message;
- fSeverity= severity;
- }
-
- /**
- * Returns if the status' severity is OK.
- */
- public boolean isOK() {
- return fSeverity == IStatus.OK;
- }
-
- /**
- * Returns if the status' severity is WARNING.
- */
- public boolean isWarning() {
- return fSeverity == IStatus.WARNING;
- }
-
- /**
- * Returns if the status' severity is INFO.
- */
- public boolean isInfo() {
- return fSeverity == IStatus.INFO;
- }
-
- /**
- * Returns if the status' severity is ERROR.
- */
- public boolean isError() {
- return fSeverity == IStatus.ERROR;
- }
-
- /*
- * @see IStatus#getMessage()
- */
- public String getMessage() {
- return fStatusMessage;
- }
-
- /**
- * Sets the status to ERROR.
- *
- * @param the error message which can be an empty string, but not <code>null</code>
- */
- public void setError(String errorMessage) {
- Assert.isNotNull(errorMessage);
- fStatusMessage= errorMessage;
- fSeverity= IStatus.ERROR;
- }
-
- /**
- * Sets the status to WARNING.
- *
- * @param the warning message which can be an empty string, but not <code>null</code>
- */
- public void setWarning(String warningMessage) {
- Assert.isNotNull(warningMessage);
- fStatusMessage= warningMessage;
- fSeverity= IStatus.WARNING;
- }
-
- /**
- * Sets the status to INFO.
- *
- * @param the info message which can be an empty string, but not <code>null</code>
- */
- public void setInfo(String infoMessage) {
- Assert.isNotNull(infoMessage);
- fStatusMessage= infoMessage;
- fSeverity= IStatus.INFO;
- }
-
- /**
- * Sets the status to OK.
- */
- public void setOK() {
- fStatusMessage= null;
- fSeverity= IStatus.OK;
- }
-
- /*
- * @see IStatus#matches(int)
- */
- public boolean matches(int severityMask) {
- return (fSeverity & severityMask) != 0;
- }
-
- /**
- * Returns always <code>false</code>.
- *
- * @see IStatus#isMultiStatus()
- */
- public boolean isMultiStatus() {
- return false;
- }
-
- /*
- * @see IStatus#getSeverity()
- */
- public int getSeverity() {
- return fSeverity;
- }
-
- /*
- * @see IStatus#getPlugin()
- */
- public String getPlugin() {
- return EditorsPlugin.getPluginId();
- }
-
- /**
- * Returns always <code>null</code>.
- *
- * @see IStatus#getException()
- */
- public Throwable getException() {
- return null;
- }
-
- /**
- * Returns always the error severity.
- *
- * @see IStatus#getCode()
- */
- public int getCode() {
- return fSeverity;
- }
-
- /**
- * Returns always <code>null</code>.
- *
- * @see IStatus#getChildren()
- */
- public IStatus[] getChildren() {
- return new IStatus[0];
- }
-
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TabFolderLayout.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TabFolderLayout.java
deleted file mode 100644
index c85d1798507..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TabFolderLayout.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.internal.editors.text;
-
-import org.eclipse.swt.SWT;
-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.Layout;
-
-/**
- * This layout controls the position and size
- * of the children of a tab folder.
- *
- * @since 2.1
- */
-class TabFolderLayout extends Layout {
-
- /*
- * @see org.eclipse.swt.widgets.Layout#computeSize(org.eclipse.swt.widgets.Composite, int, int, boolean)
- */
- protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
-
- Control [] children = composite.getChildren ();
- int count = children.length;
- int maxWidth = 0, maxHeight = 0;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache);
- maxWidth = Math.max (maxWidth, pt.x);
- maxHeight = Math.max (maxHeight, pt.y);
- }
-
- if (wHint != SWT.DEFAULT)
- maxWidth= wHint;
- if (hHint != SWT.DEFAULT)
- maxHeight= hHint;
-
- return new Point(maxWidth, maxHeight);
-
- }
-
- /*
- * @see org.eclipse.swt.widgets.Layout#layout(org.eclipse.swt.widgets.Composite, boolean)
- */
- protected void layout (Composite composite, boolean flushCache) {
- Rectangle rect= composite.getClientArea();
-
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- children[i].setBounds(rect);
- }
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java
deleted file mode 100644
index 8f879cbf8a7..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.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.internal.editors.text;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Helper class which wraps the specified resource bundle
- * and offers methods to access the bundle.
- *
- * @since 2.1
- */
-class TextEditorMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.internal.editors.text.TextEditorMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private TextEditorMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-
- public static String getFormattedString(String key, String arg) {
- return getFormattedString(key, new String[] { arg });
- }
-
- public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(getString(key), args);
- }
-
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties
deleted file mode 100644
index 377799a1ea1..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties
+++ /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
-###############################################################################
-
-EditorsPlugin.internal_error=Internal Error
-
-TextEditorPreferencePage.description=Text Editor settings:
-TextEditorPreferencePage.annotationsTab.title= Annotation&s
-TextEditorPreferencePage.analyseAnnotationsWhileTyping= Analyze annotations &while typing
-TextEditorPreferencePage.annotationPresentationOptions= Annotation &presentation:
-TextEditorPreferencePage.annotations.bookmarks= Bookmarks
-TextEditorPreferencePage.annotations.searchResults= Search Results
-TextEditorPreferencePage.annotations.errors= Errors
-TextEditorPreferencePage.annotations.warnings= Warnings
-TextEditorPreferencePage.annotations.infos= Infos
-TextEditorPreferencePage.annotations.tasks= Tasks
-TextEditorPreferencePage.annotations.others= Others
-TextEditorPreferencePage.annotations.showInText= Show in &text
-TextEditorPreferencePage.annotations.highlightInText= &Highlight in text
-TextEditorPreferencePage.annotations.showInOverviewRuler= Show in overview &ruler
-TextEditorPreferencePage.annotations.showInVerticalRuler= Show in vertical r&uler
-TextEditorPreferencePage.annotations.color= C&olor:
-
-TextEditorPreferencePage.general=Appeara&nce
-TextEditorPreferencePage.printMarginColumn=Print margin col&umn:
-TextEditorPreferencePage.showOverviewRuler=Show overview &ruler
-TextEditorPreferencePage.showLineNumbers=Show lin&e numbers
-TextEditorPreferencePage.changedLineColor=Changed lines background
-TextEditorPreferencePage.addedLineColor=Added lines background
-TextEditorPreferencePage.deletedLineColor=Deleted lines indicator
-TextEditorPreferencePage.highlightCurrentLine=Hi&ghlight current line
-TextEditorPreferencePage.showPrintMargin=Sho&w print margin
-TextEditorPreferencePage.color=C&olor:
-TextEditorPreferencePage.appearanceOptions=Appearance co&lor options:
-TextEditorPreferencePage.lineNumberForegroundColor=Line number foreground
-TextEditorPreferencePage.currentLineHighlighColor=Current line highlight
-TextEditorPreferencePage.printMarginColor=Print margin
-
-TextEditorPreferencePage.empty_input=Empty input
-TextEditorPreferencePage.invalid_input=''{0}'' is not a valid input.
-
-TextEditorPreferencePage.quickdiffTab.title= &Quick Diff
-TextEditorPreferencePage.showQuickDiffPerDefault=Always &show Quick Diff coloring
-TextEditorPreferencePage.quickdiff.referenceprovidertitle=Quickdiff &reference providers:
-TextEditorPreferencePage.quickdiff.setDefault=Make &Default
-TextEditorPreferencePage.quickdiff.defaultlabel= (default)
-TextEditorPreferencePage.quickDiffCharacterMode= Show changes using &characters instead of colors (on line number bar only)
-
-OpenExternalFileAction.dialog.text=Open External File
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorPreferencePage2.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorPreferencePage2.java
deleted file mode 100644
index 6e5d1e0d6e3..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorPreferencePage2.java
+++ /dev/null
@@ -1,815 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.editors.text;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.swt.widgets.Text;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.preference.PreferencePage;
-
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.texteditor.quickdiff.QuickDiff;
-import org.eclipse.ui.texteditor.quickdiff.ReferenceProviderDescriptor;
-import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.texteditor.AnnotationPreference;
-import org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants;
-import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
-
-
-
-/**
- * The preference page for setting the editor options.
- * <p>
- * This class is internal and not intended to be used by clients.</p>
- *
- * @since 2.1
- */
-public class TextEditorPreferencePage2 extends PreferencePage implements IWorkbenchPreferencePage {
-
- private final String[][] fAppearanceColorListModel= new String[][] {
- {TextEditorMessages.getString("TextEditorPreferencePage.lineNumberForegroundColor"), ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR}, //$NON-NLS-1$
- {TextEditorMessages.getString("TextEditorPreferencePage.currentLineHighlighColor"), ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR}, //$NON-NLS-1$
- {TextEditorMessages.getString("TextEditorPreferencePage.printMarginColor"), ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR}, //$NON-NLS-1$
- };
-
- /** Button controlling default setting of the selected reference provider. */
- private Button fSetDefaultButton;
-
- private final String[][] fAnnotationColorListModel;
-
- private OverlayPreferenceStore fOverlayStore;
-
- private Map fCheckBoxes= new HashMap();
- private SelectionListener fCheckBoxListener= new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- Button button= (Button) e.widget;
- fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
- }
- };
-
- private Map fTextFields= new HashMap();
- private ModifyListener fTextFieldListener= new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- Text text= (Text) e.widget;
- fOverlayStore.setValue((String) fTextFields.get(text), text.getText());
- }
- };
-
- private ArrayList fNumberFields= new ArrayList();
- private ModifyListener fNumberFieldListener= new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- numberFieldChanged((Text) e.widget);
- }
- };
-
- private List fAppearanceColorList;
- private List fAnnotationList;
- private List fQuickDiffProviderList;
- private ColorEditor fAppearanceColorEditor;
- private ColorEditor fAnnotationForegroundColorEditor;
- private Button fShowInTextCheckBox;
- private Button fHighlightInTextCheckBox;
- private Button fShowInOverviewRulerCheckBox;
- private Button fShowInVerticalRulerCheckBox;
- private String[][] fQuickDiffProviderListModel;
-
-
- public TextEditorPreferencePage2() {
- setDescription(TextEditorMessages.getString("TextEditorPreferencePage.description")); //$NON-NLS-1$
- setPreferenceStore(EditorsPlugin.getDefault().getPreferenceStore());
-
- MarkerAnnotationPreferences preferences= new MarkerAnnotationPreferences();
- fOverlayStore= createOverlayStore(preferences);
-
- fAnnotationColorListModel= createAnnotationTypeListModel(preferences);
- fQuickDiffProviderListModel= createQuickDiffReferenceListModel();
- }
-
- private OverlayPreferenceStore createOverlayStore(MarkerAnnotationPreferences preferences) {
-
- ArrayList overlayKeys= new ArrayList();
- Iterator e= preferences.getAnnotationPreferences().iterator();
- while (e.hasNext()) {
- AnnotationPreference info= (AnnotationPreference) e.next();
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey()));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey()));
- if (info.getHighlightPreferenceKey() != null)
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getHighlightPreferenceKey()));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getOverviewRulerPreferenceKey()));
- if (info.getVerticalRulerPreferenceKey() != null)
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getVerticalRulerPreferenceKey()));
- }
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE));
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN));
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER));
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ExtendedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE));
-
- OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
- overlayKeys.toArray(keys);
- return new OverlayPreferenceStore(getPreferenceStore(), keys);
- }
-
- private String[][] createAnnotationTypeListModel(MarkerAnnotationPreferences preferences) {
- ArrayList listModelItems= new ArrayList();
- Iterator e= preferences.getAnnotationPreferences().iterator();
- while (e.hasNext()) {
- AnnotationPreference info= (AnnotationPreference) e.next();
- listModelItems.add(new String[] { info.getPreferenceLabel(), info.getColorPreferenceKey(), info.getTextPreferenceKey(), info.getOverviewRulerPreferenceKey(), info.getHighlightPreferenceKey(), info.getVerticalRulerPreferenceKey()});
- }
- String[][] items= new String[listModelItems.size()][];
- listModelItems.toArray(items);
- return items;
- }
-
- private String[][] createQuickDiffReferenceListModel() {
- java.util.List descriptors= new QuickDiff().getReferenceProviderDescriptors();
- ArrayList listModelItems= new ArrayList();
- for (Iterator it= descriptors.iterator(); it.hasNext();) {
- ReferenceProviderDescriptor descriptor= (ReferenceProviderDescriptor) it.next();
- String label= descriptor.getLabel();
- int i= label.indexOf('&');
- while (i >= 0) {
- if (i < label.length())
- label= label.substring(0, i) + label.substring(i+1);
- else
- label.substring(0, i);
- i= label.indexOf('&');
- }
- listModelItems.add(new String[] { descriptor.getId(), label });
- }
- String[][] items= new String[listModelItems.size()][];
- listModelItems.toArray(items);
- return items;
- }
-
- /*
- * @see IWorkbenchPreferencePage#init()
- */
- public void init(IWorkbench workbench) {
- }
-
- /*
- * @see PreferencePage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
- WorkbenchHelp.setHelp(getControl(), ITextEditorHelpContextIds.TEXT_EDITOR_PREFERENCE_PAGE);
- }
-
- private void handleAppearanceColorListSelection() {
- int i= fAppearanceColorList.getSelectionIndex();
- String key= fAppearanceColorListModel[i][1];
- RGB rgb= PreferenceConverter.getColor(fOverlayStore, key);
- fAppearanceColorEditor.setColorValue(rgb);
- }
-
- private void handleAnnotationListSelection() {
- int i= fAnnotationList.getSelectionIndex();
-
- String key= fAnnotationColorListModel[i][1];
- RGB rgb= PreferenceConverter.getColor(fOverlayStore, key);
- fAnnotationForegroundColorEditor.setColorValue(rgb);
-
- key= fAnnotationColorListModel[i][2];
- fShowInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
-
- key= fAnnotationColorListModel[i][3];
- fShowInOverviewRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
-
- key= fAnnotationColorListModel[i][4];
- if (key != null) {
- fHighlightInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
- fHighlightInTextCheckBox.setEnabled(true);
- } else
- fHighlightInTextCheckBox.setEnabled(false);
-
- key= fAnnotationColorListModel[i][5];
- if (key != null) {
- fShowInVerticalRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
- fShowInVerticalRulerCheckBox.setEnabled(true);
- } else {
- fShowInVerticalRulerCheckBox.setSelection(true);
- fShowInVerticalRulerCheckBox.setEnabled(false);
- }
- }
-
- private void handleProviderListSelection() {
- int i= fQuickDiffProviderList.getSelectionIndex();
-
- boolean b= fOverlayStore.getString(ExtendedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER).equals(fQuickDiffProviderListModel[i][0]);
- fSetDefaultButton.setEnabled(!b);
- }
-
- private Control createAppearancePage(Composite parent) {
-
- Composite appearanceComposite= new Composite(parent, SWT.NONE);
- GridLayout layout= new GridLayout(); layout.numColumns= 2;
- appearanceComposite.setLayout(layout);
-
- String label= TextEditorMessages.getString("TextEditorPreferencePage.printMarginColumn"); //$NON-NLS-1$
- addTextField(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 3, 0, true);
-
- label= TextEditorMessages.getString("TextEditorPreferencePage.showOverviewRuler"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER, 0);
-
- label= TextEditorMessages.getString("TextEditorPreferencePage.showLineNumbers"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, 0);
-
- label= TextEditorMessages.getString("TextEditorPreferencePage.highlightCurrentLine"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, 0);
-
- label= TextEditorMessages.getString("TextEditorPreferencePage.showPrintMargin"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, 0);
-
-
- Label l= new Label(appearanceComposite, SWT.LEFT );
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan= 2;
- gd.heightHint= convertHeightInCharsToPixels(1) / 2;
- l.setLayoutData(gd);
-
- l= new Label(appearanceComposite, SWT.LEFT);
- l.setText(TextEditorMessages.getString("TextEditorPreferencePage.appearanceOptions")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan= 2;
- l.setLayoutData(gd);
-
- Composite editorComposite= new Composite(appearanceComposite, SWT.NONE);
- layout= new GridLayout();
- layout.numColumns= 2;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- editorComposite.setLayout(layout);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
- gd.horizontalSpan= 2;
- editorComposite.setLayoutData(gd);
-
- fAppearanceColorList= new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
- gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
- gd.heightHint= convertHeightInCharsToPixels(3);
- fAppearanceColorList.setLayoutData(gd);
-
- Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
- layout= new GridLayout();
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- layout.numColumns= 2;
- stylesComposite.setLayout(layout);
- stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- l= new Label(stylesComposite, SWT.LEFT);
- l.setText(TextEditorMessages.getString("TextEditorPreferencePage.color")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
- l.setLayoutData(gd);
-
- fAppearanceColorEditor= new ColorEditor(stylesComposite);
- Button foregroundColorButton= fAppearanceColorEditor.getButton();
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
- foregroundColorButton.setLayoutData(gd);
-
- fAppearanceColorList.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
- public void widgetSelected(SelectionEvent e) {
- handleAppearanceColorListSelection();
- }
- });
- foregroundColorButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
- public void widgetSelected(SelectionEvent e) {
- int i= fAppearanceColorList.getSelectionIndex();
- String key= fAppearanceColorListModel[i][1];
-
- PreferenceConverter.setValue(fOverlayStore, key, fAppearanceColorEditor.getColorValue());
- }
- });
-
- return appearanceComposite;
- }
-
- private Control createQuickdiffPage(Composite parent) {
- Composite composite= new Composite(parent, SWT.NONE);
- GridLayout layout= new GridLayout(); layout.numColumns= 2;
- composite.setLayout(layout);
-
- String label= TextEditorMessages.getString("TextEditorPreferencePage.showQuickDiffPerDefault"); //$NON-NLS-1$
- addCheckBox(composite, label, ExtendedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON, 0);
-
- label= TextEditorMessages.getString("TextEditorPreferencePage.quickDiffCharacterMode"); //$NON-NLS-1$
- addCheckBox(composite, label, ExtendedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE, 0);
-
- Label l= new Label(composite, SWT.LEFT );
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan= 2;
- gd.heightHint= convertHeightInCharsToPixels(1) / 2;
- l.setLayoutData(gd);
-
- l= new Label(composite, SWT.LEFT);
- l.setText(TextEditorMessages.getString("TextEditorPreferencePage.quickdiff.referenceprovidertitle")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan= 2;
- l.setLayoutData(gd);
-
- Composite editorComposite= new Composite(composite, SWT.NONE);
- layout= new GridLayout();
- layout.numColumns= 2;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- editorComposite.setLayout(layout);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
- gd.horizontalSpan= 2;
- editorComposite.setLayoutData(gd);
-
- fQuickDiffProviderList= new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
- gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
- gd.heightHint= convertHeightInCharsToPixels(4);
- fQuickDiffProviderList.setLayoutData(gd);
-
- Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
- layout= new GridLayout();
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- layout.numColumns= 2;
- stylesComposite.setLayout(layout);
- stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- fSetDefaultButton= new Button(stylesComposite, SWT.PUSH);
- fSetDefaultButton.setText(TextEditorMessages.getString("TextEditorPreferencePage.quickdiff.setDefault")); //$NON-NLS-1$
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
- gd.horizontalSpan= 2;
- fSetDefaultButton.setLayoutData(gd);
-
- fQuickDiffProviderList.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- handleProviderListSelection();
- }
-
- });
-
- fSetDefaultButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- int i= fQuickDiffProviderList.getSelectionIndex();
- for (int j= 0; j < fQuickDiffProviderListModel.length; j++) {
- if (fOverlayStore.getString(ExtendedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER).equals(fQuickDiffProviderListModel[j][0])) {
- fQuickDiffProviderList.remove(j);
- fQuickDiffProviderList.add(fQuickDiffProviderListModel[j][1], j);
- }
- if (i == j) {
- fQuickDiffProviderList.remove(j);
- fQuickDiffProviderList.add(fQuickDiffProviderListModel[j][1] + " " + TextEditorMessages.getString("TextEditorPreferencePage.quickdiff.defaultlabel"), j); //$NON-NLS-1$//$NON-NLS-2$
- }
- }
- fSetDefaultButton.setEnabled(false);
- fQuickDiffProviderList.setSelection(i);
- fQuickDiffProviderList.redraw();
-
- fOverlayStore.setValue(ExtendedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER, fQuickDiffProviderListModel[i][0]);
- }
- });
-
- return composite;
- }
-
-
- private Control createAnnotationsPage(Composite parent) {
- Composite composite= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout(); layout.numColumns= 2;
- composite.setLayout(layout);
-
- Label label= new Label(composite, SWT.LEFT);
- label.setText(TextEditorMessages.getString("TextEditorPreferencePage.annotationPresentationOptions")); //$NON-NLS-1$
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan= 2;
- label.setLayoutData(gd);
-
- Composite editorComposite= new Composite(composite, SWT.NONE);
- layout= new GridLayout();
- layout.numColumns= 2;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- editorComposite.setLayout(layout);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
- gd.horizontalSpan= 2;
- editorComposite.setLayoutData(gd);
-
- fAnnotationList= new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
- gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
- gd.heightHint= convertHeightInCharsToPixels(10);
- fAnnotationList.setLayoutData(gd);
-
- Composite optionsComposite= new Composite(editorComposite, SWT.NONE);
- layout= new GridLayout();
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- layout.numColumns= 2;
- optionsComposite.setLayout(layout);
- optionsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- fShowInTextCheckBox= new Button(optionsComposite, SWT.CHECK);
- fShowInTextCheckBox.setText(TextEditorMessages.getString("TextEditorPreferencePage.annotations.showInText")); //$NON-NLS-1$
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
- gd.horizontalSpan= 2;
- fShowInTextCheckBox.setLayoutData(gd);
-
- fHighlightInTextCheckBox= new Button(optionsComposite, SWT.CHECK);
- fHighlightInTextCheckBox.setText(TextEditorMessages.getString("TextEditorPreferencePage.annotations.highlightInText")); //$NON-NLS-1$
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
- gd.horizontalSpan= 2;
- fHighlightInTextCheckBox.setLayoutData(gd);
-
- fShowInOverviewRulerCheckBox= new Button(optionsComposite, SWT.CHECK);
- fShowInOverviewRulerCheckBox.setText(TextEditorMessages.getString("TextEditorPreferencePage.annotations.showInOverviewRuler")); //$NON-NLS-1$
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
- gd.horizontalSpan= 2;
- fShowInOverviewRulerCheckBox.setLayoutData(gd);
-
- fShowInVerticalRulerCheckBox= new Button(optionsComposite, SWT.CHECK);
- fShowInVerticalRulerCheckBox.setText(TextEditorMessages.getString("TextEditorPreferencePage.annotations.showInVerticalRuler")); //$NON-NLS-1$
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
- gd.horizontalSpan= 2;
- fShowInVerticalRulerCheckBox.setLayoutData(gd);
-
- label= new Label(optionsComposite, SWT.LEFT);
- label.setText(TextEditorMessages.getString("TextEditorPreferencePage.annotations.color")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
- label.setLayoutData(gd);
-
- fAnnotationForegroundColorEditor= new ColorEditor(optionsComposite);
- Button foregroundColorButton= fAnnotationForegroundColorEditor.getButton();
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
- foregroundColorButton.setLayoutData(gd);
-
- fAnnotationList.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- handleAnnotationListSelection();
- }
- });
-
- fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- int i= fAnnotationList.getSelectionIndex();
- String key= fAnnotationColorListModel[i][2];
- fOverlayStore.setValue(key, fShowInTextCheckBox.getSelection());
- }
- });
-
- fHighlightInTextCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- int i= fAnnotationList.getSelectionIndex();
- String key= fAnnotationColorListModel[i][4];
- fOverlayStore.setValue(key, fHighlightInTextCheckBox.getSelection());
- }
- });
-
- fShowInOverviewRulerCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- int i= fAnnotationList.getSelectionIndex();
- String key= fAnnotationColorListModel[i][3];
- fOverlayStore.setValue(key, fShowInOverviewRulerCheckBox.getSelection());
- }
- });
-
- fShowInVerticalRulerCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- int i= fAnnotationList.getSelectionIndex();
- String key= fAnnotationColorListModel[i][5];
- fOverlayStore.setValue(key, fShowInVerticalRulerCheckBox.getSelection());
- }
- });
-
- foregroundColorButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- int i= fAnnotationList.getSelectionIndex();
- String key= fAnnotationColorListModel[i][1];
- PreferenceConverter.setValue(fOverlayStore, key, fAnnotationForegroundColorEditor.getColorValue());
- }
- });
-
- return composite;
- }
-
- /*
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
-
- fOverlayStore.load();
- fOverlayStore.start();
-
- TabFolder folder= new TabFolder(parent, SWT.NONE);
- folder.setLayout(new TabFolderLayout());
- folder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- TabItem item= new TabItem(folder, SWT.NONE);
- item.setText(TextEditorMessages.getString("TextEditorPreferencePage.general")); //$NON-NLS-1$
- item.setControl(createAppearancePage(folder));
-
- item= new TabItem(folder, SWT.NONE);
- item.setText(TextEditorMessages.getString("TextEditorPreferencePage.annotationsTab.title")); //$NON-NLS-1$
- item.setControl(createAnnotationsPage(folder));
-
- item= new TabItem(folder, SWT.NONE);
- item.setText(TextEditorMessages.getString("TextEditorPreferencePage.quickdiffTab.title")); //$NON-NLS-1$
- item.setControl(createQuickdiffPage(folder));
-
- initialize();
- Dialog.applyDialogFont(folder);
- return folder;
- }
-
- private void initialize() {
-
- initializeFields();
-
- for (int i= 0; i < fAppearanceColorListModel.length; i++)
- fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
- fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
- fAppearanceColorList.select(0);
- handleAppearanceColorListSelection();
- }
- }
- });
-
- for (int i= 0; i < fAnnotationColorListModel.length; i++)
- fAnnotationList.add(fAnnotationColorListModel[i][0]);
- fAnnotationList.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (fAnnotationList != null && !fAnnotationList.isDisposed()) {
- fAnnotationList.select(0);
- handleAnnotationListSelection();
- }
- }
- });
-
- for (int i= 0; i < fQuickDiffProviderListModel.length; i++) {
- String label= fQuickDiffProviderListModel[i][1];
- if (fOverlayStore.getString(ExtendedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER).equals(fQuickDiffProviderListModel[i][0]))
- label += " " + TextEditorMessages.getString("TextEditorPreferencePage.quickdiff.defaultlabel"); //$NON-NLS-1$ //$NON-NLS-2$
- fQuickDiffProviderList.add(label);
- }
- fQuickDiffProviderList.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (fQuickDiffProviderList != null && !fQuickDiffProviderList.isDisposed()) {
- fQuickDiffProviderList.select(0);
- handleProviderListSelection();
- }
- }
- });
-
- }
-
- private void initializeFields() {
-
- Iterator e= fCheckBoxes.keySet().iterator();
- while (e.hasNext()) {
- Button b= (Button) e.next();
- String key= (String) fCheckBoxes.get(b);
- b.setSelection(fOverlayStore.getBoolean(key));
- }
-
- e= fTextFields.keySet().iterator();
- while (e.hasNext()) {
- Text t= (Text) e.next();
- String key= (String) fTextFields.get(t);
- t.setText(fOverlayStore.getString(key));
- }
-
- }
-
- /*
- * @see PreferencePage#performOk()
- */
- public boolean performOk() {
- fOverlayStore.propagate();
- EditorsPlugin.getDefault().savePluginPreferences();
- return true;
- }
-
- /*
- * @see PreferencePage#performDefaults()
- */
- protected void performDefaults() {
-
- fOverlayStore.loadDefaults();
-
- initializeFields();
-
- handleAppearanceColorListSelection();
- handleAnnotationListSelection();
- handleProviderListSelection();
-
- super.performDefaults();
- }
-
- /*
- * @see DialogPage#dispose()
- */
- public void dispose() {
-
- if (fOverlayStore != null) {
- fOverlayStore.stop();
- fOverlayStore= null;
- }
-
- super.dispose();
- }
-
- private Button addCheckBox(Composite parent, String label, String key, int indentation) {
- Button checkBox= new Button(parent, SWT.CHECK);
- checkBox.setText(label);
-
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent= indentation;
- gd.horizontalSpan= 2;
- checkBox.setLayoutData(gd);
- checkBox.addSelectionListener(fCheckBoxListener);
-
- fCheckBoxes.put(checkBox, key);
-
- return checkBox;
- }
-
- private Control addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
-
- Label labelControl= new Label(composite, SWT.NONE);
- labelControl.setText(label);
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent= indentation;
- labelControl.setLayoutData(gd);
-
- Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.widthHint= convertWidthInCharsToPixels(textLimit + 1);
- textControl.setLayoutData(gd);
- textControl.setTextLimit(textLimit);
- fTextFields.put(textControl, key);
- if (isNumber) {
- fNumberFields.add(textControl);
- textControl.addModifyListener(fNumberFieldListener);
- } else {
- textControl.addModifyListener(fTextFieldListener);
- }
-
- return textControl;
- }
-
- private void numberFieldChanged(Text textControl) {
- String number= textControl.getText();
- IStatus status= validatePositiveNumber(number);
- if (!status.matches(IStatus.ERROR))
- fOverlayStore.setValue((String) fTextFields.get(textControl), number);
- updateStatus(status);
- }
-
- private IStatus validatePositiveNumber(String number) {
- StatusInfo status= new StatusInfo();
- if (number.length() == 0) {
- status.setError(TextEditorMessages.getString("TextEditorPreferencePage.empty_input")); //$NON-NLS-1$
- } else {
- try {
- int value= Integer.parseInt(number);
- if (value < 0)
- status.setError(TextEditorMessages.getFormattedString("TextEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
- } catch (NumberFormatException e) {
- status.setError(TextEditorMessages.getFormattedString("TextEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
- }
- }
- return status;
- }
-
- void updateStatus(IStatus status) {
- if (!status.matches(IStatus.ERROR)) {
- for (int i= 0; i < fNumberFields.size(); i++) {
- Text text= (Text) fNumberFields.get(i);
- IStatus s= validatePositiveNumber(text.getText());
- status= s.getSeverity() > status.getSeverity() ? s : status;
- }
- }
- setValid(!status.matches(IStatus.ERROR));
- applyToStatusLine(this, status);
- }
-
- /**
- * Applies the status to the status line of a dialog page.
- */
- public void applyToStatusLine(DialogPage page, IStatus status) {
- String message= status.getMessage();
- switch (status.getSeverity()) {
- case IStatus.OK:
- page.setMessage(message, IMessageProvider.NONE);
- page.setErrorMessage(null);
- break;
- case IStatus.WARNING:
- page.setMessage(message, IMessageProvider.WARNING);
- page.setErrorMessage(null);
- break;
- case IStatus.INFO:
- page.setMessage(message, IMessageProvider.INFORMATION);
- page.setErrorMessage(null);
- break;
- default:
- if (message.length() == 0) {
- message= null;
- }
- page.setMessage(null);
- page.setErrorMessage(message);
- break;
- }
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java
deleted file mode 100644
index 8b50b76ba93..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java
+++ /dev/null
@@ -1,619 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.AnnotationModel;
-
-import org.eclipse.ui.PlatformUI;
-
-import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-
-
-/**
- * Abstract implementation of a marker-based annotation model.
- * <p>
- * Markers are provided by an underlying source (a subclass responsibility).
- * Markers whose textual range gets deleted during text editing are removed
- * from the model on save. The <code>updateMarkers</code> method can be used
- * to force the model to update the source's markers with any changes to their
- * locations due to edits. Clients can register <code>IMarkerUpdater</code>
- * objects in order to define the process of marker updating. Registration can be done
- * using the <code>"org.eclipse.ui.markerUpdaters"</code> extension point.</p>
- * <p>
- * Subclasses must implement the following methods:
- * <ul>
- * <li><code>retrieveMarkers</code></li>
- * <li><code>isAcceptable</code></li>
- * <li><code>deleteMarkers</code></li>
- * <li><code>listenToMarkerChanges</code></li>
- * </ul>
- * </p>
- */
-public abstract class AbstractMarkerAnnotationModel extends AnnotationModel {
-
- /** List of annotations whose text range became invalid because of document changes */
- private List fDeletedAnnotations= new ArrayList(2);
- /** List of registered and instantiated marker updaters */
- private List fInstantiatedMarkerUpdaters= null;
- /** List of registered but not yet instantiated marker updaters */
- private List fMarkerUpdaterSpecifications= null;
-
-
- /**
- * Retrieves all markers from this model.
- * <p>
- * Subclasses must implement this method.</p>
- *
- * @return the list of markers
- * @exception CoreException if there is a problem getting the markers
- */
- protected abstract IMarker[] retrieveMarkers() throws CoreException;
-
- /**
- * Deletes the given markers from this model.
- * <p>
- * Subclasses must implement this method.</p>
- *
- * @param markers the array of markers
- * @exception CoreException if there are problems deleting the markers
- */
- protected abstract void deleteMarkers(IMarker[] markers) throws CoreException;
-
- /**
- * Tells the model whether it should listen for marker changes.
- * <p>
- * Subclasses must implement this method.</p>
- *
- * @param listen <code>true</code> if this model should listen, and
- * <code>false</code> otherwise
- */
- protected abstract void listenToMarkerChanges(boolean listen);
-
- /**
- * Determines whether the marker is acceptable as an addition to this model.
- * If the marker, say, represents an aspect or range of no interest to this
- * model, the marker is rejected.
- * <p>
- * Subclasses must implement this method.</p>
- *
- * @param marker the marker
- * @return <code>true</code> if the marker is acceptable
- */
- protected abstract boolean isAcceptable(IMarker marker);
-
- /**
- * Creates a new annotation model. The annotation model does not manage any
- * annotations and is not connected to any document.
- */
- protected AbstractMarkerAnnotationModel() {
- }
-
- /**
- * Adds the given marker updater to this annotation model.
- * It is the client's responsibility to ensure the consitency
- * of the set of registered marker updaters.
- *
- * @param markerUpdater the marker updater to be added
- */
- protected void addMarkerUpdater(IMarkerUpdater markerUpdater) {
- if (!fInstantiatedMarkerUpdaters.contains(markerUpdater))
- fInstantiatedMarkerUpdaters.add(markerUpdater);
- }
-
- /**
- * Removes the given marker updater from this annotation model.
- *
- * @param markerUpdater the marker updater to be removed
- */
- protected void removeMarkerUpdater(IMarkerUpdater markerUpdater) {
- fInstantiatedMarkerUpdaters.remove(markerUpdater);
- }
-
- /**
- * Creates a new annotation for the given marker.
- * <p>
- * Subclasses may override.</p>
- *
- * @param marker the marker
- * @return the new marker annotation
- */
- protected MarkerAnnotation createMarkerAnnotation(IMarker marker) {
- return new MarkerAnnotation(marker);
- }
-
- /**
- * Determines the annotation type for the given marker.
- *
- * @param marker the marker for which to determine the annotation type
- * @return the annotation type for an annotation for the given marker
- * @since 3.0
- */
- protected String computeAnnotationType(IMarker marker) {
- AnnotationTypeLookup lookup= getAnnotationTypeLookup();
- if (lookup != null)
- return lookup.getAnnotationType(marker);
- return null;
- }
-
- /**
- * Returns the annotation type lookup used by this annotation model.
- *
- * @return the annotation type lookup
- * @since 3.0
- */
- protected AnnotationTypeLookup getAnnotationTypeLookup() {
- return EditorsPlugin.getDefault().getAnnotationTypeLookup();
- }
-
- /**
- * Handles an unanticipated <code>CoreException</code> in
- * a standard manner.
- *
- * @param exception the exception
- * @param message a message to aid debugging
- */
- protected void handleCoreException(CoreException exception, String message) {
-
- ILog log= Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog();
-
- if (message != null)
- log.log(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, exception));
- else
- log.log(exception.getStatus());
- }
-
- /**
- * Creates and returns the character position of the given marker based
- * on its attributes.
- * <p>
- * Subclasses may override.</p>
- *
- * @param marker the marker
- * @return the new position or <code>null</code> if the marker attributes do not specify a valid position
- */
- protected Position createPositionFromMarker(IMarker marker) {
-
- int start= MarkerUtilities.getCharStart(marker);
- int end= MarkerUtilities.getCharEnd(marker);
-
- if (start > end) {
- end= start + end;
- start= end - start;
- end= end - start;
- }
-
- if (start == -1 && end == -1) {
- // marker line number is 1-based
- int line= MarkerUtilities.getLineNumber(marker);
- if (line > 0 && fDocument != null) {
- try {
- start= fDocument.getLineOffset(line - 1);
- end= start;
- } catch (BadLocationException x) {
- }
- }
- }
-
- if (start > -1 && end > -1)
- return new Position(start, end - start);
-
- return null;
- }
-
- /**
- * Creates an annotation for the given marker and adds it to this model.
- * Does nothing if the marker is not acceptable to this model.
- *
- * @param marker the marker
- * @see #isAcceptable(IMarker)
- */
- protected final void addMarkerAnnotation(IMarker marker) {
-
- if (isAcceptable(marker)) {
- Position p= createPositionFromMarker(marker);
- if (p != null)
- try {
- MarkerAnnotation annotation= createMarkerAnnotation(marker);
- if (annotation != null) {
-
- String annotationType= computeAnnotationType(marker);
- if (annotationType != null)
- annotation.setType(annotationType);
-
- addAnnotation(annotation, p, false);
- }
- } catch (BadLocationException e) {
- // ignore invalid position
- }
- }
- }
-
- /**
- * Connects to the source of markers as marker change listener.
- * @see AnnotationModel#connected()
- */
- protected void connected() {
-
- listenToMarkerChanges(true);
-
- try {
- catchupWithMarkers();
- } catch (CoreException x) {
- if (x.getStatus().getCode() != IResourceStatus.RESOURCE_NOT_FOUND)
- handleCoreException(x, TextEditorMessages.getString("AbstractMarkerAnnotationModel.connected")); //$NON-NLS-1$
- }
-
- fireModelChanged();
- }
-
- /**
- * Installs all marker updaters for this marker annotation model.
- */
- private void installMarkerUpdaters() {
-
- // initialize lists - indicates that the initialization happened
- fMarkerUpdaterSpecifications= new ArrayList(2);
- fInstantiatedMarkerUpdaters= new ArrayList(2);
-
- // populate list
- IExtensionPoint extensionPoint= Platform.getPluginRegistry().getExtensionPoint(EditorsPlugin.getPluginId(), "markerUpdaters"); //$NON-NLS-1$
- if (extensionPoint != null) {
- IConfigurationElement[] elements= extensionPoint.getConfigurationElements();
- for (int i= 0; i < elements.length; i++)
- fMarkerUpdaterSpecifications.add(elements[i]);
- }
- }
-
- /**
- * Uninstalls all marker updaters.
- */
- private void uninstallMarkerUpdaters() {
- if (fInstantiatedMarkerUpdaters != null) {
- fInstantiatedMarkerUpdaters.clear();
- fInstantiatedMarkerUpdaters= null;
- }
-
- if (fMarkerUpdaterSpecifications != null) {
- fMarkerUpdaterSpecifications.clear();
- fMarkerUpdaterSpecifications= null;
- }
- }
-
- /**
- * Removes the marker change listener.
- * @see AnnotationModel#disconnected()
- */
- protected void disconnected() {
- listenToMarkerChanges(false);
- uninstallMarkerUpdaters();
- }
-
- /**
- * Returns the position known to this annotation model for the given marker.
- *
- * @param marker the marker
- * @return the position, or <code>null</code> if none
- */
- public Position getMarkerPosition(IMarker marker) {
- MarkerAnnotation a= getMarkerAnnotation(marker);
- if (a != null) {
- return (Position) fAnnotations.get(a);
- }
- return null;
- }
-
- /**
- * Updates the annotation corresponding to the given marker which has changed
- * in some way.
- * <p>
- * Subclasses may override.</p>
- *
- * @param marker the marker
- */
- protected void modifyMarkerAnnotation(IMarker marker) {
- MarkerAnnotation a= getMarkerAnnotation(marker);
- if (a != null) {
- Position p= createPositionFromMarker(marker);
- if (p != null) {
- String annotationType= computeAnnotationType(marker);
- if (annotationType != null && !annotationType.equals(a.getType()))
- a.setType(annotationType);
- modifyAnnotation(a, p);
- }
- }
- }
-
- /*
- * @see AnnotationModel#removeAnnotations(List, boolean, boolean)
- */
- protected void removeAnnotations(List annotations, boolean fireModelChanged, boolean modelInitiated) {
- if (annotations != null && annotations.size() > 0) {
-
- List markerAnnotations= new ArrayList();
- for (Iterator e= annotations.iterator(); e.hasNext();) {
- Annotation a= (Annotation) e.next();
- if (a instanceof MarkerAnnotation)
- markerAnnotations.add(a);
-
- // remove annotations from annotation model
- removeAnnotation(a, false);
- }
-
- if (markerAnnotations.size() > 0) {
-
- if (modelInitiated) {
- // if model initiated also remove it from the marker manager
-
- listenToMarkerChanges(false);
- try {
-
- IMarker[] m= new IMarker[markerAnnotations.size()];
- for (int i= 0; i < m.length; i++) {
- MarkerAnnotation ma = (MarkerAnnotation) markerAnnotations.get(i);
- m[i]= ma.getMarker();
- }
- deleteMarkers(m);
-
- } catch (CoreException x) {
- handleCoreException(x, TextEditorMessages.getString("AbstractMarkerAnnotationModel.removeAnnotations")); //$NON-NLS-1$
- }
- listenToMarkerChanges(true);
-
- } else {
- // remember deleted annotations in order to remove their markers later on
- fDeletedAnnotations.addAll(markerAnnotations);
- }
- }
-
- if (fireModelChanged)
- fireModelChanged();
- }
- }
-
- /**
- * Removes the annotation corresponding to the given marker. Does nothing
- * if there is no annotation for this marker.
- *
- * @param marker the marker
- */
- protected final void removeMarkerAnnotation(IMarker marker) {
- MarkerAnnotation a= getMarkerAnnotation(marker);
- if (a != null) {
- removeAnnotation(a, false);
- }
- }
-
- /**
- * Re-populates this model with annotations for all markers retrieved
- * from the maker source via <code>retrieveMarkers</code>.
- *
- * @exception CoreException if there is a problem getting the markers
- */
- private void catchupWithMarkers() throws CoreException {
-
- for (Iterator e=getAnnotationIterator(false); e.hasNext();) {
- Annotation a= (Annotation) e.next();
- if (a instanceof MarkerAnnotation)
- removeAnnotation(a, false);
- }
-
- IMarker[] markers= retrieveMarkers();
- if (markers != null) {
- for (int i= 0; i < markers.length; i++)
- addMarkerAnnotation(markers[i]);
- }
- }
-
- /**
- * Returns this model's annotation for the given marker.
- *
- * @param marker the marker
- * @return the annotation, or <code>null</code> if none
- */
- public final MarkerAnnotation getMarkerAnnotation(IMarker marker) {
- Iterator e= getAnnotationIterator(false);
- while (e.hasNext()) {
- Object o= e.next();
- if (o instanceof MarkerAnnotation) {
- MarkerAnnotation a= (MarkerAnnotation) o;
- if (marker.equals(a.getMarker())) {
- return a;
- }
- }
- }
- return null;
- }
-
- /**
- * Creates a marker updater as specified in the given configuration element.
- *
- * @param element the configuration element
- * @return the created marker updater or <code>null</code> if none could be created
- */
- private IMarkerUpdater createMarkerUpdater(IConfigurationElement element) {
- try {
- return (IMarkerUpdater) element.createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException x) {
- handleCoreException(x, TextEditorMessages.getString("AbstractMarkerAnnotationModel.createMarkerUpdater")); //$NON-NLS-1$
- }
-
- return null;
- }
-
- /**
- * Checks whether a marker updater is registered for the type of the
- * given marker but not yet instantiated. If so, the method instantiates
- * the marker updater and registers it with this model.
- *
- * @param marker the marker for which to look for an updater
- * @since 2.0
- */
- private void checkMarkerUpdaters(IMarker marker) {
- List toBeDeleted= new ArrayList();
- for (int i= 0; i < fMarkerUpdaterSpecifications.size(); i++) {
- IConfigurationElement spec= (IConfigurationElement) fMarkerUpdaterSpecifications.get(i);
- String markerType= spec.getAttribute("markerType"); //$NON-NLS-1$
- if (markerType == null || MarkerUtilities.isMarkerType(marker, markerType)) {
- toBeDeleted.add(spec);
- IMarkerUpdater updater= createMarkerUpdater(spec);
- if (updater != null)
- addMarkerUpdater(updater);
- }
- }
-
- for (int i= 0; i < toBeDeleted.size(); i++)
- fMarkerUpdaterSpecifications.remove(toBeDeleted.get(i));
- }
-
- /**
- * Updates the given marker according to the given position in the given
- * document. If the given position is <code>null</code>, the marker is
- * assumed to carry the correct positional information. If it is detected
- * that the marker is invalid and should thus be deleted, this method
- * returns <code>false</code>.
- *
- * @param marker the marker to be updated
- * @param document the document into which the given position points
- * @param position the current position of the marker inside the given document
- * @exception CoreException if there is a problem updating the marker
- * @since 2.0
- */
- public boolean updateMarker(IMarker marker, IDocument document, Position position) throws CoreException {
-
- if (fMarkerUpdaterSpecifications == null)
- installMarkerUpdaters();
-
- if (!fMarkerUpdaterSpecifications.isEmpty())
- checkMarkerUpdaters(marker);
-
- boolean isOK= true;
-
- for (int i= 0; i < fInstantiatedMarkerUpdaters.size(); i++) {
- IMarkerUpdater updater= (IMarkerUpdater) fInstantiatedMarkerUpdaters.get(i);
- String markerType= updater.getMarkerType();
- if (markerType == null || MarkerUtilities.isMarkerType(marker, markerType)) {
-
- if (position == null) {
- /* compatibility code */
- position= createPositionFromMarker(marker);
- }
-
- isOK= (isOK && updater.updateMarker(marker, document, position));
- }
- }
-
- return isOK;
- }
-
- /**
- * Updates the markers managed by this annotation model by calling
- * all registered marker updaters (<code>IMarkerUpdater</code>).
- *
- * @param document the document to which this model is currently connected
- * @exception CoreException if there is a problem updating the markers
- */
- public void updateMarkers(IDocument document) throws CoreException {
-
- Assert.isTrue(fDocument == document);
-
- if (fAnnotations.size() == 0 && fDeletedAnnotations.size() == 0)
- return;
-
- if (fMarkerUpdaterSpecifications == null)
- installMarkerUpdaters();
-
- listenToMarkerChanges(false);
-
- // update all markers with the positions known by the annotation model
- for (Iterator e= getAnnotationIterator(false); e.hasNext();) {
- Object o= e.next();
- if (o instanceof MarkerAnnotation) {
- MarkerAnnotation a= (MarkerAnnotation) o;
- IMarker marker= a.getMarker();
- Position position= (Position) fAnnotations.get(a);
- if ( !updateMarker(marker, document, position)) {
- if ( !fDeletedAnnotations.contains(a))
- fDeletedAnnotations.add(a);
- }
- }
- }
-
- if (!fDeletedAnnotations.isEmpty()) {
- removeAnnotations(fDeletedAnnotations, true, true);
- fDeletedAnnotations.clear();
- }
-
- listenToMarkerChanges(true);
- }
-
- /**
- * Resets all the markers to their original state.
- */
- public void resetMarkers() {
-
- // reinitializes the positions from the markers
- for (Iterator e= getAnnotationIterator(false); e.hasNext();) {
- Object o= e.next();
- if (o instanceof MarkerAnnotation) {
- MarkerAnnotation a= (MarkerAnnotation) o;
- Position p= createPositionFromMarker(a.getMarker());
- if (p != null) {
- removeAnnotation(a, false);
- try {
- addAnnotation(a, p, false);
- } catch (BadLocationException e1) {
- // ignore invalid position
- }
- }
- }
- }
-
- // add the markers of deleted positions back to the annotation model
- for (Iterator e= fDeletedAnnotations.iterator(); e.hasNext();) {
- Object o= e.next();
- if (o instanceof MarkerAnnotation) {
- MarkerAnnotation a= (MarkerAnnotation) o;
- Position p= createPositionFromMarker(a.getMarker());
- if (p != null)
- try {
- addAnnotation(a, p, false);
- } catch (BadLocationException e1) {
- // ignore invalid position
- }
- }
- }
- fDeletedAnnotations.clear();
-
- // fire annotation model changed
- fireModelChanged();
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java
deleted file mode 100644
index 01a1deb80e5..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.texteditor;
-
-
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.window.Window;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.PlatformUI;
-
-
-
-/**
- * Action for creating a marker of a specified type for the editor's
- * input element based on the editor's selection. If required, the
- * action asks the user to provide a marker label. The action is initially
- * associated with a text editor via the constructor, but that can be
- * subsequently changed using <code>setEditor</code>.
- * <p>
- * The following keys, prepended by the given option prefix,
- * are used for retrieving resources from the given bundle:
- * <ul>
- * <li><code>"dialog.title"</code> - the input dialog's title</li>
- * <li><code>"dialog.message"</code> - the input dialog's message</li>
- * <li><code>"error.dialog.title"</code> - the error dialog's title</li>
- * <li><code>"error.dialog.message"</code> - the error dialog's message</li>
- * </ul>
- * This class may be instantiated but is not intended for subclassing.
- * </p>
- */
-public class AddMarkerAction extends TextEditorAction {
-
-
- /** The maximum length of an proposed label. */
- private static final int MAX_LABEL_LENGTH= 10;
- /** The type for newly created markers */
- private String fMarkerType;
- /** Should the user be asked for a label? */
- private boolean fAskForLabel;
- /** The action's resource bundle */
- private ResourceBundle fBundle;
- /** The prefix used for resource bundle lookup */
- private String fPrefix;
-
-
- /**
- * Creates a new action for the given text editor. The action configures its
- * visual representation from the given resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param textEditor the text editor
- * @param markerType the type of marker to add
- * @param askForLabel <code>true</code> if the user should be asked for
- * a label for the new marker
- * @see ResourceAction#ResourceAction
- */
- public AddMarkerAction(ResourceBundle bundle, String prefix, ITextEditor textEditor, String markerType, boolean askForLabel) {
- super(bundle, prefix, textEditor);
- fBundle= bundle;
- fPrefix= prefix;
- fMarkerType= markerType;
- fAskForLabel= askForLabel;
- }
-
- /**
- * Returns this action's resource bundle.
- *
- * @return this action's resource bundle
- */
- protected ResourceBundle getResourceBundle() {
- return fBundle;
- }
-
- /**
- * Returns this action's resource key prefix.
- *
- * @return this action's resource key prefix
- */
- protected String getResourceKeyPrefix() {
- return fPrefix;
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- IResource resource= getResource();
- if (resource == null)
- return;
- Map attributes= getInitialAttributes();
- if (fAskForLabel) {
- if (!askForLabel(attributes))
- return;
- }
-
- try {
- MarkerUtilities.createMarker(resource, attributes, fMarkerType);
- } catch (CoreException x) {
-
- Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog().log(x.getStatus());
-
- Shell shell= getTextEditor().getSite().getShell();
- String title= getString(fBundle, fPrefix + "error.dialog.title", fPrefix + "error.dialog.title"); //$NON-NLS-2$ //$NON-NLS-1$
- String msg= getString(fBundle, fPrefix + "error.dialog.message", fPrefix + "error.dialog.message"); //$NON-NLS-2$ //$NON-NLS-1$
-
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- /*
- * @see TextEditorAction#update()
- */
- public void update() {
- setEnabled(getResource() != null);
- }
-
- /**
- * Asks the user for a marker label. Returns <code>true</code> if a label
- * is entered, <code>false</code> if the user cancels the input dialog.
- * The value for the attribute <code>message</code> is modified in the given
- * attribute map.
- *
- * @param attributes the attributes map
- * @return <code>true</code> if a label has been entered
- */
- protected boolean askForLabel(Map attributes) {
-
- Object o= attributes.get("message"); //$NON-NLS-1$
- String proposal= (o instanceof String) ? (String) o : ""; //$NON-NLS-1$
- if (proposal == null)
- proposal= ""; //$NON-NLS-1$
-
- String title= getString(fBundle, fPrefix + "dialog.title", fPrefix + "dialog.title"); //$NON-NLS-2$ //$NON-NLS-1$
- String message= getString(fBundle, fPrefix + "dialog.message", fPrefix + "dialog.message"); //$NON-NLS-2$ //$NON-NLS-1$
- IInputValidator inputValidator = new IInputValidator() {
- public String isValid(String newText) {
- return (newText == null || newText.trim().length() == 0) ? " " : null; //$NON-NLS-1$
- }
- };
- InputDialog dialog= new InputDialog(getTextEditor().getSite().getShell(), title, message, proposal, inputValidator);
-
- String label= null;
- if (dialog.open() != Window.CANCEL)
- label= dialog.getValue();
-
- if (label == null)
- return false;
-
- label= label.trim();
- if (label.length() == 0)
- return false;
-
- attributes.put("message", label); //$NON-NLS-1$
- return true;
- }
-
- /**
- * Returns the attributes the new marker will be initialized with.
- * <p>
- * Subclasses may extend or replace this method.</p>
- *
- * @return the attributes the new marker will be initialized with
- */
- protected Map getInitialAttributes() {
-
- Map attributes= new HashMap(11);
-
- ITextSelection selection= (ITextSelection) getTextEditor().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);
-
- IDocument document= getTextEditor().getDocumentProvider().getDocument(getTextEditor().getEditorInput());
- MarkerUtilities.setMessage(attributes, getLabelProposal(document, start, length));
-
- }
-
- return attributes;
- }
-
- /**
- * Returns the initial label for the marker.
- *
- * @param document the document from which to extract a label proposal
- * @param offset the document offset of the range from which to extract the label proposal
- * @param length the length of the range from which to extract the label proposal
- * @return the label proposal
- */
- protected String getLabelProposal(IDocument document, int offset, int length) {
-
-
- try {
-
-
- if (length > 0) {
-
- // find first white char but skip leading white chars
- int i= 0;
- boolean skip= true;
- while (i < length) {
- boolean isWhitespace= Character.isWhitespace(document.getChar(offset + i));
- if (!skip && isWhitespace)
- break;
- if (skip && !isWhitespace)
- skip= false;
- i++;
- }
-
- String label= document.get(offset, i);
- return label.trim();
- }
-
-
- char ch;
-
- // Get the first white char before the selection.
- int left= offset;
-
- int line= document.getLineOfOffset(offset);
- int limit= document.getLineOffset(line);
-
- while (left > limit) {
- ch= document.getChar(left);
- if (Character.isWhitespace(ch))
- break;
- --left;
- }
-
- limit += document.getLineLength(line);
-
- // Now get the first letter.
- while (left <= limit) {
- ch= document.getChar(left);
- if (!Character.isWhitespace(ch))
- break;
- ++left;
- }
-
- if (left > limit)
- return null;
-
- limit= Math.min(limit, left + MAX_LABEL_LENGTH);
-
- // Get the next white char.
- int right= (offset + length > limit ? limit : offset + length);
- while (right < limit) {
- ch= document.getChar(right);
- if (Character.isWhitespace(ch))
- break;
- ++right;
- }
-
- // Trim the string and return it.
- if (left != right) {
- String label= document.get(left, right - left);
- return label.trim();
- }
-
- } catch (BadLocationException x) {
- // don't proposal label then
- }
-
- return null;
- }
-
- /**
- * 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>.
- * Subclasses may override this method.
- *
- * @return the resource to which to attach the newly created marker
- */
- protected IResource getResource() {
- ITextEditor editor= getTextEditor();
- if (editor != null) {
- IEditorInput input= editor.getEditorInput();
- return (IResource) ((IAdaptable) input).getAdapter(IResource.class);
- }
- return null;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddTaskAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddTaskAction.java
deleted file mode 100644
index eb48e000fe6..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddTaskAction.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.texteditor;
-
-
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.ui.views.tasklist.TaskPropertiesDialog;
-
-
-/**
- * Creates a new task marker. Uses the Workbench's task properties dialog.
- * @since 2.0
- */
-public class AddTaskAction extends AddMarkerAction {
-
- /**
- * Creates a new action for the given text editor. The action configures its
- * visual representation from the given resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param editor the text editor
- * @see ResourceAction#ResourceAction
- */
- public AddTaskAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
- super(bundle, prefix, editor, IMarker.TASK, false);
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
-
- IResource resource= getResource();
- if (resource == null)
- return;
- Map attributes= getInitialAttributes();
-
- TaskPropertiesDialog dialog = new TaskPropertiesDialog(getTextEditor().getSite().getShell());
- dialog.setResource(resource);
- dialog.setInitialAttributes(attributes);
- dialog.open();
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationPreferenceLookup.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationPreferenceLookup.java
deleted file mode 100644
index 60e8b1eb2eb..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationPreferenceLookup.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.ui.texteditor;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jface.text.source.Annotation;
-
-import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-
-/**
- * Provides the strategy for finding the annotation preference for a given
- * annotation.
- *
- * @since 3.0
- */
-public class AnnotationPreferenceLookup {
-
- /** The map between annotation types and annotation preference fragments. */
- private Map fFragments;
-
- /**
- * Creates a new annotation preference lookup object.
- */
- public AnnotationPreferenceLookup() {
- }
-
- /**
- * Returns the annotation preference of a given annotation.
- *
- * @param annotation the annotation
- * @return the annotation preference for the given annotation or <code>null</code>
- */
- public AnnotationPreference getAnnotationPreference(Annotation annotation) {
- String typeName= annotation.getType();
- if (typeName == null)
- return null;
-
- AnnotationTypeHierarchy hierarchy= getAnnotationTypeHierarchy();
- AnnotationType type= hierarchy.getAnnotationType(typeName);
- AnnotationPreference preference= type.getPreference();
- if (preference == null) {
- preference= new DelegatingAnnotationPreference(type, this);
- type.setAnnotationPreference(preference);
- }
-
- return preference;
- }
-
- /**
- * Returns the annotation preference fragment defined for the given annotation type.
- *
- * @param annotationType the annotation type
- * @return the defined annotation preference fragment
- */
- public AnnotationPreference getAnnotationPreferenceFragment(String annotationType) {
- Map fragments= getPreferenceFragments();
- return (AnnotationPreference) fragments.get(annotationType);
- }
-
- /**
- * Returns the annotation type hierarchy and creates it when not yet done.
- *
- * @return the annotation type hierarchy
- */
- private AnnotationTypeHierarchy getAnnotationTypeHierarchy() {
- return EditorsPlugin.getDefault().getAnnotationTypeHierarchy();
- }
-
- /**
- * Returns a map between annotation type names and annotation preference
- * fragements and creates it if not yet done.
- *
- * @return the map between annotation type names and annotation preference fragments
- */
- private Map getPreferenceFragments() {
- if (fFragments == null) {
- fFragments= new HashMap();
- MarkerAnnotationPreferences p= new MarkerAnnotationPreferences();
- Iterator e= p.getAnnotationPreferenceFragments().iterator();
- while (e.hasNext()) {
- AnnotationPreference fragment= (AnnotationPreference) e.next();
- Object annotationType = fragment.getAnnotationType();
- AnnotationPreference preference= (AnnotationPreference) fFragments.get(annotationType);
- if (preference == null)
- fFragments.put(annotationType, fragment);
- else
- preference.merge(fragment);
- }
- }
- return fFragments;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationType.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationType.java
deleted file mode 100644
index 05b9d5bcc5f..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationType.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.texteditor;
-
-
-public class AnnotationType {
- private String fType;
- private String[] fSuperTypes;
- private AnnotationPreference fPreference;
-
- public AnnotationType(String type, String[] superTypes) {
- fType= type;
- fSuperTypes= superTypes;
- }
-
- public String getType() {
- return fType;
- }
-
- public String[] getSuperTypes() {
- return fSuperTypes;
- }
-
- /**
- * For internal use only.
- * Visibility will be changed to default.
- */
- public AnnotationPreference getPreference() {
- return fPreference;
- }
-
- /**
- * For internal use only.
- * Visibility will be changed to default.
- */
- public void setAnnotationPreference(AnnotationPreference preference) {
- fPreference= preference;
- }
-
- public boolean isSubtype(String superType) {
- if (fSuperTypes == null || superType == null)
- return false;
-
- if (superType.equals(fType))
- return true;
-
- for (int i= fSuperTypes.length -1; i > -1; i--) {
- if (superType.equals(fSuperTypes[i]))
- return true;
- }
-
- return false;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeHierarchy.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeHierarchy.java
deleted file mode 100644
index 94c823ab6c0..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeHierarchy.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.texteditor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-
-
-/**
- * Internal annotation super type hierarchy cache.
- * TODO this cache is currently unbound, i.e. only limited by the number of annotation types
- *
- * @since 3.0
- */
-public class AnnotationTypeHierarchy {
-
- private Map fTypeMap;
- private Map fTypesCache= new HashMap();
-
- public AnnotationTypeHierarchy() {
- }
-
- public AnnotationType getAnnotationType(String typeName) {
- AnnotationType type= (AnnotationType) fTypesCache.get(typeName);
- if (type == null) {
- String[] superTypes= computeSuperTypes(typeName);
- type= new AnnotationType(typeName, superTypes);
- fTypesCache.put(typeName, type);
- }
- return type;
- }
-
- public boolean isSubtype(String superType, String subtypeCandidate) {
- AnnotationType type= getAnnotationType(subtypeCandidate);
- return type.isSubtype(superType);
- }
-
- private String[] computeSuperTypes(String typeName) {
- ArrayList types= new ArrayList();
- append(types, getDirectSuperType(typeName));
- int index= 0;
- while (index < types.size()) {
- String type= (String) types.get(index++);
- append(types, getDirectSuperType(type));
- }
-
- String[] superTypes= new String[types.size()];
- types.toArray(superTypes);
- return superTypes;
- }
-
- private String getDirectSuperType(String typeName) {
- return (String) getTypeMap().get(typeName);
- }
-
- private void append(List list, String string) {
- if (string == null || string.trim().length() == 0)
- return;
-
- if (!list.contains(string))
- list.add(string);
- }
-
- private Map getTypeMap() {
- if (fTypeMap == null)
- fTypeMap= readTypes();
- return fTypeMap;
- }
-
- private Map readTypes() {
- HashMap allTypes= new HashMap();
-
- IExtensionPoint extensionPoint= Platform.getPluginRegistry().getExtensionPoint(EditorsPlugin.getPluginId(), "annotationTypes");
- if (extensionPoint != null) {
- IConfigurationElement[] elements= extensionPoint.getConfigurationElements();
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
-
- String name= element.getAttribute("name"); //$NON-NLS-1$
- if (name == null || name.trim().length() == 0)
- continue;
-
- String parent= element.getAttribute("super"); //$NON-NLS-1$
- if (parent == null || parent.trim().length() == 0)
- parent= "";
-
- allTypes.put(name, parent);
- }
- }
-
- return allTypes;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java
deleted file mode 100644
index f3bcc0c4a0c..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.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.texteditor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.jface.resource.StringConverter;
-
-import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-
-/**
- * Provides the strategy for determining annotation types for given markers.
- *
- * @since 3.0
- */
-public class AnnotationTypeLookup {
-
- /**
- * Record representing an annotation type mapping.
- */
- private static class AnnotationTypeMapping {
-
- final static int UNDEFINED= -1;
-
- String fAnnotationType;
- String fMarkerType;
- int fMarkerSeverity= UNDEFINED;
-
- boolean isMarkerSeverityDefined() {
- return fMarkerSeverity != UNDEFINED;
- }
- }
-
- /** The lookup table for marker to annotation type mappings. */
- private Map fMapping;
-
- /**
- * Creates a new annotation lookup object.
- */
- public AnnotationTypeLookup() {
- }
-
- /**
- * Computes the annotation type that corresponds to the state of
- * the given marker.
- *
- * @param marker the marker
- * @return the annotation type or <code>null</code>
- */
- public String getAnnotationType(IMarker marker) {
- String markerType= MarkerUtilities.getMarkerType(marker);
- if (markerType != null) {
- int severity= MarkerUtilities.getSeverity(marker);
- return getAnnotationType(markerType, severity);
- }
- return null;
- }
-
- /**
- * Computes the annotation type that corresponds to the given marker type and
- * the given marker severity.
- *
- * @param markerType the marker type
- * @param markerSeverity the marker severity
- * @return the annotation type or <code>null</code>
- */
- public String getAnnotationType(String markerType, int markerSeverity) {
- String annotationType= lookupAnnotationType(markerType, markerSeverity);
- if (annotationType != null)
- return annotationType;
- String[] superTypes= MarkerUtilities.getSuperTypes(markerType);
- for (int i= 0; i < superTypes.length; i++) {
- annotationType= lookupAnnotationType(superTypes[i], markerSeverity);
- if (annotationType != null)
- return annotationType;
- }
- return null;
- }
-
- /**
- * Returns the annotation type for the given marker type and the given
- * marker severity.
- *
- * @param markerType the marker type
- * @param severity the marker severity
- * @return the annotation type
- */
- private String lookupAnnotationType(String markerType, int severity) {
- if (fMapping == null)
- initializeMapping();
-
- Object value= fMapping.get(markerType);
-
- if (value instanceof String)
- return (String) value;
-
- if (value instanceof Map) {
- Map severityMap= (Map) value;
- return (String) severityMap.get(new Integer(severity));
- }
-
- return null;
- }
-
- /**
- * Initializes the mapping between markers and their property values and
- * annotation types.
- */
- private void initializeMapping() {
- fMapping= new HashMap();
- List mappings= getAnnotationTypeMappings();
- for (int i= 0, l= mappings.size(); i < l; i++) {
- AnnotationTypeMapping atm= (AnnotationTypeMapping) mappings.get(i);
- if (atm.isMarkerSeverityDefined()) {
- Object severityMap= fMapping.get(atm.fMarkerType);
- if (!(severityMap instanceof Map)) {
- severityMap= new HashMap();
- fMapping.put(atm.fMarkerType, severityMap);
- }
- Map map= (Map) severityMap;
- map.put(new Integer(atm.fMarkerSeverity), atm.fAnnotationType);
- } else {
- fMapping.put(atm.fMarkerType, atm.fAnnotationType);
- }
- }
- }
-
- /**
- * Returns the list of annotation type mappings generated from the
- * extensions provided for the annotation type extension point.
- *
- * @return a list of annotation type mappings
- */
- private List getAnnotationTypeMappings() {
- List annotationTypeMappings= new ArrayList();
- // read compatibility mode
- readExtensionPoint(annotationTypeMappings, "markerAnnotationSpecification", "annotationType");
- // read new extension point
- readExtensionPoint(annotationTypeMappings, "annotationTypes", "name");
- return annotationTypeMappings;
- }
-
- /**
- * Reads the extensions provided for the given extension point name. Uses
- * the given type attribute name to create annotation type mappings that
- * are appended to the given list.
- *
- * @param annotationTypeMappings the list to be populated
- * @param extensionPointName the name of the extension point to read
- * @param typeAttributeName the name of attribute specifying the annotation
- * type
- */
- private void readExtensionPoint(List annotationTypeMappings, String extensionPointName, String typeAttributeName) {
- IExtensionPoint extensionPoint= Platform.getPluginRegistry().getExtensionPoint(EditorsPlugin.getPluginId(), extensionPointName);
- if (extensionPoint != null) {
- IConfigurationElement[] elements= extensionPoint.getConfigurationElements();
- for (int i= 0; i < elements.length; i++) {
- AnnotationTypeMapping mapping= createMapping(elements[i], typeAttributeName);
- if (mapping != null)
- annotationTypeMappings.add(mapping);
- }
- }
- }
-
- /**
- * Creates an annotation type mapping from the given configuration element.
- *
- * @param element the configuration element
- * @param typeAttributeName the name of the attribute specifying the
- * annotation type
- * @return the annotation type mapping or <code>null</code>
- */
- private AnnotationTypeMapping createMapping(IConfigurationElement element, String typeAttributeName) {
-
- AnnotationTypeMapping mapping= new AnnotationTypeMapping();
-
- String s= element.getAttribute(typeAttributeName); //$NON-NLS-1$
- if (s == null || s.trim().length() == 0) return null;
- mapping.fAnnotationType= s;
-
- s= element.getAttribute("markerType"); //$NON-NLS-1$
- if (s == null || s.trim().length() == 0) return null;
- mapping.fMarkerType= s;
-
- s= element.getAttribute("markerSeverity"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- mapping.fMarkerSeverity= StringConverter.asInt(s, AnnotationTypeMapping.UNDEFINED);
-
- return mapping;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BasicMarkerUpdater.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BasicMarkerUpdater.java
deleted file mode 100644
index 4440eae6467..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BasicMarkerUpdater.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.texteditor;
-
-
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-
-import org.eclipse.core.resources.IMarker;
-
-
-/**
- * Updates a marker's positional attributes which are
- * start position, end position, and line number.
- */
-public final class BasicMarkerUpdater implements IMarkerUpdater {
-
- private final static String[] ATTRIBUTES= {
- IMarker.CHAR_START,
- IMarker.CHAR_END,
- IMarker.LINE_NUMBER
- };
-
- /**
- * Creates a new basic marker updater.
- */
- public BasicMarkerUpdater() {
- super();
- }
-
- /*
- * @see IMarkerUpdater#getAttribute()
- */
- public String[] getAttribute() {
- return ATTRIBUTES;
- }
-
- /*
- * @see IMarkerUpdater#getMarkerType()
- */
- public String getMarkerType() {
- return null;
- }
-
- /*
- * @see IMarkerUpdater#updateMarker(IMarker, IDocument, Position)
- */
- public boolean updateMarker(IMarker marker, IDocument document, Position position) {
-
- if (position == null)
- return true;
-
- if (position.isDeleted())
- return false;
-
- boolean offsetsInitialized= false;
- boolean offsetsChanged= false;
- int markerStart= MarkerUtilities.getCharStart(marker);
- int markerEnd= MarkerUtilities.getCharEnd(marker);
-
- if (markerStart != -1 && markerEnd != -1) {
-
- offsetsInitialized= true;
-
- int offset= position.getOffset();
- if (markerStart != offset) {
- MarkerUtilities.setCharStart(marker, offset);
- offsetsChanged= true;
- }
-
- offset += position.getLength();
- if (markerEnd != offset) {
- MarkerUtilities.setCharEnd(marker, offset);
- offsetsChanged= true;
- }
- }
-
- if (!offsetsInitialized || (offsetsChanged && MarkerUtilities.getLineNumber(marker) != -1)) {
- try {
- // marker line numbers are 1-based
- MarkerUtilities.setLineNumber(marker, document.getLineOfOffset(position.getOffset()) + 1);
- } catch (BadLocationException x) {
- }
- }
-
- return true;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BookmarkRulerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BookmarkRulerAction.java
deleted file mode 100644
index 1ff5846f932..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BookmarkRulerAction.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.texteditor;
-
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-
-/**
- * Adapter for the managing bookmark action.
- * @since 2.0
- */
-public class BookmarkRulerAction extends AbstractRulerActionDelegate {
-
- /**
- * @see AbstractRulerActionDelegate#createAction(ITextEditor, IVerticalRulerInfo)
- */
- protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
- return new MarkerRulerAction(TextEditorMessages.getResourceBundle(), "Editor.ManageBookmarks.", editor, rulerInfo, IMarker.BOOKMARK, true); //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultAnnotation.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultAnnotation.java
deleted file mode 100644
index 1114545bf3c..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultAnnotation.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationPresentation;
-
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-
-/**
- * Default annotation.
- * This class may be instantiated or be subclassed.
- * <p>
- * XXX: This is work in progress and can change anytime until API for 3.0 is frozen.
- * </p>
- * @since 3.0
- * @deprecated use Annotation and ImageUtilities, stay with layer definitions until new home found for them
- */
-public class DefaultAnnotation extends Annotation implements IAnnotationPresentation {
-
- /**
- * The layer in which task annotations are located.
- */
- public final static int TASK_LAYER= 1;
-
- /**
- * The layer in which bookmarks annotatons are located.
- */
- public final static int BOOKMARK_LAYER= 2;
-
- /**
- * The layer in which info annotations are located.
- */
- public final static int INFO_LAYER= 3;
-
- /**
- * The layer in which warning annotations representing are located.
- */
- public final static int WARNING_LAYER= 4;
-
- /**
- * The layer in which error annotations representing are located.
- */
- public final static int ERROR_LAYER= 5;
-
- /** Internal image registry */
- private static Map fgImageRegistry;
- /** Internal type to descriptor map */
- private static Map fgType2Descriptor= new HashMap();
- /** Indicates that no descriptor was found */
- private static final Object NO_DESCRIPTOR= new Object();
-
- protected Image fImage;
- protected String fImageName;
-
- private int fSeverity;
- private String fMarkerType;
-
- private boolean fIsInitialized= false;
-
- /**
- * Returns an image for the given display as specified by the given image descriptor.
- *
- * @param display the display
- * @param descriptor the image descriptor
- * @return an image for the display as specified by the descriptor
- */
- protected static Image getImage(Display display, ImageDescriptor descriptor) {
- Map map= getImageRegistry(display);
- Image image= (Image) map.get(descriptor);
- if (image == null) {
- image= descriptor.createImage();
- map.put(descriptor, image);
- }
- return image;
- }
-
- /**
- * Returns an image registry for the given display. If no such registry exists
- * the resgitry is created.
- *
- * @param display the display
- * @return the image registry for the given display
- */
- protected static Map getImageRegistry(Display display) {
- if (fgImageRegistry == null) {
- fgImageRegistry= new HashMap();
- display.disposeExec(new Runnable() {
- public void run() {
- if (fgImageRegistry != null) {
- Map map= fgImageRegistry;
- fgImageRegistry= null;
- Iterator e= map.values().iterator();
- while (e.hasNext()) {
- Image image= (Image) e.next();
- if (!image.isDisposed())
- image.dispose();
- }
- }
- }
- });
- }
- return fgImageRegistry;
- }
-
- /**
- * Returns whether the given annotationType is of the given type.
- * <p>
- * XXX: See bug 41478 why we don't match sub-types
- * </p>
- *
- * @param annotationType the annotationType to be checked
- * @param type the reference type
- * @return <code>true</code>if annotationType is an instance of the reference type
- */
- private static boolean isAnnotationType(String annotationType, String type) {
- return annotationType != null && annotationType.equals(type);
- }
-
- /**
- * Creates a new annotation.
- *
- * @param markerType the marker type of this annotation
- * @param severity the severity of this annotation
- * @param isTemporary <code>true</code> if this is a temporary annotation
- * @param message the message of this annotation
- */
- public DefaultAnnotation(String markerType, int severity, boolean isTemporary, String message) {
- super(!isTemporary);
- Assert.isTrue(severity == IMarker.SEVERITY_INFO || severity == IMarker.SEVERITY_WARNING || severity == IMarker.SEVERITY_ERROR);
- fSeverity= severity;
- fMarkerType= markerType;
- setText(message);
- setType(computeAnnotationType(markerType, severity));
- }
-
- /**
- * Computes the annotation type based on marker type and marker severity.
- *
- * @param markerType the marker type
- * @param severity the marker severity
- * @return the corresponding annotation type
- */
- private String computeAnnotationType(String markerType, int severity) {
- AnnotationTypeLookup lookup= EditorsPlugin.getDefault().getAnnotationTypeLookup();
- return lookup.getAnnotationType(markerType, severity);
- }
-
- /**
- * Initializes the annotation's icon representation and its drawing layer
- * based upon the properties of the underlying marker.
- */
- protected void initialize() {
-
- String name= getUnknownImageName(fMarkerType);
- int layer= 1;
-
- if (isAnnotationType(fMarkerType, IMarker.TASK)) {
- name= IDE.SharedImages.IMG_OBJS_TASK_TSK;
- layer= TASK_LAYER;
- } else if (isAnnotationType(fMarkerType, IMarker.BOOKMARK)) {
- name= IDE.SharedImages.IMG_OBJS_BKMRK_TSK;
- layer= BOOKMARK_LAYER;
- } else if (isAnnotationType(fMarkerType, IMarker.PROBLEM)) {
- switch (fSeverity) {
- case IMarker.SEVERITY_INFO:
- name= ISharedImages.IMG_OBJS_INFO_TSK;
- layer= INFO_LAYER;
- break;
- case IMarker.SEVERITY_WARNING:
- name= ISharedImages.IMG_OBJS_WARN_TSK;
- layer= WARNING_LAYER;
- break;
- case IMarker.SEVERITY_ERROR:
- name= ISharedImages.IMG_OBJS_ERROR_TSK;
- layer= ERROR_LAYER;
- break;
- }
- }
-
- fImage= null;
- fImageName= name;
- setLayer(layer);
- }
-
- /**
- * Returns the name of an image used to visually represent markers of
- * unknown type. This implementation returns <code>null</code>.
- * Subclasses may replace this method.
- *
- * @return the name of an image for markers of unknown type.
- */
- protected String getUnknownImageName(String annotationType) {
- return null;
- }
-
- /*
- * @see Annotation#paint(GC, Canvas, Rectangle)
- */
- public void paint(GC gc, Canvas canvas, Rectangle r) {
- Image image= getImage(canvas.getDisplay());
- if (image != null)
- drawImage(image, gc, canvas, r, SWT.CENTER, SWT.TOP);
- }
-
- /**
- * Sets the marker image to the given image.
- *
- * @param image the new marker image
- */
- protected void setImage(Image image) {
- fImage= image;
- }
-
- /**
- * Returns the image of the given name. Subclasses may extend this method.
- * If so, subclasses must assume responsibility for disposing the images
- * they create.
- *
- * @param name the name of the requested image
- * @return the image or <code>null</code> if there is no such image
- */
- protected Image getImage(String name) {
- if (name != null)
- return PlatformUI.getWorkbench().getSharedImages().getImage(name);
- return null;
- }
-
- /*
- * @see IJavaAnnotation#getImage(Display)
- */
- protected Image getImage(final Display display) {
-
- if (!fIsInitialized) {
- fIsInitialized= true;
- initialize();
- }
-
- if (fImage != null)
- return fImage;
-
- final String key= fMarkerType + fSeverity;
-
- Object descriptor= fgType2Descriptor.get(key);
- if (descriptor != null) {
- if (descriptor == NO_DESCRIPTOR)
- fImage= getImage(fImageName);
- else
- fImage= getImage(display, (ImageDescriptor)descriptor);
- return fImage;
- }
-
- // XXX: hack since I cannot get the image for a marker type
- WorkspaceModifyOperation r= new WorkspaceModifyOperation(null) {
- /*
- * @see WorkspaceModifyOperation#execute(IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CoreException {
- IMarker tempMarker= ResourcesPlugin.getWorkspace().getRoot().createMarker(fMarkerType);
- tempMarker.setAttribute(IMarker.SEVERITY, fSeverity);
- if (tempMarker.exists()) {
- IWorkbenchAdapter adapter= (IWorkbenchAdapter) tempMarker.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- Object imageDescriptor= adapter.getImageDescriptor(tempMarker);
- if (imageDescriptor != null) {
- fImage= getImage(display, (ImageDescriptor)imageDescriptor);
- fgType2Descriptor.put(key, imageDescriptor);
- } else {
- fgType2Descriptor.put(key, NO_DESCRIPTOR);
- }
- }
- tempMarker.delete();
- }
- }
- };
- try {
- r.run(null);
- } catch (InvocationTargetException e) {
- fgType2Descriptor.put(key, NO_DESCRIPTOR);
- } catch (InterruptedException e) {
- fgType2Descriptor.put(key, NO_DESCRIPTOR);
- }
-
- if (fImage == null)
- fImage= getImage(fImageName);
-
- return fImage;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultMarkerAnnotationAccess.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultMarkerAnnotationAccess.java
deleted file mode 100644
index a142079c1c7..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultMarkerAnnotationAccess.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.ui.texteditor;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationAccess;
-import org.eclipse.jface.text.source.IAnnotationAccessExtension;
-import org.eclipse.jface.text.source.IAnnotationPresentation;
-
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-
-import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-
-
-/**
- * @since 2.1
- */
-public class DefaultMarkerAnnotationAccess implements IAnnotationAccess, IAnnotationAccessExtension {
-
- /**
- * Constant for the unknown marker type
- * @deprecated use Annotation.TYPE_UNKNOWN instead
- */
- public final static String UNKNOWN= Annotation.TYPE_UNKNOWN;
-
- /**
- * Constant for the error system image.
- * Value: <code>error</code>
- *
- * @since 3.0
- */
- public final static String ERROR_SYSTEM_IMAGE= "error";
- /**
- * Constant for the warning system image.
- * Value: <code>warning</code>
- *
- * @since 3.0
- */
- public final static String WARNING_SYSTEM_IMAGE= "warning";
- /**
- * Constant for the info system image.
- * Value: <code>info</code>
- *
- * @since 3.0
- */
- public final static String INFO_SYSTEM_IMAGE= "info";
- /**
- * Constant for the task system image.
- * Value: <code>task</code>
- *
- * @since 3.0
- */
- public final static String TASK_SYSTEM_IMAGE= "task";
- /**
- * Constant for the bookmark system image.
- * Value: <code>bookmark</code>
- *
- * @since 3.0
- */
- public final static String BOOKMARK_SYSTEM_IMAGE= "bookmark";
-
- /**
- * The mapping between external and internal symbolic system image names.
- * @since 3.0
- */
- private final static Map MAPPING;
-
- static {
- MAPPING= new HashMap();
- MAPPING.put(ERROR_SYSTEM_IMAGE, ISharedImages.IMG_OBJS_ERROR_TSK);
- MAPPING.put(WARNING_SYSTEM_IMAGE, ISharedImages.IMG_OBJS_WARN_TSK);
- MAPPING.put(INFO_SYSTEM_IMAGE, ISharedImages.IMG_OBJS_INFO_TSK);
- MAPPING.put(TASK_SYSTEM_IMAGE, IDE.SharedImages.IMG_OBJS_TASK_TSK);
- MAPPING.put(BOOKMARK_SYSTEM_IMAGE, IDE.SharedImages.IMG_OBJS_BKMRK_TSK);
- }
-
-
- /**
- * The marker annotation preferences
- * @deprecated since 3.0
- */
- protected MarkerAnnotationPreferences fMarkerAnnotationPreferences;
-
- /**
- * Returns a new default marker annotation access with the given preferences.
- *
- * @param markerAnnotationPreferences
- * @deprecated use <code>DefaultMarkerAnnotationAccess()</code> instead
- */
- public DefaultMarkerAnnotationAccess(MarkerAnnotationPreferences markerAnnotationPreferences) {
- fMarkerAnnotationPreferences= markerAnnotationPreferences;
- }
-
- /**
- * Creates a new default marker annotation access using the standard
- * preference lookup strategy which is the one provided by the enclosing
- * plug-in.
- *
- * @since 3.0
- */
- public DefaultMarkerAnnotationAccess() {
- }
-
- /**
- * Returns the annotation preference for the given annotation.
- *
- * @param annotation the annotation
- * @return the annotation preference for the given annotation or <code>null</code>
- */
- private AnnotationPreference getAnnotationPreference(Annotation annotation) {
- AnnotationPreferenceLookup lookup= getAnnotationPreferenceLookup();
- if (lookup != null)
- return lookup.getAnnotationPreference(annotation);
- return null;
- }
-
- /**
- * Returns the annotation preference lookup used by this annotation access.
- *
- * @return the annotation preference lookup
- * @since 3.0
- */
- protected AnnotationPreferenceLookup getAnnotationPreferenceLookup() {
- return EditorsPlugin.getDefault().getAnnotationPreferenceLookup();
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationAccess#getType(org.eclipse.jface.text.source.Annotation)
- */
- public Object getType(Annotation annotation) {
- return annotation.getType();
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationAccess#isMultiLine(org.eclipse.jface.text.source.Annotation)
- */
- public boolean isMultiLine(Annotation annotation) {
- return true;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationAccess#isTemporary(org.eclipse.jface.text.source.Annotation)
- */
- public boolean isTemporary(Annotation annotation) {
- return !annotation.isPersistent();
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationAccessExtension#getLabel(org.eclipse.jface.text.source.Annotation)
- * @since 3.0
- */
- public String getTypeLabel(Annotation annotation) {
- AnnotationPreference preference= getAnnotationPreference(annotation);
- return preference != null ? preference.getPreferenceLabel() : null;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationAccessExtension#getLayer(org.eclipse.jface.text.source.Annotation)
- * @since 3.0
- */
- public int getLayer(Annotation annotation) {
- AnnotationPreference preference= getAnnotationPreference(annotation);
- if (preference != null)
- return preference.getPresentationLayer();
-
- // only for backward compatibility
- if (annotation instanceof IAnnotationPresentation) {
- IAnnotationPresentation presentation= (IAnnotationPresentation) annotation;
- return presentation.getLayer();
- }
-
- return IAnnotationAccessExtension.DEFAULT_LAYER;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationAccessExtension#paint(org.eclipse.jface.text.source.Annotation, org.eclipse.swt.graphics.GC, org.eclipse.swt.widgets.Canvas, org.eclipse.swt.graphics.Rectangle)
- * @since 3.0
- */
- public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) {
- if (annotation instanceof IAnnotationPresentation) {
-
- IAnnotationPresentation presentation= (IAnnotationPresentation) annotation;
- presentation.paint(gc, canvas, bounds);
-
- } else {
-
- AnnotationPreference preference= getAnnotationPreference(annotation);
- if (preference == null)
- return;
-
- Object type= getType(annotation);
- String annotationType= (type == null ? null : type.toString());
- Image image= getImage(annotation, preference, annotationType);
- if (image != null)
- ImageUtilities.drawImage(image, gc, canvas, bounds, SWT.CENTER, SWT.TOP);
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationAccessExtension#isSubtype(java.lang.Object, java.lang.Object)
- */
- public boolean isSubtype(Object annotationType, Object potentialSupertype) {
- AnnotationTypeHierarchy hierarchy= getAnnotationTypeHierarchy();
- return hierarchy.isSubtype(potentialSupertype.toString(), annotationType.toString());
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationAccessExtension#getSupertypes(java.lang.Object)
- */
- public Object[] getSupertypes(Object annotationType) {
- AnnotationTypeHierarchy hierarchy= getAnnotationTypeHierarchy();
- AnnotationType type= hierarchy.getAnnotationType(annotationType.toString());
- return type.getSuperTypes();
- }
-
- /**
- * Returns the annotation type hierarchy used by this annotation access.
- *
- * @return the annotation type hierarchy
- * @since 3.0
- */
- protected AnnotationTypeHierarchy getAnnotationTypeHierarchy() {
- return EditorsPlugin.getDefault().getAnnotationTypeHierarchy();
- }
-
- /**
- * Translates the given symbolic image name into the according symbolic image name
- * the <code>ISharedImages</code> understands.
- *
- * @param symbolicImageName the symbolic system image name to be translated
- * @since 3.0
- */
- private String translateSymbolicImageName(String symbolicImageName) {
- return (String) MAPPING.get(symbolicImageName);
- }
-
- /**
- * Retuns the image for the given annotation and the given annotation preferences or
- * <code>null</code> if there is no such image.
- *
- * @param annotation the annotation
- * @param preference the annotation preference
- * @param annotationType the annotation type
- * @return the image or <code>null</code>
- * @since 3.0
- */
- private Image getImage(Annotation annotation, AnnotationPreference preference, String annotationType) {
-
- ImageRegistry registry= EditorsPlugin.getDefault().getImageRegistry();
-
- IAnnotationImageProvider annotationImageProvider = preference.getAnnotationImageProvider();
- if (annotationImageProvider != null) {
-
- Image image= annotationImageProvider.getManagedImage(annotation);
- if (image != null)
- return image;
-
- String id= annotationImageProvider.getImageDescriptorId(annotation);
- if (id != null) {
- image= registry.get(id);
- if (image == null) {
- ImageDescriptor descriptor= annotationImageProvider.getImageDescriptor(id);
- registry.put(id, descriptor);
- image= registry.get(id);
- }
- return image;
- }
- }
-
- if (annotationType == null)
- return null;
-
- Image image= registry.get(annotationType);
- if (image == null) {
- ImageDescriptor descriptor= preference.getImageDescriptor();
- if (descriptor != null) {
- registry.put(annotationType, descriptor);
- image= registry.get(annotationType);
- } else {
- String key= translateSymbolicImageName(preference.getSymbolicImageName());
- if (key != null) {
- ISharedImages sharedImages= PlatformUI.getWorkbench().getSharedImages();
- image= sharedImages.getImage(key);
- }
- }
- }
- return image;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DelegatingAnnotationPreference.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DelegatingAnnotationPreference.java
deleted file mode 100644
index c940c9f95df..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DelegatingAnnotationPreference.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.texteditor;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.swt.graphics.RGB;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.jface.text.source.IAnnotationAccessExtension;
-
-
-class DelegatingAnnotationPreference extends AnnotationPreference {
-
- private AnnotationType fType;
- private AnnotationPreferenceLookup fLookup;
- private Set fCache= new HashSet();
-
- public DelegatingAnnotationPreference(AnnotationType type, AnnotationPreferenceLookup lookup) {
- fType= type;
- fLookup= lookup;
- }
-
- private boolean isCached(Object attribute) {
- return fCache.contains(attribute);
- }
-
- private void markCached(Object attribute) {
- fCache.add(attribute);
- }
-
- private AnnotationPreference getDefiningPreference(Object attribute) {
-
- AnnotationPreference p= fLookup.getAnnotationPreferenceFragment(fType.getType());
- if (p != null && p.hasValue(attribute))
- return p;
-
- String[] superTypes= fType.getSuperTypes();
- for (int i= 0; i < superTypes.length; i++) {
- p= fLookup.getAnnotationPreferenceFragment(superTypes[i]);
- if (p != null && p.hasValue(attribute))
- return p;
- }
-
- return null;
- }
-
- private Object getAttributeValue(Object attribute) {
- if (!isCached(attribute)) {
- AnnotationPreference preference= getDefiningPreference(attribute);
- if (preference != null)
- setValue(attribute, preference.getValue(attribute));
- markCached(attribute);
- }
- return getValue(attribute);
- }
-
- private boolean getBooleanAttributeValue(Object attribute) {
- Object value= getAttributeValue(attribute);
- if (value instanceof Boolean)
- return ((Boolean) value).booleanValue();
- return false;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getAnnotationType()
- */
- public Object getAnnotationType() {
- return fType.getType();
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#contributesToHeader()
- */
- public boolean contributesToHeader() {
- return getBooleanAttributeValue(HEADER_VALUE);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getAnnotationImageProvider()
- */
- public IAnnotationImageProvider getAnnotationImageProvider() {
- if (!isCached(IMAGE_PROVIDER)) {
- AnnotationPreference preference= getDefiningPreference(IMAGE_PROVIDER);
- if (preference != null) {
- fAnnotationImageProvider= preference.fAnnotationImageProvider;
- fAnnotationImageProviderAttribute= preference.fAnnotationImageProviderAttribute;
- fConfigurationElement= preference.fConfigurationElement;
- }
- markCached(IMAGE_PROVIDER);
- }
- return super.getAnnotationImageProvider();
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getColorPreferenceKey()
- */
- public String getColorPreferenceKey() {
- return (String) getAttributeValue(COLOR_PREFERENCE_KEY);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getColorPreferenceValue()
- */
- public RGB getColorPreferenceValue() {
- return (RGB) getAttributeValue(COLOR_PREFERENCE_VALUE);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getHighlightPreferenceKey()
- */
- public String getHighlightPreferenceKey() {
- return (String) getAttributeValue(HIGHLIGHT_PREFERENCE_KEY);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getHighlightPreferenceValue()
- */
- public boolean getHighlightPreferenceValue() {
- return getBooleanAttributeValue(HIGHLIGHT_PREFERENCE_VALUE);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return (ImageDescriptor) getAttributeValue(IMAGE_DESCRIPTOR);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getIsGoToNextNavigationTargetKey()
- */
- public String getIsGoToNextNavigationTargetKey() {
- return (String) getAttributeValue(IS_GO_TO_NEXT_TARGET_KEY);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getIsGoToPreviousNavigationTargetKey()
- */
- public String getIsGoToPreviousNavigationTargetKey() {
- return (String) getAttributeValue(IS_GO_TO_PREVIOUS_TARGET_KEY);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getOverviewRulerPreferenceKey()
- */
- public String getOverviewRulerPreferenceKey() {
- return (String) getAttributeValue(OVERVIEW_RULER_PREFERENCE_KEY);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getOverviewRulerPreferenceValue()
- */
- public boolean getOverviewRulerPreferenceValue() {
- return getBooleanAttributeValue(OVERVIEW_RULER_PREFERENCE_VALUE);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getPreferenceLabel()
- */
- public String getPreferenceLabel() {
- return (String) getAttributeValue(PREFERENCE_LABEL);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getPresentationLayer()
- */
- public int getPresentationLayer() {
- Object value= getAttributeValue(PRESENTATION_LAYER);
- if (value instanceof Integer)
- return ((Integer) value).intValue();
- return IAnnotationAccessExtension.DEFAULT_LAYER;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getShowInNextPrevDropdownToolbarActionKey()
- */
- public String getShowInNextPrevDropdownToolbarActionKey() {
- return (String) getAttributeValue(SHOW_IN_NAVIGATION_DROPDOWN_KEY);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getSymbolicImageName()
- */
- public String getSymbolicImageName() {
- return (String) getAttributeValue(SYMBOLIC_IMAGE_NAME);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getTextPreferenceKey()
- */
- public String getTextPreferenceKey() {
- return (String) getAttributeValue(TEXT_PREFERENCE_KEY);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getTextPreferenceValue()
- */
- public boolean getTextPreferenceValue() {
- return getBooleanAttributeValue(TEXT_PREFERENCE_VALUE);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getVerticalRulerPreferenceKey()
- */
- public String getVerticalRulerPreferenceKey() {
- return (String) getAttributeValue(VERTICAL_RULER_PREFERENCE_KEY);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#getVerticalRulerPreferenceValue()
- */
- public boolean getVerticalRulerPreferenceValue() {
- return getBooleanAttributeValue(VERTICAL_RULER_PREFERENCE_VALUE);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#isGoToNextNavigationTarget()
- */
- public boolean isGoToNextNavigationTarget() {
- return getBooleanAttributeValue(IS_GO_TO_NEXT_TARGET_VALUE);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#isGoToPreviousNavigationTarget()
- */
- public boolean isGoToPreviousNavigationTarget() {
- return getBooleanAttributeValue(IS_GO_TO_PREVIOUS_TARGET_VALUE);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AnnotationPreference#isShowInNextPrevDropdownToolbarAction()
- */
- public boolean isShowInNextPrevDropdownToolbarAction() {
- return getBooleanAttributeValue(SHOW_IN_NAVIGATION_DROPDOWN_VALUE);
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DocumentProviderRegistry.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DocumentProviderRegistry.java
deleted file mode 100644
index 2ff99547e13..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DocumentProviderRegistry.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.texteditor;
-
-
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.PlatformUI;
-
-import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-
-
-/**
- * This registry manages shareable document provider. Document
- * providers are specified in <code>plugin.xml</code> either
- * per name extension or per editor input type. A name extension
- * rule always overrules an editor input type rule. Editor input
- * type rules follow the same rules <code>IAdapterManager</code>
- * used to find object adapters.
- *
- * @see org.eclipse.core.runtime.IAdapterManager
- */
-public class DocumentProviderRegistry {
-
- /** The registry singleton. */
- private static DocumentProviderRegistry fgRegistry;
-
- /**
- * Returns the standard document provider registry.
- */
- public static DocumentProviderRegistry getDefault() {
- if (fgRegistry == null)
- fgRegistry= new DocumentProviderRegistry();
- return fgRegistry;
- }
-
-
- /** The mapping between name extensions and configuration elements. */
- private Map fExtensionMapping= new HashMap();
- /** The mapping between editor input type names and configuration elements. */
- private Map fInputTypeMapping= new HashMap();
- /** The mapping between configuration elements and instantiated document providers. */
- private Map fInstances= new HashMap();
-
-
- /**
- * Creates a new document provider registry and intializes it with the information
- * found in the plugin registry.
- */
- private DocumentProviderRegistry() {
- initialize();
- }
-
- /**
- * Reads the comma-separated value of the given configuration element
- * for the given attribute name and remembers the configuration element
- * in the given map under the individual tokens of the attribute value.
- */
- private void read(Map map, IConfigurationElement element, String attributeName) {
- String value= element.getAttribute(attributeName);
- if (value != null) {
- StringTokenizer tokenizer= new StringTokenizer(value, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String token= tokenizer.nextToken().trim();
-
- Set s= (Set) map.get(token);
- if (s == null) {
- s= new HashSet();
- map.put(token, s);
- }
- s.add(element);
- }
- }
- }
-
- /**
- * Initializes the document provider registry. It retrieves all implementers of the <code>documentProviders</code>
- * extension point and remembers those implementers based on the name extensions and the editor input
- * types they are for.
- */
- private void initialize() {
-
- IExtensionPoint extensionPoint;
- extensionPoint= Platform.getPluginRegistry().getExtensionPoint(EditorsPlugin.getPluginId(), "documentProviders"); //$NON-NLS-1$
-
- if (extensionPoint == null) {
- String msg= MessageFormat.format(TextEditorMessages.getString("DocumentProviderRegistry.error.extension_point_not_found"), new Object[] { PlatformUI.PLUGIN_ID }); //$NON-NLS-1$
- ILog log= Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog();
- log.log(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, msg, null));
- return;
- }
-
- IConfigurationElement[] elements= extensionPoint.getConfigurationElements();
- for (int i= 0; i < elements.length; i++) {
- read(fExtensionMapping, elements[i], "extensions"); //$NON-NLS-1$
- read(fInputTypeMapping, elements[i], "inputTypes"); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns the document provider for the given configuration element.
- * If there is no instantiated document provider remembered for this
- * element, a new document provider is created and put into the cache.
- */
- private IDocumentProvider getDocumentProvider(IConfigurationElement entry) {
- IDocumentProvider provider= (IDocumentProvider) fInstances.get(entry);
- if (provider == null) {
- try {
- provider= (IDocumentProvider) entry.createExecutableExtension("class"); //$NON-NLS-1$
- fInstances.put(entry, provider);
- } catch (CoreException x) {
- }
- }
- return provider;
- }
-
- /**
- * Returns the first enumerated element of the given set.
- */
- private IConfigurationElement selectConfigurationElement(Set set) {
- if (set != null && !set.isEmpty()) {
- Iterator e= set.iterator();
- return (IConfigurationElement) e.next();
- }
- return null;
- }
-
- /**
- * Returns a shareable document provider for the given name extension.
- *
- * @param extension the name extension to be used for lookup
- * @return the shareable document provider or <code>null</code>
- */
- public IDocumentProvider getDocumentProvider(String extension) {
-
- Set set= (Set) fExtensionMapping.get(extension);
- if (set != null) {
- IConfigurationElement entry= selectConfigurationElement(set);
- return getDocumentProvider(entry);
- }
- return null;
- }
-
- /**
- * Computes the class hierarchy of the given type. The type is
- * part of the computed hierarchy.
- *
- * @return a list with elements of type <code>Class</code>
- */
- private List computeClassList(Class type) {
-
- List result= new ArrayList();
-
- Class c= type;
- while (c != null) {
- result.add(c);
- c= c.getSuperclass();
- }
-
- return result;
- }
-
- /**
- * Computes the list of all interfaces for the given list of
- * classes. The interface lists of the given classes are
- * concatenated.
- *
- * @return a list with elements of type <code>Class</code>
- */
- private List computeInterfaceList(List classes) {
-
- List result= new ArrayList(4);
- Hashtable visited= new Hashtable(4);
-
- Iterator e= classes.iterator();
- while (e.hasNext()) {
- Class c= (Class) e.next();
- computeInterfaceList(c.getInterfaces(), result, visited);
- }
-
- return result;
- }
-
- /**
- * Computes the list of all interfaces of the given list of interfaces,
- * taking a depth-first approach.
- */
- private void computeInterfaceList(Class[] interfaces, List result, Hashtable visited) {
-
- List toBeVisited= new ArrayList(interfaces.length);
-
- for (int i= 0; i < interfaces.length; i++) {
- Class iface= interfaces[i];
- if (visited.get(iface) == null) {
- visited.put(iface, iface);
- result.add(iface);
- toBeVisited.add(iface);
- }
- }
-
- Iterator e= toBeVisited.iterator();
- while(e.hasNext()) {
- Class iface= (Class) e.next();
- computeInterfaceList(iface.getInterfaces(), result, visited);
- }
- }
-
- /**
- * Returns the configuration elements for the first class in the list
- * of given classes for which configuration elements have been remembered.
- *
- * returns an input type mapping or <code>null</code>
- */
- private Object getFirstInputTypeMapping(List classes) {
- Iterator e= classes.iterator();
- while (e.hasNext()) {
- Class c= (Class) e.next();
- Object mapping= fInputTypeMapping.get(c.getName());
- if (mapping != null)
- return mapping;
- }
- return null;
- }
-
- /**
- * Returns the appropriate configuration element for the given type. If
- * there is no configuration element for the type's name, first the list of
- * super classes is searched, and if not successful the list of all interfaces.
- *
- * returns an input type mapping or <code>null</code>
- */
- private Object findInputTypeMapping(Class type) {
-
- if (type == null)
- return null;
-
- Object mapping= fInputTypeMapping.get(type.getName());
- if (mapping != null)
- return mapping;
-
- List classList= computeClassList(type);
- mapping= getFirstInputTypeMapping(classList);
- if (mapping != null)
- return mapping;
-
- return getFirstInputTypeMapping(computeInterfaceList(classList));
- }
-
- /**
- * Returns the shareable document for the type of the given editor input.
- *
- * @param editorInput the input for whose type the provider is looked up
- * @return the shareable document provider
- */
- public IDocumentProvider getDocumentProvider(IEditorInput editorInput) {
-
- IDocumentProvider provider= null;
-
- IFile file= (IFile) editorInput.getAdapter(IFile.class);
- if (file != null)
- provider= getDocumentProvider(file.getFileExtension());
-
- if (provider == null) {
- Set set= (Set) findInputTypeMapping(editorInput.getClass());
- if (set != null) {
- IConfigurationElement entry= selectConfigurationElement(set);
- provider= getDocumentProvider(entry);
- }
- }
-
- return provider;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditor.java
deleted file mode 100644
index 71dbfe44d6e..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditor.java
+++ /dev/null
@@ -1,1022 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.texteditor;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.AnnotationRulerColumn;
-import org.eclipse.jface.text.source.ChangeRulerColumn;
-import org.eclipse.jface.text.source.CompositeRuler;
-import org.eclipse.jface.text.source.IAnnotationAccess;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationModelExtension;
-import org.eclipse.jface.text.source.IChangeRulerColumn;
-import org.eclipse.jface.text.source.IOverviewRuler;
-import org.eclipse.jface.text.source.ISharedTextColors;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.ISourceViewerExtension;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.IVerticalRulerColumn;
-import org.eclipse.jface.text.source.LineChangeHover;
-import org.eclipse.jface.text.source.LineNumberChangeRulerColumn;
-import org.eclipse.jface.text.source.LineNumberRulerColumn;
-import org.eclipse.jface.text.source.OverviewRuler;
-import org.eclipse.jface.text.source.SourceViewer;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
-import org.eclipse.ui.ide.IDEActionFactory;
-import org.eclipse.ui.ide.IGotoMarker;
-import org.eclipse.ui.texteditor.quickdiff.QuickDiff;
-
-import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-import org.eclipse.ui.internal.texteditor.quickdiff.DocumentLineDiffer;
-
-/**
- * An intermediate editor comprising functionality not present in the leaner <code>AbstractTextEditor</code>,
- * but used in many heavy weight (and especially source editing) editors, such as line numbers,
- * change ruler, overview ruler, print margins, current line highlighting, etc.
- *
- * <p>Note that this is work in progress and API is still subject to change for <code>3.0</code>.</p>
- *
- * @since 3.0
- */
-public abstract class ExtendedTextEditor extends StatusTextEditor {
- /**
- * Preference key for showing the line number ruler.
- */
- private final static String LINE_NUMBER_RULER= ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER;
- /**
- * Preference key for the foreground color of the line numbers.
- */
- private final static String LINE_NUMBER_COLOR= ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR;
- /**
- * Preference key for showing the overview ruler.
- */
- private final static String OVERVIEW_RULER= ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER;
- /**
- * Preference key for highlighting current line.
- */
- private final static String CURRENT_LINE= ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE;
- /**
- * Preference key for highlight color of current line.
- */
- private final static String CURRENT_LINE_COLOR= ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR;
- /**
- * Preference key for showing print marging ruler.
- */
- private final static String PRINT_MARGIN= ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN;
- /**
- * Preference key for print margin ruler color.
- */
- private final static String PRINT_MARGIN_COLOR= ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR;
- /**
- * Preference key for print margin ruler column.
- */
- private final static String PRINT_MARGIN_COLUMN= ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN;
-
- /**
- * Adapter class for <code>IGotoMarker</code>.
- */
- private class GotoMarkerAdapter implements IGotoMarker {
- public void gotoMarker(IMarker marker) {
- ExtendedTextEditor.this.gotoMarker(marker);
- }
- }
-
- /**
- * The annotation preferences.
- */
- private MarkerAnnotationPreferences fAnnotationPreferences;
- /**
- * The overview ruler of this editor.
- *
- * <p>This field should not be referenced by subclasses. It is <code>protected</code> for API
- * compatibility reasons and will be made <code>private</code> soon. Use
- * {@link #getOverviewRuler()} instead.</p>
- */
- protected IOverviewRuler fOverviewRuler;
- /**
- * Helper for accessing annotation from the perspective of this editor.
- *
- * <p>This field should not be referenced by subclasses. It is <code>protected</code> for API
- * compatibility reasons and will be made <code>private</code> soon. Use
- * {@link #getAnnotationAccess()} instead.</p>
- */
- protected IAnnotationAccess fAnnotationAccess;
- /**
- * Helper for managing the decoration support of this editor's viewer.
- *
- * <p>This field should not be referenced by subclasses. It is <code>protected</code> for API
- * compatibility reasons and will be made <code>private</code> soon. Use
- * {@link #getSourceViewerDecorationSupport(ISourceViewer)} instead.</p>
- */
- protected SourceViewerDecorationSupport fSourceViewerDecorationSupport;
- /**
- * The line number column.
- *
- * <p>This field should not be referenced by subclasses. It is <code>protected</code> for API
- * compatibility reasons and will be made <code>private</code> soon. Use
- * {@link AbstractTextEditor#getVerticalRuler()} to access the vertical bar instead.</p>
- */
- protected LineNumberRulerColumn fLineNumberRulerColumn;
- /**
- * The change ruler column.
- */
- private IChangeRulerColumn fChangeRulerColumn;
- /**
- * Whether quick diff information is displayed, either on a change ruler or the line number ruler.
- */
- private boolean fIsChangeInformationShown;
- /**
- * The annotation ruler column used in the vertical ruler.
- * @since 3.0
- */
- private AnnotationRulerColumn fAnnotationRulerColumn;
- /**
- * The editor's implicit document provider.
- * @since 3.0
- */
- private IDocumentProvider fImplicitDocumentProvider;
- /**
- * The editor's goto marker adapter.
- * @since 3.0
- */
- private Object fGotoMarkerAdapter= new GotoMarkerAdapter();
-
-
- /**
- * Creates a new text editor.
- */
- public ExtendedTextEditor() {
- super();
- fAnnotationPreferences= new MarkerAnnotationPreferences();
- setRangeIndicator(new DefaultRangeIndicator());
- initializeKeyBindingScopes();
- initializeEditor();
- }
-
- /**
- * Initializes this editor.
- */
- protected void initializeEditor() {
- setPreferenceStore(EditorsPlugin.getDefault().getPreferenceStore());
- }
-
- /**
- * Initializes the key binding scopes of this editor.
- */
- protected void initializeKeyBindingScopes() {
- setKeyBindingScopes(new String[] { "org.eclipse.ui.textEditorScope" }); //$NON-NLS-1$
- }
-
- /*
- * @see IWorkbenchPart#dispose()
- */
- public void dispose() {
- if (fSourceViewerDecorationSupport != null) {
- fSourceViewerDecorationSupport.dispose();
- fSourceViewerDecorationSupport= null;
- }
-
- fAnnotationAccess= null;
- fAnnotationPreferences= null;
- fAnnotationRulerColumn= null;
-
- super.dispose();
- }
-
- /*
- * @see AbstractTextEditor#editorContextMenuAboutToShow(IMenuManager)
- */
- protected void editorContextMenuAboutToShow(IMenuManager menu) {
- super.editorContextMenuAboutToShow(menu);
- addAction(menu, ITextEditorActionConstants.GROUP_EDIT, ITextEditorActionConstants.SHIFT_RIGHT);
- addAction(menu, ITextEditorActionConstants.GROUP_EDIT, ITextEditorActionConstants.SHIFT_LEFT);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler, int)
- */
- protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
-
- fAnnotationAccess= createAnnotationAccess();
- fOverviewRuler= createOverviewRuler(getSharedColors());
-
- ISourceViewer viewer= new SourceViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
- // ensure decoration support has been created and configured.
- getSourceViewerDecorationSupport(viewer);
-
- return viewer;
- }
-
- protected ISharedTextColors getSharedColors() {
- ISharedTextColors sharedColors= EditorsPlugin.getDefault().getSharedTextColors();
- return sharedColors;
- }
-
- protected IOverviewRuler createOverviewRuler(ISharedTextColors sharedColors) {
- IOverviewRuler ruler= new OverviewRuler(getAnnotationAccess(), VERTICAL_RULER_WIDTH, sharedColors);
- Iterator e= fAnnotationPreferences.getAnnotationPreferences().iterator();
- while (e.hasNext()) {
- AnnotationPreference preference= (AnnotationPreference) e.next();
- if (preference.contributesToHeader())
- ruler.addHeaderAnnotationType(preference.getAnnotationType());
- }
- return ruler;
- }
-
- /**
- * Creates the annotation access for this editor.
- *
- * @return the created annotation access
- */
- protected IAnnotationAccess createAnnotationAccess() {
- return new DefaultMarkerAnnotationAccess();
- }
-
- /**
- * Configures the decoration support for this editor's the source viewer. Subclasses may override this
- * method, but should call their superclass' implementation at some point.
- */
- protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
-
- Iterator e= fAnnotationPreferences.getAnnotationPreferences().iterator();
- while (e.hasNext())
- support.setAnnotationPreference((AnnotationPreference) e.next());
-
- support.setCursorLinePainterPreferenceKeys(CURRENT_LINE, CURRENT_LINE_COLOR);
- support.setMarginPainterPreferenceKeys(PRINT_MARGIN, PRINT_MARGIN_COLOR, PRINT_MARGIN_COLUMN);
- support.setSymbolicFontName(getFontPropertyPreferenceKey());
- }
-
- /*
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- if (fSourceViewerDecorationSupport != null)
- fSourceViewerDecorationSupport.install(getPreferenceStore());
-
- if (isPrefQuickDiffAlwaysOn())
- showChangeInformation(true);
- }
-
- /**
- * Tells whether the overview ruler is visible.
- */
- protected boolean isOverviewRulerVisible() {
- IPreferenceStore store= getPreferenceStore();
- return store != null ? store.getBoolean(OVERVIEW_RULER) : false;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.ITextEditorExtension3#showChangeInformation(boolean)
- */
- public void showChangeInformation(boolean show) {
- if (show == fIsChangeInformationShown)
- return;
-
- if (fIsChangeInformationShown) {
- uninstallChangeRulerModel();
- showChangeRuler(false); // hide change ruler if its displayed - if the line number ruler is showing, only the colors get removed by deinstalling the model
- } else {
- ensureChangeInfoCanBeDisplayed();
- installChangeRulerModel();
- }
-
- fIsChangeInformationShown= show;
- }
-
- /**
- * Installs the differ annotation model with the current quick diff display.
- */
- private void installChangeRulerModel() {
- IChangeRulerColumn column= getChangeColumn();
- if (column != null)
- column.setModel(getOrCreateDiffer());
- IOverviewRuler ruler= getOverviewRuler();
- if (ruler != null) {
- ruler.addAnnotationType("org.eclipse.ui.workbench.texteditor.quickdiffChange"); //$NON-NLS-1$
- ruler.addAnnotationType("org.eclipse.ui.workbench.texteditor.quickdiffAddition"); //$NON-NLS-1$
- ruler.addAnnotationType("org.eclipse.ui.workbench.texteditor.quickdiffDeletion"); //$NON-NLS-1$
- ruler.update();
- }
- }
-
- /**
- * Uninstalls the differ annotation model from the current quick diff display.
- */
- private void uninstallChangeRulerModel() {
- IChangeRulerColumn column= getChangeColumn();
- if (column != null)
- column.setModel(null);
- IOverviewRuler ruler= getOverviewRuler();
- if (ruler != null) {
- ruler.removeAnnotationType("org.eclipse.ui.workbench.texteditor.quickdiffChange"); //$NON-NLS-1$
- ruler.removeAnnotationType("org.eclipse.ui.workbench.texteditor.quickdiffAddition"); //$NON-NLS-1$
- ruler.removeAnnotationType("org.eclipse.ui.workbench.texteditor.quickdiffDeletion"); //$NON-NLS-1$
- ruler.update();
- }
- IAnnotationModel model= getOrCreateDiffer();
- if (model instanceof DocumentLineDiffer)
- ((DocumentLineDiffer)model).suspend();
- }
-
- /**
- * Ensures that either the line number display is a <code>LineNumberChangeRuler</code> or
- * a separate change ruler gets displayed.
- */
- private void ensureChangeInfoCanBeDisplayed() {
- if (isLineNumberRulerVisible()) {
- if (!(fLineNumberRulerColumn instanceof IChangeRulerColumn)) {
- hideLineNumberRuler();
- // HACK: set state already so a change ruler is created. Not needed once always a change line number bar gets installed
- fIsChangeInformationShown= true;
- showLineNumberRuler();
- }
- } else
- showChangeRuler(true);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.ITextEditorExtension3#isChangeInformationShowing()
- */
- public boolean isChangeInformationShowing() {
- return fIsChangeInformationShown;
- }
-
- /**
- * Extracts the line differ from the displayed document's annotation model. If none can be found,
- * a new differ is created and attached to the annotation model.
- *
- * @return the linediffer, or <code>null</code> if none could be found or created.
- */
- private IAnnotationModel getOrCreateDiffer() {
- // get annotation model extension
- ISourceViewer viewer= getSourceViewer();
- if (viewer == null)
- return null;
-
- IAnnotationModel m= viewer.getAnnotationModel();
- IAnnotationModelExtension model;
- if (m instanceof IAnnotationModelExtension)
- model= (IAnnotationModelExtension) m;
- else
- return null;
-
- // get diff model if it exists already
- IAnnotationModel differ= model.getAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID);
- IPreferenceStore store= getPreferenceStore();
-
- // create diff model if it doesn't
- if (differ == null && store != null) {
- String defaultId= store.getString(ExtendedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER);
- differ= new QuickDiff().createQuickDiffAnnotationModel(this, defaultId);
- if (differ != null)
- model.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, differ);
- } else if (differ instanceof DocumentLineDiffer && !fIsChangeInformationShown)
- ((DocumentLineDiffer)differ).resume();
-
- return differ;
- }
-
- /**
- * Returns the <code>IChangeRulerColumn</code> of this editor, or <code>null</code> if there is none. Either
- * the line number bar or a separate change ruler column can be returned.
- *
- * @return an instance of <code>IChangeRulerColumn</code> or <code>null</code>.
- */
- private IChangeRulerColumn getChangeColumn() {
- if (fChangeRulerColumn != null)
- return fChangeRulerColumn;
- else if (fLineNumberRulerColumn instanceof IChangeRulerColumn)
- return (IChangeRulerColumn) fLineNumberRulerColumn;
- else
- return null;
- }
-
- /**
- * Sets the display state of the separate change ruler column (not the quick diff display on
- * the line number ruler column) to <code>show</code>.
- *
- * @param show <code>true</code> if the change ruler column should be shown, <code>false</code> if it should be hidden
- */
- private void showChangeRuler(boolean show) {
- IVerticalRuler v= getVerticalRuler();
- if (v instanceof CompositeRuler) {
- CompositeRuler c= (CompositeRuler) v;
- if (show && fChangeRulerColumn == null)
- c.addDecorator(1, createChangeRulerColumn());
- else if (!show && fChangeRulerColumn != null) {
- c.removeDecorator(fChangeRulerColumn);
- fChangeRulerColumn= null;
- }
- }
- }
-
- /**
- * Shows the line number ruler column.
- */
- private void showLineNumberRuler() {
- showChangeRuler(false);
- if (fLineNumberRulerColumn == null) {
- IVerticalRuler v= getVerticalRuler();
- if (v instanceof CompositeRuler) {
- CompositeRuler c= (CompositeRuler) v;
- c.addDecorator(1, createLineNumberRulerColumn());
- }
- }
- }
-
- /**
- * Hides the line number ruler column.
- */
- private void hideLineNumberRuler() {
- if (fLineNumberRulerColumn != null) {
- IVerticalRuler v= getVerticalRuler();
- if (v instanceof CompositeRuler) {
- CompositeRuler c= (CompositeRuler) v;
- c.removeDecorator(fLineNumberRulerColumn);
- }
- fLineNumberRulerColumn = null;
- }
- if (fIsChangeInformationShown)
- showChangeRuler(true);
- }
-
- /**
- * Returns whether the line number ruler column should be
- * visible according to the preference store settings. Subclasses may override this
- * method to provide a custom preference setting.
- *
- * @return <code>true</code> if the line numbers should be visible
- */
- protected boolean isLineNumberRulerVisible() {
- IPreferenceStore store= getPreferenceStore();
- return store != null ? store.getBoolean(LINE_NUMBER_RULER) : false;
- }
-
- /**
- * Returns whether quick diff info should be visible upon opening an editor
- * according to the preference store settings.
- *
- * @return <code>true</code> if the line numbers should be visible
- */
- protected boolean isPrefQuickDiffAlwaysOn() {
- IPreferenceStore store= getPreferenceStore();
- return store != null ? store.getBoolean(ExtendedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON) : false;
- }
-
- /**
- * Initializes the given line number ruler column from the preference store.
- *
- * @param rulerColumn the ruler column to be initialized
- */
- protected void initializeLineNumberRulerColumn(LineNumberRulerColumn rulerColumn) {
- ISharedTextColors sharedColors= getSharedColors();
- IPreferenceStore store= getPreferenceStore();
- if (store != null) {
-
- RGB rgb= null;
- // foreground color
- if (store.contains(LINE_NUMBER_COLOR)) {
- if (store.isDefault(LINE_NUMBER_COLOR))
- rgb= PreferenceConverter.getDefaultColor(store, LINE_NUMBER_COLOR);
- else
- rgb= PreferenceConverter.getColor(store, LINE_NUMBER_COLOR);
- }
- if (rgb == null)
- rgb= new RGB(0, 0, 0);
- rulerColumn.setForeground(sharedColors.getColor(rgb));
-
-
- rgb= null;
- // background color: same as editor, or system default
- if (!store.getBoolean(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
- if (store.contains(PREFERENCE_COLOR_BACKGROUND)) {
- if (store.isDefault(PREFERENCE_COLOR_BACKGROUND))
- rgb= PreferenceConverter.getDefaultColor(store, PREFERENCE_COLOR_BACKGROUND);
- else
- rgb= PreferenceConverter.getColor(store, PREFERENCE_COLOR_BACKGROUND);
- }
- }
- rulerColumn.setBackground(sharedColors.getColor(rgb));
-
- rulerColumn.redraw();
- }
- }
-
- /**
- * Initializes the given change ruler column from the preference store.
- *
- * @param changeColumn the ruler column to be initialized
- */
- private void initializeChangeRulerColumn(IChangeRulerColumn changeColumn) {
- ISharedTextColors sharedColors= getSharedColors();
- IPreferenceStore store= getPreferenceStore();
-
- if (store != null) {
- ISourceViewer v= getSourceViewer();
- if (v != null && v.getAnnotationModel() != null) {
- changeColumn.setModel(v.getAnnotationModel());
- }
-
- Iterator iter= fAnnotationPreferences.getAnnotationPreferences().iterator();
- while (iter.hasNext()) {
- AnnotationPreference pref= (AnnotationPreference) iter.next();
-
- if ("org.eclipse.ui.workbench.texteditor.quickdiffChange".equals(pref.getAnnotationType())) { //$NON-NLS-1$
- RGB rgb= getColorPreference(store, pref);
- changeColumn.setChangedColor(sharedColors.getColor(rgb));
- } else if ("org.eclipse.ui.workbench.texteditor.quickdiffAddition".equals(pref.getAnnotationType())) { //$NON-NLS-1$
- RGB rgb= getColorPreference(store, pref);
- changeColumn.setAddedColor(sharedColors.getColor(rgb));
- } else if ("org.eclipse.ui.workbench.texteditor.quickdiffDeletion".equals(pref.getAnnotationType())) { //$NON-NLS-1$
- RGB rgb= getColorPreference(store, pref);
- changeColumn.setDeletedColor(sharedColors.getColor(rgb));
- }
- }
-
- RGB rgb= null;
- // background color: same as editor, or system default
- if (!store.getBoolean(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
- if (store.contains(PREFERENCE_COLOR_BACKGROUND)) {
- if (store.isDefault(PREFERENCE_COLOR_BACKGROUND))
- rgb= PreferenceConverter.getDefaultColor(store, PREFERENCE_COLOR_BACKGROUND);
- else
- rgb= PreferenceConverter.getColor(store, PREFERENCE_COLOR_BACKGROUND);
- }
- }
- changeColumn.setBackground(sharedColors.getColor(rgb));
-
- if (changeColumn instanceof LineNumberChangeRulerColumn) {
- LineNumberChangeRulerColumn lncrc= (LineNumberChangeRulerColumn) changeColumn;
- lncrc.setDisplayMode(store.getBoolean(ExtendedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE));
- }
- }
-
- changeColumn.redraw();
- }
-
- /**
- * Extracts the color preference for <code>pref</code> from <code>store</code>. If <code>store</code>
- * indicates that the default value is to be used, or the value stored in the preferences store is <code>null</code>,
- * the value is taken from the <code>AnnotationPreference</code>'s default color value.
- *
- * <p>The return value is never <code>null</code></p>
- *
- * @param store
- * @param pref
- * @return
- */
- private RGB getColorPreference(IPreferenceStore store, AnnotationPreference pref) {
- RGB rgb= null;
- if (store.contains(pref.getColorPreferenceKey())) {
- if (store.isDefault(pref.getColorPreferenceKey()))
- rgb= pref.getColorPreferenceValue();
- else
- rgb= PreferenceConverter.getColor(store, pref.getColorPreferenceKey());
- }
- if (rgb == null)
- rgb= pref.getColorPreferenceValue();
- return rgb;
- }
-
- /**
- * Creates a new line number ruler column that is appropriately initialized.
- */
- protected IVerticalRulerColumn createLineNumberRulerColumn() {
- if (isPrefQuickDiffAlwaysOn() || isChangeInformationShowing()) {
- LineNumberChangeRulerColumn column= new LineNumberChangeRulerColumn(getSharedColors());
- column.setHover(createChangeHover());
- initializeChangeRulerColumn(column);
- fLineNumberRulerColumn= column;
- } else {
- fLineNumberRulerColumn= new LineNumberRulerColumn();
- }
- initializeLineNumberRulerColumn(fLineNumberRulerColumn);
- return fLineNumberRulerColumn;
- }
-
- /**
- * Creates and returns a <code>LineChangeHover</code> to be used on this editor's change
- * ruler column. This default implementation returns a plain <code>LineChangeHover</code>.
- * Subclasses may override.
- *
- * @return the change hover to be used by this editors quick diff display
- */
- protected LineChangeHover createChangeHover() {
- return new LineChangeHover();
- }
-
- /**
- * Creates a new change ruler column for quick diff display independent of the
- * line number ruler column
- *
- * @return a new change ruler column
- */
- protected IChangeRulerColumn createChangeRulerColumn() {
- IChangeRulerColumn column= new ChangeRulerColumn();
- column.setHover(createChangeHover());
- fChangeRulerColumn= column;
- initializeChangeRulerColumn(fChangeRulerColumn);
- return fChangeRulerColumn;
- }
-
- /**
- * Returns {@link #createCompositeRuler()}. Subclasses should not override this method, but
- * rather <code>createCompositeRuler</code> if they want to contribute their own vertical ruler
- * implementation. If not an instance of {@link CompositeRuler} is returned, the built-in ruler
- * columns (line numbers, annotations) will not work.
- *
- * <p>May become <code>final</code> in the future.</p>
- *
- * @see AbstractTextEditor#createVerticalRuler()
- */
- protected IVerticalRuler createVerticalRuler() {
- CompositeRuler ruler= createCompositeRuler();
- IPreferenceStore store= getPreferenceStore();
- if (ruler != null && store != null) {
- for (Iterator iter= ruler.getDecoratorIterator(); iter.hasNext();) {
- IVerticalRulerColumn column= (IVerticalRulerColumn)iter.next();
- if (column instanceof AnnotationRulerColumn) {
- fAnnotationRulerColumn= (AnnotationRulerColumn)column;
- for (Iterator iter2= fAnnotationPreferences.getAnnotationPreferences().iterator(); iter2.hasNext();) {
- AnnotationPreference preference= (AnnotationPreference)iter2.next();
- String key= preference.getVerticalRulerPreferenceKey();
- boolean showAnnotation= true;
- if (key != null && store.contains(key))
- showAnnotation= store.getBoolean(key);
- if (showAnnotation)
- fAnnotationRulerColumn.addAnnotationType(preference.getAnnotationType());
- }
- fAnnotationRulerColumn.addAnnotationType(DefaultMarkerAnnotationAccess.UNKNOWN);
- break;
- }
- }
- }
- return ruler;
- }
-
- /**
- * Creates a composite ruler to be used as the vertical ruler by this editor.
- * Subclasses may re-implement this method.
- *
- * @return the vertical ruler
- */
- protected CompositeRuler createCompositeRuler() {
- CompositeRuler ruler= new CompositeRuler();
- ruler.addDecorator(0, new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess()));
-
- if (isLineNumberRulerVisible())
- ruler.addDecorator(1, createLineNumberRulerColumn());
- else if (isPrefQuickDiffAlwaysOn())
- ruler.addDecorator(1, createChangeRulerColumn());
-
- return ruler;
- }
-
- /*
- * @see AbstractTextEditor#handlePreferenceStoreChanged(PropertyChangeEvent)
- */
- protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
-
- try {
-
- ISourceViewer sourceViewer= getSourceViewer();
- if (sourceViewer == null)
- return;
-
- String property= event.getProperty();
-
- if (fSourceViewerDecorationSupport != null && fOverviewRuler != null && OVERVIEW_RULER.equals(property)) {
- if (isOverviewRulerVisible())
- showOverviewRuler();
- else
- hideOverviewRuler();
- return;
- }
-
- if (LINE_NUMBER_RULER.equals(property)) {
- if (isLineNumberRulerVisible())
- showLineNumberRuler();
- else
- hideLineNumberRuler();
- return;
- }
-
- if (fLineNumberRulerColumn != null
- && (LINE_NUMBER_COLOR.equals(property)
- || PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property)
- || PREFERENCE_COLOR_BACKGROUND.equals(property))) {
-
- initializeLineNumberRulerColumn(fLineNumberRulerColumn);
- }
-
- if (fChangeRulerColumn != null
- && (LINE_NUMBER_COLOR.equals(property)
- || PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property)
- || PREFERENCE_COLOR_BACKGROUND.equals(property))) {
-
- initializeChangeRulerColumn(fChangeRulerColumn);
- }
-
- if (fLineNumberRulerColumn instanceof LineNumberChangeRulerColumn
- && ExtendedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE.equals(property)) {
- initializeChangeRulerColumn(getChangeColumn());
- }
-
- AnnotationPreference pref= getAnnotationPreference(property);
- if (pref != null) {
- IChangeRulerColumn column= getChangeColumn();
- if (column != null) {
- Object type= pref.getAnnotationType();
- if (type instanceof String) {
- String annotationType= (String) type;
- if (annotationType.startsWith("org.eclipse.ui.workbench.texteditor.quickdiff"))
- initializeChangeRulerColumn(column);
- }
- }
- }
-
- AnnotationPreference annotationPreference= getVerticalRulerAnnotationPreference(property);
- if (annotationPreference != null && event.getNewValue() instanceof Boolean) {
- Object type= annotationPreference.getAnnotationType();
- if (((Boolean)event.getNewValue()).booleanValue())
- fAnnotationRulerColumn.addAnnotationType(type);
- else
- fAnnotationRulerColumn.removeAnnotationType(type);
- getVerticalRuler().update();
- }
-
- } finally {
- super.handlePreferenceStoreChanged(event);
- }
- }
-
- /**
- * Returns the <code>AnnotationPreference</code> corresponding to <code>colorKey</code>.
- *
- * @param colorKey the color key.
- * @return the corresponding <code>AnnotationPreference</code>
- */
- private AnnotationPreference getAnnotationPreference(String colorKey) {
- for (Iterator iter= fAnnotationPreferences.getAnnotationPreferences().iterator(); iter.hasNext();) {
- AnnotationPreference pref= (AnnotationPreference) iter.next();
- if (colorKey.equals(pref.getColorPreferenceKey()))
- return pref;
- }
- return null;
- }
-
- /**
- * Returns the annotation preference for which the given
- * preference matches a vertical ruler preference key.
- *
- * @param preferenceKey the preference key string
- * @return the annotation preference or <code>null</code> if none
- * @since 3.0
- */
- private AnnotationPreference getVerticalRulerAnnotationPreference(String preferenceKey) {
- if (preferenceKey == null)
- return null;
-
- Iterator e= fAnnotationPreferences.getAnnotationPreferences().iterator();
- while (e.hasNext()) {
- AnnotationPreference info= (AnnotationPreference) e.next();
- if (info != null && preferenceKey.equals(info.getVerticalRulerPreferenceKey()))
- return info;
- }
- return null;
- }
-
- /**
- * Shows the overview ruler.
- */
- protected void showOverviewRuler() {
- if (fOverviewRuler != null) {
- if (getSourceViewer() instanceof ISourceViewerExtension) {
- ((ISourceViewerExtension) getSourceViewer()).showAnnotationsOverview(true);
- fSourceViewerDecorationSupport.updateOverviewDecorations();
- }
- }
- }
-
- /**
- * Hides the overview ruler.
- */
- protected void hideOverviewRuler() {
- if (getSourceViewer() instanceof ISourceViewerExtension) {
- fSourceViewerDecorationSupport.hideAnnotationOverview();
- ((ISourceViewerExtension) getSourceViewer()).showAnnotationsOverview(false);
- }
- }
-
- /**
- * Returns the annotation access.
- *
- * @return the annotation access
- */
- protected IAnnotationAccess getAnnotationAccess() {
- if (fAnnotationAccess == null)
- fAnnotationAccess= createAnnotationAccess();
- return fAnnotationAccess;
- }
-
- /**
- * Returns the annotation preference lookup.
- *
- * @return the annotation preference lookup
- */
- protected AnnotationPreferenceLookup getAnnotationPreferenceLookup() {
- return EditorsPlugin.getDefault().getAnnotationPreferenceLookup();
- }
-
- /**
- * Returns the overview ruler.
- *
- * @return the overview ruler
- */
- protected IOverviewRuler getOverviewRuler() {
- if (fOverviewRuler == null)
- fOverviewRuler= createOverviewRuler(getSharedColors());
- return fOverviewRuler;
- }
-
- /**
- * Returns the source viewer decoration support.
- *
- * @return the source viewer decoration support
- */
- protected SourceViewerDecorationSupport getSourceViewerDecorationSupport(ISourceViewer viewer) {
- if (fSourceViewerDecorationSupport == null) {
- fSourceViewerDecorationSupport= new SourceViewerDecorationSupport(viewer, getOverviewRuler(), getAnnotationAccess(), getSharedColors());
- configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
- }
- return fSourceViewerDecorationSupport;
- }
-
- /**
- * Returns the annotation preferences.
- *
- * @return the annotation preferences
- */
- protected MarkerAnnotationPreferences getAnnotationPreferences() {
- return fAnnotationPreferences;
- }
-
-
- /**
- * If the editor can be saved all marker ranges have been changed according to
- * the text manipulations. However, those changes are not yet propagated to the
- * marker manager. Thus, when opening a marker, the marker's position in the editor
- * must be determined as it might differ from the position stated in the marker.
- *
- * @param marker the marker to go to
- * @deprecated visibility will be reduced, use <code>getAdapter(IGotoMarker.class) for accessing this method</code>
- */
- public void gotoMarker(IMarker marker) {
-
- if (getSourceViewer() == null)
- return;
-
- int start= MarkerUtilities.getCharStart(marker);
- int end= MarkerUtilities.getCharEnd(marker);
-
- if (start < 0 || end < 0) {
-
- // there is only a line number
- int line= MarkerUtilities.getLineNumber(marker);
- if (line > -1) {
-
- // marker line numbers are 1-based
- -- line;
-
- try {
-
- IDocument document= getDocumentProvider().getDocument(getEditorInput());
- selectAndReveal(document.getLineOffset(line), document.getLineLength(line));
-
- } catch (BadLocationException x) {
- // marker refers to invalid text position -> do nothing
- }
- }
-
- } else {
-
- // look up the current range of the marker when the document has been edited
- IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput());
- if (model instanceof AbstractMarkerAnnotationModel) {
-
- AbstractMarkerAnnotationModel markerModel= (AbstractMarkerAnnotationModel) model;
- Position pos= markerModel.getMarkerPosition(marker);
- if (pos != null && !pos.isDeleted()) {
- // use position instead of marker values
- start= pos.getOffset();
- end= pos.getOffset() + pos.getLength();
- }
-
- if (pos != null && pos.isDeleted()) {
- // do nothing if position has been deleted
- return;
- }
- }
-
- IDocument document= getDocumentProvider().getDocument(getEditorInput());
- int length= document.getLength();
- if (end - 1 < length && start < length)
- selectAndReveal(start, end - start);
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.StatusTextEditor#isErrorStatus(org.eclipse.core.runtime.IStatus)
- * @since 3.0
- */
- protected boolean isErrorStatus(IStatus status) {
- // see bug 42230
- return status != null && !status.isOK() && status.getCode() != IResourceStatus.READ_ONLY_LOCAL;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
- */
- protected void createActions() {
- super.createActions();
-
- ResourceAction action= new AddMarkerAction(TextEditorMessages.getResourceBundle(), "Editor.AddBookmark.", this, IMarker.BOOKMARK, true); //$NON-NLS-1$
- action.setHelpContextId(ITextEditorHelpContextIds.BOOKMARK_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.ADD_BOOKMARK);
- setAction(IDEActionFactory.BOOKMARK.getId(), action);
-
- action= new AddTaskAction(TextEditorMessages.getResourceBundle(), "Editor.AddTask.", this); //$NON-NLS-1$
- action.setHelpContextId(ITextEditorHelpContextIds.ADD_TASK_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.ADD_TASK);
- setAction(IDEActionFactory.ADD_TASK.getId(), action);
- }
-
- /*
- * @see IAdaptable#getAdapter(java.lang.Class)
- * @since 3.0
- */
- public Object getAdapter(Class adapter) {
- if (IGotoMarker.class.equals(adapter))
- return fGotoMarkerAdapter;
- return super.getAdapter(adapter);
- }
-
- /*
- * If there is no explicit document provider set, the implicit one is
- * re-initialized based on the given editor input.
- *
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#setDocumentProvider(org.eclipse.ui.IEditorInput)
- * @since 3.0
- */
- protected void setDocumentProvider(IEditorInput input) {
- fImplicitDocumentProvider= DocumentProviderRegistry.getDefault().getDocumentProvider(input);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.ITextEditor#getDocumentProvider()
- * @since 3.0
- */
- public IDocumentProvider getDocumentProvider() {
- IDocumentProvider provider= super.getDocumentProvider();
- if (provider == null)
- return fImplicitDocumentProvider;
- return provider;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#disposeDocumentProvider()
- * @since 3.0
- */
- protected void disposeDocumentProvider() {
- super.disposeDocumentProvider();
- fImplicitDocumentProvider= null;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditorPreferenceConstants.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditorPreferenceConstants.java
deleted file mode 100644
index a49e4ae2af8..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ExtendedTextEditorPreferenceConstants.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.texteditor;
-
-
-import org.eclipse.swt.graphics.RGB;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-
-
-
-/**
- * Preference constants used in the extended text editor preference store.
- * @since 3.0
- */
-public class ExtendedTextEditorPreferenceConstants {
-
- /**
- * Prevent initialization.
- */
- private ExtendedTextEditorPreferenceConstants() {
- }
-
- /**
- * A named preference that controls whether the current line highlighting is turned on or off
- * (value <code>"currentLine"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- */
- public final static String EDITOR_CURRENT_LINE= "currentLine"; //$NON-NLS-1$
-
- /**
- * A named preference that holds the color used to highlight the current line
- * (value <code>"currentLineColor"</code>).
- * <p>
- * The preference value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>.
- * </p>
- * @see org.eclipse.jface.resource.StringConverter
- * @see org.eclipse.jface.preference.PreferenceConverter
- */
- public final static String EDITOR_CURRENT_LINE_COLOR= "currentLineColor"; //$NON-NLS-1$
-
- /**
- * A named preference that controls whether the print margin is turned on or off
- * (value <code>"printMargin"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- */
- public final static String EDITOR_PRINT_MARGIN= "printMargin"; //$NON-NLS-1$
-
- /**
- * A named preference that holds the color used to render the print margin
- * (value <code>"printMarginColor"</code>).
- * <p>
- * The preference value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>.
- * </p>
- * @see org.eclipse.jface.resource.StringConverter
- * @see org.eclipse.jface.preference.PreferenceConverter
- */
- public final static String EDITOR_PRINT_MARGIN_COLOR= "printMarginColor"; //$NON-NLS-1$
-
- /**
- * Print margin column
- * (value <code>"printMarginColumn"</code>).
- * <p>
- * The preference value is of type <code>int</code>.
- * </p>
- */
- public final static String EDITOR_PRINT_MARGIN_COLUMN= "printMarginColumn"; //$NON-NLS-1$
-
- /**
- * A named preference that controls whether the editor shows unknown
- * indicators in text (squiggly lines).
- * (value <code>"othersIndication"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- * @since 2.1
- * @deprecated as of 3.0 there are no UNKNOWN annotations any more
- */
- public final static String EDITOR_UNKNOWN_INDICATION= "othersIndication"; //$NON-NLS-1$
-
- /**
- * A named preference that holds the color used to render unknown indicators
- * (value <code>"othersIndicationColor"</code>).
- * <p>
- * The preference value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>.
- * </p>
- * @see #EDITOR_UNKNOWN_INDICATION
- * @see org.eclipse.jface.resource.StringConverter
- * @see org.eclipse.jface.preference.PreferenceConverter
- * @since 2.1
- * @deprecated as of 3.0 there are no UNKNOWN annotations any more
- */
- public final static String EDITOR_UNKNOWN_INDICATION_COLOR= "othersIndicationColor"; //$NON-NLS-1$
-
- /**
- * A named preference that controls whether the overview ruler shows unknown indicators
- * (value <code>"othersIndicationInOverviewRuler"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- * @since 2.1
- * @deprecated as of 3.0 there are no UNKNOWN annotations any more
- */
- public final static String EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER= "othersIndicationInOverviewRuler"; //$NON-NLS-1$
-
- /**
- * A named preference that controls if the overview ruler is shown in the UI
- * (value <code>"overviewRuler"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- */
- public final static String EDITOR_OVERVIEW_RULER= "overviewRuler"; //$NON-NLS-1$
-
- /**
- * A named preference that controls if the line number ruler is shown in the UI
- * (value <code>"lineNumberRuler"</code>).
- * <p>
- * The preference value is of type <code>Boolean</code>.
- * </p>
- */
- public final static String EDITOR_LINE_NUMBER_RULER= "lineNumberRuler"; //$NON-NLS-1$
-
- /**
- * A named preference that holds the color used to render line numbers inside the line number ruler
- * (value <code>"lineNumberColor"</code>).
- * <p>
- * The preference value is of type <code>String</code>. A RGB color value encoded as a string
- * using class <code>PreferenceConverter</code>.
- * </p>
- * @see org.eclipse.jface.resource.StringConverter
- * @see org.eclipse.jface.preference.PreferenceConverter
- * @see #EDITOR_LINE_NUMBER_RULER
- */
- public final static String EDITOR_LINE_NUMBER_RULER_COLOR= "lineNumberColor"; //$NON-NLS-1$
-
- /**
- * A named preference that controls whether quick diff colors are shown on the line number bar.
- * <p>
- * Value is of type <code>boolean</code>.
- * @since 3.0
- */
- public static final String QUICK_DIFF_ALWAYS_ON= "quickdiff.quickDiff"; //$NON-NLS-1$
-
- /**
- * A named preference that controls the default quick diff reference provider.
- * <p>
- * Value is of type <code>String</code>.
- * @since 3.0
- */
- public static final String QUICK_DIFF_DEFAULT_PROVIDER= "quickdiff.defaultProvider"; //$NON-NLS-1$
-
- /**
- * A named preference that controls the default quick diff reference provider.
- * <p>
- * Value is of type <code>String</code>.
- * @since 3.0
- */
- public static final String QUICK_DIFF_CHARACTER_MODE= "quickdiff.characterMode"; //$NON-NLS-1$
-
- /**
- * Initializes the given preference store with the default values.
- *
- * @param store the preference store to be initialized
- */
- public static void initializeDefaultValues(IPreferenceStore store) {
-
- store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, true);
- PreferenceConverter.setDefault(store, ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR, new RGB(225, 235, 224));
-
- store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, false);
- store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 80);
- PreferenceConverter.setDefault(store, ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR, new RGB(176, 180 , 185));
-
- store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, false);
- PreferenceConverter.setDefault(store, ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR, new RGB(0, 0, 0));
- store.setDefault(ExtendedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON, true);
- store.setDefault(ExtendedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE, false);
- store.setDefault(ExtendedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER, "org.eclipse.ui.internal.texteditor.quickdiff.LastSaveReferenceProvider"); //$NON-NLS-1$
-
- store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER, true);
-
- store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION, false);
- store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER, false);
- PreferenceConverter.setDefault(store, ExtendedTextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR, new RGB(0, 0, 0));
-
- MarkerAnnotationPreferences.initializeDefaultValues(store);
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/IMarkerUpdater.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/IMarkerUpdater.java
deleted file mode 100644
index 04ce65f8548..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/IMarkerUpdater.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.texteditor;
-
-
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-
-import org.eclipse.core.resources.IMarker;
-
-
-/**
- * A marker updater is responsible for saving changes to markers.
- * Marker updaters either update markers of a specific types or
- * any type. Also they either assume update responsibility for a
- * specific set of marker attributes or any marker attribute.
- * Marker updater must be registered with an <code>AbstractMarkerAnnotationModel</code>.
- */
-public interface IMarkerUpdater {
-
- /**
- * Returns the marker type for which this updater is responsible. If
- * the result is <code>null</code>, the updater assumes responsibility
- * for any marker type.
- *
- * @return the marker type or <code>null</code> for any marker type
- */
- String getMarkerType();
-
- /**
- * Returns the attributes for which this updater is responsible. If the
- * result is <code>null</code>, the updater assumes responsibility for
- * any attributes.
- *
- * @return the attributes or <code>null</code> for any attribute
- */
- String[] getAttribute();
-
- /**
- * Updates the given marker according to the position of the given document.
- * If the given position is <code>null</code>, the marker is assumed to
- * carry the correct positional information.
- *
- * @param marker the marker to be updated
- * @param document the document into which the given position points
- * @param position the current position of the marker inside the given document
- * @return <code>false</code> if the updater recognizes that the marker should be deleted
- */
- boolean updateMarker(IMarker marker, IDocument document, Position position);
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ImageUtilities.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ImageUtilities.java
deleted file mode 100644
index 4ec1cad272e..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ImageUtilities.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.texteditor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-
-/**
- * Provides methods for drawing images onto a canvas.
- * @since 3.0
- */
-public class ImageUtilities {
-
- /**
- * Draws an image aligned inside the given rectangle on the given canvas.
- *
- * @param image the image to be drawn
- * @param GC the drawing GC
- * @param canvas the canvas on which to draw
- * @param r the clipping rectangle
- * @param halign the horizontal alignment of the image to be drawn
- * @param valign the vertical alignment of the image to be drawn
- */
- public static void drawImage(Image image, GC gc, Canvas canvas, Rectangle r, int halign, int valign) {
- if (image != null) {
-
- Rectangle bounds= image.getBounds();
-
- int x= 0;
- switch(halign) {
- case SWT.LEFT:
- break;
- case SWT.CENTER:
- x= (r.width - bounds.width) / 2;
- break;
- case SWT.RIGHT:
- x= r.width - bounds.width;
- break;
- }
-
- int y= 0;
- switch (valign) {
- case SWT.TOP: {
- FontMetrics fontMetrics= gc.getFontMetrics();
- y= (fontMetrics.getHeight() - bounds.height)/2;
- break;
- }
- case SWT.CENTER:
- y= (r.height - bounds.height) / 2;
- break;
- case SWT.BOTTOM: {
- FontMetrics fontMetrics= gc.getFontMetrics();
- y= r.height - (fontMetrics.getHeight() + bounds.height)/2;
- break;
- }
- }
-
- gc.drawImage(image, r.x+x, r.y+y);
- }
- }
-
- /**
- * Draws an image aligned inside the given rectangle on the given canvas.
- *
- * @param image the image to be drawn
- * @param GC the drawing GC
- * @param canvas the canvas on which to draw
- * @param r the clipping rectangle
- * @param align the alignment of the image to be drawn
- */
- public static void drawImage(Image image, GC gc, Canvas canvas, Rectangle r, int align) {
- drawImage(image, gc, canvas, r, align, SWT.CENTER);
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java
deleted file mode 100644
index de556268654..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.source.Annotation;
-
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-
-/**
- * Annotation representing a marker on a resource in the workspace.
- * This class may be instantiated or be subclassed.
- *
- * @see org.eclipse.core.resources.IMarker
- */
-public class MarkerAnnotation extends Annotation {
-
- /**
- * The layer in which markers representing problem are located.
- * @since 2.0
- * XXX to be deprecated as of 3.0 use {@link DefaultAnnotation#ERROR_LAYER}
- */
- public final static int PROBLEM_LAYER= 5;
-
- /** Internal image registry */
- private static Map fgImageRegistry;
-
- /**
- * Returns an image for the given display as specified by the given image descriptor.
- * @param display the display
- * @param descriptor the image descriptor
- * @return an image for the display as specified by the descriptor
- */
- protected static Image getImage(Display display, ImageDescriptor descriptor) {
- Map map= getImageRegistry(display);
- Image image= (Image) map.get(descriptor);
- if (image == null) {
- image= descriptor.createImage();
- map.put(descriptor, image);
- }
- return image;
- }
-
- /**
- * Returns an image registry for the given display. If no such registry exists
- * the resgitry is created.
- * @param display the display
- * @return the image registry for the given display
- */
- protected static Map getImageRegistry(Display display) {
- if (fgImageRegistry == null) {
- fgImageRegistry= new HashMap();
- display.disposeExec(new Runnable() {
- public void run() {
- if (fgImageRegistry != null) {
- Map map= fgImageRegistry;
- fgImageRegistry= null;
- Iterator e= map.values().iterator();
- while (e.hasNext()) {
- Image image= (Image) e.next();
- if (!image.isDisposed())
- image.dispose();
- }
- }
- }
- });
- }
- return fgImageRegistry;
- }
-
-
- /** The marker this annotation represents */
- private IMarker fMarker;
- /** The image, i.e., visual presentation of this annotation */
- private Image fImage;
- /** The image name */
- private String fImageName;
-
- /**
- * Creates a new annotation for the given marker.
- *
- * @param marker the marker
- */
- public MarkerAnnotation(IMarker marker) {
- this(null, marker);
- }
-
- /**
- * Creaets a new annotation of the given type for the given marker.
- *
- * @param annotationType the annotation type
- * @param marker the marker
- * @since 3.0
- */
- public MarkerAnnotation(String annotationType, IMarker marker) {
- super(annotationType, true, null);
- Assert.isNotNull(marker);
- fMarker= marker;
- initialize();
- }
-
- /**
- * Sets the marker image to the given image.
- *
- * @param image the new marker image
- */
- protected void setImage(Image image) {
- fImage= image;
- }
-
- /**
- * The <code>MarkerAnnotation</code> implementation of this
- * <code>Object</code> method returns <code>true</code> iff the other
- * object is also a <code>MarkerAnnotation</code> and the marker handles are
- * equal.
- */
- public boolean equals(Object o) {
- if (o != null && o.getClass() == getClass())
- return fMarker.equals(((MarkerAnnotation) o).fMarker);
- return false;
- }
-
- /*
- * @see Object#hashCode()
- */
- public int hashCode() {
- return fMarker.hashCode();
- }
-
- /**
- * Returns this annotation's underlying marker.
- *
- * @return the marker
- */
- public IMarker getMarker() {
- return fMarker;
- }
-
- /**
- * Initializes the annotation's icon representation and its drawing layer
- * based upon the properties of the underlying marker.
- */
- protected void initialize() {
-
- String name= getUnknownImageName(fMarker);
- int layer= 1;
-
- if (MarkerUtilities.isMarkerType(fMarker, IMarker.TASK)) {
- name= IDE.SharedImages.IMG_OBJS_TASK_TSK;
- layer= DefaultAnnotation.TASK_LAYER;
- } else if (MarkerUtilities.isMarkerType(fMarker, IMarker.BOOKMARK)) {
- name= IDE.SharedImages.IMG_OBJS_BKMRK_TSK;
- layer= DefaultAnnotation.BOOKMARK_LAYER;
- } else if (MarkerUtilities.isMarkerType(fMarker, IMarker.PROBLEM)) {
- switch (MarkerUtilities.getSeverity(fMarker)) {
- case IMarker.SEVERITY_INFO:
- name= ISharedImages.IMG_OBJS_INFO_TSK;
- layer= 3;
- break;
- case IMarker.SEVERITY_WARNING:
- name= ISharedImages.IMG_OBJS_WARN_TSK;
- layer= DefaultAnnotation.WARNING_LAYER;
- break;
- case IMarker.SEVERITY_ERROR:
- name= ISharedImages.IMG_OBJS_ERROR_TSK;
- layer= DefaultAnnotation.ERROR_LAYER;
- break;
- }
- }
-
- fImage= null;
- fImageName= name;
- setLayer(layer);
- }
-
- /*
- * @see Annotation#paint(GC, Canvas, Rectangle)
- */
- public void paint(GC gc, Canvas canvas, Rectangle r) {
- Image image= getImage(canvas.getDisplay());
- if (image != null)
- drawImage(image, gc, canvas, r, SWT.CENTER, SWT.TOP);
- }
-
- /**
- * Informs this annotation about changes applied to its underlying marker
- * and adapts to those changes.
- */
- public void update() {
- initialize();
- }
-
- /**
- * Returns the name of an image used to visually represent markers of
- * unknown type. This implementation returns <code>null</code>.
- * Subclasses may replace this method.
- *
- * @param marker the marker of unkown type
- * @return the name of an image for markers of unknown type.
- */
- protected String getUnknownImageName(IMarker marker) {
- return null;
- }
-
- /**
- * Returns the image of the given name. Subclasses may extend this method.
- * If so, subclasses must assume responsibility for disposing the images
- * they create.
- *
- * @param name the name of the requested image
- * @return the image or <code>null</code> if there is no such image
- */
- protected Image getImage(String name) {
- if (name != null)
- return PlatformUI.getWorkbench().getSharedImages().getImage(name);
- return null;
- }
-
-
- /**
- * Returns an image for this annotation. It first consults the workbench adapter
- * for this annotation's marker. If none is defined, it tries to find an image for
- * the image name of this annotation.
- *
- * @param display the display for which the image is requested
- * @return the image for this annotation
- */
- protected Image getImage(Display display) {
- if (fImage == null) {
-
- if (fMarker.exists()) {
- IWorkbenchAdapter adapter= (IWorkbenchAdapter) fMarker.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- ImageDescriptor descriptor= adapter.getImageDescriptor(fMarker);
- if (descriptor != null)
- fImage= getImage(display, descriptor);
- }
- }
-
- if (fImage == null)
- fImage= getImage(fImageName);
-
- }
- return fImage;
- }
-
- /*
- * @see org.eclipse.jface.text.source.Annotation#getText()
- */
- public String getText() {
- return MarkerUtilities.getMessage(fMarker);
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java
deleted file mode 100644
index 8c2978b198f..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.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.ui.texteditor;
-
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.swt.graphics.RGB;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.StringConverter;
-
-import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-
-
-/**
- * Objects of this class provide access to all extensions declared for the <code>markerAnnotationSpecification</code> extension point.
- * The extensions are represented as instances of <code>AnnotationPreference</code>.
- *
- * @since 2.1
- */
-public class MarkerAnnotationPreferences {
-
- /**
- * Initializes the given preference store with the default marker annotation values.
- *
- * @param store the preference store to be initialized
- * @since 3.0
- */
- public static void initializeDefaultValues(IPreferenceStore store) {
- MarkerAnnotationPreferences preferences= new MarkerAnnotationPreferences();
- Iterator e= preferences.getAnnotationPreferences().iterator();
- while (e.hasNext()) {
- AnnotationPreference info= (AnnotationPreference) e.next();
- store.setDefault(info.getTextPreferenceKey(), info.getTextPreferenceValue());
- store.setDefault(info.getOverviewRulerPreferenceKey(), info.getOverviewRulerPreferenceValue());
- if (info.getVerticalRulerPreferenceKey() != null)
- store.setDefault(info.getVerticalRulerPreferenceKey(), info.getVerticalRulerPreferenceValue());
- PreferenceConverter.setDefault(store, info.getColorPreferenceKey(), info.getColorPreferenceValue());
- if (info.getShowInNextPrevDropdownToolbarActionKey() != null)
- store.setDefault(info.getShowInNextPrevDropdownToolbarActionKey(), info.isShowInNextPrevDropdownToolbarAction());
- if (info.getIsGoToNextNavigationTargetKey() != null)
- store.setDefault(info.getIsGoToNextNavigationTargetKey(), info.isGoToNextNavigationTarget());
- if (info.getIsGoToPreviousNavigationTargetKey() != null)
- store.setDefault(info.getIsGoToPreviousNavigationTargetKey(), info.isGoToPreviousNavigationTarget());
- if (info.getHighlightPreferenceKey() != null)
- store.setDefault(info.getHighlightPreferenceKey(), info.getHighlightPreferenceValue());
- }
- }
-
-
-
- /** The list of extension fragments */
- private List fFragments;
- /** The list of extensions */
- private List fPreferences;
-
- /**
- * Creates a new marker annotation preferences accessor.
- */
- public MarkerAnnotationPreferences() {
- }
-
- /**
- * Returns all extensions provided for the <code>markerAnnotationSpecification</code> extension point.
- *
- * @return all extensions provided for the <code>markerAnnotationSpecification</code> extension point
- */
- public List getAnnotationPreferences() {
- if (fPreferences == null)
- initialize();
- return fPreferences;
- }
-
- /**
- * Returns all extensions provided for the <code>markerAnnotationSpecification</code>
- * extension point including fragments. Fragments share the preference part
- * with a marker annotation specifications provided for a super type but do
- * change the presentation part.
- *
- * @return all extensions provided for the <code>markerAnnotationSpecification</code>
- * extension point including fragments
- */
- public List getAnnotationPreferenceFragments() {
- if (fFragments == null)
- initialize();
- return fFragments;
- }
-
- /**
- * Reads all extensions provided for the <code>markerAnnotationSpecification</code> extension point and
- * translates them into <code>AnnotationPreference</code> objects.
- */
- private void initialize() {
-
- // initialize lists - indicates that the initialization happened
- fFragments= new ArrayList(2);
- fPreferences= new ArrayList(2);
-
- // populate list
- IExtensionPoint extensionPoint= Platform.getPluginRegistry().getExtensionPoint(EditorsPlugin.getPluginId(), "markerAnnotationSpecification"); //$NON-NLS-1$
- if (extensionPoint != null) {
- IConfigurationElement[] elements= extensionPoint.getConfigurationElements();
- for (int i= 0; i < elements.length; i++) {
- AnnotationPreference spec= createSpec(elements[i]);
- if (spec != null)
- fFragments.add(spec);
- if (spec.getColorPreferenceKey() != null)
- fPreferences.add(spec);
- }
- }
-
- final Collator collator= Collator.getInstance();
- Collections.sort(fFragments, new Comparator() {
- /*
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- if (o1 == o2)
- return 0;
-
- AnnotationPreference ap1= (AnnotationPreference)o1;
- AnnotationPreference ap2= (AnnotationPreference)o2;
-
- String label1= ap1.getPreferenceLabel();
- String label2= ap2.getPreferenceLabel();
-
- if (label1 == null && label2 == null)
- return 0;
-
- if (label1 == null)
- return -1;
-
- if (label2 == null)
- return 1;
-
- return collator.compare(label1, label2);
- }
- });
- }
-
- /**
- * Creates a <code>AnnotationPreference</code> the given configuration element.
- *
- * @param element the configuration element
- * @return the created annotation preference
- */
- private AnnotationPreference createSpec(IConfigurationElement element) {
-
- String s;
- int i;
- boolean b;
-
- AnnotationPreference info= new AnnotationPreference();
-
- s= element.getAttribute("annotationType"); //$NON-NLS-1$
- if (s == null || s.trim().length() == 0) return null;
- info.setAnnotationType(s);
-
- s= element.getAttribute("label"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setPreferenceLabel(s);
-
- s= element.getAttribute("markerType"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setMarkerType(s);
-
- s= element.getAttribute("markerSeverity"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0) {
- i= StringConverter.asInt(s, IMarker.SEVERITY_INFO);
- info.setSeverity(i);
- }
-
- s= element.getAttribute("textPreferenceKey"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setTextPreferenceKey(s);
-
- s= element.getAttribute("textPreferenceValue"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0) {
- b= StringConverter.asBoolean(s, false);
- info.setTextPreferenceValue(b);
- }
-
- s= element.getAttribute("highlightPreferenceKey"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setHighlightPreferenceKey(s);
-
- s= element.getAttribute("highlightPreferenceValue"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0) {
- b= StringConverter.asBoolean(s, false);
- info.setHighlightPreferenceValue(b);
- }
-
- s= element.getAttribute("overviewRulerPreferenceKey"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setOverviewRulerPreferenceKey(s);
-
- s= element.getAttribute("overviewRulerPreferenceValue"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0) {
- b= StringConverter.asBoolean(s, false);
- info.setOverviewRulerPreferenceValue(b);
- }
-
- s= element.getAttribute("verticalRulerPreferenceKey"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setVerticalRulerPreferenceKey(s);
-
- s= element.getAttribute("verticalRulerPreferenceValue"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0) {
- b= StringConverter.asBoolean(s, true);
- info.setVerticalRulerPreferenceValue(b);
- }
-
- s= element.getAttribute("colorPreferenceKey"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setColorPreferenceKey(s);
-
- s= element.getAttribute("colorPreferenceValue"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0) {
- RGB rgb= StringConverter.asRGB(s);
- info.setColorPreferenceValue(rgb == null ? new RGB(0,0,0) : rgb);
- }
-
- s= element.getAttribute("presentationLayer"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0) {
- i= StringConverter.asInt(s, 0);
- info.setPresentationLayer(i);
- }
-
- s= element.getAttribute("contributesToHeader"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0) {
- b= StringConverter.asBoolean(s, false);
- info.setContributesToHeader(b);
- }
-
- s= element.getAttribute("showInNextPrevDropdownToolbarActionKey"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setShowInNextPrevDropdownToolbarActionKey(s);
-
- s= element.getAttribute("showInNextPrevDropdownToolbarAction"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0) {
- b= StringConverter.asBoolean(s, false);
- info.setShowInNextPrevDropdownToolbarAction(b);
- }
-
- s= element.getAttribute("isGoToNextNavigationTargetKey"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setIsGoToNextNavigationTargetKey(s);
-
- s= element.getAttribute("isGoToNextNavigationTarget"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0) {
- b= StringConverter.asBoolean(s, false);
- info.setIsGoToNextNavigationTarget(b);
- }
-
- s= element.getAttribute("isGoToPreviousNavigationTargetKey"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setIsGoToPreviousNavigationTargetKey(s);
-
- s= element.getAttribute("isGoToPreviousNavigationTarget"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0) {
- b= StringConverter.asBoolean(s, false);
- info.setIsGoToPreviousNavigationTarget(b);
- }
-
- s= element.getAttribute("symbolicIcon"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setSymbolicImageName(s);
-
- s= element.getAttribute("icon"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setImageDescriptor(getImageDescriptor(s, element));
-
- s= element.getAttribute("annotationImageProvider"); //$NON-NLS-1$
- if (s != null && s.trim().length() > 0)
- info.setAnnotationImageProviderData(element, "annotationImageProvider"); //$NON-NLS-1$
-
- return info;
- }
-
- /**
- * Returns the image descritor for the icon path specified by the given configuration
- * element.
- *
- * @param iconPath the icon path
- * @param element the configuration element
- * @since 3.0
- */
- private ImageDescriptor getImageDescriptor(String iconPath, IConfigurationElement element) {
- IPluginDescriptor descriptor = element.getDeclaringExtension().getDeclaringPluginDescriptor();
- try {
- return ImageDescriptor.createFromURL(new URL(descriptor.getInstallURL(), iconPath));
- } catch (MalformedURLException x) {
- EditorsPlugin.log(x);
- }
- return null;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java
deleted file mode 100644
index 7531632bf7d..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.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> bug 38745
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.widgets.Shell;
-
-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.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.jface.window.Window;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.PlatformUI;
-
-
-
-/**
- * A ruler action which can add and remove markers which have a visual
- * representation in the ruler.
- * <p>
- * This class may be instantiated but is not intended for subclassing.
- * </p>
- */
-public class MarkerRulerAction extends ResourceAction implements IUpdate {
-
- /** The vertical ruler info of the editor */
- private IVerticalRulerInfo fRuler;
- /** The associated editor */
- private ITextEditor fTextEditor;
- /** The of the marker to be created/removed */
- private String fMarkerType;
- /** The cached list of markers covering a particular vertical ruler position */
- private List fMarkers;
- /** The flag indicating whether user interaction is required. */
- private boolean fAskForLabel;
- /** The action's resource bundle */
- private ResourceBundle fBundle;
- /** The prefix used for resource bundle look ups */
- private String fPrefix;
- /** The cached action label when adding a marker */
- private String fAddLabel;
- /** The cached action label when removing a marker */
- private String fRemoveLabel;
-
-
- /**
- * Creates a new action for the given ruler and editor. The action configures
- * its visual representation from the given resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or <code>null</code> if none
- * @param editor the editor
- * @param ruler the ruler
- * @param markerType the type of marker
- * @param askForLabel <code>true</code> if the user should be asked for a label when a new marker is created
- * @see ResourceAction#ResourceAction
- * @since 2.0
- */
- public MarkerRulerAction(ResourceBundle bundle, String prefix, ITextEditor editor, IVerticalRulerInfo ruler, String markerType, boolean askForLabel) {
- super(bundle, prefix);
- fRuler= ruler;
- fTextEditor= editor;
- fMarkerType= markerType;
- fAskForLabel= askForLabel;
-
- fBundle= bundle;
- fPrefix= prefix;
-
- fAddLabel= getString(bundle, prefix + "add.label", prefix + "add.label"); //$NON-NLS-2$ //$NON-NLS-1$
- fRemoveLabel= getString(bundle, prefix + "remove.label", prefix + "remove.label"); //$NON-NLS-2$ //$NON-NLS-1$
- }
-
- /**
- * @deprecated use <code>MarkerRulerAction(ResourceBundle, String, ITextEditor, IVerticalRulerInfo, String, boolean)</code> instead
- */
- public MarkerRulerAction(ResourceBundle bundle, String prefix, IVerticalRuler ruler, ITextEditor editor, String markerType, boolean askForLabel) {
- this(bundle, prefix, editor, ruler, markerType, askForLabel);
- }
-
-
- /**
- * Returns this action's text editor.
- *
- * @return this action's text editor
- */
- protected ITextEditor getTextEditor() {
- return fTextEditor;
- }
-
- /**
- * Returns this action's vertical ruler.
- *
- * @return this action's vertical ruler
- * @deprecated use <code>getVerticalRulerInfo</code> instead
- */
- protected IVerticalRuler getVerticalRuler() {
- if (fRuler instanceof IVerticalRuler)
- return (IVerticalRuler) fRuler;
- return null;
- }
-
- /**
- * Returns this action's vertical ruler info.
- *
- * @return this action's vertical ruler info
- * @since 2.0
- */
- protected IVerticalRulerInfo getVerticalRulerInfo() {
- return fRuler;
- }
-
- /**
- * Returns this action's resource bundle.
- *
- * @return this action's resource bundle
- */
- protected ResourceBundle getResourceBundle() {
- return fBundle;
- }
-
- /**
- * Returns this action's resource key prefix.
- *
- * @return this action's resource key prefix
- */
- protected String getResourceKeyPrefix() {
- return fPrefix;
- }
-
- /*
- * @see IUpdate#update()
- */
- public void update() {
- //bug 38745
- int line= getVerticalRuler().getLineOfLastMouseButtonActivity() + 1;
- IDocument document= getDocument();
- if (document != null) {
- if (line > getDocument().getNumberOfLines()) {
- setEnabled(false);
- setText(fAddLabel);
- } else {
- setEnabled(true);
- fMarkers= getMarkers();
- setText(fMarkers.isEmpty() ? fAddLabel : fRemoveLabel);
- }
- }
- }
-
- /*
- * @see Action#run()
- */
- public void run() {
- if (fMarkers.isEmpty())
- addMarker();
- else
- removeMarkers(fMarkers);
- }
-
- /**
- * Returns the resource for which to create the marker,
- * or <code>null</code> if there is no applicable resource.
- *
- * @return the resource for which to create the marker or <code>null</code>
- */
- protected IResource getResource() {
- IEditorInput input= fTextEditor.getEditorInput();
-
- IResource resource= (IResource) input.getAdapter(IFile.class);
-
- if (resource == null)
- resource= (IResource) input.getAdapter(IResource.class);
-
- return resource;
- }
-
- /**
- * Returns the <code>AbstractMarkerAnnotationModel</code> of the editor's input.
- *
- * @return the marker annotation model
- */
- protected AbstractMarkerAnnotationModel getAnnotationModel() {
- IDocumentProvider provider= fTextEditor.getDocumentProvider();
- IAnnotationModel model= provider.getAnnotationModel(fTextEditor.getEditorInput());
- if (model instanceof AbstractMarkerAnnotationModel)
- return (AbstractMarkerAnnotationModel) model;
- return null;
- }
-
- /**
- * Returns the <code>IDocument</code> of the editor's input.
- *
- * @return the document of the editor's input
- */
- protected IDocument getDocument() {
- IDocumentProvider provider= fTextEditor.getDocumentProvider();
- return provider.getDocument(fTextEditor.getEditorInput());
- }
-
- /**
- * Checks whether a position includes the ruler's line of activity.
- *
- * @param position the position to be checked
- * @param document the document the position refers to
- * @return <code>true</code> if the line is included by the given position
- */
- protected boolean includesRulerLine(Position position, IDocument document) {
-
- if (position != null) {
- try {
- int markerLine= document.getLineOfOffset(position.getOffset());
- int line= fRuler.getLineOfLastMouseButtonActivity();
- if (line == markerLine)
- return true;
- // commented because of "1GEUOZ9: ITPJUI:ALL - Confusing UI for multiline Bookmarks and Tasks"
- // return (markerLine <= line && line <= document.getLineOfOffset(position.getOffset() + position.getLength()));
- } catch (BadLocationException x) {
- }
- }
-
- return false;
- }
-
- /**
- * Handles core exceptions. This implementation logs the exceptions
- * with the workbech plugin and shows an error dialog.
- *
- * @param exception the exception to be handled
- * @param message the message to be logged with the given exception
- */
- protected void handleCoreException(CoreException exception, String message) {
- ILog log= Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog();
-
- if (message != null)
- log.log(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, exception));
- else
- log.log(exception.getStatus());
-
-
- Shell shell= getTextEditor().getSite().getShell();
- String title= getString(fBundle, fPrefix + "error.dialog.title", fPrefix + "error.dialog.title"); //$NON-NLS-2$ //$NON-NLS-1$
- String msg= getString(fBundle, fPrefix + "error.dialog.message", fPrefix + "error.dialog.message"); //$NON-NLS-2$ //$NON-NLS-1$
-
- ErrorDialog.openError(shell, title, msg, exception.getStatus());
- }
-
- /**
- * Returns all markers which include the ruler's line of activity.
- *
- * @return all a list of markers which include the ruler's line of activity
- */
- protected List getMarkers() {
-
- List markers= new ArrayList();
-
- IResource resource= getResource();
- IDocument document= getDocument();
- AbstractMarkerAnnotationModel model= getAnnotationModel();
-
- if (resource != null && model != null && resource.exists()) {
- try {
- IMarker[] allMarkers= resource.findMarkers(fMarkerType, true, IResource.DEPTH_ZERO);
- if (allMarkers != null) {
- for (int i= 0; i < allMarkers.length; i++) {
- if (includesRulerLine(model.getMarkerPosition(allMarkers[i]), document)) {
- markers.add(allMarkers[i]);
- }
- }
- }
- } catch (CoreException x) {
- handleCoreException(x, TextEditorMessages.getString("MarkerRulerAction.getMarker")); //$NON-NLS-1$
- }
- }
-
- return markers;
- }
-
- /**
- * Creates a new marker according to the specification of this action and
- * adds it to the marker resource.
- */
- protected void addMarker() {
- IResource resource= getResource();
- if (resource == null)
- return;
- Map attributes= getInitialAttributes();
- if (fAskForLabel) {
- if (!askForLabel(attributes))
- return;
- }
-
- try {
- MarkerUtilities.createMarker(resource, attributes, fMarkerType);
- } catch (CoreException x) {
- handleCoreException(x, TextEditorMessages.getString("MarkerRulerAction.addMarker")); //$NON-NLS-1$
- }
- }
-
- /**
- * Removes the given markers.
- *
- * @param markers the markers to be deleted
- */
- protected void removeMarkers(final List markers) {
- try {
- getResource().getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i= 0; i < markers.size(); ++i) {
- IMarker marker= (IMarker) markers.get(i);
- marker.delete();
- }
- }
- }, null, IWorkspace.AVOID_UPDATE, null);
- } catch (CoreException x) {
- handleCoreException(x, TextEditorMessages.getString("MarkerRulerAction.removeMarkers")); //$NON-NLS-1$
- }
- }
-
- /**
- * Asks the user for a marker label. Returns <code>true</code> if a label
- * is entered, <code>false</code> if the user cancels the input dialog.
- * Sets the value of the attribute <code>message</code> in the given
- * map of attributes.
- *
- * @param attributes the map of attributes
- * @return <code>true</code> if the map of attributes has successfully been initialized
- */
- protected boolean askForLabel(Map attributes) {
-
- Object o= attributes.get("message"); //$NON-NLS-1$
- String proposal= (o instanceof String) ? (String) o : ""; //$NON-NLS-1$
- if (proposal == null)
- proposal= ""; //$NON-NLS-1$
-
- String title= getString(fBundle, fPrefix + "add.dialog.title", fPrefix + "add.dialog.title"); //$NON-NLS-2$ //$NON-NLS-1$
- String message= getString(fBundle, fPrefix + "add.dialog.message", fPrefix + "add.dialog.message"); //$NON-NLS-2$ //$NON-NLS-1$
- IInputValidator inputValidator = new IInputValidator() {
- public String isValid(String newText) {
- return (newText == null || newText.trim().length() == 0) ? " " : null; //$NON-NLS-1$
- }
- };
- InputDialog dialog= new InputDialog(fTextEditor.getSite().getShell(), title, message, proposal, inputValidator);
-
- String label= null;
- if (dialog.open() != Window.CANCEL)
- label= dialog.getValue();
-
- if (label == null)
- return false;
-
- label= label.trim();
- if (label.length() == 0)
- return false;
-
- MarkerUtilities.setMessage(attributes, label);
- return true;
- }
-
- /**
- * Returns the attributes with which a newly created marker will be
- * initialized.
- *
- * @return the initial marker attributes
- */
- protected Map getInitialAttributes() {
-
- Map attributes= new HashMap(11);
-
- IDocumentProvider provider= fTextEditor.getDocumentProvider();
- IDocument document= provider.getDocument(fTextEditor.getEditorInput());
- int line= fRuler.getLineOfLastMouseButtonActivity();
- int start= -1;
- int end= -1;
-
- try {
-
- IRegion lineInformation= document.getLineInformation(line);
- start= lineInformation.getOffset();
- int length= lineInformation.getLength();
-
- end= start + length;
-
- } catch (BadLocationException x) {
- }
-
- // marker line numbers are 1-based
- MarkerUtilities.setLineNumber(attributes, line + 1);
- MarkerUtilities.setCharStart(attributes, start);
- MarkerUtilities.setCharEnd(attributes, end);
-
- return attributes;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerInfoAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerInfoAction.java
deleted file mode 100644
index 2e80bc1e37d..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerInfoAction.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.texteditor;
-
-
-import java.util.ResourceBundle;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-
-
-/**
- * @deprecated use <code>MarkerRulerAction</code> instead
- * @since 2.0
- */
-public class MarkerRulerInfoAction extends MarkerRulerAction {
-
- /**
- * @deprecated use super class instead
- */
- public MarkerRulerInfoAction(ResourceBundle bundle, String prefix, IVerticalRulerInfo ruler, ITextEditor editor, String markerType, boolean askForLabel) {
- super(bundle, prefix, editor, ruler, markerType, askForLabel);
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUpdater.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUpdater.java
deleted file mode 100644
index af2a4bf8761..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUpdater.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.texteditor;
-
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-
-import org.eclipse.core.resources.IMarker;
-
-/**
- * Updates a marker's positional attributes which are start position, end position,
- * and line number.
- */
-class MarkerUpdater implements IMarkerUpdater {
-
- private final static String[] ATTRIBUTES= {IMarker.CHAR_START, IMarker.CHAR_END, IMarker.LINE_NUMBER};
-
- /*
- * @see IMarkerUpdater#getAttribute()
- */
- public String[] getAttribute() {
- return ATTRIBUTES;
- }
-
- /*
- * @see IMarkerUpdater#getMarkerType()
- */
- public String getMarkerType() {
- return null;
- }
-
- /*
- * @see IMarkerUpdater#updateMarker(IMarker, IDocument, Position)
- */
- public boolean updateMarker(IMarker marker, IDocument document, Position position) {
-
- if (position.isDeleted())
- return false;
-
- if (MarkerUtilities.getCharStart(marker) != -1 && MarkerUtilities.getCharEnd(marker) != -1) {
- MarkerUtilities.setCharStart(marker, position.getOffset());
- MarkerUtilities.setCharEnd(marker, position.getOffset() + position.getLength());
- }
- if (MarkerUtilities.getLineNumber(marker) != -1) {
- try {
- // marker line numbers are 1-based
- MarkerUtilities.setLineNumber(marker, document.getLineOfOffset(position.getOffset()) + 1);
- } catch (BadLocationException x) {
- }
- }
-
- return true;
- }
-
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java
deleted file mode 100644
index 4f0e90e5dbe..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.ui.PlatformUI;
-
-
-
-/**
- * Utility class for accessing marker attributes. The static methods provided
- * on this class provide internal exception handling (unexpected
- * <code>CoreException</code>s are logged to workbench).
- * <p>
- * This class provides static methods only; it is not intended to be
- * instantiated or subclassed by clients.
- * </p>
- */
-public final class MarkerUtilities {
-
- /**
- * Internal marker super type hierarchy cache.
- * TODO this cache is currently unbound, i.e. only limited by the number of marker types
- */
- private static class MarkerTypeHierarchy {
-
- private Map fTypeMap;
- private Map fSuperTypesCache= new HashMap();
-
- public String[] getSuperTypes(String typeName) {
- String[] cachedTypes= (String[]) fSuperTypesCache.get(typeName);
- if (cachedTypes == null) {
- cachedTypes= computeSuperTypes(typeName);
- fSuperTypesCache.put(typeName, cachedTypes);
- }
- return cachedTypes;
- }
-
- private String[] computeSuperTypes(String typeName) {
- ArrayList types= new ArrayList();
- appendAll(types, getDirectSuperTypes(typeName));
- int index= 0;
- while (index < types.size()) {
- String type= (String) types.get(index++);
- appendAll(types, getDirectSuperTypes(type));
- }
-
- String[] superTypes= new String[types.size()];
- types.toArray(superTypes);
- return superTypes;
- }
-
- private String[] getDirectSuperTypes(String typeName) {
- return (String[]) getTypeMap().get(typeName);
- }
-
- private void appendAll(List list, Object[] objects) {
- for (int i= 0; i < objects.length; i++) {
- Object o= objects[i];
- if (!list.contains(o))
- list.add(o);
- }
- }
-
- private Map getTypeMap() {
- if (fTypeMap == null)
- fTypeMap= readTypes();
- return fTypeMap;
- }
-
- private Map readTypes() {
- HashMap allTypes= new HashMap();
- IExtensionPoint point= Platform.getPluginRegistry().getExtensionPoint(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_MARKERS);
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- for (int i= 0; i < extensions.length; i++) {
- IExtension extension= extensions[i];
- ArrayList types= new ArrayList();
- IConfigurationElement[] configElements= extension.getConfigurationElements();
- for (int j= 0; j < configElements.length; ++j) {
- IConfigurationElement element= configElements[j];
- if (element.getName().equalsIgnoreCase("super")) { //$NON-NLS-1$
- String type = element.getAttribute("type"); //$NON-NLS-1$
- if (type != null) {
- types.add(type);
- }
- }
- }
- String[] superTypes= new String[types.size()];
- types.toArray(superTypes);
- allTypes.put(extension.getUniqueIdentifier(), superTypes);
- }
- }
- return allTypes;
- }
- }
-
- private static MarkerTypeHierarchy fgMarkerTypeHierarchy;
-
-
-
- /**
- * Don't allow instantiation.
- */
- private MarkerUtilities() {
- }
-
- /**
- * Returns the ending character offset of the given marker.
- *
- * @param marker the marker
- * @return the ending character offset, or <code>-1</code> if not set
- * @see IMarker#CHAR_END
- * @see IMarker#getAttribute(java.lang.String, int)
- */
- public static int getCharEnd(IMarker marker) {
- return getIntAttribute(marker, IMarker.CHAR_END, -1);
- }
-
- /**
- * Returns the starting character offset of the given marker.
- *
- * @param marker the marker
- * @return the starting character offset, or <code>-1</code> if not set
- * @see IMarker#CHAR_START
- * @see IMarker#getAttribute(java.lang.String,int)
- */
- public static int getCharStart(IMarker marker) {
- return getIntAttribute(marker, IMarker.CHAR_START, -1);
- }
-
- /**
- * Returns the specified attribute of the given marker as an integer.
- * Returns the given default if the attribute value is not an integer.
- */
- private static int getIntAttribute(IMarker marker, String attributeName, int defaultValue) {
- if (marker.exists())
- return marker.getAttribute(attributeName, defaultValue);
- return defaultValue;
- }
-
- /**
- * Returns the line number of the given marker.
- *
- * @param marker the marker
- * @return the line number, or <code>-1</code> if not set
- * @see IMarker#LINE_NUMBER
- * @see IMarker#getAttribute(java.lang.String,int)
- */
- public static int getLineNumber(IMarker marker) {
- return getIntAttribute(marker, IMarker.LINE_NUMBER, -1);
- }
-
- /**
- * Returns the priority of the given marker.
- *
- * @param marker the marker
- * @return the priority, or <code>IMarker.PRIORITY_NORMAL</code> if not set
- * @see IMarker#PRIORITY
- * @see IMarker#PRIORITY_NORMAL
- * @see IMarker#getAttribute(java.lang.String,int)
- */
- public static int getPriority(IMarker marker) {
- return getIntAttribute(marker, IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
- }
-
- /**
- * Returns the severity of the given marker.
- *
- * @param marker the marker
- * @return the priority, or <code>IMarker.SEVERITY_INFO</code> if not set
- * @see IMarker#SEVERITY
- * @see IMarker#SEVERITY_INFO
- * @see IMarker#getAttribute(java.lang.String,int)
- */
- public static int getSeverity(IMarker marker) {
- return getIntAttribute(marker, IMarker.SEVERITY, IMarker.SEVERITY_INFO);
- }
-
- /**
- * Handles a core exception which occurs when accessing marker attributes.
- */
- private static void handleCoreException(CoreException e) {
- Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog().log(e.getStatus());
- }
-
- /**
- * Returns whether the given marker is of the given type (either directly or indirectly).
- *
- * @param marker the marker to be checked
- * @param type the reference type
- * @return <code>true</code>if maker is an instance of the reference type
- */
- public static boolean isMarkerType(IMarker marker, String type) {
- if (marker != null) {
- try {
- return marker.exists() && marker.isSubtypeOf(type);
- } catch (CoreException x) {
- handleCoreException(x);
- }
- }
- return false;
- }
-
- /**
- * Returns the marker type of the given marker or <code>null</code> if
- * the type could not be determined.
- *
- * @param marker the marker
- * @return the marker type
- * @since 3.0
- */
- public static String getMarkerType(IMarker marker) {
- try {
- return marker.getType();
- } catch (CoreException x) {
- handleCoreException(x);
- }
- return null;
- }
-
- /**
- * Returns the message associated with the given marker.
- *
- * @param marker the marker
- * @return the message associated with the marker or <code>null</code>
- * @since 3.0
- */
- public static String getMessage(IMarker marker) {
- return marker.getAttribute(IMarker.MESSAGE, null);
- }
-
- /**
- * Sets the ending character offset of the given marker.
- *
- * @param marker the marker
- * @param charEnd the ending character offset
- * @see IMarker#CHAR_END
- * @see IMarker#setAttribute(java.lang.String,int)
- */
- public static void setCharEnd(IMarker marker, int charEnd) {
- setIntAttribute(marker, IMarker.CHAR_END, charEnd);
- }
-
- /**
- * Sets the ending character offset in the given map using the standard
- * marker attribute name as the key.
- *
- * @param map the map (key type: <code>String</code>, value type:
- * <code>Object</code>)
- * @param charEnd the ending character offset
- * @see IMarker#CHAR_END
- */
- public static void setCharEnd(Map map, int charEnd) {
- map.put(IMarker.CHAR_END, new Integer(charEnd));
- }
-
- /**
- * Sets the starting character offset of the given marker.
- *
- * @param marker the marker
- * @param charStart the starting character offset
- * @see IMarker#CHAR_START
- * @see IMarker#setAttribute(java.lang.String,int)
- */
- public static void setCharStart(IMarker marker, int charStart) {
- setIntAttribute(marker, IMarker.CHAR_START, charStart);
- }
-
- /**
- * Sets the starting character offset in the given map using the standard
- * marker attribute name as the key.
- *
- * @param map the map (key type: <code>String</code>, value type:
- * <code>Object</code>)
- * @param charStart the starting character offset
- * @see IMarker#CHAR_START
- */
- public static void setCharStart(Map map, int charStart) {
- map.put(IMarker.CHAR_START, new Integer(charStart));
- }
-
- /**
- * Sets the specified attribute of the given marker as an integer.
- *
- * @param marker the marker
- * @param attributeName the attribute name
- * @param value the int value
- */
- private static void setIntAttribute(IMarker marker, String attributeName, int value) {
- try {
- if (marker.exists())
- marker.setAttribute(attributeName, value);
- } catch (CoreException e) {
- handleCoreException(e);
- }
- }
-
- /**
- * Sets the line number of the given marker.
- *
- * @param marker the marker
- * @param lineNum the line number
- * @see IMarker#LINE_NUMBER
- * @see IMarker#setAttribute(java.lang.String,int)
- */
- public static void setLineNumber(IMarker marker, int lineNum) {
- setIntAttribute(marker, IMarker.LINE_NUMBER, lineNum);
- }
-
- /**
- * Sets the line number in the given map using the standard marker attribute
- * name as the key.
- *
- * @param map the map (key type: <code>String</code>, value type:
- * <code>Object</code>)
- * @param lineNum the line number
- * @see IMarker#LINE_NUMBER
- */
- public static void setLineNumber(Map map, int lineNum) {
- map.put(IMarker.LINE_NUMBER, new Integer(lineNum));
- }
-
- /**
- * Sets the message in the given map using the standard marker attribute name
- * as the key.
- *
- * @param map the map (key type: <code>String</code>, value type:
- * <code>Object</code>)
- * @param message the message
- * @see IMarker#MESSAGE
- */
- public static void setMessage(Map map, String message) {
- map.put(IMarker.MESSAGE, message);
- }
-
- /**
- * Creates a marker on the given resource with the given type and attributes.
- * <p>
- * This method modifies the workspace (progress is not reported to the user).</p>
- *
- * @param resource the resource
- * @param attributes the attribute map (key type: <code>String</code>,
- * value type: <code>Object</code>)
- * @param markerType the type of marker
- * @exception CoreException if this method fails
- * @see IResource#createMarker
- */
- public static void createMarker(final IResource resource, final Map attributes, final String markerType) throws CoreException {
-
- IWorkspaceRunnable r= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IMarker marker= resource.createMarker(markerType);
- marker.setAttributes(attributes);
- }
- };
-
- resource.getWorkspace().run(r, null,IWorkspace.AVOID_UPDATE, null);
- }
-
- /**
- * Returns the list of super types for the given marker.
- * The list is a depth first list and maintains the sequence in which
- * the super types are listed in the marker specification.
- *
- * @return a depth-first list of all super types of the given marker type
- */
- public static String[] getSuperTypes(String markerType) {
- if (fgMarkerTypeHierarchy == null)
- fgMarkerTypeHierarchy= new MarkerTypeHierarchy();
- return fgMarkerTypeHierarchy.getSuperTypes(markerType);
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java
deleted file mode 100644
index 20797422c98..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.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.texteditor;
-
-
-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.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.jface.text.Assert;
-
-
-
-/**
- * A marker annotation model whose underlying source of markers is
- * a resource in the workspace.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.</p>
- */
-public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel {
-
-
- /**
- * Internal resource change listener.
- *
- * @see IResourceChangeListener
- */
- class ResourceChangeListener implements IResourceChangeListener {
- /*
- * @see IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent e) {
- IResourceDelta delta= e.getDelta();
- if (delta != null && fResource != null) {
- IResourceDelta child= delta.findMember(fResource.getFullPath());
- if (child != null)
- update(child.getMarkerDeltas());
- }
- }
- }
-
- /** The workspace. */
- private IWorkspace fWorkspace;
- /** The resource. */
- private IResource fResource;
- /** The resource change listener. */
- private IResourceChangeListener fResourceChangeListener= new ResourceChangeListener();
-
-
- /**
- * Creates a marker annotation model with the given resource as the source
- * of the markers.
- *
- * @param resource the resource
- */
- public ResourceMarkerAnnotationModel(IResource resource) {
- Assert.isNotNull(resource);
- fResource= resource;
- fWorkspace= resource.getWorkspace();
- }
-
- /*
- * @see AbstractMarkerAnnotationModel#isAcceptable(IMarker)
- */
- protected boolean isAcceptable(IMarker marker) {
- return marker != null && fResource.equals(marker.getResource());
- }
-
- /**
- * Updates this model to the given marker deltas.
- *
- * @param markerDeltas the array of marker deltas
- */
- protected void update(IMarkerDelta[] markerDeltas) {
-
- if (markerDeltas.length == 0)
- return;
-
- for (int i= 0; i < markerDeltas.length; i++) {
- IMarkerDelta delta= markerDeltas[i];
- switch (delta.getKind()) {
- case IResourceDelta.ADDED :
- addMarkerAnnotation(delta.getMarker());
- break;
- case IResourceDelta.REMOVED :
- removeMarkerAnnotation(delta.getMarker());
- break;
- case IResourceDelta.CHANGED :
- modifyMarkerAnnotation(delta.getMarker());
- break;
- }
- }
-
- fireModelChanged();
- }
-
- /*
- * @see AbstractMarkerAnnotationModel#listenToMarkerChanges(boolean)
- */
- protected void listenToMarkerChanges(boolean listen) {
- if (listen)
- fWorkspace.addResourceChangeListener(fResourceChangeListener);
- else
- fWorkspace.removeResourceChangeListener(fResourceChangeListener);
- }
-
- /*
- * @see AbstractMarkerAnnotationModel#deleteMarkers(IMarker[])
- */
- protected void deleteMarkers(final IMarker[] markers) throws CoreException {
- fWorkspace.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i= 0; i < markers.length; ++i) {
- markers[i].delete();
- }
- }
- }, null, IWorkspace.AVOID_UPDATE, null);
- }
-
- /*
- * @see AbstractMarkerAnnotationModel#retrieveMarkers()
- */
- protected IMarker[] retrieveMarkers() throws CoreException {
- return fResource.findMarkers(IMarker.MARKER, true, IResource.DEPTH_ZERO);
- }
-
- /**
- * Returns the resource serving as the source of markers for this annotation model.
- *
- * @return the resource serving as the source of markers for this annotation model
- * @since 2.0
- */
- protected IResource getResource() {
- return fResource;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerAction.java
deleted file mode 100644
index 3cabadd5fea..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerAction.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-
-package org.eclipse.ui.texteditor;
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationAccess;
-import org.eclipse.jface.text.source.IAnnotationAccessExtension;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.tasklist.TaskList;
-
-
-/**
- * A ruler action which can select the textual range of a marker
- * that has a visual representation in a vertical ruler.
- * <p>
- * This class may be instantiated but is not intended for subclassing.
- * </p>
- * @since 2.0
- */
-public class SelectMarkerRulerAction extends ResourceAction implements IUpdate {
-
- /** The vertical ruler info of the action's editor */
- private IVerticalRulerInfo fRuler;
- /** The associated editor */
- private ITextEditor fTextEditor;
- /** The cached list of markers including a given vertical ruler location */
- private List fMarkers;
- /** The action's resource bundle */
- private ResourceBundle fBundle;
- /** The prefix for resource bundle lookups */
- private String fPrefix;
-
- /**
- * Creates a new action for the given ruler and editor. The action configures
- * its visual representation from the given resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or <code>null</code> if none
- * @param editor the editor
- * @param ruler the ruler
- *
- * @see ResourceAction#ResourceAction
- */
- public SelectMarkerRulerAction(ResourceBundle bundle, String prefix, ITextEditor editor, IVerticalRulerInfo ruler) {
- super(bundle, prefix);
- fRuler= ruler;
- fTextEditor= editor;
-
- fBundle= bundle;
- fPrefix= prefix;
- }
-
- /**
- * @deprecated use <code>SelectMarkerRulerInfoAction(ResourceBundle, String, IVerticalRulerInfo, ITextEditor)</code>
- */
- public SelectMarkerRulerAction(ResourceBundle bundle, String prefix, IVerticalRuler ruler, ITextEditor editor) {
- this(bundle, prefix, editor, ruler);
- }
-
- /*
- * @see IUpdate#update()
- */
- public void update() {
- fMarkers= getMarkers();
- setEnabled(!fMarkers.isEmpty());
- }
-
- /*
- * @see Action#run()
- */
- public void run() {
-
- IMarker marker= chooseMarker(fMarkers);
- if (MarkerUtilities.isMarkerType(marker, IMarker.TASK) || MarkerUtilities.isMarkerType(marker, IMarker.PROBLEM)) {
- IWorkbenchPage page= fTextEditor.getSite().getPage();
- IViewPart view= view= page.findView("org.eclipse.ui.views.TaskList"); //$NON-NLS-1$
- if (view instanceof TaskList) {
- StructuredSelection ss= new StructuredSelection(marker);
- ((TaskList) view).setSelection(ss, true);
- } else {
- int offset= MarkerUtilities.getCharStart(marker);
- int endOffset= MarkerUtilities.getCharEnd(marker);
- if (offset > -1 && endOffset > -1)
- fTextEditor.selectAndReveal(offset, endOffset - offset);
- }
- }
- }
-
- /**
- * Chooses the marker with the highest layer. If there are multiple
- * markers at the found layer, the first marker is taken.
- *
- * @param markers the list of markers to choose from
- * @return the chosen marker
- */
- protected IMarker chooseMarker(List markers) {
-
- AbstractMarkerAnnotationModel model= getAnnotationModel();
- IAnnotationAccessExtension access= null;
- Object adapter= fTextEditor.getAdapter(IAnnotationAccess.class);
- if (adapter instanceof IAnnotationAccessExtension)
- access= (IAnnotationAccessExtension) adapter;
-
- IMarker marker= null;
- int maxLayer= 0;
-
- Iterator iter= markers.iterator();
- while (iter.hasNext()) {
- IMarker m= (IMarker) iter.next();
- Annotation a= model.getMarkerAnnotation(m);
- if (a != null) {
- if (access == null) {
- marker= m;
- break;
- }
- int l= access.getLayer(a);
- if (l == maxLayer) {
- if (marker == null)
- marker= m;
- } else if (l > maxLayer) {
- maxLayer= l;
- marker= m;
- }
- }
- }
-
- return marker;
- }
-
- /**
- * Returns the resource for which to create the marker,
- * or <code>null</code> if there is no applicable resource.
- *
- * @return the resource for which to create the marker or <code>null</code>
- */
- protected IResource getResource() {
- IEditorInput input= fTextEditor.getEditorInput();
-
- IResource resource= (IResource) input.getAdapter(IFile.class);
-
- if (resource == null)
- resource= (IResource) input.getAdapter(IResource.class);
-
- return resource;
- }
-
- /**
- * Returns the <code>AbstractMarkerAnnotationModel</code> of the editor's input.
- *
- * @return the marker annotation model or <code>null</code> if there's none
- */
- protected AbstractMarkerAnnotationModel getAnnotationModel() {
- IDocumentProvider provider= fTextEditor.getDocumentProvider();
- IAnnotationModel model= provider.getAnnotationModel(fTextEditor.getEditorInput());
- if (model instanceof AbstractMarkerAnnotationModel)
- return (AbstractMarkerAnnotationModel) model;
- return null;
- }
-
- /**
- * Returns the <code>IDocument</code> of the editor's input.
- *
- * @return the document of the editor's input
- */
- protected IDocument getDocument() {
- IDocumentProvider provider= fTextEditor.getDocumentProvider();
- return provider.getDocument(fTextEditor.getEditorInput());
- }
-
- /**
- * Checks whether a position includes the ruler's line of activity.
- *
- * @param position the position to be checked
- * @param document the document the position refers to
- * @return <code>true</code> if the line is included by the given position
- */
- protected boolean includesRulerLine(Position position, IDocument document) {
-
- if (position != null) {
- try {
- int markerLine= document.getLineOfOffset(position.getOffset());
- int line= fRuler.getLineOfLastMouseButtonActivity();
- if (line == markerLine)
- return true;
- // commented because of "1GEUOZ9: ITPJUI:ALL - Confusing UI for multiline Bookmarks and Tasks"
- // return (markerLine <= line && line <= document.getLineOfOffset(position.getOffset() + position.getLength()));
- } catch (BadLocationException x) {
- }
- }
-
- return false;
- }
-
- /**
- * Handles core exceptions. This implementation logs the exceptions
- * with the workbech plug-in and shows an error dialog.
- *
- * @param exception the exception to be handled
- * @param message the message to be logged with the given exception
- */
- protected void handleCoreException(CoreException exception, String message) {
- ILog log= Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog();
-
- if (message != null)
- log.log(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, exception));
- else
- log.log(exception.getStatus());
-
-
- Shell shell= fTextEditor.getSite().getShell();
- String title= getString(fBundle, fPrefix + "error.dialog.title", fPrefix + "error.dialog.title"); //$NON-NLS-2$ //$NON-NLS-1$
- String msg= getString(fBundle, fPrefix + "error.dialog.message", fPrefix + "error.dialog.message"); //$NON-NLS-2$ //$NON-NLS-1$
-
- ErrorDialog.openError(shell, title, msg, exception.getStatus());
- }
-
- /**
- * Returns all markers which include the ruler's line of activity.
- *
- * @return a list with all markers which include the ruler's line of activity
- */
- protected List getMarkers() {
-
- List markers= new ArrayList();
-
- IResource resource= getResource();
- IDocument document= getDocument();
- AbstractMarkerAnnotationModel model= getAnnotationModel();
-
- if (resource != null && model != null && resource.exists()) {
- try {
- IMarker[] allMarkers= resource.findMarkers(null, true, IResource.DEPTH_ZERO);
- if (allMarkers != null) {
- for (int i= 0; i < allMarkers.length; i++) {
- if (includesRulerLine(model.getMarkerPosition(allMarkers[i]), document)) {
- markers.add(allMarkers[i]);
- }
- }
- }
- } catch (CoreException x) {
- handleCoreException(x, TextEditorMessages.getString("SelectMarkerRulerAction.getMarker")); //$NON-NLS-1$
- }
- }
-
- return markers;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerInfoAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerInfoAction.java
deleted file mode 100644
index c2ac69f0434..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerInfoAction.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.texteditor;
-
-
-import java.util.ResourceBundle;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-
-
-/**
- * @deprecated use <code>SelectMarkerRulerAction</code> instead
- * @since 2.0
- */
-public class SelectMarkerRulerInfoAction extends SelectMarkerRulerAction {
-
- /**
- * @deprecated use super class instead
- */
- public SelectMarkerRulerInfoAction(ResourceBundle bundle, String prefix, IVerticalRulerInfo ruler, ITextEditor editor) {
- super(bundle, prefix, editor, ruler);
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectRulerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectRulerAction.java
deleted file mode 100644
index fe516949a9d..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectRulerAction.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.texteditor;
-
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-
-/**
- * Adapter for the select marker action.
- * @since 2.0
- */
-public class SelectRulerAction extends AbstractRulerActionDelegate {
-
- /*
- * @see AbstractRulerActionDelegate#createAction(ITextEditor, IVerticalRulerInfo)
- */
- protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
- return new SelectMarkerRulerAction(TextEditorMessages.getResourceBundle(), "Editor.SelectMarker.", editor, rulerInfo); //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TaskRulerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TaskRulerAction.java
deleted file mode 100644
index 8507ffccc1a..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TaskRulerAction.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.texteditor;
-
-
-import java.util.ResourceBundle;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-
-import org.eclipse.ui.views.tasklist.TaskPropertiesDialog;
-
-
-
-/**
- * Adapter for the marker ruler action creating/removing tasks.
- * @since 2.0
- */
-public class TaskRulerAction extends AbstractRulerActionDelegate {
-
- /**
- * Adds a task marker over the ruler context menu. Uses the Workbench's Task properties dialog.
- */
- static class TaskMarkerRulerAction extends MarkerRulerAction {
-
- /**
- * Creates a new action for the given ruler and editor. The action configures
- * its visual representation from the given resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param editor the text editor
- * @param ruler the vertical ruler info
- * @see ResourceAction#ResourceAction
- */
- public TaskMarkerRulerAction(ResourceBundle bundle, String prefix, ITextEditor editor, IVerticalRulerInfo ruler) {
- super(bundle, prefix, editor, ruler, IMarker.TASK, false);
- }
-
- /*
- * @see MarkerRulerAction#addMarker()
- */
- protected void addMarker() {
- IResource resource= getResource();
- if (resource == null)
- return;
-
- TaskPropertiesDialog dialog = new TaskPropertiesDialog(getTextEditor().getSite().getShell());
- dialog.setResource(resource);
- dialog.setInitialAttributes(getInitialAttributes());
- dialog.open();
- }
- }
-
- /*
- * @see AbstractRulerActionDelegate#createAction(ITextEditor, IVerticalRulerInfo)
- */
- protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
- return new TaskMarkerRulerAction(TextEditorMessages.getResourceBundle(), "Editor.ManageTasks.", editor, rulerInfo); //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.java
deleted file mode 100644
index 673b6e9f53f..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.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.texteditor;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-class TextEditorMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.texteditor.TextEditorMessages"; //$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private TextEditorMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.properties b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.properties
deleted file mode 100644
index 9150ab0890c..00000000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.properties
+++ /dev/null
@@ -1,71 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-Editor.AddTask.label=&Task...
-Editor.AddTask.tooltip=Add Task
-Editor.AddTask.image=
-Editor.AddTask.description=Add Task
-Editor.AddTask.dialog.title=Add Task
-Editor.AddTask.dialog.message=Enter Task description
-Editor.AddTask.error.dialog.title=Add Task
-Editor.AddTask.error.dialog.message=Problems adding new task
-
-Editor.ManageTasks.tooltip=Adds and Removes Tasks
-Editor.ManageTasks.image=
-Editor.ManageTasks.description=Adds and removes Tasks
-Editor.ManageTasks.add.label=Add &Task...
-Editor.ManageTasks.remove.label=Remove &Task
-Editor.ManageTasks.add.dialog.title=Add Task
-Editor.ManageTasks.add.dialog.message=Enter Task description
-Editor.ManageTasks.error.dialog.title=Managing Tasks
-Editor.ManageTasks.error.dialog.message=Problems managing tasks
-
-Editor.AddBookmark.label=Boo&kmark...
-Editor.AddBookmark.tooltip=Add Bookmark
-Editor.AddBookmark.image=
-Editor.AddBookmark.description=Add Bookmark
-Editor.AddBookmark.dialog.title=Add Bookmark
-Editor.AddBookmark.dialog.message=Enter Bookmark name:
-Editor.AddBookmark.error.dialog.title=Add Bookmark
-Editor.AddBookmark.error.dialog.message=Problems adding new bookmark
-
-Editor.ManageBookmarks.tooltip=Adds and Removes Bookmarks
-Editor.ManageBookmarks.image=
-Editor.ManageBookmarks.description=Adds and removes Bookmarks
-Editor.ManageBookmarks.add.label=Add Boo&kmark...
-Editor.ManageBookmarks.remove.label=Remove Boo&kmark
-Editor.ManageBookmarks.add.dialog.title=Add Bookmark
-Editor.ManageBookmarks.add.dialog.message=Enter Bookmark name:
-Editor.ManageBookmarks.error.dialog.title=Managing Bookmarks
-Editor.ManageBookmarks.error.dialog.message=Problems managing bookmarks
-
-Editor.SelectMarker.tooltip=Selects the marker's range
-Editor.SelectMarker.image=
-Editor.SelectMarker.description=Selects the Marker's Range
-Editor.SelectMarker.label=Select &Marker Range
-Editor.SelectMarker.error.dialog.title=Selecting Marker Range
-Editor.SelectMarker.error.dialog.message=Problems selecting marker range
-
-MarkerRulerAction.addMarker=MarkerRulerAction.addMarker
-MarkerRulerAction.getMarker=MarkerRulerAction.getMarker
-MarkerRulerAction.removeMarkers=MarkerRulerAction.removeMarkers
-
-SelectMarkerRulerAction.getMarker=SelectMarkerRulerAction.getMarker
-SelectMarkerRulerInfoAction.getMarker=SelectMarkerRulerInfoAction.getMarker
-
-## Others ##
-
-AbstractMarkerAnnotationModel.connected=AbstractMarkerAnnotationModel.connected
-AbstractMarkerAnnotationModel.createMarkerUpdater=AbstractMarkerAnnotationModel.createMarkerUpdater
-AbstractMarkerAnnotationModel.removeAnnotations=AbstractMarkerAnnotationModel.removeAnnotations
-ResourceMarkerAnnotationModel.resourceChanged=ResourceMarkerAnnotationModel.resourceChanged
-
-DocumentProviderRegistry.error.extension_point_not_found=Extension point: {0}.documentProviders not found
diff --git a/org.eclipse.ui.examples.javaeditor/.classpath b/org.eclipse.ui.examples.javaeditor/.classpath
deleted file mode 100644
index b79215b1b1f..00000000000
--- a/org.eclipse.ui.examples.javaeditor/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="Eclipse Java Editor Example"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.ui.examples.javaeditor/.cvsignore b/org.eclipse.ui.examples.javaeditor/.cvsignore
deleted file mode 100644
index c5e82d74585..00000000000
--- a/org.eclipse.ui.examples.javaeditor/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/org.eclipse.ui.examples.javaeditor/.project b/org.eclipse.ui.examples.javaeditor/.project
deleted file mode 100644
index 55e75aeba1f..00000000000
--- a/org.eclipse.ui.examples.javaeditor/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.examples.javaeditor</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.filebuffers</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.jface.text</project>
- <project>org.eclipse.ui</project>
- <project>org.eclipse.ui.editors</project>
- <project>org.eclipse.ui.views</project>
- <project>org.eclipse.ui.workbench.texteditor</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java
deleted file mode 100644
index 6c9f57781eb..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.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.javaeditor;
-
-
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.editors.text.TextEditorActionContributor;
-import org.eclipse.ui.texteditor.*;
-
-/**
- * Contributes interesting Java actions to the desktop's Edit menu and the toolbar.
- */
-public class JavaActionContributor extends TextEditorActionContributor {
-
- protected RetargetTextEditorAction fContentAssistProposal;
- protected RetargetTextEditorAction fContentAssistTip;
- protected TextEditorAction fTogglePresentation;
-
- /**
- * Default constructor.
- */
- public JavaActionContributor() {
- super();
- fContentAssistProposal= new RetargetTextEditorAction(JavaEditorMessages.getResourceBundle(), "ContentAssistProposal."); //$NON-NLS-1$
- fContentAssistProposal.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- fContentAssistTip= new RetargetTextEditorAction(JavaEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$
- fContentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
- fTogglePresentation= new PresentationAction();
- }
-
- /*
- * @see IEditorActionBarContributor#init(IActionBars)
- */
- public void init(IActionBars bars) {
- super.init(bars);
-
- IMenuManager menuManager= bars.getMenuManager();
- IMenuManager editMenu= menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
- if (editMenu != null) {
- editMenu.add(new Separator());
- editMenu.add(fContentAssistProposal);
- editMenu.add(fContentAssistTip);
- }
-
- IToolBarManager toolBarManager= bars.getToolBarManager();
- if (toolBarManager != null) {
- toolBarManager.add(new Separator());
- toolBarManager.add(fTogglePresentation);
- }
- }
-
- private void doSetActiveEditor(IEditorPart part) {
- super.setActiveEditor(part);
-
- ITextEditor editor= null;
- if (part instanceof ITextEditor)
- editor= (ITextEditor) part;
-
- fContentAssistProposal.setAction(getAction(editor, "ContentAssistProposal")); //$NON-NLS-1$
- fContentAssistTip.setAction(getAction(editor, "ContentAssistTip")); //$NON-NLS-1$
-
- fTogglePresentation.setEditor(editor);
- fTogglePresentation.update();
- }
-
- /*
- * @see IEditorActionBarContributor#setActiveEditor(IEditorPart)
- */
- public void setActiveEditor(IEditorPart part) {
- super.setActiveEditor(part);
- doSetActiveEditor(part);
- }
-
- /*
- * @see IEditorActionBarContributor#dispose()
- */
- public void dispose() {
- doSetActiveEditor(null);
- super.dispose();
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaAnnotationHover.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaAnnotationHover.java
deleted file mode 100644
index 3ef3d177bfa..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaAnnotationHover.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.examples.javaeditor;
-
-
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.source.IAnnotationHover;
-import org.eclipse.jface.text.source.ISourceViewer;
-
-/**
- * The JavaAnnotationHover provides the hover support for java editors.
- */
-
-public class JavaAnnotationHover implements IAnnotationHover {
-
- /* (non-Javadoc)
- * Method declared on IAnnotationHover
- */
- public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
- IDocument document= sourceViewer.getDocument();
-
- try {
- IRegion info= document.getLineInformation(lineNumber);
- return document.get(info.getOffset(), info.getLength());
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaContentOutlinePage.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaContentOutlinePage.java
deleted file mode 100644
index 748d1b05b42..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaContentOutlinePage.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.javaeditor;
-
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-
-/**
- * A content outline page which always represents the content of the
- * connected editor in 10 segments.
- */
-public class JavaContentOutlinePage extends ContentOutlinePage {
-
- /**
- * A segment element.
- */
- protected static class Segment {
- public String name;
- public Position position;
-
- public Segment(String name, Position position) {
- this.name= name;
- this.position= position;
- }
-
- public String toString() {
- return name;
- }
- }
-
- /**
- * Divides the editor's document into ten segments and provides elements for them.
- */
- protected class ContentProvider implements ITreeContentProvider {
-
- protected final static String SEGMENTS= "__java_segments"; //$NON-NLS-1$
- protected IPositionUpdater fPositionUpdater= new DefaultPositionUpdater(SEGMENTS);
- protected List fContent= new ArrayList(10);
-
- protected void parse(IDocument document) {
-
- int lines= document.getNumberOfLines();
- int increment= Math.max(Math.round(lines / 10), 10);
-
- for (int line= 0; line < lines; line += increment) {
-
- int length= increment;
- if (line + increment > lines)
- length= lines - line;
-
- try {
-
- int offset= document.getLineOffset(line);
- int end= document.getLineOffset(line + length);
- length= end - offset;
- Position p= new Position(offset, length);
- document.addPosition(SEGMENTS, p);
- fContent.add(new Segment(MessageFormat.format(JavaEditorMessages.getString("OutlinePage.segment.title_pattern"), new Object[] { new Integer(offset) }), p)); //$NON-NLS-1$
-
- } catch (BadPositionCategoryException x) {
- } catch (BadLocationException x) {
- }
- }
- }
-
- /*
- * @see IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (oldInput != null) {
- IDocument document= fDocumentProvider.getDocument(oldInput);
- if (document != null) {
- try {
- document.removePositionCategory(SEGMENTS);
- } catch (BadPositionCategoryException x) {
- }
- document.removePositionUpdater(fPositionUpdater);
- }
- }
-
- fContent.clear();
-
- if (newInput != null) {
- IDocument document= fDocumentProvider.getDocument(newInput);
- if (document != null) {
- document.addPositionCategory(SEGMENTS);
- document.addPositionUpdater(fPositionUpdater);
-
- parse(document);
- }
- }
- }
-
- /*
- * @see IContentProvider#dispose
- */
- public void dispose() {
- if (fContent != null) {
- fContent.clear();
- fContent= null;
- }
- }
-
- /*
- * @see IContentProvider#isDeleted(Object)
- */
- public boolean isDeleted(Object element) {
- return false;
- }
-
- /*
- * @see IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object element) {
- return fContent.toArray();
- }
-
- /*
- * @see ITreeContentProvider#hasChildren(Object)
- */
- public boolean hasChildren(Object element) {
- return element == fInput;
- }
-
- /*
- * @see ITreeContentProvider#getParent(Object)
- */
- public Object getParent(Object element) {
- if (element instanceof Segment)
- return fInput;
- return null;
- }
-
- /*
- * @see ITreeContentProvider#getChildren(Object)
- */
- public Object[] getChildren(Object element) {
- if (element == fInput)
- return fContent.toArray();
- return new Object[0];
- }
- }
-
- protected Object fInput;
- protected IDocumentProvider fDocumentProvider;
- protected ITextEditor fTextEditor;
-
- /**
- * Creates a content outline page using the given provider and the given editor.
- */
- public JavaContentOutlinePage(IDocumentProvider provider, ITextEditor editor) {
- super();
- fDocumentProvider= provider;
- fTextEditor= editor;
- }
-
- /* (non-Javadoc)
- * Method declared on ContentOutlinePage
- */
- public void createControl(Composite parent) {
-
- super.createControl(parent);
-
- TreeViewer viewer= getTreeViewer();
- viewer.setContentProvider(new ContentProvider());
- viewer.setLabelProvider(new LabelProvider());
- viewer.addSelectionChangedListener(this);
-
- if (fInput != null)
- viewer.setInput(fInput);
- }
-
- /* (non-Javadoc)
- * Method declared on ContentOutlinePage
- */
- public void selectionChanged(SelectionChangedEvent event) {
-
- super.selectionChanged(event);
-
- ISelection selection= event.getSelection();
- if (selection.isEmpty())
- fTextEditor.resetHighlightRange();
- else {
- Segment segment= (Segment) ((IStructuredSelection) selection).getFirstElement();
- int start= segment.position.getOffset();
- int length= segment.position.getLength();
- try {
- fTextEditor.setHighlightRange(start, length, true);
- } catch (IllegalArgumentException x) {
- fTextEditor.resetHighlightRange();
- }
- }
- }
-
- /**
- * Sets the input of the outline page
- */
- public void setInput(Object input) {
- fInput= input;
- update();
- }
-
- /**
- * Updates the outline page.
- */
- public void update() {
- TreeViewer viewer= getTreeViewer();
-
- if (viewer != null) {
- Control control= viewer.getControl();
- if (control != null && !control.isDisposed()) {
- control.setRedraw(false);
- viewer.setInput(fInput);
- viewer.expandAll();
- control.setRedraw(true);
- }
- }
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentSetupParticipant.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentSetupParticipant.java
deleted file mode 100644
index 45d4bf08a53..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentSetupParticipant.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.ui.examples.javaeditor;
-
-import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentExtension3;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.rules.DefaultPartitioner;
-
-/**
- *
- */
-public class JavaDocumentSetupParticipant implements IDocumentSetupParticipant {
-
- /**
- */
- public JavaDocumentSetupParticipant() {
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument)
- */
- public void setup(IDocument document) {
- if (document instanceof IDocumentExtension3) {
- IDocumentExtension3 extension3= (IDocumentExtension3) document;
- IDocumentPartitioner partitioner= new DefaultPartitioner(JavaEditorExamplePlugin.getDefault().getJavaPartitionScanner(), JavaPartitionScanner.JAVA_PARTITION_TYPES);
- extension3.setDocumentPartitioner(JavaEditorExamplePlugin.JAVA_PARTITIONING, partitioner);
- partitioner.connect(document);
- }
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java
deleted file mode 100644
index bc4b055f4b0..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.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.ui.examples.javaeditor;
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.MenuManager;
-
-import org.eclipse.jface.text.source.ISourceViewer;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import org.eclipse.ui.texteditor.TextOperationAction;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-
-/**
- * Java specific text editor.
- */
-public class JavaEditor extends TextEditor {
-
- /** The outline page */
- private JavaContentOutlinePage fOutlinePage;
-
- /**
- * Default constructor.
- */
- public JavaEditor() {
- super();
- }
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method extend the
- * actions to add those specific to the receiver
- */
- protected void createActions() {
- super.createActions();
-
- IAction a= new TextOperationAction(JavaEditorMessages.getResourceBundle(), "ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS); //$NON-NLS-1$
- a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- setAction("ContentAssistProposal", a); //$NON-NLS-1$
-
- a= new TextOperationAction(JavaEditorMessages.getResourceBundle(), "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$
- a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
- setAction("ContentAssistTip", a); //$NON-NLS-1$
- }
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method performs any extra
- * disposal actions required by the java editor.
- */
- public void dispose() {
- if (fOutlinePage != null)
- fOutlinePage.setInput(null);
- super.dispose();
- }
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method performs any extra
- * revert behavior required by the java editor.
- */
- public void doRevertToSaved() {
- super.doRevertToSaved();
- if (fOutlinePage != null)
- fOutlinePage.update();
- }
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method performs any extra
- * save behavior required by the java editor.
- */
- public void doSave(IProgressMonitor monitor) {
- super.doSave(monitor);
- if (fOutlinePage != null)
- fOutlinePage.update();
- }
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method performs any extra
- * save as behavior required by the java editor.
- */
- public void doSaveAs() {
- super.doSaveAs();
- if (fOutlinePage != null)
- fOutlinePage.update();
- }
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method performs sets the
- * input of the outline page after AbstractTextEditor has set input.
- */
- public void doSetInput(IEditorInput input) throws CoreException {
- super.doSetInput(input);
- if (fOutlinePage != null)
- fOutlinePage.setInput(input);
- }
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method adds any
- * JavaEditor specific entries.
- */
- public void editorContextMenuAboutToShow(MenuManager menu) {
- super.editorContextMenuAboutToShow(menu);
- addAction(menu, "ContentAssistProposal"); //$NON-NLS-1$
- addAction(menu, "ContentAssistTip"); //$NON-NLS-1$
- }
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method performs gets
- * the java content outline page if request is for a an
- * outline page.
- */
- public Object getAdapter(Class required) {
- if (IContentOutlinePage.class.equals(required)) {
- if (fOutlinePage == null) {
- fOutlinePage= new JavaContentOutlinePage(getDocumentProvider(), this);
- if (getEditorInput() != null)
- fOutlinePage.setInput(getEditorInput());
- }
- return fOutlinePage;
- }
- return super.getAdapter(required);
- }
-
- /* (non-Javadoc)
- * Method declared on AbstractTextEditor
- */
- protected void initializeEditor() {
- super.initializeEditor();
- setSourceViewerConfiguration(new JavaSourceViewerConfiguration());
-// setEditorContextMenuId("#JavaEditorContext"); //$NON-NLS-1$
-// setRulerContextMenuId("#JavaRulerContext"); //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java
deleted file mode 100644
index 8eb40a03807..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.ui.examples.javaeditor;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPluginDescriptor;
-
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-
-import org.eclipse.ui.examples.javaeditor.java.JavaCodeScanner;
-import org.eclipse.ui.examples.javaeditor.javadoc.JavaDocScanner;
-import org.eclipse.ui.examples.javaeditor.util.JavaColorProvider;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The example java editor plugin class.
- *
- * @since 3.0
- */
-public class JavaEditorExamplePlugin extends AbstractUIPlugin {
-
- public final static String JAVA_PARTITIONING= "__java_example_partitioning"; //$NON-NLS-1$
-
- private static JavaEditorExamplePlugin fgInstance;
- private JavaPartitionScanner fPartitionScanner;
- private JavaColorProvider fColorProvider;
- private JavaCodeScanner fCodeScanner;
- private JavaDocScanner fDocScanner;
-
- /**
- * Creates a new plugin instance.
- *
- * @param descriptor
- */
- public JavaEditorExamplePlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- fgInstance= this;
- }
-
- /**
- * Returns the default plugin instance.
- *
- * @return the default plugin instance
- */
- public static JavaEditorExamplePlugin getDefault() {
- return fgInstance;
- }
-
- /*
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#shutdown()
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- }
-
- /**
- * Return a scanner for creating java partitions.
- */
- public JavaPartitionScanner getJavaPartitionScanner() {
- if (fPartitionScanner == null)
- fPartitionScanner= new JavaPartitionScanner();
- return fPartitionScanner;
- }
-
- /**
- * Returns the singleton scanner.
- */
- public RuleBasedScanner getJavaCodeScanner() {
- if (fCodeScanner == null)
- fCodeScanner= new JavaCodeScanner(getJavaColorProvider());
- return fCodeScanner;
- }
-
- /**
- * Returns the singleton color provider.
- */
- public JavaColorProvider getJavaColorProvider() {
- if (fColorProvider == null)
- fColorProvider= new JavaColorProvider();
- return fColorProvider;
- }
-
- /**
- * Returns the singleton document scanner.
- */
- public RuleBasedScanner getJavaDocScanner() {
- if (fDocScanner == null)
- fDocScanner= new JavaDocScanner(fColorProvider);
- return fDocScanner;
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorMessages.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorMessages.java
deleted file mode 100644
index c037d223564..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorMessages.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.javaeditor;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class JavaEditorMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.examples.javaeditor.JavaEditorMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private JavaEditorMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorMessages.properties b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorMessages.properties
deleted file mode 100644
index 441a4a4e562..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorMessages.properties
+++ /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
-###############################################################################
-
-## Actions ##
-
-ContentAssistProposal.label=Content Assist@Ctrl+SPACE
-ContentAssistProposal.tooltip=Content Assist
-ContentAssistProposal.image=
-ContentAssistProposal.description=Content Assist
-
-ContentAssistTip.label=Content Tip@Ctrl+SHIFT+SPACE
-ContentAssistTip.tooltip=Content Tip
-ContentAssistTip.image=
-ContentAssistTip.description=Content Tip
-
-TogglePresentation.label=Change Presentation
-TogglePresentation.tooltip=Enable/Disable Segmented Source Viewer
-TogglePresentation.image=togglepresentation.gif
-TogglePresentation.description=Enable/Disable Segmented Source Viewer
-
-OutlinePage.segment.title_pattern=position {0}
-
-AutoIndent.error.bad_location_1=JavaAutoIndentStrategy.getAutoIndentString: BadLocationException
-AutoIndent.error.bad_location_2=JavaAutoIndentStrategy.calcShiftBackReplace: BadLocationException
-
-CompletionProcessor.ContextInfo.display.pattern=proposal {0} at position {1}
-CompletionProcessor.ContextInfo.value.pattern=proposal {0} valid from {1} to {2}
-CompletionProcessor.Proposal.ContextInfo.pattern={0} valid 5 characters around insertion point
-CompletionProcessor.Proposal.hoverinfo.pattern=Java keyword: {0}
-
-JavaTextHover.emptySelection=empty selection
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaPartitionScanner.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaPartitionScanner.java
deleted file mode 100644
index 54bb2edc298..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaPartitionScanner.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.examples.javaeditor;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.rules.*;
-
-/**
- * This scanner recognizes the JavaDoc comments and Java multi line comments.
- */
-public class JavaPartitionScanner extends RuleBasedPartitionScanner {
-
- public final static String JAVA_MULTILINE_COMMENT= "__java_multiline_comment"; //$NON-NLS-1$
- public final static String JAVA_DOC= "__java_javadoc"; //$NON-NLS-1$
- public final static String[] JAVA_PARTITION_TYPES= new String[] { JAVA_MULTILINE_COMMENT, JAVA_DOC };
-
- /**
- * Detector for empty comments.
- */
- static class EmptyCommentDetector implements IWordDetector {
-
- /* (non-Javadoc)
- * Method declared on IWordDetector
- */
- public boolean isWordStart(char c) {
- return (c == '/');
- }
-
- /* (non-Javadoc)
- * Method declared on IWordDetector
- */
- public boolean isWordPart(char c) {
- return (c == '*' || c == '/');
- }
- }
-
- /**
- *
- */
- static class WordPredicateRule extends WordRule implements IPredicateRule {
-
- private IToken fSuccessToken;
-
- public WordPredicateRule(IToken successToken) {
- super(new EmptyCommentDetector());
- fSuccessToken= successToken;
- addWord("/**/", fSuccessToken); //$NON-NLS-1$
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IPredicateRule#evaluate(ICharacterScanner, boolean)
- */
- public IToken evaluate(ICharacterScanner scanner, boolean resume) {
- return super.evaluate(scanner);
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IPredicateRule#getSuccessToken()
- */
- public IToken getSuccessToken() {
- return fSuccessToken;
- }
- }
-
- /**
- * Creates the partitioner and sets up the appropriate rules.
- */
- public JavaPartitionScanner() {
- super();
-
- IToken javaDoc= new Token(JAVA_DOC);
- IToken comment= new Token(JAVA_MULTILINE_COMMENT);
-
- List rules= new ArrayList();
-
- // Add rule for single line comments.
- rules.add(new EndOfLineRule("//", Token.UNDEFINED)); //$NON-NLS-1$
-
- // Add rule for strings and character constants.
- rules.add(new SingleLineRule("\"", "\"", Token.UNDEFINED, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
- rules.add(new SingleLineRule("'", "'", Token.UNDEFINED, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
-
- // Add special case word rule.
- rules.add(new WordPredicateRule(comment));
-
- // Add rules for multi-line comments and javadoc.
- rules.add(new MultiLineRule("/**", "*/", javaDoc, (char) 0, true)); //$NON-NLS-1$ //$NON-NLS-2$
- rules.add(new MultiLineRule("/*", "*/", comment, (char) 0, true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- IPredicateRule[] result= new IPredicateRule[rules.size()];
- rules.toArray(result);
- setPredicateRules(result);
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.java
deleted file mode 100644
index 5df2a8737d3..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.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
- *******************************************************************************/
-package org.eclipse.ui.examples.javaeditor;
-
-
-import org.eclipse.swt.graphics.RGB;
-
-import org.eclipse.jface.text.DefaultAutoIndentStrategy;
-import org.eclipse.jface.text.IAutoIndentStrategy;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextDoubleClickStrategy;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.presentation.PresentationReconciler;
-import org.eclipse.jface.text.rules.BufferedRuleBasedScanner;
-import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.source.IAnnotationHover;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-
-import org.eclipse.ui.examples.javaeditor.java.JavaAutoIndentStrategy;
-import org.eclipse.ui.examples.javaeditor.java.JavaCompletionProcessor;
-import org.eclipse.ui.examples.javaeditor.java.JavaDoubleClickSelector;
-import org.eclipse.ui.examples.javaeditor.javadoc.JavaDocCompletionProcessor;
-import org.eclipse.ui.examples.javaeditor.util.JavaColorProvider;
-
-/**
- * Example configuration for an <code>SourceViewer</code> which shows Java code.
- */
-public class JavaSourceViewerConfiguration extends SourceViewerConfiguration {
-
-
- /**
- * Single token scanner.
- */
- static class SingleTokenScanner extends BufferedRuleBasedScanner {
- public SingleTokenScanner(TextAttribute attribute) {
- setDefaultReturnToken(new Token(attribute));
- }
- }
-
-
- /**
- * Default constructor.
- */
- public JavaSourceViewerConfiguration() {
- }
-
- /* (non-Javadoc)
- * Method declared on SourceViewerConfiguration
- */
- public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
- return new JavaAnnotationHover();
- }
-
- /* (non-Javadoc)
- * Method declared on SourceViewerConfiguration
- */
- public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType) {
- return (IDocument.DEFAULT_CONTENT_TYPE.equals(contentType) ? new JavaAutoIndentStrategy() : new DefaultAutoIndentStrategy());
- }
-
- /*
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer)
- */
- public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
- return JavaEditorExamplePlugin.JAVA_PARTITIONING;
- }
-
- /* (non-Javadoc)
- * Method declared on SourceViewerConfiguration
- */
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return new String[] { IDocument.DEFAULT_CONTENT_TYPE, JavaPartitionScanner.JAVA_DOC, JavaPartitionScanner.JAVA_MULTILINE_COMMENT };
- }
-
- /* (non-Javadoc)
- * Method declared on SourceViewerConfiguration
- */
- public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
-
- ContentAssistant assistant= new ContentAssistant();
- assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
- assistant.setContentAssistProcessor(new JavaCompletionProcessor(), IDocument.DEFAULT_CONTENT_TYPE);
- assistant.setContentAssistProcessor(new JavaDocCompletionProcessor(), JavaPartitionScanner.JAVA_DOC);
-
- assistant.enableAutoActivation(true);
- assistant.setAutoActivationDelay(500);
- assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
- assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
- assistant.setContextInformationPopupBackground(JavaEditorExamplePlugin.getDefault().getJavaColorProvider().getColor(new RGB(150, 150, 0)));
-
- return assistant;
- }
-
- /* (non-Javadoc)
- * Method declared on SourceViewerConfiguration
- */
- public String getDefaultPrefix(ISourceViewer sourceViewer, String contentType) {
- return (IDocument.DEFAULT_CONTENT_TYPE.equals(contentType) ? "//" : null); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on SourceViewerConfiguration
- */
- public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) {
- return new JavaDoubleClickSelector();
- }
-
- /* (non-Javadoc)
- * Method declared on SourceViewerConfiguration
- */
- public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
- return new String[] { "\t", " " }; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /* (non-Javadoc)
- * Method declared on SourceViewerConfiguration
- */
- public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
-
- JavaColorProvider provider= JavaEditorExamplePlugin.getDefault().getJavaColorProvider();
- PresentationReconciler reconciler= new PresentationReconciler();
- reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
-
- DefaultDamagerRepairer dr= new DefaultDamagerRepairer(JavaEditorExamplePlugin.getDefault().getJavaCodeScanner());
- reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
- reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
-
- dr= new DefaultDamagerRepairer(new SingleTokenScanner(new TextAttribute(provider.getColor(JavaColorProvider.JAVADOC_DEFAULT))));
- reconciler.setDamager(dr, JavaPartitionScanner.JAVA_DOC);
- reconciler.setRepairer(dr, JavaPartitionScanner.JAVA_DOC);
-
- dr= new DefaultDamagerRepairer(new SingleTokenScanner(new TextAttribute(provider.getColor(JavaColorProvider.MULTI_LINE_COMMENT))));
- reconciler.setDamager(dr, JavaPartitionScanner.JAVA_MULTILINE_COMMENT);
- reconciler.setRepairer(dr, JavaPartitionScanner.JAVA_MULTILINE_COMMENT);
-
- return reconciler;
- }
-
- /* (non-Javadoc)
- * Method declared on SourceViewerConfiguration
- */
- public int getTabWidth(ISourceViewer sourceViewer) {
- return 4;
- }
-
- /* (non-Javadoc)
- * Method declared on SourceViewerConfiguration
- */
- public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
- return new JavaTextHover();
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaTextHover.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaTextHover.java
deleted file mode 100644
index f4f55e86751..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaTextHover.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.examples.javaeditor;
-
-
-import org.eclipse.jface.text.*;
-import org.eclipse.swt.graphics.Point;
-
-/**
- * Example implementation for an <code>ITextHover</code> which hovers over Java code.
- */
-public class JavaTextHover implements ITextHover {
-
- /* (non-Javadoc)
- * Method declared on ITextHover
- */
- public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
- if (hoverRegion != null) {
- try {
- if (hoverRegion.getLength() > -1)
- return textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
- } catch (BadLocationException x) {
- }
- }
- return JavaEditorMessages.getString("JavaTextHover.emptySelection"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on ITextHover
- */
- public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
- Point selection= textViewer.getSelectedRange();
- if (selection.x <= offset && offset < selection.x + selection.y)
- return new Region(selection.x, selection.y);
- return new Region(offset, 0);
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/PresentationAction.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/PresentationAction.java
deleted file mode 100644
index fcdb150e187..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/PresentationAction.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.examples.javaeditor;
-
-
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
-
-/**
- * A toolbar action which toggles the presentation model of the
- * connected text editor. The editor shows either the highlight range
- * only or always the whole document.
- */
-public class PresentationAction extends TextEditorAction {
-
- /**
- * Constructs and updates the action.
- */
- public PresentationAction() {
- super(JavaEditorMessages.getResourceBundle(), "TogglePresentation.", null); //$NON-NLS-1$
- update();
- }
-
- /* (non-Javadoc)
- * Method declared on IAction
- */
- public void run() {
-
- ITextEditor editor= getTextEditor();
-
- editor.resetHighlightRange();
- boolean show= editor.showsHighlightRangeOnly();
- setChecked(!show);
- editor.showHighlightRangeOnly(!show);
- }
-
- /* (non-Javadoc)
- * Method declared on TextEditorAction
- */
- public void update() {
- setChecked(getTextEditor() != null && getTextEditor().showsHighlightRangeOnly());
- setEnabled(true);
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaAutoIndentStrategy.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaAutoIndentStrategy.java
deleted file mode 100644
index cf459d97768..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaAutoIndentStrategy.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.examples.javaeditor.java;
-
-
-import org.eclipse.jface.text.*;
-
-/**
- * Auto indent strategy sensitive to brackets.
- */
-public class JavaAutoIndentStrategy extends DefaultAutoIndentStrategy {
-
- public JavaAutoIndentStrategy() {
- }
-
- /* (non-Javadoc)
- * Method declared on IAutoIndentStrategy
- */
- public void customizeDocumentCommand(IDocument d, DocumentCommand c) {
- if (c.length == 0 && c.text != null && endsWithDelimiter(d, c.text))
- smartIndentAfterNewLine(d, c);
- else if ("}".equals(c.text)) { //$NON-NLS-1$
- smartInsertAfterBracket(d, c);
- }
- }
-
- /**
- * Returns whether or not the text ends with one of the given search strings.
- */
- private boolean endsWithDelimiter(IDocument d, String txt) {
- String[] delimiters= d.getLegalLineDelimiters();
- if (delimiters != null)
- return TextUtilities.endsWith(delimiters, txt) > -1;
- return false;
- }
-
- /**
- * Returns the line number of the next bracket after end.
- * @returns the line number of the next matching bracket after end
- * @param document - the document being parsed
- * @param line - the line to start searching back from
- * @param end - the end position to search back from
- * @param closingBracketIncrease - the number of brackets to skip
- */
- protected int findMatchingOpenBracket(IDocument document, int line, int end, int closingBracketIncrease) throws BadLocationException {
-
- int start= document.getLineOffset(line);
- int brackcount= getBracketCount(document, start, end, false) - closingBracketIncrease;
-
- // sum up the brackets counts of each line (closing brackets count negative,
- // opening positive) until we find a line the brings the count to zero
- while (brackcount < 0) {
- line--;
- if (line < 0) {
- return -1;
- }
- start= document.getLineOffset(line);
- end= start + document.getLineLength(line) - 1;
- brackcount += getBracketCount(document, start, end, false);
- }
- return line;
- }
-
- /**
- * Returns the bracket value of a section of text. Closing brackets have a value of -1 and
- * open brackets have a value of 1.
- * @returns the line number of the next matching bracket after end
- * @param document - the document being parsed
- * @param start - the start position for the search
- * @param end - the end position for the search
- * @param ignoreCloseBrackets - whether or not to ignore closing brackets in the count
- */
- private int getBracketCount(IDocument document, int start, int end, boolean ignoreCloseBrackets) throws BadLocationException {
-
- int begin = start;
- int bracketcount= 0;
- while (begin < end) {
- char curr= document.getChar(begin);
- begin++;
- switch (curr) {
- case '/' :
- if (begin < end) {
- char next= document.getChar(begin);
- if (next == '*') {
- // a comment starts, advance to the comment end
- begin= getCommentEnd(document, begin + 1, end);
- } else if (next == '/') {
- // '//'-comment: nothing to do anymore on this line
- begin= end;
- }
- }
- break;
- case '*' :
- if (begin < end) {
- char next= document.getChar(begin);
- if (next == '/') {
- // we have been in a comment: forget what we read before
- bracketcount= 0;
- begin++;
- }
- }
- break;
- case '{' :
- bracketcount++;
- ignoreCloseBrackets= false;
- break;
- case '}' :
- if (!ignoreCloseBrackets) {
- bracketcount--;
- }
- break;
- case '"' :
- case '\'' :
- begin= getStringEnd(document, begin, end, curr);
- break;
- default :
- }
- }
- return bracketcount;
- }
-
- /**
- * Returns the end position a comment starting at pos.
- * @returns the end position a comment starting at pos
- * @param document - the document being parsed
- * @param position - the start position for the search
- * @param end - the end position for the search
- */
- private int getCommentEnd(IDocument document, int position, int end) throws BadLocationException {
- int currentPosition = position;
- while (currentPosition < end) {
- char curr= document.getChar(currentPosition);
- currentPosition++;
- if (curr == '*') {
- if (currentPosition < end && document.getChar(currentPosition) == '/') {
- return currentPosition + 1;
- }
- }
- }
- return end;
- }
-
- /**
- * Returns the String at line with the leading whitespace removed.
- * @returns the String at line with the leading whitespace removed.
- * @param document - the document being parsed
- * @param line - the line being searched
- */
- protected String getIndentOfLine(IDocument document, int line) throws BadLocationException {
- if (line > -1) {
- int start= document.getLineOffset(line);
- int end= start + document.getLineLength(line) - 1;
- int whiteend= findEndOfWhiteSpace(document, start, end);
- return document.get(start, whiteend - start);
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * Returns the position of the character in the document after position.
- * @returns the next location of character.
- * @param document - the document being parsed
- * @param position - the position to start searching from
- * @param end - the end of the document
- * @param character - the character you are trying to match
- */
- private int getStringEnd(IDocument document, int position, int end, char character) throws BadLocationException {
- int currentPosition = position;
- while (currentPosition < end) {
- char currentCharacter= document.getChar(currentPosition);
- currentPosition++;
- if (currentCharacter == '\\') {
- // ignore escaped characters
- currentPosition++;
- } else if (currentCharacter == character) {
- return currentPosition;
- }
- }
- return end;
- }
-
- /**
- * Set the indent of a new line based on the command provided in the supplied document.
- * @param document - the document being parsed
- * @param command - the command being performed
- */
- protected void smartIndentAfterNewLine(IDocument document, DocumentCommand command) {
-
- int docLength= document.getLength();
- if (command.offset == -1 || docLength == 0)
- return;
-
- try {
- int p= (command.offset == docLength ? command.offset - 1 : command.offset);
- int line= document.getLineOfOffset(p);
-
- StringBuffer buf= new StringBuffer(command.text);
- if (command.offset < docLength && document.getChar(command.offset) == '}') {
- int indLine= findMatchingOpenBracket(document, line, command.offset, 0);
- if (indLine == -1) {
- indLine= line;
- }
- buf.append(getIndentOfLine(document, indLine));
- } else {
- int start= document.getLineOffset(line);
- int whiteend= findEndOfWhiteSpace(document, start, command.offset);
- buf.append(document.get(start, whiteend - start));
- if (getBracketCount(document, start, command.offset, true) > 0) {
- buf.append('\t');
- }
- }
- command.text= buf.toString();
-
- } catch (BadLocationException excp) {
- System.out.println(JavaEditorMessages.getString("AutoIndent.error.bad_location_1")); //$NON-NLS-1$
- }
- }
-
- /**
- * Set the indent of a bracket based on the command provided in the supplied document.
- * @param document - the document being parsed
- * @param command - the command being performed
- */
- protected void smartInsertAfterBracket(IDocument document, DocumentCommand command) {
- if (command.offset == -1 || document.getLength() == 0)
- return;
-
- try {
- int p= (command.offset == document.getLength() ? command.offset - 1 : command.offset);
- int line= document.getLineOfOffset(p);
- int start= document.getLineOffset(line);
- int whiteend= findEndOfWhiteSpace(document, start, command.offset);
-
- // shift only when line does not contain any text up to the closing bracket
- if (whiteend == command.offset) {
- // evaluate the line with the opening bracket that matches out closing bracket
- int indLine= findMatchingOpenBracket(document, line, command.offset, 1);
- if (indLine != -1 && indLine != line) {
- // take the indent of the found line
- StringBuffer replaceText= new StringBuffer(getIndentOfLine(document, indLine));
- // add the rest of the current line including the just added close bracket
- replaceText.append(document.get(whiteend, command.offset - whiteend));
- replaceText.append(command.text);
- // modify document command
- command.length= command.offset - start;
- command.offset= start;
- command.text= replaceText.toString();
- }
- }
- } catch (BadLocationException excp) {
- System.out.println(JavaEditorMessages.getString("AutoIndent.error.bad_location_2")); //$NON-NLS-1$
- }
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCodeScanner.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCodeScanner.java
deleted file mode 100644
index 3b9535e2af1..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCodeScanner.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.javaeditor.java;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.*;
-import org.eclipse.ui.examples.javaeditor.util.*;
-
-/**
- * A Java code scanner.
- */
-public class JavaCodeScanner extends RuleBasedScanner {
-
- private static String[] fgKeywords= { "abstract", "break", "case", "catch", "class", "continue", "default", "do", "else", "extends", "final", "finally", "for", "if", "implements", "import", "instanceof", "interface", "native", "new", "package", "private", "protected", "public", "return", "static", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "try", "volatile", "while" }; //$NON-NLS-36$ //$NON-NLS-35$ //$NON-NLS-34$ //$NON-NLS-33$ //$NON-NLS-32$ //$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$
-
- private static String[] fgTypes= { "void", "boolean", "char", "byte", "short", "int", "long", "float", "double" }; //$NON-NLS-1$ //$NON-NLS-5$ //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-2$
-
- private static String[] fgConstants= { "false", "null", "true" }; //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
-
- /**
- * Creates a Java code scanner
- */
- public JavaCodeScanner(JavaColorProvider provider) {
-
- IToken keyword= new Token(new TextAttribute(provider.getColor(JavaColorProvider.KEYWORD)));
- IToken type= new Token(new TextAttribute(provider.getColor(JavaColorProvider.TYPE)));
- IToken string= new Token(new TextAttribute(provider.getColor(JavaColorProvider.STRING)));
- IToken comment= new Token(new TextAttribute(provider.getColor(JavaColorProvider.SINGLE_LINE_COMMENT)));
- IToken other= new Token(new TextAttribute(provider.getColor(JavaColorProvider.DEFAULT)));
-
- List rules= new ArrayList();
-
- // Add rule for single line comments.
- rules.add(new EndOfLineRule("//", comment)); //$NON-NLS-1$
-
- // Add rule for strings and character constants.
- rules.add(new SingleLineRule("\"", "\"", string, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
- rules.add(new SingleLineRule("'", "'", string, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
-
- // Add generic whitespace rule.
- rules.add(new WhitespaceRule(new JavaWhitespaceDetector()));
-
- // Add word rule for keywords, types, and constants.
- WordRule wordRule= new WordRule(new JavaWordDetector(), other);
- for (int i= 0; i < fgKeywords.length; i++)
- wordRule.addWord(fgKeywords[i], keyword);
- for (int i= 0; i < fgTypes.length; i++)
- wordRule.addWord(fgTypes[i], type);
- for (int i= 0; i < fgConstants.length; i++)
- wordRule.addWord(fgConstants[i], type);
- rules.add(wordRule);
-
- IRule[] result= new IRule[rules.size()];
- rules.toArray(result);
- setRules(result);
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCompletionProcessor.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCompletionProcessor.java
deleted file mode 100644
index 1059d448cc2..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCompletionProcessor.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.javaeditor.java;
-
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.jface.text.contentassist.*;
-
-/**
- * Example Java completion processor.
- */
-public class JavaCompletionProcessor implements IContentAssistProcessor {
-
- /**
- * Simple content assist tip closer. The tip is valid in a range
- * of 5 characters around its popup location.
- */
- protected static class Validator implements IContextInformationValidator, IContextInformationPresenter {
-
- protected int fInstallOffset;
-
- /*
- * @see IContextInformationValidator#isContextInformationValid(int)
- */
- public boolean isContextInformationValid(int offset) {
- return Math.abs(fInstallOffset - offset) < 5;
- }
-
- /*
- * @see IContextInformationValidator#install(IContextInformation, ITextViewer, int)
- */
- public void install(IContextInformation info, ITextViewer viewer, int offset) {
- fInstallOffset= offset;
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int, TextPresentation)
- */
- public boolean updatePresentation(int documentPosition, TextPresentation presentation) {
- return false;
- }
- }
-
- protected final static String[] fgProposals=
- { "abstract", "boolean", "break", "byte", "case", "catch", "char", "class", "continue", "default", "do", "double", "else", "extends", "false", "final", "finally", "float", "for", "if", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "void", "volatile", "while" }; //$NON-NLS-48$ //$NON-NLS-47$ //$NON-NLS-46$ //$NON-NLS-45$ //$NON-NLS-44$ //$NON-NLS-43$ //$NON-NLS-42$ //$NON-NLS-41$ //$NON-NLS-40$ //$NON-NLS-39$ //$NON-NLS-38$ //$NON-NLS-37$ //$NON-NLS-36$ //$NON-NLS-35$ //$NON-NLS-34$ //$NON-NLS-33$ //$NON-NLS-32$ //$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$
-
- protected IContextInformationValidator fValidator= new Validator();
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
- ICompletionProposal[] result= new ICompletionProposal[fgProposals.length];
- for (int i= 0; i < fgProposals.length; i++) {
- IContextInformation info= new ContextInformation(fgProposals[i], MessageFormat.format(JavaEditorMessages.getString("CompletionProcessor.Proposal.ContextInfo.pattern"), new Object[] { fgProposals[i] })); //$NON-NLS-1$
- result[i]= new CompletionProposal(fgProposals[i], documentOffset, 0, fgProposals[i].length(), null, fgProposals[i], info, MessageFormat.format(JavaEditorMessages.getString("CompletionProcessor.Proposal.hoverinfo.pattern"), new Object[] { fgProposals[i]})); //$NON-NLS-1$
- }
- return result;
- }
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
- IContextInformation[] result= new IContextInformation[5];
- for (int i= 0; i < result.length; i++)
- result[i]= new ContextInformation(
- MessageFormat.format(JavaEditorMessages.getString("CompletionProcessor.ContextInfo.display.pattern"), new Object[] { new Integer(i), new Integer(documentOffset) }), //$NON-NLS-1$
- MessageFormat.format(JavaEditorMessages.getString("CompletionProcessor.ContextInfo.value.pattern"), new Object[] { new Integer(i), new Integer(documentOffset - 5), new Integer(documentOffset + 5)})); //$NON-NLS-1$
- return result;
- }
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public char[] getCompletionProposalAutoActivationCharacters() {
- return new char[] { '.', '(' };
- }
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public char[] getContextInformationAutoActivationCharacters() {
- return new char[] { '#' };
- }
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public IContextInformationValidator getContextInformationValidator() {
- return fValidator;
- }
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public String getErrorMessage() {
- return null;
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaDoubleClickSelector.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaDoubleClickSelector.java
deleted file mode 100644
index ace486e94bf..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaDoubleClickSelector.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.javaeditor.java;
-
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextDoubleClickStrategy;
-import org.eclipse.jface.text.ITextViewer;
-
-/**
- * Double click strategy aware of Java identifier syntax rules.
- */
-public class JavaDoubleClickSelector implements ITextDoubleClickStrategy {
-
- protected ITextViewer fText;
- protected int fPos;
- protected int fStartPos;
- protected int fEndPos;
-
- protected static char[] fgBrackets= { '{', '}', '(', ')', '[', ']', '"', '"' };
-
- /*
- * Create a JavaDoubleClickSelector.
- */
- public JavaDoubleClickSelector() {
- super();
- }
-
- /* (non-Javadoc)
- * Method declared on ITextDoubleClickStrategy
- */
- public void doubleClicked(ITextViewer text) {
-
- fPos= text.getSelectedRange().x;
-
- if (fPos < 0)
- return;
-
- fText= text;
-
- if (!selectBracketBlock())
- selectWord();
- }
-
- /**
- * Match the brackets at the current selection. Return true if successful,
- * false otherwise.
- */
- protected boolean matchBracketsAt() {
-
- char prevChar, nextChar;
-
- int i;
- int bracketIndex1= fgBrackets.length;
- int bracketIndex2= fgBrackets.length;
-
- fStartPos= -1;
- fEndPos= -1;
-
- // get the chars preceding and following the start position
- try {
-
- IDocument doc= fText.getDocument();
-
- prevChar= doc.getChar(fPos - 1);
- nextChar= doc.getChar(fPos);
-
- // is the char either an open or close bracket?
- for (i= 0; i < fgBrackets.length; i= i + 2) {
- if (prevChar == fgBrackets[i]) {
- fStartPos= fPos - 1;
- bracketIndex1= i;
- }
- }
- for (i= 1; i < fgBrackets.length; i= i + 2) {
- if (nextChar == fgBrackets[i]) {
- fEndPos= fPos;
- bracketIndex2= i;
- }
- }
-
- if (fStartPos > -1 && bracketIndex1 < bracketIndex2) {
- fEndPos= searchForClosingBracket(fStartPos, prevChar, fgBrackets[bracketIndex1 + 1], doc);
- if (fEndPos > -1)
- return true;
- else
- fStartPos= -1;
- } else if (fEndPos > -1) {
- fStartPos= searchForOpenBracket(fEndPos, fgBrackets[bracketIndex2 - 1], nextChar, doc);
- if (fStartPos > -1)
- return true;
- else
- fEndPos= -1;
- }
-
- } catch (BadLocationException x) {
- }
-
- return false;
- }
-
- /**
- * Select the word at the current selection. Return true if successful,
- * false otherwise.
- */
- protected boolean matchWord() {
-
- IDocument doc= fText.getDocument();
-
- try {
-
- int pos= fPos;
- char c;
-
- while (pos >= 0) {
- c= doc.getChar(pos);
- if (!Character.isJavaIdentifierPart(c))
- break;
- --pos;
- }
-
- fStartPos= pos;
-
- pos= fPos;
- int length= doc.getLength();
-
- while (pos < length) {
- c= doc.getChar(pos);
- if (!Character.isJavaIdentifierPart(c))
- break;
- ++pos;
- }
-
- fEndPos= pos;
-
- return true;
-
- } catch (BadLocationException x) {
- }
-
- return false;
- }
-
- /**
- * Returns the position of the closing bracket after startPosition.
- * @returns the location of the closing bracket.
- * @param startPosition - the beginning position
- * @param openBracket - the character that represents the open bracket
- * @param closeBracket - the character that represents the close bracket
- * @param document - the document being searched
- */
- protected int searchForClosingBracket(int startPosition, char openBracket, char closeBracket, IDocument document) throws BadLocationException {
- int stack= 1;
- int closePosition= startPosition + 1;
- int length= document.getLength();
- char nextChar;
-
- while (closePosition < length && stack > 0) {
- nextChar= document.getChar(closePosition);
- if (nextChar == openBracket && nextChar != closeBracket)
- stack++;
- else if (nextChar == closeBracket)
- stack--;
- closePosition++;
- }
-
- if (stack == 0)
- return closePosition - 1;
- else
- return -1;
-
- }
-
- /**
- * Returns the position of the open bracket before startPosition.
- * @returns the location of the starting bracket.
- * @param startPosition - the beginning position
- * @param openBracket - the character that represents the open bracket
- * @param closeBracket - the character that represents the close bracket
- * @param document - the document being searched
- */
- protected int searchForOpenBracket(int startPosition, char openBracket, char closeBracket, IDocument document) throws BadLocationException {
- int stack= 1;
- int openPos= startPosition - 1;
- char nextChar;
-
- while (openPos >= 0 && stack > 0) {
- nextChar= document.getChar(openPos);
- if (nextChar == closeBracket && nextChar != openBracket)
- stack++;
- else if (nextChar == openBracket)
- stack--;
- openPos--;
- }
-
- if (stack == 0)
- return openPos + 1;
- else
- return -1;
- }
-
- /**
- * Select the area between the selected bracket and the closing bracket. Return
- * true if successful.
- */
- protected boolean selectBracketBlock() {
- if (matchBracketsAt()) {
-
- if (fStartPos == fEndPos)
- fText.setSelectedRange(fStartPos, 0);
- else
- fText.setSelectedRange(fStartPos + 1, fEndPos - fStartPos - 1);
-
- return true;
- }
- return false;
- }
-
- /**
- * Select the word at the current selection.
- */
- protected void selectWord() {
- if (matchWord()) {
-
- if (fStartPos == fEndPos)
- fText.setSelectedRange(fStartPos, 0);
- else
- fText.setSelectedRange(fStartPos + 1, fEndPos - fStartPos - 1);
- }
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaEditorMessages.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaEditorMessages.java
deleted file mode 100644
index 3b1937f1133..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaEditorMessages.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.examples.javaeditor.java;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class JavaEditorMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.examples.javaeditor.JavaEditorMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private JavaEditorMessages() {
- }
-
- 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/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocCompletionProcessor.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocCompletionProcessor.java
deleted file mode 100644
index ffd4d21956b..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocCompletionProcessor.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.examples.javaeditor.javadoc;
-
-
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.*;
-
-/**
- * Example Java doc completion processor.
- */
-public class JavaDocCompletionProcessor implements IContentAssistProcessor {
-
- protected final static String[] fgProposals= { "@author", "@deprecated", "@exception", "@param", "@return", "@see", "@serial", "@serialData", "@serialField", "@since", "@throws", "@version" }; //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-7$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
- ICompletionProposal[] result= new ICompletionProposal[fgProposals.length];
- for (int i= 0; i < fgProposals.length; i++)
- result[i]= new CompletionProposal(fgProposals[i], documentOffset, 0, fgProposals[i].length());
- return result;
- }
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
- return null;
- }
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
-
- /* (non-Javadoc)
- * Method declared on IContentAssistProcessor
- */
- public String getErrorMessage() {
- return null;
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocScanner.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocScanner.java
deleted file mode 100644
index c101cf0bf05..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocScanner.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.javaeditor.javadoc;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.*;
-import org.eclipse.ui.examples.javaeditor.util.JavaColorProvider;
-import org.eclipse.ui.examples.javaeditor.util.JavaWhitespaceDetector;
-
-/**
- * A rule based JavaDoc scanner.
- */
-public class JavaDocScanner extends RuleBasedScanner {
-
- /**
- * A key word detector.
- */
- static class JavaDocWordDetector implements IWordDetector {
-
- /* (non-Javadoc)
- * Method declared on IWordDetector
- */
- public boolean isWordStart(char c) {
- return (c == '@');
- }
-
- /* (non-Javadoc)
- * Method declared on IWordDetector
- */
- public boolean isWordPart(char c) {
- return Character.isLetter(c);
- }
- }
-
- private static String[] fgKeywords= { "@author", "@deprecated", "@exception", "@param", "@return", "@see", "@serial", "@serialData", "@serialField", "@since", "@throws", "@version" }; //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-7$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
-
- /**
- * Create a new java doc scanner.
- */
- public JavaDocScanner(JavaColorProvider provider) {
- super();
-
- IToken keyword= new Token(new TextAttribute(provider.getColor(JavaColorProvider.JAVADOC_KEYWORD)));
- IToken tag= new Token(new TextAttribute(provider.getColor(JavaColorProvider.JAVADOC_TAG)));
- IToken link= new Token(new TextAttribute(provider.getColor(JavaColorProvider.JAVADOC_LINK)));
-
- List list= new ArrayList();
-
- // Add rule for tags.
- list.add(new SingleLineRule("<", ">", tag)); //$NON-NLS-2$ //$NON-NLS-1$
-
- // Add rule for links.
- list.add(new SingleLineRule("{", "}", link)); //$NON-NLS-2$ //$NON-NLS-1$
-
- // Add generic whitespace rule.
- list.add(new WhitespaceRule(new JavaWhitespaceDetector()));
-
- // Add word rule for keywords.
- WordRule wordRule= new WordRule(new JavaDocWordDetector());
- for (int i= 0; i < fgKeywords.length; i++)
- wordRule.addWord(fgKeywords[i], keyword);
- list.add(wordRule);
-
- IRule[] result= new IRule[list.size()];
- list.toArray(result);
- setRules(result);
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/togglepresentation.gif b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/togglepresentation.gif
deleted file mode 100644
index a0831f04bc6..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/togglepresentation.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaColorProvider.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaColorProvider.java
deleted file mode 100644
index d96551b5cf9..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaColorProvider.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.examples.javaeditor.util;
-
-
-import java.util.*;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * Manager for colors used in the Java editor
- */
-public class JavaColorProvider {
-
- public static final RGB MULTI_LINE_COMMENT= new RGB(128, 0, 0);
- public static final RGB SINGLE_LINE_COMMENT= new RGB(128, 128, 0);
- public static final RGB KEYWORD= new RGB(0, 0, 128);
- public static final RGB TYPE= new RGB(0, 0, 128);
- public static final RGB STRING= new RGB(0, 128, 0);
- public static final RGB DEFAULT= new RGB(0, 0, 0);
- public static final RGB JAVADOC_KEYWORD= new RGB(0, 128, 0);
- public static final RGB JAVADOC_TAG= new RGB(128, 128, 128);
- public static final RGB JAVADOC_LINK= new RGB(128, 128, 128);
- public static final RGB JAVADOC_DEFAULT= new RGB(0, 128, 128);
-
- protected Map fColorTable= new HashMap(10);
-
- /**
- * Release all of the color resources held onto by the receiver.
- */
- public void dispose() {
- Iterator e= fColorTable.values().iterator();
- while (e.hasNext())
- ((Color) e.next()).dispose();
- }
-
- /**
- * Return the Color that is stored in the Color table as rgb.
- */
- public Color getColor(RGB rgb) {
- Color color= (Color) fColorTable.get(rgb);
- if (color == null) {
- color= new Color(Display.getCurrent(), rgb);
- fColorTable.put(rgb, color);
- }
- return color;
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaWhitespaceDetector.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaWhitespaceDetector.java
deleted file mode 100644
index 1b5bc9514ef..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaWhitespaceDetector.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.examples.javaeditor.util;
-
-
-import org.eclipse.jface.text.rules.IWhitespaceDetector;
-
-/**
- * A java aware white space detector.
- */
-public class JavaWhitespaceDetector implements IWhitespaceDetector {
-
- /* (non-Javadoc)
- * Method declared on IWhitespaceDetector
- */
- public boolean isWhitespace(char character) {
- return Character.isWhitespace(character);
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaWordDetector.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaWordDetector.java
deleted file mode 100644
index e79a1b9c1b1..00000000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaWordDetector.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.examples.javaeditor.util;
-
-
-import org.eclipse.jface.text.rules.IWordDetector;
-
-/**
- * A Java aware word detector.
- */
-public class JavaWordDetector implements IWordDetector {
-
- /* (non-Javadoc)
- * Method declared on IWordDetector.
- */
- public boolean isWordPart(char character) {
- return Character.isJavaIdentifierPart(character);
- }
-
- /* (non-Javadoc)
- * Method declared on IWordDetector.
- */
- public boolean isWordStart(char character) {
- return Character.isJavaIdentifierStart(character);
- }
-}
diff --git a/org.eclipse.ui.examples.javaeditor/about.html b/org.eclipse.ui.examples.javaeditor/about.html
deleted file mode 100644
index 9db411aab99..00000000000
--- a/org.eclipse.ui.examples.javaeditor/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 (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). 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, &quot;Program&quot; 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 (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) 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/org.eclipse.ui.examples.javaeditor/build.properties b/org.eclipse.ui.examples.javaeditor/build.properties
deleted file mode 100644
index deb4a693ceb..00000000000
--- a/org.eclipse.ui.examples.javaeditor/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.javaeditorexample.jar = Eclipse Java Editor Example/
-
-bin.includes = doc-html/,\
- icons/,\
- .options,\
- about.html,\
- plugin.properties,\
- plugin.xml,\
- *.jar
-
-src.includes = about.html
diff --git a/org.eclipse.ui.examples.javaeditor/doc-html/hglegal.htm b/org.eclipse.ui.examples.javaeditor/doc-html/hglegal.htm
deleted file mode 100644
index c59811321a9..00000000000
--- a/org.eclipse.ui.examples.javaeditor/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/org.eclipse.ui.examples.javaeditor/doc-html/hglegal2002.htm b/org.eclipse.ui.examples.javaeditor/doc-html/hglegal2002.htm
deleted file mode 100644
index 3c864673556..00000000000
--- a/org.eclipse.ui.examples.javaeditor/doc-html/hglegal2002.htm
+++ /dev/null
@@ -1,13 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. and others 2000, 2002. All Rights Reserved.
-</body>
-</html>
diff --git a/org.eclipse.ui.examples.javaeditor/doc-html/hglegal2003.htm b/org.eclipse.ui.examples.javaeditor/doc-html/hglegal2003.htm
deleted file mode 100644
index f5871b79e02..00000000000
--- a/org.eclipse.ui.examples.javaeditor/doc-html/hglegal2003.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">
- <LINK REL="stylesheet" HREF="../../../book.css" CHARSET="ISO-8859-1" TYPE="text/css">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.
-</body>
-</html>
diff --git a/org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy.gif b/org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy.gif
deleted file mode 100644
index 360f8e99891..00000000000
--- a/org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy2002.gif b/org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy2002.gif
deleted file mode 100644
index 61cef485216..00000000000
--- a/org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy2002.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy2003.gif b/org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy2003.gif
deleted file mode 100644
index c786e43e1f9..00000000000
--- a/org.eclipse.ui.examples.javaeditor/doc-html/ngibmcpy2003.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.examples.javaeditor/doc-html/ui_javaeditor_ex.html b/org.eclipse.ui.examples.javaeditor/doc-html/ui_javaeditor_ex.html
deleted file mode 100644
index 3302957b2c8..00000000000
--- a/org.eclipse.ui.examples.javaeditor/doc-html/ui_javaeditor_ex.html
+++ /dev/null
@@ -1,237 +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.76 [en] (Windows NT 5.0; U) [Netscape]">
- <title>Desktop - Java Editor Example</title>
-</head>
-<body>
-
-<h2>
-<b>Example - Java Editor</b></h2>
-
-<h3>
-Introduction</h3>
-The Java Editor example demonstrates the standard features available for
-custom text editors.&nbsp; It also shows how&nbsp; to register an editor
-for a file extension (in this case .jav) and how to define a custom Document
-provider for use by that editor. This example is only for demonstration
-purposes. Java editing support is provided by the&nbsp; Eclipse Java Tooling.
-<h3>
-<b>Features demonstrated in the example editor</b></h3>
-
-<ul>
-<li>
-syntax highlighting</li>
-
-<li>
-content type sensitive content assist (JavaDoc and Java code)</li>
-
-<li>
-communication between content outliner and editor, i.e. content outliner
-selection feeds the highlight range of the editor</li>
-
-<li>
-two different presentation modes</li>
-
-<ul>
-<li>
-&nbsp;marking the highlight range using a visual range indicator</li>
-
-<li>
-confining the editor to show only text within the highlight range (e.g.
-show a single method of a Java class)</li>
-</ul>
-
-<li>
-marker handling</li>
-
-<li>
-document sharing</li>
-</ul>
-
-<h3>
-Features not demonstrated</h3>
-
-<ul>
-<li>
-content formatting</li>
-
-<li>
-dynamic reconciling of content outline page</li>
-</ul>
-
-<h3>
-Running the example editor</h3>
-
-<ol>
-<li>
-Create a project</li>
-
-<li>
-Create a file with the file extension ".jav" in the newly created project.
-The Java example editor opens automatically.</li>
-
-<li>
-Insert Java code. The Java code is dynamically colored. The example editor
-presents the following language elements in different colors: multi-line
-comments, single line comments, Java language reserved words, string and
-character constants, regular Java code, as well as multi-line comments
-following the JavaDoc guidelines. Inside those JavaDoc comments, JavaDoc
-keywords and tags are differently colored.</li>
-
-<li>
-Open a new Java multi-line comment by inserting "/*" outside a Java comment.
-All the text between the inserted "/*" and the first occurrence of "*/"
-or the end of the text changes its color to red. Append another "*". The
-red range changes color to green as the regular multi-line comment now
-is considered containing JavaDoc. Invoke code assist using CTRL-SPACE.
-The function of content assist is to support the user in writing code.
-So on invocation, content assist should list all possible valid completions
-at the invocation location. Inside JavaDoc, the example editor always proposes
-all JavaDoc keywords.</li>
-
-<li>
-Outside a Java comment invoke content tip using CTRL+SHIFT+SPACE. Five
-proposals are listed. Select one and press ENTER. A small floating red
-window appears above the current line displaying the selected proposal.
-The anticipated use of content tips is to let the user express her intention,
-e.g. to enter a method call and to present contextual information which
-guides the user by doing so. In the example editor, the proposal is considered
-valid five characters around the initial invocation location. While the
-content tip is visible, invoke content assist using CTRL+SPACE. Content
-assist invoked in this situation should help the user to accomplish her
-stated intention visible in the content tip. Inside regular Java code,
-the example editor always proposes all Java keywords.</li>
-
-<li>
-Save the Java code. Saving updates the content outliner. The content outliner
-contains ten entries each of them representing one of ten equally sized
-segments of the Java code in the editor. This style of content outline
-has been chosen to show that the semantics of highlight ranges can arbitrarily
-be defined. (See next steps.)</li>
-
-<li>
-Select one of the entries in the content outliner. The corresponding lines
-are marked with a blue bar in the editor's left vertical ruler.</li>
-
-<li>
-Now switch to the segmented presentation mode of the Java editor. For that
-make sure that the editor has the focus and press that button in the desktop's
-toolbar whose hover help says "Enable/Disable segmented source viewer".&nbsp;
-This functionality is anticipated to be used, e.g., for single method views.</li>
-
-<li>
-Select a different entry in the content outliner. Now the editor only shows
-the selected segment. By deselecting the entry in the content outliner,
-the complete Java code is shown again.</li>
-
-<li>
-Select an entry in the content outliner, select a fraction of the visible
-text, and add a task for the selection. The task shows up in the task list.
-Modify the visible code. In the task list, select the previously created
-task and press the "Go to file" button. The task is selected in the visible
-area, correctly taking the previously applied modifications into account.</li>
-
-<li>
-Select another entry in the content outliner. Reveal the previously added
-task from the task list. The editor's highlight range is automatically
-enlarged to enclose the range of the revealed task.</li>
-
-<li>
-Open a new workspace. In the new workspace, open a Java editor for the
-same file as in the original workspace. Modify the editor content. Switch
-back to the original workspace. The editor shows the changes made in the
-other workspace. The two editors showing the same file are lively linked.</li>
-</ol>
-
-<h3>
-Principles for creating custom text editors</h3>
-The following steps are usually necessary do develop a custom text editor.
-<ol>
-<li>
-Create a document provider. A document provider (see IDocumentProvider)
-produces and manages documents (see IDocument) containing a textual representation
-of editor input elements. It is important to decide how the translation
-between element and textual representation looks like and whether the document
-provider should be shared between multiple editors or not. See the class
-FileDocumentProvider in the Java example editor.</li>
-
-<li>
-Create a document partitioner. A document partitioner (see IDocumentPartitioner)
-divides a document into disjoint regions. The partitioner assigns each
-region one content type out of a set of content types predefined by the
-partitioner. On each document change the document's partitioning must be
-updated. See the class JavaPartitioner in the Java example editor. The
-JavaPartitioner determines regions of the types multi-line comments, JavaDoc
-comments, and everything else. It must be ensured that the document provider
-is set on each document produced by the document provider.</li>
-
-<li>
-Determine which of the source viewer plugins should be provided. Among
-other supported plugins are auto indent strategies, double click strategies,
-content formatter, and text presentation reconciler. The subsequent description
-will be restricted to the text presentation reconciler (see IPresentationReconciler).
-In the Java example editor, the text presentation reconciler is utilized
-to implement syntax highlighting.</li>
-
-<li>
-Create for all source viewer plugins the appropriate extensions for each
-supported content type. As seen above, the document partitioner defines
-the supported content types. The default implementation of IPresentationReconciler
-supports IPresentationDamagers and IPresentationRepairers as extensions.
-Those extensions are considered being specific for a particular content
-type. Thus, for a custom editor, the user must first select a subset of
-the supported content types. Regions of a type being a member of the selected
-subset will, e.g., be syntax highlighted. For each of those types the extensions
-must be implemented. See JavaDamagerRepairer and JavaDocDamagerRepairer
-in the example editor.</li>
-
-<li>
-Build a source viewer configuration using the previously created plugins
-and extensions. See JavaSourceViewerConfiguration in the example editor.</li>
-
-<li>
-Customize the class TextEditor or AbstractTextEditor with the developed
-document partitioner and source viewer configuration. Add or replace actions
-and adapt the construction of the editor's context menu. In the actual
-version, this customization must be done in a subclass. See JavaEditor
-in the example editor.</li>
-
-<li>
-Set up an appropriate action bar contributor who contributes editor-related
-actions to the desktop's toolbar and menus. See JavaActionContributor in
-the example editor.</li>
-
-<li>
-Extend the XML configuration file of the editor's plugin, so that the editor
-registers at the predefined editor extension point for a specific set of
-file extensions. Also set up the action bar contributor in the XML file.
-See plugin.xml of this example.</li>
-</ol>
-
-<h3>
-Code organization of the example</h3>
-The example code is organized in four packages:
-<ul>
-<li>
-<tt>org.eclipse.ui.examples.javaeditor </tt>contains all the editor specific
-classes.</li>
-
-<li>
-<tt>org.eclipse.ui.examples.javaeditor.java</tt> contains all Java specific
-source viewer plugins such as the JavaDamagerRepairer as well as the Java
-specific document partitioner.</li>
-
-<li>
-<tt>org.eclipse.ui.examples.javaeditor.javadoc </tt>contains all JavaDoc
-specific source viewer plugins such as the JavaDocDamagerRepairer.</li>
-
-<br><tt>org.eclipse.ui.examples.javaeditor.util</tt> contains convenience
-classes shared by the three other packages.</ul>
-
-<br>&nbsp;
-<p><a href="hglegal2003.htm"><img src="ngibmcpy2003.gif" alt="Copyright IBM Corporation and others 2000, 2003" border="0" width="324" height="14"></a>
-</p>
-</body>
-</html>
diff --git a/org.eclipse.ui.examples.javaeditor/icons/obj16/java.gif b/org.eclipse.ui.examples.javaeditor/icons/obj16/java.gif
deleted file mode 100644
index 83de817b719..00000000000
--- a/org.eclipse.ui.examples.javaeditor/icons/obj16/java.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.examples.javaeditor/plugin.properties b/org.eclipse.ui.examples.javaeditor/plugin.properties
deleted file mode 100644
index e9cee9f45db..00000000000
--- a/org.eclipse.ui.examples.javaeditor/plugin.properties
+++ /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
-###############################################################################
-#
-# Resource strings for Java Example Editor
-#
-pluginName=JFace Text Example
-providerName = Eclipse.org
-
-#
-# Extension point names
-#
-javaEditorName=Example Java Editor
-javaFileExtensions=jav
-documentSetupParticipantName=Example Java Document Setup Participant
diff --git a/org.eclipse.ui.examples.javaeditor/plugin.xml b/org.eclipse.ui.examples.javaeditor/plugin.xml
deleted file mode 100644
index 793093e905b..00000000000
--- a/org.eclipse.ui.examples.javaeditor/plugin.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.ui.examples.javaeditor"
- name="%pluginName"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.ui.examples.javaeditor.JavaEditorExamplePlugin">
-
- <runtime>
- <library name="javaeditorexample.jar">
- <export name="*"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.runtime.compatibility" optional="true"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.core.filebuffers"/>
- <import plugin="org.eclipse.jface.text"/>
- <import plugin="org.eclipse.ui.workbench.texteditor"/>
- <import plugin="org.eclipse.ui.editors"/>
- <import plugin="org.eclipse.ui.views"/>
- </requires>
-
-
- <extension
- point="org.eclipse.ui.editors">
- <editor
- name="%javaEditorName"
- icon="icons/obj16/java.gif"
- extensions="%javaFileExtensions"
- contributorClass="org.eclipse.ui.examples.javaeditor.JavaActionContributor"
- class="org.eclipse.ui.examples.javaeditor.JavaEditor"
- id="org.eclipse.ui.JavaEditor">
- </editor>
- </extension>
- <extension
- id="ExampleJavaDocumentSetupParticipant"
- name="%documentSetupParticipantName"
- point="org.eclipse.core.filebuffers.documentSetup">
- <participant
- extensions="%javaFileExtensions"
- class="org.eclipse.ui.examples.javaeditor.JavaDocumentSetupParticipant">
- </participant>
- </extension>
-
-</plugin>
diff --git a/org.eclipse.ui.workbench.texteditor/.classpath b/org.eclipse.ui.workbench.texteditor/.classpath
deleted file mode 100644
index 065ac06e197..00000000000
--- a/org.eclipse.ui.workbench.texteditor/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.ui.workbench.texteditor/.cvsignore b/org.eclipse.ui.workbench.texteditor/.cvsignore
deleted file mode 100644
index c5e82d74585..00000000000
--- a/org.eclipse.ui.workbench.texteditor/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/org.eclipse.ui.workbench.texteditor/.project b/org.eclipse.ui.workbench.texteditor/.project
deleted file mode 100644
index ba6f6a3796a..00000000000
--- a/org.eclipse.ui.workbench.texteditor/.project
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.workbench.texteditor</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.jface.text</project>
- <project>org.eclipse.ui</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.ui.workbench.texteditor/about.html b/org.eclipse.ui.workbench.texteditor/about.html
deleted file mode 100644
index 9db411aab99..00000000000
--- a/org.eclipse.ui.workbench.texteditor/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 (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). 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, &quot;Program&quot; 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 (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) 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/org.eclipse.ui.workbench.texteditor/build.properties b/org.eclipse.ui.workbench.texteditor/build.properties
deleted file mode 100644
index 4528ccfa7e0..00000000000
--- a/org.eclipse.ui.workbench.texteditor/build.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
-###############################################################################
-bin.includes = *.jar,\
- plugin.xml,\
- plugin.properties,\
- icons/,\
- about.html
-src.includes = about.html,\
- schema/
-source.texteditor.jar = src/
diff --git a/org.eclipse.ui.workbench.texteditor/icons/full/ctool16/last_edit_pos.gif b/org.eclipse.ui.workbench.texteditor/icons/full/ctool16/last_edit_pos.gif
deleted file mode 100644
index 2a4829e08f0..00000000000
--- a/org.eclipse.ui.workbench.texteditor/icons/full/ctool16/last_edit_pos.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.workbench.texteditor/icons/full/ctool16/segment_edit.gif b/org.eclipse.ui.workbench.texteditor/icons/full/ctool16/segment_edit.gif
deleted file mode 100644
index be9eb921513..00000000000
--- a/org.eclipse.ui.workbench.texteditor/icons/full/ctool16/segment_edit.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.workbench.texteditor/icons/full/dtool16/last_edit_pos.gif b/org.eclipse.ui.workbench.texteditor/icons/full/dtool16/last_edit_pos.gif
deleted file mode 100644
index c729e44da7c..00000000000
--- a/org.eclipse.ui.workbench.texteditor/icons/full/dtool16/last_edit_pos.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.workbench.texteditor/icons/full/dtool16/segment_edit.gif b/org.eclipse.ui.workbench.texteditor/icons/full/dtool16/segment_edit.gif
deleted file mode 100644
index 6844777924f..00000000000
--- a/org.eclipse.ui.workbench.texteditor/icons/full/dtool16/segment_edit.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.workbench.texteditor/icons/full/etool16/last_edit_pos.gif b/org.eclipse.ui.workbench.texteditor/icons/full/etool16/last_edit_pos.gif
deleted file mode 100644
index 9af68df8e6b..00000000000
--- a/org.eclipse.ui.workbench.texteditor/icons/full/etool16/last_edit_pos.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.workbench.texteditor/icons/full/etool16/segment_edit.gif b/org.eclipse.ui.workbench.texteditor/icons/full/etool16/segment_edit.gif
deleted file mode 100644
index e292fe5ef18..00000000000
--- a/org.eclipse.ui.workbench.texteditor/icons/full/etool16/segment_edit.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.workbench.texteditor/plugin.properties b/org.eclipse.ui.workbench.texteditor/plugin.properties
deleted file mode 100644
index bf7610a7363..00000000000
--- a/org.eclipse.ui.workbench.texteditor/plugin.properties
+++ /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
-###############################################################################
-pluginName= Text Editor Framework
-providerName= Eclipse.org
-
-category.textEditor.name= Text Editing
-
-ExtPoint.referenceProvider= Reference Provider
-
-textEditorNavigationActionSet.label= Editor Navigation
-textEditorPresentationActionSet.label= Editor Presentation
-
-goToLastEditPosition.label= Go to Last Edit Location
-goToLastEditPosition.description= Go to last edit location
-goToLastEditPosition.tooltip= Go to Last Edit Location
-
-onlyShowSelectedElement.label= Show Selected Element Only
-onlyShowSelectedElement.tooltip= Show Selected Element Only
-onlyShowSelectedElement.description= Show Selected Element Only
-
-smartEnter.label= Insert Line Below Current Line
-smartEnter.description= Adds a new line below the current one
-smartEnterInverse.label= Insert Line Above Current Line
-smartEnterInverse.description= Adds a new line above the current one
-moveLineUp.label= Move Lines Up
-moveLineUp.description= Moves the selected lines upwards
-moveLineDown.label= Move Lines Down
-moveLineDown.description= Moves the selected lines downwards
-copyLineUp.label= Duplicate Lines
-copyLineUp.description= Duplicates the selected lines but leaves the selection
-copyLineDown.label= Copy Lines
-copyLineDown.description= Duplicates the selected lines and moves the selection to the copy
-upperCase.description= Changes the selection to upper case
-upperCase.label= To Upper Case
-lowerCase.description= Changes the selection to lower case
-lowerCase.label= To Lower Case
-
-command.clearMark.description = Clear the mark
-command.clearMark.name = Clear Mark
-command.contentAssistContextInformation.description= Show Context Information
-command.contentAssistContextInformation.name= Context Information
-command.contentAssistProposals.description= Content Assist
-command.contentAssistProposals.name= Content Assist
-command.deleteLine.description = Delete a line of text
-command.deleteLine.name = Delete Line
-command.cutLine.description = Cut a line of text
-command.cutLine.name = Cut Line
-command.deleteLineBeginning.description = Delete to the beginning of a line of text
-command.deleteLineBeginning.name = Delete to Beginning of Line
-command.cutLineBeginning.description = Cut to the beginning of a line of text
-command.cutLineBeginning.name = Cut to Beginning of Line
-command.deleteLineEnd.description = Delete to the end of a line of text
-command.deleteLineEnd.name = Delete to End of Line
-command.cutLineEnd.description = Cut to the end of a line of text
-command.cutLineEnd.name = Cut to End of Line
-command.deleteNext.description = Delete the next character
-command.deleteNext.name = Delete Next
-command.deletePreviousWord.description = Delete the previous word
-command.deletePreviousWord.name = Delete Previous Word
-command.deleteNextWord.description = Delete the next word
-command.deleteNextWord.name = Delete Next Word
-command.deletePrevious.description = Delete the previous character
-command.deletePrevious.name = Delete Previous
-command.findIncremental.description = Incremental find
-command.findIncremental.name = Incremental Find
-command.findIncrementalReverse.description = Incremental find reverse
-command.findIncrementalReverse.name = Incremental Find Reverse
-command.findNext.description = Find next item
-command.findNext.name = Find Next
-command.findPrevious.description = Find previous item
-command.findPrevious.name = Find Previous
-command.goToLine.description = Go to a certain line of text
-command.goToLine.name = Go to Line
-command.lineDown.description = Go down a line of text
-command.lineDown.name = Line Down
-command.lineEnd.description = Go to the end of the line of text
-command.lineEnd.name = Line End
-command.lineStart.description = Go to the start of the line of text
-command.lineStart.name = Line Start
-command.lineUp.description = Go up a line of text
-command.lineUp.name = Line Up
-command.nextColumn.description = Go to the next column
-command.nextColumn.name = Next Column
-command.nextWord.description = Go to the next word
-command.nextWord.name = Next Word
-command.pageDown.description = Go down a page
-command.pageDown.name = Page Down
-command.pageUp.description = Go up a page
-command.pageUp.name = Page Up
-command.previousColumn.description = Go to the previous column
-command.previousColumn.name = Previous Column
-command.previousWord.description = Go to the previous word
-command.previousWord.name = Previous Word
-command.revertToSaved.description = Revert to the state after the most recent save operation
-command.revertToSaved.name = Revert to Saved
-command.scrollLineDown.description = Scroll down a line of text
-command.scrollLineDown.name = Scroll Line Down
-command.scrollLineUp.description = Scroll up a line of text
-command.scrollLineUp.name = Scroll Line Up
-command.selectAll.description = Select all
-command.selectAll.name = Select All
-command.selectLineDown.description = Extend the selection to the next line of text
-command.selectLineDown.name = Select Line Down
-command.selectLineEnd.description = Select to the end of the line of text
-command.selectLineEnd.name = Select Line End
-command.selectLineStart.description = Select to the start of the line of text
-command.selectLineStart.name = Select Line Start
-command.selectLineUp.description = Extend the selection to the previous line of text
-command.selectLineUp.name = Select Line Up
-command.selectNextColumn.description = Select the next column
-command.selectNextColumn.name = Select Next Column
-command.selectPageDown.description = Select to the bottom of the page
-command.selectPageDown.name = Select Page Down
-command.selectPageUp.description = Select to the top of the page
-command.selectPageUp.name = Select Page Up
-command.selectPreviousColumn.description = Select the previous column
-command.selectPreviousColumn.name = Select Previous Column
-command.selectTextEnd.description = Select to the end of the text
-command.selectTextEnd.name = Select Text End
-command.selectTextStart.description = Select to the start of the text
-command.selectTextStart.name = Select Text Start
-command.selectWindowEnd.description = Select to the end of the window
-command.selectWindowEnd.name = Select Window End
-command.selectWindowStart.description = Select to the start of the window
-command.selectWindowStart.name = Select Window Start
-command.selectWordNext.description = Select the next word
-command.selectWordNext.name = Select Next Word
-command.selectWordPrevious.description = Select the previous word
-command.selectWordPrevious.name = Select Previous Word
-command.setMark.description = Set the mark
-command.setMark.name = Set Mark
-command.shiftLeft.description = Shift a block of text to the left
-command.shiftLeft.name = Shift Left
-command.shiftRight.description = Shift a block of text to the right
-command.shiftRight.name = Shift Right
-command.showRulerContextMenu.description = Show the context menu for the ruler
-command.showRulerContextMenu.name = Show Ruler Context Menu
-command.swapMark.description = Swap the mark with the cursor position
-command.swapMark.name = Swap Mark
-command.textEnd.description = Go to the end of the text
-command.textEnd.name = Text End
-command.textStart.description = Go to the start of the text
-command.textStart.name = Text Start
-command.toggleOverwrite.description = Toggle input mode
-command.toggleOverwrite.name = Toggle Overwrite
-command.windowEnd.description = Go to the end of the window
-command.windowEnd.name = Window End
-command.windowStart.description = Go to the start of the window
-command.windowStart.name = Window Start
diff --git a/org.eclipse.ui.workbench.texteditor/plugin.xml b/org.eclipse.ui.workbench.texteditor/plugin.xml
deleted file mode 100644
index 4d66ee4b677..00000000000
--- a/org.eclipse.ui.workbench.texteditor/plugin.xml
+++ /dev/null
@@ -1,1054 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.ui.workbench.texteditor"
- name="%pluginName"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.ui.internal.texteditor.TextEditorPlugin">
-
- <runtime>
- <library name="texteditor.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.ui.texteditor,org.eclipse.ui.internal.texteditor,org.eclipse.ui.texteditor.quickdiff,org.eclipse.ui.internal.texteditor.quickdiff"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.runtime.compatibility" optional="true"/>
- <import plugin="org.eclipse.jface.text"/>
- <import plugin="org.eclipse.ui"/>
- </requires>
-
-
- <extension-point id="quickDiffReferenceProvider" name="%ExtPoint.referenceProvider" schema="schema/quickDiffReferenceProvider.exsd"/>
-
-
- <extension
- point="org.eclipse.ui.commands">
- <category
- name="%category.textEditor.name"
- description="%category.textEditor.description"
- id="org.eclipse.ui.category.textEditor">
- </category>
- <command
- name="%command.deleteLine.name"
- description="%command.deleteLine.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.delete.line">
- </command>
- <command
- name="%command.cutLine.name"
- description="%command.cutLine.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.cut.line">
- </command>
- <command
- name="%command.deleteLineBeginning.name"
- description="%command.deleteLineBeginning.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.delete.line.to.beginning">
- </command>
- <command
- name="%command.cutLineBeginning.name"
- description="%command.cutLineBeginning.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.cut.line.to.beginning">
- </command>
- <command
- name="%command.deleteLineEnd.name"
- description="%command.deleteLineEnd.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.delete.line.to.end">
- </command>
- <command
- name="%command.cutLineEnd.name"
- description="%command.cutLineEnd.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.cut.line.to.end">
- </command>
- <command
- name="%command.setMark.name"
- description="%command.setMark.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.set.mark">
- </command>
- <command
- name="%command.clearMark.name"
- description="%command.clearMark.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.clear.mark">
- </command>
- <command
- name="%command.swapMark.name"
- description="%command.swapMark.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.swap.mark">
- </command>
- <command
- name="%command.findNext.name"
- description="%command.findNext.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.findNext">
- </command>
- <command
- name="%command.findPrevious.name"
- description="%command.findPrevious.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.findPrevious">
- </command>
- <command
- name="%command.findIncremental.name"
- description="%command.findIncremental.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.findIncremental">
- </command>
- <command
- name="%command.findIncrementalReverse.name"
- description="%command.findIncrementalReverse.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.findIncrementalReverse">
- </command>
- <command
- name="%command.revertToSaved.name"
- description="%command.revertToSaved.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.revertToSaved">
- </command>
- <command
- name="%command.lineUp.name"
- description="%command.lineUp.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.lineUp">
- </command>
- <command
- name="%command.lineDown.name"
- description="%command.lineDown.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.lineDown">
- </command>
- <command
- name="%command.lineStart.name"
- description="%command.lineStart.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.lineStart">
- </command>
- <command
- name="%command.lineEnd.name"
- description="%command.lineEnd.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.lineEnd">
- </command>
- <command
- name="%command.goToLine.name"
- description="%command.goToLine.description"
- categoryId="org.eclipse.ui.category.navigate"
- id="org.eclipse.ui.edit.text.goto.line">
- </command>
- <command
- name="%command.previousColumn.name"
- description="%command.previousColumn.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.columnPrevious">
- </command>
- <command
- name="%command.nextColumn.name"
- description="%command.nextColumn.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.columnNext">
- </command>
- <command
- name="%command.pageUp.name"
- description="%command.pageUp.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.pageUp">
- </command>
- <command
- name="%command.pageDown.name"
- description="%command.pageDown.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.pageDown">
- </command>
- <command
- name="%command.previousWord.name"
- description="%command.previousWord.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.wordPrevious">
- </command>
- <command
- name="%command.nextWord.name"
- description="%command.nextWord.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.wordNext">
- </command>
- <command
- name="%command.textStart.name"
- description="%command.textStart.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.textStart">
- </command>
- <command
- name="%command.textEnd.name"
- description="%command.textEnd.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.textEnd">
- </command>
- <command
- name="%command.windowStart.name"
- description="%command.windowStart.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.windowStart">
- </command>
- <command
- name="%command.windowEnd.name"
- description="%command.windowEnd.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.goto.windowEnd">
- </command>
- <command
- name="%command.scrollLineUp.name"
- description="%command.scrollLineUp.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.scroll.lineUp">
- </command>
- <command
- name="%command.scrollLineDown.name"
- description="%command.scrollLineDown.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.scroll.lineDown">
- </command>
- <command
- name="%command.selectLineUp.name"
- description="%command.selectLineUp.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.lineUp">
- </command>
- <command
- name="%command.selectLineDown.name"
- description="%command.selectLineDown.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.lineDown">
- </command>
- <command
- name="%command.selectLineStart.name"
- description="%command.selectLineStart.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.lineStart">
- </command>
- <command
- name="%command.selectLineEnd.name"
- description="%command.selectLineEnd.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.lineEnd">
- </command>
- <command
- name="%command.selectPreviousColumn.name"
- description="%command.selectPreviousColumn.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.columnPrevious">
- </command>
- <command
- name="%command.selectNextColumn.name"
- description="%command.selectNextColumn.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.columnNext">
- </command>
- <command
- name="%command.selectPageUp.name"
- description="%command.selectPageUp.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.pageUp">
- </command>
- <command
- name="%command.selectPageDown.name"
- description="%command.selectPageDown.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.pageDown">
- </command>
- <command
- name="%command.selectWordPrevious.name"
- description="%command.selectWordPrevious.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.wordPrevious">
- </command>
- <command
- name="%command.selectWordNext.name"
- description="%command.selectWordNext.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.wordNext">
- </command>
- <command
- name="%command.selectTextStart.name"
- description="%command.selectTextStart.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.textStart">
- </command>
- <command
- name="%command.selectTextEnd.name"
- description="%command.selectTextEnd.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.textEnd">
- </command>
- <command
- name="%command.selectWindowStart.name"
- description="%command.selectWindowStart.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.windowStart">
- </command>
- <command
- name="%command.selectWindowEnd.name"
- description="%command.selectWindowEnd.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.select.windowEnd">
- </command>
- <command
- name="%command.deletePrevious.name"
- description="%command.deletePrevious.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.deletePrevious">
- </command>
- <command
- name="%command.deleteNext.name"
- description="%command.deleteNext.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.deleteNext">
- </command>
- <command
- name="%command.deletePreviousWord.name"
- description="%command.deletePreviousWord.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.deletePreviousWord">
- </command>
- <command
- name="%command.deleteNextWord.name"
- description="%command.deleteNextWord.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.deleteNextWord">
- </command>
- <command
- name="%command.shiftRight.name"
- description="%command.shiftRight.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.shiftRight">
- </command>
- <command
- name="%command.shiftLeft.name"
- description="%command.shiftLeft.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.shiftLeft">
- </command>
- <command
- name="%command.toggleOverwrite.name"
- description="%command.toggleOverwrite.description"
- categoryId="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.toggleOverwrite">
- </command>
- <command
- name="%command.showRulerContextMenu.name"
- description="%command.showRulerContextMenu.description"
- categoryId="org.eclipse.ui.category.window"
- id="org.eclipse.ui.edit.text.showRulerContextMenu">
- </command>
- <command
- name="%goToLastEditPosition.label"
- description="%goToLastEditPosition.description"
- category="org.eclipse.ui.category.navigate"
- id="org.eclipse.ui.edit.text.gotoLastEditPosition">
- </command>
- <command
- name="%smartEnter.label"
- description="%smartEnter.description"
- category="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.smartEnter">
- </command>
- <command
- name="%smartEnterInverse.label"
- description="%smartEnterInverse.description"
- category="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.smartEnterInverse">
- </command>
- <command
- name="%moveLineUp.label"
- description="%moveLineUp.description"
- category="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.moveLineUp">
- </command>
- <command
- name="%moveLineDown.label"
- description="%moveLineDown.description"
- category="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.moveLineDown">
- </command>
- <command
- name="%copyLineUp.label"
- description="%copyLineUp.description"
- category="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.copyLineUp">
- </command>
- <command
- name="%copyLineDown.label"
- description="%copyLineDown.description"
- category="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.copyLineDown">
- </command>
- <command
- name="%upperCase.label"
- description="%upperCase.description"
- category="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.upperCase">
- </command>
- <command
- name="%lowerCase.label"
- description="%lowerCase.description"
- category="org.eclipse.ui.category.textEditor"
- id="org.eclipse.ui.edit.text.lowerCase">
- </command>
- <command
- name="%onlyShowSelectedElement.label"
- description="%onlyShowSelectedElement.description"
- category="org.eclipse.ui.category.window"
- id="org.eclipse.ui.edit.text.toggleShowSelectedElementOnly">
- </command>
- <command
- name="%command.contentAssistProposals.name"
- description="%command.contentAssistProposals.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.contentAssist.proposals">
- </command>
- <command
- name="%command.contentAssistContextInformation.name"
- description="%command.contentAssistContextInformation.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.ui.edit.text.contentAssist.contextInformation">
- </command>
-
- <keyBinding
- commandId="org.eclipse.ui.edit.text.delete.line"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+E">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.delete.line.to.end"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Shift+E">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.findNext"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+K">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.findPrevious"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Shift+K">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.findIncremental"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+J">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.findIncrementalReverse"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Shift+J">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.line"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+L">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.scroll.lineUp"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Arrow_Up">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.scroll.lineDown"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Arrow_Down">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.toggleOverwrite"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Insert">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.showRulerContextMenu"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+W">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.contentAssist.proposals"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Space">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.contentAssist.contextInformation"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Shift+Space">
- </keyBinding>
- <keyBinding
- string="Ctrl+Q"
- scope="org.eclipse.ui.globalScope"
- command="org.eclipse.ui.edit.text.gotoLastEditPosition"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Shift+ENTER"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.smartEnter"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Ctrl+Shift+ENTER"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.smartEnterInverse"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Alt+ARROW_UP"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.moveLineUp"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Alt+ARROW_DOWN"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.moveLineDown"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Alt+Ctrl+ARROW_UP"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.copyLineUp"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Alt+Ctrl+ARROW_DOWN"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.copyLineDown"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Ctrl+Shift+X"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.upperCase"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Ctrl+Shift+Y"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.lowerCase"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string=""
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.toggleShowSelectedElementOnly"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Ctrl+Arrow_Right"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.goto.wordNext"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Ctrl+Arrow_Left"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.goto.wordPrevious"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Ctrl+Delete"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.deleteNextWord"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Ctrl+Backspace"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.deletePreviousWord"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Ctrl+Shift+Arrow_Right"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.select.wordNext"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- string="Ctrl+Shift+Arrow_Left"
- scope="org.eclipse.ui.textEditorScope"
- command="org.eclipse.ui.edit.text.select.wordPrevious"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- locale="zh"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Space">
- </keyBinding>
- <keyBinding
- locale="zh"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Shift+Space">
- </keyBinding>
- <keyBinding
- locale="zh"
- commandId="org.eclipse.ui.edit.text.contentAssist.proposals"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Alt+/">
- </keyBinding>
- <keyBinding
- locale="zh"
- commandId="org.eclipse.ui.edit.text.contentAssist.contextInformation"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Alt+?">
- </keyBinding>
- <keyBinding
- locale="zh"
- commandId="org.eclipse.ui.edit.text.contentAssist.contextInformation"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Alt+Shift+?">
- </keyBinding>
- <keyBinding
- platform="carbon"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+E">
- </keyBinding>
- <keyBinding
- platform="carbon"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Shift+E">
- </keyBinding>
- <keyBinding
- platform="carbon"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+K">
- </keyBinding>
- <keyBinding
- platform="carbon"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Shift+K">
- </keyBinding>
- <keyBinding
- platform="carbon"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+J">
- </keyBinding>
- <keyBinding
- platform="carbon"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Shift+J">
- </keyBinding>
- <keyBinding
- platform="carbon"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+L">
- </keyBinding>
- <keyBinding
- platform="carbon"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Arrow_Up">
- </keyBinding>
- <keyBinding
- platform="carbon"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Ctrl+Arrow_Down">
- </keyBinding>
- <keyBinding
- platform="carbon"
- commandId="org.eclipse.ui.edit.text.delete.line"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Command+E">
- </keyBinding>
- <keyBinding
- platform="carbon"
- commandId="org.eclipse.ui.edit.text.delete.line.to.end"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Command+Shift+E">
- </keyBinding>
- <keyBinding
- platform="carbon"
- commandId="org.eclipse.ui.edit.findNext"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Command+K">
- </keyBinding>
- <keyBinding
- platform="carbon"
- commandId="org.eclipse.ui.edit.findPrevious"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Command+Shift+K">
- </keyBinding>
- <keyBinding
- platform="carbon"
- commandId="org.eclipse.ui.edit.findIncremental"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Command+J">
- </keyBinding>
- <keyBinding
- platform="carbon"
- commandId="org.eclipse.ui.edit.findIncrementalReverse"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Command+Shift+J">
- </keyBinding>
- <keyBinding
- platform="carbon"
- commandId="org.eclipse.ui.edit.text.goto.line"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Command+L">
- </keyBinding>
- <keyBinding
- platform="carbon"
- commandId="org.eclipse.ui.edit.text.scroll.lineUp"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Command+Arrow_Up">
- </keyBinding>
- <keyBinding
- platform="carbon"
- commandId="org.eclipse.ui.edit.text.scroll.lineDown"
- contextId="org.eclipse.ui.textEditorScope"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Command+Arrow_Down">
- </keyBinding>
- <keyBinding
- platform="carbon"
- commandId="org.eclipse.ui.edit.text.contentAssist.proposals"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Command+Space">
- </keyBinding>
- <keyBinding
- platform="carbon"
- commandId="org.eclipse.ui.edit.text.contentAssist.contextInformation"
- keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
- keySequence="Command+Shift+Space">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.cut.line.to.beginning"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Alt+0 Ctrl+K"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.cut.line.to.beginning"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Esc 0 Ctrl+K"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.cut.line.to.end"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+K"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.set.mark"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+Space"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.set.mark"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+2"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.clear.mark"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+G"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.swap.mark"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+X Ctrl+X"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.findIncremental"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+S"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.findIncrementalReverse"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+R"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.lineUp"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+P"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.lineDown"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+N"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.lineStart"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+A"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.lineEnd"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+E"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.line"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+X G"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.columnPrevious"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+B"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.columnNext"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+F"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.pageUp"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Alt+V"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.pageUp"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Esc V"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.pageDown"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+V"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.wordPrevious"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Alt+B"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.wordPrevious"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Esc B"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.wordNext"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Alt+F"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.wordNext"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Esc F"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.textStart"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Alt+&lt;"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.textStart"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Alt+Shift+&lt;"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.textStart"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Esc &lt;"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.textStart"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Esc Shift+&lt;"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.textStart"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+X ["
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.textEnd"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Alt+&gt;"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.textEnd"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Alt+Shift+&gt;"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.textEnd"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Esc &gt;"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.textEnd"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Esc Shift+&gt;"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.goto.textEnd"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+X ]"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.scroll.lineUp"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Alt+Z"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.scroll.lineUp"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Esc Z"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.scroll.lineDown"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+Z"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.deleteNext"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Ctrl+D"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.deletePreviousWord"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Alt+Bs"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.deletePreviousWord"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Esc Bs"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.deleteNextWord"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Alt+D"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.deleteNextWord"
- contextId="org.eclipse.ui.textEditorScope"
- keySequence="Esc D"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.contentAssist.proposals"
- keySequence="Alt+/"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.contentAssist.contextInformation"
- keySequence="Alt+?"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- <keyBinding
- commandId="org.eclipse.ui.edit.text.contentAssist.contextInformation"
- keySequence="Alt+Shift+?"
- keyConfigurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
- </keyBinding>
- </extension>
-
- <extension
- point="org.eclipse.ui.actionSets">
- <actionSet
- label="%textEditorPresentationActionSet.label"
- visible="false"
- id="org.eclipse.ui.edit.text.actionSet.presentation">
- <action
- allowLabelUpdate="true"
- style="toggle"
- toolbarPath="Normal/Presentation"
- id="org.eclipse.ui.edit.text.toggleShowSelectedElementOnly"
- hoverIcon="icons/full/ctool16/segment_edit.gif"
- definitionId="org.eclipse.ui.edit.text.toggleShowSelectedElementOnly"
- disabledIcon="icons/full/dtool16/segment_edit.gif"
- icon="icons/full/etool16/segment_edit.gif"
- helpContextId="only_show_selected_element_action_context"
- label="%onlyShowSelectedElement.label"
- retarget="true"
- tooltip="%onlyShowSelectedElement.tooltip">
- </action>
- </actionSet>
- <actionSet
- label="%textEditorNavigationActionSet.label"
- visible="true"
- id="org.eclipse.ui.edit.text.actionSet.navigation">
- <action
- toolbarPath="org.eclipse.ui.workbench.navigate/history.group"
- id="org.eclipse.ui.edit.text.gotoLastEditPosition"
- hoverIcon="icons/full/ctool16/last_edit_pos.gif"
- class="org.eclipse.ui.internal.texteditor.GotoLastEditPositionAction"
- definitionId="org.eclipse.ui.edit.text.gotoLastEditPosition"
- disabledIcon="icons/full/dtool16/last_edit_pos.gif"
- icon="icons/full/etool16/last_edit_pos.gif"
- helpContextId="goto_last_edit_position_action_context"
- label="%goToLastEditPosition.label"
- menubarPath="navigate/"
- tooltip="%goToLastEditPosition.tooltip">
- </action>
- </actionSet>
- </extension>
-</plugin>
diff --git a/org.eclipse.ui.workbench.texteditor/schema/quickDiffReferenceProvider.exsd b/org.eclipse.ui.workbench.texteditor/schema/quickDiffReferenceProvider.exsd
deleted file mode 100644
index 99e175188bd..00000000000
--- a/org.eclipse.ui.workbench.texteditor/schema/quickDiffReferenceProvider.exsd
+++ /dev/null
@@ -1,149 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ui.workbench.texteditor">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.ui.workbench.texteditor" id="quickdiffReferenceProvider" name="Reference Provider"/>
- </appInfo>
- <documentation>
- Allows contributors to add reference providers for the quick diff display.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="referenceprovider" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- The fully qualified name of the extension point.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- The optional id of this extension.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- The optional name of this extension.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="referenceprovider">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="name"/>
- </appInfo>
- <documentation>
- The definition of a reference provider for the quick diff display.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The class of the reference provider, which must implement &lt;code&gt;org.eclipse.ui.editors.quickdiff.IQuickDiffProviderImplementation&lt;/code&gt;.
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="label" type="string">
- <annotation>
- <documentation>
- The display label for the provider, which will show up in the menu that allows the user to set the quick diff reference to this provider.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- A string uniquely identifying this reference provider.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="default" type="boolean">
- <annotation>
- <documentation>
- If this flag is set to &lt;code&gt;true&lt;/code&gt;, this reference provider will be installed per default the first time quick diff is enabled for a document. If multiple providers are installed with the flag set are encountered, the first one is taken.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a reference provider definition. It contributes a provider that uses the version of a document saved on disk as a reference.
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;quickdiff.referenceprovider&quot;&gt;
- &lt;referenceprovider
- id=&quot;default&quot;
- name=&quot;%LastSavedProvider.name&quot;
- label=&quot;%quickdiff.referenceprovider.label&quot;
- class=&quot;org.eclipse.ui.internal.editors.quickdiff.providers.LastSaveReferenceProvider&quot;&gt;
- &lt;/referenceprovider&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- There is no additional API for managing reference providers.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The &lt;code&gt;org.eclipse.ui.editors&lt;/code&gt; plugin contributes &lt;code&gt;LastSaveReferenceProvider&lt;/code&gt;. See its implementation as an example.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- &lt;p&gt;
-&lt;a href=&quot;hglegal.htm&quot;&gt;
- &lt;img SRC=&quot;ngibmcpy.gif&quot;
- ALT=&quot;Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.&quot;
- BORDER=0 height=14 width=324&gt;&lt;/a&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.ui.workbench.texteditor/scripts/exportplugin.xml b/org.eclipse.ui.workbench.texteditor/scripts/exportplugin.xml
deleted file mode 100644
index f6a1c5c7369..00000000000
--- a/org.eclipse.ui.workbench.texteditor/scripts/exportplugin.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<project name="Export Workbench Text Editor Fragment" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.ui.workbench.texteditor" />
- <property name="version" value="_3.0.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}/texteditor.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <copy todir= "${dest}/icons">
- <fileset dir="icons"/>
- </copy>
- <zip zipfile="${dest}/texteditorsrc.jar">
- <fileset dir="src" />
- </zip>
- </target>
-
-</project> \ No newline at end of file
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditPosition.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditPosition.java
deleted file mode 100644
index e3daef79e19..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditPosition.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.ui.internal.texteditor;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.ui.IEditorInput;
-
-/**
- * Data structure representing an edit position.
- *
- * @since 2.1
- */
-public final class EditPosition {
-
- /** The editor input */
- private final IEditorInput fEditorInput;
- /** The editor ID */
- private final String fEditorId;
- /** The selection */
- private final ISelection fSelection;
- /** The position */
- private final Position fPosition;
-
- /**
- * Creates a new edit position.
- *
- * @param editorInput the editor input
- * @param editorId the editor ID
- * @param selection the selection
- * @param pos the position
- */
- public EditPosition(IEditorInput editorInput, String editorId, ISelection selection, Position pos) {
- Assert.isNotNull(editorInput);
- Assert.isNotNull(editorId);
- fEditorId= editorId;
- fEditorInput= editorInput;
- fSelection= selection;
- fPosition= pos;
- }
-
- /**
- * Returns the editor input for this edit position.
- *
- * @return the editor input of this edit position
- */
- IEditorInput getEditorInput() {
- return fEditorInput;
- }
-
- /**
- * Returns the editor id for this edit position.
- *
- * @return the editor input of this edit position
- */
- String getEditorId() {
- return fEditorId;
- }
-
- /**
- * Returns the selection of this edit position.
- *
- * @return the selection of this edit position
- */
- ISelection getSelection() {
- return fSelection;
- }
-
- /**
- * Returns the the position.
- *
- * @return the position
- */
- Position getPosition() {
- return fPosition;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.java
deleted file mode 100644
index c3eba1dc61d..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.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.internal.texteditor;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class EditorMessages {
-
- private static final String RESOURCE_BUNDLE= EditorMessages.class.getName();
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private EditorMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.properties b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.properties
deleted file mode 100644
index 0406b7e221a..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/EditorMessages.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
-###############################################################################
-
-
-## Errors ##
-
-Editor.error.gotoLastEditPosition.title= Problems going to last edit position
-Editor.error.gotoLastEditPosition.message= Unable to go to the last edit position.
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/GotoLastEditPositionAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/GotoLastEditPositionAction.java
deleted file mode 100644
index f53853b3543..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/GotoLastEditPositionAction.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.internal.texteditor;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.jface.text.Position;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-
-/**
- * Goes to last edit position.
- *
- * @see org.eclipse.ui.internal.texteditor.EditPosition
- * @since 2.1
- */
-public class GotoLastEditPositionAction extends Action implements IWorkbenchWindowActionDelegate {
-
- /** The worbench window */
- private IWorkbenchWindow fWindow;
- /** The action */
- private IAction fAction;
-
- /**
- * Creates a goto last edit action.
- */
- public GotoLastEditPositionAction() {
- WorkbenchHelp.setHelp(this, IAbstractTextEditorHelpContextIds.GOTO_LAST_EDIT_POSITION_ACTION);
- setId(ITextEditorActionDefinitionIds.GOTO_LAST_EDIT_POSITION);
- setActionDefinitionId(ITextEditorActionDefinitionIds.GOTO_LAST_EDIT_POSITION);
- setEnabled(false);
- }
-
- /*
- * @see IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- fWindow= window;
- }
-
- /*
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- run();
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- EditPosition editPosition= TextEditorPlugin.getDefault().getLastEditPosition();
- if (editPosition == null)
- return;
-
- final Position pos= editPosition.getPosition();
- if (pos == null || pos.isDeleted)
- return;
-
- IWorkbenchWindow window= getWindow();
- if (window == null)
- return;
-
- IWorkbenchPage page= window.getActivePage();
-
- IEditorPart editor;
- try {
- editor= page.openEditor(editPosition.getEditorInput(), editPosition.getEditorId());
- } catch (PartInitException ex) {
- editor= null;
- }
-
- // Optimization - could also use else branch
- if (editor instanceof ITextEditor) {
- ITextEditor textEditor= (ITextEditor)editor;
- textEditor.selectAndReveal(pos.offset, pos.length);
- }
-// } else
-// if (editor != null) {
-// final IEditorInput input= editor.getEditorInput();
-// final IEditorPart finalEditor= editor;
-// if (input instanceof IFileEditorInput) {
-//
-// WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
-// protected void execute(IProgressMonitor monitor) throws CoreException {
-// IMarker marker= null;
-// try {
-// marker= ((IFileEditorInput)input).getFile().createMarker(IMarker.TEXT);
-// marker.setAttribute(IMarker.CHAR_START, pos.offset);
-// marker.setAttribute(IMarker.CHAR_END, pos.offset + pos.length);
-//
-// finalEditor.gotoMarker(marker);
-//
-// } finally {
-// if (marker != null)
-// marker.delete();
-// }
-// }
-// };
-//
-// try {
-// op.run(null);
-// } catch (InvocationTargetException ex) {
-// String message= EditorMessages.getString("Editor.error.gotoLastEditPosition.message"); //$NON-NLS-1$
-// if (fWindow != null) {
-// Shell shell= fWindow.getShell();
-// String title= EditorMessages.getString("Editor.error.gotoLastEditPosition.title"); //$NON-NLS-1$
-// MessageDialog.openError(shell, title, message);
-// } else {
-// Throwable t= ex.getTargetException();
-// IStatus status= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, t);
-// TextEditorPlugin.getDefault().getLog().log(status);
-// }
-// } catch (InterruptedException e) {
-// Assert.isTrue(false, "this operation can not be cancelled"); //$NON-NLS-1$
-// }
-// }
-// editor.setFocus();
-// }
- }
-
- /*
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- boolean enabled= TextEditorPlugin.getDefault().getLastEditPosition() != null;
- setEnabled(enabled);
- action.setEnabled(enabled);
-
- // This is no longer needed once the action is enabled.
- if (!enabled) {
- // adding the same action twice has no effect.
- TextEditorPlugin.getDefault().addLastEditPositionDependentAction(action);
- // this is always the same action for this instance
- fAction= action;
- }
- }
-
- /**
- * Returns the workbench window.
- *
- * @return the workbench window
- */
- private IWorkbenchWindow getWindow() {
- if (fWindow == null)
- fWindow= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- return fWindow;
- }
-
- /*
- * @see IWorkbenchWindowActionDelegate#dispose()
- */
- public void dispose() {
- fWindow= null;
- TextEditorPlugin.getDefault().removeLastEditPositionDependentAction(fAction);
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/TextEditorPlugin.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/TextEditorPlugin.java
deleted file mode 100644
index 468ce956eb5..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/TextEditorPlugin.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.ui.internal.texteditor;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IPluginDescriptor;
-
-import org.eclipse.jface.action.IAction;
-
-import org.eclipse.jface.text.Assert;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The plug-in runtime class for the text editor UI plug-in (id <code>"org.eclipse.ui.workbench.texteditor"</code>).
- * This class provides static methods for:
- * <ul>
- * <li> getting the last editor position.</li>
- * </ul>
- * <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 TextEditorPlugin extends AbstractUIPlugin {
-
- /** The plugin instance */
- private static TextEditorPlugin fgPlugin;
-
- /** The last edit position */
- private EditPosition fLastEditPosition;
- /** The action which goes to the last edit position */
- private Set fLastEditPositionDependentActions;
-
-
- /**
- * Creates a plug-in instance.
- *
- * @param descriptor the plug-in descriptor
- */
- public TextEditorPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- Assert.isTrue(fgPlugin == null);
- fgPlugin= this;
- }
-
- /**
- * Returns the plug-in instance.
- *
- * @return the text editor plug-in instance
- */
- public static TextEditorPlugin getDefault() {
- return fgPlugin;
- }
-
- /**
- * Text editor UI plug-in Id (value <code>"org.eclipse.ui.workbench.texteditor"</code>).
- */
- public static final String PLUGIN_ID= "org.eclipse.ui.workbench.texteditor"; //$NON-NLS-1$
-
- /**
- * Returns the last edit position.
- *
- * @return the last edit position or <code>null</code> if there is no last edit position
- * @see EditPosition
- */
- EditPosition getLastEditPosition() {
- return fLastEditPosition;
- }
-
- /**
- * Sets the last edit position.
- *
- * @param lastEditPosition the last edit position
- * @see EditPosition
- */
- public void setLastEditPosition(EditPosition lastEditPosition) {
- fLastEditPosition= lastEditPosition;
- if (fLastEditPosition != null && fLastEditPositionDependentActions != null) {
- Iterator iter= fLastEditPositionDependentActions.iterator();
- while (iter.hasNext())
- ((IAction)iter.next()).setEnabled(true);
- fLastEditPositionDependentActions= null;
- }
- }
-
- /**
- * Adds the given action to the last edit position dependent actions.
- *
- * @param action the goto last edit position action
- */
- void addLastEditPositionDependentAction(IAction action) {
- if (fLastEditPosition != null)
- return;
- if (fLastEditPositionDependentActions == null)
- fLastEditPositionDependentActions= new HashSet();
- fLastEditPositionDependentActions.add(action);
- }
-
- /**
- * Removes the given action from the last edit position dependent actions.
- *
- * @param action the action that depends on the last edit position
- */
- void removeLastEditPositionDependentAction(IAction action) {
- if (fLastEditPosition != null)
- return;
- if (fLastEditPositionDependentActions != null)
- fLastEditPositionDependentActions.remove(action);
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DocumentLineDiffer.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DocumentLineDiffer.java
deleted file mode 100644
index dc5a6989eea..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DocumentLineDiffer.java
+++ /dev/null
@@ -1,1349 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.texteditor.quickdiff;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.AnnotationModelEvent;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationModelListener;
-import org.eclipse.jface.text.source.IAnnotationModelListenerExtension;
-import org.eclipse.jface.text.source.ILineDiffInfo;
-import org.eclipse.jface.text.source.ILineDiffer;
-
-import org.eclipse.ui.texteditor.quickdiff.IQuickDiffReferenceProvider;
-
-import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
-import org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.DocLineComparator;
-import org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.RangeDifference;
-import org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.RangeDifferencer;
-
-/**
- * Standard implementation of <code>ILineDiffer</code> as an incremental diff engine. A
- * <code>DocumentLineDiffer</code> can be initialized to some start state. Once connected to a
- * <code>IDocument</code> and a reference document has been set, changes reported via the
- * <code>IDocumentListener</code> interface will be tracked and the incremental diff updated.
- *
- * <p>The diff state can be queried using the <code>ILineDiffer</code> interface.</p>
- *
- * <p>Since diff information is model information attached to a document, this class implements
- * <code>IAnnotationModel</code> and can be attached to <code>IAnnotationModelExtension</code>s.</p>
- *
- * <p>This class is not supposed to be subclassed.</p>
- *
- * @since 3.0
- * @see IAnnotationModelExtension
- * @see DiffInitializer
- */
-public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnnotationModel {
-
- /**
- * The local implementation of <code>ILineDiffInfo</code>. As instances are also <code>Annotation</code>s,
- * they can be used in <code>DocumentLineDiffer</code>s <code>IAnnotationModel</code> protocol.
- */
- private final class DiffRegion extends Annotation implements ILineDiffInfo {
-
- private RangeDifference fDifference;
- private int fOffset;
-
- DiffRegion(RangeDifference difference, int offset) {
- super("org.eclipse.ui.workbench.texteditor.quickdiffChange", false, null); //$NON-NLS-1$
- fOffset= offset;
- fDifference= difference;
- }
-
- /*
- * @see org.eclipse.jface.text.source.Annotation#getType()
- */
- public String getType() {
- // we return unknown for unchanged regions to avoid
- // them getting displayed.
- switch (getChangeType()) {
- case CHANGED:
- return "org.eclipse.ui.workbench.texteditor.quickdiffChange"; //$NON-NLS-1$
- case ADDED:
- return "org.eclipse.ui.workbench.texteditor.quickdiffAddition"; //$NON-NLS-1$
- default: // and UNCHANGED
- return TYPE_UNKNOWN;
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.ILineDiffInfo#getRemovedLinesBelow()
- */
- public int getRemovedLinesBelow() {
- if (fOffset == fDifference.rightLength() - 1) {
- if (getChangeType() != UNCHANGED) {
- return Math.max(fDifference.leftLength() - fDifference.rightLength(), 0);
- } else {
- for (ListIterator it= fDifferences.listIterator(); it.hasNext();) {
- if (fDifference.equals(it.next())) {
- if (it.hasNext()) {
- RangeDifference next= (RangeDifference) it.next();
- if (next.rightLength() == 0)
- return Math.max(next.leftLength() - next.rightLength(), 0);
- }
- return 0;
- }
- }
- return 0;
- }
- } else
- return 0;
- }
-
- /*
- * @see org.eclipse.jface.text.source.ILineDiffInfo#getChangeType()
- */
- public int getChangeType() {
- if (fDifference.kind() == RangeDifference.NOCHANGE)
- return UNCHANGED;
- else {
- if (fOffset >= fDifference.leftLength())
- return ADDED;
- else
- return CHANGED;
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.ILineDiffInfo#getRemovedLinesAbove()
- */
- public int getRemovedLinesAbove() {
- if (getChangeType() != UNCHANGED || fOffset != 0)
- return 0;
- else {
- for (ListIterator it= fDifferences.listIterator(fDifferences.size()); it.hasPrevious();) {
- if (fDifference.equals(it.previous())) {
- if (it.hasPrevious()) {
- RangeDifference previous= (RangeDifference) it.previous();
- return Math.max(previous.leftLength() - previous.rightLength(), 0);
- } else
- return 0;
- }
- }
- return 0;
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.ILineDiffInfo#hasChanges()
- */
- public boolean hasChanges() {
- return getChangeType() != UNCHANGED || getRemovedLinesAbove() > 0 || getRemovedLinesBelow() > 0;
- }
-
- /*
- * @see org.eclipse.jface.text.source.ILineDiffInfo#getOriginalText()
- */
- public String[] getOriginalText() {
- IDocument doc= fLeftDocument;
- if (doc != null) {
- int startLine= fDifference.leftStart() + fOffset;
-
- if (startLine >= fDifference.leftEnd())
- return new String[0]; // original text of an added line is empty
-
- int endLine= startLine + getRemovedLinesBelow();
-
- if (getChangeType() == UNCHANGED)
- startLine++;
-
- String[] ret= new String[endLine - startLine + 1];
-
- for (int i= 0; i < ret.length; i++) {
- try {
- ret[i]= doc.get(doc.getLineOffset(startLine + i), doc.getLineLength(startLine + i));
- } catch (BadLocationException e) {
- ret[i]= new String();
- }
- }
-
- return ret;
- }
-
- // in initialization phase?
- return new String[0];
- }
-
- /*
- * @see org.eclipse.jface.text.source.Annotation#getText()
- */
- public String getText() {
- int r= fDifference.rightLength();
- int l= fDifference.leftLength();
- int c= Math.min(r, l);
- int a= r - l;
- String changed= c > 0 ? QuickDiffMessages.getFormattedString("quickdiff.annotation.changed", new Integer(c)) : null; //$NON-NLS-1$
- String added;
- if (a > 0)
- added= QuickDiffMessages.getFormattedString("quickdiff.annotation.added", new Integer(a)); //$NON-NLS-1$
- else if (a < 0)
- added= QuickDiffMessages.getFormattedString("quickdiff.annotation.deleted", new Integer(-a)); //$NON-NLS-1$
- else
- added= null;
-
- String line= c > 1 || c == 0 && Math.abs(a) > 1 ? QuickDiffMessages.getString("quickdiff.annotation.line_plural") : QuickDiffMessages.getString("quickdiff.annotation.line_singular"); //$NON-NLS-1$//$NON-NLS-2$
-
- String ret= (changed != null ? changed : "") + (changed != null ? " " + line : "") + (changed != null && added != null ? ", " : " ") + (added != null ? added : "") + (added != null && changed == null ? " " + line : ""); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
- return ret;
-
- }
- }
-
- /** The provider for the reference document. */
- IQuickDiffReferenceProvider fReferenceProvider;
- /** Whether this differ is in sync with the model. */
- private boolean fIsSynchronized;
- /** The number of clients connected to this model. */
- private int fOpenConnections;
- /** The current document being tracked. */
- private IDocument fLeftDocument;
- /** The reference document. */
- private IDocument fRightDocument;
- /**
- * Flag to indicate whether a change has been made to the line table and any clients should
- * update their presentation.
- */
- private boolean fUpdateNeeded;
- /** The listeners on this annotation model. */
- private List fAnnotationModelListeners= new ArrayList();
- /** The job currently initializing the differ, or <code>null</code> if there is none. */
- private Job fInitializationJob;
- /** Stores <code>DocumentEvents</code> while an initialization is going on. */
- private List fStoredEvents= new ArrayList();
- /** The differences between <code>fLeftDocument</code> and <code>fRightDocument</code>. */
- private List fDifferences= new ArrayList();
- /** The first line affected by a document event. */
- private int fFirstLine;
- /** The number of lines affected by a document event. */
- private int fNLines;
- /** The most recent range difference returned in a getLineInfo call, so it can be recyled. */
- private RangeDifference fLastDifference;
-
- /**
- * Creates a new differ.
- */
- public DocumentLineDiffer() {
- }
-
- /* ILineDiffer implementation */
-
- /*
- * @see org.eclipse.jface.text.source.ILineDiffer#getLineInfo(int)
- */
- public ILineDiffInfo getLineInfo(int line) {
-
- RangeDifference last= fLastDifference;
- if (last != null && last.rightStart() <= line && last.rightEnd() > line)
- return new DiffRegion(last, line - last.rightStart());
-
- fLastDifference= getRangeDifferenceForRightLine(line);
- last= fLastDifference;
- if (last != null)
- return new DiffRegion(last, line - last.rightStart());
- else
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.source.ILineDiffer#revertLine(int)
- */
- public synchronized void revertLine(int line) throws BadLocationException {
- if (!isInitialized())
- throw new BadLocationException(QuickDiffMessages.getString("quickdiff.nonsynchronized")); //$NON-NLS-1$
-
- DiffRegion region= (DiffRegion) getLineInfo(line);
- if (region == null || fRightDocument == null || fLeftDocument == null)
- return;
-
- RangeDifference diff= region.fDifference;
- int rOffset= fRightDocument.getLineOffset(line);
- int rLength= fRightDocument.getLineLength(line);
- int leftLine= diff.leftStart() + region.fOffset;
- String replacement;
- if (leftLine >= diff.leftEnd()) // restoring a deleted line?
- replacement= new String();
- else {
- int lOffset= fLeftDocument.getLineOffset(leftLine);
- int lLength= fLeftDocument.getLineLength(leftLine);
- replacement= fLeftDocument.get(lOffset, lLength);
- }
- fRightDocument.replace(rOffset, rLength, replacement);
- }
-
- /*
- * @see org.eclipse.jface.text.source.ILineDiffer#revertBlock(int)
- */
- public synchronized void revertBlock(int line) throws BadLocationException {
- if (!isInitialized())
- throw new BadLocationException(QuickDiffMessages.getString("quickdiff.nonsynchronized")); //$NON-NLS-1$
-
- DiffRegion region= (DiffRegion) getLineInfo(line);
- if (region == null || fRightDocument == null || fLeftDocument == null)
- return;
-
- RangeDifference diff= region.fDifference;
- int rOffset= fRightDocument.getLineOffset(diff.rightStart());
- int rLength= fRightDocument.getLineOffset(diff.rightEnd() - 1) + fRightDocument.getLineLength(diff.rightEnd() - 1) - rOffset;
- int lOffset= fLeftDocument.getLineOffset(diff.leftStart());
- int lLength= fLeftDocument.getLineOffset(diff.leftEnd() - 1) + fLeftDocument.getLineLength(diff.leftEnd() - 1) - lOffset;
- fRightDocument.replace(rOffset, rLength, fLeftDocument.get(lOffset, lLength));
- }
-
- /*
- * @see org.eclipse.jface.text.source.ILineDiffer#revertSelection(int, int)
- */
- public synchronized void revertSelection(int line, int nLines) throws BadLocationException {
- if (!isInitialized())
- throw new BadLocationException(QuickDiffMessages.getString("quickdiff.nonsynchronized")); //$NON-NLS-1$
-
- int rOffset= -1, rLength= -1, lOffset= -1, lLength= -1;
- RangeDifference diff= null;
- Iterator it= fDifferences.iterator();
-
- // get start
- while (it.hasNext()) {
- diff= (RangeDifference) it.next();
- if (line < diff.rightEnd()) {
- rOffset= fRightDocument.getLineOffset(line);
- int leftLine= Math.min(diff.leftStart() + line - diff.rightStart(), diff.leftEnd() - 1);
- lOffset= fLeftDocument.getLineOffset(leftLine);
- break;
- }
- }
-
- if (rOffset == -1 || lOffset == -1)
- return;
-
- // get end / length
- int to= line + nLines - 1;
- while (it.hasNext()) {
- diff= (RangeDifference) it.next();
- if (to < diff.rightEnd()) {
- int rEndOffset= fRightDocument.getLineOffset(to) + fRightDocument.getLineLength(to);
- rLength= rEndOffset - rOffset;
- int leftLine= Math.min(diff.leftStart() + to - diff.rightStart(), diff.leftEnd() - 1);
- int lEndOffset= fLeftDocument.getLineOffset(leftLine) + fLeftDocument.getLineLength(leftLine);
- lLength= lEndOffset - lOffset;
- break;
- }
- }
-
- if (rLength == -1 || lLength == -1)
- return;
-
- fRightDocument.replace(rOffset, rLength, fLeftDocument.get(lOffset, lLength));
- }
-
- /*
- * @see org.eclipse.jface.text.source.ILineDiffer#restoreAfterLine(int)
- */
- public synchronized int restoreAfterLine(int line) throws BadLocationException {
- if (!isInitialized())
- throw new BadLocationException(QuickDiffMessages.getString("quickdiff.nonsynchronized")); //$NON-NLS-1$
-
- DiffRegion region= (DiffRegion) getLineInfo(line);
- if (region == null || fRightDocument == null || fLeftDocument == null)
- return 0;
-
- if (region.getRemovedLinesBelow() < 1)
- return 0;
-
- RangeDifference diff= null;
- for (Iterator it= fDifferences.iterator(); it.hasNext();) {
- diff= (RangeDifference) it.next();
- if (line >= diff.rightStart() && line < diff.rightEnd()) {
- if (diff.kind() == RangeDifference.NOCHANGE && it.hasNext())
- diff= (RangeDifference) it.next();
- break;
- }
- }
-
- if (diff == null)
- return 0;
-
- int rOffset= fRightDocument.getLineOffset(diff.rightEnd());
- int rLength= 0;
- int leftLine= diff.leftStart() + diff.rightLength();
- int lOffset= fLeftDocument.getLineOffset(leftLine);
- int lLength= fLeftDocument.getLineOffset(diff.leftEnd() - 1) + fLeftDocument.getLineLength(diff.leftEnd() - 1) - lOffset;
- fRightDocument.replace(rOffset, rLength, fLeftDocument.get(lOffset, lLength));
-
- return diff.leftLength() - diff.rightLength();
- }
-
- /**
- * Returns the receivers initialization state.
- *
- * @return <code>true</code> if we are initialized and in sync with the document.
- */
- private boolean isInitialized() {
- return fIsSynchronized;
- }
-
- /**
- * Returns the receivers synchronization state.
- *
- * @return <code>true</code> if we are initialized and in sync with the document.
- */
- public synchronized boolean isSynchronized() {
- return fIsSynchronized;
- }
-
- /**
- * Sets the reference provider for this instance. If one has been installed before, it is
- * disposed.
- *
- * @param provider the new provider
- */
- public void setReferenceProvider(IQuickDiffReferenceProvider provider) {
- Assert.isNotNull(provider);
- if (provider != fReferenceProvider) {
- if (fReferenceProvider != null)
- fReferenceProvider.dispose();
- fReferenceProvider= provider;
- initialize();
- }
- }
-
- /**
- * Returns the reference provider currently installed, or <code>null</code> if none is installed.
- *
- * @return the current reference provider.
- */
- public IQuickDiffReferenceProvider getReferenceProvider() {
- return fReferenceProvider;
- }
-
- /**
- * (Re-)initializes the differ using the current reference and <code>DiffInitializer</code>
- */
- synchronized void initialize() {
- // make new incoming changes go into the queue of stored events, plus signal we can't restore.
- fIsSynchronized= false;
-
- if (fRightDocument == null)
- return;
-
- // there is no point in receiving updates before the job we get a new copy of the document for diffing
- fRightDocument.removeDocumentListener(this);
-
- if (fLeftDocument != null) {
- fLeftDocument.removeDocumentListener(this);
- fLeftDocument= null;
- }
-
- // if there already is a job:
- // return if it has not started yet, cancel it if already running
- final Job oldJob= fInitializationJob;
- if (oldJob != null) {
- // don't chain up jobs if there is one waiting already.
- if (oldJob.getState() == Job.WAITING)
- return;
- else
- oldJob.cancel();
- }
-
- fInitializationJob= new Job(QuickDiffMessages.getString("quickdiff.initialize")) { //$NON-NLS-1$
-
- /*
- * This is run in a different thread. As the documents might be synchronized, never ever
- * access the documents in a synchronized section or expect deadlocks. See
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44692
- */
- public IStatus run(IProgressMonitor monitor) {
-
- // 1: wait for any previous job that was canceled to avoid job flooding
- // It will return relatively quickly as RangeDifferencer supports canceling
- if (oldJob != null)
- try {
- oldJob.join();
- } catch (InterruptedException e) {
- // will not happen as noone interrupst our thread
- Assert.isTrue(false);
- }
-
-
- // 2: get the reference document
- IQuickDiffReferenceProvider provider= fReferenceProvider;
- final IDocument left;
- try {
- left= provider == null ? null : provider.getReference(monitor);
- } catch (CoreException e) {
- synchronized (DocumentLineDiffer.this) {
- if (isCanceled(monitor))
- return Status.CANCEL_STATUS;
- else {
- clearModel();
- fireModelChanged();
- DocumentLineDiffer.this.notifyAll();
- return e.getStatus();
- }
- }
- } catch (OperationCanceledException e) {
- return Status.CANCEL_STATUS;
- }
-
- // Getting our own copies of the documents for offline diffing.
- //
- // We need to make sure that we do get all document modifications after
- // copying the documents as we want to reinject them later on to become consistent.
- //
- // Now this is fun. The reference documents may be PartiallySynchronizedDocuments
- // which will result in a deadlock if they get changed externally before we get
- // our exclusive copies.
- // Here's what we do: we try over and over (without synchronization) to get copies
- // without interleaving modification. If there is a document change, we just repeat.
-
- IDocument right= fRightDocument; // fRightDocument, but not subject to change
- IDocument actual= null; // the copy of the actual (right) document
- IDocument reference= null; // the copy of the reference (left) document
-
- synchronized (DocumentLineDiffer.this) {
- // 4: take an early exit if the documents are not valid
- if (left == null || right == null) {
- if (isCanceled(monitor))
- return Status.CANCEL_STATUS;
- else {
- clearModel();
- fireModelChanged();
- DocumentLineDiffer.this.notifyAll();
- return Status.OK_STATUS;
- }
- }
-
- // set the reference document
- fLeftDocument= left;
- }
-
- right.addDocumentListener(DocumentLineDiffer.this);
- left.addDocumentListener(DocumentLineDiffer.this);
-
- do {
- // clear events
- synchronized (DocumentLineDiffer.this) {
- if (isCanceled(monitor))
- return Status.CANCEL_STATUS;
-
- fStoredEvents.clear();
- }
-
- // access documents unsynched:
- // get an exclusive copy of the actual document
- reference= new Document(left.get());
- actual= new Document(right.get());
-
- synchronized (DocumentLineDiffer.this) {
- if (fStoredEvents.size() == 0)
- break;
- }
-
-
- } while (true);
-
- // 6: Do Da Diffing
- DocLineComparator ref= new DocLineComparator(reference, null, false);
- DocLineComparator act= new DocLineComparator(actual, null, false);
- List diffs= RangeDifferencer.findRanges(monitor, ref, act);
-
- // 7: Reset the model to the just gotten differences
- // re-inject stored events to get up to date.
- List storedEvents;
- synchronized (DocumentLineDiffer.this) {
- if (isCanceled(monitor))
- return Status.CANCEL_STATUS;
-
- // set the new differences so we can operate on them
- fDifferences= diffs;
- storedEvents= new ArrayList(fStoredEvents);
- fStoredEvents.clear();
- }
-
- // reinject events accumulated in the meantime.
- try {
- for (ListIterator iter= storedEvents.listIterator(); iter.hasNext();) {
- DocumentEvent event= (DocumentEvent) iter.next();
- // access documents unsynched:
- handleAboutToBeChanged(event);
- handleChanged(event);
-
- synchronized (DocumentLineDiffer.this) {
- if (isCanceled(monitor))
- return Status.CANCEL_STATUS;
-
- if (fStoredEvents.size() > 0) {
- // early leave on interfering change
- left.removeDocumentListener(DocumentLineDiffer.this);
- right.removeDocumentListener(DocumentLineDiffer.this);
- clearModel();
- initialize();
- return Status.CANCEL_STATUS;
- }
- }
-
- }
- } catch (BadLocationException e) {
- left.removeDocumentListener(DocumentLineDiffer.this);
- right.removeDocumentListener(DocumentLineDiffer.this);
- clearModel();
- initialize();
- return Status.CANCEL_STATUS;
- }
-
- synchronized (DocumentLineDiffer.this) {
- // signal done
- fInitializationJob= null;
- fIsSynchronized= true;
- fLastDifference= null;
-
- // inform blocking calls.
- DocumentLineDiffer.this.notifyAll();
- }
-
- fireModelChanged();
- return Status.OK_STATUS;
- }
-
- private boolean isCanceled(IProgressMonitor monitor) {
- return fInitializationJob != this || monitor != null && monitor.isCanceled();
- }
-
- private void clearModel() {
- fLeftDocument= null;
- fInitializationJob= null;
- fStoredEvents.clear();
- fLastDifference= null;
- fDifferences.clear();
- }
-
- };
-
- fInitializationJob.setPriority(Job.DECORATE);
- fInitializationJob.schedule();
- }
-
- /* IDocumentListener implementation */
-
- /*
- * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public synchronized void documentAboutToBeChanged(DocumentEvent event) {
- // if a initialization is going on, we just store the events in the meantime
- if (!isInitialized() && fInitializationJob != null) {
- fStoredEvents.add(event);
- return;
- }
-
- try {
- handleAboutToBeChanged(event);
- } catch (BadLocationException e) {
- TextEditorPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, TextEditorPlugin.PLUGIN_ID, IStatus.OK, "reinitializing quickdiff", e)); //$NON-NLS-1$
- initialize();
- }
- }
-
-
- /**
- * Unsynchronized version of <code>documentAboutToBeChanged</code>, called by <code>documentAboutToBeChanged</code>
- * and {@link #initialize(SortedMap, int)}.
- *
- * @param event the document event to be handled
- */
- void handleAboutToBeChanged(DocumentEvent event) throws BadLocationException {
- IDocument doc= event.getDocument();
- if (doc == null)
- return;
-
- // store size of replaced region (never synchronized -> not a problem)
- fFirstLine= doc.getLineOfOffset(event.getOffset()); // store change bounding lines
- fNLines= doc.getLineOfOffset(event.getOffset() + event.getLength()) - fFirstLine + 1;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public synchronized void documentChanged(DocumentEvent event) {
- if (!isInitialized())
- return;
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=44692
- // don't allow incremental update for changes from the reference document
- // as this could deadlock
- if (event.getDocument() == fLeftDocument) {
- initialize();
- return;
- }
-
- try {
- handleChanged(event);
- } catch (BadLocationException e) {
- TextEditorPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, TextEditorPlugin.PLUGIN_ID, IStatus.OK, "reinitializing quickdiff", e)); //$NON-NLS-1$
- initialize();
- return;
- }
-
- // inform listeners about change
- if (fUpdateNeeded) {
- fireModelChanged();
- fUpdateNeeded= false;
- }
- }
-
- /**
- * Implementation of documentChanged, non synchronized.
- *
- * @param event the document event
- */
- void handleChanged(DocumentEvent event) throws BadLocationException {
- /*
- * Now, here we have a great example of object oriented programming.
- */
-
- // documents: left, right; modified and unchanged are either of both
- IDocument left= fLeftDocument;
- IDocument right= fRightDocument;
- IDocument modified= event.getDocument();
- if (modified != left && modified != right)
- Assert.isTrue(false);
-
- String insertion= event.getText();
- int added= insertion == null ? 1 : modified.computeNumberOfLines(insertion) + 1;
- // size: the size of the document change in lines
-
- // put an upper bound to the delay we can afford
- if (added > 50 || fNLines > 50) {
- initialize();
- return;
- }
-
- int size= Math.max(fNLines, added) + 1;
- int lineDelta= added - fNLines;
- int lastLine= fFirstLine + fNLines - 1;
-
- int repetitionField;
- if (modified == left) {
- int originalLine= getRightLine(lastLine + 1);
- repetitionField= searchForRepetitionField(size - 1, right, originalLine);
- } else {
- int originalLine= getLeftLine(lastLine + 1);
- repetitionField= searchForRepetitionField(size - 1, left, originalLine);
- }
- lastLine += repetitionField;
-
-
- // get enclosing range: search for a consistent block of at least the size of our
- // change before and after the change.
- RangeDifference consistentBefore, consistentAfter;
- if (modified == left) {
- consistentBefore= findConsistentRangeBeforeLeft(fFirstLine, size);
- consistentAfter= findConsistentRangeAfterLeft(lastLine, size);
- } else {
- consistentBefore= findConsistentRangeBeforeRight(fFirstLine, size);
- consistentAfter= findConsistentRangeAfterRight(lastLine, size);
- }
-
- // optimize unchanged blocks: if the consistent blocks around the change are larger than
- // size, we redimension them (especially important when there are only very little changes.
- int shiftBefore= 0;
- if (consistentBefore.kind() == RangeDifference.NOCHANGE) {
- int unchanged;
- if (modified == left)
- unchanged= Math.min(fFirstLine, consistentBefore.leftEnd()) - consistentBefore.leftStart();
- else
- unchanged= Math.min(fFirstLine, consistentBefore.rightEnd()) - consistentBefore.rightStart();
-
- shiftBefore= Math.max(0, unchanged - size);
- }
-
- int shiftAfter= 0;
- if (consistentAfter.kind() == RangeDifference.NOCHANGE) {
- int unchanged;
- if (modified == left)
- unchanged= consistentAfter.leftEnd() - Math.max(lastLine + 1, consistentAfter.leftStart());
- else
- unchanged= consistentAfter.rightEnd() - Math.max(lastLine + 1, consistentAfter.rightStart());
-
- shiftAfter= Math.max(0, unchanged - size);
- }
-
- // get the document regions that will be rediffed, take into account that on the
- // document, the change has already happened.
- // left (reference) document
- int leftOffset= left.getLineOffset(consistentBefore.leftStart() + shiftBefore);
- int leftLine= Math.max(consistentAfter.leftEnd() - 1, 0);
- if (modified == left)
- leftLine += lineDelta;
- IRegion leftLastLine= left.getLineInformation(leftLine - shiftAfter);
- int leftEndOffset= leftLastLine.getOffset() + leftLastLine.getLength();
- IRegion leftRegion= new Region(leftOffset, leftEndOffset - leftOffset);
- DocLineComparator reference= new DocLineComparator(left, leftRegion, false);
-
- // right (actual) document
- int rightOffset= right.getLineOffset(consistentBefore.rightStart() + shiftBefore);
- int rightLine= Math.max(consistentAfter.rightEnd() - 1, 0);
- if (modified == right)
- rightLine += lineDelta;
- IRegion rightLastLine= right.getLineInformation(rightLine - shiftAfter);
- int rightEndOffset= rightLastLine.getOffset() + rightLastLine.getLength();
- IRegion rightRegion= new Region(rightOffset, rightEndOffset - rightOffset);
- DocLineComparator change= new DocLineComparator(right, rightRegion, false);
-
- // put an upper bound to the delay we can afford
- if (leftLine - shiftAfter - (consistentBefore.leftStart() + shiftBefore) > 50 || rightLine - shiftAfter - (consistentBefore.rightStart() + shiftBefore) > 50) {
- initialize();
- return;
- }
-
- // debug
-// System.out.println("compare window: "+size+"\n\n<" + left.get(leftRegion.getOffset(), leftRegion.getLength()) + //$NON-NLS-1$//$NON-NLS-2$
-// ">\n\n<" + right.get(rightRegion.getOffset(), rightRegion.getLength()) + ">\n"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // compare
- List diffs= RangeDifferencer.findRanges(reference, change);
- if (diffs.size() == 0) {
- diffs.add(new RangeDifference(RangeDifference.CHANGE, 0, 0, 0, 0));
- }
-
-
- // shift the partial diffs to the absolute document positions
- int leftShift= consistentBefore.leftStart() + shiftBefore;
- int rightShift= consistentBefore.rightStart() + shiftBefore;
- for (Iterator it= diffs.iterator(); it.hasNext();) {
- RangeDifference d= (RangeDifference) it.next();
- d.shiftLeft(leftShift);
- d.shiftRight(rightShift);
- }
-
- // undo optimization shifting
- if (shiftBefore > 0) {
- RangeDifference first= (RangeDifference) diffs.get(0);
- if (first.kind() == RangeDifference.NOCHANGE)
- first.extendStart(-shiftBefore);
- else
- diffs.add(0, new RangeDifference(RangeDifference.NOCHANGE, first.rightStart() - shiftBefore, shiftBefore, first.leftStart() - shiftBefore, shiftBefore));
- }
-
- RangeDifference last= (RangeDifference) diffs.get(diffs.size() - 1);
- if (shiftAfter > 0) {
- if (last.kind() == RangeDifference.NOCHANGE)
- last.extendEnd(shiftAfter);
- else
- diffs.add(new RangeDifference(RangeDifference.NOCHANGE, last.rightEnd(), shiftAfter , last.leftEnd(), shiftAfter));
- }
-
- // replace changed diff range
- ListIterator it= fDifferences.listIterator();
- Iterator newIt= diffs.iterator();
- RangeDifference current;
- boolean changed= false;
-
- // replace regions from consistentBefore to consistentAfter with new diffs
-
- // search for consistentBefore
- do {
- Assert.isTrue(it.hasNext());
- current= (RangeDifference) it.next();
- } while (current != consistentBefore);
- Assert.isTrue(current == consistentBefore);
-
- // replace until consistentAfter
- while (current != consistentAfter) {
- if (newIt.hasNext()) {
- Object o= newIt.next();
- if (!current.equals(o)) {
- changed= true;
- it.set(o);
- }
- } else {
- it.remove();
- fUpdateNeeded= true;
- }
- Assert.isTrue(it.hasNext());
- current= (RangeDifference) it.next();
- }
-
- // replace consistentAfter
- Assert.isTrue(current == consistentAfter);
- if (newIt.hasNext()) {
- Object o= newIt.next();
- if (!current.equals(o)) {
- changed= true;
- it.set(o);
- }
- } else {
- it.remove();
- fUpdateNeeded= true;
- }
-
- // add remaining new diffs
- while (newIt.hasNext()) {
- it.add(newIt.next());
- changed= true;
- }
-
- // shift the old remaining diffs
- boolean init= true;
- while (it.hasNext()) {
- current= (RangeDifference) it.next();
- if (init) {
- init= false;
- leftShift= last.leftEnd() - current.leftStart();
- rightShift= last.rightEnd() - current.rightStart();
- if (leftShift != 0 || rightShift != 0)
- changed= true;
- else
- break;
- }
- current.shiftLeft(leftShift);
- current.shiftRight(rightShift);
- }
-
- fUpdateNeeded= changed;
- fLastDifference= null;
-
- }
-
- /**
- * Finds a consistent range of at least size before <code>line</code> in the left document.
- *
- * @param line the line before which the range has to occur
- * @param size the minimal size of the range
- * @return the first range found, or the first range in the differ if none can be found
- */
- private RangeDifference findConsistentRangeBeforeLeft(int line, int size) {
- RangeDifference found= null;
-
- for (ListIterator it= fDifferences.listIterator(); it.hasNext();) {
- RangeDifference difference= (RangeDifference) it.next();
- if (found == null || difference.kind() == RangeDifference.NOCHANGE
- && (difference.leftEnd() < line && difference.leftLength() >= size
- || difference.leftEnd() >= line && line - difference.leftStart() >= size))
- found= difference;
-
- if (difference.leftEnd() >= line)
- break;
- }
-
- return found;
- }
-
- /**
- * Finds a consistent range of at least size after <code>line</code> in the left document.
- *
- * @param line the line after which the range has to occur
- * @param size the minimal size of the range
- * @return the first range found, or the last range in the differ if none can be found
- */
- private RangeDifference findConsistentRangeAfterLeft(int line, int size) {
- RangeDifference found= null;
-
- for (ListIterator it= fDifferences.listIterator(fDifferences.size()); it.hasPrevious();) {
- RangeDifference difference= (RangeDifference) it.previous();
- if (found == null || difference.kind() == RangeDifference.NOCHANGE
- && (difference.leftStart() > line && difference.leftLength() >= size
- || difference.leftStart() <= line && difference.leftEnd() - line >= size))
- found= difference;
-
- if (difference.leftStart() <= line)
- break;
-
- }
-
- return found;
- }
-
- /**
- * Finds a consistent range of at least size before <code>line</code> in the right document.
- *
- * @param line the line before which the range has to occur
- * @param size the minimal size of the range
- * @return the first range found, or the first range in the differ if none can be found
- */
- private RangeDifference findConsistentRangeBeforeRight(int line, int size) {
- RangeDifference found= null;
-
- int unchanged= -1; // the number of unchanged lines before line
- for (ListIterator it= fDifferences.listIterator(); it.hasNext();) {
- RangeDifference difference= (RangeDifference) it.next();
- if (found == null)
- found= difference;
- else if (difference.kind() == RangeDifference.NOCHANGE) {
- unchanged= Math.min(line, difference.rightEnd()) - difference.rightStart();
- if (unchanged >= size)
- found= difference;
- }
-
- if (difference.rightEnd() >= line)
- break;
- }
-
- return found;
- }
-
- /**
- * Finds a consistent range of at least size after <code>line</code> in the right document.
- *
- * @param line the line after which the range has to occur
- * @param size the minimal size of the range
- * @return the first range found, or the last range in the differ if none can be found
- */
- private RangeDifference findConsistentRangeAfterRight(int line, int size) {
- RangeDifference found= null;
-
- int unchanged= -1; // the number of unchanged lines after line
- for (ListIterator it= fDifferences.listIterator(fDifferences.size()); it.hasPrevious();) {
- RangeDifference difference= (RangeDifference) it.previous();
- if (found == null)
- found= difference;
- else if (difference.kind() == RangeDifference.NOCHANGE) {
- unchanged= difference.rightEnd() - Math.max(line + 1, difference.rightStart()); // + 1 to step over the changed line
- if (unchanged >= size)
- found= difference;
- }
-
- if (difference.rightStart() <= line)
- break;
- }
-
- return found;
- }
-
- /**
- * Returns the size of a repetition field starting a <code>line</code>.
- *
- * @param size the maximal length of the repeat window
- * @param doc the document to search
- * @param line the line to start searching
- * @return the size of a found repetition field, or zero
- * @throws BadLocationException if <code>doc</code> is modified concurrently
- */
- private int searchForRepetitionField(int size, IDocument doc, int line) throws BadLocationException {
- /*
- Repetition fields: a line wise repetition of maximal size <code>size</code>
- can urge a change to come at its end, as diffing greedily takes the longest
- unchanged range possible:
- <pre>
- before
- repeat
- repeat
- repeat
- repeat
- repeat
- repeat
- repeat
- repeat
- after
- </pre>
-
- Inserting another repeat element anywhere in the repetition field will create
- an addition at its end.
-
- Size is one less than our window size (as this is already one more than the actual number
- of affected lines.
- */
-
- /*
- * Implementation:
- * Window of maximum repetition size. Whenever the current matches the first in the window,
- * we advance it by one. If there are more free slots in the window, the current line is
- * appended.
- * We terminate if the current line does not match and there are no more free slots.
- *
- * TODO what if we have a prefix to a repetition field? Probably does not matter.
- */
- LinkedList window= new LinkedList();
- int nLines= doc.getNumberOfLines();
- int repetition= line - 1;
- int l= line;
-
- while (l >= 0 && l < nLines) {
- IRegion r= doc.getLineInformation(l);
- String current= doc.get(r.getOffset(), r.getLength());
-
- if (!window.isEmpty() && window.get(0).equals(current)) {
- // repetition found, shift
- window.removeFirst();
- window.addLast(current);
- repetition= l;
- } else {
- // no repetition, add if there is room
- // otherwise return
- if (window.size() < size)
- window.addLast(current);
- else
- break;
- }
-
- l++;
- }
-
- int fieldLength= repetition - line + 1;
- Assert.isTrue(fieldLength >= 0);
- return fieldLength;
- }
-
- /**
- * Gets the corresponding line on the left side for a line on the right.
- *
- * @param rightLine the line on the right side
- * @return the corresponding left hand line, or <code>-1</code>
- */
- private int getLeftLine(int rightLine) {
- RangeDifference d= getRangeDifferenceForRightLine(rightLine);
- if (d == null)
- return -1;
- return Math.min(d.leftEnd() - 1, d.leftStart() + rightLine - d.rightStart());
- }
-
- /**
- * Gets the corresponding line on the right side for a line on the left.
- *
- * @param leftLine the line on the left side
- * @return the corresponding right hand line, or <code>-1</code>
- */
- private int getRightLine(int leftLine) {
- RangeDifference d= getRangeDifferenceForLeftLine(leftLine);
- if (d == null)
- return -1;
- return Math.min(d.rightEnd() - 1, d.rightStart() + leftLine - d.leftStart());
- }
-
- /**
- * Gets the RangeDifference for a line on the left hand side.
- *
- * @param leftLine the line on the left side
- * @return the corresponding RangeDifference, or <code>null</code>
- */
- private RangeDifference getRangeDifferenceForLeftLine(int leftLine) {
- for (Iterator it= fDifferences.iterator(); it.hasNext();) {
- RangeDifference d= (RangeDifference) it.next();
- if (leftLine >= d.leftStart() && leftLine < d.leftEnd()) {
- return d;
- }
- }
- return null;
- }
-
- /**
- * Gets the RangeDifference for a line on the right hand side.
- *
- * @param rightLine the line on the right side
- * @return the corresponding RangeDifference, or <code>null</code>
- */
- private RangeDifference getRangeDifferenceForRightLine(int rightLine) {
- for (Iterator it= fDifferences.iterator(); it.hasNext();) {
- RangeDifference d= (RangeDifference) it.next();
- if (rightLine >= d.rightStart() && rightLine < d.rightEnd()) {
- return d;
- }
- }
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationModel#addAnnotationModelListener(org.eclipse.jface.text.source.IAnnotationModelListener)
- */
- public void addAnnotationModelListener(IAnnotationModelListener listener) {
- fAnnotationModelListeners.add(listener);
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationModel#removeAnnotationModelListener(org.eclipse.jface.text.source.IAnnotationModelListener)
- */
- public void removeAnnotationModelListener(IAnnotationModelListener listener) {
- fAnnotationModelListeners.remove(listener);
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationModel#connect(org.eclipse.jface.text.IDocument)
- */
- public void connect(IDocument document) {
- Assert.isTrue(fRightDocument == null || fRightDocument == document);
-
- ++fOpenConnections;
- if (fOpenConnections == 1) {
- fRightDocument= document;
- initialize();
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationModel#disconnect(org.eclipse.jface.text.IDocument)
- */
- public void disconnect(IDocument document) {
- Assert.isTrue(fRightDocument == document);
-
- --fOpenConnections;
-
- if (fOpenConnections == 0)
- uninstall();
- }
-
- /**
- * Uninstalls all components and dereferences any objects.
- */
- private void uninstall() {
- synchronized (this) {
- fIsSynchronized= false;
- if (fInitializationJob != null)
- fInitializationJob.cancel();
- fInitializationJob= null;
-
- if (fLeftDocument != null)
- fLeftDocument.removeDocumentListener(this);
- fLeftDocument= null;
-
- if (fRightDocument != null)
- fRightDocument.removeDocumentListener(this);
- fRightDocument= null;
- }
-
- if (fReferenceProvider != null) {
- fReferenceProvider.dispose();
- fReferenceProvider= null;
- }
-
- fDifferences.clear();
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationModel#addAnnotation(org.eclipse.jface.text.source.Annotation, org.eclipse.jface.text.Position)
- */
- public void addAnnotation(Annotation annotation, Position position) {
- throw new UnsupportedOperationException();
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationModel#removeAnnotation(org.eclipse.jface.text.source.Annotation)
- */
- public void removeAnnotation(Annotation annotation) {
- throw new UnsupportedOperationException();
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationModel#getAnnotationIterator()
- */
- public Iterator getAnnotationIterator() {
- List copy= new ArrayList(fDifferences);
- final Iterator iter= copy.iterator();
- return new Iterator() {
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- public boolean hasNext() {
- return iter.hasNext();
- }
-
- public Object next() {
- RangeDifference diff= (RangeDifference) iter.next();
- return new DiffRegion(diff, 0);
- }
-
- };
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationModel#getPosition(org.eclipse.jface.text.source.Annotation)
- */
- public Position getPosition(Annotation annotation) {
- if (fRightDocument != null && annotation instanceof DiffRegion) {
- RangeDifference difference= ((DiffRegion)annotation).fDifference;
- try {
- int offset= fRightDocument.getLineOffset(difference.rightStart());
- return new Position(offset, fRightDocument.getLineOffset(difference.rightEnd() - 1) + fRightDocument.getLineLength(difference.rightEnd() - 1) - offset);
- } catch (BadLocationException e) {
- // ignore and return null;
- }
- }
- return null;
- }
-
- /**
- * Informs all annotation model listeners that this model has been changed.
- */
- protected void fireModelChanged() {
- fireModelChanged(new AnnotationModelEvent(this));
- }
-
- /**
- * Informs all annotation model listeners that this model has been changed
- * as described in the annotation model event. The event is sent out
- * to all listeners implementing <code>IAnnotationModelListenerExtension</code>.
- * All other listeners are notified by just calling <code>modelChanged(IAnnotationModel)</code>.
- *
- * @param event the event to be sent out to the listeners
- */
- protected void fireModelChanged(AnnotationModelEvent event) {
- ArrayList v= new ArrayList(fAnnotationModelListeners);
- Iterator e= v.iterator();
- while (e.hasNext()) {
- IAnnotationModelListener l= (IAnnotationModelListener)e.next();
- if (l instanceof IAnnotationModelListenerExtension)
- ((IAnnotationModelListenerExtension)l).modelChanged(event);
- else
- l.modelChanged(this);
- }
- }
-
- /**
- * Stops diffing of this differ. All differences are cleared.
- */
- public synchronized void suspend() {
- if (fInitializationJob != null) {
- fInitializationJob.cancel();
- fInitializationJob= null;
- }
- if (fRightDocument != null)
- fRightDocument.removeDocumentListener(this);
- if (fLeftDocument != null)
- fLeftDocument.removeDocumentListener(this);
-
- fDifferences.clear();
-
- fIsSynchronized= false;
-
- fireModelChanged();
- }
-
- /**
- * Resumes diffing of this differ. Must only be called after suspend.
- */
- public synchronized void resume() {
- if (fRightDocument != null)
- fRightDocument.addDocumentListener(this);
- initialize();
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffMessages.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffMessages.java
deleted file mode 100644
index 3ff913d7c5e..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffMessages.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.internal.texteditor.quickdiff;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Helper class which wraps the specified resource bundle
- * and offers methods to access the bundle.
- *
- * @since 3.0
- */
-public class QuickDiffMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.internal.texteditor.quickdiff.QuickDiffMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private QuickDiffMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-
- public static String getFormattedString(String key, Object arg) {
- return getFormattedString(key, new Object[] { arg });
- }
-
- public static String getFormattedString(String key, Object[] args) {
- return MessageFormat.format(getString(key), args);
- }
-
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffMessages.properties b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffMessages.properties
deleted file mode 100644
index 87253621fde..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffMessages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-quickdiff.toggle.enable= Enable Quick&Diff
-quickdiff.toggle.disable= Disable Quick&Diff
-
-quickdiff.initialize= Initializing Quick Diff
-quickdiff.nonsynchronized= Quick Diff Is Not in Sync - Cannot Restore
-quickdiff.annotation.changed={0} changed
-quickdiff.annotation.added={0} added
-quickdiff.annotation.deleted={0} deleted
-quickdiff.annotation.line_singular=line
-quickdiff.annotation.line_plural=lines
-
-quickdiff.menu.label= Set QuickDiff Re&ference
-
-RevertLineAction.description= Reverts the current line to its original state
-RevertLineAction.label= Revert &Line
-RevertLineAction.delete.label= Delete Added &Line
-RevertBlockAction.description= Reverts a contiguous block of modified lines
-RevertBlockAction.label= R&evert Block
-RevertSelectionAction.description= Reverts any modified lines in the selection
-RevertSelectionAction.label= Revert S&election
-RestoreAction.description= Restores deleted lines into the current document
-RestoreAction.label= Restore &Deleted Line
-RestoreAction.multiple.label= Restore {0} &Deleted Lines
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffRestoreAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffRestoreAction.java
deleted file mode 100644
index 882824be7a4..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffRestoreAction.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.internal.texteditor.quickdiff;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-import org.eclipse.jface.text.IRewriteTarget;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationModelExtension;
-import org.eclipse.jface.text.source.IChangeRulerColumn;
-import org.eclipse.jface.text.source.ILineDiffer;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.IEditorStatusLine;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
-
-/**
- * Abstract superclass of actions that restore / revert parts of a document displayed in the action's
- * editor to the state described by the {@link ILineDiffer ILineDiffer} associated with the document's
- * {@link IAnnotationModel IAnnotationModel}.
- *
- * @since 3.0
- */
-public abstract class QuickDiffRestoreAction extends TextEditorAction {
-
- /**
- * Creates a new instance.
- *
- * @param editor the editor this action belongs to
- */
- QuickDiffRestoreAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
- super(bundle, prefix, editor);
- }
-
- /**
- * Called by this action's run method inside a pair of calls to <code>IRewriteTarget.beginCompoundChange</code>
- * and <code>IRewriteTarget.endCompoundChange</code>().
- *
- * @see IRewriteTarget
- */
- protected abstract void runCompoundChange();
-
- /*
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- ITextEditor editor= getTextEditor();
- if (editor == null || !validateEditorInputState())
- return;
- IRewriteTarget target= (IRewriteTarget)editor.getAdapter(IRewriteTarget.class);
- if (target != null)
- target.beginCompoundChange();
- runCompoundChange();
- if (target != null)
- target.endCompoundChange();
-
- }
-
- /*
- * @see org.eclipse.ui.texteditor.TextEditorAction#update()
- */
- public void update() {
- super.update();
- if (isEnabled())
- setEnabled(canModifyEditor());
- }
-
- /**
- * Returns the selection of the editor this action belongs to.
- *
- * @return the editor's selection, or <code>null</code>
- */
- protected ITextSelection getSelection() {
- if (getTextEditor() == null)
- return null;
- ISelectionProvider sp= getTextEditor().getSelectionProvider();
- if (sp == null)
- return null;
- ISelection s= sp.getSelection();
- if (s instanceof ITextSelection)
- return (ITextSelection)s;
- else
- return null;
- }
-
- /**
- * Returns the annotation model of the document displayed in this action's editor, if it
- * implements the {@link IAnnotationModelExtension IAnnotationModelExtension} interface.
- *
- * @return the displayed document's annotation model if it is an <code>IAnnotationModelExtension</code>, or <code>null</code>
- */
- private IAnnotationModelExtension getModel() {
- if (getTextEditor() == null)
- return null;
- IDocumentProvider provider= getTextEditor().getDocumentProvider();
- IEditorInput editorInput= getTextEditor().getEditorInput();
- IAnnotationModel m= provider.getAnnotationModel(editorInput);
- if (m instanceof IAnnotationModelExtension) {
- return (IAnnotationModelExtension)m;
- } else {
- return null;
- }
- }
-
- /**
- * Returns the diff model associated with the annotation model of the document currently displayed
- * in this action's editor, if any.
- *
- * @return the diff model associated with the displayed document, or <code>null</code>
- */
- protected ILineDiffer getDiffer() {
- IAnnotationModelExtension extension= getModel();
- if (extension != null)
- return (ILineDiffer)extension.getAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID);
- else
- return null;
- }
-
- /**
- * Returns a <code>IVerticalRulerInfo</code> if this action's editor adapts to one.
- *
- * @return the <code>IVerticalRulerInfo</code> for the editor's vertical ruler, or <code>null</code>
- */
- protected IVerticalRulerInfo getRuler() {
- if (getTextEditor() != null)
- return (IVerticalRulerInfo)getTextEditor().getAdapter(IVerticalRulerInfo.class);
- else
- return null;
- }
-
- /**
- * Sets the status line error message to <code>string</code>.
- *
- * @param string the message to be displayed as error.
- */
- protected void setStatus(String string) {
- if (getTextEditor() != null) {
- IEditorStatusLine statusLine= (IEditorStatusLine) getTextEditor().getAdapter(IEditorStatusLine.class);
- if (statusLine != null) {
- statusLine.setMessage(true, string, null);
- }
- }
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/ReferenceSelectionAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/ReferenceSelectionAction.java
deleted file mode 100644
index 2795e19d13c..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/ReferenceSelectionAction.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.ui.internal.texteditor.quickdiff;
-
-import org.eclipse.jface.action.Action;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationModelExtension;
-import org.eclipse.jface.text.source.IChangeRulerColumn;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.texteditor.quickdiff.IQuickDiffProviderImplementation;
-import org.eclipse.ui.texteditor.quickdiff.IQuickDiffReferenceProvider;
-import org.eclipse.ui.texteditor.quickdiff.ReferenceProviderDescriptor;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorExtension3;
-import org.eclipse.ui.texteditor.IUpdate;
-
-
-/**
- * Action to set the quick diff reference for the document displayed in the editor. An instance of
- * this class is created for every extension to the extension point <code>quickdiff.referenceprovider</code>, and for
- * every editor. It acts as a proxy; its <code>run</code> method installs the reference provider
- * specified by the extension with the quick diff differ on the current document.
- *
- * @since 3.0
- */
-public class ReferenceSelectionAction extends Action implements IUpdate {
-
- /** The editor we get the document from. */
- private ITextEditor fEditor= null;
- /** The descriptor of the managed extension. */
- private final ReferenceProviderDescriptor fDescriptor;
- /** The implementation of the extension, after it has been loaded. */
- private IQuickDiffProviderImplementation fProvider;
-
- /**
- * Creates a new instance that will lazily create the implementation provided by the extension.
- *
- * @param descriptor describes the extension.
- * @param editor the editor for which this action is created.
- */
- public ReferenceSelectionAction(ReferenceProviderDescriptor descriptor, ITextEditor editor) {
- super("", AS_RADIO_BUTTON); //$NON-NLS-1$
- setChecked(false);
- setEnabled(true);
- Assert.isLegal(descriptor != null);
- fDescriptor= descriptor;
- fEditor= editor;
- update();
- }
-
- /**
- * Creates an instance of the implementation provided by the extension, if none has been created
- * before. Otherwise, the cached implementation is returned.
- * @return The <code>IQuickDiffProviderImplementation</code> instance provided by the extension.
- */
- private IQuickDiffProviderImplementation getProvider() {
- if (fProvider == null) {
- fProvider= fDescriptor.createProvider();
- }
- return fProvider;
- }
-
- /*
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
-
- DocumentLineDiffer differ= getDiffer(true); // create if needed, so the user does not have to toggle display when he selects a reference
- if (differ == null)
- return;
-
- if (fEditor instanceof ITextEditorExtension3) {
- ITextEditorExtension3 extension= (ITextEditorExtension3) fEditor;
- IQuickDiffProviderImplementation provider= getProvider();
- if (provider != null) {
- provider.setActiveEditor(fEditor);
- if (provider.isEnabled()) {
- differ.setReferenceProvider(provider);
- extension.showChangeInformation(true);
- setEnabled(true);
- } else
- setEnabled(false);
- }
- }
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- /* two things happen here:
- * 1: checked state setting - if a provider is already installed, and its id matches
- * our id, we are in checked state.
- * 2: enablement - if the extending plugin has been loaded, we check the provider for
- * enablement and take it as our own.
- */
- setText(fDescriptor.getLabel());
- DocumentLineDiffer differ= getDiffer(false); // don't create it if we're not showing
- setChecked(false);
- if (differ != null) {
- IQuickDiffReferenceProvider provider= differ.getReferenceProvider();
- if (provider != null && provider.getId().equals(fDescriptor.getId())) {
- setChecked(true);
- }
- }
-
- if (fDescriptor.isPluginLoaded()) {
- getProvider();
- if (fProvider == null) {
- setEnabled(false);
- } else {
- fProvider.setActiveEditor(fEditor);
- setEnabled(fProvider.isEnabled());
- }
- } else {
- // optimistically enable it
- setEnabled(true);
- }
- }
-
- /**
- * Fetches the differ installed with the current editor's document's annotation model. If none
- * is installed yet, and <code>createIfNeeded</code> is true, one is created and attached to the
- * model.
- *
- * @param createIfNeeded when set to <code>true</code>, a new differ will be created if needed.
- * @return the differ installed with the annotation model, or <code>null</code>.
- */
- private DocumentLineDiffer getDiffer(boolean createIfNeeded) {
- // get annotation model
- if (fEditor == null)
- return null;
-
- IDocumentProvider provider= fEditor.getDocumentProvider();
- IEditorInput editorInput= fEditor.getEditorInput();
- if (provider == null || editorInput == null)
- return null;
-
- IAnnotationModel m= provider.getAnnotationModel(editorInput);
- IAnnotationModelExtension model= null;
- if (m instanceof IAnnotationModelExtension) {
- model= (IAnnotationModelExtension)m;
- } else {
- return null;
- }
-
- // get differ
- DocumentLineDiffer differ= (DocumentLineDiffer)model.getAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID);
-
- // create if needed
- if (differ == null && createIfNeeded) {
- differ= new DocumentLineDiffer();
- model.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, differ);
- }
-
- return differ;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RestoreAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RestoreAction.java
deleted file mode 100644
index 76d84fe5593..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RestoreAction.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.internal.texteditor.quickdiff;
-
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.source.ILineDiffInfo;
-import org.eclipse.jface.text.source.ILineDiffer;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Action that will restore a block of deleted lines at the current caret position in an editor.
- *
- * @since 3.0
- */
-public class RestoreAction extends QuickDiffRestoreAction {
- /** Resource key prefix. */
- private static final String PREFIX= "RestoreAction."; //$NON-NLS-1$
- /** Resource key for a single deleted line. */
- private static final String SINGLE_KEY= PREFIX + "label"; //$NON-NLS-1$
- /** Resource key for multiple deleted lines. */
- private static final String MULTIPLE_KEY= PREFIX + "multiple.label"; //$NON-NLS-1$
-
- /** The line to be restored. Set in <code>update()</code>. */
- private int fLine;
-
- /**
- * Creates a new instance.
- *
- * @param editor the editor this action belongs to
- */
- public RestoreAction(ITextEditor editor) {
- super(QuickDiffMessages.getResourceBundle(), PREFIX, editor);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- super.update();
-
- if (!isEnabled())
- return;
-
- setEnabled(false);
- IVerticalRulerInfo ruler= getRuler();
- if (ruler == null)
- return;
- fLine= ruler.getLineOfLastMouseButtonActivity();
- ILineDiffer differ= getDiffer();
- if (differ == null)
- return;
- ILineDiffInfo info= differ.getLineInfo(fLine);
- if (info != null && (info.getRemovedLinesAbove() > 0 || info.getRemovedLinesBelow() > 0)) {
- if (info.getRemovedLinesBelow() == 0) {
- fLine--;
- } else if (info.getRemovedLinesAbove() != 0) {
-// // if there are deleted lines above and below the line, take the closer one;
-// int lineHeight= fCachedTextWidget.getLineHeight();
-// if (fMousePosition != null
-// && fMousePosition.y % lineHeight <= lineHeight / 2) {
-// fLine--;
-// }
- // take the one below for now TODO adjust to old viewer-dependent behaviour
- }
- info= differ.getLineInfo(fLine);
- if (info.getRemovedLinesBelow() == 1)
- setText(QuickDiffMessages.getString(SINGLE_KEY));
- else
- setText(QuickDiffMessages.getFormattedString(MULTIPLE_KEY, String.valueOf(info.getRemovedLinesBelow()))); //$NON-NLS-1$
- setEnabled(true);
- }
- }
-
- /*
- * @see org.eclipse.ui.internal.editors.quickdiff.QuickDiffRestoreAction#runCompoundChange()
- */
- public void runCompoundChange() {
- if (!isEnabled())
- return;
- ILineDiffer differ= getDiffer();
- if (differ != null) {
- try {
- differ.restoreAfterLine(fLine);
- } catch (BadLocationException e) {
- setStatus(e.getMessage());
- }
- }
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertBlockAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertBlockAction.java
deleted file mode 100644
index 1f67d07131b..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertBlockAction.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.internal.texteditor.quickdiff;
-
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.source.ILineDiffInfo;
-import org.eclipse.jface.text.source.ILineDiffer;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Action that will revert a contiguous block of added, deleted and changes lines in the currently
- * displayed document to the state in the reference document.
- *
- * @since 3.0
- */
-public class RevertBlockAction extends QuickDiffRestoreAction {
- /** Resource key prefix. */
- private static final String PREFIX= "RevertBlockAction."; //$NON-NLS-1$
-
- /** The line to be restored. Set in <code>update()</code>. */
- private int fLine;
-
- /**
- * Creates a new instance.
- *
- * @param editor the editor this action belongs to
- */
- public RevertBlockAction(ITextEditor editor) {
- super(QuickDiffMessages.getResourceBundle(), PREFIX, editor);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- super.update();
-
- if (!isEnabled())
- return;
-
- setEnabled(false);
- IVerticalRulerInfo ruler= getRuler();
- if (ruler == null)
- return;
- fLine= ruler.getLineOfLastMouseButtonActivity();
- ILineDiffer differ= getDiffer();
- if (differ == null)
- return;
- ILineDiffInfo info= differ.getLineInfo(fLine);
- if (info != null && info.getChangeType() != ILineDiffInfo.UNCHANGED) {
- boolean hasBlock= false;
- if (fLine > 0) {
- info= differ.getLineInfo(fLine - 1);
- hasBlock= info != null && info.hasChanges();
- }
- if (!hasBlock) {
- info= differ.getLineInfo(fLine + 1);
- hasBlock= info != null && info.hasChanges();
- }
- if (hasBlock)
- setEnabled(true);
- }
- }
-
- /*
- * @see org.eclipse.ui.internal.editors.quickdiff.QuickDiffRestoreAction#runCompoundChange()
- */
- public void runCompoundChange() {
- if (!isEnabled())
- return;
- ILineDiffer differ= getDiffer();
- if (differ != null) {
- try {
- differ.revertBlock(fLine);
- } catch (BadLocationException e) {
- setStatus(e.getMessage());
- }
- }
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertLineAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertLineAction.java
deleted file mode 100644
index ecf4e64ba92..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertLineAction.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.ui.internal.texteditor.quickdiff;
-
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.source.ILineDiffInfo;
-import org.eclipse.jface.text.source.ILineDiffer;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Action that will revert a line in the currently displayed document to the state in the
- * reference document.
- *
- * @since 3.0
- */
-public class RevertLineAction extends QuickDiffRestoreAction {
- /** Resource key prefix. */
- private static final String PREFIX= "RevertLineAction."; //$NON-NLS-1$
- /** Resource key for added lines - they will be deleted. */
- private static final String DELETE_KEY= PREFIX + "delete.label"; //$NON-NLS-1$
- /** Resource key for changed lines - they will be reverted. */
- private static final String REVERT_KEY= PREFIX + "label"; //$NON-NLS-1$
-
- /** The line to be restored. Set in <code>update()</code>. */
- private int fLine;
-
- /**
- * Creates a new instance.
- *
- * @param editor the editor this action belongs to
- */
- public RevertLineAction(ITextEditor editor) {
- super(QuickDiffMessages.getResourceBundle(), PREFIX, editor);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- super.update();
-
- if (!isEnabled())
- return;
-
- setEnabled(false);
- IVerticalRulerInfo ruler= getRuler();
- if (ruler == null)
- return;
- fLine= ruler.getLineOfLastMouseButtonActivity();
- ILineDiffer differ= getDiffer();
- if (differ == null)
- return;
- ILineDiffInfo info= differ.getLineInfo(fLine);
- if (info != null && info.getChangeType() != ILineDiffInfo.UNCHANGED) {
- if (info.getChangeType() == ILineDiffInfo.ADDED)
- setText(QuickDiffMessages.getString(DELETE_KEY));
- else
- setText(QuickDiffMessages.getString(REVERT_KEY));
- setEnabled(true);
- }
- }
-
- /*
- * @see org.eclipse.ui.internal.editors.quickdiff.QuickDiffRestoreAction#runCompoundChange()
- */
- public void runCompoundChange() {
- if (!isEnabled())
- return;
- ILineDiffer differ= getDiffer();
- if (differ != null) {
- try {
- differ.revertLine(fLine);
- } catch (BadLocationException e) {
- setStatus(e.getMessage());
- }
- }
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertSelectionAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertSelectionAction.java
deleted file mode 100644
index 3e15fb32e4f..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RevertSelectionAction.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.internal.texteditor.quickdiff;
-
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.source.ILineDiffInfo;
-import org.eclipse.jface.text.source.ILineDiffer;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Action that will revert the added, deleted and changes lines in the selection on the currently
- * displayed document to the state in the reference document.
- *
- * @since 3.0
- */
-public class RevertSelectionAction extends QuickDiffRestoreAction {
- /** The first line to be restored. Set in <code>update()</code>. */
- private int fStartLine;
- /** The last line to be restored. Set in <code>update()</code>. */
- private int fEndLine;
-
- /**
- * Creates a new instance.
- *
- * @param editor the editor this action belongs to
- */
- public RevertSelectionAction(ITextEditor editor) {
- super(QuickDiffMessages.getResourceBundle(), "RevertSelectionAction.", editor); //$NON-NLS-1$
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- super.update();
-
- if (!isEnabled())
- return;
-
- setEnabled(false);
-
- ITextSelection selection= getSelection();
- if (selection == null)
- return;
- fStartLine= selection.getStartLine();
- fEndLine= selection.getEndLine();
-
- // only enable if mouse activity is inside line range
- IVerticalRulerInfo ruler= getRuler();
- if (ruler == null)
- return;
- int activityLine= ruler.getLineOfLastMouseButtonActivity();
- if (activityLine < fStartLine || activityLine > fEndLine)
- return;
-
- ILineDiffer differ= getDiffer();
- if (differ == null)
- return;
-
- // only enable if selection covers at least two lines
- if (fEndLine > fStartLine) {
- for (int i= fStartLine; i <= fEndLine; i++) {
- ILineDiffInfo info= differ.getLineInfo(i);
- if (info != null && info.hasChanges()) {
- setEnabled(true);
- }
- }
- }
- }
-
- /*
- * @see org.eclipse.ui.internal.editors.quickdiff.QuickDiffRestoreAction#runCompoundChange()
- */
- public void runCompoundChange() {
- // recheck if run without being enabled
- if (!isEnabled())
- return;
-
- ILineDiffer differ= getDiffer();
- if (differ != null) {
- try {
- differ.revertSelection(fStartLine, fEndLine - fStartLine + 1);
- } catch (BadLocationException e) {
- setStatus(e.getMessage());
- }
- }
- }
-
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/DifferencesIterator.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/DifferencesIterator.java
deleted file mode 100644
index cfecba7f4bc..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/DifferencesIterator.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.internal.texteditor.quickdiff.compare.rangedifferencer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A custom iterator to iterate over a List of <code>RangeDifferences</code>.
- * It is used internally by the <code>RangeDifferencer</code>.
- */
-/* package */ class DifferencesIterator {
-
- List fRange;
- int fIndex;
- RangeDifference[] fArray;
- RangeDifference fDifference;
-
- /**
- * Creates a differences iterator on an array of <code>RangeDifference</code>s.
- */
- DifferencesIterator(RangeDifference[] differenceRanges) {
-
- fArray= differenceRanges;
- fIndex= 0;
- fRange= new ArrayList();
- if (fIndex < fArray.length)
- fDifference= fArray[fIndex++];
- else
- fDifference= null;
- }
-
- /**
- * Returns the number of RangeDifferences
- */
- int getCount() {
- return fRange.size();
- }
-
- /**
- * Appends the edit to its list and moves to the next <code>RangeDifference</code>.
- */
- void next() {
- fRange.add(fDifference);
- if (fDifference != null) {
- if (fIndex < fArray.length)
- fDifference= fArray[fIndex++];
- else
- fDifference= null;
- }
- }
-
- /**
- * Difference iterators are used in pairs.
- * This method returns the other iterator.
- */
- DifferencesIterator other(DifferencesIterator right, DifferencesIterator left) {
- if (this == right)
- return left;
- return right;
- }
-
- /**
- * Removes all <code>RangeDifference</code>s
- */
- void removeAll() {
- fRange.clear();
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/DocLineComparator.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/DocLineComparator.java
deleted file mode 100644
index dde9983e6f0..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/DocLineComparator.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.internal.texteditor.quickdiff.compare.rangedifferencer;
-
-import org.eclipse.jface.text.*;
-
-/**
- * Implements the <code>IRangeComparator</code> interface for lines in a document.
- * A <code>DocLineComparator</code> is used as the input for the <code>RangeDifferencer</code>
- * engine to perform a line oriented compare on documents.
- * <p>
- * A <code>DocLineComparator</code> doesn't know anything about line separators because
- * its notion of lines is solely defined in the underlying <code>IDocument</code>.
- */
-public final class DocLineComparator implements IRangeComparator {
-
- private final IDocument fDocument;
- private final int fLineOffset;
- private final int fLineCount;
- private final int fLength;
- private final boolean fIgnoreWhiteSpace;
- private final int fMaxOffset;
-
-
- private boolean fSkip= false;
- private int fLastOffset;
- private int fLastLength;
-
-
- /**
- * Creates a <code>DocLineComparator</code> for the given document range.
- * ignoreWhiteSpace controls whether comparing lines (in method
- * <code>rangesEqual<code>) should ignore whitespace.
- *
- * @param document the document from which the lines are taken
- * @param region if non-<code>null</code> only lines within this range are taken
- * @param ignoreWhiteSpace if <code>true</code> white space is ignored when comparing lines
- */
- public DocLineComparator(IDocument document, IRegion region, boolean ignoreWhiteSpace) {
-
- fDocument= document;
- fIgnoreWhiteSpace= ignoreWhiteSpace;
-
- if (region != null) {
- fLength= region.getLength();
- int start= region.getOffset();
- int lineOffset= 0;
- try {
- lineOffset= fDocument.getLineOfOffset(start);
- } catch (BadLocationException ex) {
- }
- fLineOffset= lineOffset;
-
- fMaxOffset= start + fLength;
-
- if (fLength == 0)
- fLineCount= 0;
- else {
- int endLine= fDocument.getNumberOfLines();
- try {
- endLine= fDocument.getLineOfOffset(start + fLength);
- } catch (BadLocationException ex) {
- }
- fLineCount= endLine - fLineOffset + 1;
- }
-
- } else {
- fLineOffset= 0;
- fLength= document.getLength();
- fLineCount= fDocument.getNumberOfLines();
- fMaxOffset= fDocument.getLength();
- }
- }
-
- /**
- * Returns the number of lines in the document.
- *
- * @return number of lines
- */
- public int getRangeCount() {
- return fLineCount;
- }
-
- /**
- * Computes the length of line <code>line</code>.
- *
- * @param line the line requested
- * @return the line length or <code>0</code> if <code>line</code> is not a valid line in the document
- */
- private int getLineLength(int line) {
- if (line >= fLineCount)
- return 0;
- try {
- int docLine= fLineOffset + line;
- String delim= fDocument.getLineDelimiter(docLine);
- int length= fDocument.getLineLength(docLine) - (delim == null ? 0 : delim.length());
- if (line == fLineCount - 1) {
- fLastOffset= fDocument.getLineOffset(docLine);
- fLastLength= Math.min(length, fMaxOffset - fLastOffset);
- } else {
- fLastOffset= -1;
- fLastLength= length;
- }
- return fLastLength;
- } catch (BadLocationException e) {
- fLastOffset= 0;
- fLastLength= 0;
- fSkip= true;
- return 0;
- }
- }
-
- /**
- * Returns <code>true</code> if a line given by the first index
- * matches a line specified by the other <code>IRangeComparator</code> and index.
- *
- * @param thisIndex the number of the line within this range comparator
- * @param other the range comparator to compare this with
- * @param otherIndex the number of the line within the other comparator
- * @return <code>true</code> if the lines are equal
- */
- public boolean rangesEqual(int thisIndex, IRangeComparator other0, int otherIndex) {
-
- if (other0 != null && other0.getClass() == getClass()) {
- DocLineComparator other= (DocLineComparator) other0;
-
- if (fIgnoreWhiteSpace) {
-
- CharSequence s1= extract(thisIndex);
- CharSequence s2= other.extract(otherIndex);
- return compare(s1, s2);
-
- } else {
-
- int tlen= getLineLength(thisIndex);
- int olen= other.getLineLength(otherIndex);
- if (tlen == olen) {
- CharSequence s1= extract(thisIndex);
- CharSequence s2= other.extract(otherIndex);
- return s1.equals(s2);
- }
- }
- }
- return false;
- }
-
- /**
- * Aborts the comparison if the number of tokens is too large.
- *
- * @return <code>true</code> to abort a token comparison
- */
- public boolean skipRangeComparison(int length, int max, IRangeComparator other) {
- return fSkip;
- }
-
- //---- private methods
-
- /**
- * Extract a single line from the underlying document without the line separator.
- *
- * @param line the number of the line to extract
- * @return the contents of the line as a String
- */
- private CharSequence extract(int line) {
- if (line < fLineCount) {
- try {
- int docLine= fLineOffset + line;
- if (fLastOffset == -1)
- fLastOffset= fDocument.getLineOffset(docLine);
-
- return fDocument.get(fLastOffset, fLastLength);
-// return new DocumentCharSequence(fDocument, offset, length);
- } catch(BadLocationException e) {
- fSkip= true;
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- private boolean compare(CharSequence s1, CharSequence s2) {
- int l1= s1.length();
- int l2= s2.length();
- int c1= 0, c2= 0;
- int i1= 0, i2= 0;
-
- while (c1 != -1) {
-
- c1= -1;
- while (i1 < l1) {
- char c= s1.charAt(i1++);
- if (! Character.isWhitespace(c)) {
- c1= c;
- break;
- }
- }
-
- c2= -1;
- while (i2 < l2) {
- char c= s2.charAt(i2++);
- if (! Character.isWhitespace(c)) {
- c2= c;
- break;
- }
- }
-
- if (c1 != c2)
- return false;
- }
- return true;
- }
-
-}
-
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/IRangeComparator.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/IRangeComparator.java
deleted file mode 100644
index fc44fa86257..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/IRangeComparator.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.internal.texteditor.quickdiff.compare.rangedifferencer;
-
-/**
- * For breaking an object to compare into a sequence of comparable entities.
- * <p>
- * It is used by <code>RangeDifferencer</code> to find longest sequences of
- * matching and non-matching ranges.
- * <p>
- * For example, to compare two text documents and find longest common sequences
- * of matching and non-matching lines, the implementation must break the document
- * into lines. <code>getRangeCount</code> would return the number of lines in the
- * document, and <code>rangesEqual</code> would compare a specified line given
- * with one in another <code>IRangeComparator</code>.
- * </p>
- * <p>
- * Clients should implement this interface; there is no standard implementation.
- * </p>
- */
-public interface IRangeComparator {
-
- /**
- * Returns the number of comparable entities.
- *
- * @return the number of comparable entities
- */
- int getRangeCount();
-
- /**
- * Returns whether the comparable entity given by the first index
- * matches an entity specified by the other <code>IRangeComparator</code> and index.
- *
- * @param thisIndex the index of the comparable entity within this <code>IRangeComparator</code>
- * @param other the IRangeComparator to compare this with
- * @param otherIndex the index of the comparable entity within the other <code>IRangeComparator</code>
- * @return <code>true</code> if the comparable entities are equal
- */
- boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex);
-
- /**
- * Returns whether a comparison should be skipped because it would be too costly (or lengthy).
- *
- * @param length a number on which to base the decision whether to return
- * <code>true</code> or <code>false</code>
- * @param maxLength another number on which to base the decision whether to return
- * <code>true</code> or <code>false</code>
- * @param other the other <code>IRangeComparator</code> to compare with
- * @return <code>true</code> to avoid a too lengthy range comparison
- */
- boolean skipRangeComparison(int length, int maxLength, IRangeComparator other);
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/ITokenComparator.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/ITokenComparator.java
deleted file mode 100644
index 6d2a805ffe0..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/ITokenComparator.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.internal.texteditor.quickdiff.compare.rangedifferencer;
-
-
-
-/**
- * For performing a so-called "token compare" on a line of text.
- * This interface extends the <code>IRangeComparator</code> interface
- * so that it can be used by the <code>TextMergeViewer</code>.
- * <p>
- * <code>TextMergeViewer</code> activates the token compare when navigating into
- * a range of differing lines. At first the lines are selected as a block.
- * When navigating into this block the token compare shows for every line
- * the differing token by selecting them.
- * <p>
- * <code>TextMergeViewer</code>'s default token comparator works on characters separated
- * by whitespace. If a different strategy is needed (for example, to use Java tokens in
- * a Java-aware merge viewer), clients may create their own token
- * comparators by implementing this interface (and overriding the
- * <code>TextMergeViewer.createTokenComparator</code> factory method).
- * </p>
- *
- * @see TextMergeViewer
- */
-public interface ITokenComparator extends IRangeComparator {
-
- /**
- * Returns the start character position of the token with the given index.
- * If the index is out of range (but not negative) the character position
- * behind the last character (the length of the input string) is returned.
- *
- * @param index index of the token for which to return the start position
- * @return the start position of the token with the given index
- * @throws java.lang.IndexOutOfBoundsException if index is negative
- */
- int getTokenStart(int index);
-
- /**
- * Returns the character length of the token with the given index.
- * If the index is out of range (but not negative) the value 0 is returned.
- *
- * @param index index of the token for which to return the start position
- * @return the character length of the token with the given index
- * @throws java.lang.IndexOutOfBoundsException if index is negative
- */
- int getTokenLength(int index);
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/LinkedRangeDifference.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/LinkedRangeDifference.java
deleted file mode 100644
index ab62b6138d5..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/LinkedRangeDifference.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.internal.texteditor.quickdiff.compare.rangedifferencer;
-
-/* package */ class LinkedRangeDifference extends RangeDifference {
-
- static final int INSERT= 0;
- static final int DELETE= 1;
-
- LinkedRangeDifference fNext;
-
- /**
- * Creates a LinkedRangeDifference an initializes it to the error state
- */
- LinkedRangeDifference() {
- super(ERROR);
- fNext= null;
- }
-
- /**
- * Constructs and links a LinkeRangeDifference to another LinkedRangeDifference
- */
- LinkedRangeDifference(LinkedRangeDifference next, int operation) {
- super(operation);
- fNext= next;
- }
-
- /**
- * Follows the next link
- */
- LinkedRangeDifference getNext() {
- return fNext;
- }
-
- boolean isDelete() {
- return kind() == DELETE;
- }
-
- boolean isInsert() {
- return kind() == INSERT;
- }
-
- /**
- * Sets the next link of this LinkedRangeDifference
- */
- void setNext(LinkedRangeDifference next) {
- fNext= next;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifference.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifference.java
deleted file mode 100644
index 14e2b91736e..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifference.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.texteditor.quickdiff.compare.rangedifferencer;
-
-import org.eclipse.jface.text.Assert;
-
-/**
- * Description of a change between two or three ranges of comparable entities.
- * <p>
- * <code>RangeDifference</code> objects are the elements of a compare result returned from
- * the <code>RangeDifferencer</code> <code>find* </code> methods.
- * Clients use these objects as they are returned from the differencer.
- * This class is not intended to be instantiated or subclassed.
- * <p>
- * Note: A range in the <code>RangeDifference</code> object is given as a start index
- * and length in terms of comparable entities. However, these entity indices and counts
- * are not necessarily character positions. For example, if an entity represents a line
- * in a document, the start index would be a line number and the count would be in lines.
- * </p>
- *
- * @see RangeDifferencer
- */
-public class RangeDifference {
-
- /** Two-way change constant indicating no change. */
- public final static int NOCHANGE= 0;
- /** Two-way change constant indicating two-way change (same as <code>RIGHT</code>) */
- public final static int CHANGE= 2;
-
- /** Three-way change constant indicating a change in both right and left. */
- public final static int CONFLICT= 1;
- /** Three-way change constant indicating a change in right. */
- public final static int RIGHT= 2;
- /** Three-way change constant indicating a change in left. */
- public final static int LEFT= 3;
- /**
- * Three-way change constant indicating the same change in both right and left,
- * that is only the ancestor is different.
- */
- public final static int ANCESTOR= 4;
-
- /** Constant indicating an unknown change kind. */
- public final static int ERROR= 5;
-
- /** the kind of change: NOCHANGE, CHANGE, LEFT, RIGHT, ANCESTOR, CONFLICT, ERROR */
- int fKind;
-
- int fLeftStart;
- int fLeftLength;
- int fRightStart;
- int fRightLength;
- int lAncestorStart;
- int lAncestorLength;
-
- /**
- * Creates a new range difference with the given change kind.
- *
- * @param changeKind the kind of change
- */
- public RangeDifference(int changeKind) {
- fKind= changeKind;
- }
-
- /**
- * Creates a new <code>RangeDifference</code> with the given change kind
- * and left and right ranges.
- *
- * @param changeKind the kind of change
- * @param rightStart start index of entity on right side
- * @param rightLength number of entities on right side
- * @param leftStart start index of entity on left side
- * @param leftLength number of entities on left side
- */
- public RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength) {
- fKind= kind;
- fRightStart= rightStart;
- fRightLength= rightLength;
- fLeftStart= leftStart;
- fLeftLength= leftLength;
- }
-
- /**
- * Creates a new <code>RangeDifference</code> with the given change kind
- * and left, right, and ancestor ranges.
- *
- * @param changeKind the kind of change
- * @param rightStart start index of entity on right side
- * @param rightLength number of entities on right side
- * @param leftStart start index of entity on left side
- * @param leftLength number of entities on left side
- * @param ancestorStart start index of entity on ancestor side
- * @param ancestorLength number of entities on ancestor side
- */
- public RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength,
- int ancestorStart, int ancestorLength) {
- this(kind, rightStart, rightLength, leftStart, leftLength);
- lAncestorStart= ancestorStart;
- lAncestorLength= ancestorLength;
- }
-
- /**
- * Returns the kind of difference.
- *
- * @return the kind of difference, one of
- * <code>NOCHANGE</code>, <code>CHANGE</code>, <code>LEFT</code>, <code>RIGHT</code>,
- * <code>ANCESTOR</code>, <code>CONFLICT</code>, <code>ERROR</code>
- */
- public int kind() {
- return fKind;
- }
-
- /**
- * Returns the start index of the entity range on the ancestor side.
- *
- * @return the start index of the entity range on the ancestor side
- */
- public int ancestorStart() {
- return lAncestorStart;
- }
-
- /**
- * Returns the number of entities on the ancestor side.
- *
- * @return the number of entities on the ancestor side
- */
- public int ancestorLength() {
- return lAncestorLength;
- }
-
- /**
- * Returns the end index of the entity range on the ancestor side.
- *
- * @return the end index of the entity range on the ancestor side
- */
- public int ancestorEnd() {
- return lAncestorStart + lAncestorLength;
- }
-
- /**
- * Returns the start index of the entity range on the right side.
- *
- * @return the start index of the entity range on the right side
- */
- public int rightStart() {
- return fRightStart;
- }
-
- /**
- * Returns the number of entities on the right side.
- *
- * @return the number of entities on the right side
- */
- public int rightLength() {
- return fRightLength;
- }
-
- /**
- * Returns the end index of the entity range on the right side.
- *
- * @return the end index of the entity range on the right side
- */
- public int rightEnd() {
- return fRightStart + fRightLength;
- }
-
- /**
- * Returns the start index of the entity range on the left side.
- *
- * @return the start index of the entity range on the left side
- */
- public int leftStart() {
- return fLeftStart;
- }
-
- /**
- * Returns the number of entities on the left side.
- *
- * @return the number of entities on the left side
- */
- public int leftLength() {
- return fLeftLength;
- }
-
- /**
- * Returns the end index of the entity range on the left side.
- *
- * @return the end index of the entity range on the left side
- */
- public int leftEnd() {
- return fLeftStart + fLeftLength;
- }
-
- /**
- * Returns the maximum number of entities in the left, right, and ancestor sides of this range.
- *
- * @return the maximum number of entities in the left, right, and ancestor sides of this range
- */
- public int maxLength() {
- return Math.max(fRightLength, Math.max(fLeftLength, lAncestorLength));
- }
-
- /**
- * Shifts the offset into the left document of the receiver.
- *
- * @param leftShift the number of elements to shift
- */
- public void shiftLeft(int shift) {
- Assert.isTrue(shift + fLeftStart >= 0);
- fLeftStart += shift;
- }
-
- /**
- * Shifts the offset into the right document of the receiver.
- *
- * @param rightShift the number of elements to shift
- */
- public void shiftRight(int shift) {
- Assert.isTrue(shift + fRightStart >= 0);
- fRightStart += shift;
- }
-
- /**
- * Resizes the receiver <code>shift</code> units, on both sides, by
- * moving the start of the difference.
- *
- * @param shift the number of elements to shift
- */
- public void extendStart(int shift) {
- Assert.isTrue(shift + fRightStart >= 0);
- Assert.isTrue(shift + fLeftStart >= 0);
- fRightStart += shift;
- fRightLength -= shift;
- fLeftStart += shift;
- fLeftLength -= shift;
- }
-
- /**
- * Resizes the receiver <code>shift</code> units, on both sides, by
- * moving the end of the difference.
- *
- * @param shift the number of elements to shift
- */
- public void extendEnd(int shift) {
- Assert.isTrue(shift + fRightLength >= 0);
- Assert.isTrue(shift + fLeftLength >= 0);
- fRightLength += shift;
- fLeftLength += shift;
- }
-
- /*
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof RangeDifference) {
- RangeDifference d= (RangeDifference) obj;
- return fKind == d.fKind && fRightStart == d.fRightStart && fRightLength == d.fRightLength && fLeftStart == d.fLeftStart && fLeftLength == d.fLeftLength;
- }
- return false;
- }
-}
-
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifferencer.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifferencer.java
deleted file mode 100644
index c4530d72d1b..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifferencer.java
+++ /dev/null
@@ -1,542 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.texteditor.quickdiff.compare.rangedifferencer;
-
-import java.util.*;
-
-import org.eclipse.jface.util.Assert;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * A <code>RangeDifferencer</code> finds the differences between two or three <code>IRangeComparator</code>s.
- * <p>
- * To use the differencer, clients provide an <code>IRangeComparator</code>
- * that breaks their input data into a sequence of comparable entities. The differencer
- * returns the differences among these sequences as an array of <code>RangeDifference</code> objects
- * (<code>findDifferences</code> methods).
- * Every <code>RangeDifference</code> represents a single kind of difference
- * and the corresponding ranges of the underlying comparable entities in the
- * left, right, and optionally ancestor sides.
- * <p>
- * Alternatively, the <code>findRanges</code> methods not only return objects for
- * the differing ranges but for non-differing ranges too.
- * <p>
- * The algorithm used is an objectified version of one described in:
- * <it>A File Comparison Program,</it> by Webb Miller and Eugene W. Myers,
- * Software Practice and Experience, Vol. 15, Nov. 1985.
- *
- * @see IRangeComparator
- * @see RangeDifference
- */
-public final class RangeDifferencer {
-
- private static final RangeDifference[] EMPTY_RESULT= new RangeDifference[0];
-
- /* (non Javadoc)
- * Non instantiatiable!
- */
- private RangeDifferencer() {
- }
-
- /**
- * Finds the differences between two <code>IRangeComparator</code>s.
- * The differences are returned as an array of <code>RangeDifference</code>s.
- * If no differences are detected an empty array is returned.
- *
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- */
- public static RangeDifference[] findDifferences(IRangeComparator left, IRangeComparator right) {
- return findDifferences((IProgressMonitor)null, left, right);
- }
-
- /**
- * Finds the differences between two <code>IRangeComparator</code>s.
- * The differences are returned as an array of <code>RangeDifference</code>s.
- * If no differences are detected an empty array is returned.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- * @since 2.0
- */
- public static RangeDifference[] findDifferences(IProgressMonitor pm, IRangeComparator left, IRangeComparator right) {
-
- // assert that both IRangeComparators are of the same class
- Assert.isTrue(right.getClass().equals(left.getClass()));
-
- int rightSize= right.getRangeCount();
- int leftSize= left.getRangeCount();
- //
- // Differences matrix:
- // only the last d of each diagonal is stored, i.e., lastDiagonal[k] = row of d
- //
- int diagLen= 2 * Math.max(rightSize, leftSize); // bound on the size of edit script
- int maxDiagonal= diagLen;
- int lastDiagonal[]= new int[diagLen + 1]; // the row containing the last d
- // on diagonal k (lastDiagonal[k] = row)
- int origin= diagLen / 2; // origin of diagonal 0
-
- // script corresponding to d[k]
- LinkedRangeDifference script[]= new LinkedRangeDifference[diagLen + 1];
- int row, col;
-
- // find common prefix
- for (row= 0; row < rightSize && row < leftSize && rangesEqual(right, row, left, row) == true; ++row)
- ;
-
- lastDiagonal[origin]= row;
- script[origin]= null;
- int lower= (row == rightSize) ? origin + 1 : origin - 1;
- int upper= (row == leftSize) ? origin - 1 : origin + 1;
-
- if (lower > upper)
- return EMPTY_RESULT;
-
- //System.out.println("findDifferences: " + maxDiagonal + " " + lower + " " + upper);
-
- // for each value of the edit distance
- for (int d= 1; d <= maxDiagonal; ++d) { // d is the current edit distance
-
- if (pm != null)
- pm.worked(1);
-
- if (right.skipRangeComparison(d, maxDiagonal, left))
- return EMPTY_RESULT; // should be something we already found
-
- // for each relevant diagonal (-d, -d+2 ..., d-2, d)
- for (int k= lower; k <= upper; k += 2) { // k is the current diagonal
- LinkedRangeDifference edit;
-
- if (pm != null && pm.isCanceled())
- return EMPTY_RESULT;
-
- if (k == origin - d || k != origin + d && lastDiagonal[k + 1] >= lastDiagonal[k - 1]) {
- //
- // move down
- //
- row= lastDiagonal[k + 1] + 1;
- edit= new LinkedRangeDifference(script[k + 1], LinkedRangeDifference.DELETE);
- } else {
- //
- // move right
- //
- row= lastDiagonal[k - 1];
- edit= new LinkedRangeDifference(script[k - 1], LinkedRangeDifference.INSERT);
- }
- col= row + k - origin;
- edit.fRightStart= row;
- edit.fLeftStart= col;
- Assert.isTrue(k >= 0 && k <= maxDiagonal);
- script[k]= edit;
-
- // slide down the diagonal as far as possible
- while (row < rightSize && col < leftSize && rangesEqual(right, row, left, col) == true) {
- ++row;
- ++col;
- }
-
- Assert.isTrue(k >= 0 && k <= maxDiagonal); // Unreasonable value for diagonal index
- lastDiagonal[k]= row;
-
- if (row == rightSize && col == leftSize) {
- //showScript(script[k], right, left);
- return createDifferencesRanges(script[k]);
- }
- if (row == rightSize)
- lower= k + 2;
- if (col == leftSize)
- upper= k - 2;
- }
- --lower;
- ++upper;
- }
- // too many differences
- Assert.isTrue(false);
- return null;
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * The differences are returned as a list of <code>RangeDifference</code>s.
- * If no differences are detected an empty list is returned.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- */
- public static RangeDifference[] findDifferences(IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
- return findDifferences(null, ancestor, left, right);
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * The differences are returned as a list of <code>RangeDifference</code>s.
- * If no differences are detected an empty list is returned.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences, or an empty array if no differences were found
- * @since 2.0
- */
- public static RangeDifference[] findDifferences(IProgressMonitor pm, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
-
- if (ancestor == null)
- return findDifferences(pm, left, right);
-
- RangeDifference[] leftAncestorScript= null;
- RangeDifference[] rightAncestorScript= findDifferences(pm, ancestor, right);
- if (rightAncestorScript != null)
- leftAncestorScript= findDifferences(pm, ancestor, left);
- if (rightAncestorScript == null || leftAncestorScript == null)
- return null;
-
- DifferencesIterator myIter= new DifferencesIterator(rightAncestorScript);
- DifferencesIterator yourIter= new DifferencesIterator(leftAncestorScript);
-
- List diff3= new ArrayList();
- diff3.add(new RangeDifference(RangeDifference.ERROR)); // add a sentinel
-
- int changeRangeStart= 0;
- int changeRangeEnd= 0;
- //
- // Combine the two two-way edit scripts into one
- //
- while (myIter.fDifference != null || yourIter.fDifference != null) {
-
- DifferencesIterator startThread;
- myIter.removeAll();
- yourIter.removeAll();
- //
- // take the next diff that is closer to the start
- //
- if (myIter.fDifference == null)
- startThread= yourIter;
- else if (yourIter.fDifference == null)
- startThread= myIter;
- else { // not at end of both scripts take the lowest range
- if (myIter.fDifference.fLeftStart <= yourIter.fDifference.fLeftStart) // 2 -> common (Ancestor) change range
- startThread= myIter;
- else
- startThread= yourIter;
- }
- changeRangeStart= startThread.fDifference.fLeftStart;
- changeRangeEnd= startThread.fDifference.leftEnd();
-
- startThread.next();
- //
- // check for overlapping changes with other thread
- // merge overlapping changes with this range
- //
- DifferencesIterator other= startThread.other(myIter, yourIter);
- while (other.fDifference != null && other.fDifference.fLeftStart <= changeRangeEnd) {
- int newMax= other.fDifference.leftEnd();
- other.next();
- if (newMax >= changeRangeEnd) {
- changeRangeEnd= newMax;
- other= other.other(myIter, yourIter);
- }
- }
- diff3.add(createRangeDifference3(myIter, yourIter, diff3, right, left, changeRangeStart, changeRangeEnd));
- }
-
- // remove sentinel
- diff3.remove(0);
- return (RangeDifference[]) diff3.toArray(EMPTY_RESULT);
- }
-
- /**
- * Finds the differences among two <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- *
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- */
- public static List findRanges(IRangeComparator left, IRangeComparator right) {
- return findRanges((IProgressMonitor)null, left, right);
- }
-
- /**
- * Finds the differences among two <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- * @since 2.0
- */
- public static List findRanges(IProgressMonitor pm, IRangeComparator left, IRangeComparator right) {
- RangeDifference[] in= findDifferences(pm, left, right);
- List out= new ArrayList();
-
- RangeDifference rd;
-
- int mstart= 0;
- int ystart= 0;
-
- for (int i= 0; i < in.length; i++) {
- RangeDifference es= in[i];
-
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart);
- if (rd.maxLength() != 0)
- out.add(rd);
-
- out.add(es);
-
- mstart= es.rightEnd();
- ystart= es.leftEnd();
- }
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, right.getRangeCount() - mstart, ystart, left.getRangeCount() - ystart);
- if (rd.maxLength() > 0)
- out.add(rd);
-
- return out;
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- */
- public static List findRanges(IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
- return findRanges(null, ancestor, left, right);
- }
-
- /**
- * Finds the differences among three <code>IRangeComparator</code>s.
- * In contrast to <code>findDifferences</code>, the result
- * contains <code>RangeDifference</code> elements for non-differing ranges too.
- * If the ancestor range comparator is <code>null</code>, a two-way
- * comparison is performed.
- *
- * @param pm if not <code>null</code> used to report progress
- * @param ancestor the ancestor range comparator or <code>null</code>
- * @param left the left range comparator
- * @param right the right range comparator
- * @return an array of range differences
- * @since 2.0
- */
- public static List findRanges(IProgressMonitor pm, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) {
-
- if (ancestor == null)
- return findRanges(pm, left, right);
-
- RangeDifference[] in= findDifferences(pm, ancestor, left, right);
- List out= new ArrayList();
-
- RangeDifference rd;
-
- int mstart= 0;
- int ystart= 0;
- int astart= 0;
-
- for (int i= 0; i < in.length; i++) {
- RangeDifference es= in[i];
-
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart, astart, es.ancestorStart() - astart);
- if (rd.maxLength() > 0)
- out.add(rd);
-
- out.add(es);
-
- mstart= es.rightEnd();
- ystart= es.leftEnd();
- astart= es.ancestorEnd();
- }
- rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, right.getRangeCount() - mstart, ystart, left.getRangeCount() - ystart, astart, ancestor.getRangeCount() - astart);
- if (rd.maxLength() > 0)
- out.add(rd);
-
- return out;
- }
-
- //---- private methods
-
- /**
- * Creates a Vector of DifferencesRanges out of the LinkedRangeDifference.
- * It coalesces adjacent changes.
- * In addition, indices are changed such that the ranges are 1) open, i.e,
- * the end of the range is not included, and 2) are zero based.
- */
- private static RangeDifference[] createDifferencesRanges(LinkedRangeDifference start) {
-
- LinkedRangeDifference ep= reverseDifferences(start);
- ArrayList result= new ArrayList();
- RangeDifference es= null;
-
- while (ep != null) {
- es= new RangeDifference(RangeDifference.CHANGE);
-
- if (ep.isInsert()) {
- es.fRightStart= ep.fRightStart + 1;
- es.fLeftStart= ep.fLeftStart;
- RangeDifference b= ep;
- do {
- ep= ep.getNext();
- es.fLeftLength++;
- } while (ep != null && ep.isInsert() && ep.fRightStart == b.fRightStart);
- } else {
- es.fRightStart= ep.fRightStart;
- es.fLeftStart= ep.fLeftStart;
-
- RangeDifference a= ep;
- //
- // deleted lines
- //
- do {
- a= ep;
- ep= ep.getNext();
- es.fRightLength++;
- } while (ep != null && ep.isDelete() && ep.fRightStart == a.fRightStart + 1);
-
- boolean change= (ep != null && ep.isInsert() && ep.fRightStart == a.fRightStart);
-
- if (change) {
- RangeDifference b= ep;
- //
- // replacement lines
- //
- do {
- ep= ep.getNext();
- es.fLeftLength++;
- } while (ep != null && ep.isInsert() && ep.fRightStart == b.fRightStart);
- } else {
- es.fLeftLength= 0;
- }
- es.fLeftStart++; // meaning of range changes from "insert after", to "replace with"
-
- }
- //
- // the script commands are 1 based, subtract one to make them zero based
- //
- es.fRightStart--;
- es.fLeftStart--;
- result.add(es);
- }
- return (RangeDifference[]) result.toArray(EMPTY_RESULT);
- }
-
- /**
- * Creates a <code>RangeDifference3</code> given the
- * state of two DifferenceIterators.
- */
- private static RangeDifference createRangeDifference3(
- DifferencesIterator myIter,
- DifferencesIterator yourIter,
- List diff3,
- IRangeComparator right,
- IRangeComparator left,
- int changeRangeStart,
- int changeRangeEnd) {
-
- int rightStart, rightEnd;
- int leftStart, leftEnd;
- int kind= RangeDifference.ERROR;
- RangeDifference last= (RangeDifference) diff3.get(diff3.size() - 1);
-
- Assert.isTrue((myIter.getCount() != 0 || yourIter.getCount() != 0)); // At least one range array must be non-empty
- //
- // find corresponding lines to fChangeRangeStart/End in right and left
- //
- if (myIter.getCount() == 0) { // only left changed
- rightStart= changeRangeStart - last.ancestorEnd() + last.rightEnd();
- rightEnd= changeRangeEnd - last.ancestorEnd() + last.rightEnd();
- kind= RangeDifference.LEFT;
- } else {
- RangeDifference f= (RangeDifference) myIter.fRange.get(0);
- RangeDifference l= (RangeDifference) myIter.fRange.get(myIter.fRange.size() - 1);
- rightStart= changeRangeStart - f.fLeftStart + f.fRightStart;
- rightEnd= changeRangeEnd - l.leftEnd() + l.rightEnd();
- }
-
- if (yourIter.getCount() == 0) { // only right changed
- leftStart= changeRangeStart - last.ancestorEnd() + last.leftEnd();
- leftEnd= changeRangeEnd - last.ancestorEnd() + last.leftEnd();
- kind= RangeDifference.RIGHT;
- } else {
- RangeDifference f= (RangeDifference) yourIter.fRange.get(0);
- RangeDifference l= (RangeDifference) yourIter.fRange.get(yourIter.fRange.size() - 1);
- leftStart= changeRangeStart - f.fLeftStart + f.fRightStart;
- leftEnd= changeRangeEnd - l.leftEnd() + l.rightEnd();
- }
-
- if (kind == RangeDifference.ERROR) { // overlapping change (conflict) -> compare the changed ranges
- if (rangeSpansEqual(right, rightStart, rightEnd - rightStart, left, leftStart, leftEnd - leftStart))
- kind= RangeDifference.ANCESTOR;
- else
- kind= RangeDifference.CONFLICT;
- }
- return new RangeDifference(kind, rightStart, rightEnd - rightStart, leftStart, leftEnd - leftStart, changeRangeStart, changeRangeEnd - changeRangeStart);
- }
-
- /**
- * Tests if two ranges are equal
- */
- private static boolean rangesEqual(IRangeComparator a, int ai, IRangeComparator b, int bi) {
- return a.rangesEqual(ai, b, bi);
- }
-
- /**
- * Tests whether <code>right</code> and <code>left</left> changed in the same way
- */
- private static boolean rangeSpansEqual(IRangeComparator right, int rightStart, int rightLen, IRangeComparator left, int leftStart, int leftLen) {
- if (rightLen == leftLen) {
- int i= 0;
- for (i= 0; i < rightLen; i++) {
- if (!rangesEqual(right, rightStart + i, left, leftStart + i))
- break;
- }
- if (i == rightLen)
- return true;
- }
- return false;
- }
-
- /**
- * Reverses the range differences
- */
- private static LinkedRangeDifference reverseDifferences(LinkedRangeDifference start) {
- LinkedRangeDifference ep, behind, ahead;
-
- ahead= start;
- ep= null;
- while (ahead != null) {
- behind= ep;
- ep= ahead;
- ahead= ahead.getNext();
- ep.setNext(behind);
- }
- return ep;
- }
-}
-
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/package.html b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/package.html
deleted file mode 100644
index 270a74d7b8d..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/package.html
+++ /dev/null
@@ -1,12 +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.51 [en] (WinNT; I) [Netscape]">
- <title>QuickDiff Internal</title>
-</head>
-<body>
-Copy of the respective classes in org.eclipse.compare.rangedifferencer in order to avoid circular dependencies.
-</body>
-</html>
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/package.html b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/package.html
deleted file mode 100644
index 610f4b03deb..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/package.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.51 [en] (WinNT; I) [Netscape]">
- <title>QuickDiff Internal</title>
-</head>
-<body>
-Implementation for quick diff display, restore actions and the <code>org.eclipse.ui.editors.quickDiffReferenceProvider</code>
-extension point.
-</body>
-</html>
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractDocumentProvider.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractDocumentProvider.java
deleted file mode 100644
index 3b0e199f689..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractDocumentProvider.java
+++ /dev/null
@@ -1,944 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.source.IAnnotationModel;
-
-import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
-
-
-
-/**
- * An abstract implementation of a shareable document provider.
- * <p>
- * Subclasses must implement <code>createDocument</code>,
- * <code>createAnnotationModel</code>, and <code>doSaveDocument</code>.
- * </p>
- */
-public abstract class AbstractDocumentProvider implements IDocumentProvider, IDocumentProviderExtension, IDocumentProviderExtension2, IDocumentProviderExtension3 {
-
- /**
- * Opertion created by the document provider and to be executed by the providers runnable context.
- *
- * @since 3.0
- */
- protected static abstract class DocumentProviderOperation implements IRunnableWithProgress {
-
- /**
- * The actual functionality of this operation.
- *
- * @throws CoreException
- */
- protected abstract void execute(IProgressMonitor monitor) throws CoreException;
-
- /*
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- execute(monitor);
- } catch (CoreException x) {
- throw new InvocationTargetException(x);
- }
- }
- }
-
- /**
- * Collection of all information managed for a connected element.
- */
- protected class ElementInfo implements IDocumentListener {
-
- /** The element for which the info is stored */
- public Object fElement;
- /** How often the element has been connected */
- public int fCount;
- /** Can the element be saved */
- public boolean fCanBeSaved;
- /** The element's document */
- public IDocument fDocument;
- /** The element's annotation model */
- public IAnnotationModel fModel;
- /**
- * Has element state been validated
- * @since 2.0
- */
- public boolean fIsStateValidated;
- /**
- * The status of this element
- * @since 2.0
- */
- public IStatus fStatus;
-
-
- /**
- * Creates a new element info, initialized with the given
- * document and annotation model.
- *
- * @param document the document
- * @param model the annotation model
- */
- public ElementInfo(IDocument document, IAnnotationModel model) {
- fDocument= document;
- fModel= model;
- fCount= 0;
- fCanBeSaved= false;
- fIsStateValidated= false;
- }
-
- /**
- * An element info equals another object if this object is an element info
- * and if the documents of the two element infos are equal.
- * @see Object#equals(java.lang.Object)
- */
- public boolean equals(Object o) {
- if (o instanceof ElementInfo) {
- ElementInfo e= (ElementInfo) o;
- return fDocument.equals(e.fDocument);
- }
- return false;
- }
-
- /*
- * @see Object#hashCode()
- */
- public int hashCode() {
- return fDocument.hashCode();
- }
-
- /*
- * @see IDocumentListener#documentChanged(DocumentEvent)
- */
- public void documentChanged(DocumentEvent event) {
- fCanBeSaved= true;
- removeUnchangedElementListeners(fElement, this);
- fireElementDirtyStateChanged(fElement, fCanBeSaved);
- }
-
- /*
- * @see IDocumentListener#documentAboutToBeChanged(DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
- }
-
-
- /**
- * Enables a certain behavior.
- * Indicates whether this provider should behave as described in
- * use case 5 of http://bugs.eclipse.org/bugs/show_bug.cgi?id=10806.
- * Current value: <code>false</code>
- * @since 2.0
- */
- static final protected boolean PR10806_UC5_ENABLED= false;
-
- /**
- * Enables a certain behavior.
- * Indicates whether this provider should behave as described in
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=14469
- * Notes: This contradicts <code>PR10806_UC5_ENABLED</code>.
- * Current value: <code>true</code>
- * @since 2.0
- */
- static final protected boolean PR14469_ENABLED= true;
-
- /**
- * Constant for representing the ok status. This is considered a value object.
- * @since 2.0
- */
- static final protected IStatus STATUS_OK= new Status(IStatus.OK, TextEditorPlugin.PLUGIN_ID, IStatus.OK, EditorMessages.getString("AbstractDocumentProvider.ok"), null); //$NON-NLS-1$
-
- /**
- * Constant for representing the error status. This is considered a value object.
- * @since 2.0
- */
- static final protected IStatus STATUS_ERROR= new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.INFO, EditorMessages.getString("AbstractDocumentProvider.error"), null); //$NON-NLS-1$
-
-
- /** Element information of all connected elements */
- private Map fElementInfoMap= new HashMap();
- /** The element state listeners */
- private List fElementStateListeners= new ArrayList();
- /**
- * The current progress monitor
- * @since 2.1
- */
- private IProgressMonitor fProgressMonitor;
-
-
- /**
- * Creates a new document provider.
- */
- protected AbstractDocumentProvider() {
- }
-
- /**
- * Creates the document for the given element.
- * <p>
- * Subclasses must implement this method.</p>
- *
- * @param element the element
- * @return the document
- * @exception CoreException if the document could not be created
- */
- protected abstract IDocument createDocument(Object element) throws CoreException;
-
- /**
- * Creates an annotation model for the given element. <p>
- * Subclasses must implement this method.
- *
- * @param element the element
- * @return the annotation model
- * @exception CoreException if the annotation model could not be created
- */
- protected abstract IAnnotationModel createAnnotationModel(Object element) throws CoreException;
-
- /**
- * Performs the actual work of saving the given document provided for the
- * given element.
- * <p>
- * Subclasses must implement this method.</p>
- *
- * @param monitor a progress monitor to report progress and request cancelation
- * @param element the element
- * @param document the document
- * @param overwrite indicates whether an overwrite should happen if necessary
- * @exception CoreException if document could not be stored to the given element
- */
- protected abstract void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException;
-
- /**
- * Returns the runnable context for this document provider.
- *
- * @return the runnable context for this document provider
- * @since 3.0
- */
- protected abstract IRunnableContext getOperationRunner(IProgressMonitor monitor);
-
- /**
- * Returns the element info object for the given element.
- *
- * @param element the element
- * @return the element info object, or <code>null</code> if none
- */
- protected ElementInfo getElementInfo(Object element) {
- return (ElementInfo) fElementInfoMap.get(element);
- }
-
- /**
- * Creates a new element info object for the given element.
- * <p>
- * This method is called from <code>connect</code> when an element info needs
- * to be created. The <code>AbstractDocumentProvider</code> implementation
- * of this method returns a new element info object whose document and
- * annotation model are the values of <code>createDocument(element)</code>
- * and <code>createAnnotationModel(element)</code>, respectively. Subclasses
- * may override.</p>
- *
- * @param element the element
- * @return a new element info object
- * @exception CoreException if the document or annotation model could not be created
- */
- protected ElementInfo createElementInfo(Object element) throws CoreException {
- return new ElementInfo(createDocument(element), createAnnotationModel(element));
- }
-
- /**
- * Disposes of the given element info object.
- * <p>
- * This method is called when an element info is disposed. The
- * <code>AbstractDocumentProvider</code> implementation of this
- * method does nothing. Subclasses may reimplement.</p>
- *
- * @param element the element
- * @param info the element info object
- */
- protected void disposeElementInfo(Object element, ElementInfo info) {
- }
-
- /**
- * Called on initial creation and when the dirty state of the element
- * changes to <code>false</code>. Adds all listeners which must be
- * active as long as the element is not dirty. This method is called
- * before <code>fireElementDirtyStateChanged</code> or <code>
- * fireElementContentReplaced</code> is called.
- * Subclasses may extend.
- *
- * @param element the element
- * @param info the element info object
- */
- protected void addUnchangedElementListeners(Object element, ElementInfo info) {
- if (info.fDocument != null)
- info.fDocument.addDocumentListener(info);
- }
-
- /**
- * Called when the given element gets dirty. Removes all listeners
- * which must be active only when the element is not dirty. This
- * method is called before <code>fireElementDirtyStateChanged</code>
- * or <code>fireElementContentReplaced</code> is called.
- * Subclasses may extend.
- *
- * @param element the element
- * @param info the element info object
- */
- protected void removeUnchangedElementListeners(Object element, ElementInfo info) {
- if (info.fDocument != null)
- info.fDocument.removeDocumentListener(info);
- }
-
- /**
- * Enumerates the elements connected via this document provider.
- *
- * @return the list of elements (element type: <code>Object</code>)
- */
- protected Iterator getConnectedElements() {
- Set s= new HashSet();
- Set keys= fElementInfoMap.keySet();
- if (keys != null)
- s.addAll(keys);
- return s.iterator();
- }
-
- /*
- * @see IDocumentProvider#connect(Object)
- */
- public final void connect(Object element) throws CoreException {
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- if (info == null) {
-
- info= createElementInfo(element);
- if (info == null)
- info= new ElementInfo(null, null);
-
- info.fElement= element;
-
- addUnchangedElementListeners(element, info);
-
- fElementInfoMap.put(element, info);
- if (fElementInfoMap.size() == 1)
- connected();
- }
- ++ info.fCount;
- }
-
- /**
- * This hook method is called when this provider starts managing documents for
- * elements. I.e. it is called when the first element gets connected to this provider.
- * Subclasses may extend.
- * @since 2.0
- */
- protected void connected() {
- }
-
- /*
- * @see IDocumentProvider#disconnect
- */
- public final void disconnect(Object element) {
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
-
- if (info == null)
- return;
-
- if (info.fCount == 1) {
-
- fElementInfoMap.remove(element);
- removeUnchangedElementListeners(element, info);
- disposeElementInfo(element, info);
-
- if (fElementInfoMap.size() == 0)
- disconnected();
-
- } else
- -- info.fCount;
- }
-
- /**
- * This hook method is called when this provider stops managing documents for
- * element. I.e. it is called when the last element gets disconnected from this provider.
- * Subcalles may extend.
- * @since 2.0
- */
- protected void disconnected() {
- }
-
- /*
- * @see IDocumentProvider#getDocument(Object)
- */
- public IDocument getDocument(Object element) {
-
- if (element == null)
- return null;
-
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- return (info != null ? info.fDocument : null);
- }
-
- /*
- * @see IDocumentProvider#mustSaveDocument(Object)
- */
- public boolean mustSaveDocument(Object element) {
-
- if (element == null)
- return false;
-
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- return (info != null ? info.fCount == 1 && info.fCanBeSaved : false);
- }
-
- /*
- * @see IDocumentProvider#getAnnotationModel(Object)
- */
- public IAnnotationModel getAnnotationModel(Object element) {
-
- if (element == null)
- return null;
-
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- return (info != null ? info.fModel : null);
- }
-
- /*
- * @see IDocumentProvider#canSaveDocument(Object)
- */
- public boolean canSaveDocument(Object element) {
-
- if (element == null)
- return false;
-
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- return (info != null ? info.fCanBeSaved : false);
- }
-
- /**
- * Executes the actual work of reseting the given elements document.
- *
- * @param element the element
- * @param monitor the progress monitor
- * @throws CoreException
- * @since 3.0
- */
- protected void doResetDocument(Object element, IProgressMonitor monitor) throws CoreException {
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- if (info != null) {
-
- IDocument original= null;
- IStatus status= null;
-
- try {
- original= createDocument(element);
- } catch (CoreException x) {
- status= x.getStatus();
- }
-
- info.fStatus= status;
-
- if (original != null) {
- fireElementContentAboutToBeReplaced(element);
- info.fDocument.set(original.get());
- if (info.fCanBeSaved) {
- info.fCanBeSaved= false;
- addUnchangedElementListeners(element, info);
- }
- fireElementContentReplaced(element);
- fireElementDirtyStateChanged(element, false);
- }
- }
- }
-
- /**
- * Executes the given operation in the providers runnable context.
- *
- * @param operation the operation to be executes
- * @param monitor the progress monitor
- * @exception CoreException the operation's core exception
- * @since 3.0
- */
- protected void executeOperation(DocumentProviderOperation operation, IProgressMonitor monitor) throws CoreException {
- try {
- IRunnableContext runner= getOperationRunner(monitor);
- if (runner != null)
- runner.run(false, false, operation);
- else
- operation.run(monitor);
- } catch (InvocationTargetException x) {
- Throwable e= x.getTargetException();
- if (e instanceof CoreException)
- throw (CoreException) e;
- String message= (e.getMessage() != null ? e.getMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.ERROR, message, e));
- } catch (InterruptedException x) {
- String message= (x.getMessage() != null ? x.getMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.CANCEL, TextEditorPlugin.PLUGIN_ID, IStatus.OK, message, x));
- }
- }
-
- /*
- * @see IDocumentProvider#resetDocument(Object)
- */
- public final void resetDocument(final Object element) throws CoreException {
-
- if (element == null)
- return;
-
- DocumentProviderOperation operation= new DocumentProviderOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- doResetDocument(element, monitor);
- }
- };
-
- executeOperation(operation, getProgressMonitor());
- }
-
-
- /*
- * @see IDocumentProvider#saveDocument(IProgressMonitor, Object, IDocument, boolean)
- */
- public final void saveDocument(IProgressMonitor monitor, final Object element, final IDocument document, final boolean overwrite) throws CoreException {
-
- if (element == null)
- return;
-
- DocumentProviderOperation operation= new DocumentProviderOperation() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- if (info != null) {
- if (info.fDocument != document) {
- Status status= new Status(IStatus.WARNING, TextEditorPlugin.PLUGIN_ID, IStatus.ERROR, EditorMessages.getString("AbstractDocumentProvider.error.save.inuse"), null); //$NON-NLS-1$
- throw new CoreException(status);
- }
- doSaveDocument(monitor, element, document, overwrite);
- info.fCanBeSaved= false;
- addUnchangedElementListeners(element, info);
- fireElementDirtyStateChanged(element, false);
-
- } else {
- doSaveDocument(monitor, element, document, overwrite);
- }
- }
- };
-
- executeOperation(operation, monitor);
- }
-
- /**
- * The <code>AbstractDocumentProvider</code> implementation of this
- * <code>IDocumentProvider</code> method does nothing. Subclasses may
- * reimplement.
- *
- * @param element the element
- */
- public void aboutToChange(Object element) {
- }
-
- /**
- * The <code>AbstractDocumentProvider</code> implementation of this
- * <code>IDocumentProvider</code> method does nothing. Subclasses may
- * reimplement.
- *
- * @param element the element
- */
- public void changed(Object element) {
- }
-
- /*
- * @see IDocumentProvider#addElementStateListener(IElementStateListener)
- */
- public void addElementStateListener(IElementStateListener listener) {
- Assert.isNotNull(listener);
- if (!fElementStateListeners.contains(listener))
- fElementStateListeners.add(listener);
- }
-
- /*
- * @see IDocumentProvider#removeElementStateListener(IElementStateListener)
- */
- public void removeElementStateListener(IElementStateListener listener) {
- Assert.isNotNull(listener);
- fElementStateListeners.remove(listener);
- }
-
- /**
- * Informs all registered element state listeners about a change in the
- * dirty state of the given element.
- *
- * @param element the element
- * @param isDirty the new dirty state
- * @see IElementStateListener#elementDirtyStateChanged(Object, boolean)
- */
- protected void fireElementDirtyStateChanged(Object element, boolean isDirty) {
- Iterator e= new ArrayList(fElementStateListeners).iterator();
- while (e.hasNext()) {
- IElementStateListener l= (IElementStateListener) e.next();
- l.elementDirtyStateChanged(element, isDirty);
- }
- }
-
- /**
- * Informs all registered element state listeners about an impending
- * replace of the given element's content.
- *
- * @param element the element
- * @see IElementStateListener#elementContentAboutToBeReplaced(Object)
- */
- protected void fireElementContentAboutToBeReplaced(Object element) {
- Iterator e= new ArrayList(fElementStateListeners).iterator();
- while (e.hasNext()) {
- IElementStateListener l= (IElementStateListener) e.next();
- l.elementContentAboutToBeReplaced(element);
- }
- }
-
- /**
- * Informs all registered element state listeners about the just-completed
- * replace of the given element's content.
- *
- * @param element the element
- * @see IElementStateListener#elementContentReplaced(Object)
- */
- protected void fireElementContentReplaced(Object element) {
- Iterator e= new ArrayList(fElementStateListeners).iterator();
- while (e.hasNext()) {
- IElementStateListener l= (IElementStateListener) e.next();
- l.elementContentReplaced(element);
- }
- }
-
- /**
- * Informs all registered element state listeners about the deletion
- * of the given element.
- *
- * @param element the element
- * @see IElementStateListener#elementDeleted(Object)
- */
- protected void fireElementDeleted(Object element) {
- Iterator e= new ArrayList(fElementStateListeners).iterator();
- while (e.hasNext()) {
- IElementStateListener l= (IElementStateListener) e.next();
- l.elementDeleted(element);
- }
- }
-
- /**
- * Informs all registered element state listeners about a move.
- *
- * @param originalElement the element before the move
- * @param movedElement the element after the move
- * @see IElementStateListener#elementMoved(Object, Object)
- */
- protected void fireElementMoved(Object originalElement, Object movedElement) {
- Iterator e= new ArrayList(fElementStateListeners).iterator();
- while (e.hasNext()) {
- IElementStateListener l= (IElementStateListener) e.next();
- l.elementMoved(originalElement, movedElement);
- }
- }
-
- /*
- * @see IDocumentProvider#getModificationStamp(Object)
- * @since 2.0
- */
- public long getModificationStamp(Object element) {
- return 0;
- }
-
- /*
- * @see IDocumentProvider#getSynchronizationStamp(Object)
- * @since 2.0
- */
- public long getSynchronizationStamp(Object element) {
- return 0;
- }
-
- /*
- * @see IDocumentProvider#isDeleted(Object)
- * @since 2.0
- */
- public boolean isDeleted(Object element) {
- return false;
- }
-
- /*
- * @see IDocumentProviderExtension#isReadOnly(Object)
- * @since 2.0
- */
- public boolean isReadOnly(Object element) {
- return true;
- }
-
- /*
- * @see IDocumentProviderExtension#isModifiable(Object)
- * @since 2.0
- */
- public boolean isModifiable(Object element) {
- return false;
- }
-
- /**
- * Returns whether <code>validateState</code> has been called for the given element
- * since the element's state has potentially been invalidated.
- *
- * @param element the element
- * @return whether <code>validateState</code> has been called for the given element
- * @since 2.0
- */
- public boolean isStateValidated(Object element) {
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- if (info != null)
- return info.fIsStateValidated;
- return false;
- }
-
- /**
- * Hook method for validating the state of the given element. Must not take care of cache updating etc.
- * Default implementation is empty.
- *
- * @param element the element
- * @param computationContext the context in which validation happens
- * @exception ValidateStateException in case validation succeeds, but the state cannot be changed
- * @exception CoreException in case validation fails
- * @since 2.0
- */
- protected void doValidateState(Object element, Object computationContext) throws CoreException {
- }
-
- /*
- * @see IDocumentProviderExtension#validateState(Object, Object)
- * @since 2.0
- */
- public void validateState(final Object element, final Object computationContext) throws CoreException {
- if (element == null)
- return;
-
- DocumentProviderOperation operation= new DocumentProviderOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- if (info == null)
- return;
-
- doValidateState(element, computationContext);
-
- doUpdateStateCache(element);
- info.fIsStateValidated= true;
- fireElementStateValidationChanged(element, true);
- }
- };
-
- executeOperation(operation, getProgressMonitor());
- }
-
- /**
- * Hook method for updating the state of the given element.
- * Default implementation is empty.
- *
- * @param element the element
- * @exception CoreException in case state cache updating fails
- * @since 2.0
- */
- protected void doUpdateStateCache(Object element) throws CoreException {
- }
-
- /**
- * Returns whether the state of the element must be invalidated given its
- * previous read-only state.
- *
- * @param element the element
- * @param wasReadOnly the previous read-only state
- * @return <code>true</code> if the state of the given element must be invalidated
- * @since 2.0
- */
- protected boolean invalidatesState(Object element, boolean wasReadOnly) {
- Assert.isTrue(PR10806_UC5_ENABLED != PR14469_ENABLED);
- boolean readOnlyChanged= (isReadOnly(element) != wasReadOnly && !wasReadOnly);
- if (PR14469_ENABLED)
- return readOnlyChanged && !canSaveDocument(element);
- return readOnlyChanged;
- }
-
- /*
- * @see IDocumentProviderExtension#updateStateCache(Object)
- * @since 2.0
- */
- final public void updateStateCache(Object element) throws CoreException {
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- if (info != null) {
- boolean wasReadOnly= isReadOnly(element);
- doUpdateStateCache(element);
- if (invalidatesState(element, wasReadOnly)) {
- info.fIsStateValidated= false;
- fireElementStateValidationChanged(element, false);
- }
- }
- }
-
- /*
- * @see IDocumentProviderExtension#setCanSaveDocument(Object)
- * @since 2.0
- */
- public void setCanSaveDocument(Object element) {
- if (element != null) {
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- if (info != null) {
- info.fCanBeSaved= true;
- removeUnchangedElementListeners(element, info);
- fireElementDirtyStateChanged(element, info.fCanBeSaved);
- }
- }
- }
-
- /**
- * Informs all registered element state listeners about a change in the
- * state validation of the given element.
- *
- * @param element the element
- * @param isStateValidated
- * @see IElementStateListenerExtension#elementStateValidationChanged(Object, boolean)
- * @since 2.0
- */
- protected void fireElementStateValidationChanged(Object element, boolean isStateValidated) {
- Iterator e= new ArrayList(fElementStateListeners).iterator();
- while (e.hasNext()) {
- Object o= e.next();
- if (o instanceof IElementStateListenerExtension) {
- IElementStateListenerExtension l= (IElementStateListenerExtension) o;
- l.elementStateValidationChanged(element, isStateValidated);
- }
- }
- }
-
- /**
- * Informs all registered element state listeners about the current state
- * change of the element
- *
- * @param element the element
- * @see IElementStateListenerExtension#elementStateChanging(Object)
- * @since 2.0
- */
- protected void fireElementStateChanging(Object element) {
- Iterator e= new ArrayList(fElementStateListeners).iterator();
- while (e.hasNext()) {
- Object o= e.next();
- if (o instanceof IElementStateListenerExtension) {
- IElementStateListenerExtension l= (IElementStateListenerExtension) o;
- l.elementStateChanging(element);
- }
- }
- }
-
- /**
- * Informs all registered element state listeners about the failed
- * state change of the element
- *
- * @param element the element
- * @see IElementStateListenerExtension#elementStateChangeFailed(Object)
- * @since 2.0
- */
- protected void fireElementStateChangeFailed(Object element) {
- Iterator e= new ArrayList(fElementStateListeners).iterator();
- while (e.hasNext()) {
- Object o= e.next();
- if (o instanceof IElementStateListenerExtension) {
- IElementStateListenerExtension l= (IElementStateListenerExtension) o;
- l.elementStateChangeFailed(element);
- }
- }
- }
-
- /*
- * @see IDocumentProviderExtension#getStatus(Object)
- * @since 2.0
- */
- public IStatus getStatus(Object element) {
- ElementInfo info= (ElementInfo) fElementInfoMap.get(element);
- if (info != null) {
- if (info.fStatus != null)
- return info.fStatus;
- return (info.fDocument == null ? STATUS_ERROR : STATUS_OK);
- }
-
- return STATUS_ERROR;
- }
-
- /**
- * Performs the actual work of snchronizing the given element.
- *
- * @param element the element
- * @param monitor the progress monitor
- * @since 3.0
- */
- protected void doSynchronize(Object element, IProgressMonitor monitor) throws CoreException {
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#synchronize(Object)
- * @since 2.0
- */
- public final void synchronize(final Object element) throws CoreException {
-
- if (element == null)
- return;
-
- DocumentProviderOperation operation= new DocumentProviderOperation() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- doSynchronize(element, monitor);
- }
- };
-
- executeOperation(operation, getProgressMonitor());
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension2#getProgressMonitor()
- * @since 2.1
- */
- public IProgressMonitor getProgressMonitor() {
- return fProgressMonitor == null ? new NullProgressMonitor() : fProgressMonitor;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension2#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor)
- * @since 2.1
- */
- public void setProgressMonitor(IProgressMonitor progressMonitor) {
- fProgressMonitor= progressMonitor;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension3#isSynchronized(java.lang.Object)
- * @since 3.0
- */
- public boolean isSynchronized(Object element) {
- return true;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java
deleted file mode 100644
index ad2f816e680..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.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.texteditor;
-
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.widgets.Control;
-
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * This class serves as an adapter for actions contributed to the vertical ruler's
- * context menu. This adapter provides the contributed actions access to their editor
- * and the editor's vertical ruler. These actions gain only limited access to the vertical
- * ruler as defined by <code>IVerticalRulerInfo</code>. The adapter updates the
- * adapter (inner) action on menu and mouse action on the vertical ruler.<p>
- * Extending classes must implement the factory method
- * <code>createAction(ITextEditor editor, IVerticalRulerInfo)</code>.
- * @since 2.0
- */
-public abstract class AbstractRulerActionDelegate implements IEditorActionDelegate, MouseListener, IMenuListener {
-
- /** The editor. */
- private IEditorPart fEditor;
- /** The action calling the action delegate. */
- private IAction fCallerAction;
- /** The underlying action. */
- private IAction fAction;
-
- /**
- * The factory method creating the underlying action.
- *
- * @param editor the editor the action to be created will work on
- * @param rulerInfo the vertical ruler the action to be created will work on
- * @return the created action
- */
- protected abstract IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo);
-
-
- /*
- * @see IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
- */
- public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) {
- if (fEditor != null) {
- IVerticalRulerInfo rulerInfo= (IVerticalRulerInfo) fEditor.getAdapter(IVerticalRulerInfo.class);
- if (rulerInfo != null) {
- Control control= rulerInfo.getControl();
- if (control != null && !control.isDisposed())
- control.removeMouseListener(this);
- }
-
- if (fEditor instanceof ITextEditorExtension)
- ((ITextEditorExtension) fEditor).removeRulerContextMenuListener(this);
- }
-
- fEditor= targetEditor;
- fCallerAction= callerAction;
- fAction= null;
-
- if (fEditor != null && fEditor instanceof ITextEditor) {
- if (fEditor instanceof ITextEditorExtension)
- ((ITextEditorExtension) fEditor).addRulerContextMenuListener(this);
-
- IVerticalRulerInfo rulerInfo= (IVerticalRulerInfo) fEditor.getAdapter(IVerticalRulerInfo.class);
- if (rulerInfo != null) {
- fAction= createAction((ITextEditor) fEditor, rulerInfo);
- update();
-
- Control control= rulerInfo.getControl();
- if (control != null && !control.isDisposed())
- control.addMouseListener(this);
- }
- }
- }
-
- /*
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction callerAction) {
- if (fAction != null)
- fAction.run();
- }
-
- /*
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- /**
- * Requests the adaptee to update itself to the current state.
- */
- private void update() {
- if (fAction instanceof IUpdate) {
- ((IUpdate) fAction).update();
- if (fCallerAction != null) {
- fCallerAction.setText(fAction.getText());
- fCallerAction.setEnabled(fAction.isEnabled());
- }
- }
- }
-
- /*
- * @see IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
- */
- public void menuAboutToShow(IMenuManager manager) {
- update();
- }
-
- /*
- * @see MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- /*
- * @see MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDown(MouseEvent e) {
- update();
- }
-
- /*
- * @see MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseUp(MouseEvent e) {
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
deleted file mode 100644
index 044038d8003..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
+++ /dev/null
@@ -1,4631 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Chris.Dennis@invidi.com - http://bugs.eclipse.org/bugs/show_bug.cgi?id=29027
- *******************************************************************************/
-package org.eclipse.ui.texteditor;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IPluginPrerequisite;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.ST;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.PaletteData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Caret;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-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.jface.viewers.IPostSelectionProvider;
-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.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IFindReplaceTarget;
-import org.eclipse.jface.text.IFindReplaceTargetExtension;
-import org.eclipse.jface.text.IMarkRegionTarget;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.IRewriteTarget;
-import org.eclipse.jface.text.ITextInputListener;
-import org.eclipse.jface.text.ITextListener;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewerExtension;
-import org.eclipse.jface.text.ITextViewerExtension3;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextEvent;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.IVerticalRulerExtension;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.jface.text.source.VerticalRuler;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorActionBarContributor;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IKeyBindingService;
-import org.eclipse.ui.INavigationLocation;
-import org.eclipse.ui.INavigationLocationProvider;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.EditorActionBarContributor;
-import org.eclipse.ui.part.EditorPart;
-
-import org.eclipse.ui.internal.ActionDescriptor;
-import org.eclipse.ui.internal.EditorPluginAction;
-import org.eclipse.ui.internal.texteditor.EditPosition;
-import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
-
-
-
-
-/**
- * Abstract base implementation of a text editor.
- * <p>
- * Subclasses are responsible for configuring the editor appropriately.
- * The standard text editor, <code>TextEditor</code>, is one such example.</p>
- * <p>
- * If a subclass calls <code>setEditorContextMenuId</code> the arguments is
- * used as the id under which the editor's context menu is registered for extensions.
- * If no id is set, the context menu is registered under <b>[editor_id].EditorContext</b>
- * whereby [editor_id] is replaced with the editor's part id. If the editor is instructed to
- * run in version 1.0 context menu registration compatibility mode, the latter form of the
- * registration even happens if a context menu id has been set via <code>setEditorContextMenuId</code>.
- * If no id is set while in compatibility mode, the menu is registered under
- * <code>DEFAULT_EDITOR_CONTEXT_MENU_ID</code>.</p>
- * <p>
- * If a subclass calls <code>setRulerContextMenuId</code> the argument is
- * used as the id under which the ruler's context menu is registered for extensions.
- * If no id is set, the context menu is registered under <b>[editor_id].RulerContext</b>
- * whereby [editor_id] is replaced with the editor's part id. If the editor is instructed to
- * run in version 1.0 context menu registration compatibility mode, the latter form of the
- * registration even happens if a context menu id has been set via <code>setRulerContextMenuId</code>.
- * If no id is set while in compatibility mode, the menu is registered under
- * <code>DEFAULT_RULER_CONTEXT_MENU_ID</code>.</p>
- *
- * @see org.eclipse.ui.editors.text.TextEditor
- */
-public abstract class AbstractTextEditor extends EditorPart implements ITextEditor, IReusableEditor, ITextEditorExtension, ITextEditorExtension2, ITextEditorExtension3, INavigationLocationProvider {
-
- /**
- * Tag used in xml configuration files to specify editor action contributions.
- * Current value: <code>editorContribution</code>
- * @since 2.0
- */
- private static final String TAG_CONTRIBUTION_TYPE= "editorContribution"; //$NON-NLS-1$
-
- /**
- * The text input listener.
- *
- * @see ITextInputListener
- * @since 2.1
- */
- private static class TextInputListener implements ITextInputListener {
- /** Indicates whether the editor input changed during the process of state validation. */
- public boolean inputChanged;
-
- /** Detectors for editor input changes during the process of state validation. */
- public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {}
- public void inputDocumentChanged(IDocument oldInput, IDocument newInput) { inputChanged= true; }
- }
-
- /**
- * Internal element state listener.
- */
- class ElementStateListener implements IElementStateListener, IElementStateListenerExtension {
-
- /**
- * Internal <code>VerifyListener</code> for performing the state validation of the
- * editor input in case of the first attempted manipulation via typing on the keyboard.
- * @since 2.0
- */
- class Validator implements VerifyListener {
- /*
- * @see VerifyListener#verifyText(org.eclipse.swt.events.VerifyEvent)
- */
- public void verifyText(VerifyEvent e) {
- if (! validateEditorInputState())
- e.doit= false;
- }
- }
-
- /**
- * The listener's validator.
- * @since 2.0
- */
- private Validator fValidator;
- /**
- * The display used for posting runnable into the UI thread.
- * @since 3.0
- */
- private Display fDisplay;
-
- /*
- * @see IElementStateListenerExtension#elementStateValidationChanged(Object, boolean)
- * @since 2.0
- */
- public void elementStateValidationChanged(final Object element, final boolean isStateValidated) {
- if (element != null && element.equals(getEditorInput())) {
- Runnable r= new Runnable() {
- public void run() {
- enableSanityChecking(true);
- if (isStateValidated && fValidator != null) {
- ISourceViewer viewer= getSourceViewer();
- if (viewer != null) {
- StyledText textWidget= viewer.getTextWidget();
- if (textWidget != null && !textWidget.isDisposed())
- textWidget.removeVerifyListener(fValidator);
- fValidator= null;
- enableStateValidation(false);
- }
- } else if (!isStateValidated && fValidator == null) {
- ISourceViewer viewer= getSourceViewer();
- if (viewer != null) {
- StyledText textWidget= viewer.getTextWidget();
- if (textWidget != null && !textWidget.isDisposed()) {
- fValidator= new Validator();
- enableStateValidation(true);
- textWidget.addVerifyListener(fValidator);
- }
- }
- }
- }
- };
- execute(r);
- }
- }
-
-
- /*
- * @see IElementStateListener#elementDirtyStateChanged(Object, boolean)
- */
- public void elementDirtyStateChanged(Object element, boolean isDirty) {
- if (element != null && element.equals(getEditorInput())) {
- Runnable r= new Runnable() {
- public void run() {
- enableSanityChecking(true);
- firePropertyChange(PROP_DIRTY);
- }
- };
- execute(r);
- }
- }
-
- /*
- * @see IElementStateListener#elementContentAboutToBeReplaced(Object)
- */
- public void elementContentAboutToBeReplaced(Object element) {
- if (element != null && element.equals(getEditorInput())) {
- Runnable r= new Runnable() {
- public void run() {
- enableSanityChecking(true);
- rememberSelection();
- resetHighlightRange();
- }
- };
- execute(r);
- }
- }
-
- /*
- * @see IElementStateListener#elementContentReplaced(Object)
- */
- public void elementContentReplaced(Object element) {
- if (element != null && element.equals(getEditorInput())) {
- Runnable r= new Runnable() {
- public void run() {
- enableSanityChecking(true);
- firePropertyChange(PROP_DIRTY);
- restoreSelection();
- }
- };
- execute(r);
- }
- }
-
- /*
- * @see IElementStateListener#elementDeleted(Object)
- */
- public void elementDeleted(Object deletedElement) {
- if (deletedElement != null && deletedElement.equals(getEditorInput())) {
- Runnable r= new Runnable() {
- public void run() {
- enableSanityChecking(true);
- close(false);
- }
- };
- execute(r);
- }
- }
-
- /*
- * @see IElementStateListener#elementMoved(Object, Object)
- */
- public void elementMoved(final Object originalElement, final Object movedElement) {
- if (originalElement != null && originalElement.equals(getEditorInput())) {
- Runnable r= new Runnable() {
- public void run() {
- enableSanityChecking(true);
-
- if (!canHandleMove((IEditorInput) originalElement, (IEditorInput) movedElement)) {
- close(true);
- return;
- }
-
- if (movedElement == null || movedElement instanceof IEditorInput) {
- rememberSelection();
-
- IDocumentProvider d= getDocumentProvider();
- IDocument changed= null;
- if (isDirty())
- changed= d.getDocument(getEditorInput());
-
- setInput((IEditorInput) movedElement);
-
- if (changed != null) {
- d.getDocument(getEditorInput()).set(changed.get());
- validateState(getEditorInput());
- updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE);
- }
-
- restoreSelection();
- }
- }
- };
- execute(r);
- }
- }
-
- /*
- * @see IElementStateListenerExtension#elementStateChanging(Object)
- * @since 2.0
- */
- public void elementStateChanging(Object element) {
- if (element != null && element.equals(getEditorInput()))
- enableSanityChecking(false);
- }
-
- /*
- * @see IElementStateListenerExtension#elementStateChangeFailed(Object)
- * @since 2.0
- */
- public void elementStateChangeFailed(Object element) {
- if (element != null && element.equals(getEditorInput()))
- enableSanityChecking(true);
- }
-
- /**
- * Executes the given runnable in the UI thread.
- *
- * @param runnable runnable to be executed
- * @since 3.0
- */
- private void execute(Runnable runnable) {
- if (Display.getCurrent() != null)
- runnable.run();
- else {
- if (fDisplay == null)
- fDisplay= getSite().getShell().getDisplay();
- fDisplay.asyncExec(runnable);
- }
- }
- }
-
- /**
- * Internal text listener for updating all content dependent
- * actions. The updating is done asynchronously.
- */
- class TextListener implements ITextListener {
-
- /** The posted updater code. */
- private Runnable fRunnable= new Runnable() {
- public void run() {
-
- TextEvent textEvent= (TextEvent) fTextEventQueue.remove(0);
-
- if (fSourceViewer != null) {
- // check whether editor has not been disposed yet
- if (fTextEventQueue.isEmpty())
- updateContentDependentActions();
-
- // remember the last edit position
- if (isDirty() && (textEvent.getDocumentEvent() != null)) {
- ISelection sel= getSelectionProvider().getSelection();
- IEditorInput input= getEditorInput();
- Position pos= null;
- if (sel instanceof ITextSelection) {
- int offset= ((ITextSelection)sel).getOffset();
- int length= ((ITextSelection)sel).getLength();
- pos= new Position(offset, length);
- try {
- getDocumentProvider().getDocument(input).addPosition(pos);
- } catch (BadLocationException ex) {
- // pos is null
- }
- }
- TextEditorPlugin.getDefault().setLastEditPosition(new EditPosition(input, getEditorSite().getId(), getSelectionProvider().getSelection(), pos));
- }
- }
- }
- };
-
- /** Display used for posting the updater code. */
- private Display fDisplay;
- /**
- * Display used for posting the updater code.
- * @since 2.1
- */
- private ArrayList fTextEventQueue= new ArrayList(5);
-
- /*
- * @see ITextListener#textChanged(TextEvent)
- */
- public void textChanged(TextEvent event) {
-
- /*
- * Also works for text events which do not base on a DocumentEvent.
- * This way, if the visible document of the viewer changes, all content
- * dependent actions are updated as well.
- */
-
- if (fDisplay == null)
- fDisplay= getSite().getShell().getDisplay();
-
- fTextEventQueue.add(event);
- fDisplay.asyncExec(fRunnable);
- }
- }
-
- /**
- * Compare configuration elements according to the prerequisite relation
- * of their defining plug-ins.
- *
- * @since 2.0
- */
- static class ConfigurationElementComparator implements Comparator {
-
- /*
- * @see Comparator#compare(java.lang.Object, java.lang.Object)
- * @since 2.0
- */
- public int compare(Object object0, Object object1) {
-
- IConfigurationElement element0= (IConfigurationElement)object0;
- IConfigurationElement element1= (IConfigurationElement)object1;
-
- if (dependsOn(element0, element1))
- return -1;
-
- if (dependsOn(element1, element0))
- return +1;
-
- return 0;
- }
-
- /**
- * Returns whether one configuration element depends on the other element.
- * This is done by checking the dependency chain of the defining plug-ins.
- *
- * @param element0 the first element
- * @param element1 the second element
- * @return <code>true</code> if <code>element0</code> depends on <code>element1</code>.
- * @since 2.0
- */
- private static boolean dependsOn(IConfigurationElement element0, IConfigurationElement element1) {
- IPluginDescriptor descriptor0= element0.getDeclaringExtension().getDeclaringPluginDescriptor();
- IPluginDescriptor descriptor1= element1.getDeclaringExtension().getDeclaringPluginDescriptor();
-
- return dependsOn(descriptor0, descriptor1);
- }
-
- /**
- * Returns whether one plug-in depends on the other plugin.
- *
- * @param descriptor0 descriptor of the first plug-in
- * @param descriptor1 descriptor of the second plug-in
- * @return <code>true</code> if <code>descriptor0</code> depends on <code>descriptor1</code>.
- * @since 2.0
- */
- private static boolean dependsOn(IPluginDescriptor descriptor0, IPluginDescriptor descriptor1) {
-
- IPluginRegistry registry= Platform.getPluginRegistry();
- IPluginPrerequisite[] prerequisites= descriptor0.getPluginPrerequisites();
-
- for (int i= 0; i < prerequisites.length; i++) {
- IPluginPrerequisite prerequisite= prerequisites[i];
- String id= prerequisite.getUniqueIdentifier();
- IPluginDescriptor descriptor= registry.getPluginDescriptor(id);
-
- if (descriptor != null && (descriptor.equals(descriptor1) || dependsOn(descriptor, descriptor1)))
- return true;
- }
-
- return false;
- }
- }
-
- /**
- * Internal property change listener for handling changes in the editor's preferences.
- */
- class PropertyChangeListener implements IPropertyChangeListener {
- /*
- * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- handlePreferenceStoreChanged(event);
- }
- }
-
- /**
- * Internal property change listener for handling workbench font changes.
- * @since 2.1
- */
- class FontPropertyChangeListener implements IPropertyChangeListener {
- /*
- * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (fSourceViewer == null)
- return;
-
- String property= event.getProperty();
-
- if (getFontPropertyPreferenceKey().equals(property))
- initializeViewerFont(fSourceViewer);
- }
- }
-
- /**
- * Internal key verify listener for triggering action activation codes.
- */
- class ActivationCodeTrigger implements VerifyKeyListener {
-
- /** Indicates whether this trigger has been installed. */
- private boolean fIsInstalled= false;
- /**
- * The key binding service to use.
- * @since 2.0
- */
- private IKeyBindingService fKeyBindingService;
-
- /*
- * @see VerifyKeyListener#verifyKey(org.eclipse.swt.events.VerifyEvent)
- */
- public void verifyKey(VerifyEvent event) {
-
- ActionActivationCode code= null;
- int size= fActivationCodes.size();
- for (int i= 0; i < size; i++) {
- code= (ActionActivationCode) fActivationCodes.get(i);
- if (code.matches(event)) {
- IAction action= getAction(code.fActionId);
- if (action != null) {
-
- if (action instanceof IUpdate)
- ((IUpdate) action).update();
-
- if (!action.isEnabled() && action instanceof IReadOnlyDependent) {
- IReadOnlyDependent dependent= (IReadOnlyDependent) action;
- boolean writable= dependent.isEnabled(true);
- if (writable) {
- event.doit= false;
- return;
- }
- } else if (action.isEnabled()) {
- event.doit= false;
- action.run();
- return;
- }
- }
- }
- }
- }
-
- /**
- * Installs this trigger on the editor's text widget.
- * @since 2.0
- */
- public void install() {
- if (!fIsInstalled) {
-
- if (fSourceViewer instanceof ITextViewerExtension) {
- ITextViewerExtension e= (ITextViewerExtension) fSourceViewer;
- e.prependVerifyKeyListener(this);
- } else {
- StyledText text= fSourceViewer.getTextWidget();
- text.addVerifyKeyListener(this);
- }
-
- fKeyBindingService= getEditorSite().getKeyBindingService();
- fIsInstalled= true;
- }
- }
-
- /**
- * Uninstalls this trigger from the editor's text widget.
- * @since 2.0
- */
- public void uninstall() {
- if (fIsInstalled) {
-
- if (fSourceViewer instanceof ITextViewerExtension) {
- ITextViewerExtension e= (ITextViewerExtension) fSourceViewer;
- e.removeVerifyKeyListener(this);
- } else if (fSourceViewer != null) {
- StyledText text= fSourceViewer.getTextWidget();
- if (text != null && !text.isDisposed())
- text.removeVerifyKeyListener(fActivationCodeTrigger);
- }
-
- fIsInstalled= false;
- fKeyBindingService= null;
- }
- }
-
- /**
- * Registers the given action for key activation.
- * @param action the action to be registered
- * @since 2.0
- */
- public void registerActionForKeyActivation(IAction action) {
- if (action.getActionDefinitionId() != null)
- fKeyBindingService.registerAction(action);
- }
-
- /**
- * The given action is no longer available for key activation
- * @param action the action to be unregistered
- * @since 2.0
- */
- public void unregisterActionFromKeyActivation(IAction action) {
- if (action.getActionDefinitionId() != null)
- fKeyBindingService.unregisterAction(action);
- }
-
- /**
- * Sets the keybindings scopes for this editor.
- * @param keyBindingScopes the keybinding scopes
- * @since 2.1
- */
- public void setScopes(String[] keyBindingScopes) {
- if (keyBindingScopes != null && keyBindingScopes.length > 0)
- fKeyBindingService.setScopes(keyBindingScopes);
- }
- }
-
- /**
- * Representation of action activation codes.
- */
- static class ActionActivationCode {
-
- /** The action id. */
- public String fActionId;
- /** The character. */
- public char fCharacter;
- /** The key code. */
- public int fKeyCode= -1;
- /** The state mask. */
- public int fStateMask= SWT.DEFAULT;
-
- /**
- * Creates a new action activation code for the given action id.
- * @param actionId the action id
- */
- public ActionActivationCode(String actionId) {
- fActionId= actionId;
- }
-
- /**
- * Returns <code>true</code> if this activation code matches the given verify event.
- * @param event the event to test for matching
- */
- public boolean matches(VerifyEvent event) {
- return (event.character == fCharacter &&
- (fKeyCode == -1 || event.keyCode == fKeyCode) &&
- (fStateMask == SWT.DEFAULT || event.stateMask == fStateMask));
- }
- }
-
- /**
- * Internal part and shell activation listener for triggering state validation.
- * @since 2.0
- */
- class ActivationListener extends ShellAdapter implements IPartListener {
-
- /** Cache of the active workbench part. */
- private IWorkbenchPart fActivePart;
- /** Indicates whether activation handling is currently be done. */
- private boolean fIsHandlingActivation= false;
-
- /*
- * @see IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
- */
- public void partActivated(IWorkbenchPart part) {
- fActivePart= part;
- handleActivation();
- }
-
- /*
- * @see IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)
- */
- public void partBroughtToTop(IWorkbenchPart part) {
- }
-
- /*
- * @see IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part) {
- }
-
- /*
- * @see IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part) {
- fActivePart= null;
- }
-
- /*
- * @see IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
- */
- public void partOpened(IWorkbenchPart part) {
- }
-
- /*
- * @see ShellListener#shellActivated(org.eclipse.swt.events.ShellEvent)
- */
- public void shellActivated(ShellEvent e) {
- /*
- * Workaround for problem described in
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11731
- * Will be removed when SWT has solved the problem.
- */
- e.widget.getDisplay().asyncExec(new Runnable() {
- public void run() {
- handleActivation();
- }
- });
- }
-
- /**
- * Handles the activation triggering a element state check in the editor.
- */
- private void handleActivation() {
- if (fIsHandlingActivation)
- return;
-
- if (fActivePart == AbstractTextEditor.this) {
- fIsHandlingActivation= true;
- try {
- safelySanityCheckState(getEditorInput());
- } finally {
- fIsHandlingActivation= false;
- }
- }
- }
- }
-
- /**
- * Internal interface for a cursor listener. I.e. aggregation
- * of mouse and key listener.
- * @since 2.0
- */
- interface ICursorListener extends MouseListener, KeyListener {
- }
-
- /**
- * Maps an action definition id to an StyledText action.
- * @since 2.0
- */
- static class IdMapEntry {
-
- /** The action id. */
- private String fActionId;
- /** The StyledText action. */
- private int fAction;
-
- /**
- * Creates a new mapping.
- * @param actionId the action id
- * @param action the StyledText action
- */
- public IdMapEntry(String actionId, int action) {
- fActionId= actionId;
- fAction= action;
- }
-
- /**
- * Returns the action id.
- * @return the action id
- */
- public String getActionId() {
- return fActionId;
- }
-
- /**
- * Returns the action.
- * @return the action
- */
- public int getAction() {
- return fAction;
- }
- }
-
- /**
- * Internal action to scroll the editor's viewer by a specified number of lines.
- * @since 2.0
- */
- class ScrollLinesAction extends Action {
-
- /** Number of lines to scroll. */
- private int fScrollIncrement;
-
- /**
- * Creates a new scroll action that scroll the given number of lines. If the
- * increment is &lt 0, it's scrolling up, if &gt 0 it's scrolling down.
- * @param scrollIncrement the number of lines to scroll
- */
- public ScrollLinesAction(int scrollIncrement) {
- fScrollIncrement= scrollIncrement;
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- ISourceViewer viewer= getSourceViewer();
- int topIndex= viewer.getTopIndex();
- int newTopIndex= Math.max(0, topIndex + fScrollIncrement);
- viewer.setTopIndex(newTopIndex);
- }
- }
-
- /**
- * Action to toggle the insert mode.
- * @since 2.1
- */
- class ToggleInsertModeAction extends TextNavigationAction {
-
- public ToggleInsertModeAction(StyledText textWidget) {
- super(textWidget, ST.TOGGLE_OVERWRITE);
- }
-
- /*
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- switchToNextInsertMode();
- }
- }
-
- /**
- * This action implements smart end.
- * Instead of going to the end of a line it does the following:
- * - if smart home/end is enabled and the caret is before the line's last non-whitespace and then the caret is moved directly after it
- * - if the caret is after last non-whitespace the caret is moved at the end of the line
- * - if the caret is at the end of the line the caret is moved directly after the line's last non-whitespace character
- * @since 2.1
- */
- class LineEndAction extends TextNavigationAction {
-
- /** boolean flag which tells if the text up to the line end should be selected. */
- private boolean fDoSelect;
-
- /**
- * Create a new line end action.
- *
- * @param textWidget the styled text widget
- * @param doSelect a boolean flag which tells if the text up to the line end should be selected
- */
- public LineEndAction(StyledText textWidget, boolean doSelect) {
- super(textWidget, ST.LINE_END);
- fDoSelect= doSelect;
- }
-
- /*
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- boolean isSmartHomeEndEnabled= false;
- IPreferenceStore store= getPreferenceStore();
- if (store != null)
- isSmartHomeEndEnabled= store.getBoolean(AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END);
-
- StyledText st= getSourceViewer().getTextWidget();
- if (st == null || st.isDisposed())
- return;
- int caretOffset= st.getCaretOffset();
- int lineNumber= st.getLineAtOffset(caretOffset);
- int lineOffset= st.getOffsetAtLine(lineNumber);
-
- int lineLength;
- try {
- int caretOffsetInDocument= widgetOffset2ModelOffset(getSourceViewer(), caretOffset);
- lineLength= getSourceViewer().getDocument().getLineInformationOfOffset(caretOffsetInDocument).getLength();
- } catch (BadLocationException ex) {
- return;
- }
- int lineEndOffset= lineOffset + lineLength;
-
- int delta= lineEndOffset - st.getCharCount();
- if (delta > 0) {
- lineEndOffset -= delta;
- lineLength -= delta;
- }
-
- String line= ""; //$NON-NLS-1$
- if (lineLength > 0)
- line= st.getText(lineOffset, lineEndOffset - 1);
- int i= lineLength - 1;
- while (i > -1 && Character.isWhitespace(line.charAt(i))) {
- i--;
- }
- i++;
-
- // Remember current selection
- Point oldSelection= st.getSelection();
-
- // Compute new caret position
- int newCaretOffset= -1;
-
- if (isSmartHomeEndEnabled) {
-
- if (caretOffset - lineOffset == i)
- // to end of line
- newCaretOffset= lineEndOffset;
- else
- // to end of text
- newCaretOffset= lineOffset + i;
-
- } else {
-
- if (caretOffset < lineEndOffset)
- // to end of line
- newCaretOffset= lineEndOffset;
-
- }
-
- if (newCaretOffset == -1)
- newCaretOffset= caretOffset;
- else
- st.setCaretOffset(newCaretOffset);
-
- st.setCaretOffset(newCaretOffset);
- if (fDoSelect) {
- if (caretOffset < oldSelection.y)
- st.setSelection(oldSelection.y, newCaretOffset);
- else
- st.setSelection(oldSelection.x, newCaretOffset);
- } else
- st.setSelection(newCaretOffset);
-
- fireSelectionChanged(oldSelection);
- }
- }
-
- /**
- * This action implements smart home.
- * Instead of going to the start of a line it does the following:
- * - if smart home/end is enabled and the caret is after the line's first non-whitespace then the caret is moved directly before it
- * - if the caret is before the line's first non-whitespace the caret is moved to the beginning of the line
- * - if the caret is at the beginning of the line the caret is moved directly before the line's first non-whitespace character
- * @since 2.1
- */
- protected class LineStartAction extends TextNavigationAction {
-
- /** boolean flag which tells if the text up to the beginning of the line should be selected. */
- private final boolean fDoSelect;
-
- /**
- * Creates a new line start action.
- *
- * @param textWidget the styled text widget
- * @param doSelect a boolean flag which tells if the text up to the beginning of the line should be selected
- */
- public LineStartAction(final StyledText textWidget, final boolean doSelect) {
- super(textWidget, ST.LINE_START);
- fDoSelect= doSelect;
- }
-
- /**
- * Computes the offset of the line start position.
- *
- * @param document The document where to compute the line start position
- * @param line The line to determine the start position of
- * @param length The length of the line
- * @param offset The caret position in the document
- * @return The offset of the line start
- */
- protected int getLineStartPosition(final IDocument document, final String line, final int length, final int offset) {
- int index= 0;
- while (index < length && Character.isWhitespace(line.charAt(index)))
- index++;
- return index;
- }
-
- /*
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- boolean isSmartHomeEndEnabled= false;
- IPreferenceStore store= getPreferenceStore();
- if (store != null)
- isSmartHomeEndEnabled= store.getBoolean(AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END);
-
- StyledText st= getSourceViewer().getTextWidget();
- if (st == null || st.isDisposed())
- return;
-
- int caretOffset= st.getCaretOffset();
- int lineNumber= st.getLineAtOffset(caretOffset);
- int lineOffset= st.getOffsetAtLine(lineNumber);
-
- int lineLength;
- int caretOffsetInDocument;
- final IDocument document= getSourceViewer().getDocument();
-
- try {
- caretOffsetInDocument= widgetOffset2ModelOffset(getSourceViewer(), caretOffset);
- lineLength= document.getLineInformationOfOffset(caretOffsetInDocument).getLength();
- } catch (BadLocationException ex) {
- return;
- }
-
- String line= ""; //$NON-NLS-1$
- if (lineLength > 0) {
- int end= lineOffset + lineLength - 1;
- end= Math.min(end, st.getCharCount() -1);
- line= st.getText(lineOffset, end);
- }
-
- // Compute the line start offset
- int index= getLineStartPosition(document, line, lineLength, caretOffsetInDocument);
-
- // Remember current selection
- Point oldSelection= st.getSelection();
-
- // Compute new caret position
- int newCaretOffset= -1;
- if (isSmartHomeEndEnabled) {
-
- if (caretOffset - lineOffset == index)
- // to beginning of line
- newCaretOffset= lineOffset;
- else
- // to beginning of text
- newCaretOffset= lineOffset + index;
-
- } else {
-
- if (caretOffset > lineOffset)
- // to beginning of line
- newCaretOffset= lineOffset;
- }
-
- if (newCaretOffset == -1)
- newCaretOffset= caretOffset;
- else
- st.setCaretOffset(newCaretOffset);
-
- if (fDoSelect) {
- if (caretOffset < oldSelection.y)
- st.setSelection(oldSelection.y, newCaretOffset);
- else
- st.setSelection(oldSelection.x, newCaretOffset);
- } else
- st.setSelection(newCaretOffset);
-
- fireSelectionChanged(oldSelection);
- }
-
- }
-
- /**
- * Internal action to show the editor's ruler context menu (accessibility).
- * @since 2.0
- */
- class ShowRulerContextMenuAction extends Action {
- /*
- * @see IAction#run()
- */
- public void run() {
- if (fSourceViewer == null)
- return;
-
- StyledText text= fSourceViewer.getTextWidget();
- if (text == null || text.isDisposed())
- return;
-
- Point location= text.getLocationAtOffset(text.getCaretOffset());
- location.x= 0;
-
- if (fVerticalRuler instanceof IVerticalRulerExtension)
- ((IVerticalRulerExtension) fVerticalRuler).setLocationOfLastMouseButtonActivity(location.x, location.y);
-
- location= text.toDisplay(location);
- fRulerContextMenu.setLocation(location.x, location.y);
- fRulerContextMenu.setVisible(true);
- }
- }
-
-
- /**
- * Editor specific selection provider which wraps the source viewer's selection provider.
- * @since 2.1
- */
- class SelectionProvider implements IPostSelectionProvider {
-
- /*
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- if (fSourceViewer != null)
- fSourceViewer.getSelectionProvider().addSelectionChangedListener(listener);
- }
-
- /*
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- public ISelection getSelection() {
- return doGetSelection();
- }
-
- /*
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- if (fSourceViewer != null)
- fSourceViewer.getSelectionProvider().removeSelectionChangedListener(listener);
- }
-
- /*
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(ISelection)
- */
- public void setSelection(ISelection selection) {
- doSetSelection(selection);
- }
-
- /*
- * @see org.eclipse.jface.text.IPostSelectionProvider#addPostSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void addPostSelectionChangedListener(ISelectionChangedListener listener) {
- if (fSourceViewer != null) {
- if (fSourceViewer.getSelectionProvider() instanceof IPostSelectionProvider) {
- IPostSelectionProvider provider= (IPostSelectionProvider) fSourceViewer.getSelectionProvider();
- provider.addPostSelectionChangedListener(listener);
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IPostSelectionProvider#removePostSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void removePostSelectionChangedListener(ISelectionChangedListener listener) {
- if (fSourceViewer != null) {
- if (fSourceViewer.getSelectionProvider() instanceof IPostSelectionProvider) {
- IPostSelectionProvider provider= (IPostSelectionProvider) fSourceViewer.getSelectionProvider();
- provider.removePostSelectionChangedListener(listener);
- }
- }
- }
- }
-
- /**
- * Key used to look up font preference.
- * Value: <code>"org.eclipse.jface.textfont"</code>
- *
- * @deprecated As of 2.1, replaced by {@link JFaceResources#TEXT_FONT}
- */
- public final static String PREFERENCE_FONT= JFaceResources.TEXT_FONT;
- /**
- * Key used to look up foreground color preference.
- * Value: <code>AbstractTextEditor.Color.Foreground</code>
- * @since 2.0
- */
- public final static String PREFERENCE_COLOR_FOREGROUND= "AbstractTextEditor.Color.Foreground"; //$NON-NLS-1$
- /**
- * Key used to look up background color preference.
- * Value: <code>AbstractTextEditor.Color.Background</code>
- * @since 2.0
- */
- public final static String PREFERENCE_COLOR_BACKGROUND= "AbstractTextEditor.Color.Background"; //$NON-NLS-1$
- /**
- * Key used to look up foreground color system default preference.
- * Value: <code>AbstractTextEditor.Color.Foreground.SystemDefault</code>
- * @since 2.0
- */
- public final static String PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT= "AbstractTextEditor.Color.Foreground.SystemDefault"; //$NON-NLS-1$
- /**
- * Key used to look up background color system default preference.
- * Value: <code>AbstractTextEditor.Color.Background.SystemDefault</code>
- * @since 2.0
- */
- public final static String PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT= "AbstractTextEditor.Color.Background.SystemDefault"; //$NON-NLS-1$
- /**
- * Key used to look up find scope background color preference.
- * Value: <code>AbstractTextEditor.Color.FindScope</code>
- * @since 2.0
- */
- public final static String PREFERENCE_COLOR_FIND_SCOPE= "AbstractTextEditor.Color.FindScope"; //$NON-NLS-1$
- /**
- * Key used to look up smart home/end preference.
- * Value: <code>AbstractTextEditor.Navigation.SmartHomeEnd</code>
- * @since 2.1
- */
- public final static String PREFERENCE_NAVIGATION_SMART_HOME_END= "AbstractTextEditor.Navigation.SmartHomeEnd"; //$NON-NLS-1$
-
-
- /** Menu id for the editor context menu. */
- public final static String DEFAULT_EDITOR_CONTEXT_MENU_ID= "#EditorContext"; //$NON-NLS-1$
- /** Menu id for the ruler context menu. */
- public final static String DEFAULT_RULER_CONTEXT_MENU_ID= "#RulerContext"; //$NON-NLS-1$
-
- /** The width of the vertical ruler. */
- protected final static int VERTICAL_RULER_WIDTH= 12;
-
- /**
- * The complete mapping between action definition ids used by eclipse and StyledText actions.
- * @since 2.0
- */
- protected final static IdMapEntry[] ACTION_MAP= new IdMapEntry[] {
- // navigation
- new IdMapEntry(ITextEditorActionDefinitionIds.LINE_UP, ST.LINE_UP),
- new IdMapEntry(ITextEditorActionDefinitionIds.LINE_DOWN, ST.LINE_DOWN),
- new IdMapEntry(ITextEditorActionDefinitionIds.LINE_START, ST.LINE_START),
- new IdMapEntry(ITextEditorActionDefinitionIds.LINE_END, ST.LINE_END),
- new IdMapEntry(ITextEditorActionDefinitionIds.COLUMN_PREVIOUS, ST.COLUMN_PREVIOUS),
- new IdMapEntry(ITextEditorActionDefinitionIds.COLUMN_NEXT, ST.COLUMN_NEXT),
- new IdMapEntry(ITextEditorActionDefinitionIds.PAGE_UP, ST.PAGE_UP),
- new IdMapEntry(ITextEditorActionDefinitionIds.PAGE_DOWN, ST.PAGE_DOWN),
- new IdMapEntry(ITextEditorActionDefinitionIds.WORD_PREVIOUS, ST.WORD_PREVIOUS),
- new IdMapEntry(ITextEditorActionDefinitionIds.WORD_NEXT, ST.WORD_NEXT),
- new IdMapEntry(ITextEditorActionDefinitionIds.TEXT_START, ST.TEXT_START),
- new IdMapEntry(ITextEditorActionDefinitionIds.TEXT_END, ST.TEXT_END),
- new IdMapEntry(ITextEditorActionDefinitionIds.WINDOW_START, ST.WINDOW_START),
- new IdMapEntry(ITextEditorActionDefinitionIds.WINDOW_END, ST.WINDOW_END),
- // selection
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_LINE_UP, ST.SELECT_LINE_UP),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_LINE_DOWN, ST.SELECT_LINE_DOWN),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_LINE_START, ST.SELECT_LINE_START),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_LINE_END, ST.SELECT_LINE_END),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_COLUMN_PREVIOUS, ST.SELECT_COLUMN_PREVIOUS),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_COLUMN_NEXT, ST.SELECT_COLUMN_NEXT),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_PAGE_UP, ST.SELECT_PAGE_UP),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_PAGE_DOWN, ST.SELECT_PAGE_DOWN),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS, ST.SELECT_WORD_PREVIOUS),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT, ST.SELECT_WORD_NEXT),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_TEXT_START, ST.SELECT_TEXT_START),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_TEXT_END, ST.SELECT_TEXT_END),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_WINDOW_START, ST.SELECT_WINDOW_START),
- new IdMapEntry(ITextEditorActionDefinitionIds.SELECT_WINDOW_END, ST.SELECT_WINDOW_END),
- // modification
- new IdMapEntry(ITextEditorActionDefinitionIds.CUT, ST.CUT),
- new IdMapEntry(ITextEditorActionDefinitionIds.COPY, ST.COPY),
- new IdMapEntry(ITextEditorActionDefinitionIds.PASTE, ST.PASTE),
- new IdMapEntry(ITextEditorActionDefinitionIds.DELETE_PREVIOUS, ST.DELETE_PREVIOUS),
- new IdMapEntry(ITextEditorActionDefinitionIds.DELETE_NEXT, ST.DELETE_NEXT),
- new IdMapEntry(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD, ST.DELETE_WORD_PREVIOUS),
- new IdMapEntry(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD, ST.DELETE_WORD_NEXT),
- // miscellaneous
- new IdMapEntry(ITextEditorActionDefinitionIds.TOGGLE_OVERWRITE, ST.TOGGLE_OVERWRITE)
- };
-
- private final String fReadOnlyLabel = EditorMessages.getString("Editor.statusline.state.readonly.label"); //$NON-NLS-1$
- private final String fWritableLabel = EditorMessages.getString("Editor.statusline.state.writable.label"); //$NON-NLS-1$
- private final String fInsertModeLabel = EditorMessages.getString("Editor.statusline.mode.insert.label"); //$NON-NLS-1$
- private final String fOverwriteModeLabel = EditorMessages.getString("Editor.statusline.mode.overwrite.label"); //$NON-NLS-1$
- private final String fSmartInsertModeLabel= EditorMessages.getString("Editor.statusline.mode.smartinsert.label"); //$NON-NLS-1$
-
- /** The error message shown in the status line in case of failed information look up. */
- protected final String fErrorLabel= EditorMessages.getString("Editor.statusline.error.label"); //$NON-NLS-1$
-
- /**
- * Data structure for the position label value.
- */
- private static class PositionLabelValue {
-
- public int fValue;
-
- public String toString() {
- return String.valueOf(fValue);
- }
- }
- /** The pattern used to show the position label in the status line. */
- private final String fPositionLabelPattern= EditorMessages.getString("Editor.statusline.position.pattern"); //$NON-NLS-1$
- /** The position label value of the current line. */
- private final PositionLabelValue fLineLabel= new PositionLabelValue();
- /** The position label value of the current column. */
- private final PositionLabelValue fColumnLabel= new PositionLabelValue();
- /** The arguments for the position label pattern. */
- private final Object[] fPositionLabelPatternArguments= new Object[] { fLineLabel, fColumnLabel };
-
-
-
-
-
- /** The editor's explicit document provider. */
- private IDocumentProvider fExplicitDocumentProvider;
- /** The editor's preference store. */
- private IPreferenceStore fPreferenceStore;
- /** The editor's range indicator. */
- private Annotation fRangeIndicator;
- /** The editor's source viewer configuration. */
- private SourceViewerConfiguration fConfiguration;
- /** The editor's source viewer. */
- private ISourceViewer fSourceViewer;
- /**
- * The editor's selection provider.
- * @since 2.1
- */
- private SelectionProvider fSelectionProvider= new SelectionProvider();
- /** The editor's font. */
- private Font fFont; /**
- * The editor's foreground color.
- * @since 2.0
- */
- private Color fForegroundColor;
- /**
- * The editor's background color.
- * @since 2.0
- */
- private Color fBackgroundColor;
- /**
- * The find scope's highlight color.
- * @since 2.0
- */
- private Color fFindScopeHighlightColor;
-
- /**
- * The editor's status line.
- * @since 2.1
- */
- private IEditorStatusLine fEditorStatusLine;
- /** The editor's vertical ruler. */
- private IVerticalRuler fVerticalRuler;
- /** The editor's context menu id. */
- private String fEditorContextMenuId;
- /** The ruler's context menu id. */
- private String fRulerContextMenuId;
- /** The editor's help context id. */
- private String fHelpContextId;
- /** The editor's presentation mode. */
- private boolean fShowHighlightRangeOnly;
- /** The actions registered with the editor. */
- private Map fActions= new HashMap(10);
- /** The actions marked as selection dependent. */
- private List fSelectionActions= new ArrayList(5);
- /** The actions marked as content dependent. */
- private List fContentActions= new ArrayList(5);
- /**
- * The actions marked as property dependent.
- * @since 2.0
- */
- private List fPropertyActions= new ArrayList(5);
- /**
- * The actions marked as state dependent.
- * @since 2.0
- */
- private List fStateActions= new ArrayList(5);
- /** The editor's action activation codes. */
- private List fActivationCodes= new ArrayList(2);
- /** The verify key listener for activation code triggering. */
- private ActivationCodeTrigger fActivationCodeTrigger= new ActivationCodeTrigger();
- /** Context menu listener. */
- private IMenuListener fMenuListener;
- /** Vertical ruler mouse listener. */
- private MouseListener fMouseListener;
- /** Selection changed listener. */
- private ISelectionChangedListener fSelectionChangedListener;
- /** Title image to be disposed. */
- private Image fTitleImage;
- /** The text context menu to be disposed. */
- private Menu fTextContextMenu;
- /** The ruler context menu to be disposed. */
- private Menu fRulerContextMenu;
- /** The editor's element state listener. */
- private IElementStateListener fElementStateListener= new ElementStateListener();
- /**
- * The editor's text input listener.
- * @since 2.1
- */
- private TextInputListener fTextInputListener= new TextInputListener();
- /** The editor's text listener. */
- private ITextListener fTextListener= new TextListener();
- /** The editor's property change listener. */
- private IPropertyChangeListener fPropertyChangeListener= new PropertyChangeListener();
- /**
- * The editor's font properties change listener.
- * @since 2.1
- */
- private IPropertyChangeListener fFontPropertyChangeListener= new FontPropertyChangeListener();
-
- /**
- * The editor's activation listener.
- * @since 2.0
- */
- private ActivationListener fActivationListener= new ActivationListener();
- /**
- * The map of the editor's status fields.
- * @since 2.0
- */
- private Map fStatusFields;
- /**
- * The editor's cursor listener.
- * @since 2.0
- */
- private ICursorListener fCursorListener;
- /**
- * The editor's remembered text selection.
- * @since 2.0
- */
- private ISelection fRememberedSelection;
- /**
- * Indicates whether the editor runs in 1.0 context menu registration compatibility mode.
- * @since 2.0
- */
- private boolean fCompatibilityMode= true;
- /**
- * The number of reentrances into error correction code while saving.
- * @since 2.0
- */
- private int fErrorCorrectionOnSave;
- /**
- * The delete line target.
- * @since 2.1
- */
- private DeleteLineTarget fDeleteLineTarget;
- /**
- * The incremental find target.
- * @since 2.0
- */
- private IncrementalFindTarget fIncrementalFindTarget;
- /**
- * The mark region target.
- * @since 2.0
- */
- private IMarkRegionTarget fMarkRegionTarget;
- /**
- * Cached modification stamp of the editor's input.
- * @since 2.0
- */
- private long fModificationStamp= -1;
- /**
- * Ruler context menu listeners.
- * @since 2.0
- */
- private List fRulerContextMenuListeners= new ArrayList();
- /**
- * Indicates whether sanity checking in enabled.
- * @since 2.0
- */
- private boolean fIsSanityCheckEnabled= true;
- /**
- * The find replace target.
- * @since 2.1
- */
- private FindReplaceTarget fFindReplaceTarget;
- /**
- * Indicates whether state validation is enabled.
- * @since 2.1
- */
- private boolean fIsStateValidationEnabled= true;
- /**
- * The key binding scopes of this editor.
- * @since 2.1
- */
- private String[] fKeyBindingScopes;
- /**
- * The editor's insert mode.
- * @since 3.0
- */
- private InsertMode fInsertMode= SMART_INSERT;
- /**
- * The sequence of legal editor insert modes.
- * @since 3.0
- */
- private List fLegalInsertModes= null;
- /**
- * The caret used in overwrite mode.
- * @since 3.0
- */
- private Caret fOverwriteModeCaret;
- /**
- * The caret used in insert mode.
- * @since 3.0
- */
- private Caret fInsertModeCaret;
- /**
- * The caret used in smart insert mode.
- * @since 3.0
- */
- private Caret fSmartInsertModeCaret;
-
-
- /**
- * Creates a new text editor. If not explicitly set, this editor uses
- * a <code>SourceViewerConfiguration</code> to configure its
- * source viewer. This viewer does not have a range indicator installed,
- * nor any menu id set. By default, the created editor runs in 1.0 context
- * menu registration compatibility mode.
- */
- protected AbstractTextEditor() {
- super();
- fEditorContextMenuId= null;
- fRulerContextMenuId= null;
- fHelpContextId= null;
- }
-
- /*
- * @see ITextEditor#getDocumentProvider()
- */
- public IDocumentProvider getDocumentProvider() {
- return fExplicitDocumentProvider;
- }
-
- /**
- * Returns the editor's range indicator.
- *
- * @return the editor's range indicator
- */
- protected final Annotation getRangeIndicator() {
- return fRangeIndicator;
- }
-
- /**
- * Returns the editor's source viewer configuration.
- *
- * @return the editor's source viewer configuration
- */
- protected final SourceViewerConfiguration getSourceViewerConfiguration() {
- return fConfiguration;
- }
-
- /**
- * Returns the editor's source viewer.
- *
- * @return the editor's source viewer
- */
- protected final ISourceViewer getSourceViewer() {
- return fSourceViewer;
- }
-
- /**
- * Returns the editor's vertical ruler.
- *
- * @return the editor's vertical ruler
- */
- protected final IVerticalRuler getVerticalRuler() {
- return fVerticalRuler;
- }
-
- /**
- * Returns the editor's context menu id.
- *
- * @return the editor's context menu id
- */
- protected final String getEditorContextMenuId() {
- return fEditorContextMenuId;
- }
-
- /**
- * Returns the ruler's context menu id.
- *
- * @return the ruler's context menu id
- */
- protected final String getRulerContextMenuId() {
- return fRulerContextMenuId;
- }
-
- /**
- * Returns the editor's help context id.
- *
- * @return the editor's help context id
- */
- protected final String getHelpContextId() {
- return fHelpContextId;
- }
-
- /**
- * Returns this editor's preference store.
- *
- * @return this editor's preference store
- */
- protected final IPreferenceStore getPreferenceStore() {
- return fPreferenceStore;
- }
-
- /**
- * Sets this editor's document provider. This method must be
- * called before the editor's control is created.
- *
- * @param provider the document provider
- */
- protected void setDocumentProvider(IDocumentProvider provider) {
- Assert.isNotNull(provider);
- fExplicitDocumentProvider= provider;
- }
-
- /**
- * Sets this editor's source viewer configuration used to configure its
- * internal source viewer. This method must be called before the editor's
- * control is created. If not, this editor uses a <code>SourceViewerConfiguration</code>.
- *
- * @param configuration the source viewer configuration object
- */
- protected void setSourceViewerConfiguration(SourceViewerConfiguration configuration) {
- Assert.isNotNull(configuration);
- fConfiguration= configuration;
- }
-
- /**
- * Sets the annotation which this editor uses to represent the highlight
- * range if the editor is configured to show the entire document. If the
- * range indicator is not set, this editor uses a <code>DefaultRangeIndicator</code>.
- *
- * @param rangeIndicator the annotation
- */
- protected void setRangeIndicator(Annotation rangeIndicator) {
- Assert.isNotNull(rangeIndicator);
- fRangeIndicator= rangeIndicator;
- }
-
- /**
- * Sets this editor's context menu id.
- *
- * @param contextMenuId the context menu id
- */
- protected void setEditorContextMenuId(String contextMenuId) {
- Assert.isNotNull(contextMenuId);
- fEditorContextMenuId= contextMenuId;
- }
-
- /**
- * Sets the ruler's context menu id.
- *
- * @param contextMenuId the context menu id
- */
- protected void setRulerContextMenuId(String contextMenuId) {
- Assert.isNotNull(contextMenuId);
- fRulerContextMenuId= contextMenuId;
- }
-
- /**
- * Sets the context menu registration 1.0 compatibility mode. (See class
- * description for more details.)
- *
- * @param compatible <code>true</code> if compatibility mode is enabled
- * @since 2.0
- */
- protected final void setCompatibilityMode(boolean compatible) {
- fCompatibilityMode= compatible;
- }
-
- /**
- * Sets the editor's help context id.
- *
- * @param helpContextId the help context id
- */
- protected void setHelpContextId(String helpContextId) {
- Assert.isNotNull(helpContextId);
- fHelpContextId= helpContextId;
- }
-
- /**
- * Sets the keybinding scopes for this editor.
- *
- * @param scopes the scopes
- * @since 2.1
- */
- protected void setKeyBindingScopes(String[] scopes) {
- Assert.isTrue(scopes != null && scopes.length > 0);
- fKeyBindingScopes= scopes;
- }
-
- /**
- * Sets this editor's preference store. This method must be
- * called before the editor's control is created.
- *
- * @param store the new preference store
- */
- protected void setPreferenceStore(IPreferenceStore store) {
- if (fPreferenceStore != null)
- fPreferenceStore.removePropertyChangeListener(fPropertyChangeListener);
-
- fPreferenceStore= store;
-
- if (fPreferenceStore != null)
- fPreferenceStore.addPropertyChangeListener(fPropertyChangeListener);
- }
-
- /*
- * @see ITextEditor#isEditable()
- */
- public boolean isEditable() {
- IDocumentProvider provider= getDocumentProvider();
- if (provider instanceof IDocumentProviderExtension) {
- IDocumentProviderExtension extension= (IDocumentProviderExtension) provider;
- return extension.isModifiable(getEditorInput());
- }
- return false;
- }
-
- /*
- * @see ITextEditor#getSelectionProvider()
- */
- public ISelectionProvider getSelectionProvider() {
- return fSelectionProvider;
- }
-
- /**
- * Remembers the current selection of this editor. This method is called when, e.g.,
- * the content of the editor is about to be reverted to the saved state. This method
- * remembers the selection in a semantic format, i.e., in a format which allows to
- * restore the selection even if the originally selected text is no longer part of the
- * editor's content.
- * <p>
- * Subclasses should implement this method including all necessary state. This
- * default implementation remembers the textual range only and is thus purely
- * syntactic.</p>
- *
- * @see #restoreSelection
- * @since 2.0
- */
- protected void rememberSelection() {
- fRememberedSelection= doGetSelection();
- }
-
- /**
- * Returns the current selection.
- * @return ISelection
- * @since 2.1
- */
- protected ISelection doGetSelection() {
- ISelectionProvider sp= null;
- if (fSourceViewer != null)
- sp= fSourceViewer.getSelectionProvider();
- return (sp == null ? null : sp.getSelection());
- }
-
- /**
- * Restores a selection previously remembered by <code>rememberSelection</code>.
- * Subclasses may reimplement this method and thereby semantically adapt the
- * remembered selection. This default implementation just selects the
- * remembered textual range.
- *
- * @see #rememberSelection
- * @since 2.0
- */
- protected void restoreSelection() {
- if (fRememberedSelection instanceof ITextSelection) {
- ITextSelection textSelection= (ITextSelection)fRememberedSelection;
- if (isValidSelection(textSelection.getOffset(), textSelection.getLength()))
- doSetSelection(fRememberedSelection);
- }
- fRememberedSelection= null;
- }
-
- /**
- * Tells whether the given selection is valid.
- *
- * @param offset the offset of the selection
- * @param length the length of the selection
- * @return <code>true</code> if the selection is valid
- * @since 2.1
- */
- private boolean isValidSelection(int offset, int length) {
- IDocumentProvider provider= getDocumentProvider();
- if (provider != null) {
- IDocument document= provider.getDocument(getEditorInput());
- if (document != null) {
- int end= offset + length;
- int documentLength= document.getLength();
- return 0 <= offset && offset <= documentLength && 0 <= end && end <= documentLength;
- }
- }
- return false;
- }
-
- /**
- * Sets the given selection.
- * @param selection
- * @since 2.1
- */
- protected void doSetSelection(ISelection selection) {
- if (selection instanceof ITextSelection) {
- ITextSelection textSelection= (ITextSelection) selection;
- selectAndReveal(textSelection.getOffset(), textSelection.getLength());
- }
- }
-
- /**
- * Creates and returns the listener on this editor's context menus.
- *
- * @return the menu listener
- */
- protected final IMenuListener getContextMenuListener() {
- if (fMenuListener == null) {
- fMenuListener= new IMenuListener() {
-
- public void menuAboutToShow(IMenuManager menu) {
- String id= menu.getId();
- if (getRulerContextMenuId().equals(id)) {
- setFocus();
- rulerContextMenuAboutToShow(menu);
- } else if (getEditorContextMenuId().equals(id)) {
- setFocus();
- editorContextMenuAboutToShow(menu);
- }
- }
- };
- }
- return fMenuListener;
- }
-
- /**
- * Creates and returns the listener on this editor's vertical ruler.
- *
- * @return the mouse listener
- */
- protected final MouseListener getRulerMouseListener() {
- if (fMouseListener == null) {
- fMouseListener= new MouseListener() {
-
- private boolean fDoubleClicked= false;
-
- private void triggerAction(String actionID) {
- IAction action= getAction(actionID);
- if (action != null) {
- if (action instanceof IUpdate)
- ((IUpdate) action).update();
- if (action.isEnabled())
- action.run();
- }
- }
-
- public void mouseUp(MouseEvent e) {
- setFocus();
- if (1 == e.button && !fDoubleClicked)
- triggerAction(ITextEditorActionConstants.RULER_CLICK);
- fDoubleClicked= false;
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- if (1 == e.button) {
- fDoubleClicked= true;
- triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK);
- }
- }
-
- public void mouseDown(MouseEvent e) {
- StyledText text= fSourceViewer.getTextWidget();
- if (text != null && !text.isDisposed()) {
- Display display= text.getDisplay();
- Point location= display.getCursorLocation();
- fRulerContextMenu.setLocation(location.x, location.y);
- }
- }
- };
- }
- return fMouseListener;
- }
-
- /**
- * Returns this editor's selection changed listener to be installed
- * on the editor's source viewer.
- *
- * @return the listener
- */
- protected final ISelectionChangedListener getSelectionChangedListener() {
- if (fSelectionChangedListener == null) {
- fSelectionChangedListener= new ISelectionChangedListener() {
-
- private Runnable fRunnable= new Runnable() {
- public void run() {
- // check whether editor has not been disposed yet
- if (fSourceViewer != null) {
- updateSelectionDependentActions();
- }
- }
- };
-
- private Display fDisplay;
-
- public void selectionChanged(SelectionChangedEvent event) {
- if (fDisplay == null)
- fDisplay= getSite().getShell().getDisplay();
- fDisplay.asyncExec(fRunnable);
- handleCursorPositionChanged();
- }
- };
- }
-
- return fSelectionChangedListener;
- }
-
- /**
- * Returns this editor's "cursor" listener to be installed on the editor's
- * source viewer. This listener is listening to key and mouse button events.
- * It triggers the updating of the status line by calling
- * <code>handleCursorPositionChanged()</code>.
- *
- * @return the listener
- * @since 2.0
- */
- protected final ICursorListener getCursorListener() {
- if (fCursorListener == null) {
- fCursorListener= new ICursorListener() {
-
- public void keyPressed(KeyEvent e) {
- handleCursorPositionChanged();
- }
-
- public void keyReleased(KeyEvent e) {
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- public void mouseDown(MouseEvent e) {
- }
-
- public void mouseUp(MouseEvent e) {
- handleCursorPositionChanged();
- }
- };
- }
- return fCursorListener;
- }
-
- /*
- * @see IEditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
- * @since 2.1
- */
- protected final void internalInit(IWorkbenchWindow window, final IEditorSite site, final IEditorInput input) throws PartInitException {
-
- IRunnableWithProgress runnable= new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
-
- if (getDocumentProvider() instanceof IDocumentProviderExtension2) {
- IDocumentProviderExtension2 extension= (IDocumentProviderExtension2) getDocumentProvider();
- extension.setProgressMonitor(monitor);
- }
-
- doSetInput(input);
-
- } catch (CoreException x) {
- throw new InvocationTargetException(x);
- } finally {
- if (getDocumentProvider() instanceof IDocumentProviderExtension2) {
- IDocumentProviderExtension2 extension= (IDocumentProviderExtension2) getDocumentProvider();
- extension.setProgressMonitor(null);
- }
- }
- }
- };
-
- try {
- IRunnableContext context= (window instanceof IRunnableContext) ? (IRunnableContext) window : new ProgressMonitorDialog(window.getShell());
- context.run(false, true, runnable);
- } catch (InterruptedException x) {
- } catch (InvocationTargetException x) {
- Throwable t= x.getTargetException();
- if (t instanceof CoreException)
- throw new PartInitException(((CoreException) t).getStatus());
- throw new PartInitException(new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.OK, EditorMessages.getString("Editor.error.init"), t)); //$NON-NLS-1$
- }
- }
-
- /*
- * @see IEditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
- */
- public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
-
- setSite(site);
-
- IWorkbenchWindow window= getSite().getWorkbenchWindow();
- internalInit(window, site, input);
-
- window.getPartService().addPartListener(fActivationListener);
- window.getShell().addShellListener(fActivationListener);
- }
-
- /**
- * Creates the vertical ruler to be used by this editor.
- * Subclasses may re-implement this method.
- *
- * @return the vertical ruler
- */
- protected IVerticalRuler createVerticalRuler() {
- return new VerticalRuler(VERTICAL_RULER_WIDTH);
- }
-
- /**
- * 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, <code>SWT.WRAP</code> is currently not supported
- * @return the source viewer
- */
- protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
- return new SourceViewer(parent, ruler, styles);
- }
-
- /**
- * The <code>AbstractTextEditor</code> implementation of this
- * <code>IWorkbenchPart</code> method creates the vertical ruler and
- * source viewer.
- * Subclasses may extend.
- *
- * @param parent the parent composite
- */
- public void createPartControl(Composite parent) {
-
- fVerticalRuler= createVerticalRuler();
-
- int styles= SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
- fSourceViewer= createSourceViewer(parent, fVerticalRuler, styles);
-
- if (fConfiguration == null)
- fConfiguration= new SourceViewerConfiguration();
- fSourceViewer.configure(fConfiguration);
-
- if (fRangeIndicator != null)
- fSourceViewer.setRangeIndicator(fRangeIndicator);
-
- fSourceViewer.addTextListener(fTextListener);
- getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener());
-
- initializeViewerFont(fSourceViewer);
- initializeViewerColors(fSourceViewer);
- initializeFindScopeColor(fSourceViewer);
-
- StyledText styledText= fSourceViewer.getTextWidget();
-
- /* gestures commented out until proper solution (i.e. preference page) can be found
- * for bug # 28417:
- *
- final Map gestureMap = new HashMap();
-
- gestureMap.put("E", "org.eclipse.ui.navigate.forwardHistory");
- gestureMap.put("N", "org.eclipse.ui.file.save");
- gestureMap.put("NW", "org.eclipse.ui.file.saveAll");
- gestureMap.put("S", "org.eclipse.ui.file.close");
- gestureMap.put("SW", "org.eclipse.ui.file.closeAll");
- gestureMap.put("W", "org.eclipse.ui.navigate.backwardHistory");
- gestureMap.put("EN", "org.eclipse.ui.edit.copy");
- gestureMap.put("ES", "org.eclipse.ui.edit.paste");
- gestureMap.put("EW", "org.eclipse.ui.edit.cut");
-
- Capture capture = Capture.create();
- capture.setControl(styledText);
-
- capture.addCaptureListener(new CaptureListener() {
- public void gesture(Gesture gesture) {
- if (gesture.getPen() == 3) {
- String actionId = (String) gestureMap.get(Util.recognize(gesture.getPoints(), 20));
-
- if (actionId != null) {
- IKeyBindingService keyBindingService = getEditorSite().getKeyBindingService();
-
- if (keyBindingService instanceof KeyBindingService) {
- IAction action = ((KeyBindingService) keyBindingService).getAction(actionId);
-
- if (action != null) {
- if (action instanceof IUpdate)
- ((IUpdate) action).update();
-
- if (action.isEnabled())
- action.run();
- }
- }
-
- return;
- }
-
- fTextContextMenu.setVisible(true);
- }
- };
- });
- */
-
- styledText.addMouseListener(getCursorListener());
- styledText.addKeyListener(getCursorListener());
-
- if (getHelpContextId() != null)
- WorkbenchHelp.setHelp(styledText, getHelpContextId());
-
-
- String id= fEditorContextMenuId != null ? fEditorContextMenuId : DEFAULT_EDITOR_CONTEXT_MENU_ID;
-
- MenuManager manager= new MenuManager(id, id);
- manager.setRemoveAllWhenShown(true);
- manager.addMenuListener(getContextMenuListener());
- fTextContextMenu= manager.createContextMenu(styledText);
-
- // comment this line if using gestures, above.
- styledText.setMenu(fTextContextMenu);
-
- if (fEditorContextMenuId != null)
- getSite().registerContextMenu(fEditorContextMenuId, manager, getSelectionProvider());
- else if (fCompatibilityMode)
- getSite().registerContextMenu(DEFAULT_EDITOR_CONTEXT_MENU_ID, manager, getSelectionProvider());
-
- if ((fEditorContextMenuId != null && fCompatibilityMode) || fEditorContextMenuId == null) {
- String partId= getSite().getId();
- if (partId != null)
- getSite().registerContextMenu(partId + ".EditorContext", manager, getSelectionProvider()); //$NON-NLS-1$
- }
-
- if (fEditorContextMenuId == null)
- fEditorContextMenuId= DEFAULT_EDITOR_CONTEXT_MENU_ID;
-
-
- id= fRulerContextMenuId != null ? fRulerContextMenuId : DEFAULT_RULER_CONTEXT_MENU_ID;
- manager= new MenuManager(id, id);
- manager.setRemoveAllWhenShown(true);
- manager.addMenuListener(getContextMenuListener());
-
- Control rulerControl= fVerticalRuler.getControl();
- fRulerContextMenu= manager.createContextMenu(rulerControl);
- rulerControl.setMenu(fRulerContextMenu);
- rulerControl.addMouseListener(getRulerMouseListener());
-
- if (fRulerContextMenuId != null)
- getSite().registerContextMenu(fRulerContextMenuId, manager, getSelectionProvider());
- else if (fCompatibilityMode)
- getSite().registerContextMenu(DEFAULT_RULER_CONTEXT_MENU_ID, manager, getSelectionProvider());
-
- if ((fRulerContextMenuId != null && fCompatibilityMode) || fRulerContextMenuId == null) {
- String partId= getSite().getId();
- if (partId != null)
- getSite().registerContextMenu(partId + ".RulerContext", manager, getSelectionProvider()); //$NON-NLS-1$
- }
-
- if (fRulerContextMenuId == null)
- fRulerContextMenuId= DEFAULT_RULER_CONTEXT_MENU_ID;
-
- getSite().setSelectionProvider(getSelectionProvider());
-
- initializeActivationCodeTrigger();
-
- createNavigationActions();
- createAccessibilityActions();
- createActions();
-
- initializeSourceViewer(getEditorInput());
-
- JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener);
- }
-
- /**
- * @since 2.1
- */
- private void initializeActivationCodeTrigger() {
- fActivationCodeTrigger.install();
- fActivationCodeTrigger.setScopes(fKeyBindingScopes);
- }
-
- /**
- * Initializes the given viewer's font.
- *
- * @param viewer the viewer
- * @since 2.0
- */
- private void initializeViewerFont(ISourceViewer viewer) {
-
- boolean isSharedFont= true;
- Font font= null;
- String symbolicFontName= getSymbolicFontName();
-
- if (symbolicFontName != null)
- font= JFaceResources.getFont(symbolicFontName);
- else if (fPreferenceStore != null) {
- // Backward compatibility
- if (fPreferenceStore.contains(JFaceResources.TEXT_FONT) && !fPreferenceStore.isDefault(JFaceResources.TEXT_FONT)) {
- FontData data= PreferenceConverter.getFontData(fPreferenceStore, JFaceResources.TEXT_FONT);
-
- if (data != null) {
- isSharedFont= false;
- font= new Font(viewer.getTextWidget().getDisplay(), data);
- }
- }
- }
- if (font == null)
- font= JFaceResources.getTextFont();
-
- setFont(viewer, font);
-
- if (fFont != null) {
- fFont.dispose();
- fFont= null;
- }
-
- if (!isSharedFont)
- fFont= font;
- }
-
- /**
- * Sets the font for the given viewer sustaining selection and scroll position.
- *
- * @param sourceViewer the source viewer
- * @param font the font
- * @since 2.0
- */
- private void setFont(ISourceViewer sourceViewer, Font font) {
- if (sourceViewer.getDocument() != null) {
-
- Point selection= sourceViewer.getSelectedRange();
- int topIndex= sourceViewer.getTopIndex();
-
- StyledText styledText= sourceViewer.getTextWidget();
- Control parent= styledText;
- if (sourceViewer instanceof ITextViewerExtension) {
- ITextViewerExtension extension= (ITextViewerExtension) sourceViewer;
- parent= extension.getControl();
- }
-
- parent.setRedraw(false);
-
- styledText.setFont(font);
-
- if (fVerticalRuler instanceof IVerticalRulerExtension) {
- IVerticalRulerExtension e= (IVerticalRulerExtension) fVerticalRuler;
- e.setFont(font);
- }
-
- sourceViewer.setSelectedRange(selection.x , selection.y);
- sourceViewer.setTopIndex(topIndex);
-
- if (parent instanceof Composite) {
- Composite composite= (Composite) parent;
- composite.layout(true);
- }
-
- parent.setRedraw(true);
-
-
- } else {
-
- StyledText styledText= sourceViewer.getTextWidget();
- styledText.setFont(font);
-
- if (fVerticalRuler instanceof IVerticalRulerExtension) {
- IVerticalRulerExtension e= (IVerticalRulerExtension) fVerticalRuler;
- e.setFont(font);
- }
- }
- }
-
- /**
- * Creates a color from the information stored in the given preference store.
- * Returns <code>null</code> if there is no such information available.
- *
- * @param store the store to read from
- * @param key the key used for the lookup in the preference store
- * @param display the display used create the color
- * @return the created color according to the specification in the preference store
- * @since 2.0
- */
- private Color createColor(IPreferenceStore store, String key, Display display) {
-
- RGB rgb= null;
-
- if (store.contains(key)) {
-
- if (store.isDefault(key))
- rgb= PreferenceConverter.getDefaultColor(store, key);
- else
- rgb= PreferenceConverter.getColor(store, key);
-
- if (rgb != null)
- return new Color(display, rgb);
- }
-
- return null;
- }
-
- /**
- * Initializes the given viewer's colors.
- *
- * @param viewer the viewer to be initialized
- * @since 2.0
- */
- protected void initializeViewerColors(ISourceViewer viewer) {
-
- IPreferenceStore store= getPreferenceStore();
- if (store != null) {
-
- StyledText styledText= viewer.getTextWidget();
-
- // ----------- foreground color --------------------
- Color color= store.getBoolean(PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT)
- ? null
- : createColor(store, PREFERENCE_COLOR_FOREGROUND, styledText.getDisplay());
- styledText.setForeground(color);
-
- if (fForegroundColor != null)
- fForegroundColor.dispose();
-
- fForegroundColor= color;
-
- // ---------- background color ----------------------
- color= store.getBoolean(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)
- ? null
- : createColor(store, PREFERENCE_COLOR_BACKGROUND, styledText.getDisplay());
- styledText.setBackground(color);
-
- if (fBackgroundColor != null)
- fBackgroundColor.dispose();
-
- fBackgroundColor= color;
- }
- }
-
- /**
- * Initializes the background color used for highlighting the document ranges
- * defining search scopes.
- * @param viewer the viewer to initialize
- * @since 2.0
- */
- private void initializeFindScopeColor(ISourceViewer viewer) {
-
- IPreferenceStore store= getPreferenceStore();
- if (store != null) {
-
- StyledText styledText= viewer.getTextWidget();
-
- Color color= createColor(store, PREFERENCE_COLOR_FIND_SCOPE, styledText.getDisplay());
-
- IFindReplaceTarget target= viewer.getFindReplaceTarget();
- if (target != null && target instanceof IFindReplaceTargetExtension)
- ((IFindReplaceTargetExtension) target).setScopeHighlightColor(color);
-
- if (fFindScopeHighlightColor != null)
- fFindScopeHighlightColor.dispose();
-
- fFindScopeHighlightColor= color;
- }
- }
-
-
- /**
- * Initializes the editor's source viewer based on the given editor input.
- *
- * @param input the editor input to be used to initialize the source viewer
- */
- private void initializeSourceViewer(IEditorInput input) {
-
- IAnnotationModel model= getDocumentProvider().getAnnotationModel(input);
- IDocument document= getDocumentProvider().getDocument(input);
-
- if (document != null) {
- fSourceViewer.setDocument(document, model);
- fSourceViewer.setEditable(isEditable());
- fSourceViewer.showAnnotations(model != null);
- }
-
- if (fElementStateListener instanceof IElementStateListenerExtension) {
- IElementStateListenerExtension extension= (IElementStateListenerExtension) fElementStateListener;
- extension.elementStateValidationChanged(input, false);
- }
-
- createInsertModeCarets();
- if (getInsertMode() == OVERWRITE)
- fSourceViewer.getTextWidget().invokeAction(ST.TOGGLE_OVERWRITE);
- handleInsertModeChanged();
- }
-
- /**
- * Initializes the editor's title based on the given editor input.
- *
- * @param input the editor input to be used
- */
- private void initializeTitle(IEditorInput input) {
-
- Image oldImage= fTitleImage;
- fTitleImage= null;
- String title= ""; //$NON-NLS-1$
-
- if (input != null) {
- IEditorRegistry editorRegistry = getEditorSite().getPage().getWorkbenchWindow().getWorkbench().getEditorRegistry();
- IEditorDescriptor editorDesc= editorRegistry.findEditor(getSite().getId());
- ImageDescriptor imageDesc= editorDesc != null ? editorDesc.getImageDescriptor() : null;
-
- fTitleImage= imageDesc != null ? imageDesc.createImage() : null;
- title= input.getName();
- }
-
- setTitleImage(fTitleImage);
- setTitle(title);
-
- firePropertyChange(PROP_DIRTY);
-
- if (oldImage != null && !oldImage.isDisposed())
- oldImage.dispose();
- }
-
- /**
- * Hook method for setting the document provider for the given input.
- * This default implementation does notthing. Clients may
- * reimplement.
- *
- * @param input the input of this editor.
- * @since 3.0
- */
- protected void setDocumentProvider(IEditorInput input) {
- }
-
- /**
- * If there is no explicit document provider set, the implicit one is
- * re-initialized based on the given editor input.
- *
- * @param input the editor input.
- */
- private void updateDocumentProvider(IEditorInput input) {
-
- IProgressMonitor rememberedProgressMonitor= null;
-
- IDocumentProvider provider= getDocumentProvider();
- if (provider != null) {
- provider.removeElementStateListener(fElementStateListener);
- if (provider instanceof IDocumentProviderExtension2) {
- IDocumentProviderExtension2 extension= (IDocumentProviderExtension2) provider;
- rememberedProgressMonitor= extension.getProgressMonitor();
- extension.setProgressMonitor(null);
- }
- }
-
- setDocumentProvider(input);
-
- provider= getDocumentProvider();
- if (provider != null) {
- provider.addElementStateListener(fElementStateListener);
- if (provider instanceof IDocumentProviderExtension2) {
- IDocumentProviderExtension2 extension= (IDocumentProviderExtension2) provider;
- extension.setProgressMonitor(rememberedProgressMonitor);
- }
- }
- }
-
- /**
- * Internal <code>setInput</code> method.
- *
- * @param input the input to be set
- * @exception CoreException if input cannot be connected to the document provider
- */
- protected void doSetInput(IEditorInput input) throws CoreException {
-
- if (input == null)
-
- close(isSaveOnCloseNeeded());
-
- else {
-
- IEditorInput oldInput= getEditorInput();
- if (oldInput != null)
- getDocumentProvider().disconnect(oldInput);
-
- super.setInput(input);
-
- updateDocumentProvider(input);
-
- IDocumentProvider provider= getDocumentProvider();
- if (provider == null) {
- IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, EditorMessages.getString("Editor.error.no_provider"), null); //$NON-NLS-1$
- throw new CoreException(s);
- }
-
- provider.connect(input);
-
- initializeTitle(input);
- if (fSourceViewer != null)
- initializeSourceViewer(input);
-
- updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE);
- }
- }
-
- /*
- * @see EditorPart#setInput(org.eclipse.ui.IEditorInput)
- */
- public final void setInput(IEditorInput input) {
-
- try {
-
- doSetInput(input);
-
- } catch (CoreException x) {
- String title= EditorMessages.getString("Editor.error.setinput.title"); //$NON-NLS-1$
- String msg= EditorMessages.getString("Editor.error.setinput.message"); //$NON-NLS-1$
- Shell shell= getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- /*
- * @see ITextEditor#close
- */
- public void close(final boolean save) {
-
- enableSanityChecking(false);
-
- Display display= getSite().getShell().getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- if (fSourceViewer != null) {
- // check whether editor has not been disposed yet
- getSite().getPage().closeEditor(AbstractTextEditor.this, save);
- }
- }
- });
- }
-
- /**
- * The <code>AbstractTextEditor</code> implementation of this
- * <code>IWorkbenchPart</code> method may be extended by subclasses.
- * Subclasses must call <code>super.dispose()</code>.
- */
- public void dispose() {
-
- if (fActivationListener != null) {
- IWorkbenchWindow window= getSite().getWorkbenchWindow();
- window.getPartService().removePartListener(fActivationListener);
- Shell shell= window.getShell();
- if (shell != null && !shell.isDisposed())
- shell.removeShellListener(fActivationListener);
- fActivationListener= null;
- }
-
- if (fTitleImage != null) {
- fTitleImage.dispose();
- fTitleImage= null;
- }
-
- if (fFont != null) {
- fFont.dispose();
- fFont= null;
- }
-
- if (fInsertModeCaret != null) {
- if (!fInsertModeCaret.isDisposed()) {
- Image image= fInsertModeCaret.getImage();
- if (image != null && !image.isDisposed())
- image.dispose();
- }
- fInsertModeCaret= null;
- }
-
- if (fOverwriteModeCaret != null) {
- if (!fOverwriteModeCaret.isDisposed()) {
- Image image= fOverwriteModeCaret.getImage();
- if (image != null && !image.isDisposed())
- image.dispose();
- }
- fOverwriteModeCaret= null;
- }
-
- if (fSmartInsertModeCaret != null) {
- if (!fSmartInsertModeCaret.isDisposed()) {
- Image image= fSmartInsertModeCaret.getImage();
- if (image != null && !image.isDisposed())
- image.dispose();
- }
- fSmartInsertModeCaret= null;
- }
-
- if (fForegroundColor != null) {
- fForegroundColor.dispose();
- fForegroundColor= null;
- }
-
- if (fBackgroundColor != null) {
- fBackgroundColor.dispose();
- fBackgroundColor= null;
- }
-
- if (fFindScopeHighlightColor != null) {
- fFindScopeHighlightColor.dispose();
- fFindScopeHighlightColor= null;
- }
-
- if (fFontPropertyChangeListener != null) {
- JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener);
- fFontPropertyChangeListener= null;
- }
-
- if (fPropertyChangeListener != null) {
- if (fPreferenceStore != null) {
- fPreferenceStore.removePropertyChangeListener(fPropertyChangeListener);
- fPreferenceStore= null;
- }
- fPropertyChangeListener= null;
- }
-
- if (fActivationCodeTrigger != null) {
- fActivationCodeTrigger.uninstall();
- fActivationCodeTrigger= null;
- }
-
- disposeDocumentProvider();
-
- if (fSourceViewer != null) {
-
- if (fTextListener != null) {
- fSourceViewer.removeTextListener(fTextListener);
- fTextListener= null;
- }
-
- fTextInputListener= null;
- fSelectionProvider= null;
- fSourceViewer= null;
- }
-
- if (fTextContextMenu != null) {
- fTextContextMenu.dispose();
- fTextContextMenu= null;
- }
-
- if (fRulerContextMenu != null) {
- fRulerContextMenu.dispose();
- fRulerContextMenu= null;
- }
-
- if (fActions != null) {
- fActions.clear();
- fActions= null;
- }
-
- if (fSelectionActions != null) {
- fSelectionActions.clear();
- fSelectionActions= null;
- }
-
- if (fContentActions != null) {
- fContentActions.clear();
- fContentActions= null;
- }
-
- if (fPropertyActions != null) {
- fPropertyActions.clear();
- fPropertyActions= null;
- }
-
- if (fStateActions != null) {
- fStateActions.clear();
- fStateActions= null;
- }
-
- if (fActivationCodes != null) {
- fActivationCodes.clear();
- fActivationCodes= null;
- }
-
- if (fEditorStatusLine != null)
- fEditorStatusLine= null;
-
- super.setInput(null);
-
- super.dispose();
- }
-
- /**
- * Disposes the connection with the document provider. Subclasses
- * may extend.
- *
- * @since 3.0
- */
- protected void disposeDocumentProvider() {
- IDocumentProvider provider= getDocumentProvider();
- if (provider != null) {
-
- IEditorInput input= getEditorInput();
- if (input != null)
- provider.disconnect(input);
-
- if (fElementStateListener != null) {
- provider.removeElementStateListener(fElementStateListener);
- fElementStateListener= null;
- }
-
- fExplicitDocumentProvider= null;
- }
- }
-
- /**
- * Determines whether the given preference change affects the editor's
- * presentation. This implementation always returns <code>false</code>.
- * May be reimplemented by subclasses.
- *
- * @param event the event which should be investigated
- * @return <code>true</code> if the event describes a preference change affecting the editor's presentation
- * @since 2.0
- */
- protected boolean affectsTextPresentation(PropertyChangeEvent event) {
- return false;
- }
-
- /**
- * Returns the symbolic font name for this
- * editor as defined in XML.
- *
- * @return a String with the symbolic font name or <code>null</code> if none is defined
- * @since 2.1
- */
- private String getSymbolicFontName() {
- if (getConfigurationElement() != null)
- return getConfigurationElement().getAttribute("symbolicFontName"); //$NON-NLS-1$
- else
- return null;
- }
-
- /**
- * Returns the property preference key for the editor font.
- *
- * @return a String with the key
- * @since 2.1
- */
- protected final String getFontPropertyPreferenceKey() {
- String symbolicFontName= getSymbolicFontName();
-
- if (symbolicFontName != null)
- return symbolicFontName;
- else
- return JFaceResources.TEXT_FONT;
- }
-
- /**
- * Handles a property change event describing a change
- * of the editor's preference store and updates the preference
- * related editor properties.
- *
- * @param event the property change event
- */
- protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
-
- if (fSourceViewer == null)
- return;
-
- String property= event.getProperty();
-
- if (getFontPropertyPreferenceKey().equals(property)) {
- // There is a separate handler for font preference changes
- return;
- } else if (PREFERENCE_COLOR_FOREGROUND.equals(property) || PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT.equals(property) ||
- PREFERENCE_COLOR_BACKGROUND.equals(property) || PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property))
- {
- initializeViewerColors(fSourceViewer);
- } else if (PREFERENCE_COLOR_FIND_SCOPE.equals(property)) {
- initializeFindScopeColor(fSourceViewer);
- }
-
- if (affectsTextPresentation(event))
- fSourceViewer.invalidateTextPresentation();
- }
-
- /**
- * Returns the progress monitor related to this editor.
- *
- * @return the progress monitor related to this editor
- * @since 2.1
- */
- protected IProgressMonitor getProgressMonitor() {
-
- IProgressMonitor pm= null;
-
- IStatusLineManager manager= getStatusLineManager();
- if (manager != null)
- pm= manager.getProgressMonitor();
-
- return pm != null ? pm : new NullProgressMonitor();
- }
-
- /**
- * Handles an external change of the editor's input element.
- */
- protected void handleEditorInputChanged() {
-
- String title;
- String msg;
- Shell shell= getSite().getShell();
-
- final IDocumentProvider provider= getDocumentProvider();
- if (provider == null) {
- // fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=15066
- close(false);
- return;
- }
-
- final IEditorInput input= getEditorInput();
- if (provider.isDeleted(input)) {
-
- if (isSaveAsAllowed()) {
-
- title= EditorMessages.getString("Editor.error.activated.deleted.save.title"); //$NON-NLS-1$
- msg= EditorMessages.getString("Editor.error.activated.deleted.save.message"); //$NON-NLS-1$
-
- String[] buttons= {
- EditorMessages.getString("Editor.error.activated.deleted.save.button.save"), //$NON-NLS-1$
- EditorMessages.getString("Editor.error.activated.deleted.save.button.close"), //$NON-NLS-1$
- };
-
- MessageDialog dialog= new MessageDialog(shell, title, null, msg, MessageDialog.QUESTION, buttons, 0);
-
- if (dialog.open() == 0) {
- IProgressMonitor pm= getProgressMonitor();
- performSaveAs(pm);
- if (pm.isCanceled())
- handleEditorInputChanged();
- } else {
- close(false);
- }
-
- } else {
-
- title= EditorMessages.getString("Editor.error.activated.deleted.close.title"); //$NON-NLS-1$
- msg= EditorMessages.getString("Editor.error.activated.deleted.close.message"); //$NON-NLS-1$
- if (MessageDialog.openConfirm(shell, title, msg))
- close(false);
- }
-
- } else {
-
- title= EditorMessages.getString("Editor.error.activated.outofsync.title"); //$NON-NLS-1$
- msg= EditorMessages.getString("Editor.error.activated.outofsync.message"); //$NON-NLS-1$
-
- if (MessageDialog.openQuestion(shell, title, msg)) {
-
-
- try {
- if (provider instanceof IDocumentProviderExtension) {
- IDocumentProviderExtension extension= (IDocumentProviderExtension) provider;
- extension.synchronize(input);
- } else {
- doSetInput(input);
- }
- } catch (CoreException x) {
- title= EditorMessages.getString("Editor.error.refresh.outofsync.title"); //$NON-NLS-1$
- msg= EditorMessages.getString("Editor.error.refresh.outofsync.message"); //$NON-NLS-1$
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
- }
- }
-
- /**
- * The <code>AbstractTextEditor</code> implementation of this
- * <code>IEditorPart</code> method calls <code>performSaveAs</code>.
- * Subclasses may reimplement.
- */
- public void doSaveAs() {
- /*
- * 1GEUSSR: ITPUI:ALL - User should never loose changes made in the editors.
- * Changed Behavior to make sure that if called inside a regular save (because
- * of deletion of input element) there is a way to report back to the caller.
- */
- performSaveAs(getProgressMonitor());
- }
-
- /**
- * Performs a save as and reports the result state back to the
- * given progress monitor. This default implementation does nothing.
- * Subclasses may reimplement.
- *
- * @param progressMonitor the progress monitor for communicating result state or <code>null</code>
- */
- protected void performSaveAs(IProgressMonitor progressMonitor) {
- }
-
- /**
- * The <code>AbstractTextEditor</code> implementation of this
- * <code>IEditorPart</code> method may be extended by subclasses.
- *
- * @param progressMonitor the progress monitor for communicating result state or <code>null</code>
- */
- public void doSave(IProgressMonitor progressMonitor) {
-
- IDocumentProvider p= getDocumentProvider();
- if (p == null)
- return;
-
- if (p.isDeleted(getEditorInput())) {
-
- if (isSaveAsAllowed()) {
-
- /*
- * 1GEUSSR: ITPUI:ALL - User should never loose changes made in the editors.
- * Changed Behavior to make sure that if called inside a regular save (because
- * of deletion of input element) there is a way to report back to the caller.
- */
- performSaveAs(progressMonitor);
-
- } else {
-
- Shell shell= getSite().getShell();
- String title= EditorMessages.getString("Editor.error.save.deleted.title"); //$NON-NLS-1$
- String msg= EditorMessages.getString("Editor.error.save.deleted.message"); //$NON-NLS-1$
- MessageDialog.openError(shell, title, msg);
- }
-
- } else {
- performSave(false, progressMonitor);
- }
- }
-
- /**
- * Enables/disables sanity checking.
- * @param enable <code>true</code> if santity checking should be enabled, <code>false</code> otherwise
- * @since 2.0
- */
- protected void enableSanityChecking(boolean enable) {
- synchronized (this) {
- fIsSanityCheckEnabled= enable;
- }
- }
-
- /**
- * Checks the state of the given editor input if sanity checking is enabled.
- * @param input the editor input whose state is to be checked
- * @since 2.0
- */
- protected void safelySanityCheckState(IEditorInput input) {
- boolean enabled= false;
-
- synchronized (this) {
- enabled= fIsSanityCheckEnabled;
- }
-
- if (enabled)
- sanityCheckState(input);
- }
-
- /**
- * Checks the state of the given editor input.
- * @param input the editor input whose state is to be checked
- * @since 2.0
- */
- protected void sanityCheckState(IEditorInput input) {
-
- IDocumentProvider p= getDocumentProvider();
- if (p == null)
- return;
-
- if (p instanceof IDocumentProviderExtension3) {
-
- IDocumentProviderExtension3 p3= (IDocumentProviderExtension3) p;
-
- long stamp= p.getModificationStamp(input);
- if (stamp != fModificationStamp) {
- fModificationStamp= stamp;
- if (!p3.isSynchronized(input))
- handleEditorInputChanged();
- }
-
- } else {
-
- if (fModificationStamp == -1)
- fModificationStamp= p.getSynchronizationStamp(input);
-
- long stamp= p.getModificationStamp(input);
- if (stamp != fModificationStamp) {
- fModificationStamp= stamp;
- if (stamp != p.getSynchronizationStamp(input))
- handleEditorInputChanged();
- }
- }
-
- updateState(getEditorInput());
- updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE);
- }
-
- /**
- * Enables/disables state validation.
- * @param enable <code>true</code> if state validation should be enabled, <code>false</code> otherwise
- * @since 2.1
- */
- protected void enableStateValidation(boolean enable) {
- synchronized (this) {
- fIsStateValidationEnabled= enable;
- }
- }
-
- /**
- * Validates the state of the given editor input. The predominate intent
- * of this method is to take any action propably necessary to ensure that
- * the input can persistently be changed.
- *
- * @param input the input to be validated
- * @since 2.0
- */
- protected void validateState(IEditorInput input) {
-
- IDocumentProvider provider= getDocumentProvider();
- if (! (provider instanceof IDocumentProviderExtension))
- return;
-
- IDocumentProviderExtension extension= (IDocumentProviderExtension) provider;
-
- try {
- extension.validateState(input, getSite().getShell());
- } catch (CoreException exception) {
-
- ILog log= Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog();
- log.log(exception.getStatus());
-
- Shell shell= getSite().getShell();
- String title= EditorMessages.getString("Editor.error.validateEdit.title"); //$NON-NLS-1$
- String msg= EditorMessages.getString("Editor.error.validateEdit.message"); //$NON-NLS-1$
- ErrorDialog.openError(shell, title, msg, exception.getStatus());
-
- return;
- }
-
- if (fSourceViewer != null)
- fSourceViewer.setEditable(isEditable());
-
- updateStateDependentActions();
- }
-
- /*
- * @see org.eclipse.ui.texteditor.ITextEditorExtension2#validateEditorInputState()
- * @since 2.1
- */
- public boolean validateEditorInputState() {
-
- boolean enabled= false;
-
- synchronized (this) {
- enabled= fIsStateValidationEnabled;
- }
-
- if (enabled) {
-
- ISourceViewer viewer= getSourceViewer();
- fTextInputListener.inputChanged= false;
- viewer.addTextInputListener(fTextInputListener);
- try {
- final IEditorInput input= getEditorInput();
-
- BusyIndicator.showWhile(getSite().getShell().getDisplay(), new Runnable() {
- /*
- * @see java.lang.Runnable#run()
- */
- public void run() {
- validateState(input);
- }
- });
-
- sanityCheckState(input);
- return !isEditorInputReadOnly() && !fTextInputListener.inputChanged;
-
- } finally {
- viewer.removeTextInputListener(fTextInputListener);
- }
-
- }
-
- return !isEditorInputReadOnly();
- }
-
- /**
- * Updates the state of the given editor input such as read-only flag.
- *
- * @param input the input to be validated
- * @since 2.0
- */
- protected void updateState(IEditorInput input) {
- IDocumentProvider provider= getDocumentProvider();
- if (provider instanceof IDocumentProviderExtension) {
- IDocumentProviderExtension extension= (IDocumentProviderExtension) provider;
- try {
-
- boolean wasReadOnly= isEditorInputReadOnly();
- extension.updateStateCache(input);
-
- if (fSourceViewer != null)
- fSourceViewer.setEditable(isEditable());
-
- if (wasReadOnly != isEditorInputReadOnly())
- updateStateDependentActions();
-
- } catch (CoreException x) {
- ILog log= Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog();
- log.log(x.getStatus());
- }
- }
- }
-
- /**
- * Performs the save and handles errors appropriatly.
- *
- * @param overwrite indicates whether or not overwrititng is allowed
- * @param progressMonitor the monitor in which to run the operation
- */
- protected void performSave(boolean overwrite, IProgressMonitor progressMonitor) {
-
- IDocumentProvider provider= getDocumentProvider();
- if (provider == null)
- return;
-
- try {
-
- provider.aboutToChange(getEditorInput());
- IEditorInput input= getEditorInput();
- provider.saveDocument(progressMonitor, input, getDocumentProvider().getDocument(input), overwrite);
- editorSaved();
-
- } catch (CoreException x) {
- handleExceptionOnSave(x, progressMonitor);
- } finally {
- provider.changed(getEditorInput());
- }
- }
-
- /**
- * Handles the given exception. If the exception reports an out-of-sync
- * situation, this is reported to the user. Otherwise, the exception
- * is generically reported.
- *
- * @param exception the exception to handle
- * @param progressMonitor the progress monitor
- */
- protected void handleExceptionOnSave(CoreException exception, IProgressMonitor progressMonitor) {
-
- try {
- ++ fErrorCorrectionOnSave;
-
- Shell shell= getSite().getShell();
-
- boolean isSynchronized= false;
- IDocumentProvider p= getDocumentProvider();
-
- if (p instanceof IDocumentProviderExtension3) {
- IDocumentProviderExtension3 p3= (IDocumentProviderExtension3) p;
- isSynchronized= p3.isSynchronized(getEditorInput());
- } else {
- long modifiedStamp= p.getModificationStamp(getEditorInput());
- long synchStamp= p.getSynchronizationStamp(getEditorInput());
- isSynchronized= (modifiedStamp == synchStamp);
- }
-
- if (fErrorCorrectionOnSave == 1 && !isSynchronized) {
-
- String title= EditorMessages.getString("Editor.error.save.outofsync.title"); //$NON-NLS-1$
- String msg= EditorMessages.getString("Editor.error.save.outofsync.message"); //$NON-NLS-1$
-
- if (MessageDialog.openQuestion(shell, title, msg))
- performSave(true, progressMonitor);
- else {
- /*
- * 1GEUPKR: ITPJUI:ALL - Loosing work with simultaneous edits
- * Set progress monitor to canceled in order to report back
- * to enclosing operations.
- */
- if (progressMonitor != null)
- progressMonitor.setCanceled(true);
- }
- } else {
-
- String title= EditorMessages.getString("Editor.error.save.title"); //$NON-NLS-1$
- String msg= EditorMessages.getString("Editor.error.save.message"); //$NON-NLS-1$
- ErrorDialog.openError(shell, title, msg, exception.getStatus());
-
- /*
- * 1GEUPKR: ITPJUI:ALL - Loosing work with simultaneous edits
- * Set progress monitor to canceled in order to report back
- * to enclosing operations.
- */
- if (progressMonitor != null)
- progressMonitor.setCanceled(true);
- }
-
- } finally {
- -- fErrorCorrectionOnSave;
- }
- }
-
- /**
- * The <code>AbstractTextEditor</code> implementation of this
- * <code>IEditorPart</code> method returns <code>false</code>.
- * Subclasses may override.
- */
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /*
- * @see EditorPart#isSaveOnCloseNeeded()
- */
- public boolean isSaveOnCloseNeeded() {
- IDocumentProvider p= getDocumentProvider();
- return p == null ? false : p.mustSaveDocument(getEditorInput());
- }
-
- /*
- * @see EditorPart#isDirty()
- */
- public boolean isDirty() {
- IDocumentProvider p= getDocumentProvider();
- return p == null ? false : p.canSaveDocument(getEditorInput());
- }
-
- /**
- * The <code>AbstractTextEditor</code> implementation of this
- * <code>ITextEditor</code> method may be extended by subclasses.
- */
- public void doRevertToSaved() {
- IDocumentProvider p= getDocumentProvider();
- if (p == null)
- return;
-
- performRevert();
- }
-
- /**
- * Performs revert and handles errors appropriatly.
- *
- * @since 3.0
- */
- protected void performRevert() {
-
- IDocumentProvider provider= getDocumentProvider();
- if (provider == null)
- return;
-
- try {
-
- provider.aboutToChange(getEditorInput());
- provider.resetDocument(getEditorInput());
- editorSaved();
-
- } catch (CoreException x) {
- Shell shell= getSite().getShell();
- String title= EditorMessages.getString("Editor.error.revert.title"); //$NON-NLS-1$
- String msg= EditorMessages.getString("Editor.error.revert.message"); //$NON-NLS-1$
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- } finally {
- provider.changed(getEditorInput());
- }
- }
-
- /*
- * @see ITextEditor#setAction(String, IAction)
- */
- public void setAction(String actionID, IAction action) {
- Assert.isNotNull(actionID);
- if (action == null) {
- action= (IAction) fActions.remove(actionID);
- if (action != null)
- fActivationCodeTrigger.unregisterActionFromKeyActivation(action);
- } else {
- fActions.put(actionID, action);
- fActivationCodeTrigger.registerActionForKeyActivation(action);
- }
- }
-
- /*
- * @see ITextEditor#setActionActivationCode(String, char, int, int)
- */
- public void setActionActivationCode(String actionID, char activationCharacter, int activationKeyCode, int activationStateMask) {
-
- Assert.isNotNull(actionID);
-
- ActionActivationCode found= findActionActivationCode(actionID);
- if (found == null) {
- found= new ActionActivationCode(actionID);
- fActivationCodes.add(found);
- }
-
- found.fCharacter= activationCharacter;
- found.fKeyCode= activationKeyCode;
- found.fStateMask= activationStateMask;
- }
-
- /**
- * Returns the activation code registered for the specified action.
- *
- * @param actionID the action id
- * @return the registered activation code or <code>null</code> if no code has been installed
- */
- private ActionActivationCode findActionActivationCode(String actionID) {
- int size= fActivationCodes.size();
- for (int i= 0; i < size; i++) {
- ActionActivationCode code= (ActionActivationCode) fActivationCodes.get(i);
- if (actionID.equals(code.fActionId))
- return code;
- }
- return null;
- }
-
- /*
- * @see ITextEditor#removeActionActivationCode(String)
- */
- public void removeActionActivationCode(String actionID) {
- Assert.isNotNull(actionID);
- ActionActivationCode code= findActionActivationCode(actionID);
- if (code != null)
- fActivationCodes.remove(code);
- }
-
- /*
- * @see ITextEditor#getAction(String)
- */
- public IAction getAction(String actionID) {
- Assert.isNotNull(actionID);
- IAction action= (IAction) fActions.get(actionID);
-
- if (action == null) {
- action= findContributedAction(actionID);
- if (action != null)
- setAction(actionID, action);
- }
-
- return action;
- }
-
- /**
- * Returns the action with the given action id that has been contributed via xml to this editor.
- * The lookup honors the dependencies of plug-ins.
- *
- * @param actionID the action id to look up
- * @return the action that has been contributed
- * @since 2.0
- */
- private IAction findContributedAction(String actionID) {
- IExtensionPoint extensionPoint= Platform.getPluginRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, "editorActions"); //$NON-NLS-1$
- if (extensionPoint != null) {
- IConfigurationElement[] elements= extensionPoint.getConfigurationElements();
-
- List actions= new ArrayList();
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
- if (TAG_CONTRIBUTION_TYPE.equals(element.getName())) {
- if (!getSite().getId().equals(element.getAttribute("targetID"))) //$NON-NLS-1$
- continue;
-
- IConfigurationElement[] children= element.getChildren("action"); //$NON-NLS-1$
- for (int j= 0; j < children.length; j++) {
- IConfigurationElement child= children[j];
- if (actionID.equals(child.getAttribute("actionID"))) //$NON-NLS-1$
- actions.add(child);
- }
- }
- }
- Collections.sort(actions, new ConfigurationElementComparator());
-
- if (actions.size() != 0) {
- IConfigurationElement element= (IConfigurationElement) actions.get(0);
- String defId = element.getAttribute(ActionDescriptor.ATT_DEFINITION_ID);
- return new EditorPluginAction(element, "class", this, defId, IAction.AS_UNSPECIFIED); //$NON-NLS-1$
- }
- }
-
- return null;
- }
-
- /**
- * Updates the specified action by calling <code>IUpdate.update</code>
- * if applicable.
- *
- * @param actionId the action id
- */
- private void updateAction(String actionId) {
- Assert.isNotNull(actionId);
- if (fActions != null) {
- IAction action= (IAction) fActions.get(actionId);
- if (action instanceof IUpdate)
- ((IUpdate) action).update();
- }
- }
-
- /**
- * Marks or unmarks the given action to be updated on text selection changes.
- *
- * @param actionId the action id
- * @param mark <code>true</code> if the action is selection dependent
- */
- public void markAsSelectionDependentAction(String actionId, boolean mark) {
- Assert.isNotNull(actionId);
- if (mark) {
- if (!fSelectionActions.contains(actionId))
- fSelectionActions.add(actionId);
- } else
- fSelectionActions.remove(actionId);
- }
-
- /**
- * Marks or unmarks the given action to be updated on content changes.
- *
- * @param actionId the action id
- * @param mark <code>true</code> if the action is content dependent
- */
- public void markAsContentDependentAction(String actionId, boolean mark) {
- Assert.isNotNull(actionId);
- if (mark) {
- if (!fContentActions.contains(actionId))
- fContentActions.add(actionId);
- } else
- fContentActions.remove(actionId);
- }
-
- /**
- * Marks or unmarks the given action to be updated on property changes.
- *
- * @param actionId the action id
- * @param mark <code>true</code> if the action is property dependent
- * @since 2.0
- */
- public void markAsPropertyDependentAction(String actionId, boolean mark) {
- Assert.isNotNull(actionId);
- if (mark) {
- if (!fPropertyActions.contains(actionId))
- fPropertyActions.add(actionId);
- } else
- fPropertyActions.remove(actionId);
- }
-
- /**
- * Marks or unmarks the given action to be updated on state changes.
- *
- * @param actionId the action id
- * @param mark <code>true</code> if the action is state dependent
- * @since 2.0
- */
- public void markAsStateDependentAction(String actionId, boolean mark) {
- Assert.isNotNull(actionId);
- if (mark) {
- if (!fStateActions.contains(actionId))
- fStateActions.add(actionId);
- } else
- fStateActions.remove(actionId);
- }
-
- /**
- * Updates all selection dependent actions.
- */
- protected void updateSelectionDependentActions() {
- if (fSelectionActions != null) {
- Iterator e= fSelectionActions.iterator();
- while (e.hasNext())
- updateAction((String) e.next());
- }
- }
-
- /**
- * Updates all content dependent actions.
- */
- protected void updateContentDependentActions() {
- if (fContentActions != null) {
- Iterator e= fContentActions.iterator();
- while (e.hasNext())
- updateAction((String) e.next());
- }
- }
-
- /**
- * Updates all property dependent actions.
- * @since 2.0
- */
- protected void updatePropertyDependentActions() {
- if (fPropertyActions != null) {
- Iterator e= fPropertyActions.iterator();
- while (e.hasNext())
- updateAction((String) e.next());
- }
- }
-
- /**
- * Updates all state dependent actions.
- * @since 2.0
- */
- protected void updateStateDependentActions() {
- if (fStateActions != null) {
- Iterator e= fStateActions.iterator();
- while (e.hasNext())
- updateAction((String) e.next());
- }
- }
-
- /**
- * Creates action entries for all SWT StyledText actions as defined in
- * <code>org.eclipse.swt.custom.ST</code>. Overwrites and
- * extends the list of these actions afterwards.
- * <p>
- * Subclasses may extend.
- * </p>
- * @since 2.0
- */
- protected void createNavigationActions() {
-
- IAction action;
-
- StyledText textWidget= getSourceViewer().getTextWidget();
- for (int i= 0; i < ACTION_MAP.length; i++) {
- IdMapEntry entry= ACTION_MAP[i];
- action= new TextNavigationAction(textWidget, entry.getAction());
- action.setActionDefinitionId(entry.getActionId());
- setAction(entry.getActionId(), action);
- }
-
- action= new ToggleInsertModeAction(textWidget);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.TOGGLE_OVERWRITE);
- setAction(ITextEditorActionDefinitionIds.TOGGLE_OVERWRITE, action);
- textWidget.setKeyBinding(SWT.INSERT, SWT.NULL);
-
- action= new ScrollLinesAction(-1);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SCROLL_LINE_UP);
- setAction(ITextEditorActionDefinitionIds.SCROLL_LINE_UP, action);
-
- action= new ScrollLinesAction(1);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SCROLL_LINE_DOWN);
- setAction(ITextEditorActionDefinitionIds.SCROLL_LINE_DOWN, action);
-
- action= new LineEndAction(textWidget, false);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.LINE_END);
- setAction(ITextEditorActionDefinitionIds.LINE_END, action);
-
- action= new LineStartAction(textWidget, false);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.LINE_START);
- setAction(ITextEditorActionDefinitionIds.LINE_START, action);
-
- action= new LineEndAction(textWidget, true);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_LINE_END);
- setAction(ITextEditorActionDefinitionIds.SELECT_LINE_END, action);
-
- action= new LineStartAction(textWidget, true);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_LINE_START);
- setAction(ITextEditorActionDefinitionIds.SELECT_LINE_START, action);
-
- setActionActivationCode(ITextEditorActionDefinitionIds.LINE_END, (char) 0, SWT.END, SWT.NONE);
- setActionActivationCode(ITextEditorActionDefinitionIds.LINE_START, (char) 0, SWT.HOME, SWT.NONE);
- setActionActivationCode(ITextEditorActionDefinitionIds.SELECT_LINE_END, (char) 0, SWT.END, SWT.SHIFT);
- setActionActivationCode(ITextEditorActionDefinitionIds.SELECT_LINE_START, (char) 0, SWT.HOME, SWT.SHIFT);
- }
-
- /**
- * Creates this editor's accessibility actions.
- * @since 2.0
- */
- private void createAccessibilityActions() {
- IAction action= new ShowRulerContextMenuAction();
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_RULER_CONTEXT_MENU);
- setAction(ITextEditorActionDefinitionIds.SHOW_RULER_CONTEXT_MENU, action);
- }
-
- /**
- * Creates this editor's standard actions and connects them with the global
- * workbench actions.
- * <p>
- * Subclasses may extend.</p>
- */
- protected void createActions() {
-
- ResourceAction action;
-
- action= new TextOperationAction(EditorMessages.getResourceBundle(), "Editor.Undo.", this, ITextOperationTarget.UNDO); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.UNDO_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.UNDO);
- setAction(ITextEditorActionConstants.UNDO, action);
-
- action= new TextOperationAction(EditorMessages.getResourceBundle(), "Editor.Redo.", this, ITextOperationTarget.REDO); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.REDO_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.REDO);
- setAction(ITextEditorActionConstants.REDO, action);
-
- action= new TextOperationAction(EditorMessages.getResourceBundle(), "Editor.Cut.", this, ITextOperationTarget.CUT); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CUT);
- setAction(ITextEditorActionConstants.CUT, action);
-
- action= new TextOperationAction(EditorMessages.getResourceBundle(), "Editor.Copy.", this, ITextOperationTarget.COPY, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.COPY);
- setAction(ITextEditorActionConstants.COPY, action);
-
- action= new TextOperationAction(EditorMessages.getResourceBundle(), "Editor.Paste.", this, ITextOperationTarget.PASTE); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.PASTE_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.PASTE);
- setAction(ITextEditorActionConstants.PASTE, action);
-
- action= new TextOperationAction(EditorMessages.getResourceBundle(), "Editor.Delete.", this, ITextOperationTarget.DELETE); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE);
- setAction(ITextEditorActionConstants.DELETE, action);
-
- action= new DeleteLineAction(EditorMessages.getResourceBundle(), "Editor.DeleteLine.", this, DeleteLineAction.WHOLE, false); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE);
- setAction(ITextEditorActionConstants.DELETE_LINE, action);
-
- action= new DeleteLineAction(EditorMessages.getResourceBundle(), "Editor.CutLine.", this, DeleteLineAction.WHOLE, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CUT_LINE);
- setAction(ITextEditorActionConstants.CUT_LINE, action);
-
- action= new DeleteLineAction(EditorMessages.getResourceBundle(), "Editor.DeleteLineToBeginning.", this, DeleteLineAction.TO_BEGINNING, false); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_TO_BEGINNING_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE_TO_BEGINNING);
- setAction(ITextEditorActionConstants.DELETE_LINE_TO_BEGINNING, action);
-
- action= new DeleteLineAction(EditorMessages.getResourceBundle(), "Editor.CutLineToBeginning.", this, DeleteLineAction.TO_BEGINNING, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_TO_BEGINNING_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CUT_LINE_TO_BEGINNING);
- setAction(ITextEditorActionConstants.CUT_LINE_TO_BEGINNING, action);
-
- action= new DeleteLineAction(EditorMessages.getResourceBundle(), "Editor.DeleteLineToEnd.", this, DeleteLineAction.TO_END, false); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_TO_END_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE_TO_END);
- setAction(ITextEditorActionConstants.DELETE_LINE_TO_END, action);
-
- action= new DeleteLineAction(EditorMessages.getResourceBundle(), "Editor.CutLineToEnd.", this, DeleteLineAction.TO_END, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_TO_END_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CUT_LINE_TO_END);
- setAction(ITextEditorActionConstants.CUT_LINE_TO_END, action);
-
- action= new MarkAction(EditorMessages.getResourceBundle(), "Editor.SetMark.", this, MarkAction.SET_MARK); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.SET_MARK_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SET_MARK);
- setAction(ITextEditorActionConstants.SET_MARK, action);
-
- action= new MarkAction(EditorMessages.getResourceBundle(), "Editor.ClearMark.", this, MarkAction.CLEAR_MARK); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.CLEAR_MARK_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CLEAR_MARK);
- setAction(ITextEditorActionConstants.CLEAR_MARK, action);
-
- action= new MarkAction(EditorMessages.getResourceBundle(), "Editor.SwapMark.", this, MarkAction.SWAP_MARK); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.SWAP_MARK_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SWAP_MARK);
- setAction(ITextEditorActionConstants.SWAP_MARK, action);
-
- action= new TextOperationAction(EditorMessages.getResourceBundle(), "Editor.SelectAll.", this, ITextOperationTarget.SELECT_ALL, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.SELECT_ALL_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_ALL);
- setAction(ITextEditorActionConstants.SELECT_ALL, action);
-
- action= new ShiftAction(EditorMessages.getResourceBundle(), "Editor.ShiftRight.", this, ITextOperationTarget.SHIFT_RIGHT); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.SHIFT_RIGHT_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHIFT_RIGHT);
- setAction(ITextEditorActionConstants.SHIFT_RIGHT, action);
-
- action= new ShiftAction(EditorMessages.getResourceBundle(), "Editor.ShiftRight.", this, ITextOperationTarget.SHIFT_RIGHT) { //$NON-NLS-1$
- public void update() {
- updateForTab();
- }
- };
- setAction(ITextEditorActionConstants.SHIFT_RIGHT_TAB, action);
-
- action= new ShiftAction(EditorMessages.getResourceBundle(), "Editor.ShiftLeft.", this, ITextOperationTarget.SHIFT_LEFT); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.SHIFT_LEFT_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHIFT_LEFT);
- setAction(ITextEditorActionConstants.SHIFT_LEFT, action);
-
- action= new TextOperationAction(EditorMessages.getResourceBundle(), "Editor.Print.", this, ITextOperationTarget.PRINT, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.PRINT_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.PRINT);
- setAction(ITextEditorActionConstants.PRINT, action);
-
- action= new FindReplaceAction(EditorMessages.getResourceBundle(), "Editor.FindReplace.", this); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.FIND_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.FIND_REPLACE);
- setAction(ITextEditorActionConstants.FIND, action);
-
- action= new FindNextAction(EditorMessages.getResourceBundle(), "Editor.FindNext.", this, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.FIND_NEXT_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.FIND_NEXT);
- setAction(ITextEditorActionConstants.FIND_NEXT, action);
-
- action= new FindNextAction(EditorMessages.getResourceBundle(), "Editor.FindPrevious.", this, false); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.FIND_PREVIOUS_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.FIND_PREVIOUS);
- setAction(ITextEditorActionConstants.FIND_PREVIOUS, action);
-
- action= new IncrementalFindAction(EditorMessages.getResourceBundle(), "Editor.FindIncremental.", this, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.FIND_INCREMENTAL_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.FIND_INCREMENTAL);
- setAction(ITextEditorActionConstants.FIND_INCREMENTAL, action);
-
- action= new IncrementalFindAction(EditorMessages.getResourceBundle(), "Editor.FindIncrementalReverse.", this, false); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.FIND_INCREMENTAL_REVERSE_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.FIND_INCREMENTAL_REVERSE);
- setAction(ITextEditorActionConstants.FIND_INCREMENTAL_REVERSE, action);
-
- action= new SaveAction(EditorMessages.getResourceBundle(), "Editor.Save.", this); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.SAVE_ACTION);
- // action.setActionDefinitionId(ITextEditorActionDefinitionIds.SAVE);
- setAction(ITextEditorActionConstants.SAVE, action);
-
- action= new RevertToSavedAction(EditorMessages.getResourceBundle(), "Editor.Revert.", this); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.REVERT_TO_SAVED_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.REVERT_TO_SAVED);
- setAction(ITextEditorActionConstants.REVERT_TO_SAVED, action);
-
- action= new GotoLineAction(EditorMessages.getResourceBundle(), "Editor.GotoLine.", this); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.GOTO_LINE_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.LINE_GOTO);
- setAction(ITextEditorActionConstants.GOTO_LINE, action);
-
- action = new MoveLinesAction(EditorMessages.getResourceBundle(), "Editor.MoveLinesUp.", this, true, false); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.MOVE_LINES_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.MOVE_LINES_UP);
- setAction(ITextEditorActionConstants.MOVE_LINE_UP, action);
-
- action = new MoveLinesAction(EditorMessages.getResourceBundle(), "Editor.MoveLinesDown.", this, false, false); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.MOVE_LINES_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.MOVE_LINES_DOWN);
- setAction(ITextEditorActionConstants.MOVE_LINE_DOWN, action);
-
- action = new MoveLinesAction(EditorMessages.getResourceBundle(), "Editor.CopyLineUp.", this, true, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_LINES_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.COPY_LINES_UP);
- setAction(ITextEditorActionConstants.COPY_LINE_UP, action);
-
- action = new MoveLinesAction(EditorMessages.getResourceBundle(), "Editor.CopyLineDown.", this, false, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_LINES_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.COPY_LINES_DOWN);
- setAction(ITextEditorActionConstants.COPY_LINE_DOWN, action);
-
- action = new CaseAction(EditorMessages.getResourceBundle(), "Editor.UpperCase.", this, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.UPPER_CASE_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.UPPER_CASE);
- setAction(ITextEditorActionConstants.UPPER_CASE, action);
-
- action = new CaseAction(EditorMessages.getResourceBundle(), "Editor.LowerCase.", this, false); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.LOWER_CASE_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.LOWER_CASE);
- setAction(ITextEditorActionConstants.LOWER_CASE, action);
-
- action = new SmartEnterAction(EditorMessages.getResourceBundle(), "Editor.SmartEnter.", this, false); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.SMART_ENTER_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SMART_ENTER);
- setAction(ITextEditorActionConstants.SMART_ENTER, action);
-
- action = new SmartEnterAction(EditorMessages.getResourceBundle(), "Editor.SmartEnterInverse.", this, true); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.SMART_ENTER_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.SMART_ENTER_INVERSE);
- setAction(ITextEditorActionConstants.SMART_ENTER_INVERSE, action);
-
-
- markAsContentDependentAction(ITextEditorActionConstants.UNDO, true);
- markAsContentDependentAction(ITextEditorActionConstants.REDO, true);
- markAsContentDependentAction(ITextEditorActionConstants.FIND, true);
- markAsContentDependentAction(ITextEditorActionConstants.FIND_NEXT, true);
- markAsContentDependentAction(ITextEditorActionConstants.FIND_PREVIOUS, true);
- markAsContentDependentAction(ITextEditorActionConstants.FIND_INCREMENTAL, true);
- markAsContentDependentAction(ITextEditorActionConstants.FIND_INCREMENTAL_REVERSE, true);
-
- markAsSelectionDependentAction(ITextEditorActionConstants.CUT, true);
- markAsSelectionDependentAction(ITextEditorActionConstants.COPY, true);
- markAsSelectionDependentAction(ITextEditorActionConstants.PASTE, true);
- markAsSelectionDependentAction(ITextEditorActionConstants.DELETE, true);
- markAsSelectionDependentAction(ITextEditorActionConstants.SHIFT_RIGHT, true);
- markAsSelectionDependentAction(ITextEditorActionConstants.SHIFT_RIGHT_TAB, true);
- markAsSelectionDependentAction(ITextEditorActionConstants.UPPER_CASE, true);
- markAsSelectionDependentAction(ITextEditorActionConstants.LOWER_CASE, true);
-
- markAsPropertyDependentAction(ITextEditorActionConstants.REVERT_TO_SAVED, true);
-
- markAsStateDependentAction(ITextEditorActionConstants.UNDO, true);
- markAsStateDependentAction(ITextEditorActionConstants.REDO, true);
- markAsStateDependentAction(ITextEditorActionConstants.CUT, true);
- markAsStateDependentAction(ITextEditorActionConstants.PASTE, true);
- markAsStateDependentAction(ITextEditorActionConstants.DELETE, true);
- markAsStateDependentAction(ITextEditorActionConstants.SHIFT_RIGHT, true);
- markAsStateDependentAction(ITextEditorActionConstants.SHIFT_RIGHT_TAB, true);
- markAsStateDependentAction(ITextEditorActionConstants.SHIFT_LEFT, true);
- markAsStateDependentAction(ITextEditorActionConstants.FIND, true);
- markAsStateDependentAction(ITextEditorActionConstants.DELETE_LINE, true);
- markAsStateDependentAction(ITextEditorActionConstants.DELETE_LINE_TO_BEGINNING, true);
- markAsStateDependentAction(ITextEditorActionConstants.DELETE_LINE_TO_END, true);
- markAsStateDependentAction(ITextEditorActionConstants.MOVE_LINE_UP, true);
- markAsStateDependentAction(ITextEditorActionConstants.MOVE_LINE_DOWN, true);
- markAsStateDependentAction(ITextEditorActionConstants.CUT_LINE, true);
- markAsStateDependentAction(ITextEditorActionConstants.CUT_LINE_TO_BEGINNING, true);
- markAsStateDependentAction(ITextEditorActionConstants.CUT_LINE_TO_END, true);
-
- setActionActivationCode(ITextEditorActionConstants.SHIFT_RIGHT_TAB,'\t', -1, SWT.NONE);
- setActionActivationCode(ITextEditorActionConstants.SHIFT_LEFT, '\t', -1, SWT.SHIFT);
- }
-
- /**
- * Convenience method to add the action installed under the given action id to the given menu.
- * @param menu the menu to add the action to
- * @param actionId the id of the action to be added
- */
- protected final void addAction(IMenuManager menu, String actionId) {
- IAction action= getAction(actionId);
- if (action != null) {
- if (action instanceof IUpdate)
- ((IUpdate) action).update();
- menu.add(action);
- }
- }
-
- /**
- * Convenience method to add the action installed under the given action id to the specified group of the menu.
- * @param menu the menu to add the action to
- * @param group the group in the menu
- * @param actionId the id of the action to add
- */
- protected final void addAction(IMenuManager menu, String group, String actionId) {
- IAction action= getAction(actionId);
- if (action != null) {
- if (action instanceof IUpdate)
- ((IUpdate) action).update();
-
- IMenuManager subMenu= menu.findMenuUsingPath(group);
- if (subMenu != null)
- subMenu.add(action);
- else
- menu.appendToGroup(group, action);
- }
- }
-
- /**
- * Convenience method to add a new group after the specified group.
- * @param menu the menu to add the new group to
- * @param existingGroup the group after which to insert the new group
- * @param newGroup the new group
- */
- protected final void addGroup(IMenuManager menu, String existingGroup, String newGroup) {
- IMenuManager subMenu= menu.findMenuUsingPath(existingGroup);
- if (subMenu != null)
- subMenu.add(new Separator(newGroup));
- else
- menu.appendToGroup(existingGroup, new Separator(newGroup));
- }
-
- /**
- * Sets up the ruler context menu before it is made visible.
- * <p>
- * Subclasses may extend to add other actions.</p>
- *
- * @param menu the menu
- */
- protected void rulerContextMenuAboutToShow(IMenuManager menu) {
-
- menu.add(new Separator(ITextEditorActionConstants.GROUP_REST));
- menu.add(new Separator(ITextEditorActionConstants.MB_ADDITIONS));
-
- for (Iterator i = fRulerContextMenuListeners.iterator(); i.hasNext();)
- ((IMenuListener) i.next()).menuAboutToShow(menu);
-
- addAction(menu, ITextEditorActionConstants.RULER_MANAGE_BOOKMARKS);
- addAction(menu, ITextEditorActionConstants.RULER_MANAGE_TASKS);
- }
-
- /**
- * Sets up this editor's context menu before it is made visible.
- * <p>
- * Subclasses may extend to add other actions.</p>
- *
- * @param menu the menu
- */
- protected void editorContextMenuAboutToShow(IMenuManager menu) {
-
- menu.add(new Separator(ITextEditorActionConstants.GROUP_UNDO));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_COPY));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_PRINT));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_FIND));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_ADD));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_REST));
- menu.add(new Separator(ITextEditorActionConstants.MB_ADDITIONS));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_SAVE));
-
- if (isEditable()) {
- addAction(menu, ITextEditorActionConstants.GROUP_UNDO, ITextEditorActionConstants.UNDO);
- addAction(menu, ITextEditorActionConstants.GROUP_UNDO, ITextEditorActionConstants.REVERT_TO_SAVED);
- addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.CUT);
- addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.COPY);
- addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.PASTE);
- addAction(menu, ITextEditorActionConstants.GROUP_SAVE, ITextEditorActionConstants.SAVE);
- } else {
- addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.COPY);
- }
- }
-
- /**
- * Returns the status line manager of this editor.
- * @return the status line manager of this editor
- * @since 2.0
- */
- private IStatusLineManager getStatusLineManager() {
-
- IEditorActionBarContributor contributor= getEditorSite().getActionBarContributor();
- if (!(contributor instanceof EditorActionBarContributor))
- return null;
-
- IActionBars actionBars= ((EditorActionBarContributor) contributor).getActionBars();
- if (actionBars == null)
- return null;
-
- return actionBars.getStatusLineManager();
- }
-
- /*
- * @see IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class required) {
-
- if (IEditorStatusLine.class.equals(required)) {
- if (fEditorStatusLine == null) {
- IStatusLineManager statusLineManager= getStatusLineManager();
- ISelectionProvider selectionProvider= getSelectionProvider();
- if (statusLineManager != null && selectionProvider != null)
- fEditorStatusLine= new EditorStatusLine(statusLineManager, selectionProvider);
- }
- return fEditorStatusLine;
- }
-
- if (IVerticalRulerInfo.class.equals(required)) {
- if (fVerticalRuler instanceof IVerticalRulerInfo)
- return fVerticalRuler;
- }
-
- if (IMarkRegionTarget.class.equals(required)) {
- if (fMarkRegionTarget == null) {
- IStatusLineManager manager= getStatusLineManager();
- if (manager != null)
- fMarkRegionTarget= (fSourceViewer == null ? null : new MarkRegionTarget(fSourceViewer, manager));
- }
- return fMarkRegionTarget;
- }
-
- if (DeleteLineTarget.class.equals(required)){
- if (fDeleteLineTarget == null) {
- fDeleteLineTarget = new DeleteLineTarget(fSourceViewer);
- }
- return fDeleteLineTarget;
- }
-
- if (IncrementalFindTarget.class.equals(required)) {
- if (fIncrementalFindTarget == null) {
- IStatusLineManager manager= getStatusLineManager();
- if (manager != null)
- fIncrementalFindTarget= (fSourceViewer == null ? null : new IncrementalFindTarget(fSourceViewer, manager));
- }
- return fIncrementalFindTarget;
- }
-
- if (IFindReplaceTarget.class.equals(required)) {
- if (fFindReplaceTarget == null) {
- IFindReplaceTarget target= (fSourceViewer == null ? null : fSourceViewer.getFindReplaceTarget());
- if (target != null) {
- fFindReplaceTarget= new FindReplaceTarget(this, target);
- if (fFindScopeHighlightColor != null)
- fFindReplaceTarget.setScopeHighlightColor(fFindScopeHighlightColor);
- }
- }
- return fFindReplaceTarget;
- }
-
- if (ITextOperationTarget.class.equals(required))
- return (fSourceViewer == null ? null : fSourceViewer.getTextOperationTarget());
-
- if (IRewriteTarget.class.equals(required)) {
- if (fSourceViewer instanceof ITextViewerExtension) {
- ITextViewerExtension extension= (ITextViewerExtension) fSourceViewer;
- return extension.getRewriteTarget();
- }
- return null;
- }
-
- return super.getAdapter(required);
- }
-
- /*
- * @see IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- if (fSourceViewer != null && fSourceViewer.getTextWidget() != null)
- fSourceViewer.getTextWidget().setFocus();
- }
-
- /*
- * @see ITextEditor#showsHighlightRangeOnly()
- */
- public boolean showsHighlightRangeOnly() {
- return fShowHighlightRangeOnly;
- }
-
- /*
- * @see ITextEditor#showHighlightRangeOnly(boolean)
- */
- public void showHighlightRangeOnly(boolean showHighlightRangeOnly) {
- fShowHighlightRangeOnly= showHighlightRangeOnly;
- }
-
- /*
- * @see ITextEditor#setHighlightRange(int, int, boolean)
- */
- public void setHighlightRange(int start, int length, boolean moveCursor) {
- if (fSourceViewer == null)
- return;
-
- if (fShowHighlightRangeOnly) {
- if (moveCursor)
- fSourceViewer.setVisibleRegion(start, length);
- } else {
- IRegion rangeIndication= fSourceViewer.getRangeIndication();
- if (rangeIndication == null || start != rangeIndication.getOffset() || length != rangeIndication.getLength())
- fSourceViewer.setRangeIndication(start, length, moveCursor);
- }
- }
-
- /*
- * @see ITextEditor#getHighlightRange()
- */
- public IRegion getHighlightRange() {
- if (fSourceViewer == null)
- return null;
-
- if (fShowHighlightRangeOnly)
- return getCoverage(fSourceViewer);
-
- return fSourceViewer.getRangeIndication();
- }
-
- /*
- * @see ITextEditor#resetHighlightRange
- */
- public void resetHighlightRange() {
- if (fSourceViewer == null)
- return;
-
- if (fShowHighlightRangeOnly)
- fSourceViewer.resetVisibleRegion();
- else
- fSourceViewer.removeRangeIndication();
- }
-
- /**
- * Adjusts the highlight range so that at least the specified range
- * is highlighted.
- * <p>
- * Subclasses may re-implement this method.</p>
- *
- * @param offset the offset of the range which at least should be highlighted
- * @param length the length of the range which at least should be highlighted
- */
- protected void adjustHighlightRange(int offset, int length) {
- if (fSourceViewer == null)
- return;
-
- if (!isVisible(fSourceViewer, offset, length))
- fSourceViewer.resetVisibleRegion();
- }
-
- /*
- * @see ITextEditor#selectAndReveal(int, int)
- */
- public void selectAndReveal(int start, int length) {
- if (fSourceViewer == null)
- return;
-
- ISelection selection= getSelectionProvider().getSelection();
- if (selection instanceof TextSelection) {
- TextSelection textSelection= (TextSelection) selection;
- if (textSelection.getOffset() != 0 || textSelection.getLength() != 0)
- markInNavigationHistory();
- }
-
- StyledText widget= fSourceViewer.getTextWidget();
- widget.setRedraw(false);
- {
- adjustHighlightRange(start, length);
-
- fSourceViewer.revealRange(start, length);
- fSourceViewer.setSelectedRange(start, length);
-
- markInNavigationHistory();
- }
- widget.setRedraw(true);
- }
-
- /*
- * @see org.eclipse.ui.INavigationLocationProvider#createNavigationLocation()
- * @since 2.1
- */
- public INavigationLocation createEmptyNavigationLocation() {
- return new TextSelectionNavigationLocation(this, false);
- }
-
- /*
- * @see org.eclipse.ui.INavigationLocationProvider#createNavigationLocation()
- */
- public INavigationLocation createNavigationLocation() {
- return new TextSelectionNavigationLocation(this, true);
- }
-
- /**
- * Writes a check mark of the given situation into the navigation history.
- * @since 2.1
- */
- protected void markInNavigationHistory() {
- IWorkbenchPage page= getEditorSite().getPage();
- page.getNavigationHistory().markLocation(this);
- }
-
- /**
- * Hook which gets called when the editor has been saved.
- * Subclasses may extend.
- * @since 2.1
- */
- protected void editorSaved() {
- IWorkbenchPage page= getEditorSite().getPage();
- INavigationLocation[] locations= page.getNavigationHistory().getLocations();
- IEditorInput input= getEditorInput();
- for (int i= 0; i < locations.length; i++) {
- if (locations[i] instanceof TextSelectionNavigationLocation) {
- if(input.equals(locations[i].getInput())) {
- TextSelectionNavigationLocation location= (TextSelectionNavigationLocation) locations[i];
- location.partSaved(this);
- }
- }
- }
- }
-
- /*
- * @see WorkbenchPart#firePropertyChange(int)
- */
- protected void firePropertyChange(int property) {
- super.firePropertyChange(property);
- updatePropertyDependentActions();
- }
-
- /*
- * @see ITextEditorExtension#setStatusField(IStatusField, String)
- * @since 2.0
- */
- public void setStatusField(IStatusField field, String category) {
- Assert.isNotNull(category);
- if (field != null) {
-
- if (fStatusFields == null)
- fStatusFields= new HashMap(3);
-
- fStatusFields.put(category, field);
- updateStatusField(category);
-
- } else if (fStatusFields != null)
- fStatusFields.remove(category);
-
- if (fIncrementalFindTarget != null && ITextEditorActionConstants.STATUS_CATEGORY_FIND_FIELD.equals(category))
- fIncrementalFindTarget.setStatusField(field);
- }
-
- /**
- * Returns the current status field for the given status category.
- *
- * @param category the status category
- * @return the current status field for the given status category
- * @since 2.0
- */
- protected IStatusField getStatusField(String category) {
- if (category != null && fStatusFields != null)
- return (IStatusField) fStatusFields.get(category);
- return null;
- }
-
- /**
- * Returns whether this editor is in overwrite or insert mode.
- *
- * @return <code>true</code> if in insert mode, <code>false</code> for overwrite mode
- * @since 2.0
- * @deprecated
- */
- protected boolean isInInsertMode() {
- InsertMode mode= getInsertMode();
- return mode == INSERT || mode == SMART_INSERT;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.ITextEditorExtension3#getInsertMode()
- */
- public InsertMode getInsertMode() {
- return fInsertMode;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.ITextEditorExtension3#setInsertMode(org.eclipse.ui.texteditor.ITextEditorExtension3.InsertMode)
- */
- public void setInsertMode(InsertMode newMode) {
- List legalModes= getLegalInsertModes();
- if (!legalModes.contains(newMode))
- throw new IllegalArgumentException();
-
- InsertMode oldMode= fInsertMode;
- fInsertMode= newMode;
-
- if (getSourceViewer() != null && (oldMode == OVERWRITE || newMode == OVERWRITE)) {
- StyledText styledText= getSourceViewer().getTextWidget();
- styledText.invokeAction(ST.TOGGLE_OVERWRITE);
- }
-
- handleInsertModeChanged();
- }
-
- /**
- * Returns the set of legal insert modes. If insert modes are configured all defined insert modes
- * are legal.
- *
- * @return the set of legal insert modes
- */
- protected List getLegalInsertModes() {
- if (fLegalInsertModes == null) {
- fLegalInsertModes= new ArrayList();
- fLegalInsertModes.add(OVERWRITE);
- fLegalInsertModes.add(INSERT);
- fLegalInsertModes.add(SMART_INSERT);
- }
- return fLegalInsertModes;
- }
-
- private void switchToNextInsertMode() {
-
- InsertMode mode= getInsertMode();
- List legalModes= getLegalInsertModes();
-
- int i= 0;
- while (i < legalModes.size()) {
- if (legalModes.get(i) == mode) break;
- ++ i;
- }
-
- i= (i + 1) % legalModes.size();
- InsertMode newMode= (InsertMode) legalModes.get(i);
- setInsertMode(newMode);
- }
-
-
- /**
- * Configures the given insert mode as legal or inlegal. This call is ignored if the set of legal
- * input modes would be empty after the call.
- *
- * @param mode the insert mode to be configured
- * @param legal <code>true</code> if the given mode is legal, <code>false</code> otherwise
- */
- protected void configureInsertMode(InsertMode mode, boolean legal) {
- List legalModes= getLegalInsertModes();
- if (legal) {
- if (!legalModes.contains(mode))
- legalModes.add(mode);
- } else if (legalModes.size() > 1) {
- if (getInsertMode() == mode)
- switchToNextInsertMode();
- legalModes.remove(mode);
- }
- }
-
- private Image createOverwriteModeCaretImage(StyledText styledText) {
-
- if (!"win32".equals(SWT.getPlatform())) //$NON-NLS-1$
- return null;
-
- PaletteData caretPalette= new PaletteData(new RGB[] {new RGB (0,0,0), new RGB (255,255,255)});
- ImageData imageData = new ImageData(100, styledText.getLineHeight(), 1, caretPalette);
- Display display = styledText.getDisplay();
- Image blockImage= new Image(display, imageData);
- GC gc = new GC (blockImage);
- gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
- gc.setFont(styledText.getFont());
- Point extent= gc.stringExtent("l"); //$NON-NLS-1$
- gc.fillRectangle(0, 0,extent.x, imageData.height -1);
- gc.dispose();
-
- return blockImage;
- }
-
- private Caret createOverwriteCaret(StyledText styledText) {
- Caret caret= new Caret(styledText, SWT.NULL);
- Image image= createOverwriteModeCaretImage(styledText);
- if (image != null)
- caret.setImage(image);
- else
- caret.setSize(1, caret.getSize().y);
-
- return caret;
- }
-
- private Image createSmartInsertModeCaretImage(StyledText styledText) {
-
- if (!"win32".equals(SWT.getPlatform())) //$NON-NLS-1$
- return null;
-
- PaletteData caretPalette= new PaletteData(new RGB[] {new RGB (0,0,0), new RGB (255,255,255)});
- ImageData imageData = new ImageData(4, styledText.getLineHeight(), 1, caretPalette);
- Display display = styledText.getDisplay();
- Image bracketImage= new Image(display, imageData);
- GC gc = new GC (bracketImage);
- gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
- gc.drawLine(0, 0, imageData.width -1, 0);
- gc.drawLine(0, 0, 0, imageData.height -1);
- gc.drawLine(0, imageData.height -1, imageData.width -1, imageData.height -1);
- gc.dispose();
-
- return bracketImage;
- }
-
- private Caret createSmartInsertModeCaret(StyledText styledText) {
- Caret caret= new Caret(styledText, SWT.NULL);
- Image image= createSmartInsertModeCaretImage(styledText);
- if (image != null)
- caret.setImage(image);
- else
- caret.setSize(1, caret.getSize().y);
-
- return caret;
- }
-
- private void createInsertModeCarets() {
- StyledText styledText= getSourceViewer().getTextWidget();
- fInsertModeCaret= styledText.getCaret();
- fOverwriteModeCaret= createOverwriteCaret(styledText);
- fSmartInsertModeCaret= createSmartInsertModeCaret(styledText);
- styledText.setCaret(fInsertModeCaret);
- }
-
- private void updateCaret() {
-
- if (getSourceViewer() == null)
- return;
-
- StyledText styledText= getSourceViewer().getTextWidget();
-
- Caret caret= null;
- Image image= null;
-
- InsertMode mode= getInsertMode();
- if (OVERWRITE == mode) {
- caret= fOverwriteModeCaret;
- image= createOverwriteModeCaretImage(styledText);
- } else if (INSERT == mode) {
- caret= fInsertModeCaret;
- } else if (SMART_INSERT == mode) {
- caret= fSmartInsertModeCaret;
- image= createSmartInsertModeCaretImage(styledText);
- }
-
- if (caret != null) {
- if (image != null) {
- Image oldImage= caret.getImage();
- caret.setImage(image);
- if (oldImage != null)
- oldImage.dispose();
- }
- styledText.setCaret(caret);
- }
- }
-
- /**
- * Handles a change of the editor's insert mode.
- * Subclasses may extend.
- *
- * @since 2.0
- */
- protected void handleInsertModeChanged() {
- updateCaret();
- updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_MODE);
- }
-
- /**
- * Handles a potential change of the cursor position.
- * Subclasses may extend.
- *
- * @since 2.0
- */
- protected void handleCursorPositionChanged() {
- updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION);
- }
-
- /**
- * Updates the status fields for the given category.
- *
- * @param category
- * @since 2.0
- */
- protected void updateStatusField(String category) {
-
- if (category == null)
- return;
-
- IStatusField field= getStatusField(category);
- if (field != null) {
-
- String text= null;
-
- if (ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION.equals(category))
- text= getCursorPosition();
- else if (ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE.equals(category))
- text= isEditorInputReadOnly() ? fReadOnlyLabel : fWritableLabel;
- else if (ITextEditorActionConstants.STATUS_CATEGORY_INPUT_MODE.equals(category)) {
- InsertMode mode= getInsertMode();
- if (OVERWRITE == mode)
- text= fOverwriteModeLabel;
- else if (INSERT == mode)
- text= fInsertModeLabel;
- else if (SMART_INSERT == mode)
- text= fSmartInsertModeLabel;
- }
-
- field.setText(text == null ? fErrorLabel : text);
- }
- }
-
- /**
- * Updates all status fields.
- *
- * @since 2.0
- */
- protected void updateStatusFields() {
- if (fStatusFields != null) {
- Iterator e= fStatusFields.keySet().iterator();
- while (e.hasNext())
- updateStatusField((String) e.next());
- }
- }
-
- /**
- * Returns a description of the cursor position.
- *
- * @return a description of the cursor position
- * @since 2.0
- */
- protected String getCursorPosition() {
-
- if (fSourceViewer == null)
- return fErrorLabel;
-
- StyledText styledText= fSourceViewer.getTextWidget();
- int caret= widgetOffset2ModelOffset(fSourceViewer, styledText.getCaretOffset());
- IDocument document= fSourceViewer.getDocument();
-
- if (document == null)
- return fErrorLabel;
-
- try {
-
- int line= document.getLineOfOffset(caret);
-
- int lineOffset= document.getLineOffset(line);
- int tabWidth= styledText.getTabs();
- int column= 0;
- for (int i= lineOffset; i < caret; i++)
- if ('\t' == document.getChar(i))
- column += tabWidth - (tabWidth == 0 ? 0 : column % tabWidth);
- else
- column++;
-
- fLineLabel.fValue= line + 1;
- fColumnLabel.fValue= column + 1;
- return MessageFormat.format(fPositionLabelPattern, fPositionLabelPatternArguments);
-
- } catch (BadLocationException x) {
- return fErrorLabel;
- }
- }
-
- /*
- * @see ITextEditorExtension#isEditorInputReadOnly()
- * @since 2.0
- */
- public boolean isEditorInputReadOnly() {
- IDocumentProvider provider= getDocumentProvider();
- if (provider instanceof IDocumentProviderExtension) {
- IDocumentProviderExtension extension= (IDocumentProviderExtension) provider;
- return extension.isReadOnly(getEditorInput());
- }
- return true;
- }
-
- /*
- * @see ITextEditorExtension2#isEditorInputModifiable()
- * @since 2.1
- */
- public boolean isEditorInputModifiable() {
- IDocumentProvider provider= getDocumentProvider();
- if (provider instanceof IDocumentProviderExtension) {
- IDocumentProviderExtension extension= (IDocumentProviderExtension) provider;
- return extension.isModifiable(getEditorInput());
- }
- return true;
- }
-
- /*
- * @see ITextEditorExtension#addRulerContextMenuListener(IMenuListener)
- * @since 2.0
- */
- public void addRulerContextMenuListener(IMenuListener listener) {
- fRulerContextMenuListeners.add(listener);
- }
-
- /*
- * @see ITextEditorExtension#removeRulerContextMenuListener(IMenuListener)
- * @since 2.0
- */
- public void removeRulerContextMenuListener(IMenuListener listener) {
- fRulerContextMenuListeners.remove(listener);
- }
-
- /**
- * Returns wether this editor can handle the move of the original element
- * so that it ends up being the moved element. By default this method returns
- * <code>true</code>.
- * Subclasses may reimplement.
- *
- * @param originalElement the original element
- * @param movedElement the moved element
- * @since 2.0
- */
- protected boolean canHandleMove(IEditorInput originalElement, IEditorInput movedElement) {
- return true;
- }
-
- /**
- * Returns the offset of the given source viewer's document that corresponds
- * to the given widget offset or <code>-1</code> if there is no such offset.
- *
- * @param viewer the source viewer
- * @param widgetOffset the widget offset
- * @return the corresponding offset in the source viewer's document or <code>-1</code>
- * @since 2.1
- */
- protected final static int widgetOffset2ModelOffset(ISourceViewer viewer, int widgetOffset) {
- if (viewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) viewer;
- return extension.widgetOffset2ModelOffset(widgetOffset);
- }
- return widgetOffset + viewer.getVisibleRegion().getOffset();
- }
-
- /**
- * Returns the offset of the given source viewer's text widget that corresponds
- * to the given model offset or <code>-1</code> if there is no such offset.
- *
- * @param viewer the source viewer
- * @param modelOffset the model offset
- * @return the corresponding offset in the source viewer's text widget or <code>-1</code>
- * @since 3.0
- */
- protected final static int modelOffset2WidgetOffset(ISourceViewer viewer, int modelOffset) {
- if (viewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) viewer;
- return extension.modelOffset2WidgetOffset(modelOffset);
- }
- return modelOffset - viewer.getVisibleRegion().getOffset();
- }
-
- /**
- * Returns the minimal region of the given source viewer's document that completely
- * comprises everything that is visible in the viewer's widget.
- *
- * @return the minimal region of the source viewer's document comprising the contents of the viewer's widget
- * @since 2.1
- */
- protected final static IRegion getCoverage(ISourceViewer viewer) {
- if (viewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) viewer;
- return extension.getModelCoverage();
- }
- return viewer.getVisibleRegion();
- }
-
- /**
- * Tells whether the given region is visible in the given source viewer.
- *
- * @param viewer the source viewer
- * @param offset the offset of the region
- * @param length the length of the region
- * @since 2.1
- */
- protected final static boolean isVisible(ISourceViewer viewer, int offset, int length) {
- if (viewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) viewer;
- IRegion overlap= extension.modelRange2WidgetRange(new Region(offset, length));
- return overlap != null;
- }
- return viewer.overlapsWithVisibleRegion(offset, length);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.ITextEditorExtension3#showChangeInformation(boolean)
- * @since 3.0
- */
- public void showChangeInformation(boolean show) {
- // do nothing
- }
-
- /*
- * @see org.eclipse.ui.texteditor.ITextEditorExtension3#isChangeInformationShowing()
- * @since 3.0
- */
- public boolean isChangeInformationShowing() {
- return false;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java
deleted file mode 100644
index 88ea55b303f..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java
+++ /dev/null
@@ -1,838 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.texteditor;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginDescriptor;
-
-import org.eclipse.swt.graphics.RGB;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-
-import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
-
-
-/**
- * An annotation preference provides all the information required for handing the preferences for the presentation of annotations of a specified type.
- * The provided information covers:
- * <ul>
- * <li> the preference key for the presentation color
- * <li> the default presentation color
- * <li> the preference key for the visibility of annotations inside text
- * <li> the default visibility of annotations inside text
- * <li> the preference key for the visibility of annotations inside the overview ruler
- * <li> the default visibility of annotations inside the overview ruler
- * <li> the presentation layer
- * <li> how the annotation type should be presented on a preference page
- * <li> whether the annotation type should be presented in the header of the overview ruler
- * <li> the marker type if the annotation type is derived from an <code>IMarker</code>
- * <li> the severity of the marker if the annotation type is derived from an <code>IMarker</code>
- * <li> the preference key for the visibility in the next/previous navigation toolbar drop down action
- * <li> the default value for the visibility in the next/previous navigation toolbar drop down action
- * <li> the preference key for go to next navigation enablement
- * <li> the default value for go to next navigation enablement
- * <li> the preference key for got to previous navigation enablement
- * <li> the default value for got to previous navigation enablement
- * <li> the image descriptor
- * <li> the symbolic image name
- * </ul>
- *
- * @since 2.1
- */
-public class AnnotationPreference {
-
- /** IDs for presentation preference attributes */
-
- /** The image to be used for drawing in the vertical ruler. */
- protected final static Object IMAGE_DESCRIPTOR= new Object();
- /** The preference label */
- protected final static Object PREFERENCE_LABEL= new Object();
- /** The presentation layer */
- protected final static Object PRESENTATION_LAYER= new Object();
- /** The symbolic name of the image to be drawn in the vertical ruler. */
- protected final static Object SYMBOLIC_IMAGE_NAME= new Object();
- /** Indicates whether the annotation type contributed to the overview ruler's header */
- protected final static Object HEADER_VALUE= new Object();
- /** The annotation image provider. */
- protected final static Object IMAGE_PROVIDER= new Object();
-
- /** IDs for preference store access and initialization */
-
- /** The preference key for the visibility inside text */
- protected final static Object TEXT_PREFERENCE_KEY= new Object();
- /** The visibility inside text */
- protected final static Object TEXT_PREFERENCE_VALUE= new Object();
- /** The preference key for the presentation color */
- protected final static Object COLOR_PREFERENCE_KEY= new Object();
- /** The presentation color */
- protected final static Object COLOR_PREFERENCE_VALUE= new Object();
- /** The preference key for highlighting inside text. */
- protected final static Object HIGHLIGHT_PREFERENCE_KEY= new Object();
- /** The value for highlighting inside text. */
- protected final static Object HIGHLIGHT_PREFERENCE_VALUE= new Object();
- /** The preference key for go to next navigation enablement. */
- protected final static Object IS_GO_TO_NEXT_TARGET_KEY= new Object();
- /** The value for go to next navigation enablement. */
- protected final static Object IS_GO_TO_NEXT_TARGET_VALUE= new Object();
- /** The preference key for go to previous navigation enablement. */
- protected final static Object IS_GO_TO_PREVIOUS_TARGET_KEY= new Object();
- /** The value for go to previous navigation enablement. */
- protected final static Object IS_GO_TO_PREVIOUS_TARGET_VALUE= new Object();
- /** The preference key for the visibility in the vertical ruler. */
- protected final static Object VERTICAL_RULER_PREFERENCE_KEY= new Object();
- /** The visibility in the vertical ruler. */
- protected final static Object VERTICAL_RULER_PREFERENCE_VALUE= new Object();
- /** The preference key for the visibility in the overview ruler */
- protected final static Object OVERVIEW_RULER_PREFERENCE_KEY= new Object();
- /** The visibility in the overview ruler */
- protected final static Object OVERVIEW_RULER_PREFERENCE_VALUE= new Object();
- /** The preference key for the visibility in the next/previous drop down toolbar action. */
- protected final static Object SHOW_IN_NAVIGATION_DROPDOWN_KEY= new Object();
- /** The value for the visibility in the next/previous drop down toolbar action. */
- protected final static Object SHOW_IN_NAVIGATION_DROPDOWN_VALUE= new Object();
-
- /**
- * Array of all supported attributes.
- */
- protected final static Object[] ATTRIBUTES= new Object[] {
- IMAGE_DESCRIPTOR,
- PREFERENCE_LABEL,
- PRESENTATION_LAYER,
- SYMBOLIC_IMAGE_NAME,
- HEADER_VALUE,
- IMAGE_PROVIDER,
- TEXT_PREFERENCE_KEY,
- TEXT_PREFERENCE_VALUE,
- COLOR_PREFERENCE_KEY,
- COLOR_PREFERENCE_VALUE,
- HIGHLIGHT_PREFERENCE_KEY,
- HIGHLIGHT_PREFERENCE_VALUE,
- IS_GO_TO_NEXT_TARGET_KEY,
- IS_GO_TO_NEXT_TARGET_VALUE,
- IS_GO_TO_PREVIOUS_TARGET_KEY,
- IS_GO_TO_PREVIOUS_TARGET_VALUE,
- VERTICAL_RULER_PREFERENCE_KEY,
- VERTICAL_RULER_PREFERENCE_VALUE,
- OVERVIEW_RULER_PREFERENCE_KEY,
- OVERVIEW_RULER_PREFERENCE_VALUE,
- SHOW_IN_NAVIGATION_DROPDOWN_KEY,
- SHOW_IN_NAVIGATION_DROPDOWN_VALUE
- };
-
- /** The annotation type */
- private Object fAnnotationType;
- /** The marker type */
- private String fMarkerType;
- /** The marker severity */
- private int fSeverity;
- /**
- * The annotation image provider.
- * @since 3.0
- */
- public IAnnotationImageProvider fAnnotationImageProvider;
- /**
- * The configuration element from which to create the annotation image provider.
- * @since 3.0
- */
- public IConfigurationElement fConfigurationElement;
- /**
- * The name of the attribute used to load the annotation image provider
- * from the configuration element.
- * @since 3.0
- */
- public String fAnnotationImageProviderAttribute;
- /**
- * The map of attributes.
- * @since 3.0
- */
- private Map fAttributes= new HashMap();
-
-
-
- /**
- * Creates a new uninitialized annotation preference.
- */
- public AnnotationPreference() {
- }
-
- /**
- * Creates a new annotation preference for the given annotation type.
- *
- * @param annotationType the annotation type
- * @param colorKey the preference key for the presentation color
- * @param textKey the preference key for the visibility inside text
- * @param overviewRulerKey the preference key for the visibility in the overview ruler
- * @param presentationLayer the presentation layer
- */
- public AnnotationPreference(Object annotationType, String colorKey, String textKey, String overviewRulerKey, int presentationLayer) {
- fAnnotationType= annotationType;
- setValue(COLOR_PREFERENCE_KEY, colorKey);
- setValue(TEXT_PREFERENCE_KEY, textKey);
- setValue(OVERVIEW_RULER_PREFERENCE_KEY, overviewRulerKey);
- setValue(PRESENTATION_LAYER, presentationLayer);
- }
-
- /**
- * Sets the given value for the given attribute.
- *
- * @param attribute the attribute
- * @param value the attribute value
- * @since 3.0
- */
- protected void setValue(Object attribute, Object value) {
- fAttributes.put(attribute, value);
- }
-
- /**
- * Sets the given value for the given attribute.
- *
- * @param attribute the attribute
- * @param value the attribute value
- * @since 3.0
- */
- protected void setValue(Object attribute, int value) {
- fAttributes.put(attribute, new Integer(value));
- }
-
- /**
- * Sets the given value for the given attribute.
- *
- * @param attribute the attribute
- * @param value the attribute value
- * @since 3.0
- */
- protected void setValue(Object attribute, boolean value) {
- fAttributes.put(attribute, value ? Boolean.TRUE : Boolean.FALSE);
- }
-
- /**
- * Returns the value of the given attribute as string.
- *
- * @param attribute the attribute
- * @return the attribute value
- * @since 3.0
- */
- protected String getStringValue(Object attribute) {
- Object value= fAttributes.get(attribute);
- if (value instanceof String)
- return (String) value;
- return null;
- }
-
- /**
- * Returns the value of the given attribute as boolean.
- *
- * @param attribute the attribute
- * @return the attribute value
- * @since 3.0
- */
- protected boolean getBooleanValue(Object attribute) {
- Object value= fAttributes.get(attribute);
- if (value instanceof Boolean)
- return ((Boolean) value).booleanValue();
- return false;
- }
-
- /**
- * Returns the value of the given attribute as integer.
- *
- * @param attribute the attribute
- * @return the attribute value
- * @since 3.0
- */
- protected int getIntegerValue(Object attribute) {
- Object value= fAttributes.get(attribute);
- if (value instanceof Integer)
- return ((Integer) value).intValue();
- return 0;
- }
-
- /**
- * Returns the value of the given attribute.
- *
- * @param attribute the attribute
- * @return the attribute value
- * @since 3.0
- */
- public Object getValue(Object attribute) {
- return fAttributes.get(attribute);
- }
-
- /**
- * Returns whether the given attribute is defined.
- *
- * @param attribute the attribute
- * @return <code>true</code> if the attribute has a value <code>false</code> otherwise
- * @since 3.0
- */
- public boolean hasValue(Object attribute) {
- return fAttributes.get(attribute) != null;
- }
-
- /**
- * Returns whether the given string is a preference key.
- *
- * @param key the string to test
- * @return <code>true</code> if the string is a preference key
- */
- public boolean isPreferenceKey(String key) {
- if (key == null)
- return false;
-
- return key.equals(getStringValue(COLOR_PREFERENCE_KEY)) ||
- key.equals(getStringValue(OVERVIEW_RULER_PREFERENCE_KEY)) ||
- key.equals(getStringValue(TEXT_PREFERENCE_KEY)) ||
- key.equals(getStringValue(HIGHLIGHT_PREFERENCE_KEY)) ||
- key.equals(getStringValue(VERTICAL_RULER_PREFERENCE_KEY));
- }
-
- /**
- * Returns the annotation type.
- *
- * @return the annotation type
- */
- public Object getAnnotationType() {
- return fAnnotationType;
- }
-
- /**
- * Returns the marker type.
- *
- * @return the marker type
- * @deprecated since 3.0
- */
- public String getMarkerType() {
- return fMarkerType;
- }
-
- /**
- * Returns the marker severity.
- *
- * @return the marker severity
- * @deprecated since 3.0
- */
- public int getSeverity() {
- return fSeverity;
- }
-
- /**
- * Sets the annotation type.
- *
- * @param annotationType the annotation type
- */
- public void setAnnotationType(Object annotationType) {
- fAnnotationType= annotationType;
- }
-
- /**
- * Sets the marker type.
- *
- * @param markerType the marker type
- */
- public void setMarkerType(String markerType) {
- fMarkerType= markerType;
- }
-
- /**
- * Sets the marker serverity.
- *
- * @param severity the marker severity
- */
- public void setSeverity(int severity) {
- fSeverity= severity;
- }
-
- /**
- * Returns the preference key for the presentation color.
- *
- * @return the preference key for the presentation color
- */
- public String getColorPreferenceKey() {
- return getStringValue(COLOR_PREFERENCE_KEY);
- }
-
- /**
- * Returns the default presentation color.
- *
- * @return the default presentation color.
- */
- public RGB getColorPreferenceValue() {
- return (RGB) getValue(COLOR_PREFERENCE_VALUE);
- }
-
- /**
- * Returns the presentation string for this annotation type.
- *
- * @return the presentation string for this annotation type
- */
- public String getPreferenceLabel() {
- return getStringValue(PREFERENCE_LABEL);
- }
-
- /**
- * Returns the preference key for the visibility in the overview ruler.
- *
- * @return the preference key for the visibility in the overview ruler
- */
- public String getOverviewRulerPreferenceKey() {
- return getStringValue(OVERVIEW_RULER_PREFERENCE_KEY);
- }
-
- /**
- * Returns the default visibility in the overview ruler.
- *
- * @return the default visibility in the overview ruler
- */
- public boolean getOverviewRulerPreferenceValue() {
- return getBooleanValue(OVERVIEW_RULER_PREFERENCE_VALUE);
- }
-
- /**
- * Returns the preference key for the visibility in the vertical ruler.
- *
- * @return the preference key for the visibility in the vertical ruler
- * @since 3.0
- */
- public String getVerticalRulerPreferenceKey() {
- return getStringValue(VERTICAL_RULER_PREFERENCE_KEY);
- }
-
- /**
- * Returns the default visibility in the vertical ruler.
- *
- * @return the default visibility in the vertical ruler
- * @since 3.0
- */
- public boolean getVerticalRulerPreferenceValue() {
- return getBooleanValue(VERTICAL_RULER_PREFERENCE_VALUE);
- }
-
- /**
- * Returns the presentation layer.
- *
- * @return the presentation layer
- */
- public int getPresentationLayer() {
- return getIntegerValue(PRESENTATION_LAYER);
- }
-
- /**
- * Returns the preference key for the visibility inside text.
- *
- * @return the preference key for the visibility inside text
- */
- public String getTextPreferenceKey() {
- return getStringValue(TEXT_PREFERENCE_KEY);
- }
-
- /**
- * Returns the default visibility inside text.
- *
- * @return the default visibility inside text
- */
- public boolean getTextPreferenceValue() {
- return getBooleanValue(TEXT_PREFERENCE_VALUE);
- }
-
- /**
- * Returns the preference key for highlighting inside text.
- *
- * @return the preference key for highlighting inside text
- * @since 3.0
- */
- public String getHighlightPreferenceKey() {
- return getStringValue(HIGHLIGHT_PREFERENCE_KEY);
- }
-
- /**
- * Returns the default value for highlighting inside text.
- *
- * @return the default value for highlighting inside text
- * @since 3.0
- */
- public boolean getHighlightPreferenceValue() {
- return getBooleanValue(HIGHLIGHT_PREFERENCE_VALUE);
- }
-
- /**
- * Returns whether the annotation type contributes to the header of the overview ruler.
- *
- * @return <code>true</code> if the annotation type contributes to the header of the overview ruler
- */
- public boolean contributesToHeader() {
- return getBooleanValue(HEADER_VALUE);
- }
-
- /**
- * Sets the preference key for the presentation color.
- *
- * @param colorKey the preference key
- */
- public void setColorPreferenceKey(String colorKey) {
- setValue(COLOR_PREFERENCE_KEY, colorKey);
- }
-
- /**
- * Sets the default presentation color.
- *
- * @param colorValue the default color
- */
- public void setColorPreferenceValue(RGB colorValue) {
- setValue(COLOR_PREFERENCE_VALUE, colorValue);
- }
-
- /**
- * Sets the presentation label of this annotation type.
- *
- * @param label the presentation label
- */
- public void setPreferenceLabel(String label) {
- setValue(PREFERENCE_LABEL, label);
- }
-
- /**
- * Sets the preference key for the visibility in the overview ruler.
- *
- * @param overviewRulerKey the preference key
- */
- public void setOverviewRulerPreferenceKey(String overviewRulerKey) {
- setValue(OVERVIEW_RULER_PREFERENCE_KEY, overviewRulerKey);
- }
-
- /**
- * Sets the default visibility in the overview ruler.
- *
- * @param overviewRulerValue <code>true</code> if visible by default, <code>false</code> otherwise
- */
- public void setOverviewRulerPreferenceValue(boolean overviewRulerValue) {
- setValue(OVERVIEW_RULER_PREFERENCE_VALUE, overviewRulerValue);
- }
-
- /**
- * Sets the preference key for the visibility in the vertical ruler.
- *
- * @param verticalRulerKey the preference key
- * @since 3.0
- */
- public void setVerticalRulerPreferenceKey(String verticalRulerKey) {
- setValue(VERTICAL_RULER_PREFERENCE_KEY, verticalRulerKey);
- }
-
- /**
- * Sets the default visibility in the vertical ruler.
- *
- * @param verticalRulerValue <code>true</code> if visible by default, <code>false</code> otherwise
- * @since 3.0
- */
- public void setVerticalRulerPreferenceValue(boolean verticalRulerValue) {
- setValue(VERTICAL_RULER_PREFERENCE_VALUE, verticalRulerValue);
- }
-
- /**
- * Sets the presentation layer.
- *
- * @param presentationLayer the presentation layer
- */
- public void setPresentationLayer(int presentationLayer) {
- setValue(PRESENTATION_LAYER, presentationLayer);
- }
-
- /**
- * Sets the preference key for the visibility of squiggles inside text.
- *
- * @param textKey the preference key
- */
- public void setTextPreferenceKey(String textKey) {
- setValue(TEXT_PREFERENCE_KEY, textKey);
- }
-
- /**
- * Sets the default visibility inside text.
- *
- * @param textValue <code>true</code> if visible by default, <code>false</code> otherwise
- */
- public void setTextPreferenceValue(boolean textValue) {
- setValue(TEXT_PREFERENCE_VALUE, textValue);
- }
-
- /**
- * Sets the preference key for highlighting inside text.
- *
- * @param highlightKey the preference key
- * @since 3.0
- */
- public void setHighlightPreferenceKey(String highlightKey) {
- setValue(HIGHLIGHT_PREFERENCE_KEY, highlightKey);
- }
-
- /**
- * Sets the default value for highlighting inside text.
- *
- * @param highlightValue <code>true</code> if highlighted in text by default, <code>false</code> otherwise
- * @since 3.0
- */
- public void setHighlightPreferenceValue(boolean highlightValue) {
- setValue(HIGHLIGHT_PREFERENCE_VALUE, highlightValue);
- }
-
- /**
- * Sets whether the annotation type contributes to the overview ruler's header.
- *
- * @param contributesToHeader <code>true</code> if in header, <code>false</code> otherwise
- */
- public void setContributesToHeader(boolean contributesToHeader) {
- setValue(HEADER_VALUE, contributesToHeader);
- }
-
- /**
- * Returns the default value for go to next navigation enablement.
- *
- * @return <code>true</code> if enabled by default
- * @since 3.0
- */
- public boolean isGoToNextNavigationTarget() {
- return getBooleanValue(IS_GO_TO_NEXT_TARGET_VALUE);
- }
-
- /**
- * Sets the default value for go to next navigation enablement.
- *
- * @param isGoToNextNavigationTarget <code>true</code> if enabled by default
- * @since 3.0
- */
- public void setIsGoToNextNavigationTarget(boolean isGoToNextNavigationTarget) {
- setValue(IS_GO_TO_NEXT_TARGET_VALUE, isGoToNextNavigationTarget);
- }
-
- /**
- * Returns the preference key for go to next navigation enablement.
- *
- * @return the preference key or <code>null</code> if the key is undefined
- * @since 3.0
- */
- public String getIsGoToNextNavigationTargetKey() {
- return getStringValue(IS_GO_TO_NEXT_TARGET_KEY);
- }
-
- /**
- * Sets the preference key for go to next navigation enablement.
- *
- * @param isGoToNextNavigationTargetKey <code>true</code> if enabled by default
- * @since 3.0
- */
- public void setIsGoToNextNavigationTargetKey(String isGoToNextNavigationTargetKey) {
- setValue(IS_GO_TO_NEXT_TARGET_KEY, isGoToNextNavigationTargetKey);
- }
-
- /**
- * Returns the default value for go to previous navigation enablement.
- *
- * @return <code>true</code> if enabled by default
- * @since 3.0
- */
- public boolean isGoToPreviousNavigationTarget() {
- return getBooleanValue(IS_GO_TO_PREVIOUS_TARGET_VALUE);
- }
-
- /**
- * Sets the default value for go to previous navigation enablement.
- *
- * @param isGoToPreviousNavigationTarget <code>true</code> if enabled by default
- * @since 3.0
- */
- public void setIsGoToPreviousNavigationTarget(boolean isGoToPreviousNavigationTarget) {
- setValue(IS_GO_TO_PREVIOUS_TARGET_VALUE, isGoToPreviousNavigationTarget);
- }
-
- /**
- * Returns the preference key for go to previous navigation enablement.
- *
- * @return the preference key or <code>null</code> if the key is undefined
- * @since 3.0
- */
- public String getIsGoToPreviousNavigationTargetKey() {
- return getStringValue(IS_GO_TO_PREVIOUS_TARGET_KEY);
- }
-
- /**
- * Sets the preference key for go to previous navigation enablement.
- *
- * @param isGoToPreviousNavigationTargetKey the preference key
- * @since 3.0
- */
- public void setIsGoToPreviousNavigationTargetKey(String isGoToPreviousNavigationTargetKey) {
- setValue(IS_GO_TO_PREVIOUS_TARGET_KEY, isGoToPreviousNavigationTargetKey);
- }
-
- /**
- * Returns the preference key for the visibility in the next/previous drop down toolbar action.
- *
- * @return the preference key or <code>null</code> if the key is undefined
- * @since 3.0
- */
- public String getShowInNextPrevDropdownToolbarActionKey() {
- return getStringValue(SHOW_IN_NAVIGATION_DROPDOWN_KEY);
- }
-
- /**
- * Sets the preference key for the visibility in the next/previous drop down toolbar action.
- *
- * @param showInNextPrevDropdownToolbarActionKey the preference key
- * @since 3.0
- */
- public void setShowInNextPrevDropdownToolbarActionKey(String showInNextPrevDropdownToolbarActionKey) {
- setValue(SHOW_IN_NAVIGATION_DROPDOWN_KEY, showInNextPrevDropdownToolbarActionKey);
- }
-
- /**
- * Returns the default value for the visibility in the next/previous drop down toolbar action.
- *
- * @return <code>true</code> if enabled by default
- * @since 3.0
- */
- public boolean isShowInNextPrevDropdownToolbarAction() {
- return getBooleanValue(SHOW_IN_NAVIGATION_DROPDOWN_VALUE);
- }
-
- /**
- * Sets the default value for the visibility in the next/previous drop down toolbar action.
- *
- * @param showInNextPrevDropdownToolbarAction <code>true</code> if enabled by default
- * @since 3.0
- */
- public void setShowInNextPrevDropdownToolbarAction(boolean showInNextPrevDropdownToolbarAction) {
- setValue(SHOW_IN_NAVIGATION_DROPDOWN_VALUE, showInNextPrevDropdownToolbarAction);
- }
-
- /**
- * Returns the image descriptor for the image to be drawn in the vertical ruler. The provided
- * image is only used, if <code>getAnnotationImageProvider</code> returns <code>null</code>.
- *
- * @return the image descriptor or <code>null</code>
- * @since 3.0
- **/
- public ImageDescriptor getImageDescriptor() {
- return (ImageDescriptor) getValue(IMAGE_DESCRIPTOR);
- }
-
- /**
- * Sets the image descriptor for the image to be drawn in the vertical ruler.
- *
- * @param descriptor the image descriptor
- * @since 3.0
- */
- public void setImageDescriptor(ImageDescriptor descriptor) {
- setValue(IMAGE_DESCRIPTOR, descriptor);
- }
-
- /**
- * Returns the symbolic name of the image to be drawn in the vertical ruler.
- * The image is only used if <code>getImageDescriptor</code> returns <code>null</code>.
- *
- * @return the symbolic name of the image or <code>null</code>
- * @since 3.0
- */
- public String getSymbolicImageName() {
- return getStringValue(SYMBOLIC_IMAGE_NAME);
- }
-
- /**
- * Sets the symbolic name of the image to be drawn in the vertical ruler.
- *
- * @param symbolicImageName the symbolic image name
- * @since 3.0
- */
- public void setSymbolicImageName(String symbolicImageName) {
- setValue(SYMBOLIC_IMAGE_NAME, symbolicImageName);
- }
-
- /**
- * Returns the annotation image provider. If no default annotation image
- * provider has been set, this method checks whether the annotation image
- * provider data has been set. If so, an annotation image provider is
- * created if the configuration element's plug-in is loaded. When an
- * annotation image provider has been created successfully, it is set as
- * the default annotation image provider.
- *
- * @return the annotation image provider
- * @since 3.0
- */
- public IAnnotationImageProvider getAnnotationImageProvider() {
- if (fAnnotationImageProvider == null) {
- if (fConfigurationElement != null && fAnnotationImageProviderAttribute != null) {
- IPluginDescriptor descriptor = fConfigurationElement.getDeclaringExtension().getDeclaringPluginDescriptor();
- if (descriptor.isPluginActivated()) {
- try {
- fAnnotationImageProvider= (IAnnotationImageProvider) fConfigurationElement.createExecutableExtension(fAnnotationImageProviderAttribute);
- } catch (CoreException x) {
- TextEditorPlugin.getDefault().getLog().log(x.getStatus());
- }
- }
- }
- }
- return fAnnotationImageProvider;
- }
-
- /**
- * Sets the annotation image provider who provides images for annotations
- * of the specified annotation type.
- *
- * @param provider the annotation image provider
- * @since 3.0
- */
- public void setAnnotationImageProvider(IAnnotationImageProvider provider) {
- fAnnotationImageProvider= provider;
- setValue(IMAGE_PROVIDER, provider != null);
- }
-
- /**
- * Sets the data needed to create the annotation image provider.
- *
- * @param configurationElement the configuration element
- * @param annotationImageProviderAttribute the atrribute of the
- * configuration element
- * @since 3.0
- */
- public void setAnnotationImageProviderData(IConfigurationElement configurationElement, String annotationImageProviderAttribute) {
- fConfigurationElement= configurationElement;
- fAnnotationImageProviderAttribute= annotationImageProviderAttribute;
- setValue(IMAGE_PROVIDER, annotationImageProviderAttribute != null);
- }
-
- /**
- * Merges the values of the given preference into this preference. Existing
- * values will not be overwritten. Subclasses may extend.
- *
- * @param preference the preference to merge into this preference
- * @since 3.0
- */
- public void merge(AnnotationPreference preference) {
- if (!getAnnotationType().equals(preference.getAnnotationType()))
- return;
-
- for (int i= 0; i < ATTRIBUTES.length; i++) {
- if (!hasValue(ATTRIBUTES[i]))
- setValue(ATTRIBUTES[i], preference.getValue(ATTRIBUTES[i]));
- }
-
- if (fAnnotationImageProvider == null)
- fAnnotationImageProvider= preference.fAnnotationImageProvider;
- if (fConfigurationElement == null)
- fConfigurationElement= preference.fConfigurationElement;
- if (fAnnotationImageProviderAttribute == null)
- fAnnotationImageProviderAttribute= preference.fAnnotationImageProviderAttribute;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java
deleted file mode 100644
index 64b4552a8ef..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.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.texteditor;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-
-import org.eclipse.jface.text.Assert;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.part.EditorActionBarContributor;
-
-
-
-/**
- * Manages the installation and deinstallation of global actions for
- * the same type of editors.
- * <p>
- * If instantiated and used as-is, this contributor connects to all of the workbench defined
- * global editor actions the corresponding actions of the current editor. It also adds addition
- * actions for searching and navigation (go to line) as well as a set of status fields.</p>
- * <p>
- * Subclasses may override the following methods:
- * <ul>
- * <li><code>contributeToMenu</code> - extend to contribute to menu</li>
- * <li><code>contributeToToolBar</code> - reimplement to contribute to toolbar</li>
- * <li><code>contributeToStatusLine</code> - reimplement to contribute to status line</li>
- * <li><code>setActiveEditor</code> - extend to react to editor changes</li>
- * </ul>
- * </p>
- * @see org.eclipse.ui.texteditor.ITextEditorActionConstants
- */
-public class BasicTextEditorActionContributor extends EditorActionBarContributor {
-
- /** The global actions to be connected with editor actions */
- private final static String[] ACTIONS= {
- ITextEditorActionConstants.UNDO,
- ITextEditorActionConstants.REDO,
- ITextEditorActionConstants.CUT,
- ITextEditorActionConstants.COPY,
- ITextEditorActionConstants.PASTE,
- ITextEditorActionConstants.DELETE,
- ITextEditorActionConstants.SELECT_ALL,
- ITextEditorActionConstants.FIND,
- ITextEditorActionConstants.PRINT,
- ITextEditorActionConstants.REVERT
- };
-
- /**
- * Status field definition.
- * @since 3.0
- */
- private static class StatusFieldDef {
-
- private String category;
- private String actionId;
- private boolean visible;
- private int widthInChars;
-
- private StatusFieldDef(String category, String actionId, boolean visible, int widthInChars) {
- Assert.isNotNull(category);
- this.category= category;
- this.actionId= actionId;
- this.visible= visible;
- this.widthInChars= widthInChars;
- }
- }
-
- /**
- * The status fields to be set to the editor
- * @since 2.0
- */
- private final static StatusFieldDef[] STATUS_FIELD_DEFS= {
- new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_FIND_FIELD, null, false, EditorMessages.getString("Editor.FindIncremental.reverse.name").length() + 15), //$NON-NLS-1$
- new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE, null, true, StatusLineContributionItem.DEFAULT_WIDTH_IN_CHARS),
- new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_MODE, ITextEditorActionDefinitionIds.TOGGLE_OVERWRITE, true, StatusLineContributionItem.DEFAULT_WIDTH_IN_CHARS),
- new StatusFieldDef(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION, ITextEditorActionConstants.GOTO_LINE, true, StatusLineContributionItem.DEFAULT_WIDTH_IN_CHARS)
- };
-
- /**
- * The active editor part.
- */
- private IEditorPart fActiveEditorPart;
- /**
- * The find next action.
- * @since 2.0
- */
- private RetargetTextEditorAction fFindNext;
- /**
- * The find previous action.
- * @since 2.0
- */
- private RetargetTextEditorAction fFindPrevious;
- /**
- * The incremental find action.
- * @since 2.0
- */
- private RetargetTextEditorAction fIncrementalFind;
- /**
- * The reverse incremental find action.
- * @since 2.1
- */
- private RetargetTextEditorAction fIncrementalFindReverse;
- /**
- * The go to line action.
- */
- private RetargetTextEditorAction fGotoLine;
- /**
- * The map of status fields.
- * @since 2.0
- */
- private Map fStatusFields;
-
-
- /**
- * Creates an empty editor action bar contributor. The action bars are
- * furnished later via the <code>init</code> method.
- *
- * @see org.eclipse.ui.IEditorActionBarContributor#init(org.eclipse.ui.IActionBars, org.eclipse.ui.IWorkbenchPage)
- */
- public BasicTextEditorActionContributor() {
-
- fFindNext= new RetargetTextEditorAction(EditorMessages.getResourceBundle(), "Editor.FindNext."); //$NON-NLS-1$
- fFindNext.setActionDefinitionId(ITextEditorActionDefinitionIds.FIND_NEXT);
- fFindPrevious= new RetargetTextEditorAction(EditorMessages.getResourceBundle(), "Editor.FindPrevious."); //$NON-NLS-1$
- fFindPrevious.setActionDefinitionId(ITextEditorActionDefinitionIds.FIND_PREVIOUS);
- fIncrementalFind= new RetargetTextEditorAction(EditorMessages.getResourceBundle(), "Editor.FindIncremental."); //$NON-NLS-1$
- fIncrementalFind.setActionDefinitionId(ITextEditorActionDefinitionIds.FIND_INCREMENTAL);
- fIncrementalFindReverse= new RetargetTextEditorAction(EditorMessages.getResourceBundle(), "Editor.FindIncrementalReverse."); //$NON-NLS-1$
- fIncrementalFindReverse.setActionDefinitionId(ITextEditorActionDefinitionIds.FIND_INCREMENTAL_REVERSE);
- fGotoLine= new RetargetTextEditorAction(EditorMessages.getResourceBundle(), "Editor.GotoLine."); //$NON-NLS-1$
- fGotoLine.setActionDefinitionId(ITextEditorActionDefinitionIds.LINE_GOTO);
-
- fStatusFields= new HashMap(3);
- for (int i= 0; i < STATUS_FIELD_DEFS.length; i++) {
- StatusFieldDef fieldDef= STATUS_FIELD_DEFS[i];
- fStatusFields.put(fieldDef, new StatusLineContributionItem(fieldDef.category, fieldDef.visible, fieldDef.widthInChars));
- }
- }
-
- /**
- * Returns the active editor part.
- *
- * @return the active editor part
- */
- protected final IEditorPart getActiveEditorPart() {
- return fActiveEditorPart;
- }
-
- /**
- * Returns the action registered with the given text editor.
- *
- * @param editor the editor, or <code>null</code>
- * @param actionId the action id
- * @return the action, or <code>null</code> if none
- */
- protected final IAction getAction(ITextEditor editor, String actionId) {
- return (editor == null || actionId == null ? null : editor.getAction(actionId));
- }
-
- /**
- * The method installs the global action handlers for the given text editor.
- * <p>
- * This method cannot be overridden by subclasses.</p>
- * @since 2.0
- */
- private void doSetActiveEditor(IEditorPart part) {
-
- if (fActiveEditorPart == part)
- return;
-
- if (fActiveEditorPart instanceof ITextEditorExtension) {
- ITextEditorExtension extension= (ITextEditorExtension) fActiveEditorPart;
- for (int i= 0; i < STATUS_FIELD_DEFS.length; i++)
- extension.setStatusField(null, STATUS_FIELD_DEFS[i].category);
- }
-
- fActiveEditorPart= part;
- ITextEditor editor= (part instanceof ITextEditor) ? (ITextEditor) part : null;
-
- IActionBars actionBars= getActionBars();
- if (actionBars != null) {
- for (int i= 0; i < ACTIONS.length; i++)
- actionBars.setGlobalActionHandler(ACTIONS[i], getAction(editor, ACTIONS[i]));
- }
-
- fFindNext.setAction(getAction(editor, ITextEditorActionConstants.FIND_NEXT));
- fFindPrevious.setAction(getAction(editor, ITextEditorActionConstants.FIND_PREVIOUS));
- fIncrementalFind.setAction(getAction(editor, ITextEditorActionConstants.FIND_INCREMENTAL));
- fIncrementalFindReverse.setAction(getAction(editor, ITextEditorActionConstants.FIND_INCREMENTAL_REVERSE));
- fGotoLine.setAction(getAction(editor, ITextEditorActionConstants.GOTO_LINE));
-
- for (int i= 0; i < STATUS_FIELD_DEFS.length; i++) {
- if (fActiveEditorPart instanceof ITextEditorExtension) {
- StatusLineContributionItem statusField= (StatusLineContributionItem) fStatusFields.get(STATUS_FIELD_DEFS[i]);
- statusField.setActionHandler(getAction(editor, STATUS_FIELD_DEFS[i].actionId));
- ITextEditorExtension extension= (ITextEditorExtension) fActiveEditorPart;
- extension.setStatusField(statusField, STATUS_FIELD_DEFS[i].category);
- }
- }
- }
-
- /**
- * The <code>BasicTextEditorActionContributor</code> implementation of this
- * <code>IEditorActionBarContributor</code> method installs the global
- * action handler for the given text editor by calling a private helper
- * method.
- * <p>
- * Subclasses may extend.</p>
- */
- public void setActiveEditor(IEditorPart part) {
- doSetActiveEditor(part);
- }
-
- /*
- * @see EditorActionBarContributor#contributeToMenu(IMenuManager)
- */
- public void contributeToMenu(IMenuManager menu) {
-
- IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
- if (editMenu != null) {
- editMenu.appendToGroup(IWorkbenchActionConstants.FIND_EXT, fFindNext);
- editMenu.appendToGroup(IWorkbenchActionConstants.FIND_EXT, fFindPrevious);
- editMenu.appendToGroup(IWorkbenchActionConstants.FIND_EXT, fIncrementalFind);
- editMenu.appendToGroup(IWorkbenchActionConstants.FIND_EXT, fIncrementalFindReverse);
- }
-
- IMenuManager navigateMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
- if (navigateMenu != null) {
- navigateMenu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fGotoLine);
- }
- }
-
- /*
- * @see EditorActionBarContributor#contributeToStatusLine(org.eclipse.jface.action.IStatusLineManager)
- * @since 2.0
- */
- public void contributeToStatusLine(IStatusLineManager statusLineManager) {
- super.contributeToStatusLine(statusLineManager);
- for (int i= 0; i < STATUS_FIELD_DEFS.length; i++)
- statusLineManager.add((IContributionItem)fStatusFields.get(STATUS_FIELD_DEFS[i]));
- }
-
- /*
- * @see org.eclipse.ui.IEditorActionBarContributor#dispose()
- * @since 2.0
- */
- public void dispose() {
- doSetActiveEditor(null);
- super.dispose();
- }
-
-
-// /* (non-Javadoc)
-// * @see org.eclipse.ui.IEditorActionBarContributor#init(org.eclipse.ui.IActionBars, org.eclipse.ui.IWorkbenchPage)
-// */
-// public void init(IActionBars bars, IWorkbenchPage page) {
-//
-// if (page != null) {
-// IWorkbenchWindow window= page.getWorkbenchWindow();
-// if (window instanceof WorkbenchWindow) {
-// WorkbenchWindow wWindow= (WorkbenchWindow) window;
-// WWinKeyBindingService service= wWindow.getKeyBindingService();
-// if (service != null) {
-// service.registerGlobalAction(fFindNext);
-// service.registerGlobalAction(fFindPrevious);
-// service.registerGlobalAction(fIncrementalFind);
-// service.registerGlobalAction(fIncrementalFindReverse);
-// service.registerGlobalAction(fGotoLine);
-// }
-// }
-// }
-// super.init(bars, page);
-// }
-
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/CaseAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/CaseAction.java
deleted file mode 100644
index eeca8d873a4..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/CaseAction.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.texteditor;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Point;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.ISourceViewer;
-
-/**
- * Action that converts the current selection to lower case.
- * @since 3.0
- */
-public class CaseAction extends ResourceAction implements IUpdate {
-
- /** The editor we are working on. */
- private AbstractTextEditor fEditor;
-
- /** <code>true</code> if this action converts to upper case, <code>false</code> otherwise. */
- private boolean fToUpper;
-
- /**
- * Creates and initializes the action for the given text editor.
- * The action configures its visual representation from the given resource
- * bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or <code>null</code> if none
- * @param editor the text editor
- * @param toUpper <code>true</code> if this is an uppercase action, <code>false</code> otherwise.
- *
- * @see ResourceAction#ResourceAction
- */
- public CaseAction(ResourceBundle bundle, String prefix, AbstractTextEditor editor, boolean toUpper) {
- super(bundle, prefix);
- fEditor= editor;
- fToUpper= toUpper;
- update();
- }
-
- /*
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- if (fEditor == null)
- return;
-
- if (!isEnabled())
- return;
-
- ISourceViewer viewer= fEditor.getSourceViewer();
- if (viewer == null)
- return;
-
- IDocument document= viewer.getDocument();
- if (document == null)
- return;
-
- StyledText st= viewer.getTextWidget();
- if (st == null)
- return;
-
- Point sel= viewer.getSelectedRange();
- if (sel == null)
- return;
-
- try {
- // if the selection is emtpy, we select the word / string using the viewer's
- // doubleclick strategy
- if (sel.y == 0) {
-
- // TODO find a better way to do this although there are multiple partitionings on a single document
-
-// String partition= getContentType(viewer, document, sel.x);
-// SourceViewerConfiguration svc= fEditor.getSourceViewerConfiguration(); // never null when viewer instantiated
-// ITextDoubleClickStrategy dcs= svc.getDoubleClickStrategy(viewer, partition);
-// if (dcs != null) {
-// dcs.doubleClicked(viewer);
-// sel= viewer.getSelectedRange();
-// }
-
- if (sel.y == 0)
- return; // if the selection is still empty, we're done
- }
-
- String target= document.get(sel.x, sel.y);
- String replacement= (fToUpper ? target.toUpperCase() : target.toLowerCase());
- if (!target.equals(replacement)) {
- document.replace(sel.x, target.length(), replacement);
- }
- } catch (BadLocationException x) {
- // ignore and return
- return;
- }
-
- // reinstall selection and move it into view
- viewer.setSelectedRange(sel.x, sel.y);
- // don't use the viewer's reveal feature in order to avoid jumping around
- st.showSelection();
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- boolean enabled= true;
- if (fEditor != null) {
- if (fEditor.isEditorInputReadOnly()) {
- enabled= false;
- }
- } else {
- enabled= false;
- }
- setEnabled(enabled);
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ComboContentAssistSubjectAdapter.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ComboContentAssistSubjectAdapter.java
deleted file mode 100644
index 4dd9bf048a1..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ComboContentAssistSubjectAdapter.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.texteditor;
-
-import java.util.HashMap;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IEventConsumer;
-import org.eclipse.jface.text.contentassist.IContentAssistSubject;
-
-/**
- * Adapts a <code>Combo</code> to an <code>IContentAssistSubject</code>.
- *
- * @see org.eclipse.swt.widgets.Combo
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject
- * @since 3.0
- */
-final class ComboContentAssistSubjectAdapter implements IContentAssistSubject {
-
- private class InternalDocument extends Document {
-
- private ModifyListener fModifyListener;
-
- private InternalDocument() {
- super(fCombo.getText());
- fModifyListener= new ModifyListener() {
- /*
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- set(fCombo.getText());
- }
- };
- fCombo.addModifyListener(fModifyListener);
- }
-
- /*
- * @see org.eclipse.jface.text.AbstractDocument#replace(int, int, java.lang.String)
- */
- public void replace(int pos, int length, String text) throws BadLocationException {
- super.replace(pos, length, text);
- fCombo.removeModifyListener(fModifyListener);
- fCombo.setText(get());
- fCombo.addModifyListener(fModifyListener);
- }
- }
-
- /**
- * The combo.
- */
- private Combo fCombo;
- private HashMap fModifyListeners;
-
-
- /**
- * Creates a content assist subject adapter for the given combo.
- *
- * @param combo the combo to adapt
- */
- public ComboContentAssistSubjectAdapter(Combo combo) {
- Assert.isNotNull(combo);
- fCombo= combo;
- fModifyListeners= new HashMap();
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#getControl()
- */
- public Control getControl() {
- return fCombo;
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#getLineHeight()
- */
- public int getLineHeight() {
- return fCombo.getTextHeight();
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#getCaretOffset()
- */
- public int getCaretOffset() {
- return fCombo.getSelection().y;
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#getLocationAtOffset(int)
- */
- public Point getLocationAtOffset(int offset) {
- String comboString= fCombo.getText();
- GC gc = new GC(fCombo);
- gc.setFont(fCombo.getFont());
- Point extent= gc.textExtent(comboString.substring(0, Math.min(offset, comboString.length())));
- int spaceWidth= gc.textExtent(" ").x; //$NON-NLS-1$
- gc.dispose();
- /*
- * FIXME: the two space widths below is a workaround for bug 44072
- */
- int x= 2 * spaceWidth + fCombo.getClientArea().x + fCombo.getBorderWidth() + extent.x;
- return new Point(x, fCombo.getLocation().y);
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#getLineDelimiter()
- */
- public String getLineDelimiter() {
- return System.getProperty("line.separator"); //$NON-NLS-1$
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#addKeyListener(org.eclipse.swt.events.KeyListener)
- */
- public void addKeyListener(KeyListener keyListener) {
- fCombo.addKeyListener(keyListener);
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#getSelectionRange()
- */
- public Point getWidgetSelectionRange() {
- return new Point(fCombo.getSelection().x, Math.abs(fCombo.getSelection().y - fCombo.getSelection().x));
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#getSelectedRange()
- */
- public Point getSelectedRange() {
- return new Point(fCombo.getSelection().x, Math.abs(fCombo.getSelection().y - fCombo.getSelection().x));
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#getDocument()
- */
- public IDocument getDocument() {
- IDocument document= (IDocument)fCombo.getData("document"); //$NON-NLS-1$
- if (document == null) {
- document= new InternalDocument() ;
- fCombo.setData("document", document); //$NON-NLS-1$
- }
- return document;
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#canAddVerifyKeyListener()
- */
- public boolean supportsVerifyKeyListener() {
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#appendVerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener)
- */
- public boolean appendVerifyKeyListener(final VerifyKeyListener verifyKeyListener) {
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#prependVerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener)
- */
- public boolean prependVerifyKeyListener(final VerifyKeyListener verifyKeyListener) {
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#removeVerifyKeyListener(org.eclipse.swt.custom.VerifyKeyListener)
- */
- public void removeVerifyKeyListener(VerifyKeyListener verifyKeyListener) {
-// if (fVerifyKeyListeners.containsKey(verifyKeyListener)) {
-// fCombo.removeListener(SWT.KeyUp, (Listener)fVerifyKeyListeners.get(verifyKeyListener));
-// }
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#setEventConsumer(org.eclipse.jface.text.IEventConsumer)
- */
- public void setEventConsumer(IEventConsumer eventConsumer) {
- // this is not supported
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#setSelectedRange(int, int)
- */
- public void setSelectedRange(int i, int j) {
- fCombo.setSelection(new Point(i, i+j));
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#revealRange(int, int)
- */
- public void revealRange(int i, int j) {
- // XXX: this should be improved
- fCombo.setSelection(new Point(i, i+j));
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#removeKeyListener(org.eclipse.swt.events.KeyListener)
- */
- public void removeKeyListener(KeyListener keyListener) {
- fCombo.removeKeyListener(keyListener);
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#removeSelectionListener(org.eclipse.swt.events.SelectionListener)
- */
- public void removeSelectionListener(SelectionListener selectionListener) {
- fCombo.removeSelectionListener(selectionListener);
- Object listener= fModifyListeners.get(selectionListener);
- if (listener instanceof Listener)
- fCombo.removeListener(SWT.Modify, (Listener)listener);
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistSubject#addSelectionListener(org.eclipse.swt.events.SelectionListener)
- */
- public boolean addSelectionListener(final SelectionListener selectionListener) {
- fCombo.addSelectionListener(selectionListener);
- Listener listener= new Listener() {
- /*
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- public void handleEvent(Event e) {
- selectionListener.widgetSelected(new SelectionEvent(e));
-
- }
- };
- fCombo.addListener(SWT.Modify, listener);
- fModifyListeners.put(selectionListener, listener);
- return true;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ContentAssistAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ContentAssistAction.java
deleted file mode 100644
index 814e86815e7..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ContentAssistAction.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.ui.texteditor;
-
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextOperationTargetExtension;
-import org.eclipse.jface.text.source.ISourceViewer;
-
-import org.eclipse.ui.IWorkbenchPartSite;
-
-
-/**
- * A content assist action which gets its target from its text editor.
- * <p>
- * The action is initially associated with a text editor via the constructor,
- * but can subsequently be changed using <code>setEditor</code>.</p>
- * <p>
- * If this class is used as is, it works by asking the text editor for its text operation target
- * (using <code>getAdapter(ITextOperationTarget.class)</code> and runs the content assist
- * operation on this target.
- * </p>
- * @since 2.0
- */
-public final class ContentAssistAction extends TextEditorAction {
-
- /** The text operation target */
- private ITextOperationTarget fOperationTarget;
-
- /**
- * Creates and initializes the action for the given text editor.
- * The action configures its visual representation from the given resource
- * bundle. The action works by asking the text editor at the time for its
- * text operation target adapter (using
- * <code>getAdapter(ITextOperationTarget.class)</code>. The action runs the
- * content assist operation on this target.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param editor the text editor
- * @see ResourceAction#ResourceAction
- */
- public ContentAssistAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
- super(bundle, prefix, editor);
- }
-
- /**
- * Runs the content assist operation on the editor's text operation target.
- */
- public void run() {
- if (fOperationTarget != null) {
-
- ITextEditor editor= getTextEditor();
- if (editor != null && validateEditorInputState()) {
-
- Display display= null;
-
- IWorkbenchPartSite site= editor.getSite();
- Shell shell= site.getShell();
- if (shell != null && !shell.isDisposed())
- display= shell.getDisplay();
-
- BusyIndicator.showWhile(display, new Runnable() {
- public void run() {
- fOperationTarget.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
- }
- });
- }
- }
- }
-
- /**
- * The <code>ContentAssistAction</code> implementation of this
- * <code>IUpdate</code> method discovers the operation through the current
- * editor's <code>ITextOperationTarget</code> adapter, and sets the
- * enabled state accordingly.
- */
- public void update() {
-
- ITextEditor editor= getTextEditor();
-
- if (fOperationTarget == null && editor!= null)
- fOperationTarget= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
-
- if (fOperationTarget == null) {
- setEnabled(false);
- return;
- }
-
- if (fOperationTarget instanceof ITextOperationTargetExtension) {
- ITextOperationTargetExtension targetExtension= (ITextOperationTargetExtension) fOperationTarget;
- targetExtension.enableOperation(ISourceViewer.CONTENTASSIST_PROPOSALS, canModifyEditor());
- }
-
- setEnabled(fOperationTarget.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS));
- }
-
- /**
- * @see TextEditorAction#setEditor(ITextEditor)
- */
- public void setEditor(ITextEditor editor) {
- super.setEditor(editor);
- fOperationTarget= null;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConvertLineDelimitersAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConvertLineDelimitersAction.java
deleted file mode 100644
index a56522d2b57..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConvertLineDelimitersAction.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.texteditor;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentExtension;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.IRewriteTarget;
-import org.eclipse.jface.text.TextUtilities;
-
-
-/**
- * An action to convert line delimiters of a text editor document to a particular line
- * delimiter.
- * @since 2.0
- */
-public class ConvertLineDelimitersAction extends TextEditorAction {
-
- /** The target line delimiter. */
- private final String fLineDelimiter;
-
- /**
- * Creates a line delimiter conversion action.
- *
- * @param editor the editor
- * @param lineDelimiter the target line delimiter to convert the editor's document to
- */
- public ConvertLineDelimitersAction(ITextEditor editor, String lineDelimiter) {
- this(EditorMessages.getResourceBundle(), "dummy", editor, lineDelimiter); //$NON-NLS-1$
- }
-
- /**
- * Creates a line delimiter conversion action.
- *
- * @param bundle the resource bundle
- * @param prefix the prefix for the resource bundle lookup
- * @param editor the editor
- * @param lineDelimiter the target line delimiter to convert the editor's document to
- */
- public ConvertLineDelimitersAction(ResourceBundle bundle, String prefix, ITextEditor editor, String lineDelimiter) {
- super(bundle, prefix, editor);
- fLineDelimiter= lineDelimiter;
-
- String platformLineDelimiter= System.getProperty("line.separator"); //$NON-NLS-1$
- setText(EditorMessages.getString(getLabelKey(fLineDelimiter, platformLineDelimiter)));
-
- update();
- }
-
- /*
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
-
- try {
-
- ITextEditor editor= getTextEditor();
- if (editor == null)
- return;
-
- if (!validateEditorInputState())
- return;
-
- Object adapter= editor.getAdapter(IRewriteTarget.class);
- if (adapter instanceof IRewriteTarget) {
-
- IRewriteTarget target= (IRewriteTarget) adapter;
- IDocument document= target.getDocument();
- if (document != null) {
- Shell shell= getTextEditor().getSite().getShell();
- ConvertRunnable runnable= new ConvertRunnable(target, fLineDelimiter);
-
- if (document.getNumberOfLines() < 40) {
- BusyIndicator.showWhile(shell.getDisplay(), runnable);
-
- } else {
- ProgressMonitorDialog dialog= new ProgressMonitorDialog(shell);
- dialog.run(false, true, runnable);
- }
- }
- }
-
- } catch (InterruptedException e) {
- // action cancelled
-
- } catch (InvocationTargetException e) {
- // should not happen
- }
- }
-
- /**
- * A runnable that converts all line delimiters of a document to <code>lineDelimiter</code>.
- */
- private static class ConvertRunnable implements IRunnableWithProgress, Runnable {
-
- /** The rewrite target */
- private final IRewriteTarget fRewriteTarget;
- /** The line delimiter to which to convert to */
- private final String fLineDelimiter;
-
- /**
- * Returns a new runnable for converting all line delimiters in
- * the <code>rewriteTarget</code> to <code>lineDelimter</code>.
- * @param rewriteTarget
- * @param lineDelimiter
- */
- public ConvertRunnable(IRewriteTarget rewriteTarget, String lineDelimiter) {
- fRewriteTarget= rewriteTarget;
- fLineDelimiter= lineDelimiter;
- }
-
- /*
- * @see IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-
- IDocument document= fRewriteTarget.getDocument();
- final int lineCount= document.getNumberOfLines();
- monitor.beginTask(EditorMessages.getString("Editor.ConvertLineDelimiter.title"), lineCount); //$NON-NLS-1$
-
- fRewriteTarget.setRedraw(false);
- fRewriteTarget.beginCompoundChange();
-
- if (document instanceof IDocumentExtension)
- ((IDocumentExtension) document).startSequentialRewrite(true);
-
- Map partitioners= TextUtilities.removeDocumentPartitioners(document);
-
- try {
- for (int i= 0; i < lineCount; i++) {
- if (monitor.isCanceled())
- throw new InterruptedException();
-
- final String delimiter= document.getLineDelimiter(i);
- if (delimiter != null && delimiter.length() > 0 && !delimiter.equals(fLineDelimiter)) {
- IRegion region= document.getLineInformation(i);
- document.replace(region.getOffset() + region.getLength(), delimiter.length(), fLineDelimiter);
- }
-
- monitor.worked(1);
- }
-
- } catch (BadLocationException e) {
- throw new InvocationTargetException(e);
-
- } finally {
-
- if (partitioners != null)
- TextUtilities.addDocumentPartitioners(document, partitioners);
-
- if (document instanceof IDocumentExtension)
- ((IDocumentExtension) document).stopSequentialRewrite();
-
- fRewriteTarget.endCompoundChange();
- fRewriteTarget.setRedraw(true);
-
- monitor.done();
- }
- }
-
- /*
- * @see Runnable#run()
- */
- public void run() {
- try {
- run(new NullProgressMonitor());
-
- } catch (InterruptedException e) {
- // should not happen
-
- } catch (InvocationTargetException e) {
- // should not happen
- }
- }
- }
-
-// /**
-// * Returns whether the given document uses only the given line delimiter.
-// * @param document the document to check
-// * @param lineDelimiter the line delimiter to check for
-// */
-// private static boolean usesLineDelimiterExclusively(IDocument document, String lineDelimiter) {
-//
-// try {
-// final int lineCount= document.getNumberOfLines();
-// for (int i= 0; i < lineCount; i++) {
-// final String delimiter= document.getLineDelimiter(i);
-// if (delimiter != null && delimiter.length() > 0 && !delimiter.equals(lineDelimiter))
-// return false;
-// }
-//
-// } catch (BadLocationException e) {
-// return false;
-// }
-//
-// return true;
-// }
-
- /**
- * Computes and returns the key to be used to lookup the action's label in
- * its resource bundle.
- *
- * @param lineDelimiter the line delimiter
- * @param platformLineDelimiter the platform line delimiter
- */
- private static String getLabelKey(String lineDelimiter, String platformLineDelimiter) {
- if (lineDelimiter.equals(platformLineDelimiter)) {
-
- if (lineDelimiter.equals("\r\n")) //$NON-NLS-1$
- return "Editor.ConvertLineDelimiter.toWindows.default.label"; //$NON-NLS-1$
-
- if (lineDelimiter.equals("\n")) //$NON-NLS-1$
- return "Editor.ConvertLineDelimiter.toUNIX.default.label"; //$NON-NLS-1$
-
- if (lineDelimiter.equals("\r")) //$NON-NLS-1$
- return "Editor.ConvertLineDelimiter.toMac.default.label"; //$NON-NLS-1$
-
- } else {
-
- if (lineDelimiter.equals("\r\n")) //$NON-NLS-1$
- return "Editor.ConvertLineDelimiter.toWindows.label"; //$NON-NLS-1$
-
- if (lineDelimiter.equals("\n")) //$NON-NLS-1$
- return "Editor.ConvertLineDelimiter.toUNIX.label"; //$NON-NLS-1$
-
- if (lineDelimiter.equals("\r")) //$NON-NLS-1$
- return "Editor.ConvertLineDelimiter.toMac.label"; //$NON-NLS-1$
- }
-
- return null;
- }
-
- /**
- * Internally sets the enable state of this action.
- */
- private boolean doEnable() {
- return canModifyEditor();
- }
-
- /*
- * @see IUpdate#update()
- */
- public void update() {
- super.update();
- setEnabled(doEnable());
- }
-
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java
deleted file mode 100644
index a7f261164fa..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.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.ui.texteditor;
-
-
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationPresentation;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.PaletteData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-
-/**
- * Specialized annotation to indicate a particular range of text lines.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * This class is instantiated automatically by <code>AbstractTextEditor</code>.
- * </p>
- */
-public class DefaultRangeIndicator extends Annotation implements IAnnotationPresentation {
-
- /** The color palette data of this range indicator */
- private static PaletteData fgPaletteData;
- /** The image of this range indicator */
- private Image fImage;
-
- /**
- * Creates a new range indicator.
- */
- public DefaultRangeIndicator() {
- super();
- setLayer(0);
- }
-
- /*
- * @see Annotation#paint(GC, Canvas, Rectangle)
- */
- public void paint(GC gc, Canvas canvas, Rectangle bounds) {
-
- Point canvasSize= canvas.getSize();
-
- int x= 0;
- int y= bounds.y;
- int w= canvasSize.x;
- int h= bounds.height;
- int b= 1;
-
- if (y + h > canvasSize.y)
- h= canvasSize.y - y;
-
- if (y < 0) {
- h= h + y;
- y= 0;
- }
-
- if (h <= 0)
- return;
-
- Image image = getImage(canvas);
- gc.drawImage(image, 0, 0, w, h, x, y, w, h);
-
- gc.setBackground(canvas.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
- gc.fillRectangle(x, bounds.y, w, b);
- gc.fillRectangle(x, bounds.y + bounds.height - b, w, b);
- }
-
- /**
- * Returns the image of this range indicator.
- *
- * @param the control
- * @return an image
- */
- private Image getImage(Control control) {
- if (fImage == null) {
- fImage= createImage(control.getDisplay(), control.getSize());
-
- control.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fImage != null && !fImage.isDisposed()) {
- fImage.dispose();
- fImage= null;
- }
- }
- });
- } else {
- Rectangle imageRectangle= fImage.getBounds();
- Point controlSize= control.getSize();
-
- if (imageRectangle.width < controlSize.x || imageRectangle.height < controlSize.y) {
- fImage.dispose();
- fImage= createImage(control.getDisplay(), controlSize);
- }
- }
-
- return fImage;
- }
-
- /**
- * Creates and returns a new SWT image with the given size on
- * the given display which is used as this range indicator's image.
- *
- * @param display the display on which to create the image
- * @return a new image
- */
- private static Image createImage(Display display, Point size) {
-
- int width= size.x;
- int height= size.y;
-
- if (fgPaletteData == null)
- fgPaletteData= createPalette(display);
-
- ImageData imageData= new ImageData(width, height, 1, fgPaletteData);
-
- for (int y= 0; y < height; y++)
- for (int x= 0; x < width; x++)
- imageData.setPixel(x, y, (x + y) % 2);
-
- return new Image(display, imageData);
- }
-
- /**
- * Creates and returns a new color palette data.
- *
- * @param display
- * @return the new color palette data
- */
- private static PaletteData createPalette(Display display) {
- Color c1;
- Color c2;
-
- if (false) {
- // range lighter
- c1= display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
- c2= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
- } else {
- // range darker
- c1= display.getSystemColor(SWT.COLOR_LIST_SELECTION);
- c2= display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
- }
-
- RGB rgbs[]= new RGB[] {
- new RGB(c1.getRed(), c1.getGreen(), c1.getBlue()),
- new RGB(c2.getRed(), c2.getGreen(), c2.getBlue())};
-
- return new PaletteData(rgbs);
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DeleteLineAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DeleteLineAction.java
deleted file mode 100644
index e595a992127..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DeleteLineAction.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.ui.texteditor;
-
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-/**
- * An action to delete a whole line, the fraction of the line that is left from the cursor
- * or the fraction that is right from the cursor.
- * @since 2.0
- */
-public class DeleteLineAction extends TextEditorAction {
-
- /**
- * Delete the whole line.
- */
- public static final int WHOLE= 0;
- /**
- * Delete to the beginning of line.
- */
- public static final int TO_BEGINNING= 1;
- /**
- * Delete to the end of line.
- */
- public static final int TO_END= 2;
-
- /**
- * The type of deletion.
- */
- private final int fType;
- /**
- * Should the deleted line be copied to the clipboard.
- * @since 2.1
- */
- private final boolean fCopyToClipboard;
- /** The deletion target.
- * @since 2.1
- */
- private DeleteLineTarget fTarget;
-
- /**
- * Creates a line delimiter conversion action.
- *
- * @param editor the editor
- * @param type the line deletion type, must be one of
- * <code>WHOLE_LINE</code>, <code>TO_BEGINNING</code> or <code>TO_END</code>
- */
- public DeleteLineAction(ResourceBundle bundle, String prefix, ITextEditor editor, int type) {
- this(bundle, prefix, editor, type, true);
- }
-
- /**
- * Creates a line deletion action.
- *
- * @param editor the editor
- * @param type the line deletion type, must be one of
- * <code>WHOLE_LINE</code>, <code>TO_BEGINNING</code> or <code>TO_END</code>
- * @since 2.1
- */
- public DeleteLineAction(ResourceBundle bundle, String prefix, ITextEditor editor, int type, boolean copyToClipboard) {
- super(bundle, prefix, editor);
- fType= type;
- fCopyToClipboard= copyToClipboard;
- update();
- }
-
- /**
- * Returns the editor's document.
- *
- * @param editor the editor
- * @return the editor's document
- */
- private static IDocument getDocument(ITextEditor editor) {
-
- IDocumentProvider documentProvider= editor.getDocumentProvider();
- if (documentProvider == null)
- return null;
-
- IDocument document= documentProvider.getDocument(editor.getEditorInput());
- if (document == null)
- return null;
-
- return document;
- }
-
- /**
- * Returns the editor's selection.
- *
- * @param editor the editor
- * @return the editor's selection
- */
- private static ITextSelection getSelection(ITextEditor editor) {
-
- ISelectionProvider selectionProvider= editor.getSelectionProvider();
- if (selectionProvider == null)
- return null;
-
- ISelection selection= selectionProvider.getSelection();
- if (!(selection instanceof ITextSelection))
- return null;
-
- return (ITextSelection) selection;
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
-
- if (fTarget == null)
- return;
-
- ITextEditor editor= getTextEditor();
- if (editor == null)
- return;
-
- if (!validateEditorInputState())
- return;
-
- IDocument document= getDocument(editor);
- if (document == null)
- return;
-
- ITextSelection selection= getSelection(editor);
- if (selection == null)
- return;
-
- try {
- fTarget.deleteLine(document, selection.getOffset(), fType, fCopyToClipboard);
- } catch (BadLocationException e) {
- // should not happen
- }
- }
-
- /*
- * @see IUpdate#update()
- */
- public void update() {
-
- super.update();
- if (!isEnabled())
- return;
-
- if (!canModifyEditor()) {
- setEnabled(false);
- return;
- }
-
- ITextEditor editor= getTextEditor();
- if (editor != null)
- fTarget= (DeleteLineTarget) editor.getAdapter(DeleteLineTarget.class);
- else
- fTarget= null;
-
- setEnabled(fTarget != null);
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DeleteLineTarget.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DeleteLineTarget.java
deleted file mode 100644
index 2ba269ad690..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DeleteLineTarget.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.texteditor;
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextListener;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextEvent;
-
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-
-
-/**
- * A delete line target.
- * @since 2.1
- */
-class DeleteLineTarget {
-
- /**
- * A clipboard which concatenates subsequent delete line actions.
- */
- private class DeleteLineClipboard implements MouseListener, ModifyListener, ISelectionChangedListener, ITextListener, FocusListener {
-
- /** The text viewer. */
- private final ITextViewer fViewer;
- /*
- * This is a hack to stop a string of deletions when the user moves
- * the caret. This kludge is necessary since:
- * 1) Moving the caret does not fire a selection event
- * 2) There is no support in StyledText for a CaretListener
- * 3) The AcceleratorScope and KeybindingService classes are internal
- *
- * This kludge works by comparing the offset of the caret to the offset
- * recorded the last time the action was run. If they differ, we do not
- * continue the session.
- *
- * @see #saveState
- * @see #checkState
- */
- /** The last known offset of the caret */
- private int fIndex= -1;
- /** The clip board. */
- private Clipboard fClipboard;
- /** A string buffer. */
- private final StringBuffer fBuffer= new StringBuffer();
- /** The delete flag indicates if a deletion is in progress. */
- private boolean fDeleting;
-
- /**
- * Creates the text viewer.
- */
- public DeleteLineClipboard(ITextViewer viewer) {
- Assert.isNotNull(viewer);
- fViewer= viewer;
- }
-
- /**
- * Returns the text viewer.
- */
- public ITextViewer getViewer() {
- return fViewer;
- }
-
- /**
- * Saves the current state, to be compared later using
- * <code>checkState</code>.
- */
- private void saveState() {
- fIndex= fViewer.getTextWidget().getCaretOffset();
- }
-
- /**
- * Checks that the state has not changed since it was saved.
- *
- * @return returns <code>true</code> if the current state is the same as
- * when it was last saved.
- */
- private boolean hasSameState() {
- return fIndex == fViewer.getTextWidget().getCaretOffset();
- }
-
- /**
- * Checks the state of the clipboard.
- */
- public void checkState() {
-
- if (fClipboard == null) {
- StyledText text= fViewer.getTextWidget();
- if (text == null)
- return;
-
- fViewer.getSelectionProvider().addSelectionChangedListener(this);
- text.addFocusListener(this);
- text.addMouseListener(this);
- text.addModifyListener(this);
-
- fClipboard= new Clipboard(text.getDisplay());
- fBuffer.setLength(0);
-
- } else if (!hasSameState()) {
- fBuffer.setLength(0);
- }
- }
-
- /**
- * Appends the given string to this clipboard.
- *
- * @param deltaString the string to append
- */
- public void append(String deltaString) {
- fBuffer.append(deltaString);
- String string= fBuffer.toString();
- Transfer[] dataTypes= new Transfer[] { TextTransfer.getInstance() };
- Object[] data= new Object[] { string };
- fClipboard.setContents(data, dataTypes);
- }
-
- /**
- * Uninstalls this action.
- */
- private void uninstall() {
-
- if (fClipboard == null)
- return;
-
- StyledText text= fViewer.getTextWidget();
- if (text == null)
- return;
-
- fViewer.getSelectionProvider().removeSelectionChangedListener(this);
- text.removeFocusListener(this);
- text.removeMouseListener(this);
- text.removeModifyListener(this);
-
- fClipboard.dispose();
- fClipboard= null;
- }
-
- /**
- * Mark whether a deletion is in progress.
- *
- * @param deleting <code>true</code> if a deletion is in progress
- */
- public void setDeleting(boolean deleting) {
- fDeleting= deleting;
- }
-
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- uninstall();
- }
-
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseDown(MouseEvent)
- */
- public void mouseDown(MouseEvent e) {
- uninstall();
- }
-
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseUp(MouseEvent)
- */
- public void mouseUp(MouseEvent e) {
- uninstall();
- }
-
- /*
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- uninstall();
- }
-
- /*
- * @see org.eclipse.swt.events.FocusListener#focusGained(FocusEvent)
- */
- public void focusGained(FocusEvent e) {
- uninstall();
- }
-
- /*
- * @see org.eclipse.swt.events.FocusListener#focusLost(FocusEvent)
- */
- public void focusLost(FocusEvent e) {
- uninstall();
- }
-
- /*
- * @see org.eclipse.jface.text.ITextListener#textChanged(TextEvent)
- */
- public void textChanged(TextEvent event) {
- uninstall();
- }
-
- /*
- * @see org.eclipse.swt.events.ModifyListener#modifyText(ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- if (!fDeleting)
- uninstall();
- }
- }
-
- /**
- * The clipboard manager.
- */
- private final DeleteLineClipboard fClipboard;
-
- /**
- * Constructor for DeleteLineTarget.
- */
- public DeleteLineTarget(ITextViewer viewer) {
- fClipboard= new DeleteLineClipboard(viewer);
- }
-
- /**
- * Returns the document's delete region specified by position and type.
- *
- * @param document the document
- * @param position the position
- * @param type the line deletion type, must be one of
- * <code>WHOLE_LINE</code>, <code>TO_BEGINNING</code> or <code>TO_END</code>
- * @return the document's delete region
- * @throws BadLocationException
- */
- private static IRegion getDeleteRegion(IDocument document, int position, int type) throws BadLocationException {
-
- int line= document.getLineOfOffset(position);
- int offset= 0;
- int length= 0;
-
- switch (type) {
- case DeleteLineAction.WHOLE:
- offset= document.getLineOffset(line);
- length= document.getLineLength(line);
- break;
-
- case DeleteLineAction.TO_BEGINNING:
- offset= document.getLineOffset(line);
- length= position - offset;
- break;
-
- case DeleteLineAction.TO_END:
- offset= position;
-
- IRegion lineRegion= document.getLineInformation(line);
- int end= lineRegion.getOffset() + lineRegion.getLength();
-
- if (position == end) {
- String lineDelimiter= document.getLineDelimiter(line);
- length= lineDelimiter == null ? 0 : lineDelimiter.length();
-
- } else {
- length= end - offset;
- }
- break;
-
- default:
- throw new IllegalArgumentException();
- }
-
- return new Region(offset, length);
- }
-
- /**
- * Deletes the specified fraction of the line of the given offset.
- *
- * @param document the document
- * @param position the offset
- * @param type the line deletion type, must be one of
- * <code>WHOLE_LINE</code>, <code>TO_BEGINNING</code> or <code>TO_END</code>
- * @param copyToClipboard <code>true</code> if the deleted line should be copied to the clipboard
- * @throws BadLocationException if position is not valid in the given document
- */
- public void deleteLine(IDocument document, int position, int type, boolean copyToClipboard) throws BadLocationException {
-
- IRegion deleteRegion= getDeleteRegion(document, position, type);
- int offset= deleteRegion.getOffset();
- int length= deleteRegion.getLength();
-
- if (length == 0)
- return;
-
- if (copyToClipboard) {
-
- fClipboard.checkState();
- fClipboard.append(document.get(offset, length));
-
- fClipboard.setDeleting(true);
- document.replace(offset, length, null);
- fClipboard.setDeleting(false);
-
- fClipboard.saveState();
-
- } else {
- document.replace(offset, length, null);
- }
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.java
deleted file mode 100644
index 88d934af725..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.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.texteditor;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-class EditorMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.texteditor.EditorMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private EditorMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.properties b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.properties
deleted file mode 100644
index 9051a9bba68..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorMessages.properties
+++ /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
-###############################################################################
-
-
-## Errors ##
-
-Editor.error.no_provider=Text editor does not have a document provider
-
-Editor.error.save.title=Save problems
-Editor.error.save.message=Save could not be completed.
-
-Editor.error.save.deleted.title=Cannot Save
-Editor.error.save.deleted.message=The file has been deleted.
-
-Editor.error.init= Editor could not be initialized.
-
-Editor.error.save.outofsync.title=Update conflict
-Editor.error.save.outofsync.message=The file has been changed on the file system. Do you want to overwrite the changes?
-
-Editor.error.activated.outofsync.title=File Changed
-Editor.error.activated.outofsync.message=The file has been changed on the file system. Do you want to load the changes?
-
-Editor.error.activated.deleted.save.title=File Deleted
-Editor.error.activated.deleted.save.message=The file has been deleted from the file system. Do you want to save your changes or close the editor without saving?
-Editor.error.activated.deleted.save.button.save=Save
-Editor.error.activated.deleted.save.button.close=Close
-Editor.error.activated.deleted.close.title=File Deleted
-Editor.error.activated.deleted.close.message=The file has been deleted from the file system. This editor will be closed.
-
-Editor.error.refresh.outofsync.title=Problems loading File
-Editor.error.refresh.outofsync.message=The file could not be loaded from the file system.
-
-Editor.error.revert.title=Problems while reverting to saved state
-Editor.error.revert.message=Could not revert to saved state.
-Editor.error.setinput.title=Problem while opening
-Editor.error.setinput.message=Cannot open input element:
-Editor.error.no_input=Unable to read text editor input
-Editor.error.invalid_input=Invalid text editor input
-
-Editor.error.validateEdit.title= Problems editing file
-Editor.error.validateEdit.message= The file cannot be edited.
-
-AbstractDocumentProvider.error.save.inuse=File is either open in another editor or in use by an operation.
-
-
-
-## Actions ##
-
-Editor.Undo.label=&Undo
-Editor.Undo.tooltip=Undo
-Editor.Undo.image=
-Editor.Undo.description=Undo
-
-Editor.Redo.label=&Redo
-Editor.Redo.tooltip=Redo
-Editor.Redo.image=
-Editor.Redo.description=Redo
-
-Editor.Cut.label=Cu&t
-Editor.Cut.tooltip=Cut
-Editor.Cut.image=
-Editor.Cut.description=Cut
-
-Editor.Copy.label=&Copy
-Editor.Copy.tooltip=Copy
-Editor.Copy.image=
-Editor.Copy.description=Copy
-
-Editor.Paste.label=&Paste
-Editor.Paste.tooltip=Paste
-Editor.Paste.image=
-Editor.Paste.description=Paste
-
-Editor.Delete.label=&Delete
-Editor.Delete.tooltip=Delete
-Editor.Delete.image=
-Editor.Delete.description=Delete
-
-Editor.Print.label=&Print
-Editor.Print.tooltip=Print
-Editor.Print.image=
-Editor.Print.description=Print
-
-Editor.SelectAll.label=Select &All
-Editor.SelectAll.tooltip=Select All
-Editor.SelectAll.image=
-Editor.SelectAll.description=Select All
-
-Editor.ShiftRight.label=Sh&ift Right
-Editor.ShiftRight.tooltip=Shift Right
-Editor.ShiftRight.image=
-Editor.ShiftRight.description=Shift Right
-
-Editor.ShiftLeft.label=S&hift Left
-Editor.ShiftLeft.tooltip=Shift Left
-Editor.ShiftLeft.image=
-Editor.ShiftLeft.description=Shift Left
-
-Editor.delete.line.submenu.label=D&elete Line
-
-Editor.DeleteLine.label=&Whole
-Editor.DeleteLine.tooltip=Delete Line
-Editor.DeleteLine.image=
-Editor.DeleteLine.description=Delete Line
-
-Editor.CutLine.label=&Whole
-Editor.CutLine.tooltip=Cut Line
-Editor.CutLine.image=
-Editor.CutLine.description=Cut Line
-
-Editor.DeleteLineToBeginning.label=To &Beginning
-Editor.DeleteLineToBeginning.tooltip=Delete Line to Beginning
-Editor.DeleteLineToBeginning.image=
-Editor.DeleteLineToBeginning.description=Delete Line to Beginning
-
-Editor.CutLineToBeginning.label=To &Beginning
-Editor.CutLineToBeginning.tooltip=Cut Line to Beginning
-Editor.CutLineToBeginning.image=
-Editor.CutLineToBeginning.description=Cut Line to Beginning
-
-Editor.DeleteLineToEnd.label=To &End
-Editor.DeleteLineToEnd.tooltip=Delete Line to End
-Editor.DeleteLineToEnd.image=
-Editor.DeleteLineToEnd.description=Delete Line to End
-
-Editor.CutLineToEnd.label=To &End
-Editor.CutLineToEnd.tooltip=Cut Line to End
-Editor.CutLineToEnd.image=
-Editor.CutLineToEnd.description=Cut Line to End
-
-Editor.mark.status.message.mark.set=Mark set
-Editor.mark.status.message.mark.cleared=Mark cleared
-Editor.mark.status.message.mark.swapped=Mark swapped
-Editor.mark.status.error.message.mark.not.set=Mark not set
-Editor.mark.status.error.message.mark.not.visible=Mark not in visible region
-
-Editor.mark.submenu.label=&Mark
-
-Editor.SetMark.label=&Set
-Editor.SetMark.tooltip=Set Mark
-Editor.SetMark=
-Editor.SetMark.description=Set Mark
-
-Editor.ClearMark.label=&Clear
-Editor.ClearMark.tooltip=Clear Mark
-Editor.ClearMark=
-Editor.ClearMark.description=Clear Mark
-
-Editor.SwapMark.label=S&wap
-Editor.SwapMark.tooltip=Swap Mark
-Editor.SwapMark=
-Editor.SwapMark.description=Swap Mark
-
-Editor.FindReplace.label=&Find/Replace...
-Editor.FindReplace.tooltip=Find/Replace
-Editor.FindReplace.image=
-Editor.FindReplace.description=Find/Replace
-
-Editor.FindNext.label=Find &Next
-Editor.FindNext.tooltip=Find Next
-Editor.FindNext.image=
-Editor.FindNext.description=Find Next
-
-Editor.FindPrevious.label=Find Pre&vious
-Editor.FindPrevious.tooltip=Find Previous
-Editor.FindPrevious.image=
-Editor.FindPrevious.description=Find Previous
-
-Editor.FindIncremental.label=&Incremental Find Next
-Editor.FindIncremental.tooltip=Incremental Find Next
-Editor.FindIncremental.image=
-Editor.FindIncremental.description=Incremental Find Next
-
-# Incremental Find Status field
-Editor.FindIncremental.name= Incremental Find
-Editor.FindIncremental.reverse.name= Reverse Incremental Find
-Editor.FindIncremental.not_found.pattern={0}{1} {2} not found
-Editor.FindIncremental.found.pattern={0}{1}: {2}
-Editor.FindIncremental.render.tab=<TAB>
-# The following two properties must end in a space
-Editor.FindIncremental.wrapped=Wrapped
-Editor.FindIncremental.reverse=Reverse
-
-Editor.FindIncrementalReverse.label=Incre&mental Find Previous
-Editor.FindIncrementalReverse.tooltip=Incremental Find Previous
-Editor.FindIncrementalReverse.image=
-Editor.FindIncrementalReverse.description=Incremental Find Previous
-
-Editor.Save.label=&Save
-Editor.Save.tooltip=Save
-Editor.Save.image=
-Editor.Save.description=Save
-
-Editor.Revert.label=Re&vert File
-Editor.Revert.tooltip=Revert File to Saved Version
-Editor.Revert.image=
-Editor.Revert.description=Reverts file contents to version on disk
-
-Editor.GotoLine.label=&Go to Line...
-Editor.GotoLine.tooltip=Go to Line
-Editor.GotoLine.image=
-Editor.GotoLine.description=Go to Line
-Editor.GotoLine.dialog.title=Go to Line
-Editor.GotoLine.dialog.message=Enter line number (1..{0}):
-Editor.GotoLine.dialog.invalid_input=Not a number
-Editor.GotoLine.dialog.invalid_range=Line number out of range
-
-Editor.ConvertLineDelimiter.title=Converting line delimiters...
-Editor.ConvertLineDelimiter.toWindows.label=CRLF (&Windows)
-Editor.ConvertLineDelimiter.toWindows.default.label=CRLF (&Windows) [default]
-Editor.ConvertLineDelimiter.toUNIX.label=LF (&UNIX, MacOS X)
-Editor.ConvertLineDelimiter.toUNIX.default.label=LF (&UNIX, MacOS X) [default]
-Editor.ConvertLineDelimiter.toMac.label=CR (Classic &MacOS)
-Editor.ConvertLineDelimiter.toMac.default.label=CR (Classic &MacOS) [default]
-
-Editor.MoveLines.IllegalMove.status= Move not possible - Uncheck "Show Source of Selected Element Only" to see the entire document
-
-Editor.SmartEnter.label=Insert line below current line
-Editor.SmartEnter.tooltip=Adds a new line below the current one
-Editor.SmartEnter.image=
-Editor.SmartEnter.description=Adds a new line below the current one
-
-Editor.SmartEnterInverse.label=Insert line above current line
-Editor.SmartEnterInverse.tooltip=Adds a new line above the current one
-Editor.SmartEnterInverse.image=
-Editor.SmartEnterInverse.description=Adds a new line above the current one
-
-Editor.MoveLinesUp.label=Move Lines Up
-Editor.MoveLinesUp.tooltip=Moves the selected lines upwards
-Editor.MoveLinesUp.image=
-Editor.MoveLinesUp.description=Moves the selected lines upwards
-
-Editor.MoveLinesDown.label=Move Lines Down
-Editor.MoveLinesDown.tooltip=Moves the selected lines downwards
-Editor.MoveLinesDown.image=
-Editor.MoveLinesDown.description=Moves the selected lines downwards
-
-Editor.UpperCase.label=To Upper Case
-Editor.UpperCase.tooltip=Changes the selection to upper case
-Editor.UpperCase.image=
-Editor.UpperCase.description=Changes the selection to upper case
-
-Editor.LowerCase.label=To Lower Case
-Editor.LowerCase.tooltip=Changes the selection to lower case
-Editor.LowerCase.image=
-Editor.LowerCase.description=Changes the selection to lower case
-
-
-## Status line ##
-
-Editor.statusline.state.readonly.label=Read Only
-Editor.statusline.state.writable.label=Writable
-Editor.statusline.mode.insert.label=Insert
-Editor.statusline.mode.overwrite.label=Overwrite
-Editor.statusline.mode.smartinsert.label=Smart Insert
-Editor.statusline.position.pattern={0} : {1}
-Editor.statusline.error.label=?
-
-## Others ##
-
-WorkbenchChainedTextFontFieldEditor.defaultWorkbenchTextFont=<Using Workbench Text Font>
-
-FindReplace.title= Find/Replace
-FindReplace.Find.label=&Find:
-FindReplace.Replace.label=R&eplace With:
-FindReplace.Direction=Direction
-FindReplace.ForwardRadioButton.label=F&orward
-FindReplace.BackwardRadioButton.label=&Backward
-FindReplace.Scope=Scope
-FindReplace.GlobalRadioButton.label=A&ll
-FindReplace.SelectedRangeRadioButton.label=Selec&ted Lines
-FindReplace.Options=Options
-FindReplace.CaseCheckBox.label=&Case Sensitive
-FindReplace.WrapCheckBox.label=Wra&p Search
-FindReplace.WholeWordCheckBox.label=&Whole Word
-FindReplace.IncrementalCheckBox.label=&Incremental
-FindReplace.RegExCheckbox.label= Regular e&xpressions
-FindReplace.FindNextButton.label=Fi&nd
-FindReplace.ReplaceFindButton.label=Replace/Fin&d
-FindReplace.ReplaceSelectionButton.label=&Replace
-FindReplace.ReplaceAllButton.label=Replace &All
-FindReplace.CloseButton.label=Close
-FindReplace.Status.noMatch.label=String Not Found
-FindReplace.Status.replacement.label=1 Match replaced
-FindReplace.Status.replacements.label={0} matches replaced
-
-FindNext.Status.noMatch.label=String Not Found
-
-AbstractDocumentProvider.ok=OK
-AbstractDocumentProvider.error=ERROR
-FindReplaceDialog.read_only=Replace can not be performed because of read only state.
-MarkRegionTarget.markNotSet=mark not set
-MarkRegionTarget.markNotVisible=mark not in visible region
-
-## Content Assist for regular expressions ##
-FindReplace.regExContentAssist.displayString.\\\\= Backslash
-FindReplace.regExContentAssist.additionalInfo.\\\\= \\\\
-FindReplace.regExContentAssist.displayString.\\0= Octal charcter code
-FindReplace.regExContentAssist.additionalInfo.\\0= \\0
-FindReplace.regExContentAssist.displayString.\\x= Hex character code
-FindReplace.regExContentAssist.additionalInfo.\\x= \\x
-FindReplace.regExContentAssist.displayString.\\u= Hex code of double-byte character
-FindReplace.regExContentAssist.additionalInfo.\\u= \\\u0075
-FindReplace.regExContentAssist.displayString.\\t= Tab
-FindReplace.regExContentAssist.additionalInfo.\\t= \\t
-FindReplace.regExContentAssist.displayString.\\n= Newline
-FindReplace.regExContentAssist.additionalInfo.\\n= \\n
-FindReplace.regExContentAssist.displayString.\\r= CR
-FindReplace.regExContentAssist.additionalInfo.\\r= \\r
-FindReplace.regExContentAssist.displayString.\\f= FF
-FindReplace.regExContentAssist.additionalInfo.\\f= \\f
-FindReplace.regExContentAssist.displayString.\\a= Beep
-FindReplace.regExContentAssist.additionalInfo.\\a= \\a
-FindReplace.regExContentAssist.displayString.\\e= Esc
-FindReplace.regExContentAssist.additionalInfo.\\e= \\e
-FindReplace.regExContentAssist.displayString.\\c= Control character
-FindReplace.regExContentAssist.additionalInfo.\\c= \\c
-FindReplace.regExContentAssist.displayString..= Any character
-FindReplace.regExContentAssist.additionalInfo..= .
-FindReplace.regExContentAssist.displayString.\\d= A digit
-FindReplace.regExContentAssist.additionalInfo.\\d= \\d
-FindReplace.regExContentAssist.displayString.\\D= Not a digit
-FindReplace.regExContentAssist.additionalInfo.\\D= \\D
-FindReplace.regExContentAssist.displayString.\\s= A whitespace
-FindReplace.regExContentAssist.additionalInfo.\\s= \\s
-FindReplace.regExContentAssist.displayString.\\S= Not a whitespace
-FindReplace.regExContentAssist.additionalInfo.\\S= \\S
-FindReplace.regExContentAssist.displayString.\\w= Alphanumeric
-FindReplace.regExContentAssist.additionalInfo.\\w= \\w
-FindReplace.regExContentAssist.displayString.\\W= Not an alphanumeric
-FindReplace.regExContentAssist.additionalInfo.\\W= \\W
-FindReplace.regExContentAssist.displayString.?= Greedy match 0 or 1 times
-FindReplace.regExContentAssist.additionalInfo.?= ?
-FindReplace.regExContentAssist.displayString.*= Greedy match 0 or more times
-FindReplace.regExContentAssist.additionalInfo.*= *
-FindReplace.regExContentAssist.displayString.+= Greedy match 1 or more times
-FindReplace.regExContentAssist.additionalInfo.+= +
-FindReplace.regExContentAssist.displayString.{n}= Greedy match exactly n times
-FindReplace.regExContentAssist.additionalInfo.{n}= {n}
-FindReplace.regExContentAssist.displayString.{n,}= Greedy match >= n times
-FindReplace.regExContentAssist.additionalInfo.{n,}= {n,}
-FindReplace.regExContentAssist.displayString.{n,m}= Greedy match >= n times but <= m times
-FindReplace.regExContentAssist.additionalInfo.{n,m}= {n,m}
-FindReplace.regExContentAssist.displayString.??= Match 0 or 1 times (left to right)
-FindReplace.regExContentAssist.additionalInfo.??= ??
-FindReplace.regExContentAssist.displayString.*?= Match 0 or more times (left to right)
-FindReplace.regExContentAssist.additionalInfo.*?= *?
-FindReplace.regExContentAssist.displayString.+?= Match 1 or more times (left to right)
-FindReplace.regExContentAssist.additionalInfo.+?= +?
-FindReplace.regExContentAssist.displayString.{n}?= Match exactly n times (left to right)
-FindReplace.regExContentAssist.additionalInfo.{n}?= {n}?
-FindReplace.regExContentAssist.displayString.{n,}?= Match >= n times (left to right)
-FindReplace.regExContentAssist.additionalInfo.{n,}?= {n,}?
-FindReplace.regExContentAssist.displayString.{n,m}?= Match >= n times but <= m times (left to right)
-FindReplace.regExContentAssist.additionalInfo.{n,m}?= {n,m}?
-FindReplace.regExContentAssist.displayString.?+= Match 0 or 1 times compared to full text
-FindReplace.regExContentAssist.additionalInfo.?+= ?+
-FindReplace.regExContentAssist.displayString.*+= Match 0 or more times compared to full text
-FindReplace.regExContentAssist.additionalInfo.*+= *+
-FindReplace.regExContentAssist.displayString.++= Match 1 or more times compared to full text
-FindReplace.regExContentAssist.additionalInfo.++= ++
-FindReplace.regExContentAssist.displayString.{n}+= Match exactly n times compared to full text
-FindReplace.regExContentAssist.additionalInfo.{n}+= {n}+
-FindReplace.regExContentAssist.displayString.{n,}+= Match exactly n times compared to to full text
-FindReplace.regExContentAssist.additionalInfo.{n,}+= {n,}+
-FindReplace.regExContentAssist.displayString.{n,m}+= Match >= n times but <= m times compared to to full text
-FindReplace.regExContentAssist.additionalInfo.{n,m}+= {n,m}+
-FindReplace.regExContentAssist.displayString.UV= U and V
-FindReplace.regExContentAssist.additionalInfo.UV= UV
-FindReplace.regExContentAssist.displayString.U|V= U or V
-FindReplace.regExContentAssist.additionalInfo.U|V= U|V
-FindReplace.regExContentAssist.displayString.(U)= Mark U as capturing group
-FindReplace.regExContentAssist.additionalInfo.(U)= (U)
-FindReplace.regExContentAssist.displayString.\\i= Replace field: Match of the capturing group i
-FindReplace.regExContentAssist.additionalInfo.\\i= \\i
-FindReplace.regExContentAssist.displayString.$i= Find field: Match of the capturing group i
-FindReplace.regExContentAssist.additionalInfo.$i= $i
-FindReplace.regExContentAssist.displayString.\\= Quote next character
-FindReplace.regExContentAssist.additionalInfo.\\= \\
-FindReplace.regExContentAssist.displayString.\\Q= Start quoting
-FindReplace.regExContentAssist.additionalInfo.\\Q= \\Q
-FindReplace.regExContentAssist.displayString.\\E= End quoting
-FindReplace.regExContentAssist.additionalInfo.\\E= \\E
-FindReplace.regExContentAssist.displayString.[ecq]= Character set
-FindReplace.regExContentAssist.additionalInfo.[ecq]= Example: [ecq]
-FindReplace.regExContentAssist.displayString.[^ecq]= Excluded character set
-FindReplace.regExContentAssist.additionalInfo.[^ecq]= Example: [^ecq]
-FindReplace.regExContentAssist.displayString.[e-q]= Character range
-FindReplace.regExContentAssist.additionalInfo.[e-q]= Example: [e-q]
-FindReplace.regExContentAssist.displayString.&&= Intersection of character sets
-FindReplace.regExContentAssist.additionalInfo.&&= Example: [e-q&&[def]]
-FindReplace.regExContentAssist.displayString.^= Line start
-FindReplace.regExContentAssist.additionalInfo.^= ^
-FindReplace.regExContentAssist.displayString.$= Line end
-FindReplace.regExContentAssist.additionalInfo.$= $
-FindReplace.regExContentAssist.displayString.\\b= Word beginning or end
-FindReplace.regExContentAssist.additionalInfo.\\b= \\b
-FindReplace.regExContentAssist.displayString.\\B= Not a word beginning or end
-FindReplace.regExContentAssist.additionalInfo.\\B= \\B
-FindReplace.regExContentAssist.displayString.\\A= Start of input
-FindReplace.regExContentAssist.additionalInfo.\\A= \\A
-FindReplace.regExContentAssist.displayString.\\G= Previous match's end
-FindReplace.regExContentAssist.additionalInfo.\\G= \\G
-FindReplace.regExContentAssist.displayString.\\Z= \\Z
-FindReplace.regExContentAssist.additionalInfo.\\Z= \\Z
-FindReplace.regExContentAssist.displayString.\\z= End of input
-FindReplace.regExContentAssist.additionalInfo.\\z= \\z
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorStatusLine.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorStatusLine.java
deleted file mode 100644
index ef86a61af03..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorStatusLine.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.text.Assert;
-
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-
-/**
- * An editor status line.
- * The selection provider of the editor triggers the status line to be cleared.
- * @since 2.1
- */
-class EditorStatusLine implements IEditorStatusLine {
-
- /**
- * Clears the status line on selection changed.
- */
- private class StatusLineClearer implements ISelectionChangedListener {
- /*
- * @see ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- fStatusLineManager.setErrorMessage(null, null);
- fStatusLineManager.setMessage(null, null);
-
- Assert.isTrue(this == fStatusLineClearer);
- uninstallStatusLineClearer();
- }
- }
-
- /** The status line manager. */
- private final IStatusLineManager fStatusLineManager;
-
- /** The selection provider. */
- private final ISelectionProvider fSelectionProvider;
-
- /** The status line clearer, <code>null</code> if not installed. */
- private StatusLineClearer fStatusLineClearer;
-
- /**
- * Constructor for EditorStatusLine.
- */
- public EditorStatusLine(IStatusLineManager statusLineManager, ISelectionProvider selectionProvider) {
-
- Assert.isNotNull(statusLineManager);
- Assert.isNotNull(selectionProvider);
-
- fStatusLineManager= statusLineManager;
- fSelectionProvider= selectionProvider;
- }
-
- /**
- * Returns the status line manager.
- */
- public IStatusLineManager getStatusLineManager() {
- return fStatusLineManager;
- }
-
- /**
- * Returns the selection provider.
- */
- public ISelectionProvider getSelectionProvider() {
- return fSelectionProvider;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IStatusLine#setMessage(boolean, String, Image)
- */
- public void setMessage(boolean error, String message, Image image) {
-
- if (error)
- fStatusLineManager.setErrorMessage(image, message);
- else {
- // Clear error message
- fStatusLineManager.setErrorMessage(null, null);
-
- fStatusLineManager.setMessage(image, message);
- }
-
- if (isMessageEmpty(message))
- uninstallStatusLineClearer();
- else
- installStatusLineClearer();
- }
-
- /**
- * Returns whether this given string is empty.
- *
- * @param message a string
- * @return <code>true</code> if the string is <code>null</code>, has 0 length or only white space characters.
- */
- private static boolean isMessageEmpty(String message) {
- return message == null || message.trim().length() == 0;
- }
-
- /**
- * Uninstalls the status line clearer.
- */
- private void uninstallStatusLineClearer() {
- if (fStatusLineClearer == null)
- return;
-
- fSelectionProvider.removeSelectionChangedListener(fStatusLineClearer);
- fStatusLineClearer= null;
- }
-
- /**
- * Installs the status line clearer.
- */
- private void installStatusLineClearer() {
- if (fStatusLineClearer != null)
- return;
-
- StatusLineClearer statusLineClearer= new StatusLineClearer();
- fSelectionProvider.addSelectionChangedListener(statusLineClearer);
- fStatusLineClearer= statusLineClearer;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java
deleted file mode 100644
index 40ceb91097d..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ResourceBundle;
-import java.util.regex.PatternSyntaxException;
-
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.dialogs.IDialogSettings;
-
-import org.eclipse.jface.text.IFindReplaceTarget;
-import org.eclipse.jface.text.IFindReplaceTargetExtension3;
-import org.eclipse.jface.text.TextUtilities;
-
-import org.eclipse.ui.IEditorActionBarContributor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.EditorActionBarContributor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-
-/**
- * An action which finds the next/previous occurrence of the last search or
- * the current selection if present.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * @since 2.0
- */
-public class FindNextAction extends ResourceAction implements IUpdate {
-
- /** The action's target */
- private IFindReplaceTarget fTarget;
- /** The part the action is bound to */
- private IWorkbenchPart fWorkbenchPart;
- /** The workbench window */
- private IWorkbenchWindow fWorkbenchWindow;
- /** The dialog settings to retrieve the last search */
- private IDialogSettings fDialogSettings;
- /** The find history as initially given in the dialog settings. */
- private List fFindHistory= new ArrayList();
- /** The find string as initially given in the dialog settings. */
- private String fFindString;
- /** The search direction as initially given in the dialog settings. */
- private boolean fForward;
- /** The warpping flag as initially given in the dialog settings. */
- private boolean fWrapInit;
- /** The case flag as initially given in the dialog settings. */
- private boolean fCaseInit;
- /** The whole word flag as initially given in the dialog settings. */
- private boolean fWholeWordInit;
- /**
- * The regExSearch flag as initially given in the dialog settings.
- *
- * @since 3.0
- */
- private boolean fRegExSearch;
- /**
- * The last selection set by find/replace.
- *
- * @since 3.0
- */
- private String fSelection;
-
- /**
- * Creates a new find/replace action for the given workbench part.
- * The action configures its visual representation from the given
- * resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param workbenchPart the workbench part
- * @param forward the search direction
- * @see ResourceAction#ResourceAction
- */
- public FindNextAction(ResourceBundle bundle, String prefix, IWorkbenchPart workbenchPart, boolean forward) {
- super(bundle, prefix);
- fWorkbenchPart= workbenchPart;
- fForward= forward;
- update();
- }
-
- /**
- * Creates a new find/replace action for the given workbench window.
- * The action configures its visual representation from the given
- * resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param workbenchWindow the workbench window
- * @param forward the search direction
- * @see ResourceAction#ResourceAction
- *
- * @deprecated use FindReplaceAction(ResourceBundle, String, IWorkbenchPart, boolean) instead
- */
- public FindNextAction(ResourceBundle bundle, String prefix, IWorkbenchWindow workbenchWindow, boolean forward) {
- super(bundle, prefix);
- fWorkbenchWindow= workbenchWindow;
- fForward= forward;
- update();
- }
-
- /**
- * Returns the find string based on the selection or the find history.
- * @return the find string
- */
- private String getFindString() {
- String string= getSelectionString();
-
- if ((string == null || fRegExSearch && string.equals(fSelection)) && !fFindHistory.isEmpty())
- string= (String) fFindHistory.get(0);
-
- return string;
- }
-
- /**
- * Returns the status line manager of the active editor.
- * @return the status line manager of the active editor
- */
- private IStatusLineManager getStatusLineManager() {
-
- IEditorPart editor= fWorkbenchPart.getSite().getPage().getActiveEditor();
- if (editor == null)
- return null;
-
- IEditorActionBarContributor contributor= editor.getEditorSite().getActionBarContributor();
- if (contributor instanceof EditorActionBarContributor) {
- return ((EditorActionBarContributor) contributor).getActionBars().getStatusLineManager();
- }
- return null;
- }
-
- /**
- * Sets the "no matches found" error message to the status line.
- */
- private void statusNotFound() {
- fWorkbenchPart.getSite().getShell().getDisplay().beep();
-
- IStatusLineManager manager= getStatusLineManager();
- if (manager == null)
- return;
-
- manager.setMessage(EditorMessages.getString("FindNext.Status.noMatch.label")); //$NON-NLS-1$
- }
-
- /**
- * Clears the status line.
- */
- private void statusClear() {
- IStatusLineManager manager= getStatusLineManager();
- if (manager == null)
- return;
-
- manager.setErrorMessage(""); //$NON-NLS-1$
- manager.setMessage(""); //$NON-NLS-1$
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- if (fTarget != null) {
- readConfiguration();
-
- fFindString= getFindString();
- if (fFindString == null) {
- statusNotFound();
- return;
- }
-
- statusClear();
- if (!findNext(fFindString, fForward, fCaseInit, fWrapInit, fWholeWordInit && !fRegExSearch, fRegExSearch))
- statusNotFound();
-
- writeConfiguration();
- }
- }
-
- /*
- * @see IUpdate#update()
- */
- public void update() {
-
- if (fWorkbenchPart == null && fWorkbenchWindow != null)
- fWorkbenchPart= fWorkbenchWindow.getPartService().getActivePart();
-
- if (fWorkbenchPart != null)
- fTarget= (IFindReplaceTarget) fWorkbenchPart.getAdapter(IFindReplaceTarget.class);
- else
- fTarget= null;
-
- setEnabled(fTarget != null && fTarget.canPerformFind());
- }
-
- /*
- * @see FindReplaceDialog#findIndex(String, int, boolean, boolean, boolean, boolean)
- */
- private int findIndex(String findString, int startPosition, boolean forwardSearch, boolean caseSensitive, boolean wrapSearch, boolean wholeWord, boolean regExSearch) {
-
- if (forwardSearch) {
- if (wrapSearch) {
- int index= findAndSelect(startPosition, findString, true, caseSensitive, wholeWord, regExSearch);
- if (index == -1) {
- beep();
- index= findAndSelect(-1, findString, true, caseSensitive, wholeWord, regExSearch);
- }
- return index;
- }
- return findAndSelect(startPosition, findString, true, caseSensitive, wholeWord, regExSearch);
- }
-
- // backward
- if (wrapSearch) {
- int index= findAndSelect(startPosition - 1, findString, false, caseSensitive, wholeWord, regExSearch);
- if (index == -1) {
- beep();
- index= findAndSelect(-1, findString, false, caseSensitive, wholeWord, regExSearch);
- }
- return index;
- }
- return findAndSelect(startPosition - 1, findString, false, caseSensitive, wholeWord, regExSearch);
- }
-
- /**
- * Returns whether the specified search string can be found using the given options.
- *
- * @param findString the string to search for
- * @param forwardSearch the search direction
- * @param caseSensitive should the search honor cases
- * @param wrapSearch should the search wrap to the start/end if end/start reached
- * @param wholeWord does the find string represent a complete word
- * @param regExSearch if <code>true</code> findString represents a regular expression
- * @return <code>true</code> if the find string can be found using the given options
- * @since 3.0
- */
- private boolean findNext(String findString, boolean forwardSearch, boolean caseSensitive, boolean wrapSearch, boolean wholeWord, boolean regExSearch) {
-
- Point r= fTarget.getSelection();
- int findReplacePosition= r.x;
- if (forwardSearch)
- findReplacePosition += r.y;
-
- int index= findIndex(findString, findReplacePosition, forwardSearch, caseSensitive, wrapSearch, wholeWord, regExSearch);
-
- if (index != -1)
- return true;
-
- return false;
- }
-
- private void beep() {
- Shell shell= null;
- if (fWorkbenchPart != null)
- shell= fWorkbenchPart.getSite().getShell();
- else if (fWorkbenchWindow != null)
- shell= fWorkbenchWindow.getShell();
-
- if (shell != null && !shell.isDisposed())
- shell.getDisplay().beep();
- }
-
- /**
- * Searches for a string starting at the given offset and using the specified search
- * directives. If a string has been found it is selected and its start offset is
- * returned.
- *
- * @param offset the offset at which searching starts
- * @param findString the string which should be found
- * @param forwardSearch the direction of the search
- * @param caseSensitive <code>true</code> performes a case sensitve search, <code>false</code> an insensitive search
- * @param wholeWord if <code>true</code> only occurences are reported in which the findString stands as a word by itself
- * @param regExSearch if <code>true</code> findString represents a regular expression
- * @return the position of the specified string, or -1 if the string has not been found
- * @since 3.0
- */
- private int findAndSelect(int offset, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord, boolean regExSearch) {
- if (fTarget instanceof IFindReplaceTargetExtension3)
- try {
- return ((IFindReplaceTargetExtension3)fTarget).findAndSelect(offset, findString, forwardSearch, caseSensitive, wholeWord, regExSearch);
- } catch (PatternSyntaxException ex) {
- return -1;
- }
- else
- return fTarget.findAndSelect(offset, findString, forwardSearch, caseSensitive, wholeWord);
- }
-
- //--------------- configuration handling --------------
-
- /**
- * Returns the dialog settings object used to share state
- * between several find/replace dialogs.
- *
- * @return the dialog settings to be used
- */
- private IDialogSettings getDialogSettings() {
- AbstractUIPlugin plugin= (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings settings= plugin.getDialogSettings();
- fDialogSettings= settings.getSection(FindReplaceDialog.class.getName());
- if (fDialogSettings == null)
- fDialogSettings= settings.addNewSection(FindReplaceDialog.class.getName());
- return fDialogSettings;
- }
-
- /**
- * Initializes itself from the dialog settings with the same state
- * as at the previous invocation.
- */
- private void readConfiguration() {
- IDialogSettings s= getDialogSettings();
-
- fWrapInit= s.getBoolean("wrap"); //$NON-NLS-1$
- fCaseInit= s.getBoolean("casesensitive"); //$NON-NLS-1$
- fWholeWordInit= s.getBoolean("wholeword"); //$NON-NLS-1$
- fRegExSearch= s.getBoolean("isRegEx"); //$NON-NLS-1$
- fSelection= s.get("selection"); //$NON-NLS-1$
-
- String[] findHistory= s.getArray("findhistory"); //$NON-NLS-1$
- if (findHistory != null) {
- fFindHistory.clear();
- for (int i= 0; i < findHistory.length; i++)
- fFindHistory.add(findHistory[i]);
- }
- }
-
- /**
- * Stores its current configuration in the dialog store.
- */
- private void writeConfiguration() {
- if (fFindString == null)
- return;
-
- IDialogSettings s= getDialogSettings();
-
- String selection= fTarget.getSelectionText();
- if (selection == null)
- selection= ""; //$NON-NLS-1$
- s.put("selection", selection); //$NON-NLS-1$
-
- if (!fFindHistory.isEmpty() && fFindString.equals(fFindHistory.get(0)))
- return;
-
- int index= fFindHistory.indexOf(fFindString);
- if (index != -1)
- fFindHistory.remove(index);
- fFindHistory.add(0, fFindString);
-
- while (fFindHistory.size() > 8)
- fFindHistory.remove(8);
- String[] names= new String[fFindHistory.size()];
- fFindHistory.toArray(names);
- s.put("findhistory", names); //$NON-NLS-1$
- }
-
- /**
- * Returns the actual selection of the find replace target.
- */
- private String getSelectionString() {
-
- /*
- * 1GF86V3: ITPUI:WINNT - Internal errors using Find/Replace Dialog
- * Now uses TextUtilities rather than focussing on '\n'
- */
- String selection= fTarget.getSelectionText();
- if (selection != null && selection.length() > 0) {
- int[] info= TextUtilities.indexOf(TextUtilities.DELIMITERS, selection, 0);
- if (info[0] > 0)
- return selection.substring(0, info[0]);
- else if (info[0] == -1)
- return selection;
- }
- return null;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceAction.java
deleted file mode 100644
index 56bf117cda7..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceAction.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.text.IFindReplaceTarget;
-
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IPartService;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.IWorkbenchWindow;
-
-
-/**
- * An action which opens a Find/Replace dialog.
- * The dialog while open, tracks the active workbench part
- * and retargets itself to the active find/replace target.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- *
- * @see IFindReplaceTarget
- */
-public class FindReplaceAction extends ResourceAction implements IUpdate {
-
- /**
- * Represents the "global" find/replace dialog. It tracks the active
- * part and retargets the find/replace dialog accordingly. The find/replace
- * target is retrieved from the active part using
- * <code>getAdapter(IFindReplaceTarget.class)</code>.
- * <p>
- * The stub has the same life cycle as the find/replace dialog.</p>
- */
- class FindReplaceDialogStub implements IPartListener, DisposeListener {
-
- /** The workbench part */
- private IWorkbenchPart fPart;
- /** The previous workbench part */
- private IWorkbenchPart fPreviousPart;
- /** The previous find/replace target */
- private IFindReplaceTarget fPreviousTarget;
-
- /** The workbench window */
- private IWorkbenchWindow fWindow;
- /** The find/replace dialog */
- private FindReplaceDialog fDialog;
-
- /**
- * Creates a new find/replace dialog accessor anchored at the given part site.
- * @param site the part site
- */
- public FindReplaceDialogStub(IWorkbenchPartSite site) {
-
- fWindow= site.getWorkbenchWindow();
-
- fDialog= new FindReplaceDialog(site.getShell());
- fDialog.create();
- fDialog.getShell().addDisposeListener(this);
-
- IPartService service= fWindow.getPartService();
- service.addPartListener(this);
- partActivated(service.getActivePart());
- }
-
- /**
- * Returns the find/replace dialog.
- * @return the find/replace dialog
- */
- public FindReplaceDialog getDialog() {
- return fDialog;
- }
-
- /*
- * @see IPartListener#partActivated(IWorkbenchPart)
- */
- public void partActivated(IWorkbenchPart part) {
-
- IFindReplaceTarget target= part == null ? null : (IFindReplaceTarget) part.getAdapter(IFindReplaceTarget.class);
- fPreviousPart= fPart;
- fPart= target == null ? null : part;
-
- if (fPreviousTarget != target) {
- fPreviousTarget= target;
- if (fDialog != null) {
- boolean isEditable= false;
- if (fPart instanceof ITextEditorExtension2) {
- ITextEditorExtension2 extension= (ITextEditorExtension2) fPart;
- isEditable= extension.isEditorInputModifiable();
- }
- fDialog.updateTarget(target, isEditable);
- }
- }
- }
-
- /*
- * @see IPartListener#partClosed(IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part) {
-
- if (part == fPreviousPart) {
- fPreviousPart= null;
- fPreviousTarget= null;
- }
-
- if (part == fPart)
- partActivated(null);
- }
-
- /*
- * @see DisposeListener#widgetDisposed(DisposeEvent)
- */
- public void widgetDisposed(DisposeEvent event) {
-
- if (fgFindReplaceDialogStub == this)
- fgFindReplaceDialogStub= null;
-
- if (fWindow != null) {
- fWindow.getPartService().removePartListener(this);
- fWindow= null;
- }
- fDialog= null;
- fPart= null;
- fPreviousPart= null;
- fPreviousTarget= null;
- }
-
- /*
- * @see IPartListener#partOpened(IWorkbenchPart)
- */
- public void partOpened(IWorkbenchPart part) {}
-
- /*
- * @see IPartListener#partDeactivated(IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part) {}
-
- /*
- * @see IPartListener#partBroughtToTop(IWorkbenchPart)
- */
- public void partBroughtToTop(IWorkbenchPart part) {}
- }
-
-
- /** Lister for disabling the dialog on editor close */
- private static FindReplaceDialogStub fgFindReplaceDialogStub;
- /** The action's target */
- private IFindReplaceTarget fTarget;
- /** The part the action is bound to */
- private IWorkbenchPart fWorkbenchPart;
- /** The workbench window */
- private IWorkbenchWindow fWorkbenchWindow;
-
- /**
- * Creates a new find/replace action for the given workbench part.
- * The action configures its visual representation from the given
- * resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param workbenchPart the workbench part
- * @see ResourceAction#ResourceAction
- */
- public FindReplaceAction(ResourceBundle bundle, String prefix, IWorkbenchPart workbenchPart) {
- super(bundle, prefix);
- fWorkbenchPart= workbenchPart;
- update();
- }
-
- /**
- * Creates a new find/replace action for the given workbench window.
- * The action configures its visual representation from the given
- * resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param workbenchWindow the workbench window
- * @see ResourceAction#ResourceAction
- *
- * @deprecated use FindReplaceAction(ResourceBundle, String, IWorkbenchPart) instead
- */
- public FindReplaceAction(ResourceBundle bundle, String prefix, IWorkbenchWindow workbenchWindow) {
- super(bundle, prefix);
- fWorkbenchWindow= workbenchWindow;
- update();
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- if (fTarget == null)
- return;
-
- if (fgFindReplaceDialogStub != null) {
- Shell shell= fWorkbenchPart.getSite().getShell();
- FindReplaceDialog dialog= fgFindReplaceDialogStub.getDialog();
- if (dialog != null && shell != dialog.getParentShell()) {
- fgFindReplaceDialogStub= null; // here to avoid timing issues
- dialog.close();
- }
- }
-
- if (fgFindReplaceDialogStub == null)
- fgFindReplaceDialogStub= new FindReplaceDialogStub(fWorkbenchPart.getSite());
-
- boolean isEditable= false;
- if (fWorkbenchPart instanceof ITextEditorExtension2)
- isEditable= ((ITextEditorExtension2) fWorkbenchPart).isEditorInputModifiable();
-
- FindReplaceDialog dialog= fgFindReplaceDialogStub.getDialog();
- dialog.updateTarget(fTarget, isEditable);
- dialog.open();
- }
-
- /*
- * @see IUpdate#update()
- */
- public void update() {
-
- if (fWorkbenchPart == null && fWorkbenchWindow != null)
- fWorkbenchPart= fWorkbenchWindow.getPartService().getActivePart();
-
- if (fWorkbenchPart != null)
- fTarget= (IFindReplaceTarget) fWorkbenchPart.getAdapter(IFindReplaceTarget.class);
- else
- fTarget= null;
-
- setEnabled(fTarget != null && fTarget.canPerformFind());
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
deleted file mode 100644
index 3434acdd412..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
+++ /dev/null
@@ -1,1769 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-
-import java.text.BreakIterator;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.PatternSyntaxException;
-
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-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.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.JFaceColors;
-
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IFindReplaceTarget;
-import org.eclipse.jface.text.IFindReplaceTargetExtension;
-import org.eclipse.jface.text.IFindReplaceTargetExtension3;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-
-
-/**
- * Find/Replace dialog. The dialog is opened on a particular
- * target but can be re-targeted. Internally used by the <code>FindReplaceAction</code>
- */
-class FindReplaceDialog extends Dialog {
-
- /**
- * Updates the find replace dialog on activation changes.
- */
- class ActivationListener extends ShellAdapter {
-
- private boolean findFieldHadFocus;
-
- /*
- * @see ShellListener#shellActivated(ShellEvent)
- */
- public void shellActivated(ShellEvent e) {
-
- String oldText= fFindField.getText(); // XXX workaround for 10766
- List oldList= new ArrayList();
- oldList.addAll(fFindHistory);
-
- readConfiguration();
-
-
- fFindField.removeModifyListener(fFindModifyListener);
-
- updateCombo(fFindField, fFindHistory);
- if (!fFindHistory.equals(oldList) && !fFindHistory.isEmpty())
- fFindField.setText((String) fFindHistory.get(0));
- else
- fFindField.setText(oldText);
- if (findFieldHadFocus)
- fFindField.setSelection(new Point(0, fFindField.getText().length()));
- fFindField.addModifyListener(fFindModifyListener);
-
- fActiveShell= (Shell)e.widget;
- updateButtonState();
-
- if (findFieldHadFocus && getShell() == fActiveShell && !fFindField.isDisposed())
- fFindField.setFocus();
- }
-
- /*
- * @see ShellListener#shellDeactivated(ShellEvent)
- */
- public void shellDeactivated(ShellEvent e) {
- findFieldHadFocus= fFindField.isFocusControl();
-
- storeSettings();
-
- fGlobalRadioButton.setSelection(true);
- fSelectedRangeRadioButton.setSelection(false);
- fUseSelectedLines= false;
-
- if (fTarget != null && (fTarget instanceof IFindReplaceTargetExtension))
- ((IFindReplaceTargetExtension) fTarget).setScope(null);
-
- fOldScope= null;
-
- fActiveShell= null;
- updateButtonState();
- }
- }
-
- /**
- * Modify listener to update the search result in case of incremental search.
- * @since 2.0
- */
- private class FindModifyListener implements ModifyListener {
-
- /*
- * @see ModifyListener#modifyText(ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- if (isIncrementalSearch() && !isRegExSearchAvailableAndChecked()) {
- if (fFindField.getText().equals("") && fTarget != null) { //$NON-NLS-1$
- // empty selection at base location
- int offset= fIncrementalBaseLocation.x;
-
- if (isForwardSearch() && !fNeedsInitialFindBeforeReplace || !isForwardSearch() && fNeedsInitialFindBeforeReplace)
- offset= offset + fIncrementalBaseLocation.y;
-
- fNeedsInitialFindBeforeReplace= false;
- findAndSelect(offset, "", isForwardSearch(), isCaseSensitiveSearch(), isWholeWordSearch(), isRegExSearchAvailableAndChecked()); //$NON-NLS-1$
- } else {
- performSearch(false);
- }
- }
-
- updateButtonState(!isIncrementalSearch());
- }
- }
-
- /** The size of the dialogs search history. */
- private static final int HISTORY_SIZE= 5;
-
- private Point fLocation;
- private Point fIncrementalBaseLocation;
- private boolean fWrapInit, fCaseInit, fWholeWordInit, fForwardInit, fGlobalInit, fIncrementalInit;
- /**
- * Tells whether an initial find operation is needed
- * before the replace operation.
- *
- * @since 3.0
- */
- private boolean fNeedsInitialFindBeforeReplace;
- /**
- * Initial value for telling whether the search string is a regular expression.
- * @since 3.0
- */
- boolean fIsRegExInit;
-
- private List fFindHistory;
- private List fReplaceHistory;
- private IRegion fOldScope;
-
- private boolean fIsTargetEditable;
- private IFindReplaceTarget fTarget;
- private Shell fParentShell;
- private Shell fActiveShell;
-
- private ActivationListener fActivationListener= new ActivationListener();
- private ModifyListener fFindModifyListener= new FindModifyListener();
-
- private Label fReplaceLabel, fStatusLabel;
- private Button fForwardRadioButton, fGlobalRadioButton, fSelectedRangeRadioButton;
- private Button fCaseCheckBox, fWrapCheckBox, fWholeWordCheckBox, fIncrementalCheckBox;
-
- /**
- * Checkbox for selecting whether the search string is a regular expression.
- * @since 3.0
- */
- private Button fIsRegExCheckBox;
-
- private Button fReplaceSelectionButton, fReplaceFindButton, fFindNextButton, fReplaceAllButton;
- Combo fFindField, fReplaceField;
- private Rectangle fDialogPositionInit;
-
- private IDialogSettings fDialogSettings;
- /**
- * Tells whether the target supports regular expressions.
- *
- * @return <code>true</code> if the target supports regular expressions
- * @since 3.0
- */
- private boolean fIsTargetSupportingRegEx;
- /**
- * Tells whether fUseSelectedLines radio is checked.
- *
- * @since 3.0
- */
- private boolean fUseSelectedLines;
- /**
- * The content assitant for the find combo.
- *
- * @since 3.0
- */
- private ContentAssistant fFindFieldContentAssistant;
- /**
- * The content assitant for the replace combo.
- *
- * @since 3.0
- */
- private ContentAssistant fReplaceFieldContentAssistant;
- /**
- * Content assist's proposal popup background color.
- *
- * @since 3.0
- */
- private Color fProposalPopupBackgroundColor;
- /**
- * Content assist's proposal popup foreground color.
- *
- * @since 3.0
- */
- private Color fProposalPopupForegroundColor;
-
-
- /**
- * Creates a new dialog with the given shell as parent.
- * @param parentShell the parent shell
- */
- public FindReplaceDialog(Shell parentShell) {
- super(parentShell);
-
- fParentShell= null;
- fTarget= null;
-
- fDialogPositionInit= null;
- fFindHistory= new ArrayList(HISTORY_SIZE - 1);
- fReplaceHistory= new ArrayList(HISTORY_SIZE - 1);
-
- fWrapInit= false;
- fCaseInit= false;
- fIsRegExInit= false;
- fWholeWordInit= false;
- fIncrementalInit= false;
- fGlobalInit= true;
- fForwardInit= true;
-
- readConfiguration();
-
- setShellStyle(SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE);
- setBlockOnOpen(false);
- }
-
- /**
- * Returns this dialog's parent shell.
- * @return the dialog's parent shell
- */
- public Shell getParentShell() {
- return super.getParentShell();
- }
-
-
- /**
- * Returns <code>true</code> if control can be used.
- *
- * @param control the control to be checked
- * @return <code>true</code> if control can be used
- */
- private boolean okToUse(Control control) {
- return control != null && !control.isDisposed();
- }
-
- /*
- * @see org.eclipse.jface.window.Window#create()
- */
- public void create() {
-
- super.create();
-
- Shell shell= getShell();
- shell.addShellListener(fActivationListener);
- if (fLocation != null)
- shell.setLocation(fLocation);
-
- // set help context
- WorkbenchHelp.setHelp(shell, IAbstractTextEditorHelpContextIds.FIND_REPLACE_DIALOG);
-
- // fill in combo contents
- fFindField.removeModifyListener(fFindModifyListener);
- updateCombo(fFindField, fFindHistory);
- fFindField.addModifyListener(fFindModifyListener);
- updateCombo(fReplaceField, fReplaceHistory);
-
- // get find string
- initFindStringFromSelection();
-
- // set dialog position
- if (fDialogPositionInit != null)
- shell.setBounds(fDialogPositionInit);
-
- shell.setText(EditorMessages.getString("FindReplace.title")); //$NON-NLS-1$
- // shell.setImage(null);
- }
-
- /**
- * Create the button section of the find/replace dialog.
- *
- * @param parent the parent composite
- * @return the button section
- */
- private Composite createButtonSection(Composite parent) {
-
- Composite panel= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns= -2;
- layout.makeColumnsEqualWidth= true;
- panel.setLayout(layout);
-
- fFindNextButton= makeButton(panel, "FindReplace.FindNextButton.label", 102, true, new SelectionAdapter() { //$NON-NLS-1$
- public void widgetSelected(SelectionEvent e) {
- if (isIncrementalSearch() && !isRegExSearchAvailableAndChecked())
- initIncrementalBaseLocation();
-
- fNeedsInitialFindBeforeReplace= false;
- performSearch();
- updateFindHistory();
- fFindNextButton.setFocus();
- }
- });
- setGridData(fFindNextButton, GridData.FILL, true, GridData.FILL, false);
-
- fReplaceFindButton= makeButton(panel, "FindReplace.ReplaceFindButton.label", 103, false, new SelectionAdapter() { //$NON-NLS-1$
- public void widgetSelected(SelectionEvent e) {
- if (fNeedsInitialFindBeforeReplace)
- performSearch();
- if (performReplaceSelection())
- performSearch();
- updateFindAndReplaceHistory();
- fReplaceFindButton.setFocus();
- }
- });
- setGridData(fReplaceFindButton, GridData.FILL, true, GridData.FILL, false);
-
- fReplaceSelectionButton= makeButton(panel, "FindReplace.ReplaceSelectionButton.label", 104, false, new SelectionAdapter() { //$NON-NLS-1$
- public void widgetSelected(SelectionEvent e) {
- if (fNeedsInitialFindBeforeReplace)
- performSearch();
- performReplaceSelection();
- updateFindAndReplaceHistory();
- fFindNextButton.setFocus();
- }
- });
- setGridData(fReplaceSelectionButton, GridData.FILL, true, GridData.FILL, false);
-
- fReplaceAllButton= makeButton(panel, "FindReplace.ReplaceAllButton.label", 105, false, new SelectionAdapter() { //$NON-NLS-1$
- public void widgetSelected(SelectionEvent e) {
- performReplaceAll();
- updateFindAndReplaceHistory();
- fFindNextButton.setFocus();
- }
- });
- setGridData(fReplaceAllButton, GridData.FILL, true, GridData.FILL, false);
-
- // Make the all the buttons the same size as the Remove Selection button.
- fReplaceAllButton.setEnabled(isEditable());
-
- return panel;
- }
-
- /**
- * Creates the options configuration section of the find replace dialog.
- *
- * @param parent the parent composite
- * @return the options configuration section
- */
- private Composite createConfigPanel(Composite parent) {
-
- Composite panel= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
- layout.makeColumnsEqualWidth= true;
- panel.setLayout(layout);
-
- Composite directionGroup= createDirectionGroup(panel);
- setGridData(directionGroup, GridData.FILL, true, GridData.FILL, false);
- Composite scopeGroup= createScopeGroup(panel);
- setGridData(scopeGroup, GridData.FILL, true, GridData.FILL, false);
-
- Composite optionsGroup= createOptionsGroup(panel);
- setGridData(optionsGroup, GridData.FILL, true, GridData.FILL, false);
- GridData data= (GridData) optionsGroup.getLayoutData();
- data.horizontalSpan= 2;
- optionsGroup.setLayoutData(data);
-
- return panel;
- }
-
- /*
- * @see org.eclipse.jface.window.Window#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
-
- Composite panel= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns= 1;
- layout.makeColumnsEqualWidth= true;
- panel.setLayout(layout);
-
- Composite inputPanel= createInputPanel(panel);
- setGridData(inputPanel, GridData.FILL, true, GridData.CENTER, false);
-
- Composite configPanel= createConfigPanel(panel);
- setGridData(configPanel, GridData.FILL, true, GridData.CENTER, true);
-
- Composite buttonPanelB= createButtonSection(panel);
- setGridData(buttonPanelB, GridData.FILL, true, GridData.CENTER, false);
-
- Composite statusBar= createStatusAndCloseButton(panel);
- setGridData(statusBar, GridData.FILL, true, GridData.CENTER, false);
-
- updateButtonState();
-
- applyDialogFont(panel);
-
- // Setup content assistants for find and replace combos
- fProposalPopupBackgroundColor= new Color(getShell().getDisplay(), new RGB(254, 241, 233));
- fProposalPopupForegroundColor= new Color(getShell().getDisplay(), new RGB(0, 0, 0));
-
- fFindFieldContentAssistant= createContentAssistant(fFindField);
- fReplaceFieldContentAssistant= createContentAssistant(fReplaceField);
-
- return panel;
- }
-
- /**
- * Creates the direction defining part of the options defining section
- * of the find replace dialog.
- *
- * @param parent the parent composite
- * @return the direction defining part
- */
- private Composite createDirectionGroup(Composite parent) {
-
- Composite panel= new Composite(parent, SWT.NONE);
- GridLayout layout= new GridLayout();
- layout.marginWidth= 0;
- layout.marginHeight= 0;
- panel.setLayout(layout);
-
- Group group= new Group(panel, SWT.SHADOW_ETCHED_IN);
- group.setText(EditorMessages.getString("FindReplace.Direction")); //$NON-NLS-1$
- GridLayout groupLayout= new GridLayout();
- group.setLayout(groupLayout);
- group.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- SelectionListener selectionListener= new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- if (isIncrementalSearch() && !isRegExSearchAvailableAndChecked())
- initIncrementalBaseLocation();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
-
- fForwardRadioButton= new Button(group, SWT.RADIO | SWT.LEFT);
- fForwardRadioButton.setText(EditorMessages.getString("FindReplace.ForwardRadioButton.label")); //$NON-NLS-1$
- setGridData(fForwardRadioButton, GridData.BEGINNING, false, GridData.CENTER, false);
- fForwardRadioButton.addSelectionListener(selectionListener);
-
- Button backwardRadioButton= new Button(group, SWT.RADIO | SWT.LEFT);
- backwardRadioButton.setText(EditorMessages.getString("FindReplace.BackwardRadioButton.label")); //$NON-NLS-1$
- setGridData(backwardRadioButton, GridData.BEGINNING, false, GridData.CENTER, false);
- backwardRadioButton.addSelectionListener(selectionListener);
-
- backwardRadioButton.setSelection(!fForwardInit);
- fForwardRadioButton.setSelection(fForwardInit);
-
- return panel;
- }
-
- /**
- * Creates the scope defining part of the find replace dialog.
- *
- * @param parent the parent composite
- * @return the scope defining part
- * @since 2.0
- */
- private Composite createScopeGroup(Composite parent) {
-
- Composite panel= new Composite(parent, SWT.NONE);
- GridLayout layout= new GridLayout();
- layout.marginWidth= 0;
- layout.marginHeight= 0;
- panel.setLayout(layout);
-
- Group group= new Group(panel, SWT.SHADOW_ETCHED_IN);
- group.setText(EditorMessages.getString("FindReplace.Scope")); //$NON-NLS-1$
- GridLayout groupLayout= new GridLayout();
- group.setLayout(groupLayout);
- group.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- fGlobalRadioButton= new Button(group, SWT.RADIO | SWT.LEFT);
- fGlobalRadioButton.setText(EditorMessages.getString("FindReplace.GlobalRadioButton.label")); //$NON-NLS-1$
- setGridData(fGlobalRadioButton, GridData.BEGINNING, false, GridData.CENTER, false);
- fGlobalRadioButton.setSelection(fGlobalInit);
- fGlobalRadioButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- if (!fGlobalRadioButton.getSelection() || !fUseSelectedLines)
- return;
- fUseSelectedLines= false;
- useSelectedLines(false);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- fSelectedRangeRadioButton= new Button(group, SWT.RADIO | SWT.LEFT);
- fSelectedRangeRadioButton.setText(EditorMessages.getString("FindReplace.SelectedRangeRadioButton.label")); //$NON-NLS-1$
- setGridData(fSelectedRangeRadioButton, GridData.BEGINNING, false, GridData.CENTER, false);
- fSelectedRangeRadioButton.setSelection(!fGlobalInit);
- fUseSelectedLines= !fGlobalInit;
- fSelectedRangeRadioButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- if (!fSelectedRangeRadioButton.getSelection() || fUseSelectedLines)
- return;
- fUseSelectedLines= true;
- useSelectedLines(true);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- return panel;
- }
-
- /**
- * Tells the dialog to perform searches only in the scope given by the actually selected lines.
- * @param selectedLines <code>true</code> if selected lines should be used
- * @since 2.0
- */
- private void useSelectedLines(boolean selectedLines) {
- if (isIncrementalSearch() && !isRegExSearchAvailableAndChecked())
- initIncrementalBaseLocation();
-
- if (fTarget == null || !(fTarget instanceof IFindReplaceTargetExtension))
- return;
-
- IFindReplaceTargetExtension extensionTarget= (IFindReplaceTargetExtension) fTarget;
-
- if (selectedLines) {
-
- IRegion scope;
- if (fOldScope == null) {
- Point lineSelection= extensionTarget.getLineSelection();
- scope= new Region(lineSelection.x, lineSelection.y);
- } else {
- scope= fOldScope;
- fOldScope= null;
- }
-
- int offset= isForwardSearch()
- ? scope.getOffset()
- : scope.getOffset() + scope.getLength();
-
- extensionTarget.setSelection(offset, 0);
- extensionTarget.setScope(scope);
- } else {
- fOldScope= extensionTarget.getScope();
- extensionTarget.setScope(null);
- }
- }
-
- /**
- * Creates the panel where the user specifies the text to search
- * for and the optional replacement text.
- *
- * @param parent the parent composite
- * @return the input panel
- */
- private Composite createInputPanel(Composite parent) {
-
- ModifyListener listener= new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateButtonState();
- }
- };
-
- Composite panel= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
- panel.setLayout(layout);
-
- Label findLabel= new Label(panel, SWT.LEFT);
- findLabel.setText(EditorMessages.getString("FindReplace.Find.label")); //$NON-NLS-1$
- setGridData(findLabel, GridData.BEGINNING, false, GridData.CENTER, false);
-
- fFindField= new Combo(panel, SWT.DROP_DOWN | SWT.BORDER);
- setGridData(fFindField, GridData.FILL, true, GridData.CENTER, false);
- fFindField.addModifyListener(fFindModifyListener);
-
- fReplaceLabel= new Label(panel, SWT.LEFT);
- fReplaceLabel.setText(EditorMessages.getString("FindReplace.Replace.label")); //$NON-NLS-1$
- setGridData(fReplaceLabel, GridData.BEGINNING, false, GridData.CENTER, false);
-
- fReplaceField= new Combo(panel, SWT.DROP_DOWN | SWT.BORDER);
- setGridData(fReplaceField, GridData.FILL, true, GridData.CENTER, false);
- fReplaceField.addModifyListener(listener);
-
- return panel;
- }
-
- /**
- * Creates the functional options part of the options defining
- * section of the find replace dialog.
- *
- * @param the parent composite
- * @return the options group
- */
- private Composite createOptionsGroup(Composite parent) {
-
- Composite panel= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.marginWidth= 0;
- layout.marginHeight= 0;
- panel.setLayout(layout);
-
- Group group= new Group(panel, SWT.SHADOW_NONE);
- group.setText(EditorMessages.getString("FindReplace.Options")); //$NON-NLS-1$
- GridLayout groupLayout= new GridLayout();
- groupLayout.numColumns= 2;
- groupLayout.makeColumnsEqualWidth= true;
- group.setLayout(groupLayout);
- group.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- SelectionListener selectionListener= new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- storeSettings();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
-
- fCaseCheckBox= new Button(group, SWT.CHECK | SWT.LEFT);
- fCaseCheckBox.setText(EditorMessages.getString("FindReplace.CaseCheckBox.label")); //$NON-NLS-1$
- setGridData(fCaseCheckBox, GridData.BEGINNING, false, GridData.CENTER, false);
- fCaseCheckBox.setSelection(fCaseInit);
- fCaseCheckBox.addSelectionListener(selectionListener);
-
- fWrapCheckBox= new Button(group, SWT.CHECK | SWT.LEFT);
- fWrapCheckBox.setText(EditorMessages.getString("FindReplace.WrapCheckBox.label")); //$NON-NLS-1$
- setGridData(fWrapCheckBox, GridData.BEGINNING, false, GridData.CENTER, false);
- fWrapCheckBox.setSelection(fWrapInit);
- fWrapCheckBox.addSelectionListener(selectionListener);
-
- fWholeWordCheckBox= new Button(group, SWT.CHECK | SWT.LEFT);
- fWholeWordCheckBox.setText(EditorMessages.getString("FindReplace.WholeWordCheckBox.label")); //$NON-NLS-1$
- setGridData(fWholeWordCheckBox, GridData.BEGINNING, false, GridData.CENTER, false);
- fWholeWordCheckBox.setSelection(fWholeWordInit);
- fWholeWordCheckBox.addSelectionListener(selectionListener);
-
- fIncrementalCheckBox= new Button(group, SWT.CHECK | SWT.LEFT);
- fIncrementalCheckBox.setText(EditorMessages.getString("FindReplace.IncrementalCheckBox.label")); //$NON-NLS-1$
- setGridData(fIncrementalCheckBox, GridData.BEGINNING, false, GridData.CENTER, false);
- fIncrementalCheckBox.setSelection(fIncrementalInit);
- fIncrementalCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- if (isIncrementalSearch() && !isRegExSearch())
- initIncrementalBaseLocation();
-
- storeSettings();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- fIsRegExCheckBox= new Button(group, SWT.CHECK | SWT.LEFT);
- fIsRegExCheckBox.setText(EditorMessages.getString("FindReplace.RegExCheckbox.label")); //$NON-NLS-1$
- setGridData(fIsRegExCheckBox, GridData.BEGINNING, false, GridData.CENTER, false);
- ((GridData)fIsRegExCheckBox.getLayoutData()).horizontalSpan= 2;
- fIsRegExCheckBox.setSelection(fIsRegExInit);
- fIsRegExCheckBox.addSelectionListener(new SelectionAdapter() {
- /*
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
- boolean newState= fIsRegExCheckBox.getSelection();
- fIncrementalCheckBox.setEnabled(!newState);
- fWholeWordCheckBox.setEnabled(!newState);
- updateButtonState();
- storeSettings();
- fFindFieldContentAssistant.enableAutoActivation(newState);
- fReplaceFieldContentAssistant.enableAutoActivation(newState);
- }
- });
- fWholeWordCheckBox.setEnabled(!isRegExSearchAvailableAndChecked());
- fWholeWordCheckBox.addSelectionListener(new SelectionAdapter() {
- /*
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
- updateButtonState();
- }
- });
- fIncrementalCheckBox.setEnabled(!isRegExSearchAvailableAndChecked());
- return panel;
- }
-
- /**
- * Creates the status and close section of the dialog.
- *
- * @param parent the parent composite
- * @return the status and close button
- */
- private Composite createStatusAndCloseButton(Composite parent) {
-
- Composite panel= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
- layout.marginWidth= 0;
- layout.marginHeight= 0;
- panel.setLayout(layout);
-
- fStatusLabel= new Label(panel, SWT.LEFT);
- setGridData(fStatusLabel, GridData.FILL, true, GridData.CENTER, false);
-
- String label= EditorMessages.getString("FindReplace.CloseButton.label"); //$NON-NLS-1$
- Button closeButton= createButton(panel, 101, label, false);
- setGridData(closeButton, GridData.END, false, GridData.END, false);
-
- return panel;
- }
-
- /*
- * @see Dialog#buttonPressed
- */
- protected void buttonPressed(int buttonID) {
- if (buttonID == 101)
- close();
- }
-
-
-
- // ------- action invocation ---------------------------------------
-
- /**
- * Returns the position of the specified search string, or <code>-1</code> if the string can
- * not be found when searching using the given options.
- *
- * @param findString the string to search for
- * @param startPosition the position at which to start the search
- * @param forwardSearch the direction of the search
- * @param caseSensitive should the search be case sensitive
- * @param wrapSearch should the search wrap to the start/end if arrived at the end/start
- * @param wholeWord does the search string represent a complete word
- * @return the occurrence of the find string following the options or <code>-1</code> if nothing found
- */
- private int findIndex(String findString, int startPosition, boolean forwardSearch, boolean caseSensitive, boolean wrapSearch, boolean wholeWord, boolean regExSearch) {
-
- if (forwardSearch) {
- if (wrapSearch) {
- int index= findAndSelect(startPosition, findString, true, caseSensitive, wholeWord, regExSearch);
- if (index == -1) {
- if (okToUse(getShell()) && !isIncrementalSearch())
- getShell().getDisplay().beep();
- index= findAndSelect(-1, findString, true, caseSensitive, wholeWord, regExSearch);
- }
- return index;
- }
- return findAndSelect(startPosition, findString, true, caseSensitive, wholeWord, regExSearch);
- }
-
- // backward
- if (wrapSearch) {
- int index= findAndSelect(startPosition - 1, findString, false, caseSensitive, wholeWord, regExSearch);
- if (index == -1) {
- if (okToUse(getShell()) && !isIncrementalSearch())
- getShell().getDisplay().beep();
- index= findAndSelect(-1, findString, false, caseSensitive, wholeWord, regExSearch);
- }
- return index;
- }
- return findAndSelect(startPosition - 1, findString, false, caseSensitive, wholeWord, regExSearch);
- }
-
- /**
- * Searches for a string starting at the given offset and using the specified search
- * directives. If a string has been found it is selected and its start offset is
- * returned.
- *
- * @param offset the offset at which searching starts
- * @param findString the string which should be found
- * @param forwardSearch the direction of the search
- * @param caseSensitive <code>true</code> performes a case sensitve search, <code>false</code> an insensitive search
- * @param wholeWord if <code>true</code> only occurences are reported in which the findString stands as a word by itself
- * @param regExSearch if <code>true</code> findString represents a regular expression
- * @return the position of the specified string, or -1 if the string has not been found
- * @since 3.0
- */
- private int findAndSelect(int offset, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord, boolean regExSearch) {
- if (fTarget instanceof IFindReplaceTargetExtension3)
- return ((IFindReplaceTargetExtension3)fTarget).findAndSelect(offset, findString, forwardSearch, caseSensitive, wholeWord, regExSearch);
- else
- return fTarget.findAndSelect(offset, findString, forwardSearch, caseSensitive, wholeWord);
- }
-
- void replaceSelection(String replaceString, boolean regExReplace) {
- if (fTarget instanceof IFindReplaceTargetExtension3)
- ((IFindReplaceTargetExtension3)fTarget).replaceSelection(replaceString, regExReplace);
- else
- fTarget.replaceSelection(replaceString);
- }
-
- /**
- * Returns whether the specified search string can be found using the given options.
- *
- * @param findString the string to search for
- * @param forwardSearch the direction of the search
- * @param caseSensitive should the search be case sensitive
- * @param wrapSearch should the search wrap to the start/end if arrived at the end/start
- * @param wholeWord does the search string represent a complete word
- * @param incremental is this an incremental search
- * @param global is the search scope the whoel document
- * @param regExSearch if <code>true</code> findString represents a regular expression
- * @return <code>true</code> if the search string can be found using the given options
- * @since 3.0
- */
- private boolean findNext(String findString, boolean forwardSearch, boolean caseSensitive, boolean wrapSearch, boolean wholeWord, boolean incremental, boolean global, boolean regExSearch) {
-
- if (fTarget == null)
- return false;
-
- Point r= null;
- if (incremental)
- r= fIncrementalBaseLocation;
- else
- r= fTarget.getSelection();
-
- int findReplacePosition= r.x;
- if (forwardSearch && !fNeedsInitialFindBeforeReplace || !forwardSearch && fNeedsInitialFindBeforeReplace)
- findReplacePosition += r.y;
-
- fNeedsInitialFindBeforeReplace= false;
-
- int index= findIndex(findString, findReplacePosition, forwardSearch, caseSensitive, wrapSearch, wholeWord, regExSearch);
-
- if (index != -1)
- return true;
-
- return false;
- }
-
- /**
- * Returns the dialog's boundaries.
- * @return the dialog's boundaries
- */
- private Rectangle getDialogBoundaries() {
- if (okToUse(getShell())) {
- return getShell().getBounds();
- } else {
- return fDialogPositionInit;
- }
- }
-
- /**
- * Returns the dialog's history.
- * @return the dialog's history
- */
- private List getFindHistory() {
- return fFindHistory;
- }
-
- // ------- accessors ---------------------------------------
-
- /**
- * Retrieves the string to search for from the appriopriate text input field and returns it.
- * @return the search string
- */
- private String getFindString() {
- if (okToUse(fFindField)) {
- return fFindField.getText();
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Returns the dialog's replace history.
- * @return the dialog's replace history
- */
- private List getReplaceHistory() {
- return fReplaceHistory;
- }
-
- /**
- * Retrieves the replacement string from the appriopriate text input field and returns it.
- * @return the replacement string
- */
- private String getReplaceString() {
- if (okToUse(fReplaceField)) {
- return fReplaceField.getText();
- }
- return ""; //$NON-NLS-1$
- }
-
- // ------- init / close ---------------------------------------
-
- /**
- * Returns the actual selection of the find replace target.
- * @return the selection of the target
- */
- private String getSelectionString() {
- String selection= fTarget.getSelectionText();
- if (selection != null && selection.length() > 0) {
- int[] info= TextUtilities.indexOf(TextUtilities.DELIMITERS, selection, 0);
- if (info[0] > 0)
- return selection.substring(0, info[0]);
- else if (info[0] == -1)
- return selection;
- }
- return null;
- }
-
- /**
- * @see org.eclipse.jface.window.Window#close()
- */
- public boolean close() {
- handleDialogClose();
- return super.close();
- }
-
- /**
- * Removes focus changed listener from browser and stores settings for re-open.
- */
- private void handleDialogClose() {
-
- // remove listeners
- if (fParentShell != null) {
- fParentShell.removeShellListener(fActivationListener);
- fParentShell= null;
- }
-
- getShell().removeShellListener(fActivationListener);
-
- // store current settings in case of re-open
- storeSettings();
-
- if (fTarget != null && fTarget instanceof IFindReplaceTargetExtension)
- ((IFindReplaceTargetExtension) fTarget).endSession();
-
- fFindFieldContentAssistant.uninstall();
- fReplaceFieldContentAssistant.uninstall();
-
- fProposalPopupBackgroundColor.dispose();
- fProposalPopupForegroundColor.dispose();
-
- // prevent leaks
- fActiveShell= null;
- fTarget= null;
- fFindFieldContentAssistant= null;
- fReplaceFieldContentAssistant= null;
- }
-
- /**
- * Writes the current selection to the dialog settings.
- * @since 3.0
- */
- private void writeSelection() {
- if (fTarget == null)
- return;
- String selection= fTarget.getSelectionText();
- if (selection == null)
- selection= ""; //$NON-NLS-1$
-
- IDialogSettings s= getDialogSettings();
- s.put("selection", selection); //$NON-NLS-1$
- }
-
- /**
- * Stores the current state in the dialog settings.
- * @since 2.0
- */
- private void storeSettings() {
- fDialogPositionInit= getDialogBoundaries();
- fWrapInit= isWrapSearch();
- fWholeWordInit= isWholeWordSearch();
- fCaseInit= isCaseSensitiveSearch();
- fIsRegExInit= isRegExSearch();
- fIncrementalInit= isIncrementalSearch();
- fForwardInit= isForwardSearch();
-
- writeConfiguration();
- }
-
- /**
- * Initializes the string to search for and the appropriate
- * text inout field based on the selection found in the
- * action's target.
- */
- private void initFindStringFromSelection() {
- if (fTarget != null && okToUse(fFindField)) {
- String selection= getSelectionString();
- fFindField.removeModifyListener(fFindModifyListener);
- if (selection != null) {
- fFindField.setText(selection);
- if (!selection.equals(fTarget.getSelectionText())) {
- useSelectedLines(true);
- fGlobalRadioButton.setSelection(false);
- fSelectedRangeRadioButton.setSelection(true);
- fUseSelectedLines= true;
- }
- } else {
- if ("".equals(fFindField.getText())) { //$NON-NLS-1$
- if (fFindHistory.size() > 0)
- fFindField.setText((String) fFindHistory.get(0));
- else
- fFindField.setText(""); //$NON-NLS-1$
- }
- }
- fFindField.setSelection(new Point(0, fFindField.getText().length()));
- fFindField.addModifyListener(fFindModifyListener);
- }
- }
-
- /**
- * Initializes the anchor used as starting point for incremental searching.
- * @since 2.0
- */
- private void initIncrementalBaseLocation() {
- if (fTarget != null && isIncrementalSearch() && !isRegExSearchAvailableAndChecked()) {
- fIncrementalBaseLocation= fTarget.getSelection();
- } else {
- fIncrementalBaseLocation= new Point(0, 0);
- }
- }
-
- // ------- history ---------------------------------------
-
- /**
- * Retrieves and returns the option case sensitivity from the appropriate check box.
- * @return <code>true</code> if case sensitive
- */
- private boolean isCaseSensitiveSearch() {
- if (okToUse(fCaseCheckBox)) {
- return fCaseCheckBox.getSelection();
- }
- return fCaseInit;
- }
-
- /**
- * Retrieves and returns the regEx option from the appropriate check box.
- *
- * @return <code>true</code> if case sensitive
- * @since 3.0
- */
- private boolean isRegExSearch() {
- if (okToUse(fIsRegExCheckBox)) {
- return fIsRegExCheckBox.getSelection();
- }
- return fIsRegExInit;
- }
-
- /**
- * If the target supports regular expressions search retrieves and returns
- * regEx option from appropriate check box.
- *
- * @return <code>true</code> if regEx is available and checked
- * @since 3.0
- */
- private boolean isRegExSearchAvailableAndChecked() {
- if (okToUse(fIsRegExCheckBox)) {
- return fIsTargetSupportingRegEx && fIsRegExCheckBox.getSelection();
- }
- return fIsRegExInit;
- }
-
- /**
- * Retrieves and returns the option search direction from the appropriate check box.
- * @return <code>true</code> if searching forward
- */
- private boolean isForwardSearch() {
- if (okToUse(fForwardRadioButton)) {
- return fForwardRadioButton.getSelection();
- }
- return fForwardInit;
- }
-
- /**
- * Retrieves and returns the option global scope from the appropriate check box.
- * @return <code>true</code> if searching globally
- * @since 2.0
- */
- private boolean isGlobalSearch() {
- if (okToUse(fGlobalRadioButton)) {
- return fGlobalRadioButton.getSelection();
- }
- return fGlobalInit;
- }
-
- /**
- * Retrieves and returns the option search whole words from the appropriate check box.
- * @return <code>true</code> if searching for whole words
- */
- private boolean isWholeWordSearch() {
- if (okToUse(fWholeWordCheckBox)) {
- return fWholeWordCheckBox.getSelection();
- }
- return fWholeWordInit;
- }
-
- /**
- * Retrieves and returns the option wrap search from the appropriate check box.
- * @return <code>true</code> if wrapping while searching
- */
- private boolean isWrapSearch() {
- if (okToUse(fWrapCheckBox)) {
- return fWrapCheckBox.getSelection();
- }
- return fWrapInit;
- }
-
- /**
- * Retrieves and returns the option incremental search from the appropriate check box.
- * @return <code>true</code> if incremental search
- * @since 2.0
- */
- private boolean isIncrementalSearch() {
- if (okToUse(fIncrementalCheckBox)) {
- return fIncrementalCheckBox.getSelection();
- }
- return fIncrementalInit;
- }
-
- /**
- * Creates a button.
- * @param parent the parent control
- * @param key the key to lookup the button label
- * @param id the button id
- * @param dfltButton is this button the default button
- * @param listener a button pressed listener
- * @return teh new button
- */
- private Button makeButton(Composite parent, String key, int id, boolean dfltButton, SelectionListener listener) {
- String label= EditorMessages.getString(key);
- Button b= createButton(parent, id, label, dfltButton);
- b.addSelectionListener(listener);
- return b;
- }
-
- /**
- * Returns the status line manager of the active editor or <code>null</code> if there is no such editor.
- * @return the status line manager of the active editor
- */
- private IEditorStatusLine getStatusLineManager() {
- AbstractUIPlugin plugin= (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IWorkbenchWindow window= plugin.getWorkbench().getActiveWorkbenchWindow();
- if (window == null)
- return null;
-
- IWorkbenchPage page= window.getActivePage();
- if (page == null)
- return null;
-
- IEditorPart editor= page.getActiveEditor();
- if (editor == null)
- return null;
-
- return (IEditorStatusLine) editor.getAdapter(IEditorStatusLine.class);
- }
-
- /**
- * Sets the given error message in the status line.
- * @param message the error message
- */
- private void statusMessage(boolean error, String message) {
- fStatusLabel.setText(message);
-
- if (error)
- fStatusLabel.setForeground(JFaceColors.getErrorText(fStatusLabel.getDisplay()));
- else
- fStatusLabel.setForeground(null);
-
- IEditorStatusLine statusLine= getStatusLineManager();
- if (statusLine != null)
- statusLine.setMessage(error, message, null);
-
- if (error)
- getShell().getDisplay().beep();
- }
-
- /**
- * Sets the given error message in the status line.
- * @param message the message
- */
- private void statusError(String message) {
- statusMessage(true, message);
- }
-
- /**
- * Sets the given message in the status line.
- * @param message the message
- */
- private void statusMessage(String message) {
- statusMessage(false, message);
- }
-
- /**
- * Replaces all occurrences of the user's findString with
- * the replace string. Indicate to the user the number of replacements
- * that occur.
- */
- private void performReplaceAll() {
-
- int replaceCount= 0;
- final String replaceString= getReplaceString();
- final String findString= getFindString();
-
- if (findString != null && findString.length() > 0) {
-
- class ReplaceAllRunnable implements Runnable {
- public int numberOfOccurrences;
- public void run() {
- numberOfOccurrences= replaceAll(findString, replaceString == null ? "" : replaceString, isForwardSearch(), isCaseSensitiveSearch(), isWrapSearch(), isWholeWordSearch() && !isRegExSearchAvailableAndChecked(), isGlobalSearch(), isRegExSearchAvailableAndChecked()); //$NON-NLS-1$
- }
- }
-
- try {
- ReplaceAllRunnable runnable= new ReplaceAllRunnable();
- BusyIndicator.showWhile(fActiveShell.getDisplay(), runnable);
- replaceCount= runnable.numberOfOccurrences;
-
- if (replaceCount != 0) {
- if (replaceCount == 1) { // not plural
- statusMessage(EditorMessages.getString("FindReplace.Status.replacement.label")); //$NON-NLS-1$
- } else {
- String msg= EditorMessages.getString("FindReplace.Status.replacements.label"); //$NON-NLS-1$
- msg= MessageFormat.format(msg, new Object[] {String.valueOf(replaceCount)});
- statusMessage(msg);
- }
- } else {
- statusMessage(EditorMessages.getString("FindReplace.Status.noMatch.label")); //$NON-NLS-1$
- }
- } catch (PatternSyntaxException ex) {
- statusError(ex.getLocalizedMessage());
- } catch (IllegalStateException ex) {
- // we don't keep state in this dialog
- }
- }
- writeSelection();
- updateButtonState();
- }
-
- /**
- * Validates the state of the find/replace target.
- * @return <code>true</code> if target can be changed, <code>false</code> otherwise
- * @since 2.1
- */
- private boolean validateTargetState() {
-
- if (fTarget instanceof IFindReplaceTargetExtension2) {
- IFindReplaceTargetExtension2 extension= (IFindReplaceTargetExtension2) fTarget;
- if (!extension.validateTargetState()) {
- statusError(EditorMessages.getString("FindReplaceDialog.read_only")); //$NON-NLS-1$
- updateButtonState();
- return false;
- }
- }
- return isEditable();
- }
-
- /**
- * Replaces the current selection of the target with the user's
- * replace string.
- */
- private boolean performReplaceSelection() {
-
- if (!validateTargetState())
- return false;
-
- String replaceString= getReplaceString();
- if (replaceString == null)
- replaceString= ""; //$NON-NLS-1$
-
- boolean replaced;
- try {
- replaceSelection(replaceString, isRegExSearchAvailableAndChecked());
- replaced= true;
- writeSelection();
- } catch (PatternSyntaxException ex) {
- statusError(ex.getLocalizedMessage());
- replaced= false;
- } catch (IllegalStateException ex) {
- replaced= false;
- }
-
- updateButtonState();
- return replaced;
- }
-
- /**
- * Locates the user's findString in the text of the target.
- */
- private void performSearch() {
- performSearch(isIncrementalSearch() && !isRegExSearchAvailableAndChecked());
- }
-
- /**
- * Locates the user's findString in the text of the target.
- */
- private void performSearch(boolean mustInitIncrementalBaseLocation) {
-
- if (mustInitIncrementalBaseLocation)
- initIncrementalBaseLocation();
-
- String findString= getFindString();
-
- if (findString != null && findString.length() > 0) {
-
- try {
- boolean somethingFound= findNext(findString, isForwardSearch(), isCaseSensitiveSearch(), isWrapSearch(), isWholeWordSearch() && !isRegExSearchAvailableAndChecked(), isIncrementalSearch() && !isRegExSearchAvailableAndChecked(), isGlobalSearch(), isRegExSearchAvailableAndChecked());
- if (somethingFound) {
- statusMessage(""); //$NON-NLS-1$
- } else {
- statusMessage(EditorMessages.getString("FindReplace.Status.noMatch.label")); //$NON-NLS-1$
- }
- } catch (PatternSyntaxException ex) {
- statusError(ex.getLocalizedMessage());
- } catch (IllegalStateException ex) {
- // we don't keep state in this dialog
- }
- }
- writeSelection();
- updateButtonState();
- }
-
- /**
- * Replaces all occurrences of the user's findString with
- * the replace string. Returns the number of replacements
- * that occur.
- *
- * @param findString the string to search for
- * @param replaceString the replacement string
- * @param forwardSearch the search direction
- * @param caseSensitive should the search be case sensitive
- * @param wrapSearch should search wrap to start/end if end/start is reached
- * @param wholeWord does the search string represent a complete word
- * @param global is the search performed globally
- * @return the number of occurrences
- * @since 3.0
- */
- private int replaceAll(String findString, String replaceString, boolean forwardSearch, boolean caseSensitive, boolean wrapSearch, boolean wholeWord, boolean global, boolean regExSearch) {
-
- int replaceCount= 0;
- int findReplacePosition= 0;
-
- if (wrapSearch) { // search the whole text
- findReplacePosition= 0;
- forwardSearch= true;
- } else if (fTarget.getSelectionText() != null) {
- // the cursor is set to the end or beginning of the selected text
- Point selection= fTarget.getSelection();
- findReplacePosition= selection.x;
- }
-
- if (!validateTargetState())
- return replaceCount;
-
- if (fTarget instanceof IFindReplaceTargetExtension)
- ((IFindReplaceTargetExtension) fTarget).setReplaceAllMode(true);
-
- try {
- int index= 0;
- while (index != -1) {
- index= findAndSelect(findReplacePosition, findString, forwardSearch, caseSensitive, wholeWord, regExSearch);
- if (index != -1) { // substring not contained from current position
- replaceSelection(replaceString, regExSearch);
- replaceCount++;
-
- if (forwardSearch)
- findReplacePosition= index + replaceString.length();
- else {
- findReplacePosition= index - replaceString.length();
- if (findReplacePosition == -1)
- break;
- }
- }
- }
- } finally {
- if (fTarget instanceof IFindReplaceTargetExtension)
- ((IFindReplaceTargetExtension) fTarget).setReplaceAllMode(false);
- }
-
- return replaceCount;
- }
-
- // ------- ui creation ---------------------------------------
-
- /**
- * Attaches the given layout specification to the <code>component</code>.
- *
- * @param component the component
- * @param horizontalAlignment horizontal alignment
- * @param grabExcessHorizontalSpace grab excess horizontal space
- * @param verticalAlignment vertical alignment
- * @param grabExcessVerticalSpace grab excess vertical space
- */
- private void setGridData(Control component, int horizontalAlignment, boolean grabExcessHorizontalSpace, int verticalAlignment, boolean grabExcessVerticalSpace) {
- GridData gd= new GridData();
- gd.horizontalAlignment= horizontalAlignment;
- gd.grabExcessHorizontalSpace= grabExcessHorizontalSpace;
- gd.verticalAlignment= verticalAlignment;
- gd.grabExcessVerticalSpace= grabExcessVerticalSpace;
- component.setLayoutData(gd);
- }
-
- /**
- * Updates the enabled state of the buttons.
- */
- private void updateButtonState() {
- updateButtonState(false);
- }
-
- /**
- * Updates the enabled state of the buttons.
- */
- private void updateButtonState(boolean disableReplace) {
- if (okToUse(getShell()) && okToUse(fFindNextButton)) {
- String selectedText= null;
- if (fTarget != null) {
- selectedText= fTarget.getSelectionText();
- }
-
- boolean selection= (selectedText != null && selectedText.length() > 0);
-
- boolean enable= fTarget != null && (fActiveShell == fParentShell || fActiveShell == getShell());
- String str= getFindString();
- boolean findString= str != null && str.length() > 0 && (isRegExSearchAvailableAndChecked() || !isWholeWordSearch() || isWord(str));
-
- fFindNextButton.setEnabled(enable && findString);
- fReplaceSelectionButton.setEnabled(!disableReplace && enable && isEditable() && selection && (!fNeedsInitialFindBeforeReplace || !isRegExSearchAvailableAndChecked()));
- fReplaceFindButton.setEnabled(!disableReplace && enable && isEditable() && findString && selection && (!fNeedsInitialFindBeforeReplace || !isRegExSearchAvailableAndChecked()));
- fReplaceAllButton.setEnabled(enable && isEditable() && findString);
- }
- }
-
- /**
- * Tests whether each character in the given
- * string is a letter.
- *
- * @param str
- * @return <code>true</code> if the given string is a word
- * @since 3.0
- */
- private boolean isWord(String str) {
- if (str == null)
- return false;
-
- BreakIterator wordIterator= BreakIterator.getWordInstance();
- wordIterator.setText(str);
- int first= wordIterator.first();
- if (first > 0)
- return false;
- return wordIterator.next() == str.length();
- }
-
- /**
- * Updates the given combo with the given content.
- * @param combo combo to be updated
- * @param content to be put into the combo
- */
- private void updateCombo(Combo combo, List content) {
- combo.removeAll();
- for (int i= 0; i < content.size(); i++) {
- combo.add(content.get(i).toString());
- }
- }
-
- // ------- open / reopen ---------------------------------------
-
- /**
- * Called after executed find/replace action to update the history.
- */
- private void updateFindAndReplaceHistory() {
- updateFindHistory();
- if (okToUse(fReplaceField)) {
- updateHistory(fReplaceField, fReplaceHistory);
- }
-
- }
-
- /**
- * Called after executed find action to update the history.
- */
- private void updateFindHistory() {
- if (okToUse(fFindField)) {
- fFindField.removeModifyListener(fFindModifyListener);
- updateHistory(fFindField, fFindHistory);
- fFindField.addModifyListener(fFindModifyListener);
- }
- }
-
- /**
- * Updates the combo with the history.
- * @param combo to be updated
- * @param history to be put into the combo
- */
- private void updateHistory(Combo combo, List history) {
- String findString= combo.getText();
- int index= history.indexOf(findString);
- if (index != 0) {
- if (index != -1) {
- history.remove(index);
- }
- history.add(0, findString);
- updateCombo(combo, history);
- combo.setText(findString);
- }
- }
-
- /**
- * Returns whether the target is editable.
- * @return <code>true</code> if target is editable
- */
- private boolean isEditable() {
- boolean isEditable= (fTarget == null ? false : fTarget.isEditable());
- return fIsTargetEditable && isEditable;
- }
-
- /**
- * Updates this dialog because of a different target.
- * @param target the new target
- * @param isTargetEditable <code>true</code> if the new target can be modifed
- * @since 2.0
- */
- public void updateTarget(IFindReplaceTarget target, boolean isTargetEditable) {
-
- fIsTargetEditable= isTargetEditable;
- fNeedsInitialFindBeforeReplace= true;
-
- if (target != fTarget) {
- if (fTarget != null && fTarget instanceof IFindReplaceTargetExtension)
- ((IFindReplaceTargetExtension) fTarget).endSession();
-
- fTarget= target;
- if (target != null)
- fIsTargetSupportingRegEx= target instanceof IFindReplaceTargetExtension3;
-
- if (fTarget != null && fTarget instanceof IFindReplaceTargetExtension) {
- ((IFindReplaceTargetExtension) fTarget).beginSession();
-
- fGlobalInit= true;
- fGlobalRadioButton.setSelection(fGlobalInit);
- fSelectedRangeRadioButton.setSelection(!fGlobalInit);
- fUseSelectedLines= !fGlobalInit;
- }
- }
-
- if (okToUse(fIsRegExCheckBox))
- fIsRegExCheckBox.setEnabled(fIsTargetSupportingRegEx);
-
- if (okToUse(fWholeWordCheckBox))
- fWholeWordCheckBox.setEnabled(!isRegExSearchAvailableAndChecked());
-
- if (okToUse(fIncrementalCheckBox))
- fIncrementalCheckBox.setEnabled(!isRegExSearchAvailableAndChecked());
-
- if (okToUse(fReplaceLabel)) {
- fReplaceLabel.setEnabled(isEditable());
- fReplaceField.setEnabled(isEditable());
- initFindStringFromSelection();
- initIncrementalBaseLocation();
- updateButtonState();
- }
-
- fFindFieldContentAssistant.enableAutoActivation(isRegExSearchAvailableAndChecked());
- fReplaceFieldContentAssistant.enableAutoActivation(isRegExSearchAvailableAndChecked());
- }
-
- /**
- * Sets the parent shell of this dialog to be the given shell.
- *
- * @param shell the new parent shell
- */
- public void setParentShell(Shell shell) {
- if (shell != fParentShell) {
-
- if (fParentShell != null)
- fParentShell.removeShellListener(fActivationListener);
-
- fParentShell= shell;
- fParentShell.addShellListener(fActivationListener);
- }
-
- fActiveShell= shell;
- }
-
-
- //--------------- configuration handling --------------
-
- /**
- * Returns the dialog settings object used to share state
- * between several find/replace dialogs.
- *
- * @return the dialog settings to be used
- */
- private IDialogSettings getDialogSettings() {
- AbstractUIPlugin plugin= (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings settings= plugin.getDialogSettings();
- fDialogSettings= settings.getSection(getClass().getName());
- if (fDialogSettings == null)
- fDialogSettings= settings.addNewSection(getClass().getName());
- return fDialogSettings;
- }
-
- /**
- * Initializes itself from the dialog settings with the same state
- * as at the previous invocation.
- */
- private void readConfiguration() {
- IDialogSettings s= getDialogSettings();
-
- try {
- int x= s.getInt("x"); //$NON-NLS-1$
- int y= s.getInt("y"); //$NON-NLS-1$
- fLocation= new Point(x, y);
- } catch (NumberFormatException e) {
- fLocation= null;
- }
-
- fWrapInit= s.getBoolean("wrap"); //$NON-NLS-1$
- fCaseInit= s.getBoolean("casesensitive"); //$NON-NLS-1$
- fWholeWordInit= s.getBoolean("wholeword"); //$NON-NLS-1$
- fIncrementalInit= s.getBoolean("incremental"); //$NON-NLS-1$
- fIsRegExInit= s.getBoolean("isRegEx"); //$NON-NLS-1$
-
- String[] findHistory= s.getArray("findhistory"); //$NON-NLS-1$
- if (findHistory != null) {
- List history= getFindHistory();
- history.clear();
- for (int i= 0; i < findHistory.length; i++)
- history.add(findHistory[i]);
- }
-
- String[] replaceHistory= s.getArray("replacehistory"); //$NON-NLS-1$
- if (replaceHistory != null) {
- List history= getReplaceHistory();
- history.clear();
- for (int i= 0; i < replaceHistory.length; i++)
- history.add(replaceHistory[i]);
- }
- }
-
- /**
- * Stores its current configuration in the dialog store.
- */
- private void writeConfiguration() {
- IDialogSettings s= getDialogSettings();
-
- Point location= getShell().getLocation();
- s.put("x", location.x); //$NON-NLS-1$
- s.put("y", location.y); //$NON-NLS-1$
-
- s.put("wrap", fWrapInit); //$NON-NLS-1$
- s.put("casesensitive", fCaseInit); //$NON-NLS-1$
- s.put("wholeword", fWholeWordInit); //$NON-NLS-1$
- s.put("incremental", fIncrementalInit); //$NON-NLS-1$
- s.put("isRegEx", fIsRegExInit); //$NON-NLS-1$
- List history= getFindHistory();
- while (history.size() > 8)
- history.remove(8);
- String[] names= new String[history.size()];
- history.toArray(names);
- s.put("findhistory", names); //$NON-NLS-1$
-
- history= getReplaceHistory();
- while (history.size() > 8)
- history.remove(8);
- names= new String[history.size()];
- history.toArray(names);
- s.put("replacehistory", names); //$NON-NLS-1$
- }
-
- // ------------- content assistant -----------------
-
- private ContentAssistant createContentAssistant(final Combo combo) {
- final ContentAssistant contentAssistant= new ContentAssistant();
-
- IContentAssistProcessor processor= new RegExContentAssistProcessor();
- contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
-
- contentAssistant.enableAutoActivation(isRegExSearchAvailableAndChecked());
- contentAssistant.setProposalSelectorBackground(fProposalPopupBackgroundColor);
- contentAssistant.setProposalSelectorForeground(fProposalPopupForegroundColor);
-
- contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
- contentAssistant.setInformationControlCreator(new IInformationControlCreator() {
- /*
- * @see org.eclipse.jface.text.IInformationControlCreator#createInformationControl(org.eclipse.swt.widgets.Shell)
- */
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent);
- }});
-
- combo.addKeyListener(new KeyAdapter() {
- /*
- * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
- */
- public void keyReleased(KeyEvent e) {
- if (!isRegExSearchAvailableAndChecked())
- return;
-
- // FIXME: should get key binding from manager but this is either not yet API or net yet implemented
-// ICommandManager cm= ((Workbench)PlatformUI.getWorkbench()).getCommandManager();
-// ICommand command= cm.getCommand(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
-// command.getKeyBindings();
-// System.out.println("pressed");
-
- if (e.character == ' ' && e.stateMask == SWT.CTRL) {
- int i= combo.getSelection().y;
- String text= combo.getText();
- String newText= ""; //$NON-NLS-1$
- if (i > 0)
- newText= text.substring(0, i - 1);
- if (i < text.length())
- newText= newText + text.substring(i);
- combo.setText(newText);
- i= Math.max(0, i - 1);
- combo.setSelection(new Point(i, i));
- String errorMessge= contentAssistant.showPossibleCompletions();
- if (errorMessge != null)
- statusError(errorMessge);
- }
-
- }});
- contentAssistant.install(new ComboContentAssistSubjectAdapter(combo));
- return contentAssistant;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceTarget.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceTarget.java
deleted file mode 100644
index 9a474acf6f8..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceTarget.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-
-import org.eclipse.jface.text.IFindReplaceTarget;
-import org.eclipse.jface.text.IFindReplaceTargetExtension;
-import org.eclipse.jface.text.IFindReplaceTargetExtension3;
-import org.eclipse.jface.text.IRegion;
-
-/**
- * Internal find/replace target wrapping the editor's source viewer.
- * @since 2.1
- */
-class FindReplaceTarget implements IFindReplaceTarget, IFindReplaceTargetExtension, IFindReplaceTargetExtension2, IFindReplaceTargetExtension3 {
-
- /** The editor */
- private AbstractTextEditor fEditor;
- /** The find/replace target */
- private IFindReplaceTarget fTarget;
-
- /**
- * Creates a new find/replace target.
- *
- * @param editor the editor
- * @param target the wrapped find/replace target
- */
- public FindReplaceTarget(AbstractTextEditor editor, IFindReplaceTarget target) {
- fEditor= editor;
- fTarget= target;
- }
-
- /**
- * Returns the wrapped find/replace target.
- *
- * @return the wrapped find/replace target
- */
- private IFindReplaceTarget getTarget() {
- return fTarget;
- }
-
- /**
- * Returns the find/replace target extension.
- *
- * @return the find/replace target extension
- */
- private IFindReplaceTargetExtension getExtension() {
- if (fTarget instanceof IFindReplaceTargetExtension)
- return (IFindReplaceTargetExtension) fTarget;
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTarget#canPerformFind()
- */
- public boolean canPerformFind() {
- if (getTarget() != null)
- return getTarget().canPerformFind();
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTarget#findAndSelect(int, java.lang.String, boolean, boolean, boolean)
- */
- public int findAndSelect(int offset, String findString, boolean searchForward, boolean caseSensitive, boolean wholeWord) {
- if (getTarget() != null)
- return getTarget().findAndSelect(offset, findString, searchForward, caseSensitive, wholeWord);
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTargetExtension3#findAndSelect(int, String, boolean, boolean, boolean, boolean)
- */
- public int findAndSelect(int offset, String findString, boolean searchForward, boolean caseSensitive, boolean wholeWord, boolean regExSearch) {
- if (getTarget() instanceof IFindReplaceTargetExtension3)
- return ((IFindReplaceTargetExtension3)getTarget()).findAndSelect(offset, findString, searchForward, caseSensitive, wholeWord, regExSearch);
-
- // fallback
- if (!regExSearch && getTarget() != null)
- return getTarget().findAndSelect(offset, findString, searchForward, caseSensitive, wholeWord);
-
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTarget#getSelection()
- */
- public Point getSelection() {
- if (getTarget() != null)
- return getTarget().getSelection();
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTarget#getSelectionText()
- */
- public String getSelectionText() {
- if (getTarget() != null)
- return getTarget().getSelectionText();
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTarget#isEditable()
- */
- public boolean isEditable() {
- if (getTarget() != null) {
- if (getTarget().isEditable())
- return true;
- return fEditor.isEditorInputModifiable();
- }
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTarget#replaceSelection(java.lang.String)
- */
- public void replaceSelection(String text) {
- if (getTarget() != null)
- getTarget().replaceSelection(text);
- }
-
- /**
- * @see org.eclipse.jface.text.IFindReplaceTargetExtension3#replaceSelection(String, boolean)
- */
- public void replaceSelection(String text, boolean regExReplace) {
- if (getTarget() instanceof IFindReplaceTargetExtension3) {
- ((IFindReplaceTargetExtension3)getTarget()).replaceSelection(text, regExReplace);
- return;
- }
-
- // fallback
- if (!regExReplace && getTarget() != null)
- getTarget().replaceSelection(text);
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTargetExtension#beginSession()
- */
- public void beginSession() {
- if (getExtension() != null)
- getExtension().beginSession();
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTargetExtension#endSession()
- */
- public void endSession() {
- if (getExtension() != null)
- getExtension().endSession();
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTargetExtension#getScope()
- */
- public IRegion getScope() {
- if (getExtension() != null)
- return getExtension().getScope();
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTargetExtension#setScope(org.eclipse.jface.text.IRegion)
- */
- public void setScope(IRegion scope) {
- if (getExtension() != null)
- getExtension().setScope(scope);
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTargetExtension#getLineSelection()
- */
- public Point getLineSelection() {
- if (getExtension() != null)
- return getExtension().getLineSelection();
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTargetExtension#setSelection(int, int)
- */
- public void setSelection(int offset, int length) {
- if (getExtension() != null)
- getExtension().setSelection(offset, length);
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTargetExtension#setScopeHighlightColor(org.eclipse.swt.graphics.Color)
- */
- public void setScopeHighlightColor(Color color) {
- if (getExtension() != null)
- getExtension().setScopeHighlightColor(color);
- }
-
- /*
- * @see org.eclipse.jface.text.IFindReplaceTargetExtension#setReplaceAllMode(boolean)
- */
- public void setReplaceAllMode(boolean replaceAll) {
- if (getExtension() != null)
- getExtension().setReplaceAllMode(replaceAll);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IFindReplaceTargetExtension2#validateTargetState()
- */
- public boolean validateTargetState() {
- return fEditor.validateEditorInputState();
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java
deleted file mode 100644
index 4daba4ffb4e..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.window.Window;
-
-import org.eclipse.ui.IWorkbenchPage;
-
-
-/**
- * Action for jumping to a particular line if the editor's text viewer.
- * The user is requested to enter the line number into an input dialog.
- * The action is initially associated with a text editor via the constructor,
- * but that can be subsequently changed using <code>setEditor</code>.
- * <p>
- * The following keys, prepended by the given option prefix,
- * are used for retrieving resources from the given bundle:
- * <ul>
- * <li><code>"dialog.invalid_range"</code> - to indicate an invalid line number</li>
- * <li><code>"dialog.invalid_input"</code> - to indicate an invalid line number format</li>
- * <li><code>"dialog.title"</code> - the input dialog's title</li>
- * <li><code>"dialog.message"</code> - the input dialog's message</li>
- * </ul>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class GotoLineAction extends TextEditorAction {
-
- /**
- * Validates whether the text found in the input field of the
- * dialog forms a valid line number. A number is valid if it is
- * one to which can be jumped.
- */
- class NumberValidator implements IInputValidator {
-
- /*
- * @see IInputValidator#isValid(String)
- */
- public String isValid(String input) {
-
- if (input == null || input.length() == 0)
- return " "; //$NON-NLS-1$
-
- try {
- int i= Integer.parseInt(input);
- if (i <= 0 || fLastLine < i)
- return fBundle.getString(fPrefix + "dialog.invalid_range"); //$NON-NLS-1$
-
- } catch (NumberFormatException x) {
- return fBundle.getString(fPrefix + "dialog.invalid_input"); //$NON-NLS-1$
- }
-
- return null;
- }
- }
-
- /**
- * Standard input dialog which additionally sets the focus to the
- * text input field. Workaround for <code>InputDialog</code> issue.
- * 1GIJZOO: ITPSRCEDIT:ALL - Gotodialog's edit field has no initial focus
- * @since 2.0
- */
- class GotoLineDialog extends InputDialog {
-
- /*
- * @see InputDialog#InputDialog(org.eclipse.swt.widgets.Shell, java.lang.String, java.lang.String, java.lang.String, org.eclipse.jface.dialogs.IInputValidator)
- */
- public GotoLineDialog(Shell parent, String title, String message, String initialValue, IInputValidator validator) {
- super(parent, title, message, initialValue, validator);
- }
-
- /*
- * @see InputDialog#createDialogArea(Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Control result= super.createDialogArea(parent);
- getText().setFocus();
- applyDialogFont(result);
- return result;
- }
- }
-
- /** The biggest valid line number of the presented document */
- private int fLastLine;
- /** This action's resource bundle */
- private ResourceBundle fBundle;
- /** This action's prefix used for accessing the resource bundle */
- private String fPrefix;
-
- /**
- * Creates a new action for the given text editor. The action configures its
- * visual representation from the given resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param editor the text editor
- * @see ResourceAction#ResourceAction
- */
- public GotoLineAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
- super(bundle, prefix, editor);
- fBundle= bundle;
- fPrefix= prefix;
- }
-
- /**
- * Jumps to the given line.
- *
- * @param line the line to jump to
- */
- private void gotoLine(int line) {
-
- ITextEditor editor= getTextEditor();
-
- IDocumentProvider provider= editor.getDocumentProvider();
- IDocument document= provider.getDocument(editor.getEditorInput());
- try {
-
- int start= document.getLineOffset(line);
- editor.selectAndReveal(start, 0);
-
- IWorkbenchPage page= editor.getSite().getPage();
- page.activate(editor);
-
- } catch (BadLocationException x) {
- // ignore
- }
- }
-
- /*
- * @see Action#run()
- */
- public void run() {
- try {
-
- ITextEditor editor= getTextEditor();
-
- if (editor == null)
- return;
-
- IDocumentProvider docProvider= editor.getDocumentProvider();
- if (docProvider == null)
- return;
-
- IDocument document= docProvider.getDocument(editor.getEditorInput());
- if (document == null)
- return;
-
- fLastLine= document.getLineOfOffset(document.getLength()) + 1;
-
- String title= fBundle.getString(fPrefix + "dialog.title"); //$NON-NLS-1$
- String message= MessageFormat.format(fBundle.getString(fPrefix + "dialog.message"), new Object[] {new Integer(fLastLine)}); //$NON-NLS-1$
-
- GotoLineDialog d= new GotoLineDialog(editor.getSite().getShell(), title, message, "", new NumberValidator()); //$NON-NLS-1$
- if (d.open() == Window.OK) {
- try {
- int line= Integer.parseInt(d.getValue());
- gotoLine(line - 1);
- } catch (NumberFormatException x) {
- }
- }
-
- } catch (BadLocationException x) {
- }
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAbstractTextEditorHelpContextIds.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAbstractTextEditorHelpContextIds.java
deleted file mode 100644
index 6d7c7b8463a..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAbstractTextEditorHelpContextIds.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.ui.texteditor;
-
-
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * Help context ids for the text editor.
- * <p>
- * This interface contains constants only; it is not intended to be implemented.
- * </p>
- */
-public interface IAbstractTextEditorHelpContextIds {
-
- /**
- * The string with which all other defined ids are prefixed to construct help context ids.
- * Value: <code>"org.eclipse.ui."</code>
- */
- public static final String PREFIX= PlatformUI.PLUGIN_ID + "."; //$NON-NLS-1$
-
- /**
- * The string which is appended to action ids to construct help context ids.
- * Value: <code>"_action_context"</code>
- */
- public static final String ACTION_POSTFIX= "_action_context"; //$NON-NLS-1$
-
-
-
-
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.undo_action_context"</code>
- */
- public static final String UNDO_ACTION= PREFIX + ITextEditorActionConstants.UNDO + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.redo_action_context"</code>
- */
- public static final String REDO_ACTION= PREFIX + ITextEditorActionConstants.REDO + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.cut_action_context"</code>
- */
- public static final String CUT_ACTION= PREFIX + ITextEditorActionConstants.CUT + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.copy_action_context"</code>
- */
- public static final String COPY_ACTION= PREFIX + ITextEditorActionConstants.COPY + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.paste_action_context"</code>
- */
- public static final String PASTE_ACTION= PREFIX + ITextEditorActionConstants.PASTE + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.delete_action_context"</code>
- */
- public static final String DELETE_ACTION= PREFIX + ITextEditorActionConstants.DELETE + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.DeleteLine_action_context"</code>
- * @since 2.0
- */
- public static final String DELETE_LINE_ACTION= PREFIX + ITextEditorActionConstants.DELETE_LINE + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.CutLine_action_context"</code>
- * @since 2.1
- */
- public static final String CUT_LINE_ACTION= PREFIX + ITextEditorActionConstants.CUT_LINE + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.DeleteLineToBeginning_action_context"</code>
- * @since 2.0
- */
- public static final String DELETE_LINE_TO_BEGINNING_ACTION= PREFIX + ITextEditorActionConstants.DELETE_LINE_TO_BEGINNING + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.CutLineToBeginning_action_context"</code>
- * @since 2.1
- */
- public static final String CUT_LINE_TO_BEGINNING_ACTION= PREFIX + ITextEditorActionConstants.CUT_LINE_TO_BEGINNING + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.DeleteLineToEnd_action_context"</code>
- * @since 2.0
- */
- public static final String DELETE_LINE_TO_END_ACTION= PREFIX + ITextEditorActionConstants.DELETE_LINE_TO_END + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.CutLineToEnd_action_context"</code>
- * @since 2.1
- */
- public static final String CUT_LINE_TO_END_ACTION= PREFIX + ITextEditorActionConstants.CUT_LINE_TO_END + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.SetMark_action_context"</code>
- * @since 2.0
- */
- public static final String SET_MARK_ACTION= PREFIX + ITextEditorActionConstants.SET_MARK + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.ClearMark_action_context"</code>
- * @since 2.0
- */
- public static final String CLEAR_MARK_ACTION= PREFIX + ITextEditorActionConstants.CLEAR_MARK + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.SwapMark_action_context"</code>
- * @since 2.0
- */
- public static final String SWAP_MARK_ACTION= PREFIX + ITextEditorActionConstants.SWAP_MARK + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.selectAll_action_context"</code>
- */
- public static final String SELECT_ALL_ACTION= PREFIX + ITextEditorActionConstants.SELECT_ALL + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.ShiftRight_action_context"</code>
- */
- public static final String SHIFT_RIGHT_ACTION= PREFIX + ITextEditorActionConstants.SHIFT_RIGHT + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.ShiftLeft_action_context"</code>
- */
- public static final String SHIFT_LEFT_ACTION= PREFIX + ITextEditorActionConstants.SHIFT_LEFT + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.find_action_context"</code>
- */
- public static final String FIND_ACTION= PREFIX + ITextEditorActionConstants.FIND + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.FindNext_action_context"</code>
- * @since 2.0
- */
- public static final String FIND_NEXT_ACTION= PREFIX + ITextEditorActionConstants.FIND_NEXT + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.FindPrevious_action_context"</code>
- * @since 2.0
- */
- public static final String FIND_PREVIOUS_ACTION= PREFIX + ITextEditorActionConstants.FIND_PREVIOUS + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.FindIncremental_action_context"</code>
- * @since 2.0
- */
- public static final String FIND_INCREMENTAL_ACTION= PREFIX + ITextEditorActionConstants.FIND_INCREMENTAL + ACTION_POSTFIX;
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.FindIncrementalReverse_action_context"</code>
- * @since 2.1
- */
- public static final String FIND_INCREMENTAL_REVERSE_ACTION= PREFIX + ITextEditorActionConstants.FIND_INCREMENTAL_REVERSE + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.bookmark_action_context"</code>
- * @deprecated in 3.0 Use <code>org.eclipse.ui.texteditor.ITextEditorHelpContextIds.BOOKMARK_ACTION</code> instead.
- */
- public static final String BOOKMARK_ACTION= PREFIX + ITextEditorActionConstants.BOOKMARK + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.addTask_action_context"</code>
- * @deprecated in 3.0 Use <code>org.eclipse.ui.texteditor.ITextEditorHelpContextIds.ADD_TASK_ACTION</code> instead.
- */
- public static final String ADD_TASK_ACTION= PREFIX + ITextEditorActionConstants.ADD_TASK + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.save_action_context"</code>
- */
- public static final String SAVE_ACTION= PREFIX + ITextEditorActionConstants.SAVE + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.revert_action_context"</code>
- */
- public static final String REVERT_TO_SAVED_ACTION= PREFIX + ITextEditorActionConstants.REVERT_TO_SAVED + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.GotoLine_action_context"</code>
- */
- public static final String GOTO_LINE_ACTION= PREFIX + ITextEditorActionConstants.GOTO_LINE + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.print_action_context"</code>
- */
- public static final String PRINT_ACTION= PREFIX + ITextEditorActionConstants.PRINT + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.ConvertLineDelimitersToWindows_action_context"</code>
- * @since 2.0
- */
- public static final String CONVERT_LINE_DELIMITERS_TO_WINDOWS= PREFIX + ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_WINDOWS + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.ConvertLineDelimitersToUNIX_action_context"</code>
- * @since 2.0
- */
- public static final String CONVERT_LINE_DELIMITERS_TO_UNIX= PREFIX + ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_UNIX + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.ConvertLineDelimitersToMAC_action_context"</code>
- * @since 2.0
- */
- public static final String CONVERT_LINE_DELIMITERS_TO_MAC= PREFIX + ITextEditorActionConstants.CONVERT_LINE_DELIMITERS_TO_MAC + ACTION_POSTFIX;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.find_replace_dialog_context"</code>
- */
- public static final String FIND_REPLACE_DIALOG= PREFIX + "find_replace_dialog_context"; //$NON-NLS-1$
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.goto_last_edit_position_action_context"</code>
- * @since 2.1
- */
- public static final String GOTO_LAST_EDIT_POSITION_ACTION= PREFIX + "goto_last_edit_position" + ACTION_POSTFIX; //$NON-NLS-1$
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.move_lines_action_context"</code>
- * @since 3.0
- */
- public static final String MOVE_LINES_ACTION= PREFIX + "move_lines" + ACTION_POSTFIX; //$NON-NLS-1$
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.copy_lines_action_context"</code>
- * @since 3.0
- */
- public static final String COPY_LINES_ACTION= PREFIX + "copy_lines" + ACTION_POSTFIX; //$NON-NLS-1$;
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.upper_case_action_context"</code>
- * @since 3.0
- */
- public static final String UPPER_CASE_ACTION= PREFIX + "upper_case" + ACTION_POSTFIX; //$NON-NLS-1$
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.lower_case_action_context"</code>
- * @since 3.0
- */
- public static final String LOWER_CASE_ACTION= PREFIX + "lower_case" + ACTION_POSTFIX; //$NON-NLS-1$
-
- /**
- * Help context id for the action.
- * Value: <code>"org.eclipse.ui.smart_enter_action_context"</code>
- * @since 3.0
- */
- public static final String SMART_ENTER_ACTION= PREFIX + "smart_enter" + ACTION_POSTFIX; //$NON-NLS-1$;
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAnnotationImageProvider.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAnnotationImageProvider.java
deleted file mode 100644
index 03757bf0039..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAnnotationImageProvider.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.texteditor;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.jface.text.source.Annotation;
-
-/**
- * Provides an image for a given annotation.
- *
- * @since 3.0
- */
-public interface IAnnotationImageProvider {
-
- /**
- * Returns the image for the given annotation or <code>null</code>. The
- * returned image is managed by this annotation image provided. If the
- * annotation image provider does not support managed images, clients have
- * to manage the annotation images. For that, clients first ask for the
- * image descriptor id for a given annotation (<code>getImageDescriptorId(Annotation)</code>)
- * as then for the image descriptor. The image descriptor id should be used
- * to manage the annotation images using an <code>ImageRegistry</code>.
- *
- * @param annotation the annotation
- * @return the managed image
- */
- Image getManagedImage(Annotation annotation);
-
- /**
- * Returns the image descriptor id of the image for the given annotation.
- *
- * @param annotation the annotation
- * @return the image descriptor id
- */
- String getImageDescriptorId(Annotation annotation);
-
- /**
- * Returns the image descriptor for the given symbolic name.
- *
- * @param imageDescritporId the image descriptor id
- * @return the image descriptor
- */
- ImageDescriptor getImageDescriptor(String imageDescritporId);
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProvider.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProvider.java
deleted file mode 100644
index bfd20bc007e..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProvider.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.texteditor;
-
-
-
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.IAnnotationModel;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-
-
-/**
- * A document provider maps between domain elements and documents.
- * A document provider has the following responsibilities:
- * <ul>
- * <li> create an annotation model of a domain model element
- * <li> create and manage a textual representation, i.e., a document, of a domain model element
- * <li> create and save the content of domain model elements based on given documents
- * <li> update the documents this document provider manages for domain model elements
- * to changes directly applied to those domain model elements
- * <li> notify all element state listeners about changes directly applied to domain model
- * elements this document provider manages a document for, i.e. the document
- * provider must know which changes of a domain model element are to be interpreted
- * as element moves, deletes, etc.
- * </ul>
- * Text editors use document providers to bridge the gap between their input elements and the
- * documents they work on. A single document provider may be shared between multiple editors;
- * the methods take the editors' input elements as a parameter.
- * <p>
- * This interface may be implemented by clients; or subclass the standard
- * abstract base class <code>AbstractDocumentProvider</code>.</p>
- *
- * @see org.eclipse.jface.text.IDocument
- * @see org.eclipse.ui.texteditor.AbstractDocumentProvider
- */
-public interface IDocumentProvider {
-
- /**
- * Connects the given element to this document provider. This tells the provider
- * that caller of this method is interested to work with the document provided for
- * the given domain model element. By counting the invocations of this method and
- * <code>disconnect(Object)</code> this provider can assume to know the
- * correct number of clients working with the document provided for that
- * domain model element. <p>
- * The given element must not be <code>null</code>.
- *
- * @param element the element
- * @exception CoreException if the textual representation or the annotation model
- * of the element could not be created
- */
- void connect(Object element) throws CoreException;
-
- /**
- * Disconnects the given element from this document provider. This tells the provider
- * that the caller of this method is no longer interested in working with the document
- * provided for the given domain model element. By counting the invocations of
- * <code>connect(Object)</code> and of this method this provider can assume to
- * know the correct number of clients working with the document provided for that
- * domain model element. <p>
- * The given element must not be <code>null</code>.
- *
- * @param element the element
- */
- void disconnect(Object element);
-
- /**
- * Returns the document for the given element. Usually the document contains
- * a textual presentation of the content of the element, or is the element itself.
- *
- * @param element the element, or <code>null</code>
- * @return the document, or <code>null</code> if none
- */
- IDocument getDocument(Object element);
-
- /**
- * Resets the given element's document to its last saved state.
- * Element state listeners are notified both before (<code>elementContentAboutToBeReplaced</code>)
- * and after (<code>elementContentReplaced</code>) the content is changed.
- *
- * @param element the element, or <code>null</code>
- */
- void resetDocument(Object element) throws CoreException;
-
- /**
- * Saves the given document provided for the given element.
- *
- * @param monitor a progress monitor to report progress and request cancelation
- * @param element the element, or <code>null</code>
- * @param document the document
- * @param overwrite indicates whether overwrite should be performed
- * while saving the given element if necessary
- * @exception CoreException if document could not be stored to the given element
- */
- void saveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException;
-
- /**
- * Returns the modification stamp of the given element.
- *
- * @param element the element
- * @return the modification stamp of the given element
- */
- long getModificationStamp(Object element);
-
- /**
- * Returns the time stamp of the last synchronization of
- * the given element and it's provided document.
- *
- * @param element the element
- * @return the sysnchronization stamp of the given element
- */
- long getSynchronizationStamp(Object element);
-
- /**
- * Returns whether the given element has been deleted.
- *
- * @param element the element
- * @return <code>true</code> if the element has been deleted
- */
- boolean isDeleted(Object element);
-
- /**
- * Returns whether the document provided for the given element must be saved.
- *
- * @param element the element, or <code>null</code>
- * @return <code>true</code> if the document must be saved, and
- * <code>false</code> otherwise (including the element is <code>null</code>)
- */
- boolean mustSaveDocument(Object element);
-
- /**
- * Returns whether the document provided for the given element differs from
- * its original state which would required that it be saved.
- *
- * @param element the element, or <code>null</code>
- * @return <code>true</code> if the document can be saved, and
- * <code>false</code> otherwise (including the element is <code>null</code>)
- */
- boolean canSaveDocument(Object element);
-
- /**
- * Returns the annotation model for the given element.
- *
- * @param element the element, or <code>null</code>
- * @return the annotation model, or <code>null</code> if none
- */
- IAnnotationModel getAnnotationModel(Object element);
-
- /**
- * Informs this document provider about upcoming changes of the given element.
- * The changes might cause change notifications specific for the type of the given element.
- * If this provider manages a document for the given element, the document provider
- * must not change the document because of the notifications received after <code>
- * aboutToChange</code> has been and before <code>changed</code> is called. In this case,
- * it is assumed that the document is already up to date, e.g., a save operation is a
- * typical case. <p>
- * The concrete nature of the change notification depends on the concrete type of the
- * given element. If the element is, e.g., an <code>IResource</code> the notification
- * is a resource delta.
- *
- * @param element the element, or <code>null</code>
- */
- void aboutToChange(Object element);
-
- /**
- * Informs this document provider that the given element has been changed.
- * All notifications have been sent out. If this provider manages a document
- * for the given element, the document provider must from now on change the
- * document on the receipt of change notifications. The concrete nature of the change
- * notification depends on the concrete type of the given element. If the element is,
- * e.g., an <code>IResource</code> the notification is a resource delta.
- *
- * @param element the element, or <code>null</code>
- */
- void changed(Object element);
-
- /**
- * Adds the given element state listener to this document provider.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the listener
- */
- void addElementStateListener(IElementStateListener listener);
-
- /**
- * Removes the given element state listener from this document provider.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener the listener
- */
- void removeElementStateListener(IElementStateListener listener);
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension.java
deleted file mode 100644
index bc28f1d8893..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension.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.texteditor;
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-
-
-/**
- * Extension interface for <code>IDocumentProvider</code>. It adds the following
- * functions:
- * <ul>
- * <li> dealing with immutable domain elements
- * <li> state validation
- * <li> persistent status of domain element operations
- * <li> extended synchronization support
- * </ul>
- * @since 2.0
- */
-public interface IDocumentProviderExtension {
-
- /**
- * Returns whether the document provider thinks that the given element is read-only.
- * If this method returns <code>true</code>, <code>saveDocument</code> could fail.
- * This method does not say anything about the document constructed from the given
- * element. If the given element is not connected to this document provider, the return
- * value is undefined. Document providers are allowed to use a cache to answer this
- * question, i.e. there can be a difference between the "real" state of the element and
- * the return value.
- *
- * @param element the element
- * @return <code>true</code> if the given element is read-only, <code>false</code> otherwise
- */
- boolean isReadOnly(Object element);
-
- /**
- * Returns whether the document provider thinks that the given element can persistently be modified.
- * This is orthogonal to <code>isReadOnly</code> as read-only elements may be modifiable and
- * writable elements may not be modifiable. If the given element is not connected to this document
- * provider, the result is undefined. Document providers are allowed to use a cache to answer this
- * question, i.e. there can be a difference between the "real" state of the element and the return
- * value.
- *
- * @param element the element
- * @return <code>true</code> if the given element is modifiable, <code>false</code> otherwise
- */
- boolean isModifiable(Object element);
-
- /**
- * Validates the state of the given element. This method may change the "real" state of the
- * element. If using, it also updates the internal caches, so that this method may also change
- * the results returned by <code>isReadOnly</code> and <code>isModifiable</code>. If the
- * given element is not connected to this document provider, the effect is undefined.
- *
- * @param element the element
- * @param computationContext the context in which the computation is performed, e.g., a SWT shell
- * @exception CoreException if validating fails
- */
- void validateState(Object element, Object computationContext) throws CoreException;
-
- /**
- * Returns whether the state of the given element has been validated.
- *
- * @param element the element
- * @return <code>true</code> if the state has been validated
- */
- boolean isStateValidated(Object element);
-
- /**
- * Updates the state cache for the given element. This method may change the result returned
- * by <code>isReadOnly</code> and <code>isModifiable</code>. If the given element is not
- * connected to this document provider, the effect is undefined.
- *
- * @param element the element
- * @exception CoreException if validating fails
- */
- void updateStateCache(Object element) throws CoreException;
-
- /**
- * Marks the document managed for the given element as saveable. I.e.
- * <code>canBeSaved(element)</code> will return <code>true</code>
- * afterwards.
- *
- * @param element the element
- */
- void setCanSaveDocument(Object element);
-
- /**
- * Returns the status of the given element.
- *
- * @param element the element
- * @return the status of the given element
- */
- IStatus getStatus(Object element);
-
- /**
- * Synchronizes the document provided for the given element with the
- * given element. After that call <code>getSynchronizationTimeStamp</code>
- * and <code>getModificationTimeStamp</code> return the same value.
- *
- * @param element the element
- * @exception CoreException if the synchronization could not be performed
- */
- void synchronize(Object element) throws CoreException;
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension2.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension2.java
deleted file mode 100644
index ee971782ea9..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension2.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.texteditor;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * Extension interface for <code>IDocumentProvider</code>. It adds the following
- * functions:
- * <ul>
- * <li> global temporary progress monitor
- * </ul>
- * @since 2.1
- */
-public interface IDocumentProviderExtension2 {
-
- /**
- * Sets this providers progress monitor.
- * @param progressMonitor
- */
- void setProgressMonitor(IProgressMonitor progressMonitor);
-
- /**
- * Returns this providers progress monitor.
- * @return IProgressMonitor
- */
- IProgressMonitor getProgressMonitor();
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension3.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension3.java
deleted file mode 100644
index bed36022782..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension3.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2003 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.ui.texteditor;
-
-
-/**
- * Extension interface to <code>IDocumentProvider</code>. The method
- * <code>isSynchronized</code> replaces the original <code>getSynchronizationStamp</code> method.
- *
- * @since 3.0
- */
-public interface IDocumentProviderExtension3 {
-
- /**
- * Returns whether the information provided for the given element is in sync with the element.
- *
- * @param element the element
- * @return <code>true</code> if the information is in sync with the element, <code>false</code> otherwise
- */
- boolean isSynchronized(Object element);
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IEditorStatusLine.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IEditorStatusLine.java
deleted file mode 100644
index 24b3c886f34..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IEditorStatusLine.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.texteditor;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * An interface to use the status line of an editor.
- *
- * @since 2.1
- */
-public interface IEditorStatusLine {
- /**
- * Sets the image and message to be displayed on the status line.
- * <p>
- * The error flag indicates that the message is an error message.
- * If the error flag is set, a potential non-error message is overridden.
- * If the error message is <code>null</code>, the non-error message is displayed.
- * </p>
- *
- * @param error indicates that the message is an error message
- * @param message the message to set (may be <code>null</code> to clear the message)
- * @param image the image to set (may be <code>null</code> to clear the image)
- */
- void setMessage(boolean error, String message, Image image);
-
-} \ No newline at end of file
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IElementStateListener.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IElementStateListener.java
deleted file mode 100644
index f9cb3adf540..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IElementStateListener.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.texteditor;
-
-
-/**
- * Interface for parties interested in standardized element changes. These
- * changes are:
- * <ul>
- * <li> dirty state changes
- * <li> content replacements
- * <li> moves
- * <li> deletions
- * </ul>
- * The notifications sent to the element state listeners inform about those standardized,
- * abstract changes. The concrete change applied might differ from the one the listeners
- * are notified about, but should be interpreted as the one the listeners receive.
- */
-public interface IElementStateListener {
-
- /**
- * Notifies that the dirty state of the given element has changed.
- *
- * @param element the element
- * @param isDirty the new dirty state
- */
- void elementDirtyStateChanged(Object element, boolean isDirty);
-
- /**
- * Notifies that the content of the given element is about to be replaced.
- *
- * @param element the element
- */
- void elementContentAboutToBeReplaced(Object element);
-
- /**
- * Notifies that the content of the given element has been replaced.
- *
- * @param element the element
- */
- void elementContentReplaced(Object element);
-
- /**
- * Notifies that the given element has been deleted.
- *
- * @param element the element
- */
- void elementDeleted(Object element);
-
- /**
- * Notifies that the element has moved. If <code>movedElement</code>
- * is <code>null</code> it is similar to <code>elementDeleted(originalElement)</code>.
- *
- * @param originalElement the element before the move
- * @param movedElement the element after the move
- */
- void elementMoved(Object originalElement, Object movedElement);
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IElementStateListenerExtension.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IElementStateListenerExtension.java
deleted file mode 100644
index 7724b5062f2..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IElementStateListenerExtension.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.texteditor;
-
-/**
- * Extension interface for <code>IElementStateListener</code>.
- * It adds
- * <ul>
- * <li> state validation notification
- * <li>a notion of session, i.e. a notification about an upcoming element change and error handling.
- * </ul>
- * @since 2.0
- */
-public interface IElementStateListenerExtension {
-
- /**
- * Notifies that the state validation of the given element has changed.
- *
- * @param element the element
- * @param isStateValidated the flag indicating whether state validation is done
- */
- void elementStateValidationChanged(Object element, boolean isStateValidated);
-
- /**
- * Notifies that the given element is currently being changed. This method may
- * be sent from a non-ui thread.
- *
- * @param element the element
- */
- void elementStateChanging(Object element);
-
- /**
- * Notifies that changing the given element has failed.
- *
- * @param element the element
- */
- void elementStateChangeFailed(Object element);
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IFindReplaceTargetExtension2.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IFindReplaceTargetExtension2.java
deleted file mode 100644
index db53a4dea6a..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IFindReplaceTargetExtension2.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.texteditor;
-
-/**
- * Extension interface for <code>IFindReplaceTarget</code>. Extends the find replace target with
- * the concept of state validation.
- *
- * @since 2.1
- */
-public interface IFindReplaceTargetExtension2 {
-
- /**
- * Validates the state of this target. The predominate intent of this method
- * is to take any action propably necessary to ensure that the target can
- * persistently be changed.
- *
- * @return <code>true</code> if the target was validated, <code>false</code> otherwise
- */
- boolean validateTargetState();
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IReadOnlyDependent.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IReadOnlyDependent.java
deleted file mode 100644
index c5367eaa8d9..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IReadOnlyDependent.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.texteditor;
-
-
-
-/**
- * Extension interface for actions. Actions implementing this interface not
- * only manage an enable/disable state but also manage a "hypothetical"
- * enable state, depending on whether the target they work on is writable
- * or read-only.
- * @since 2.0
- */
-public interface IReadOnlyDependent {
-
- /**
- * Returns whether the actions would be enabled if its target
- * would be enabled given the writable state described by <code>isWritable</code>.
- * <code>isEnabled()</code> and <code>isEnabled(boolean)</code> holds the following
- * invariants:
- * isEnabled() == false, if isEnabled(true) == false || isEnabled(false) == false
- * isEnabled() == true, if isEnabled(true) == true || isEnabled(false) == true
- *
- * @param isWritable
- * @return the hypothetical enable state of the action
- */
- boolean isEnabled(boolean isWritable);
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IStatusField.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IStatusField.java
deleted file mode 100644
index 3696a620e75..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IStatusField.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.texteditor;
-
-
-import org.eclipse.swt.graphics.Image;
-
-
-/**
- * Interface of a status field of a text editor. The field that shows up in the
- * workbench's status line if the contributing editor is active.
- * @since 2.0
- */
-public interface IStatusField {
-
- /**
- * Sets the text of this status field.
- *
- * @param text the text shown in the status field
- */
- void setText(String text);
-
- /**
- * Sets the image of this status field.
- *
- * @param image the image shown in the status field
- */
- void setImage(Image image);
-}
-
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IStatusFieldExtension.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IStatusFieldExtension.java
deleted file mode 100644
index 51dfd45ba6e..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IStatusFieldExtension.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.texteditor;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Extends <code>IStatusField</code> with the following concepts:
- * <ul>
- * <li>set error text and image</li>
- * <li>set tool tip</li>
- * <li>control visibility</li>
- * </ul>
- *
- * @see org.eclipse.ui.texteditor.IStatusField
- * @since 3.0
- */
-public interface IStatusFieldExtension {
- /**
- * Sets the text of this status field.
- * <p>
- * The error text overrides the current text until the error
- * text is cleared (set to <code>null</code>).
- * </p>
- *
- * @param text the error text shown in the status field or <code>null</code> to clear
- * @see IStatusField#setText(String)
- */
- void setErrorText(String text);
-
- /**
- * Sets the error image of this status field.
- * <p>
- * The error image overrides the current image until the error
- * image is cleared (set to <code>null</code>).
- * </p>
- *
- * @param image the error image shown in the status field or <code>null</code> to clear
- * @see IStatusField#setImage(Image)
- */
- void setErrorImage(Image image);
-
- /**
- * Sets tool tip text for this status field.
- *
- * @param string the new tool tip text or <code>null</code> to clear
- */
- void setToolTipText (String string);
-
- /**
- * Sets whether this status field is visible within the status line.
- *
- * @param visible <code>true</code> if this item should be visible, <code>false</code> otherwise
- */
- void setVisible(boolean visible);
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditor.java
deleted file mode 100644
index 937a0e3ae45..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditor.java
+++ /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
- *******************************************************************************/
-package org.eclipse.ui.texteditor;
-
-
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-import org.eclipse.ui.IEditorPart;
-
-
-/**
- * Interface to a text editor. This interface defines functional extensions to
- * <code>IEditorPart</code> as well as the configuration capabilities of a text editor.
- * <p>
- * Text editors are configured with an <code>IDocumentProvider</code> which
- * delivers a textual presentation (<code>IDocument</code>) of the editor's input.
- * The editor works on the document and forwards all input element related calls,
- * such as <code>save</code>, to the document provider. The provider also delivers
- * the input's annotation model which is used to control the editor's vertical ruler.</p>
- * <p>
- * Clients may implement this interface from scratch, but the recommended way is to
- * subclass the abstract base class <code>AbstractTextEditor</code>.
- * </p>
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider
- * @see org.eclipse.jface.text.source.IAnnotationModel
- */
-public interface ITextEditor extends IEditorPart {
-
- /**
- * Returns this text editor's document provider.
- *
- * @return the document provider
- */
- IDocumentProvider getDocumentProvider();
-
- /**
- * Closes this text editor after optionally saving changes.
- *
- * @param save <code>true</code> if unsaved changed should be saved, and
- * <code>false</code> if unsaved changed should be discarded
- */
- void close(boolean save);
-
- /**
- * Returns whether the text in this text editor can be changed by the user.
- *
- * @return <code>true</code> if it can be edited, and <code>false</code> if it is read-only
- */
- boolean isEditable();
-
- /**
- * Abandons all modifications applied to this text editor's input element's
- * textual presentation since the last save operation.
- */
- void doRevertToSaved();
-
- /**
- * Installs the given action under the given action id.
- *
- * @param actionId the action id
- * @param action the action, or <code>null</code> to clear it
- * @see #getAction(String)
- */
- void setAction(String actionID, IAction action);
-
- /**
- * Returns the action installed under the given action id.
- *
- * @param actionId the action id
- * @return the action, or <code>null</code> if none
- * @see #setAction(String, IAction)
- */
- IAction getAction(String actionId);
-
- /**
- * Sets the given activation code for the specified action. If
- * there is an activation code already registered, it is replaced.
- * The activation code consists of the same information as
- * a <code>KeyEvent</code>. If the activation code is triggered
- * and the associated action is enabled, the action is performed
- * and the triggering <code>KeyEvent</code> is considered consumed.
- * If the action is disabled, the <code>KeyEvent</code> is passed
- * on unmodified. Thus, action activation codes and action accelerators
- * differ in their model of event consumption. The key code parameter
- * can be <code>-1</code> to indicate a wild card. The state mask
- * parameter can be SWT.DEFAULT to indicate a wild card.
- *
- * @param actionId the action id
- * @param activationCharacter the activation code character
- * @param activationKeyCode the activation code key code or <code>-1</code> for wild card
- * @param activationStateMask the activation code state mask or <code>SWT.DEFAULT</code> for wild card
- */
- void setActionActivationCode(String actionId, char activationCharacter, int activationKeyCode, int activationStateMask);
-
- /**
- * Removes any installed activation code for the specified action.
- * If no activation code is installed, this method does not have
- * any effect.
- *
- * @param actionId the action id
- */
- void removeActionActivationCode(String actionId);
-
- /**
- * Returns whether this text editor is configured to show only the
- * highlighted range of the text.
- *
- * @return <code>true</code> if only the highlighted range is shown, and
- * <code>false</code> if this editor shows the entire text of the document
- * @see #showHighlightRangeOnly(boolean)
- */
- boolean showsHighlightRangeOnly();
-
- /**
- * Configures this text editor to show only the highlighted range of the
- * text.
- *
- * @param showHighlightRangeOnly <code>true</code> if only the highlighted
- * range is shown, and <code>false</code> if this editor shows the entire
- * text of the document
- * @see #showsHighlightRangeOnly()
- */
- void showHighlightRangeOnly(boolean showHighlightRangeOnly);
-
- /**
- * Sets the highlighted range of this text editor to the specified region.
- *
- * @param offset the offset of the highlighted range
- * @param length the length of the highlighted range
- * @param moveCursor <code>true</code> if the cursor should be moved to
- * the start of the highlighted range, and <code>false</code> to leave
- * the cursor unaffected
- * @see #getHighlightRange()
- */
- void setHighlightRange(int offset, int length, boolean moveCursor);
-
- /**
- * Returns the highlighted range of this text editor.
- *
- * @return the highlighted range
- * @see #setHighlightRange(int, int, boolean)
- */
- IRegion getHighlightRange();
-
- /**
- * Resets the highlighted range of this text editor.
- */
- void resetHighlightRange();
-
- /**
- * Returns this text editor's selection provider. Repeated calls to this
- * method return the same selection provider.
- *
- * @return the selection provider
- */
- ISelectionProvider getSelectionProvider();
-
- /**
- * Selects and reveals the specified range in this text editor.
- *
- * @param offset the offset of the selection
- * @param length the length of the selection
- */
- void selectAndReveal(int offset, int length);
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java
deleted file mode 100644
index 775c26905b6..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.ActionFactory;
-
-
-/**
- * Defines the names of those actions which are preregistered with the
- * <code>AbstractTextEditor</code>. <code>RULER_DOUBLE_CLICK</code> defines
- * the action which is registered as being executed when the editor's
- * ruler has been double clicked. This interface extends the set of names
- * available from <code>IWorkbenchActionConstants</code>. It also defines the
- * names of the menu groups in a text editor's context menu.
- */
-public interface ITextEditorActionConstants extends IWorkbenchActionConstants {
-
- /**
- * Context menu group for undo/redo related actions.
- * Value: <code>"group.undo"</code>
- */
- static final String GROUP_UNDO= "group.undo"; //$NON-NLS-1$
-
- /**
- * Context menu group for copy/paste related actions.
- * Value: <code>"group.copy"</code>
- */
- static final String GROUP_COPY= "group.copy"; //$NON-NLS-1$
-
- /**
- * Context menu group for text manipulation actions.
- * Value: <code>"group.edit"</code>
- */
- static final String GROUP_EDIT= "group.edit"; //$NON-NLS-1$
-
- /**
- * Context menu group for print related actions.
- * Value: <code>"group.print"</code>
- */
- static final String GROUP_PRINT= "group.print"; //$NON-NLS-1$
-
- /**
- * Context menu group for find/replace related actions.
- * Value: <code>"group.find"</code>
- */
- static final String GROUP_FIND= "group.find"; //$NON-NLS-1$
-
- /**
- * Context menu group for save related actions.
- * Value: <code>"group.save"</code>
- */
- static final String GROUP_SAVE= "group.save"; //$NON-NLS-1$
-
- /**
- * Context menu group for actions which do not fit in one of the other categories.
- * Value: <code>"group.rest"</code>
- */
- static final String GROUP_REST= "group.rest"; //$NON-NLS-1$
-
- /**
- * Name of the action for shifting text blocks to the right.
- * Value: <code>"ShiftRight"</code>
- */
- static final String SHIFT_RIGHT= "ShiftRight"; //$NON-NLS-1$
-
- /**
- * Name of the action for shifting text blocks to the right, triggered by the TAB key.
- * Value: <code>"ShiftRightTab"</code>
- *
- * @since 3.0
- */
- static final String SHIFT_RIGHT_TAB= "ShiftRightTab"; //$NON-NLS-1$
-
- /**
- * Name of the action for shifting text blocks to the left.
- * Value: <code>"ShiftLeft"</code>
- */
- static final String SHIFT_LEFT= "ShiftLeft"; //$NON-NLS-1$
-
- /**
- * Name of the action to delete the current line.
- * Value: <code>"DeleteLine"</code>
- * @since 2.0
- */
- static final String DELETE_LINE= "DeleteLine"; //$NON-NLS-1$
-
- /**
- * Name of the action to cut the current line.
- * Value: <code>"CutLine"</code>
- * @since 2.1
- */
- static final String CUT_LINE= "CutLine"; //$NON-NLS-1$
-
- /**
- * Name of the action to delete line to beginning.
- * Value: <code>"DeleteLineToBeginning"</code>
- * @since 2.0
- */
- static final String DELETE_LINE_TO_BEGINNING= "DeleteLineToBeginning"; //$NON-NLS-1$
-
- /**
- * Name of the action to cut line to beginning.
- * Value: <code>"CutLineToBeginning"</code>
- * @since 2.1
- */
- static final String CUT_LINE_TO_BEGINNING= "CutLineToBeginning"; //$NON-NLS-1$
-
- /**
- * Name of the action to delete line to end.
- * Value: <code>"DeleteLineToEnd"</code>
- * @since 2.0
- */
- static final String DELETE_LINE_TO_END= "DeleteLineToEnd"; //$NON-NLS-1$
-
- /**
- * Name of the action to cut line to end.
- * Value: <code>"CutLineToEnd"</code>
- * @since 2.1
- */
- static final String CUT_LINE_TO_END= "CutLineToEnd"; //$NON-NLS-1$
-
- /**
- * Name of the action to set the mark.
- * Value: <code>"SetMark"</code>
- * @since 2.0
- */
- static final String SET_MARK= "SetMark"; //$NON-NLS-1$
-
- /**
- * Name of the action to set the mark.
- * Value: <code>"ClearMark"</code>
- * @since 2.0
- */
- static final String CLEAR_MARK= "ClearMark"; //$NON-NLS-1$
-
- /**
- * Name of the action to swap the mark with the cursor position.
- * Value: <code>"SwapMark"</code>
- * @since 2.0
- */
- static final String SWAP_MARK= "SwapMark"; //$NON-NLS-1$
-
- /**
- * Name of the action to jump to a certain text line.
- * Value: <code>"GotoLine"</code>
- */
- static final String GOTO_LINE= "GotoLine"; //$NON-NLS-1$
-
- /**
- * Name of the action to insert a new line below the current position.
- * Value: <code>"SmartEnter"</code>
- * @since 3.0
- */
- static final String SMART_ENTER= "SmartEnter"; //$NON-NLS-1$
-
- /**
- * Name of the action to insert a new line above the current position.
- * Value: <code>"SmartEnterInverse"</code>
- * @since 3.0
- */
- static final String SMART_ENTER_INVERSE= "SmartEnterInverse"; //$NON-NLS-1$
-
- /**
- * Name of the action to move lines upwards
- * Value: <code>"MoveLineUp"</code>
- * @since 3.0
- */
- static final String MOVE_LINE_UP= "MoveLineUp"; //$NON-NLS-1$
-
- /**
- * Name of the action to move lines downwards
- * Value: <code>"MoveLineDown"</code>
- * @since 3.0
- */
- static final String MOVE_LINE_DOWN= "MoveLineDown"; //$NON-NLS-1$
-
- /**
- * Name of the action to copy lines upwards
- * Value: <code>"CopyLineUp"</code>
- * @since 3.0
- */
- static final String COPY_LINE_UP= "CopyLineUp"; //$NON-NLS-1$;
-
- /**
- * Name of the action to copy lines downwards
- * Value: <code>"CopyLineDown"</code>
- * @since 3.0
- */
- static final String COPY_LINE_DOWN= "CopyLineDown"; //$NON-NLS-1$;
-
- /**
- * Name of the action to turn a selection to upper case
- * Value: <code>"UpperCase"</code>
- * @since 3.0
- */
- static final String UPPER_CASE= "UpperCase"; //$NON-NLS-1$
-
- /**
- * Name of the action to turn a selection to lower case
- * Value: <code>"LowerCase"</code>
- * @since 3.0
- */
- static final String LOWER_CASE= "LowerCase"; //$NON-NLS-1$
-
- /**
- * Name of the action to find next.
- * Value: <code>"FindNext"</code>
- * @since 2.0
- */
- static final String FIND_NEXT= "FindNext"; //$NON-NLS-1$
-
- /**
- * Name of the action to find previous.
- * Value: <code>"FindPrevious"</code>
- * @since 2.0
- */
- static final String FIND_PREVIOUS= "FindPrevious"; //$NON-NLS-1$
-
- /**
- * Name of the action to incremental find.
- * Value: <code>"FindIncremental"</code>
- * @since 2.0
- */
- static final String FIND_INCREMENTAL= "FindIncremental"; //$NON-NLS-1$
- /**
- * Name of the action to incremental find reverse.
- * Value: <code>"FindIncrementalReverse"</code>
- * @since 2.1
- */
- static final String FIND_INCREMENTAL_REVERSE= "FindIncrementalReverse"; //$NON-NLS-1$
-
- /**
- * Name of the action to convert line delimiters to Windows.
- * Value: <code>"ConvertLineDelimitersToWindows"</code>
- * @since 2.0
- */
- static final String CONVERT_LINE_DELIMITERS_TO_WINDOWS= "ConvertLineDelimitersToWindows"; //$NON-NLS-1$
-
- /**
- * Name of the action to convert line delimiters to UNIX.
- * Value: <code>"ConvertLineDelimitersToUNIX"</code>
- * @since 2.0
- */
- static final String CONVERT_LINE_DELIMITERS_TO_UNIX= "ConvertLineDelimitersToUNIX"; //$NON-NLS-1$
-
- /**
- * Name of the action to convert line delimiters to MAC.
- * Value: <code>"ConvertLineDelimitersToMAC"</code>
- * @since 2.0
- */
- static final String CONVERT_LINE_DELIMITERS_TO_MAC= "ConvertLineDelimitersToMAC"; //$NON-NLS-1$
-
-
-
- /**
- * Name of the ruler action performed when double clicking the editor's vertical ruler.
- * Value: <code>"RulerDoubleClick"</code>
- */
- static final String RULER_DOUBLE_CLICK= "RulerDoubleClick"; //$NON-NLS-1$
-
- /**
- * Name of the ruler action performed when clicking the editor's vertical ruler.
- * Value: <code>"RulerClick"</code>
- * @since 2.0
- */
- static final String RULER_CLICK= "RulerClick"; //$NON-NLS-1$
-
- /**
- * Name of the ruler action to manage tasks.
- * Value: <code>"ManageTasks"</code>
- */
- static final String RULER_MANAGE_TASKS= "ManageTasks"; //$NON-NLS-1$
-
- /**
- * Name of the ruler action to manage bookmarks.
- * Value: <code>"ManageBookmarks"</code>
- */
- static final String RULER_MANAGE_BOOKMARKS= "ManageBookmarks"; //$NON-NLS-1$
-
-
- /**
- * Status line category "input position".
- * Value: <code>"InputPosition"</code>
- * @since 2.0
- */
- static final String STATUS_CATEGORY_INPUT_POSITION= "InputPosition"; //$NON-NLS-1$
-
- /**
- * Status line category "input mode".
- * Value: <code>"InputMode"</code>
- * @since 2.0
- */
- static final String STATUS_CATEGORY_INPUT_MODE= "InputMode"; //$NON-NLS-1$
-
- /**
- * Status line category "element state".
- * Value: <code>"ElementState"</code>
- * @since 2.0
- */
- static final String STATUS_CATEGORY_ELEMENT_STATE= "ElementState"; //$NON-NLS-1$
-
- /**
- * Status line category "findField".
- * Value: <code>"FindField"</code>
- * @since 3.0
- */
- static final String STATUS_CATEGORY_FIND_FIELD= "findField"; //$NON-NLS-1$
-
- /**
- * Name of standard Copy global action in the Edit menu.
- * Value <code>"copy"</code>
- *
- * @since 3.0
- * @see org.eclipse.ui.actions.ActionFactory#COPY#getId()
- */
- static final String COPY= ActionFactory.COPY.getId();
-
- /**
- * Name of standard Cut global action in the Edit menu.
- * Value <code>"cut"</code>
- *
- * @since 3.0
- * @see org.eclipse.ui.actions.ActionFactory#CUT#getId()
- */
- static final String CUT= ActionFactory.CUT.getId();
-
- /**
- * Name of standard Delete global action in the Edit menu.
- * Value <code>"delete"</code>
- *
- * @since 3.0
- * @see org.eclipse.ui.actions.ActionFactory#DELETE#getId()
- */
- static final String DELETE= ActionFactory.DELETE.getId();
-
- /**
- * Name of standard Find global action in the Edit menu.
- * Value <code>"find"</code>
- *
- * @since 3.0
- * @see org.eclipse.ui.actions.ActionFactory#FIND#getId()
- */
- static final String FIND= ActionFactory.FIND.getId();
-
- /**
- * Name of standard Paste global action in the Edit menu.
- * Value <code>"paste"</code>
- *
- * @since 3.0
- * @see org.eclipse.ui.actions.ActionFactory#PASTE#getId()
- */
- static final String PASTE= ActionFactory.PASTE.getId();
-
- /**
- * Name of standard Print global action in the File menu.
- * Value <code>"print"</code>
- *
- * @since 3.0
- * @see org.eclipse.ui.actions.ActionFactory#PRINT#getId()
- */
- static final String PRINT= ActionFactory.PRINT.getId();
-
- /**
- * Name of standard Redo global action in the Edit menu.
- * Value <code>"redo"</code>
- *
- * @since 3.0
- * @see org.eclipse.ui.actions.ActionFactory#REDO#getId()
- */
- static final String REDO= ActionFactory.REDO.getId();
-
- /**
- * Name of standard Undo global action in the Edit menu.
- * Value <code>"undo"</code>
- *
- * @since 3.0
- * @see org.eclipse.ui.actions.ActionFactory#UNDO#getId()
- */
- static final String UNDO= ActionFactory.UNDO.getId();
-
- /**
- * Name of standard Save global action in the File menu.
- * Value <code>"save"</code>
- *
- * @since 3.0
- * @see org.eclipse.ui.actions.ActionFactory#SAVE#getId()
- */
- static final String SAVE= ActionFactory.SAVE.getId();
-
- /**
- * Name of standard Select All global action in the Edit menu.
- * Value <code>"selectAll"</code>
- *
- * @since 3.0
- * @see org.eclipse.ui.actions.ActionFactory#SELECT_ALL#getId()
- */
- static final String SELECT_ALL= ActionFactory.SELECT_ALL.getId();
-
- /**
- * Name of standard Revert global action in the File menu.
- * Value <code>"revert"</code>
- *
- * @since 3.0
- * @see org.eclipse.ui.actions.ActionFactory#REVERT#getId()
- */
- static final String REVERT= ActionFactory.REVERT.getId();
-
- /**
- * Name of the action for re-establishing the state after the
- * most recent save operation.
- * Value: <code>"ITextEditorActionConstants.REVERT"</code>
- */
- static final String REVERT_TO_SAVED= REVERT;
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java
deleted file mode 100644
index 7efc0c336a7..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java
+++ /dev/null
@@ -1,443 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Chris.Dennis@invidi.com - http://bugs.eclipse.org/bugs/show_bug.cgi?id=29027
- *******************************************************************************/
-package org.eclipse.ui.texteditor;
-
-/**
- * Defines the definitions ids for the text editor actions. These actions are
- * navigation, selection, and modification actions.
- * @since 2.0
- */
-public interface ITextEditorActionDefinitionIds extends IWorkbenchActionDefinitionIds {
-
- // edit
-
- /**
- * Action definition id of the edit delete line action.
- * Value: <code>"org.eclipse.ui.edit.text.delete.line"</code>
- */
- public static final String DELETE_LINE= "org.eclipse.ui.edit.text.delete.line"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit cut line action.
- * Value: <code>"org.eclipse.ui.edit.text.cut.line"</code>
- * @since 2.1
- */
- public static final String CUT_LINE= "org.eclipse.ui.edit.text.cut.line"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit delete line to beginning action.
- * Value: <code>"org.eclipse.ui.edit.text.delete.line.to.beginning"</code>
- */
- public static final String DELETE_LINE_TO_BEGINNING= "org.eclipse.ui.edit.text.delete.line.to.beginning"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit cut line to beginning action.
- * Value: <code>"org.eclipse.ui.edit.text.cut.line.to.beginning"</code>
- * @since 2.1
- */
- public static final String CUT_LINE_TO_BEGINNING= "org.eclipse.ui.edit.text.cut.line.to.beginning"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit delete line to end action.
- * Value: <code>"org.eclipse.ui.edit.text.delete.line.to.end"</code>
- */
- public static final String DELETE_LINE_TO_END= "org.eclipse.ui.edit.text.delete.line.to.end"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit cut line to end action.
- * Value: <code>"org.eclipse.ui.edit.text.cut.line.to.end"</code>
- * @since 2.1
- */
- public static final String CUT_LINE_TO_END= "org.eclipse.ui.edit.text.cut.line.to.end"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit set mark action.
- * Value: <code>"org.eclipse.ui.edit.text.set.mark"</code>
- */
- public static final String SET_MARK= "org.eclipse.ui.edit.text.set.mark"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit clear mark action.
- * Value: <code>"org.eclipse.ui.edit.text.clear.mark"</code>
- */
- public static final String CLEAR_MARK= "org.eclipse.ui.edit.text.clear.mark"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit swap mark action.
- * Value: <code>"org.eclipse.ui.edit.text.swap.mark"</code>
- */
- public static final String SWAP_MARK= "org.eclipse.ui.edit.text.swap.mark"; //$NON-NLS-1$
-
- /**
- * Action definition id of the smart enter action.
- * Value: <code>"org.eclipse.ui.edit.text.smartEnter"</code>
- * @since 3.0
- */
- public static final String SMART_ENTER= "org.eclipse.ui.edit.text.smartEnter"; //$NON-NLS-1$
-
- /**
- * Action definition id of the smart enter (inverse) action.
- * Value: <code>"org.eclipse.ui.edit.text.smartEnterInverse"</code>
- * @since 3.0
- */
- public static final String SMART_ENTER_INVERSE= "org.eclipse.ui.edit.text.smartEnterInverse"; //$NON-NLS-1$
-
- /**
- * Action definition id of the move lines upwards action.
- * Value: <code>"org.eclipse.ui.edit.text.moveLineUp"</code>
- * @since 3.0
- */
- public static final String MOVE_LINES_UP= "org.eclipse.ui.edit.text.moveLineUp"; //$NON-NLS-1$
-
- /**
- * Action definition id of the move lines downwards action.
- * Value: <code>"org.eclipse.ui.edit.text.moveLineDown"</code>
- * @since 3.0
- */
- public static final String MOVE_LINES_DOWN= "org.eclipse.ui.edit.text.moveLineDown"; //$NON-NLS-1$
-
- /**
- * Action definition id of the copy lines upwards action.
- * Value: <code>"org.eclipse.ui.edit.text.copyLineUp"</code>
- * @since 3.0
- */
- public static final String COPY_LINES_UP= "org.eclipse.ui.edit.text.copyLineUp"; //$NON-NLS-1$;
-
- /**
- * Action definition id of the copy lines downwards action.
- * Value: <code>"org.eclipse.ui.edit.text.copyLineDown"</code>
- * @since 3.0
- */
- public static final String COPY_LINES_DOWN= "org.eclipse.ui.edit.text.copyLineDown"; //$NON-NLS-1$;
-
- /**
- * Action definition id of the upper case action.
- * Value: <code>"org.eclipse.ui.edit.text.upperCase"</code>
- * @since 3.0
- */
- public static final String UPPER_CASE= "org.eclipse.ui.edit.text.upperCase"; //$NON-NLS-1$
-
- /**
- * Action definition id of the lower case action.
- * Value: <code>"org.eclipse.ui.edit.text.lowerCase"</code>
- * @since 3.0
- */
- public static final String LOWER_CASE= "org.eclipse.ui.edit.text.lowerCase"; //$NON-NLS-1$
-
-
- // navigation
-
- /**
- * Action definition id of the navigate goto previous line action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.lineUp"</code>
- */
- public static final String LINE_UP= "org.eclipse.ui.edit.text.goto.lineUp"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto next line action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.lineDown"</code>
- */
- public static final String LINE_DOWN= "org.eclipse.ui.edit.text.goto.lineDown"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto line start action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.lineStart"</code>
- */
- public static final String LINE_START= "org.eclipse.ui.edit.text.goto.lineStart"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto line end action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.lineEnd"</code>
- */
- public static final String LINE_END= "org.eclipse.ui.edit.text.goto.lineEnd"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto line action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.line"</code>
- */
- public static final String LINE_GOTO= "org.eclipse.ui.edit.text.goto.line"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto previous column action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.columnPrevious"</code>
- */
- public static final String COLUMN_PREVIOUS= "org.eclipse.ui.edit.text.goto.columnPrevious"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto next column action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.columnNext"</code>
- */
- public static final String COLUMN_NEXT= "org.eclipse.ui.edit.text.goto.columnNext"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto previous page action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.pageUp"</code>
- */
- public static final String PAGE_UP= "org.eclipse.ui.edit.text.goto.pageUp"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto next page action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.pageDown"</code>
- */
- public static final String PAGE_DOWN= "org.eclipse.ui.edit.text.goto.pageDown"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto previous word action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.wordPrevious"</code>
- */
- public static final String WORD_PREVIOUS= "org.eclipse.ui.edit.text.goto.wordPrevious"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto next word action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.wordNext"</code>
- */
- public static final String WORD_NEXT= "org.eclipse.ui.edit.text.goto.wordNext"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto text start action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.textStart"</code>
- */
- public static final String TEXT_START= "org.eclipse.ui.edit.text.goto.textStart"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto text end action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.textEnd"</code>
- */
- public static final String TEXT_END= "org.eclipse.ui.edit.text.goto.textEnd"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto start of window action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.windowStart"</code>
- */
- public static final String WINDOW_START= "org.eclipse.ui.edit.text.goto.windowStart"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate goto end of window action.
- * Value: <code>"org.eclipse.ui.edit.text.goto.windowEnd"</code>
- */
- public static final String WINDOW_END= "org.eclipse.ui.edit.text.goto.windowEnd"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate scroll line up action.
- * Value: <code>"org.eclipse.ui.edit.text.scroll.lineUp"</code>
- */
- public static final String SCROLL_LINE_UP= "org.eclipse.ui.edit.text.scroll.lineUp"; //$NON-NLS-1$
-
- /**
- * Action definition id of the navigate scroll line down action.
- * Value: <code>"org.eclipse.ui.edit.text.scroll.lineDown"</code>
- */
- public static final String SCROLL_LINE_DOWN= "org.eclipse.ui.edit.text.scroll.lineDown"; //$NON-NLS-1$
-
-
- // selection
-
- /**
- * Action definition id of the select line up action.
- * Value: <code>"org.eclipse.ui.edit.text.select.lineUp"</code>
- */
- public static final String SELECT_LINE_UP= "org.eclipse.ui.edit.text.select.lineUp"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select line down action.
- * Value: <code>"org.eclipse.ui.edit.text.select.lineDown"</code>
- */
- public static final String SELECT_LINE_DOWN= "org.eclipse.ui.edit.text.select.lineDown"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select line start action.
- * Value: <code>"org.eclipse.ui.edit.text.select.lineStart"</code>
- */
- public static final String SELECT_LINE_START= "org.eclipse.ui.edit.text.select.lineStart"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select line end action.
- * Value: <code>"org.eclipse.ui.edit.text.select.lineEnd"</code>
- */
- public static final String SELECT_LINE_END= "org.eclipse.ui.edit.text.select.lineEnd"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select previous column action.
- * Value: <code>"org.eclipse.ui.edit.text.select.columnPrevious"</code>
- */
- public static final String SELECT_COLUMN_PREVIOUS= "org.eclipse.ui.edit.text.select.columnPrevious"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select next column action.
- * Value: <code>"org.eclipse.ui.edit.text.select.columnNext"</code>
- */
- public static final String SELECT_COLUMN_NEXT= "org.eclipse.ui.edit.text.select.columnNext"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select page up action.
- * Value: <code>"org.eclipse.ui.edit.text.select.pageUp"</code>
- */
- public static final String SELECT_PAGE_UP= "org.eclipse.ui.edit.text.select.pageUp"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select page down action.
- * Value: <code>"org.eclipse.ui.edit.text.select.pageDown"</code>
- */
- public static final String SELECT_PAGE_DOWN= "org.eclipse.ui.edit.text.select.pageDown"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select previous word action.
- * Value: <code>"org.eclipse.ui.edit.text.select.wordPrevious"</code>
- */
- public static final String SELECT_WORD_PREVIOUS= "org.eclipse.ui.edit.text.select.wordPrevious"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select next word action.
- * Value: <code>"org.eclipse.ui.edit.text.select.wordNext"</code>
- */
- public static final String SELECT_WORD_NEXT= "org.eclipse.ui.edit.text.select.wordNext"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select text start action.
- * Value: <code>"org.eclipse.ui.edit.text.select.textStart"</code>
- */
- public static final String SELECT_TEXT_START= "org.eclipse.ui.edit.text.select.textStart"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select text end action.
- * Value: <code>"org.eclipse.ui.edit.text.select.textEnd"</code>
- */
- public static final String SELECT_TEXT_END= "org.eclipse.ui.edit.text.select.textEnd"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select window start action.
- * Value: <code>"org.eclipse.ui.edit.text.select.windowStart"</code>
- */
- public static final String SELECT_WINDOW_START= "org.eclipse.ui.edit.text.select.windowStart"; //$NON-NLS-1$
-
- /**
- * Action definition id of the select window end action.
- * Value: <code>"org.eclipse.ui.edit.text.select.windowEnd"</code>
- */
- public static final String SELECT_WINDOW_END= "org.eclipse.ui.edit.text.select.windowEnd"; //$NON-NLS-1$
-
-
- // modification
-
- /**
- * Action definition id of the edit delet previous character action.
- * Value: <code>"org.eclipse.ui.edit.text.deletePrevious"</code>
- */
- public static final String DELETE_PREVIOUS= "org.eclipse.ui.edit.text.deletePrevious"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit delete next character action.
- * Value: <code>"org.eclipse.ui.edit.text.deleteNext"</code>
- */
- public static final String DELETE_NEXT= "org.eclipse.ui.edit.text.deleteNext"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit delete previous word action.
- * Value: <code>"org.eclipse.ui.edit.text.deletePreviousWord"</code>
- * @since 2.1
- */
- public static final String DELETE_PREVIOUS_WORD= "org.eclipse.ui.edit.text.deletePreviousWord"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit delete next word action.
- * Value: <code>"org.eclipse.ui.edit.text.deleteNextWord"</code>
- * @since 2.1
- */
- public static final String DELETE_NEXT_WORD= "org.eclipse.ui.edit.text.deleteNextWord"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit shift right action.
- * Value: <code>"org.eclipse.ui.edit.text.shiftRight"</code>
- */
- public static final String SHIFT_RIGHT= "org.eclipse.ui.edit.text.shiftRight"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit shift left action.
- * Value: <code>"org.eclipse.ui.edit.text.shiftLeft"</code>
- */
- public static final String SHIFT_LEFT= "org.eclipse.ui.edit.text.shiftLeft"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit convert to window's line delimiter action.
- * Value: <code>"org.eclipse.ui.edit.text.convert.lineDelimiters.toWindows"</code>
- */
- public static final String CONVERT_LINE_DELIMITERS_TO_WINDOWS= "org.eclipse.ui.edit.text.convert.lineDelimiters.toWindows"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit convert to unix' line delimiter action.
- * Value: <code>"org.eclipse.ui.edit.text.convert.lineDelimiters.toUNIX"</code>
- */
- public static final String CONVERT_LINE_DELIMITERS_TO_UNIX= "org.eclipse.ui.edit.text.convert.lineDelimiters.toUNIX"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit convert to mac' line delimiter action.
- * Value: <code>"org.eclipse.ui.edit.text.convert.lineDelimiters.toMac"</code>
- */
- public static final String CONVERT_LINE_DELIMITERS_TO_MAC= "org.eclipse.ui.edit.text.convert.lineDelimiters.toMac"; //$NON-NLS-1$
-
-
- // miscellaneous
-
- /**
- * Action definition id of the toggle input mode action.
- * Value: <code>"org.eclipse.ui.edit.text.toggleOverwrite"</code>
- */
- public static final String TOGGLE_OVERWRITE= "org.eclipse.ui.edit.text.toggleOverwrite"; //$NON-NLS-1$
-
- /**
- * Action definition id of toggle show selected element only action.
- * Value: <code>"org.eclipse.ui.edit.text.toggleShowSelectedElementOnly"</code>
- * @since 3.0
- */
- public static final String TOGGLE_SHOW_SELECTED_ELEMENT_ONLY= "org.eclipse.ui.edit.text.toggleShowSelectedElementOnly"; //$NON-NLS-1$
-
- /**
- * Action definition id of the show ruler context menu action.
- * Value: <code>"org.eclipse.ui.edit.text.showRulerContextMenu"</code>
- */
- public static final String SHOW_RULER_CONTEXT_MENU= "org.eclipse.ui.edit.text.showRulerContextMenu"; //$NON-NLS-1$
-
- /**
- * Action definition id of go to last edit position action.
- * Value: <code>"org.eclipse.ui.edit.text.gotoLastEditPosition"</code>
- * @since 2.1
- */
- public static final String GOTO_LAST_EDIT_POSITION= "org.eclipse.ui.edit.text.gotoLastEditPosition"; //$NON-NLS-1$
-
- /**
- * Action definition id of go to next annotation action.
- * Value: <code>"org.eclipse.ui.edit.text.gotoNextAnnotation"</code>
- * @since 3.0
- */
- public static final String GOTO_NEXT_ANNOTATION= "org.eclipse.ui.edit.text.gotoNextAnnotation"; //$NON-NLS-1$
-
- /**
- * Action definition id of go to previous annotation action.
- * Value: <code>"org.eclipse.ui.edit.text.gotoPreviousAnnotation"</code>
- * @since 3.0
- */
- public static final String GOTO_PREVIOUS_ANNOTATION= "org.eclipse.ui.edit.text.gotoPreviousAnnotation"; //$NON-NLS-1$
-
- /**
- * Action definition ID of the edit -> content assist proposal action
- * Value: <code>"org.eclipse.ui.edit.text.contentAssist.proposals"</code>).
- * @since 2.1
- */
- public static final String CONTENT_ASSIST_PROPOSALS= "org.eclipse.ui.edit.text.contentAssist.proposals"; //$NON-NLS-1$
-
- /**
- * Action definition ID of the edit -> content assist context information action
- * Value: <code>"org.eclipse.ui.edit.text.contentAssist.contextInformation"</code>).
- * @since 2.1
- */
- public static final String CONTENT_ASSIST_CONTEXT_INFORMATION= "org.eclipse.ui.edit.text.contentAssist.contextInformation"; //$NON-NLS-1$
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension.java
deleted file mode 100644
index b362f6aa221..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension.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.texteditor;
-
-
-import org.eclipse.jface.action.IMenuListener;
-
-
-/**
- * Extension interface for <code>ITextEditor</code>. Adds the following functions:
- * <ul>
- * <li> status fields
- * <li> read-only state of the editor's input
- * <li> ruler context menu listeners.
- * </ul>
- *
- * @since 2.0
- */
-public interface ITextEditorExtension {
-
- /**
- * Informs the editor which status field is to be used when posting status
- * information in the given category.
- *
- * @param field the status field to be used
- * @param category the status information category
- * @see ITextEditorActionConstants
- */
- void setStatusField(IStatusField field, String category);
-
- /**
- * Returns whether the editor's input is read-only. The semantics of
- * this method is orthogonal to <code>isEditable</code> as it talks about the
- * editor input, i.e. the domain element, and <b>not</b> about the editor
- * document.
- *
- * @return <code>true</code> if the editor input is read-only
- */
- boolean isEditorInputReadOnly();
-
- /**
- * Adds a ruler context menu listener to the editor.
- *
- * @param listener the listener
- */
- void addRulerContextMenuListener(IMenuListener listener);
-
- /**
- * Removes a ruler context menu listener from the editor.
- *
- * @param listener the listener
- */
- void removeRulerContextMenuListener(IMenuListener listener);
-}
-
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension2.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension2.java
deleted file mode 100644
index 6ac3c3a48a7..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension2.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.texteditor;
-
-/**
- * Extension interface for <code>ITextEditor</code>. Adds the following functions:
- * <ul>
- * <li> modifiable state of the editor's input
- * <li> validate state of editor input
- * </ul>
- *
- * @since 2.1
- */
-public interface ITextEditorExtension2 {
-
- /**
- * Returns whether the editor's input can be persistently be modified.
- * This is orthogonal to <code>ITextEditorExtension.isEditorInputReadOnly</code> as read-only elements may be modifiable and
- * writable elements may not be modifiable. If the given element is not connected to this document
- * provider, the result is undefined. Document providers are allowed to use a cache to answer this
- * question, i.e. there can be a difference between the "real" state of the element and the return
- * value.
- *
- * @return <code>true</code> if the editor input is modifiable
- * */
- boolean isEditorInputModifiable();
-
- /**
- * Validates the state of the given editor input. The predominate intent
- * of this method is to take any action propably necessary to ensure that
- * the input can persistently be changed.
- *
- * @return <code>true</code> if the input was validated, <code>false</code> otherwise
- */
- boolean validateEditorInputState();
-
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension3.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension3.java
deleted file mode 100644
index 520c2382d35..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension3.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.texteditor;
-
-/**
- * Extension interface for <code>ITextEditor</code>. Adds the following functions:
- * <ul>
- * <li> insert mode management
- * </ul>
- * <p>
- *
- * @since 3.0
- */
-public interface ITextEditorExtension3 {
-
- /**
- * Constitutes entities to enumerate the editor insert modes.
- */
- public static class InsertMode {
- private InsertMode() {
- }
- };
-
- /**
- * Represents the non-smart insert mode.
- */
- final static InsertMode INSERT= new InsertMode();
- /**
- * Represents the non-smart overwrite mode.
- */
- final static InsertMode OVERWRITE= new InsertMode();
- /**
- * Represents the smart insert mode.
- */
- final static InsertMode SMART_INSERT= new InsertMode();
-
-
- /**
- * Returns the current input mode of this editor.
- *
- * @return the current input mode of this editor
- */
- InsertMode getInsertMode();
-
- /**
- * Sets the insert mode of this editor.
- *
- * @param mode the new insert mode
- * @exception IllegalArgumentException if <code>mode</code> is not a legal insert mode for this editor
- */
- void setInsertMode(InsertMode mode);
-
- /**
- * Sets the display of quick diff information.
- *
- * @param show <code>true</code> if quick diff information should be shown, <code>false</code> otherwise
- */
- void showChangeInformation(boolean show);
-
- /**
- * Returns the quick diff display state.
- *
- * @return <code>true</code> if quick diff info is displayed, <code>false</code> otherwise
- */
- boolean isChangeInformationShowing();
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IUpdate.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IUpdate.java
deleted file mode 100644
index fb189f0397f..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IUpdate.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.texteditor;
-
-
-
-/**
- * Indicates the support of an update method.
- */
-public interface IUpdate {
-
- /**
- * Requests that this object update itself.
- */
- void update();
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IWorkbenchActionDefinitionIds.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IWorkbenchActionDefinitionIds.java
deleted file mode 100644
index 64cec446890..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IWorkbenchActionDefinitionIds.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.texteditor;
-
-
-/**
- * Defines the definitions ids for workbench actions.
- * @since 2.0
- */
-public interface IWorkbenchActionDefinitionIds {
-
- // workbench file actions
-
- /**
- * Action definition id of the file print action.
- * Value: <code>"org.eclipse.ui.file.print"</code>
- */
- public static final String PRINT= "org.eclipse.ui.file.print"; //$NON-NLS-1$
-
- /**
- * Action definition id of the file save action.
- * Value: <code>"org.eclipse.ui.file.save"</code>
- */
- public static final String SAVE= "org.eclipse.ui.file.save"; //$NON-NLS-1$
-
- /**
- * Action definition id of the file revert action.
- * Value: <code>"org.eclipse.ui.edit.revertToSaved"</code>
- */
- public static final String REVERT_TO_SAVED= "org.eclipse.ui.edit.revertToSaved"; //$NON-NLS-1$
-
-
-
- // workbench edit actions
-
- /**
- * Action definition id of the edit cut action.
- * Value: <code>"org.eclipse.ui.edit.cut"</code>
- */
- public static final String CUT= "org.eclipse.ui.edit.cut"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit copy action.
- * Value: <code>"org.eclipse.ui.edit.copy"</code>
- */
- public static final String COPY= "org.eclipse.ui.edit.copy"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit past action.
- * Value: <code>"org.eclipse.ui.edit.paste"</code>
- */
- public static final String PASTE= "org.eclipse.ui.edit.paste"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit undo action.
- * Value: <code>"org.eclipse.ui.edit.undo"</code>
- */
- public static final String UNDO= "org.eclipse.ui.edit.undo"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit redo action.
- * Value: <code>"org.eclipse.ui.edit.redo"</code>
- */
- public static final String REDO= "org.eclipse.ui.edit.redo"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit delete action.
- * Value: <code>"org.eclipse.ui.edit.delete"</code>
- */
- public static final String DELETE= "org.eclipse.ui.edit.delete"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit select all action.
- * Value: <code>"org.eclipse.ui.edit.selectAll"</code>
- */
- public static final String SELECT_ALL= "org.eclipse.ui.edit.selectAll"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit find/replace action.
- * Value: <code>"org.eclipse.ui.edit.findReplace"</code>
- */
- public static final String FIND_REPLACE= "org.eclipse.ui.edit.findReplace"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit add bookmark action.
- * Value: <code>"org.eclipse.ui.edit.addBookmark"</code>
- */
- public static final String ADD_BOOKMARK= "org.eclipse.ui.edit.addBookmark"; //$NON-NLS-1$
-
- /**
- * Action definition id of the edit add task action.
- * Value: <code>"org.eclipse.ui.edit.addTask"</code>
- */
- public static final String ADD_TASK= "org.eclipse.ui.edit.addTask"; //$NON-NLS-1$
-
-
- // future workbench edit actions
-
- /**
- * Action definition id of the edit find next action.
- * Value: <code>"org.eclipse.ui.edit.findNext"</code>
- */
- public static final String FIND_NEXT= "org.eclipse.ui.edit.findNext"; //$NON-NLS-1$
- /**
- * Action definition id of the edit find previous action.
- * Value: <code>"org.eclipse.ui.edit.findPrevious"</code>
- */
- public static final String FIND_PREVIOUS= "org.eclipse.ui.edit.findPrevious"; //$NON-NLS-1$
- /**
- * Action definition id of the edit incremental find action.
- * Value: <code>"org.eclipse.ui.edit.findIncremental"</code>
- */
- public static final String FIND_INCREMENTAL= "org.eclipse.ui.edit.findIncremental"; //$NON-NLS-1$
- /**
- * Action definition id of the edit incremental find reverse action.
- * Value: <code>"org.eclipse.ui.edit.findIncrementalReverse"</code>
- *
- * @since 2.1
- */
- public static final String FIND_INCREMENTAL_REVERSE= "org.eclipse.ui.edit.findIncrementalReverse"; //$NON-NLS-1$
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindAction.java
deleted file mode 100644
index 5fe9625592a..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindAction.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.texteditor;
-
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.IFindReplaceTarget;
-import org.eclipse.jface.text.IFindReplaceTargetExtension;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-
-
-/**
- * An action which enters the incremental find mode a la emacs.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * @since 2.0
- */
-public class IncrementalFindAction extends ResourceAction implements IUpdate {
-
- /** The action's target */
- private IFindReplaceTarget fTarget;
- /** The part the action is bound to */
- private IWorkbenchPart fWorkbenchPart;
- /** The workbench window */
- private IWorkbenchWindow fWorkbenchWindow;
- /**
- * The direction to run the incremental find
- * @since 2.1
- */
- private boolean fForward;
-
- /**
- * Creates a new incremental find action for the given workbench part.
- * The action configures its visual representation from the given
- * resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param workbenchPart the workbench part
- * @param forward <code>true</code> if the search direction is forward
- * @see ResourceAction#ResourceAction
- * @since 2.1
- */
- public IncrementalFindAction(ResourceBundle bundle, String prefix, IWorkbenchPart workbenchPart, boolean forward) {
- super(bundle, prefix);
- fWorkbenchPart= workbenchPart;
- fForward= forward;
- update();
- }
-
- /**
- * Creates a new incremental find action for the given workbench window.
- * The action configures its visual representation from the given
- * resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param workbenchWindow the workbench window
- * @param forward <code>true</code> if the search direction is forward
- * @see ResourceAction#ResourceAction
- *
- * @deprecated use FindReplaceAction(ResourceBundle, String, IWorkbenchPart, boolean) instead
- * @since 2.1
- */
- public IncrementalFindAction(ResourceBundle bundle, String prefix, IWorkbenchWindow workbenchWindow, boolean forward) {
- super(bundle, prefix);
- fWorkbenchWindow= workbenchWindow;
- fForward= forward;
- update();
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
-
- if (fTarget == null)
- return;
-
- if (fTarget instanceof IncrementalFindTarget)
- ((IncrementalFindTarget) fTarget).setDirection(fForward);
-
- if (fTarget instanceof IFindReplaceTargetExtension)
- ((IFindReplaceTargetExtension) fTarget).beginSession();
- }
-
- /*
- * @see IUpdate#update()
- */
- public void update() {
-
- if (fWorkbenchPart == null && fWorkbenchWindow != null)
- fWorkbenchPart= fWorkbenchWindow.getPartService().getActivePart();
-
- if (fWorkbenchPart != null)
- fTarget= (IFindReplaceTarget) fWorkbenchPart.getAdapter(IncrementalFindTarget.class);
- else
- fTarget= null;
-
- setEnabled(fTarget != null && fTarget.canPerformFind());
- }
-
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindTarget.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindTarget.java
deleted file mode 100644
index c5ee3830f4f..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindTarget.java
+++ /dev/null
@@ -1,772 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-import java.text.MessageFormat;
-import java.util.Stack;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-
-import org.eclipse.jface.action.IStatusLineManager;
-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.text.Assert;
-import org.eclipse.jface.text.IFindReplaceTarget;
-import org.eclipse.jface.text.IFindReplaceTargetExtension;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextListener;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension;
-import org.eclipse.jface.text.TextEvent;
-
-/**
- * An incremental find target. Replace is always disabled.
- * @since 2.0
- */
-class IncrementalFindTarget implements IFindReplaceTarget, IFindReplaceTargetExtension, VerifyKeyListener, MouseListener, FocusListener, ISelectionChangedListener, ITextListener {
-
- /** The string representing rendered tab */
- private final static String TAB= EditorMessages.getString("Editor.FindIncremental.render.tab"); //$NON-NLS-1$
- /**
- * The string representing "Reverse Incremental Find"
- * @since 3.0
- */
- private final static String FIELD_NAME= EditorMessages.getString("Editor.FindIncremental.name"); //$NON-NLS-1$
- /**
- * The string representing "Incremental Find"
- * @since 3.0
- */
- private final static String REVERSE_FIELD_NAME= EditorMessages.getString("Editor.FindIncremental.reverse.name"); //$NON-NLS-1$
- /**
- * The string representing reverse
- * @since 2.1
- */
- private final static String REVERSE= EditorMessages.getString("Editor.FindIncremental.reverse"); //$NON-NLS-1$
- /**
- * The string representing wrapped
- * @since 2.1
- */
- private final static String WRAPPED= EditorMessages.getString("Editor.FindIncremental.wrapped"); //$NON-NLS-1$
- /** The text viewer to operate on */
- private final ITextViewer fTextViewer;
- /** The status line manager for output */
- private final IStatusLineManager fStatusLine;
- /** The find replace target to delegate find requests */
- private final IFindReplaceTarget fTarget;
- /** The current find string */
- private StringBuffer fFindString= new StringBuffer();
- /** The position of the first upper case character, -1 if none */
- private int fCasePosition;
- /**
- * The position in the stack of the first wrap search, -1 if none
- * @since 2.1
- */
- private int fWrapPosition;
- /** The position of the last successful find */
- private int fCurrentIndex;
- /** A flag indicating if last find was successful */
- private boolean fFound;
- /**
- * A flag indicating if the last search was forward
- * @since 2.1
- */
- private boolean fForward= true;
- /** A flag indicating listeners are installed. */
- private boolean fInstalled;
- /**
- * A flag indicating that a search is currently active.
- * Used to ignore selection callbacks generated by the incremental search itself.
- * @since 2.1
- */
- private boolean fSearching;
- /** The current find stack */
- private Stack fSessionStack;
- /**
- * The previous search string
- * @since 2.1
- */
- private String fPrevFindString= ""; //$NON-NLS-1$
- /**
- * The find status field.
- * @since 3.0
- */
- private IStatusField fStatusField;
- /**
- * Tells whether the status field implements
- * <code>IStatusFieldExtension</code>.
- * @see IStatusFieldExtension
- * @since 3.0
- */
- private boolean fIsStatusFieldExtension;
-
- /**
- * Data structure for a search result.
- * @since 2.1
- */
- private class SearchResult {
- int selection, length, index, findLength;
- boolean found, forward;
-
- /**
- * Creates a new search result data object and fills
- * it with the current values of this target.
- */
- public SearchResult() {
- Point p= fTarget.getSelection();
- selection= p.x;
- length= p.y;
- index= fCurrentIndex;
- findLength= fFindString.length();
- found= fFound;
- forward= fForward;
- }
-
- }
-
- /**
- * Stores the search result.
- */
- private void saveState() {
- fSessionStack.push(new SearchResult());
- }
-
- /**
- * Restores the search result.
- *
- * @since 2.1
- */
- private void restoreState() {
-
- StyledText text= fTextViewer.getTextWidget();
- if (text == null || text.isDisposed())
- return;
-
- SearchResult searchResult= null;
- if (!fSessionStack.empty())
- searchResult= (SearchResult) fSessionStack.pop();
-
- if (searchResult == null) {
- text.getDisplay().beep();
- return;
- }
-
- text.setSelectionRange(searchResult.selection, searchResult.length);
- text.showSelection();
-
- // relies on the contents of the StringBuffer
- fFindString.setLength(searchResult.findLength);
- fCurrentIndex= searchResult.index;
- fFound= searchResult.found;
- fForward= searchResult.forward;
-
- // Recalculate the indices
- if (fFindString.length() < fCasePosition)
- fCasePosition= -1;
- if (fSessionStack.size() < fWrapPosition)
- fWrapPosition= -1;
- }
-
- /**
- * Sets the direction for the next search.
- * This can be called before <code>beginSession</code> to set the initial search direction.
- * @param forward <code>true</code> if the next search should be forward
- * @see #beginSession
- * @since 2.1
- */
- public void setDirection(boolean forward) {
- fForward= forward;
- }
-
- /**
- * Creates an instance of an incremental find target.
- * @param viewer the text viewer to operate on
- * @param manager the status line manager for output
- */
- public IncrementalFindTarget(ITextViewer viewer, IStatusLineManager manager) {
- Assert.isNotNull(viewer);
- Assert.isNotNull(manager);
- fTextViewer= viewer;
- fStatusLine= manager;
- fTarget= viewer.getFindReplaceTarget();
- }
-
- /*
- * @see IFindReplaceTarget#canPerformFind()
- */
- public boolean canPerformFind() {
- return fTarget.canPerformFind();
- }
-
- /*
- * @see IFindReplaceTarget#findAndSelect(int, String, boolean, boolean, boolean)
- */
- public int findAndSelect(int offset, String findString, boolean searchForward, boolean caseSensitive, boolean wholeWord) {
- return fTarget.findAndSelect(offset, findString, searchForward, caseSensitive, wholeWord);
- }
-
- /*
- * @see IFindReplaceTarget#getSelection()
- */
- public Point getSelection() {
- return fTarget.getSelection();
- }
-
- /*
- * @see IFindReplaceTarget#getSelectionText()
- */
- public String getSelectionText() {
- return fTarget.getSelectionText();
- }
-
- /*
- * @see IFindReplaceTarget#isEditable()
- */
- public boolean isEditable() {
- return false;
- }
-
- /*
- * @see IFindReplaceTarget#replaceSelection(String)
- */
- public void replaceSelection(String text) {
- }
-
- /*
- * @see IFindReplaceTargetExtension#beginSession()
- */
- public void beginSession() {
- fSearching= true;
-
- // Workaround since some accelerators get handled directly by the OS
- if (fInstalled) {
- saveState();
- repeatSearch(fForward);
- updateStatus();
- fSearching= false;
- return;
- }
-
- fFindString.setLength(0);
- fSessionStack= new Stack();
- fCasePosition= -1;
- fWrapPosition= -1;
- fFound= true;
-
- // clear initial selection
- StyledText text= fTextViewer.getTextWidget();
- if (text != null && !text.isDisposed()) {
- fCurrentIndex= text.getCaretOffset();
- text.setSelection(fCurrentIndex);
- } else {
- fCurrentIndex= 0;
- }
-
- install();
-
- // Set the mark
- if (fTextViewer instanceof ITextViewerExtension)
- ((ITextViewerExtension) fTextViewer).setMark(fCurrentIndex);
-
- updateStatus();
-
- if (fTarget instanceof IFindReplaceTargetExtension)
- ((IFindReplaceTargetExtension) fTarget).beginSession();
-
- fSearching= false;
- }
-
- /*
- * @see IFindReplaceTargetExtension#endSession()
- */
- public void endSession() {
- if (fTarget instanceof IFindReplaceTargetExtension)
- ((IFindReplaceTargetExtension) fTarget).endSession();
-
- // will uninstall itself
- }
-
- /*
- * @see IFindReplaceTargetExtension#getScope()
- */
- public IRegion getScope() {
- return null;
- }
-
- /*
- * @see IFindReplaceTargetExtension#setGlobal(boolean)
- */
- public void setGlobal(boolean global) {
- }
-
- /*
- * @see IFindReplaceTargetExtension#setScope(IRegion)
- */
- public void setScope(IRegion scope) {
- }
-
- /*
- * @see IFindReplaceTargetExtension#setReplaceAllMode(boolean)
- */
- public void setReplaceAllMode(boolean replaceAll) {
- }
-
- /**
- * Installs this target. I.e. adds all required listeners.
- */
- private void install() {
-
- if (fInstalled)
- return;
-
- StyledText text= fTextViewer.getTextWidget();
- if (text == null)
- return;
-
- text.addMouseListener(this);
- text.addFocusListener(this);
- fTextViewer.addTextListener(this);
-
- ISelectionProvider selectionProvider= fTextViewer.getSelectionProvider();
- if (selectionProvider != null)
- selectionProvider.addSelectionChangedListener(this);
-
- if (fTextViewer instanceof ITextViewerExtension)
- ((ITextViewerExtension) fTextViewer).prependVerifyKeyListener(this);
- else
- text.addVerifyKeyListener(this);
-
- fInstalled= true;
- }
-
- /**
- * Uninstalls itself. I.e. removes all listeners installed in <code>install</code>.
- */
- private void uninstall() {
-
- fTextViewer.removeTextListener(this);
-
- ISelectionProvider selectionProvider= fTextViewer.getSelectionProvider();
- if (selectionProvider != null)
- selectionProvider.removeSelectionChangedListener(this);
-
- StyledText text= fTextViewer.getTextWidget();
- if (text != null) {
- text.removeMouseListener(this);
- text.removeFocusListener(this);
- }
-
- if (fTextViewer instanceof ITextViewerExtension) {
- ((ITextViewerExtension) fTextViewer).removeVerifyKeyListener(this);
-
- } else {
- if (text != null)
- text.removeVerifyKeyListener(this);
- }
-
- fInstalled= false;
- }
-
- /**
- * Updates the status line.
- * @since 2.1
- */
- private void updateStatus() {
-
- if (!fInstalled)
- return;
-
- String string= fFindString.toString();
- String wrapPrefix= fWrapPosition == -1 ? "" : WRAPPED; //$NON-NLS-1$
- String reversePrefix= fForward ? "" : REVERSE; //$NON-NLS-1$
-
- if (!fFound) {
- String pattern= EditorMessages.getString("Editor.FindIncremental.not_found.pattern"); //$NON-NLS-1$
- statusError(MessageFormat.format(pattern, new Object[] { reversePrefix, wrapPrefix, string }));
-
- } else if (string.length() == 0) {
- if (fForward)
- statusMessage(FIELD_NAME);
- else
- statusMessage(REVERSE_FIELD_NAME);
- } else if (!fForward || fWrapPosition > -1) {
- String pattern= EditorMessages.getString("Editor.FindIncremental.found.pattern"); //$NON-NLS-1$
- statusMessage(MessageFormat.format(pattern, new Object[] { reversePrefix, wrapPrefix, string }));
- } else {
- statusMessage(string);
- }
- }
-
- /*
- * @see VerifyKeyListener#verifyKey(VerifyEvent)
- */
- public void verifyKey(VerifyEvent event) {
-
- if (!event.doit)
- return;
-
- fSearching= true;
- if (event.character == 0) {
-
- switch (event.keyCode) {
-
- // ALT, CTRL, ARROW_LEFT, ARROW_RIGHT == leave
- case SWT.ARROW_LEFT:
- case SWT.ARROW_RIGHT:
- case SWT.HOME:
- case SWT.END:
- case SWT.PAGE_DOWN:
- case SWT.PAGE_UP:
- leave();
- break;
-
- case SWT.ARROW_DOWN:
- saveState();
- setDirection(true);
- repeatSearch(fForward);
- event.doit= false;
- break;
-
- case SWT.ARROW_UP:
- saveState();
- setDirection(false);
- repeatSearch(fForward);
- event.doit= false;
- break;
- }
-
- // event.character != 0
- } else {
-
- switch (event.character) {
-
- // ESC, CR = quit
- case 0x1B:
- case 0x0D:
- leave();
- event.doit= false;
- break;
-
- // backspace and delete
- case 0x08:
- case 0x7F:
- restoreState();
- event.doit= false;
- break;
-
- default:
- if (event.stateMask == 0 || event.stateMask == SWT.SHIFT || event.stateMask == (SWT.ALT | SWT.CTRL)) { // SWT.ALT | SWT.CTRL covers AltGr (see bug 43049)
- saveState();
- addCharSearch(event.character);
- event.doit= false;
- }
- break;
- }
- }
- updateStatus();
- fSearching= false;
- }
-
- /**
- * Repeats the last search while possibly changing the direciton.
- * @param forward <code>true</code> iff the next search should be forward
- * @since 2.1
- */
- private boolean repeatSearch(boolean forward) {
- if (fFindString.length() == 0)
- fFindString= new StringBuffer(fPrevFindString);
-
- String string= fFindString.toString();
- if (string.length() == 0) {
- fFound= true;
- return true;
- }
-
- StyledText text= fTextViewer.getTextWidget();
- // Cannot use fTarget.getSelection since that does not return which side of the
- // selection the caret is on.
- int startIndex= text.getCaretOffset();
- if (!forward)
- startIndex -= 1;
-
- // Check to see if a wrap is necessary
- if (!fFound && (fForward == forward)) {
- startIndex= -1;
- if (fWrapPosition == -1)
- fWrapPosition= fSessionStack.size();
- }
- fForward = forward;
-
- // Find the string
- text.setRedraw(false);
- int index= fTarget.findAndSelect(startIndex, string, fForward, fCasePosition != -1, false);
-
- // Set the caret on the left if the search is reversed
- if (!forward) {
- Point p= fTarget.getSelection();
- text.setSelectionRange(p.x + p.y, -p.y);
- p= null;
- }
- text.setRedraw(true);
-
- // Take appropriate action
- boolean found = (index != -1);
- if (!found && fFound) {
- text= fTextViewer.getTextWidget();
- if (text != null && !text.isDisposed())
- text.getDisplay().beep();
- }
-
- if (found)
- fCurrentIndex= startIndex;
-
- fFound= found;
- return found;
- }
-
- /**
- * Adds the given character to the search string and repeats the search with the last parameters.
- * @param c the character to append to the search pattern
- * @since 2.1
- */
- private boolean addCharSearch(char c) {
- // Add char to pattern
- if (fCasePosition == -1 && Character.isUpperCase(c) && Character.toLowerCase(c) != c)
- fCasePosition= fFindString.length();
-
- fFindString.append(c);
- String string= fFindString.toString();
- StyledText text= fTextViewer.getTextWidget();
-
- text.setRedraw(false);
- int index= fTarget.findAndSelect(fCurrentIndex, string, fForward, fCasePosition != -1, false);
-
- // Set the caret on the left if the search is reversed
- if (!fForward) {
- Point p= fTarget.getSelection();
- text.setSelectionRange(p.x + p.y, -p.y);
- }
- text.setRedraw(true);
-
- // Take appropriate action
- boolean found = (index != -1);
- if (!found && fFound) {
- text= fTextViewer.getTextWidget();
- if (text != null && !text.isDisposed())
- text.getDisplay().beep();
- }
-
- fFound= found;
- return found;
- }
-
- /**
- * Leaves this incremental search session.
- */
- private void leave() {
- if (fFindString.length() != 0)
- fPrevFindString= fFindString.toString();
- statusClear();
- uninstall();
- fSessionStack = null;
- }
-
- /*
- * @see ITextListener#textChanged(TextEvent)
- */
- public void textChanged(TextEvent event) {
- if (event.getDocumentEvent() != null)
- leave();
- }
-
- /*
- * @see MouseListener##mouseDoubleClick(MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- leave();
- }
-
- /*
- * @see MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDown(MouseEvent e) {
- leave();
- }
-
- /*
- * @see MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseUp(MouseEvent e) {
- leave();
- }
-
- /*
- * @see FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
- */
- public void focusGained(FocusEvent e) {
- leave();
- }
-
- /*
- * @see FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
- */
- public void focusLost(FocusEvent e) {
- leave();
- }
-
- /**
- * Sets the given string as status message, clears the status error message.
- * @param string the status message
- */
- private void statusMessage(String string) {
- if (fStatusField != null) {
- if (fIsStatusFieldExtension) {
- ((IStatusFieldExtension)fStatusField).setErrorText(null);
- fStatusField.setText(escapeTabs(string));
- ((IStatusFieldExtension)fStatusField).setVisible(true);
- fStatusLine.update(true);
- } else {
- fStatusLine.setErrorMessage(null);
- fStatusField.setText(escapeTabs(string));
- }
- } else {
- fStatusLine.setErrorMessage(null);
- fStatusLine.setMessage(escapeTabs(string));
- }
- }
-
- /**
- * Sets the status error message, clears the status message.
- * @param string the status error message
- */
- private void statusError(String string) {
- if (fStatusField != null) {
- if (fIsStatusFieldExtension) {
- ((IStatusFieldExtension)fStatusField).setErrorText(escapeTabs(string));
- fStatusField.setText(""); //$NON-NLS-1$
- ((IStatusFieldExtension)fStatusField).setVisible(true);
- fStatusLine.update(true);
- } else {
- fStatusLine.setErrorMessage(escapeTabs(string));
- fStatusField.setText(""); //$NON-NLS-1$
- }
- } else {
- fStatusLine.setErrorMessage(escapeTabs(string));
- fStatusLine.setMessage(null);
- }
- }
-
- /**
- * Clears the status message and the status error message.
- */
- private void statusClear() {
- if (fStatusField != null) {
- if (fIsStatusFieldExtension) {
- fStatusField.setText(""); //$NON-NLS-1$
- ((IStatusFieldExtension)fStatusField).setErrorText(null);
- ((IStatusFieldExtension)fStatusField).setVisible(false);
- fStatusLine.update(true);
- } else {
- fStatusField.setText(""); //$NON-NLS-1$
- fStatusLine.setErrorMessage(null);
- }
- } else {
- fStatusLine.setErrorMessage(null);
- fStatusLine.setMessage(null);
- }
- }
-
- /**
- * Translates all tab characters into a proper status line presentation.
- * @param string the string in which to translate the tabs
- * @return the given string with all tab characters replace with a proper status line presentation
- */
- private String escapeTabs(String string) {
- StringBuffer buffer= new StringBuffer();
-
- int begin= 0;
- int end= string.indexOf('\t', begin);
-
- while (end >= 0) {
- buffer.append(string.substring(begin, end));
- buffer.append(TAB);
- begin= end + 1;
- end= string.indexOf('\t', begin);
- }
- buffer.append(string.substring(begin));
-
- return buffer.toString();
- }
-
- /*
- * @see IFindReplaceTargetExtension#getLineSelection()
- */
- public Point getLineSelection() {
- if (fTarget instanceof IFindReplaceTargetExtension)
- return ((IFindReplaceTargetExtension) fTarget).getLineSelection();
-
- return null; // XXX should not return null
- }
-
- /*
- * @see IFindReplaceTargetExtension#setSelection(int, int)
- */
- public void setSelection(int offset, int length) {
- if (fTarget instanceof IFindReplaceTargetExtension)
- ((IFindReplaceTargetExtension) fTarget).setSelection(offset, length);
- }
-
- /*
- * @see IFindReplaceTargetExtension#setScopeHighlightColor(Color)
- */
- public void setScopeHighlightColor(Color color) {
- }
-
- /*
- * @see ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- * @since 2.1
- */
- public void selectionChanged(SelectionChangedEvent e) {
- boolean ignore= false;
- ISelection selection= e.getSelection();
- if (selection instanceof ITextSelection) {
- ITextSelection textSelection= (ITextSelection)selection;
- Point range= getSelection();
- ignore= textSelection.getOffset() + textSelection.getLength() == range.x + range.y;
- }
- if (!fSearching && !ignore)
- leave();
- }
-
- /**
- * Sets the find status field for this incremental find target.
- *
- * @param field
- * @since 3.0
- */
- void setStatusField(IStatusField statusField) {
- fStatusField= statusField;
- fIsStatusFieldExtension= fStatusField instanceof IStatusFieldExtension;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java
deleted file mode 100644
index 8c9cb3ee600..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.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.ui.texteditor;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Color;
-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.Display;
-import org.eclipse.swt.widgets.Label;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-
-/**
- * A form consisting of a title, a banner, and a info text. Banner and info text are
- * separated by a separator line. This form must be handled like a SWT widget.
- * @since 2.0
- */
-public class InfoForm {
-
- /** The form's root widget */
- private ScrolledComposite fScrolledComposite;
- /** The background color */
- private Color fBackgroundColor;
- /** The foreground color */
- private Color fForegroundColor;
- /** The separator's color */
- private Color fSeparatorColor;
- /** The form header */
- private Label fHeader;
- /** The form banner */
- private Label fBanner;
- /** The form text */
- private Label fText;
- /** The preference change listener */
- private IPropertyChangeListener fPropertyChangeListener;
-
- /**
- * Creates a new info form.
- * @param parent the parent composite
- */
- public InfoForm(Composite parent) {
-
- Display display= parent.getDisplay();
- fBackgroundColor= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
- fForegroundColor= display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
- fSeparatorColor= new Color(display, 152, 170, 203);
-
- fPropertyChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- handlePropertyChange(event);
- }
- };
- JFaceResources.getFontRegistry().addListener(fPropertyChangeListener);
-
- fScrolledComposite= new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- fScrolledComposite.setAlwaysShowScrollBars(false);
- fScrolledComposite.setExpandHorizontal(true);
- fScrolledComposite.setExpandVertical(true);
- fScrolledComposite.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- JFaceResources.getFontRegistry().removeListener(fPropertyChangeListener);
- fScrolledComposite= null;
- fSeparatorColor.dispose();
- fSeparatorColor= null;
- fHeader= null;
- fBanner= null;
- fText= null;
- }
- });
-
- Composite composite= createComposite(fScrolledComposite);
- composite.setLayout(new GridLayout());
-
- fHeader= createHeader(composite, null);
- createLabel(composite, null);
- createLabel(composite, null);
-
- fBanner= createBanner(composite, null);
-
- Composite separator= createCompositeSeparator(composite);
- GridData data= new GridData(GridData.FILL_HORIZONTAL);
- data.heightHint= 2;
- separator.setLayoutData(data);
-
- fText= createLabel(composite, null);
- createLabel(composite, null);
-
- fScrolledComposite.setContent(composite);
- fScrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- createActionControls(composite);
- }
-
- /**
- * Hook method for creating an appropriate action control.
- * @param parent the action control's parent control
- */
- protected void createActionControls(Composite parent) {
- }
-
- /**
- * Returns the control of this form.
- * @return the root control of this form
- */
- public Control getControl() {
- return fScrolledComposite;
- }
-
- /**
- * Sets the header text of this info form.
- * @param header the header text
- */
- public void setHeaderText(String header) {
- fHeader.setText(header);
- }
-
- /**
- * Sets the banner text of this info form.
- * @param banner the banner text
- */
- public void setBannerText(String banner) {
- fBanner.setText(banner);
- }
-
- /**
- * Sets the info of this info form
- * @param info the info text
- */
- public void setInfo(String info) {
- fText.setText(info);
- }
-
- /**
- * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- protected void handlePropertyChange(PropertyChangeEvent event) {
-
- if (fHeader != null)
- fHeader.setFont(JFaceResources.getHeaderFont());
-
- if (fBanner != null)
- fBanner.setFont(JFaceResources.getBannerFont());
-
- Control control= fScrolledComposite.getContent();
- fScrolledComposite.setMinSize(control.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- fScrolledComposite.setContent(control);
-
- fScrolledComposite.layout(true);
- fScrolledComposite.redraw();
- }
-
- /*
- * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createComposite(Composite)
- */
- private Composite createComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setBackground(fBackgroundColor);
- return composite;
- }
-
- /*
- * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createCompositeSeparator(Composite)
- */
- private Composite createCompositeSeparator(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setBackground(fSeparatorColor);
- return composite;
- }
-
- /*
- * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createLabel(Composite, String)
- */
- private Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.NONE);
- if (text != null)
- label.setText(text);
- label.setBackground(fBackgroundColor);
- label.setForeground(fForegroundColor);
- return label;
- }
-
- /*
- * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createHeader(Composite, String)
- */
- private Label createHeader(Composite parent, String text) {
- Label label = new Label(parent, SWT.NONE);
- if (text != null)
- label.setText(text);
- label.setBackground(fBackgroundColor);
- label.setForeground(fForegroundColor);
- label.setFont(JFaceResources.getHeaderFont());
- return label;
- }
-
- /*
- * @see org.eclipse.update.ui.forms.internal.FormWidgetFactory#createBanner(Composite, String)
- */
- private Label createBanner(Composite parent, String text) {
- Label label = new Label(parent, SWT.NONE);
- if (text != null)
- label.setText(text);
- label.setBackground(fBackgroundColor);
- label.setForeground(fForegroundColor);
- label.setFont(JFaceResources.getBannerFont());
- return label;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkAction.java
deleted file mode 100644
index 286a5ee78bb..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkAction.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.texteditor;
-
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.IMarkRegionTarget;
-
-/**
- * An action to handle emacs-like marked regions.
- * @since 2.0
- */
-public class MarkAction extends TextEditorAction {
-
- /** Sets the mark. */
- public static final int SET_MARK= 0;
- /** Clears the mark. */
- public static final int CLEAR_MARK= 1;
- /** Swaps the mark and the cursor position. */
- public static final int SWAP_MARK= 2;
-
- /** The mark action type. */
- private final int fType;
-
- /**
- * Constructor for MarkAction.
- *
- * @param type the mark action type, must be one of
- * <code>SET_MARK</code>, <code>CLEAR_MARK</code> or <code>SWAP_MARK</code>.
- */
- public MarkAction(ResourceBundle bundle, String prefix, ITextEditor editor, int type) {
- super(bundle, prefix, editor);
- fType= type;
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
-
- ITextEditor editor= getTextEditor();
- if (editor == null)
- return;
-
- IMarkRegionTarget target= (IMarkRegionTarget) editor.getAdapter(IMarkRegionTarget.class);
- if (target == null)
- return;
-
- switch (fType) {
- case SET_MARK:
- target.setMarkAtCursor(true);
- break;
-
- case CLEAR_MARK:
- target.setMarkAtCursor(false);
- break;
-
- case SWAP_MARK:
- target.swapMarkAndCursor();
- break;
- }
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkRegionTarget.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkRegionTarget.java
deleted file mode 100644
index 80be5b1d03f..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkRegionTarget.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.ui.texteditor;
-
-
-import org.eclipse.swt.graphics.Point;
-
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.text.IMarkRegionTarget;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension;
-import org.eclipse.jface.text.ITextViewerExtension3;
-
-/**
- * Default implementation of <code>IMarkRegionTarget</code> using <code>ITextViewer</code>
- * and <code>IStatusLineManager</code>.
- * @since 2.0
- */
-public class MarkRegionTarget implements IMarkRegionTarget {
-
- /** The text viewer. */
- private final ITextViewer fViewer;
- /** The status line. */
- private final IStatusLineManager fStatusLine;
-
- /**
- * Creates a MarkRegionTaret.
- *
- * @param viewer the text viewer
- * @param manager the status line manager
- */
- public MarkRegionTarget(ITextViewer viewer, IStatusLineManager manager) {
- fViewer= viewer;
- fStatusLine= manager;
- }
-
- /*
- * @see IMarkregion#setMarkAtCursor(boolean)
- */
- public void setMarkAtCursor(boolean set) {
-
- if (!(fViewer instanceof ITextViewerExtension))
- return;
-
- ITextViewerExtension viewerExtension= ((ITextViewerExtension) fViewer);
-
- if (set) {
- Point selection= fViewer.getSelectedRange();
- viewerExtension.setMark(selection.x);
-
- fStatusLine.setErrorMessage(""); //$NON-NLS-1$
- fStatusLine.setMessage(EditorMessages.getString("Editor.mark.status.message.mark.set")); //$NON-NLS-1$
-
- } else {
- viewerExtension.setMark(-1);
-
- fStatusLine.setErrorMessage(""); //$NON-NLS-1$
- fStatusLine.setMessage(EditorMessages.getString("Editor.mark.status.message.mark.cleared")); //$NON-NLS-1$
- }
- }
-
- /*
- * @see IMarkregion#swapMarkAndCursor()
- */
- public void swapMarkAndCursor() {
-
- if (!(fViewer instanceof ITextViewerExtension))
- return;
-
- ITextViewerExtension viewerExtension= ((ITextViewerExtension) fViewer);
-
- int markPosition= viewerExtension.getMark();
- if (markPosition == -1) {
- fStatusLine.setErrorMessage(EditorMessages.getString("MarkRegionTarget.markNotSet")); //$NON-NLS-1$
- fStatusLine.setMessage(""); //$NON-NLS-1$
- return;
- }
-
- if (!isVisible(fViewer, markPosition)) {
- fStatusLine.setErrorMessage(EditorMessages.getString("MarkRegionTarget.markNotVisible")); //$NON-NLS-1$
- fStatusLine.setMessage(""); //$NON-NLS-1$
- return;
- }
-
- Point selection= fViewer.getSelectedRange();
- viewerExtension.setMark(selection.x);
-
- fViewer.setSelectedRange(markPosition, 0);
- fViewer.revealRange(markPosition, 0);
-
- fStatusLine.setErrorMessage(""); //$NON-NLS-1$
- fStatusLine.setMessage(EditorMessages.getString("Editor.mark.status.message.mark.swapped")); //$NON-NLS-1$
- }
-
- /**
- * Tells whether the given offset is visible in the given text viewer.
- *
- * @param viewer the text viewer
- * @param offset the offset to check
- * @return <code>true</code> if the given offset is visible in the given text viewer
- *
- * @since 2.1
- */
- protected final static boolean isVisible(ITextViewer viewer, int offset) {
- if (viewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) viewer;
- return extension.modelOffset2WidgetOffset(offset) >= 0;
- } else {
- IRegion region= viewer.getVisibleRegion();
- int vOffset= region.getOffset();
- return (vOffset <= offset && offset <= vOffset + region.getLength());
- }
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MoveLinesAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MoveLinesAction.java
deleted file mode 100644
index f804013d222..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MoveLinesAction.java
+++ /dev/null
@@ -1,500 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.texteditor;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Event;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.IRewriteTarget;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension3;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.source.ISourceViewer;
-
-/**
- * Action for moving selected lines in an editor.
- * @since 3.0
- */
-public class MoveLinesAction extends TextEditorAction {
-
- /**
- * Detects the end of a compound edit command. The user is assumed to have ended the command
- * when
- * <ul>
- * <li>entering any text with a different key combination than the one used to move / copy</li>
- * <li>clicking anywhere in the editor</li>
- * <li>the viewer loses focus</li>
- * <li>the underlying document gets changed due to anything but this action</li>
- * </ul>
- */
- private class ExitStrategy implements VerifyKeyListener, MouseListener, FocusListener, IDocumentListener {
-
- /**
- * The widget this instance is registered with for <code>VerifyKey</code>-, <code>Mouse</code>-
- * and <code>FocusEvent</code>s, or <code>null</code> if not registered.
- */
- private StyledText fWidgetEventSource;
- /**
- * The document this instance is registered with for <code>DocumentEvent</code>s,
- * or <code>null</code> if not registered.
- */
- private IDocument fDocumentEventSource;
- /**
- * Indicates whether there are any pending registrations.<br/>
- * Invariant: <code>fIsInstalled || (fWidgetEventSource == fDocumentEventSource == null)</code>
- */
- private boolean fIsInstalled;
-
- /**
- * Installs the exit strategy with all event sources.
- */
- public void install() {
- if (fIsInstalled)
- uninstall();
- fIsInstalled= true;
-
- ISourceViewer viewer= fEditor.getSourceViewer();
- if (viewer == null)
- return;
-
- fWidgetEventSource= viewer.getTextWidget();
- if (fWidgetEventSource == null)
- return;
-
- fWidgetEventSource.addVerifyKeyListener(this);
- fWidgetEventSource.addMouseListener(this);
- fWidgetEventSource.addFocusListener(this);
-
- fDocumentEventSource= viewer.getDocument();
- if (fDocumentEventSource != null)
- fDocumentEventSource.addDocumentListener(this);
- }
-
- /**
- * Uninstalls the exit strategy with all event sources it was previously registered with.
- */
- public void uninstall() {
- if (fWidgetEventSource != null) {
- fWidgetEventSource.removeVerifyKeyListener(this);
- fWidgetEventSource.removeMouseListener(this);
- fWidgetEventSource.removeFocusListener(this);
- fWidgetEventSource= null;
- }
- if (fDocumentEventSource != null) {
- fDocumentEventSource.removeDocumentListener(this);
- fDocumentEventSource= null;
- }
- fIsInstalled= false;
- }
-
- public void verifyKey(VerifyEvent event) {
- if (event.stateMask != fStateMask) {
- endCompoundEdit();
- }
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- endCompoundEdit();
- }
-
- public void mouseDown(MouseEvent e) {
- endCompoundEdit();
- }
-
- public void mouseUp(MouseEvent e) {}
-
- public void focusLost(FocusEvent e) {
- endCompoundEdit();
- }
-
- public void focusGained(FocusEvent e) {}
-
- public void documentAboutToBeChanged(DocumentEvent event) {
- // don't do this since it will break interaction between the moveUp and moveDown actions.
-// if (!fDescription.correspondsTo(event)) endCompoundEdit();
- }
-
- public void documentChanged(DocumentEvent event) {}
- }
-
- /* keys */
-
- /** Key for status message upon illegal move. <p>Value {@value}</p> */
- private static final String ILLEGAL_MOVE= "Editor.MoveLines.IllegalMove.status"; //$NON-NLS-1$
-
- /* state variables - define what this action does */
-
- /** <code>true</code> if lines are shifted upwards, <code>false</code> otherwise. */
- private final boolean fUpwards;
- /** <code>true</code> if lines are to be copied instead of moved. */
- private final boolean fCopy;
- /** The editor we are working on. */
- private final AbstractTextEditor fEditor;
-
- /* compound members of this action */
-
- /** The exit strategy that will detect the ending of a compound edit */
- private final ExitStrategy fExitStrategy= new ExitStrategy();
-
- /* process variables - may change in every run() */
-
- /**
- * Set to <code>true</code> by <code>getMovingSelection</code> if the resulting selection
- * should include the last delimiter.
- */
- private boolean fAddDelimiter;
- /** <code>true</code> if a compound move / copy is going on. */
- private boolean fEditInProgress= false;
- /** stateMask for this action - if it changes, the edition is considered to be ended */
- private int fStateMask;
-// /** Descrition of the last edition triggered by this action */
-// private EditDescription fDescription= new EditDescription();
-
- /**
- * Creates and initializes the action for the given text editor.
- * The action configures its visual representation from the given resource
- * bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or <code>null</code> if none
- * @param editor the text editor
- * @param upwards <code>true</code>if the selected lines should be moved upwards,
- * <code>false</code> if downwards
- * @param copy if <code>true</code>, the action will copy lines instead of moving them
- * @see ResourceAction#ResourceAction
- */
- public MoveLinesAction(ResourceBundle bundle, String prefix, AbstractTextEditor editor, boolean upwards, boolean copy) {
- super(bundle, prefix, editor);
- fEditor= editor;
- fUpwards= upwards;
- fCopy= copy;
- update();
- }
-
- /**
- * Ends the compound change.
- */
- private void beginCompoundEdit() {
- if (fEditInProgress || fEditor == null)
- return;
-
- fEditInProgress= true;
-
- fExitStrategy.install();
-
- IRewriteTarget target= (IRewriteTarget)fEditor.getAdapter(IRewriteTarget.class);
- if (target != null) {
- target.beginCompoundChange();
- }
- }
-
- /**
- * Checks if <code>selection</code> is contained by the visible region of <code>viewer</code>.
- * As a special case, a selection is considered contained even if it extends over the visible
- * region, but the extension stays on a partially contained line and contains only white space.
- *
- * @param selection the selection to be checked
- * @param viewer the viewer displaying a visible region of <code>selection</code>'s document.
- * @return <code>true</code>, if <code>selection</code> is contained, <code>false</code> otherwise.
- */
- private boolean containedByVisibleRegion(ITextSelection selection, ISourceViewer viewer) {
- int min= selection.getOffset();
- int max= min + selection.getLength();
- IDocument document= viewer.getDocument();
-
- IRegion visible;
- if (viewer instanceof ITextViewerExtension3)
- visible= ((ITextViewerExtension3) viewer).getModelCoverage();
- else
- visible= viewer.getVisibleRegion();
-
- int visOffset= visible.getOffset();
- try {
- if (visOffset > min) {
- if (document.getLineOfOffset(visOffset) != selection.getStartLine())
- return false;
- if (!isWhitespace(document.get(min, visOffset - min))) {
- showStatus();
- return false;
- }
- }
- int visEnd= visOffset + visible.getLength();
- if (visEnd < max) {
- if (document.getLineOfOffset(visEnd) != selection.getEndLine())
- return false;
- if (!isWhitespace(document.get(visEnd, max - visEnd))) {
- showStatus();
- return false;
- }
- }
- return true;
- } catch (BadLocationException e) {
- }
- return false;
- }
-
- /**
- * Ends the compound change.
- */
- private void endCompoundEdit() {
- if (!fEditInProgress || fEditor == null)
- return;
-
- fExitStrategy.uninstall();
-
- IRewriteTarget target= (IRewriteTarget)fEditor.getAdapter(IRewriteTarget.class);
- if (target != null) {
- target.endCompoundChange();
- }
-
- fEditInProgress= false;
- }
-
- /**
- * Given a selection on a document, computes the lines fully or partially covered by
- * <code>selection</code>. A line in the document is considered covered if
- * <code>selection</code> comprises any characters on it, including the terminating delimiter.
- * <p>Note that the last line in a selection is not considered covered if the selection only
- * comprises the line delimiter at its beginning (that is considered part of the second last
- * line).
- * As a special case, if the selection is empty, a line is considered covered if the caret is
- * at any position in the line, including between the delimiter and the start of the line. The
- * line containing the delimiter is not considered covered in that case.
- * </p>
- *
- * @param document the document <code>selection</code> refers to
- * @param selection a selection on <code>document</code>
- * @param viewer the <code>ISourceViewer</code> displaying <code>document</code>
- * @return a selection describing the range of lines (partially) covered by
- * <code>selection</code>, without any terminating line delimiters
- * @throws BadLocationException if the selection is out of bounds (when the underlying document has changed during the call)
- */
- private ITextSelection getMovingSelection(IDocument document, ITextSelection selection, ISourceViewer viewer) throws BadLocationException {
- int low= document.getLineOffset(selection.getStartLine());
- int endLine= selection.getEndLine();
- int high= document.getLineOffset(endLine) + document.getLineLength(endLine);
-
- // get everything up to last line without its delimiter
- String delim= document.getLineDelimiter(endLine);
- if (delim != null)
- high -= delim.length();
-
- // the new selection will cover the entire lines being moved, except for the last line's
- // delimiter. The exception to this rule is an empty last line, which will stay covered
- // including its delimiter
- if (delim != null && document.getLineLength(endLine) == delim.length())
- fAddDelimiter= true;
- else
- fAddDelimiter= false;
-
- return new TextSelection(document, low, high - low);
- }
-
- /**
- * Computes the region of the skipped line given the text block to be moved. If
- * <code>fUpwards</code> is <code>true</code>, the line above <code>selection</code>
- * is selected, otherwise the line below.
- *
- * @param document the document <code>selection</code> refers to
- * @param movingArea the selection on <code>document</code> that will be moved.
- * @return the region comprising the line that <code>selection</code> will be moved over, without its terminating delimiter.
- */
- private ITextSelection getSkippedLine(IDocument document, ITextSelection selection) {
- int skippedLineN= (fUpwards ? selection.getStartLine() - 1 : selection.getEndLine() + 1);
- if (skippedLineN < 0 || skippedLineN >= document.getNumberOfLines())
- return null;
- try {
- IRegion line= document.getLineInformation(skippedLineN);
- return new TextSelection(document, line.getOffset(), line.getLength());
- } catch (BadLocationException e) {
- // only happens on concurrent modifications
- return null;
- }
- }
-
- /**
- * Checks for white space in a string.
- *
- * @param string the string to be checked or <code>null</code>
- * @return <code>true</code> if <code>string</code> contains only white space or is
- * <code>null</code>, <code>false</code> otherwise
- */
- private boolean isWhitespace(String string) {
- return string == null ? true : string.trim().length() == 0;
- }
-
- /*
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void runWithEvent(Event event) {
-
- updateShortCut(event);
-
- // get involved objects
- if (fEditor == null)
- return;
-
- if (!validateEditorInputState())
- return;
-
- ISourceViewer viewer= fEditor.getSourceViewer();
- if (viewer == null)
- return;
-
- IDocument document= viewer.getDocument();
- if (document == null)
- return;
-
- StyledText widget= viewer.getTextWidget();
- if (widget == null)
- return;
-
- // get selection
- Point p= viewer.getSelectedRange();
- if (p == null)
- return;
-
- ITextSelection sel= new TextSelection(document, p.x, p.y);
-
- ITextSelection skippedLine= getSkippedLine(document, sel);
- if (skippedLine == null)
- return;
-
- try {
-
- ITextSelection movingArea= getMovingSelection(document, sel, viewer);
-
- // if either the skipped line or the moving lines are outside the widget's
- // visible area, bail out
- if (!containedByVisibleRegion(movingArea, viewer) || !containedByVisibleRegion(skippedLine, viewer))
- return;
-
- // get the content to be moved around: the moving (selected) area and the skipped line
- String moving= movingArea.getText();
- String skipped= skippedLine.getText();
- if (moving == null || skipped == null)
- return;
-
- String delim;
- String insertion;
- int offset, deviation;
- if (fUpwards) {
- delim= document.getLineDelimiter(skippedLine.getEndLine());
- Assert.isNotNull(delim);
- if (fCopy) {
- insertion= moving + delim;
- offset= movingArea.getOffset();
- deviation= 0;
- } else {
- insertion= moving + delim + skipped;
- offset= skippedLine.getOffset();
- deviation= -skippedLine.getLength() - delim.length();
- }
- } else {
- delim= document.getLineDelimiter(movingArea.getEndLine());
- Assert.isNotNull(delim);
- if (fCopy) {
- insertion= moving + delim;
- offset= skippedLine.getOffset();
- deviation= movingArea.getLength() + delim.length();
- } else {
- insertion= skipped + delim + moving;
- offset= movingArea.getOffset();
- deviation= skipped.length() + delim.length();
- }
- }
-
- // modify the document
- beginCompoundEdit();
- if (fCopy) {
-// fDescription= new EditDescription(offset, 0, insertion.length());
- document.replace(offset, 0, insertion);
- } else {
-// fDescription= new EditDescription(offset, insertion.length(), insertion.length());
- document.replace(offset, insertion.length(), insertion);
- }
-
- // move the selection along
- int selOffset= movingArea.getOffset() + deviation;
- int selLength= movingArea.getLength() + (fAddDelimiter ? delim.length() : 0);
- selLength= Math.min(selLength, viewer.getVisibleRegion().getOffset() + viewer.getVisibleRegion().getLength() - selOffset);
- selectAndReveal(viewer, selOffset, selLength);
- } catch (BadLocationException x) {
- // won't happen without concurrent modification - bail out
- return;
- }
- }
-
- /**
- * Saves the state mask of <code>event</code> for comparison with the next event in order to
- * detect key changes in the set of keys pressed by the user.
- *
- * @param event the event that triggered this action
- */
- private void updateShortCut(Event event) {
- fStateMask= event.stateMask;
- }
-
- /**
- * Performs similar to AbstractTextEditor.selectAndReveal, but does not update
- * the viewers highlight area.
- *
- * @param viewer the viewer that we want to select on
- * @param offset the offset of the selection
- * @param length the length of the selection
- */
- private void selectAndReveal(ITextViewer viewer, int offset, int length) {
- // invert selection to avoid jumping to the end of the selection in st.showSelection()
- viewer.setSelectedRange(offset + length, -length);
- //viewer.revealRange(offset, length); // will trigger jumping
- StyledText st= viewer.getTextWidget();
- if (st != null)
- st.showSelection(); // only minimal scrolling
- }
-
- /**
- * Displays information in the status line why a line move is not possible
- */
- private void showStatus() {
- IEditorStatusLine status= (IEditorStatusLine) fEditor.getAdapter(IEditorStatusLine.class);
- if (status == null)
- return;
- status.setMessage(false, EditorMessages.getString(ILLEGAL_MOVE), null);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- super.update();
-
- if (isEnabled())
- setEnabled(canModifyEditor());
-
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/PropagatingFontFieldEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/PropagatingFontFieldEditor.java
deleted file mode 100644
index 20e2ff6fe01..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/PropagatingFontFieldEditor.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.texteditor;
-
-
-
-import org.eclipse.swt.widgets.Composite;
-
-
-/**
- * @deprecated use WorkbenchChainedTextFontFieldEditor
- */
-public final class PropagatingFontFieldEditor extends WorkbenchChainedTextFontFieldEditor {
-
- /**
- * @deprecated use WorkbenchChainedTextFontFieldEditor
- */
- public PropagatingFontFieldEditor(String name, String labelText, Composite parent) {
- super(name, labelText, parent);
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RegExContentAssistProcessor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RegExContentAssistProcessor.java
deleted file mode 100644
index eb93f0da835..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RegExContentAssistProcessor.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.CompletionProposal;
-import org.eclipse.jface.text.contentassist.ContextInformationValidator;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessorExtension;
-import org.eclipse.jface.text.contentassist.IContentAssistSubject;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-
-/**
- * Content assist processor for regular expressions.
- *
- * @since 3.0
- */
-final class RegExContentAssistProcessor implements IContentAssistProcessor, IContentAssistProcessorExtension {
-
- /**
- * The available proposal strings.
- */
- private final static HashMap fgProposalStrings= new HashMap();
-
- /**
- * The available proposal keys.
- */
- private final static ArrayList fgProposalKeys= new ArrayList();
-
-
- static {
-
- //---------- Proposal Keys ----------
-
- fgProposalKeys.add("\\\\"); //$NON-NLS-1$
- fgProposalKeys.add("\\0"); //$NON-NLS-1$
- fgProposalKeys.add("\\x"); //$NON-NLS-1$
- fgProposalKeys.add("\\u"); //$NON-NLS-1$
- fgProposalKeys.add("\\t"); //$NON-NLS-1$
- fgProposalKeys.add("\\n"); //$NON-NLS-1$
- fgProposalKeys.add("\\r"); //$NON-NLS-1$
- fgProposalKeys.add("\\f"); //$NON-NLS-1$
- fgProposalKeys.add("\\a"); //$NON-NLS-1$
- fgProposalKeys.add("\\e"); //$NON-NLS-1$
- fgProposalKeys.add("\\c"); //$NON-NLS-1$
-
- fgProposalKeys.add("."); //$NON-NLS-1$
- fgProposalKeys.add("\\d"); //$NON-NLS-1$
- fgProposalKeys.add("\\D"); //$NON-NLS-1$
- fgProposalKeys.add("\\s"); //$NON-NLS-1$
- fgProposalKeys.add("\\S"); //$NON-NLS-1$
- fgProposalKeys.add("\\w"); //$NON-NLS-1$
- fgProposalKeys.add("\\W"); //$NON-NLS-1$
-
- fgProposalKeys.add("^"); //$NON-NLS-1$
- fgProposalKeys.add("$"); //$NON-NLS-1$
- fgProposalKeys.add("\\b"); //$NON-NLS-1$
- fgProposalKeys.add("\\B"); //$NON-NLS-1$
- fgProposalKeys.add("\\A"); //$NON-NLS-1$
- fgProposalKeys.add("\\G"); //$NON-NLS-1$
-// fgProposalKeys.add("\\Z"); //$NON-NLS-1$
- fgProposalKeys.add("\\z"); //$NON-NLS-1$
-
- fgProposalKeys.add("?"); //$NON-NLS-1$
- fgProposalKeys.add("*"); //$NON-NLS-1$
- fgProposalKeys.add("+"); //$NON-NLS-1$
- fgProposalKeys.add("{n}"); //$NON-NLS-1$
- fgProposalKeys.add("{n,}"); //$NON-NLS-1$
- fgProposalKeys.add("{n,m}"); //$NON-NLS-1$
-
- fgProposalKeys.add("??"); //$NON-NLS-1$
- fgProposalKeys.add("*?"); //$NON-NLS-1$
- fgProposalKeys.add("+?"); //$NON-NLS-1$
- fgProposalKeys.add("{n}?"); //$NON-NLS-1$
- fgProposalKeys.add("{n,}?"); //$NON-NLS-1$
- fgProposalKeys.add("{n,m}?"); //$NON-NLS-1$
-
- fgProposalKeys.add("?+"); //$NON-NLS-1$
- fgProposalKeys.add("*+"); //$NON-NLS-1$
- fgProposalKeys.add("++"); //$NON-NLS-1$
- fgProposalKeys.add("{n}+"); //$NON-NLS-1$
- fgProposalKeys.add("{n,}+"); //$NON-NLS-1$
- fgProposalKeys.add("{n,m}+"); //$NON-NLS-1$
-
- fgProposalKeys.add("UV"); //$NON-NLS-1$
- fgProposalKeys.add("U|V"); //$NON-NLS-1$
- fgProposalKeys.add("(U)"); //$NON-NLS-1$
-
- fgProposalKeys.add("\\i"); //$NON-NLS-1$
- fgProposalKeys.add("$i"); //$NON-NLS-1$
-
- fgProposalKeys.add("\\"); //$NON-NLS-1$
- fgProposalKeys.add("\\Q"); //$NON-NLS-1$
- fgProposalKeys.add("\\E"); //$NON-NLS-1$
-
- fgProposalKeys.add("[ecq]"); //$NON-NLS-1$
- fgProposalKeys.add("[^ecq]"); //$NON-NLS-1$
- fgProposalKeys.add("[e-q]"); //$NON-NLS-1$
- fgProposalKeys.add("&&"); //$NON-NLS-1$
-
-// fgProposalKeys.add("\\p{Lower}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Upper}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{ASCII}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Alpha}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Digit}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Alnum}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Punct}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Graph}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Print}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Blank}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Cntrl}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{XDigit}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Space}"); //$NON-NLS-1$
-//
-// fgProposalKeys.add("\\p{InGreek}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Lu}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\p{Sc}"); //$NON-NLS-1$
-// fgProposalKeys.add("\\P{InGreek}"); //$NON-NLS-1$
-// fgProposalKeys.add("[\\p{L}&&[^\\p{Lu}]"); //$NON-NLS-1$
-
-// fgProposalKeys.add("(?idmsux-idmsux)"); //$NON-NLS-1$
-// fgProposalKeys.add("(?idmsux-idmsux:U)"); //$NON-NLS-1$
-
-// fgProposalKeys.add("(?:U)"); //$NON-NLS-1$
-// fgProposalKeys.add("(?=U)"); //$NON-NLS-1$
-// fgProposalKeys.add("(?!U)"); //$NON-NLS-1$
-// fgProposalKeys.add("(?<=U)"); //$NON-NLS-1$
-// fgProposalKeys.add("(?<!U)"); //$NON-NLS-1$
-// fgProposalKeys.add("(?>U)"); //$NON-NLS-1$
-
- //---------- Proposals ----------
-
- fgProposalStrings.put("\\\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\0", "\\0"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\x", "\\x"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\u", "\\u"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\t", "\\t"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\n", "\\n"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\r", "\\r"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\f", "\\f"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\a", "\\a"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\e", "\\e"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\c", "\\c"); //$NON-NLS-1$ //$NON-NLS-2$
-
- fgProposalStrings.put(".", "."); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\d", "\\d"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\D", "\\D"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\s", "\\s"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\S", "\\S"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\w", "\\w"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\W", "\\W"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("^", "^"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("$", "$"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\b", "\\b"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\B", "\\B"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\A", "\\A"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\G", "\\G"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\Z", "\\Z"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\z", "\\z"); //$NON-NLS-1$ //$NON-NLS-2$
-
- fgProposalStrings.put("?", "?"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("*", "*"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("+", "+"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("{n}", "{}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("{n,}", "{,}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("{n,m}", "{,}"); //$NON-NLS-1$ //$NON-NLS-2$
-
- fgProposalStrings.put("??", "??"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("*?", "*?"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("+?", "+?"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("{n}?", "{}?"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("{n,}?", "{,}?"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("{n,m}?", "{,}?"); //$NON-NLS-1$ //$NON-NLS-2$
-
- fgProposalStrings.put("?+", "?+"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("*+", "*+"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("++", "++"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("{n}+", "{}+"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("{n,}+", "{,}+"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("{n,m}+", "{,}+"); //$NON-NLS-1$ //$NON-NLS-2$
-
- fgProposalStrings.put("UV", ""); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("U|V", "|"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("(U)", "()"); //$NON-NLS-1$ //$NON-NLS-2$
-
- fgProposalStrings.put("\\i", "\\"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("$i", "$"); //$NON-NLS-1$ //$NON-NLS-2$
-
- fgProposalStrings.put("\\", "\\"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\Q", "\\Q"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\E", "\\E"); //$NON-NLS-1$ //$NON-NLS-2$
-
- fgProposalStrings.put("[ecq]", "[]"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("[^ecq]", "^"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("[e-q]", "[]"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("&&", "&&"); //$NON-NLS-1$ //$NON-NLS-2$
-
- fgProposalStrings.put("\\p{Lower}", "\\p{Lower}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Upper}", "\\p{Upper}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{ASCII}", "\\p{ASCII}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Alpha}", "\\p{Alpha}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Digit}", "\\p{Digit}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Alnum}", "\\p{Alnum}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Punct}", "\\p{Punct}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Graph}", "\\p{Graph}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Print}", "\\p{Print}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Blank}", "\\p{Blank}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Cntrl}", "\\p{Cntrl}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{XDigit}", "\\p{XDigit}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Space}", "\\p{Space}"); //$NON-NLS-1$ //$NON-NLS-2$
-
- fgProposalStrings.put("\\p{InGreek}", "\\p{InGreek}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Lu}", "\\p{Lu}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\p{Sc}", "\\p{Sc}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("\\P{InGreek}", "\\P{InGreek}"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("[\\p{L}&&[^\\p{Lu}]","[\\p{L}&&[^\\p{Lu}]"); //$NON-NLS-1$ //$NON-NLS-2$
-
- fgProposalStrings.put("(?:U)", "(?:)"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("(?idmsux-idmsux)", "(?)"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("(?idmsux-idmsux:U)", "(?:)"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("(?=U)", "(?=)"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("(?!U)", "(?!)"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("(?<=U)", "(?<=)"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("(?<!U)", "(?<!)"); //$NON-NLS-1$ //$NON-NLS-2$
- fgProposalStrings.put("(?>U)", "(?>)"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * The context information validator.
- */
- private IContextInformationValidator fValidator= new ContextInformationValidator(this);
-
- /*
- * @see IContentAssistProcessor#computeCompletionProposals(ITextViewer, int)
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
- return computeCompletionProposals((IContentAssistSubject)null, documentOffset);
- }
-
- /*
- * @see IContentAssistProcessor#computeContextInformation(ITextViewer, int)
- */
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
- return computeContextInformation((IContentAssistSubject)null, documentOffset);
- }
-
- /*
- * @see IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
- */
- public char[] getCompletionProposalAutoActivationCharacters() {
- return new char[] {'\\', '[', '('};
- }
-
- /*
- * @see IContentAssistProcessor#getContextInformationAutoActivationCharacters()
- */
- public char[] getContextInformationAutoActivationCharacters() {
- return new char[] { };
-
- }
-
- /*
- * @see IContentAssistProcessor#getContextInformationValidator()
- */
- public IContextInformationValidator getContextInformationValidator() {
- return fValidator;
- }
-
- /*
- * @see IContentAssistProcessor#getErrorMessage()
- */
- public String getErrorMessage() {
- return null;
- }
-
- /*
- * @see IContentAssistProcessorExtension#computeCompletionProposals(IContentAssistSubject, int)
- */
- public ICompletionProposal[] computeCompletionProposals(IContentAssistSubject contentAssistSubject, int documentOffset) {
- List results= new ArrayList(fgProposalKeys.size());
- Iterator iter= fgProposalKeys.iterator();
- while (iter.hasNext())
- addProposal((String)iter.next(), contentAssistSubject, documentOffset, results, true);
-
- if (results.isEmpty()) {
- iter= fgProposalKeys.iterator();
- while (iter.hasNext())
- addProposal((String)iter.next(), contentAssistSubject, documentOffset, results, false);
- }
-
- return (ICompletionProposal[])results.toArray(new ICompletionProposal[results.size()]);
- }
-
- /*
- * @see IContentAssistProcessorExtension#computeContextInformation(IContentAssistSubject, int)
- */
- public IContextInformation[] computeContextInformation(IContentAssistSubject contentAssistSubject, int documentOffset) {
- return null;
- }
-
- private void addProposal(String proposalKey, IContentAssistSubject contentAssistSubject, int documentOffset, List results, boolean filter) {
- String proposal= (String)fgProposalStrings.get(proposalKey);
-
- // compute correct replacement
- if (filter) {
- String selection= null;
- try {
- selection = contentAssistSubject.getDocument().get(documentOffset - 1, 1);
- } catch (BadLocationException e) {
- return ;
- }
- if (selection == null || selection.length() == 0 || proposal.length() == 0 || proposal.charAt(0) != selection.charAt(0))
- return;
-
- proposal= proposal.substring(1);
- }
-
- String displayString= getString(proposalKey, "displayString"); //$NON-NLS-1$
- String additionalInfo= getString(proposalKey, "additionalInfo"); //$NON-NLS-1$
- IContextInformation info= createContextInformation(proposalKey);
-
-// // Move cursor on to the left if the proposal ends with '}'
- int relativeOffset= proposal.length();
- // XXX: currently there's no smartness: position the cursor after the proposal
-// if (relativeOffset > 0 && proposal.charAt(relativeOffset - 1) == '}')
-// relativeOffset--;
-
- results.add(new CompletionProposal(proposal, documentOffset, 0, Math.max(0, relativeOffset), null, displayString, info, additionalInfo));
- }
-
- private IContextInformation createContextInformation(String proposalKey) {
- return null;
- }
-
- private String getString(String proposalKey, String type) {
- return EditorMessages.getString("FindReplace.regExContentAssist." + type + "." + proposalKey); //$NON-NLS-1$//$NON-NLS-2$
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ResourceAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ResourceAction.java
deleted file mode 100644
index 68b128bf0af..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ResourceAction.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.texteditor;
-
-
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-
-
-/**
- * An action which configures its label, image, tooltip, and description from
- * a resource bundle using known keys.
- * <p>
- * Clients may subclass this abstract class to define new kinds of actions. As
- * with <code>Action</code>, subclasses must implement the
- * <code>IAction.run</code> method to carry out the action's semantics.
- * </p>
- */
-public abstract class ResourceAction extends Action {
-
- /**
- * Retrieves and returns the value with the given key from the given resource
- * bundle, or returns the given default value if there is no such resource.
- * Convenience method for dealing gracefully with missing resources.
- *
- * @param bundle the resource bundle
- * @param key the resource key
- * @param defaultValue the default value, or <code>null</code>
- * @return the resource value, or the given default value (which may be
- * <code>null</code>)
- */
- protected static String getString(ResourceBundle bundle, String key, String defaultValue) {
-
- String value= defaultValue;
- try {
- value= bundle.getString(key);
- } catch (MissingResourceException x) {
- }
-
- return value;
- }
-
- /**
- * Creates a new action that configures itself from the given resource
- * bundle.
- * <p>
- * The following keys, prepended by the given option prefix,
- * are used for retrieving resources from the given bundle:
- * <ul>
- * <li><code>"label"</code> - <code>setText</code></li>
- * <li><code>"tooltip"</code> - <code>setToolTipText</code></li>
- * <li><code>"image"</code> - <code>setImageDescriptor</code></li>
- * <li><code>"description"</code> - <code>setDescription</code></li>
- * </ul>
- * </p>
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys, or
- * <code>null</code> if none
- * @param style one of <code>IAction.AS_PUSH_BUTTON</code>, <code>IAction.AS_CHECK_BOX</code>,
- * and <code>IAction.AS_RADIO_BUTTON</code>.
- *
- * @see ResourceAction#ResourceAction
- * @see org.eclipse.jface.action.IAction#AS_CHECK_BOX
- * @see org.eclipse.jface.action.IAction#AS_DROP_DOWN_MENU
- * @see org.eclipse.jface.action.IAction#AS_PUSH_BUTTON
- * @see org.eclipse.jface.action.IAction#AS_RADIO_BUTTON
- * @since 2.1
- */
- public ResourceAction(ResourceBundle bundle, String prefix, int style) {
- super(null, style);
- initialize(bundle, prefix);
- }
-
- /**
- * Creates a new action that configures itself from the given resource
- * bundle.
- * <p>
- * The following keys, prepended by the given option prefix,
- * are used for retrieving resources from the given bundle:
- * <ul>
- * <li><code>"label"</code> - <code>setText</code></li>
- * <li><code>"tooltip"</code> - <code>setToolTipText</code></li>
- * <li><code>"image"</code> - <code>setImageDescriptor</code></li>
- * <li><code>"description"</code> - <code>setDescription</code></li>
- * </ul>
- * </p>
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys, or
- * <code>null</code> if none
- */
- public ResourceAction(ResourceBundle bundle, String prefix) {
- super();
- initialize(bundle, prefix);
- }
-
- /**
- * Sets the action's help context id.
- *
- * @param contextId the help context id
- */
- public final void setHelpContextId(String contextId) {
- WorkbenchHelp.setHelp(this, contextId);
- }
-
- /**
- * Initializes this action using the given bundle and prefix.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys, or <code>null</code> if none
- * @since 2.1
- */
- private void initialize(ResourceBundle bundle, String prefix) {
- String labelKey= "label"; //$NON-NLS-1$
- String tooltipKey= "tooltip"; //$NON-NLS-1$
- String imageKey= "image"; //$NON-NLS-1$
- String descriptionKey= "description"; //$NON-NLS-1$
-
- if (prefix != null && prefix.length() > 0) {
- labelKey= prefix + labelKey;
- tooltipKey= prefix + tooltipKey;
- imageKey= prefix + imageKey;
- descriptionKey= prefix + descriptionKey;
- }
-
- setText(getString(bundle, labelKey, labelKey));
- setToolTipText(getString(bundle, tooltipKey, null));
- setDescription(getString(bundle, descriptionKey, null));
-
- String file= getString(bundle, imageKey, null);
- if (file != null && file.trim().length() > 0)
- setImageDescriptor(ImageDescriptor.createFromFile(getClass(), file));
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RetargetTextEditorAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RetargetTextEditorAction.java
deleted file mode 100644
index db08acedce0..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RetargetTextEditorAction.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.texteditor;
-
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.events.HelpListener;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-
-/**
- * Action used by an editor action bar contributor to establish placeholders in
- * menus or action bars which can be retargeted to dynamically changing actions,
- * for example, those which come from the active editor. This action assumes that
- * the "wrapped" action sends out property change events in response to state
- * changes. It uses these change notifications to adapt its enabling state and
- * its visual presentation.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public final class RetargetTextEditorAction extends ResourceAction {
-
- /** The target action. */
- private IAction fAction;
- /** The default label if there is no target action. */
- private String fDefaultText;
- /**
- * The local help listener
- * @since 2.1
- */
- private HelpListener fLocalHelpListener;
- /** The listener to pick up changes of the target action. */
- private IPropertyChangeListener fListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- update(event);
- }
- };
-
- /**
- * Creates a new action. The action configures its initial visual
- * representation from the given resource bundle. If this action's
- * wrapped action is set to <code>null</code> it also uses the
- * information in the resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param style one of <code>IAction.AS_PUSH_BUTTON</code>, <code>IAction.AS_CHECK_BOX</code>,
- * and <code>IAction.AS_RADIO_BUTTON</code>.
- *
- * @see ResourceAction#ResourceAction
- * @see IAction#AS_CHECK_BOX
- * @see IAction#AS_DROP_DOWN_MENU
- * @see IAction#AS_PUSH_BUTTON
- * @see IAction#AS_RADIO_BUTTON
- * @since 2.1
- */
- public RetargetTextEditorAction(ResourceBundle bundle, String prefix, int style) {
- super(bundle, prefix, style);
- fDefaultText= getText();
- installHelpListener();
- }
-
- /**
- * Creates a new action. The action configures its initial visual
- * representation from the given resource bundle. If this action's
- * wrapped action is set to <code>null</code> it also uses the
- * information in the resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @see ResourceAction#ResourceAction
- */
- public RetargetTextEditorAction(ResourceBundle bundle, String prefix) {
- super(bundle, prefix);
- fDefaultText= getText();
- installHelpListener();
- }
-
- /**
- * Creates a new action. The action configures its initial visual
- * representation from the given resource bundle. If this action's
- * wrapped action is set to <code>null</code> it also uses the
- * information in the resource bundle. The action gets the given
- * action id.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or <code>null</code> if none
- * @param actionId the action id
- * @param style one of <code>IAction.AS_PUSH_BUTTON</code>, <code>IAction.AS_CHECK_BOX</code>,
- * and <code>IAction.AS_RADIO_BUTTON</code>.
- *
- * @see ResourceAction#ResourceAction
- * @see IAction#AS_CHECK_BOX
- * @see IAction#AS_DROP_DOWN_MENU
- * @see IAction#AS_PUSH_BUTTON
- * @see IAction#AS_RADIO_BUTTON
- * @since 2.1
- */
- public RetargetTextEditorAction(ResourceBundle bundle, String prefix, String actionId, int style) {
- super(bundle, prefix, style);
- fDefaultText= getText();
- setId(actionId);
- installHelpListener();
- }
-
- /**
- * Creates a new action. The action configures its initial visual
- * representation from the given resource bundle. If this action's
- * wrapped action is set to <code>null</code> it also uses the
- * information in the resource bundle. The action gets the given
- * action id.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or <code>null</code> if none
- * @param actionId the action id
- * @see ResourceAction#ResourceAction
- * @since 2.0
- */
- public RetargetTextEditorAction(ResourceBundle bundle, String prefix, String actionId) {
- super(bundle, prefix);
- fDefaultText= getText();
- setId(actionId);
- installHelpListener();
- }
-
- /**
- * Updates to the changes of the underlying action.
- *
- * @param event the change event describing the state change
- */
- private void update(PropertyChangeEvent event) {
- if (ENABLED.equals(event.getProperty())) {
- Boolean bool= (Boolean) event.getNewValue();
- setEnabled(bool.booleanValue());
- } else if (TEXT.equals(event.getProperty()))
- setText((String) event.getNewValue());
- else if (TOOL_TIP_TEXT.equals(event.getProperty()))
- setToolTipText((String) event.getNewValue());
- else if (CHECKED.equals(event.getProperty())) {
- Boolean bool= (Boolean) event.getNewValue();
- setChecked(bool.booleanValue());
- }
- }
-
- /**
- * Sets the underlying action.
- *
- * @param action the underlying action
- */
- public void setAction(IAction action) {
-
- if (fAction != null) {
- fAction.removePropertyChangeListener(fListener);
- fAction= null;
- }
-
- fAction= action;
-
- if (fAction == null) {
-
- setEnabled(false);
- if (getStyle() == AS_CHECK_BOX || getStyle() == AS_RADIO_BUTTON)
- setChecked(false);
- setText(fDefaultText);
- setToolTipText(""); //$NON-NLS-1$
-
- } else {
-
- setEnabled(fAction.isEnabled());
- if (fAction.getStyle() == AS_CHECK_BOX || fAction.getStyle() == AS_RADIO_BUTTON)
- super.setChecked(fAction.isChecked());
- setText(fAction.getText());
- setToolTipText(fAction.getToolTipText());
- fAction.addPropertyChangeListener(fListener);
- }
- }
-
- /**
- * Installs the help listener.
- *
- * @since 2.1
- */
- private void installHelpListener() {
- super.setHelpListener(new HelpListener() {
- public void helpRequested(HelpEvent e) {
- HelpListener listener= null;
- if (fAction != null) {
- // if we have a handler, see if it has a help listener
- listener= fAction.getHelpListener();
- if (listener == null)
- // use our own help listener
- listener= fLocalHelpListener;
- }
- if (listener != null)
- // pass on the event
- listener.helpRequested(e);
- }
- });
- }
-
- /**
- * The <code>RetargetTextEditorAction</code> implementation of this method declared on
- * <code>IAction</code> stores the help listener in a local field. The
- * supplied listener is only used if there is no handler.
- *
- * @since 2.1
- */
- public void setHelpListener(HelpListener listener) {
- fLocalHelpListener= listener;
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- if (fAction != null)
- fAction.run();
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RevertToSavedAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RevertToSavedAction.java
deleted file mode 100644
index 976c63cfd57..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RevertToSavedAction.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.texteditor;
-
-
-
-import java.util.ResourceBundle;
-
-
-/**
- * Action for abandoning changes made in the text editor since the last save
- * operation. The action is initially associated with a text editor via the
- * constructor, but that can be subsequently changed using <code>setEditor</code>.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class RevertToSavedAction extends TextEditorAction {
-
- /**
- * Creates a new action for the given text editor. The action configures its
- * visual representation from the given resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param editor the text editor
- * @see ResourceAction#ResourceAction
- */
- public RevertToSavedAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
- super(bundle, prefix, editor);
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- getTextEditor().doRevertToSaved();
- }
-
- /*
- * @see TextEditorAction#update()
- */
- public void update() {
- setEnabled(getTextEditor().isDirty());
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SaveAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SaveAction.java
deleted file mode 100644
index 30ef31776cf..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SaveAction.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.texteditor;
-
-
-
-import java.util.ResourceBundle;
-
-
-/**
- * Action for saving recent changes made in the text editor. The action is
- * initially associated with a text editor via the constructor, but that can be
- * subsequently changed using <code>setEditor</code>.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class SaveAction extends TextEditorAction {
-
- /**
- * Creates a new action for the given text editor. The action configures its
- * visual representation from the given resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param editor the text editor
- * @see ResourceAction#ResourceAction
- */
- public SaveAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
- super(bundle, prefix, editor);
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- getTextEditor().getSite().getPage().saveEditor(getTextEditor(), false);
- }
-
- /*
- * @see TextEditorAction#update()
- */
- public void update() {
- setEnabled(getTextEditor().isDirty());
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ShiftAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ShiftAction.java
deleted file mode 100644
index 84c0e50f659..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ShiftAction.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.texteditor;
-
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.text.ITextOperationTarget;
-
-import org.eclipse.ui.IWorkbenchPartSite;
-
-
-
-/**
- * Action for shifting code to the right or left by one indentation level.
- * @since 2.0
- */
-public class ShiftAction extends TextEditorAction implements IReadOnlyDependent {
-
- /** The text operation code */
- private int fOperationCode= -1;
- /** The text operation target */
- private ITextOperationTarget fOperationTarget;
-
- /**
- * Creates and initializes the action for the given text editor and operation
- * code. The action configures its visual representation from the given resource
- * bundle. The action works by asking the text editor at the time for its
- * text operation target adapter (using
- * <code>getAdapter(ITextOperationTarget.class)</code>. The action runs that
- * operation with the given opcode.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or <code>null</code> if none
- * @param editor the text editor
- * @param operationCode the operation code
- * @see ResourceAction#ResourceAction
- */
- public ShiftAction(ResourceBundle bundle, String prefix, ITextEditor editor, int operationCode) {
- super(bundle, prefix, editor);
- fOperationCode= operationCode;
- update();
- }
-
- /**
- * The <code>TextOperationAction</code> implementation of this
- * <code>IAction</code> method runs the operation with the current
- * operation code.
- */
- public void run() {
- if (fOperationCode == -1 || fOperationTarget == null)
- return;
-
- ITextEditor editor= getTextEditor();
- if (editor == null)
- return;
-
- if (!validateEditorInputState())
- return;
-
- Display display= null;
-
- IWorkbenchPartSite site= editor.getSite();
- Shell shell= site.getShell();
- if (shell != null && !shell.isDisposed())
- display= shell.getDisplay();
-
- BusyIndicator.showWhile(display, new Runnable() {
- public void run() {
- fOperationTarget.doOperation(fOperationCode);
- }
- });
- }
-
- /*
- * @see IUpdate#update()
- */
- public void update() {
- super.update();
- if (!isEnabled())
- return;
-
- if (!canModifyEditor()) {
- setEnabled(false);
- return;
- }
-
- ITextEditor editor= getTextEditor();
- if (fOperationTarget == null && editor != null && fOperationCode != -1)
- fOperationTarget= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
-
- }
-
- /**
- * Enablement when tab key is pressed - the current selection has to be cover multiple lines.
- */
- protected void updateForTab() {
- super.update();
-
- if (isEnabled()) {
- if (!canModifyEditor()) {
- setEnabled(false);
- return;
- }
-
- ITextEditor editor= getTextEditor();
- if (fOperationTarget == null && editor != null && fOperationCode != -1)
- fOperationTarget= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
-
- boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
- setEnabled(isEnabled);
- }
-
- }
-
- /*
- * @see TextEditorAction#setEditor(ITextEditor)
- */
- public void setEditor(ITextEditor editor) {
- super.setEditor(editor);
- fOperationTarget= null;
- }
-
- /*
- * @see IReadOnlyDependent#isEnabled(boolean)
- */
- public boolean isEnabled(boolean isWritable) {
-
- if (!isWritable)
- return false;
-
- /*
- * Note that this implementation still honors the result returned by canDoOperation.
- * I.e. if the viewer is set to read-only, this method still returns false.
- * It covers the case in which the viewer is also writable.
- *
- */
- ITextEditor editor= getTextEditor();
- if (fOperationTarget == null && editor!= null && fOperationCode != -1)
- fOperationTarget= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
-
- return (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SmartEnterAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SmartEnterAction.java
deleted file mode 100644
index c2751b09d91..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SmartEnterAction.java
+++ /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
- * Chris.Dennis@invidi.com - http://bugs.eclipse.org/bugs/show_bug.cgi?id=29027
- *******************************************************************************/
-package org.eclipse.ui.texteditor;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.swt.custom.StyledText;
-
-/**
- * This action implements smart return.
- * Instead of breaking the line where we are, we do the following:
- * <p><b>Smart Enter</b>
- * <ul>
- * <li> if the caret is on a line containing any non-whitespace, a line is inserted below the
- * current one and the caret moved to it,</li>
- * <li> if the caret is on a whitespace-only line, a line is inserted below the current line,
- * but the caret stays in its position.</li>
- * </ul>
- * </p>
- * <p><b>Smart Enter Inverse</b>
- * <ul>
- * <li> if the caret is on a line containing any non-whitespace, we insert a line above the
- * current one and move the caret to it (i.e. it stays at the same offset in the widget),</li>
- * <li> if the caret is on a whitespace-only line, a line is inserted above the current line,
- * but the caret stays in its logical position (i.e., it gets shiftet one line down in the
- * document, but keeps its position relative to the content following the caret).</li>
- * </ul>
- * </p>
- * @since 3.0
- */
-public class SmartEnterAction extends TextEditorAction {
-
- /**
- * <code>true</code> if this action inserts a line above the current (Smart Enter Inverse),
- * <code>false</code> otherwise
- */
- protected boolean fAbove;
-
- /**
- * Creates a new smart enter action.
- * @param bundle the resource bundle
- * @param prefix the prefix to use to get properties from <code>bundle</code>
- * @param textEditor the editor that the action acts upon
- * @param above whether new lines are inserted above or below the caret's line.
- */
- public SmartEnterAction(ResourceBundle bundle, String prefix, ITextEditor textEditor, boolean above) {
- super(bundle, prefix, textEditor);
- fAbove= above;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.TextEditorAction#update()
- */
- public void update() {
- super.update();
- if (isEnabled())
- setEnabled(canModifyEditor());
- }
-
- /*
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- ITextEditor ed= getTextEditor();
- if (!(ed instanceof AbstractTextEditor))
- return;
-
- if (!validateEditorInputState())
- return;
-
- AbstractTextEditor editor= (AbstractTextEditor) ed;
- ISourceViewer sv= editor.getSourceViewer();
- if (sv == null)
- return;
-
- StyledText st= sv.getTextWidget();
- if (st == null || st.isDisposed())
- return;
-
- // get current line
- int caretOffset= st.getCaretOffset();
- int lineNumber= st.getLineAtOffset(caretOffset);
- int lineOffset= st.getOffsetAtLine(lineNumber);
- int lineLength= getLineLength(st, lineNumber, lineOffset);
-
- // insert a new line relative to the current, depending on fAbove
- String line= st.getTextRange(lineOffset, lineLength);
- boolean whiteSpace= isWhitespace(line);
- String delimiter= st.getLineDelimiter();
-
- int insertionPoint; // where the new line should be inserted
-
- if (fAbove) {
- if (whiteSpace)
- insertionPoint= caretOffset;
- else
- insertionPoint= lineOffset + getIndentationLength(line);
- } else {
- insertionPoint= lineOffset + lineLength;
- }
-
- // operating directly on the widget we get all the auto-indentation for free
- st.replaceTextRange(insertionPoint, 0, delimiter);
-
- int newCaretOffset= -1;
- if (fAbove && !whiteSpace) {
- newCaretOffset=
- st.getOffsetAtLine(lineNumber) + getLineLength(st, lineNumber, lineOffset);
- } else if (fAbove || !whiteSpace) {
- int nextLine= lineNumber + 1;
- int nextLineOffset= st.getOffsetAtLine(nextLine);
- int nextLineLength= getLineLength(st, nextLine, nextLineOffset);
- newCaretOffset= nextLineOffset + nextLineLength;
- }
- if (newCaretOffset != -1) {
- st.setCaretOffset(newCaretOffset);
- st.showSelection();
- }
- }
-
- /**
- * Determines the length of a line without the terminating line delimiter
- * @param st the StyledText widget
- * @param lineNumber the number of the line
- * @param lineOffset the line's offset
- * @return the length of the line without terminating delimiter
- */
- private int getLineLength(StyledText st, int lineNumber, int lineOffset) {
- int lineLength;
- if (st.getLineCount() == lineNumber + 1) { // end of display area, no next line
- lineLength= st.getCharCount() - lineOffset;
- } else {
- lineLength= st.getOffsetAtLine(lineNumber + 1); // next line offset
- lineLength -= lineOffset;
- lineLength -= st.getLineDelimiter().length(); // subtract line delim
- }
- return lineLength;
- }
-
- /**
- * Computes the indentation of a line.
- * @param line - a non <code>null</code> string
- * @return the number of whitespace characters at the beginning of <code>line</code>
- */
- private int getIndentationLength(String line) {
- Assert.isNotNull(line);
- int pos;
- for (pos= 0; pos < line.length(); pos++) {
- if (!Character.isWhitespace(line.charAt(pos)))
- break;
- }
- return pos;
- }
-
- /**
- * Checks if a string consists only of whitespace.
- * @param string
- * @return <code>true</code> if <code>string</code> consists of whitespace only,
- * <code>false</code> otherwise.
- */
- private boolean isWhitespace(String string) {
- if (string == null)
- return true;
- return string.trim().length() == 0;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java
deleted file mode 100644
index 9efc6d046d2..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java
+++ /dev/null
@@ -1,768 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.CursorLinePainter;
-import org.eclipse.jface.text.IPainter;
-import org.eclipse.jface.text.ITextViewerExtension2;
-import org.eclipse.jface.text.ITextViewerExtension4;
-import org.eclipse.jface.text.MarginPainter;
-import org.eclipse.jface.text.source.AnnotationPainter;
-import org.eclipse.jface.text.source.IAnnotationAccess;
-import org.eclipse.jface.text.source.ICharacterPairMatcher;
-import org.eclipse.jface.text.source.IOverviewRuler;
-import org.eclipse.jface.text.source.ISharedTextColors;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.MatchingCharacterPainter;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-/**
- * Support for source viewer decoration.
- *
- * @since 2.1
- */
-public class SourceViewerDecorationSupport {
-
-
- /*
- * @see IPropertyChangeListener
- */
- private class FontPropertyChangeListener implements IPropertyChangeListener {
- /*
- * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (fMarginPainter != null && fSymbolicFontName != null && fSymbolicFontName.equals(event.getProperty()))
- fMarginPainter.initialize();
- }
- }
-
-
- /** The viewer */
- private ISourceViewer fSourceViewer;
- /** The viewer's overview ruler */
- private IOverviewRuler fOverviewRuler;
- /** The annotation access */
- private IAnnotationAccess fAnnotationAccess;
- /** The shared color manager */
- private ISharedTextColors fSharedTextColors;
-
- /** The editor's line painter */
- private CursorLinePainter fCursorLinePainter;
- /** The editor's margin ruler painter */
- private MarginPainter fMarginPainter;
- /** The editor's annotation painter */
- private AnnotationPainter fAnnotationPainter;
- /** The editor's peer character painter */
- private MatchingCharacterPainter fMatchingCharacterPainter;
- /** The character painter's pair matcher */
- private ICharacterPairMatcher fCharacterPairMatcher;
-
- /** Table of annotation type preference infos */
- private Map fAnnotationTypeKeyMap= new HashMap();
- /** Preference key for the cursor line highlighting */
- private String fCursorLinePainterEnableKey;
- /** Preference key for the cursor line background color */
- private String fCursorLinePainterColorKey;
- /** Preference key for the margin painter */
- private String fMarginPainterEnableKey;
- /** Preference key for the margin painter color */
- private String fMarginPainterColorKey;
- /** Preference key for the margin painter column */
- private String fMarginPainterColumnKey;
- /** Preference key for the matching character painter */
- private String fMatchingCharacterPainterEnableKey;
- /** Preference key for the matching character painter color */
- private String fMatchingCharacterPainterColorKey;
- /** The property change listener */
- private IPropertyChangeListener fPropertyChangeListener;
- /** The preference store */
- private IPreferenceStore fPreferenceStore;
- /** The symbolic font name */
- private String fSymbolicFontName;
- /** The font change listener */
- private FontPropertyChangeListener fFontPropertyChangeListener;
-
-
- /**
- * Creates a new decoration support for the given viewer.
- *
- * @param sourceViewer the source viewer
- * @param overviewRuler the viewer's overview ruler
- * @param annotationAccess the annotation access
- * @param sharedTextColors the shared text color manager
- */
- public SourceViewerDecorationSupport(ISourceViewer sourceViewer, IOverviewRuler overviewRuler, IAnnotationAccess annotationAccess, ISharedTextColors sharedTextColors) {
- fSourceViewer= sourceViewer;
- fOverviewRuler= overviewRuler;
- fAnnotationAccess= annotationAccess;
- fSharedTextColors= sharedTextColors;
- }
-
- /**
- * Installs this decoration support on th given preference store. It assumes
- * that this support has completely been configured.
- *
- * @param store the preference store
- */
- public void install(IPreferenceStore store) {
-
- fPreferenceStore= store;
- if (fPreferenceStore != null) {
- fPropertyChangeListener= new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- handlePreferenceStoreChanged(event);
- }
- };
- fPreferenceStore.addPropertyChangeListener(fPropertyChangeListener);
- }
-
- updateTextDecorations();
- updateOverviewDecorations();
- }
-
- /**
- * Updates the text docorations for all configured annotation types.
- */
- private void updateTextDecorations() {
-
- StyledText widget= fSourceViewer.getTextWidget();
- if (widget == null || widget.isDisposed())
- return;
-
- if (areMatchingCharactersShown())
- showMatchingCharacters();
- else
- hideMatchingCharacters();
-
- if (isCursorLineShown())
- showCursorLine();
- else
- hideCursorLine();
-
- if (isMarginShown())
- showMargin();
- else
- hideMargin();
-
- Iterator e= fAnnotationTypeKeyMap.keySet().iterator();
- while (e.hasNext()) {
- Object type= e.next();
- if (areAnnotationsShown(type))
- showAnnotations(type, false, false);
- else
- hideAnnotations(type, false, false);
- if (areAnnotationsHighlighted(type))
- showAnnotations(type, true, false);
- else
- hideAnnotations(type, true, false);
- }
- updateAnnotationPainter();
- }
-
- /**
- * Updates the annotation overview for all configured annotation types.
- */
- public void updateOverviewDecorations() {
- Iterator e= fAnnotationTypeKeyMap.keySet().iterator();
- while (e.hasNext()) {
- Object type= e.next();
- if (isAnnotationOverviewShown(type))
- showAnnotationOverview(type);
- else
- hideAnnotationOverview(type);
- }
- }
-
- /**
- * Uninstalls this support from the preference store it has previously been
- * installed on. If there is no such preference store, this call is without
- * effect.
- */
- public void uninstall() {
-
- if (fPreferenceStore != null) {
- fPreferenceStore.removePropertyChangeListener(fPropertyChangeListener);
- fPropertyChangeListener= null;
- fPreferenceStore= null;
- }
-
- if (fFontPropertyChangeListener != null) {
- JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener);
- fFontPropertyChangeListener= null;
- }
- }
-
- /**
- * Disposes this decoration support. Internally calls
- * <code>uninstall</code>.
- */
- public void dispose() {
- uninstall();
- updateTextDecorations();
- updateOverviewDecorations();
- }
-
- /**
- * Sets the character pair matcher for the matching character painter.
- *
- * @param pairMatcher
- */
- public void setCharacterPairMatcher(ICharacterPairMatcher pairMatcher) {
- fCharacterPairMatcher= pairMatcher;
- }
-
- /**
- * Sets the preference keys for the annotation painter.
- *
- * @param type the annotation type
- * @param colorKey the preference key for the color
- * @param editorKey the preference key for the presentation in the text area
- * @param overviewRulerKey the preference key for the presentation in the overview ruler
- * @param layer the layer
- */
- public void setAnnotationPainterPreferenceKeys(Object type, String colorKey, String editorKey, String overviewRulerKey, int layer) {
- AnnotationPreference info= new AnnotationPreference(type, colorKey, editorKey, overviewRulerKey, layer);
- fAnnotationTypeKeyMap.put(type, info);
- }
-
- /**
- * Sets the preference info for the annotation painter.
- * @param info the preference info to be set
- */
- public void setAnnotationPreference(AnnotationPreference info) {
- fAnnotationTypeKeyMap.put(info.getAnnotationType(), info);
- }
-
- /**
- * Sets the preference keys for the cursor line painter.
- * @param enableKey the preference key for the cursor line painter
- * @param colorKey the preference key for the color used by the cursor line
- * painter
- */
- public void setCursorLinePainterPreferenceKeys(String enableKey, String colorKey) {
- fCursorLinePainterEnableKey= enableKey;
- fCursorLinePainterColorKey= colorKey;
- }
-
- /**
- * Sets the preference keys for the margin painter.
- * @param enableKey the preference key for the margin painter
- * @param colorKey the preference key for the color used by the margin
- * painter
- * @param columnKey the preference key for the margin column
- */
- public void setMarginPainterPreferenceKeys(String enableKey, String colorKey, String columnKey) {
- fMarginPainterEnableKey= enableKey;
- fMarginPainterColorKey= colorKey;
- fMarginPainterColumnKey= columnKey;
- }
-
- /**
- * Sets the preference keys for the matching character painter.
- * @param enableKey the preference key for the matching character painter
- * @param colorKey the preference key for the color used by the matching
- * character painter
- */
- public void setMatchingCharacterPainterPreferenceKeys(String enableKey, String colorKey) {
- fMatchingCharacterPainterEnableKey= enableKey;
- fMatchingCharacterPainterColorKey= colorKey;
- }
-
- /**
- * Sets the symbolic font name that is used for computing the margin width.
- * @param symbolicFontName
- */
- public void setSymbolicFontName(String symbolicFontName) {
- fSymbolicFontName= symbolicFontName;
- }
-
- /**
- * Returns the annotation preference for the given key.
- *
- * @param preferenceKey the preference key string
- * @return the annotation preference
- */
- private AnnotationPreference getAnnotationPreferenceInfo(String preferenceKey) {
- Iterator e= fAnnotationTypeKeyMap.values().iterator();
- while (e.hasNext()) {
- AnnotationPreference info= (AnnotationPreference) e.next();
- if (info != null && info.isPreferenceKey(preferenceKey))
- return info;
- }
- return null;
- }
-
-
- /*
- * @see AbstractTextEditor#handlePreferenceStoreChanged(PropertyChangeEvent)
- */
- protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
-
- String p= event.getProperty();
-
- if (fMatchingCharacterPainterEnableKey != null && fMatchingCharacterPainterEnableKey.equals(p) && fCharacterPairMatcher != null) {
- if (areMatchingCharactersShown())
- showMatchingCharacters();
- else
- hideMatchingCharacters();
- return;
- }
-
- if (fMatchingCharacterPainterColorKey != null && fMatchingCharacterPainterColorKey.equals(p)) {
- if (fMatchingCharacterPainter != null) {
- fMatchingCharacterPainter.setColor(getColor(fMatchingCharacterPainterColorKey));
- fMatchingCharacterPainter.paint(IPainter.CONFIGURATION);
- }
- return;
- }
-
- if (fCursorLinePainterEnableKey != null && fCursorLinePainterEnableKey.equals(p)) {
- if (isCursorLineShown())
- showCursorLine();
- else
- hideCursorLine();
- return;
- }
-
- if (fCursorLinePainterColorKey != null && fCursorLinePainterColorKey.equals(p)) {
- if (fCursorLinePainter != null) {
- hideCursorLine();
- showCursorLine();
- }
- return;
- }
-
- if (fMarginPainterEnableKey != null && fMarginPainterEnableKey.equals(p)) {
- if (isMarginShown())
- showMargin();
- else
- hideMargin();
- return;
- }
-
- if (fMarginPainterColorKey != null && fMarginPainterColorKey.equals(p)) {
- if (fMarginPainter != null) {
- fMarginPainter.setMarginRulerColor(getColor(fMarginPainterColorKey));
- fMarginPainter.paint(IPainter.CONFIGURATION);
- }
- return;
- }
-
- if (fMarginPainterColumnKey != null && fMarginPainterColumnKey.equals(p)) {
- if (fMarginPainter != null && fPreferenceStore != null) {
- fMarginPainter.setMarginRulerColumn(fPreferenceStore.getInt(fMarginPainterColumnKey));
- fMarginPainter.paint(IPainter.CONFIGURATION);
- }
- return;
- }
-
- AnnotationPreference info= getAnnotationPreferenceInfo(p);
- if (info != null) {
-
- if (info.getColorPreferenceKey().equals(p)) {
- Color color= getColor(info.getColorPreferenceKey());
- if (fAnnotationPainter != null) {
- fAnnotationPainter.setAnnotationTypeColor(info.getAnnotationType(), color);
- fAnnotationPainter.paint(IPainter.CONFIGURATION);
- }
- setAnnotationOverviewColor(info.getAnnotationType(), color);
- return;
- }
-
- if (info.getTextPreferenceKey().equals(p)) {
- if (areAnnotationsShown(info.getAnnotationType()))
- showAnnotations(info.getAnnotationType(), false, true);
- else
- hideAnnotations(info.getAnnotationType(), false, true);
- return;
- }
-
- if (info.getHighlightPreferenceKey() != null && info.getHighlightPreferenceKey().equals(p)) {
- if (areAnnotationsHighlighted(info.getAnnotationType()))
- showAnnotations(info.getAnnotationType(), true, true);
- else
- hideAnnotations(info.getAnnotationType(), true, true);
- return;
- }
-
- if (info.getOverviewRulerPreferenceKey().equals(p)) {
- if (isAnnotationOverviewShown(info.getAnnotationType()))
- showAnnotationOverview(info.getAnnotationType());
- else
- hideAnnotationOverview(info.getAnnotationType());
- return;
- }
- }
-
- }
-
- /**
- * Returns the shared color for the given key.
- *
- * @param key the color key string
- * @return the shared color for the given key
- */
- private Color getColor(String key) {
- if (fPreferenceStore != null) {
- RGB rgb= PreferenceConverter.getColor(fPreferenceStore, key);
- return getColor(rgb);
- }
- return null;
- }
-
- /**
- * Returns the shared color for the given RGB.
- *
- * @param rgb the rgb
- * @return the shared color for the given rgb
- */
- private Color getColor(RGB rgb) {
- return fSharedTextColors.getColor(rgb);
- }
-
- /**
- * Returns the color of the given annotation type.
- *
- * @param annotationType the annotation type
- * @return the color of the annotation type
- */
- private Color getAnnotationTypeColor(Object annotationType) {
- AnnotationPreference info= (AnnotationPreference) fAnnotationTypeKeyMap.get(annotationType);
- if (info != null)
- return getColor( info.getColorPreferenceKey());
- return null;
- }
-
-
-
- /**
- * Returns the layer of the given annotation type.
- *
- * @param annotationType the annotation type
- * @return the layer
- */
- private int getAnnotationTypeLayer(Object annotationType) {
- AnnotationPreference info= (AnnotationPreference) fAnnotationTypeKeyMap.get(annotationType);
- if (info != null)
- return info.getPresentationLayer();
- return 0;
- }
-
- /**
- * Enables showing of matching characters.
- */
- private void showMatchingCharacters() {
- if (fMatchingCharacterPainter == null) {
- if (fSourceViewer instanceof ITextViewerExtension2) {
- fMatchingCharacterPainter= new MatchingCharacterPainter(fSourceViewer, fCharacterPairMatcher);
- fMatchingCharacterPainter.setColor(getColor(fMatchingCharacterPainterColorKey));
- ITextViewerExtension2 extension= (ITextViewerExtension2) fSourceViewer;
- extension.addPainter(fMatchingCharacterPainter);
- }
- }
- }
-
- /**
- * Disables showing of matching characters.
- */
- private void hideMatchingCharacters() {
- if (fMatchingCharacterPainter != null) {
- if (fSourceViewer instanceof ITextViewerExtension2) {
- ITextViewerExtension2 extension= (ITextViewerExtension2) fSourceViewer;
- extension.removePainter(fMatchingCharacterPainter);
- fMatchingCharacterPainter.deactivate(true);
- fMatchingCharacterPainter.dispose();
- fMatchingCharacterPainter= null;
- }
- }
- }
-
- /**
- * Tells whether matching charaters are shown.
- *
- * @return <code>true</code> if the matching characters are shown
- */
- private boolean areMatchingCharactersShown() {
- if (fPreferenceStore != null && fMatchingCharacterPainterEnableKey != null)
- return fPreferenceStore.getBoolean(fMatchingCharacterPainterEnableKey);
- return false;
- }
-
- /**
- * Shows the cursor line.
- */
- private void showCursorLine() {
- if (fCursorLinePainter == null) {
- if (fSourceViewer instanceof ITextViewerExtension2) {
- fCursorLinePainter= new CursorLinePainter(fSourceViewer);
- fCursorLinePainter.setHighlightColor(getColor(fCursorLinePainterColorKey));
- ITextViewerExtension2 extension= (ITextViewerExtension2) fSourceViewer;
- extension.addPainter(fCursorLinePainter);
- }
- }
- }
-
- /**
- * Hides the cursor line.
- */
- private void hideCursorLine() {
- if (fCursorLinePainter != null) {
- if (fSourceViewer instanceof ITextViewerExtension2) {
- ITextViewerExtension2 extension= (ITextViewerExtension2) fSourceViewer;
- extension.removePainter(fCursorLinePainter);
- fCursorLinePainter.deactivate(true);
- fCursorLinePainter.dispose();
- fCursorLinePainter= null;
- }
- }
- }
-
- /**
- * Tells whether the cursor line is shown.
- *
- * @return <code>true</code> f the cursor line is shown
- */
- private boolean isCursorLineShown() {
- if (fPreferenceStore != null && fCursorLinePainterEnableKey != null)
- return fPreferenceStore.getBoolean(fCursorLinePainterEnableKey);
- return false;
- }
-
- /**
- * Shows the margin.
- */
- private void showMargin() {
- if (fMarginPainter == null) {
- if (fSourceViewer instanceof ITextViewerExtension2) {
- fMarginPainter= new MarginPainter(fSourceViewer);
- fMarginPainter.setMarginRulerColor(getColor(fMarginPainterColorKey));
- if (fPreferenceStore != null)
- fMarginPainter.setMarginRulerColumn(fPreferenceStore.getInt(fMarginPainterColumnKey));
- ITextViewerExtension2 extension= (ITextViewerExtension2) fSourceViewer;
- extension.addPainter(fMarginPainter);
-
- fFontPropertyChangeListener= new FontPropertyChangeListener();
- JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener);
- }
- }
- }
-
- /**
- * Hides the margin.
- */
- private void hideMargin() {
- if (fMarginPainter != null) {
- if (fSourceViewer instanceof ITextViewerExtension2) {
- JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener);
- fFontPropertyChangeListener= null;
-
- ITextViewerExtension2 extension= (ITextViewerExtension2) fSourceViewer;
- extension.removePainter(fMarginPainter);
- fMarginPainter.deactivate(true);
- fMarginPainter.dispose();
- fMarginPainter= null;
- }
- }
- }
-
- /**
- * Tells whether the margin is shown.
- *
- * @return <code>true</code> if the margin is shown
- */
- private boolean isMarginShown() {
- if (fPreferenceStore != null && fMarginPainterEnableKey != null)
- return fPreferenceStore.getBoolean(fMarginPainterEnableKey);
- return false;
- }
-
- /**
- * Enables annotations in the source viewer for the given annotation type.
- *
- * @param annotationType the annotation type
- * @param highlighting <code>true</code> if highlighting <code>false</code> if painting squiggles
- * @param updatePainter if <code>true</code> update the annotation painter
- */
- private void showAnnotations(Object annotationType, boolean highlighting, boolean updatePainter) {
- if (fSourceViewer instanceof ITextViewerExtension2) {
- if (fAnnotationPainter == null) {
- fAnnotationPainter= new AnnotationPainter(fSourceViewer, fAnnotationAccess);
- if (fSourceViewer instanceof ITextViewerExtension4)
- ((ITextViewerExtension4)fSourceViewer).addTextPresentationListener(fAnnotationPainter);
- ITextViewerExtension2 extension= (ITextViewerExtension2) fSourceViewer;
- extension.addPainter(fAnnotationPainter);
- }
- fAnnotationPainter.setAnnotationTypeColor(annotationType, getAnnotationTypeColor(annotationType));
- if (highlighting)
- fAnnotationPainter.addHighlightAnnotationType(annotationType);
- else
- fAnnotationPainter.addAnnotationType(annotationType);
-
- if (updatePainter)
- updateAnnotationPainter();
- }
- }
-
- /**
- * Updates the annotation painter.
- */
- private void updateAnnotationPainter() {
- if (fAnnotationPainter == null)
- return;
-
- fAnnotationPainter.paint(IPainter.CONFIGURATION);
- if (!fAnnotationPainter.isPaintingAnnotations()) {
- if (fSourceViewer instanceof ITextViewerExtension2) {
- ITextViewerExtension2 extension= (ITextViewerExtension2) fSourceViewer;
- extension.removePainter(fAnnotationPainter);
- }
- if (fSourceViewer instanceof ITextViewerExtension4)
- ((ITextViewerExtension4)fSourceViewer).removeTextPresentationListener(fAnnotationPainter);
-
- fAnnotationPainter.deactivate(true);
- fAnnotationPainter.dispose();
- fAnnotationPainter= null;
- }
- }
-
- /**
- * Hides annotations in the source viewer for the given annotation type.
- *
- * @param annotationType the annotation type
- * @param highlighting <code>true</code> if highlighting <code>false</code> if painting squiggles
- * @param updatePainter if <code>true</code> update the annotation painter
- * @since 3.0
- */
- private void hideAnnotations(Object annotationType, boolean highlighting, boolean updatePainter) {
- if (fAnnotationPainter != null) {
- if (highlighting)
- fAnnotationPainter.removeHighlightAnnotationType(annotationType);
- else
- fAnnotationPainter.removeAnnotationType(annotationType);
-
- if (updatePainter) {
- updateAnnotationPainter();
- }
- }
- }
-
- /**
- * Tells whether annotations are shown in the source viewer for the given type.
- *
- * @param annotationType the annotation type
- * @return <code>true</code> if the annotations are shown
- */
- private boolean areAnnotationsShown(Object annotationType) {
- if (fPreferenceStore != null) {
- AnnotationPreference info= (AnnotationPreference) fAnnotationTypeKeyMap.get(annotationType);
- if (info != null)
- return fPreferenceStore.getBoolean(info.getTextPreferenceKey());
- }
- return false;
- }
-
- /**
- * Tells whether annotations are highlighted in the source viewer for the given type.
- *
- * @param annotationType the annotation type
- * @return <code>true</code> if the annotations are highlighted
- * @since 3.0
- */
- private boolean areAnnotationsHighlighted(Object annotationType) {
- if (fPreferenceStore != null) {
- AnnotationPreference info= (AnnotationPreference)fAnnotationTypeKeyMap.get(annotationType);
- if (info != null)
- return info.getHighlightPreferenceKey() != null && fPreferenceStore.getBoolean(info.getHighlightPreferenceKey());
- }
- return false;
- }
-
- /**
- * Tells whether annotation overview is enabled for the given type.
- *
- * @param annotationType the annotation type
- * @return <code>true</code> if the annotation overview is shown
- */
- private boolean isAnnotationOverviewShown(Object annotationType) {
- if (fPreferenceStore != null && fOverviewRuler != null) {
- AnnotationPreference info= (AnnotationPreference) fAnnotationTypeKeyMap.get(annotationType);
- if (info != null)
- return fPreferenceStore.getBoolean(info.getOverviewRulerPreferenceKey());
- }
- return false;
- }
-
- /**
- * Enable annotation overview for the given annotation type.
- *
- * @param annotationType the annotation type
- */
- private void showAnnotationOverview(Object annotationType) {
- if (fOverviewRuler != null) {
- fOverviewRuler.setAnnotationTypeColor(annotationType, getAnnotationTypeColor(annotationType));
- fOverviewRuler.setAnnotationTypeLayer(annotationType, getAnnotationTypeLayer(annotationType));
- fOverviewRuler.addAnnotationType(annotationType);
- fOverviewRuler.update();
- }
- }
-
- /**
- * Hides the annotation overview for the given type.
- * @param annotationType the annotation type
- */
- private void hideAnnotationOverview(Object annotationType) {
- if (fOverviewRuler != null) {
- fOverviewRuler.removeAnnotationType(annotationType);
- fOverviewRuler.update();
- }
- }
-
- /**
- * Hides the annotation overview.
- * @param annotationType the annotation type
- */
- public void hideAnnotationOverview() {
- if (fOverviewRuler != null) {
- Iterator e= fAnnotationTypeKeyMap.keySet().iterator();
- while (e.hasNext())
- fOverviewRuler.removeAnnotationType(e.next());
- fOverviewRuler.update();
- }
- }
-
- /**
- * Sets the annotion overview color for the given annotation type.
- *
- * @param annotationType the annotation type
- * @param color the color
- */
- private void setAnnotationOverviewColor(Object annotationType, Color color) {
- if (fOverviewRuler != null) {
- fOverviewRuler.setAnnotationTypeColor(annotationType, color);
- fOverviewRuler.update();
- }
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusLineContributionItem.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusLineContributionItem.java
deleted file mode 100644
index 4b26773248b..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusLineContributionItem.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.StatusLineLayoutData;
-import org.eclipse.jface.resource.JFaceColors;
-
-/**
- * Contribution item for the status line.
- * @since 2.0
- */
-public class StatusLineContributionItem extends ContributionItem implements IStatusField, IStatusFieldExtension {
-
- /**
- * Internal mouse listener to track double clicking the status line item.
- * @since 3.0
- */
- private class Listener extends MouseAdapter {
- /*
- * @see org.eclipse.swt.events.MouseAdapter#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- if (fActionHandler != null && fActionHandler.isEnabled())
- fActionHandler.run();
- }
- }
-
- /**
- * Left and right margin used in CLabel.
- * @since 2.1
- */
- private static final int INDENT= 3;
- /**
- * Default number of characters that should fit into the item.
- * @since 2.1
- */
- static final int DEFAULT_WIDTH_IN_CHARS= 14;
- /**
- * Precomputed label width hint.
- * @since 2.1
- */
- private int fFixedWidth= -1;
- /** The text */
- private String fText;
- /** The image */
- private Image fImage;
- /**
- * The error text.
- * @since 3.0
- */
- private String fErrorText;
- /**
- * The error image.
- * @since 3.0
- */
- private Image fErrorImage;
- /**
- * The tool tip text.
- * @since 3.0
- */
- private String fToolTipText;
- /**
- * Number of characters that should fit into the item.
- * @since 3.0
- */
- private int fWidthInChars;
- /** The status line label widget */
- private CLabel fLabel;
- /**
- * The action handler.
- * @since 3.0
- */
- private IAction fActionHandler;
- /**
- * The mouse listener
- * @since 3.0
- */
- private MouseListener fMouseListener;
-
-
- /**
- * Creates a new item with the given id.
- *
- * @param id the item's id
- */
- public StatusLineContributionItem(String id) {
- this(id, true, DEFAULT_WIDTH_IN_CHARS);
- }
-
- /**
- * Creates a new item with the given attributes.
- *
- * @param id the item's id
- * @param visible the visibility of this item
- * @param widthInChars the width in characters
- * @since 3.0
- */
- public StatusLineContributionItem(String id, boolean visible, int widthInChars) {
- super(id);
- setVisible(visible);
- fWidthInChars= widthInChars;
- }
-
- /*
- * @see IStatusField#setText(String)
- */
- public void setText(String text) {
- fText= text;
- updateMessageLabel();
- }
-
- /*
- * @see IStatusField#setImage(Image)
- */
- public void setImage(Image image) {
- fImage= image;
- updateMessageLabel();
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IStatusFieldExtension#setErrorText(java.lang.String)
- * @since 3.0
- */
- public void setErrorText(String text) {
- fErrorText= text;
- updateMessageLabel();
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IStatusFieldExtension#setErrorImage(org.eclipse.swt.graphics.Image)
- * @since 3.0
- */
- public void setErrorImage(Image image) {
- fErrorImage= image;
- updateMessageLabel();
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IStatusFieldExtension#setToolTipText(java.lang.String)
- * @since 3.0
- */
- public void setToolTipText(String string) {
- fToolTipText= string;
- updateMessageLabel();
- }
-
- /*
- * @see IContributionItem#fill(Composite)
- */
- public void fill(Composite parent) {
-
- fLabel= new CLabel(parent, SWT.SHADOW_IN);
- fLabel.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- fMouseListener= null;
- }
- });
- if (fActionHandler != null) {
- fMouseListener= new Listener();
- fLabel.addMouseListener(fMouseListener);
- }
-
- StatusLineLayoutData data = new StatusLineLayoutData();
- data.widthHint= getWidthHint(parent);
- fLabel.setLayoutData(data);
-
- if (fText != null)
- fLabel.setText(fText);
- }
-
- public void setActionHandler(IAction actionHandler) {
- if (fActionHandler != null && actionHandler == null && fMouseListener != null) {
- if (!fLabel.isDisposed())
- fLabel.removeMouseListener(fMouseListener);
- fMouseListener= null;
- }
-
- fActionHandler= actionHandler;
-
- if (fLabel != null && !fLabel.isDisposed() && fMouseListener == null && fActionHandler != null) {
- fMouseListener= new Listener();
- fLabel.addMouseListener(fMouseListener);
- }
- }
-
- /**
- * Returns the width hint for this label.
- *
- * @param control the root control of this label
- * @return the width hint for this label
- * @since 2.1
- */
- private int getWidthHint(Composite control) {
- if (fFixedWidth < 0) {
- GC gc= new GC(control);
- gc.setFont(control.getFont());
- fFixedWidth= gc.getFontMetrics().getAverageCharWidth() * fWidthInChars;
- fFixedWidth += INDENT * 2;
- gc.dispose();
- }
- return fFixedWidth;
- }
-
- /**
- * Updates the message label widget.
- *
- * @since 3.0
- */
- private void updateMessageLabel() {
- if (fLabel != null && !fLabel.isDisposed()) {
- Display display = fLabel.getDisplay();
- if ((fErrorText != null && fErrorText.length() > 0) || fErrorImage != null) {
- fLabel.setForeground(JFaceColors.getErrorText(display));
- fLabel.setText(fErrorText);
- fLabel.setImage(fErrorImage);
- if (fToolTipText != null)
- fLabel.setToolTipText(fToolTipText);
- else if (fErrorText.length() > fWidthInChars)
- fLabel.setToolTipText(fErrorText);
- else
- fLabel.setToolTipText(null);
- }
- else {
- fLabel.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
- fLabel.setText(fText);
- fLabel.setImage(fImage);
- if (fToolTipText != null)
- fLabel.setToolTipText(fToolTipText);
- else if (fText != null && fText.length() > fWidthInChars)
- fLabel.setToolTipText(fText);
- else
- fLabel.setToolTipText(null);
- }
- }
- }
-}
-
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java
deleted file mode 100644
index eee9e64109a..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.ui.IEditorInput;
-
-
-/**
- * Capable of handling input elements that have an associated status with them.
- * @since 2.0
- */
-public class StatusTextEditor extends AbstractTextEditor {
-
- /** The root composite of this editor */
- private Composite fParent;
- /** The layout used to manage the regular and the status page */
- private StackLayout fStackLayout;
- /** The root composite for the regular page */
- private Composite fDefaultComposite;
- /** The status page */
- private Control fStatusControl;
-
- /*
- * @see IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
-
- fParent= new Composite(parent, SWT.NONE);
- fStackLayout= new StackLayout();
- fParent.setLayout(fStackLayout);
-
- fDefaultComposite= new Composite(fParent, SWT.NONE);
- fDefaultComposite.setLayout(new FillLayout());
- super.createPartControl(fDefaultComposite);
-
- updatePartControl(getEditorInput());
- }
-
- /**
- * Checks if the status of the given input is OK. If not the
- * status control is shown rather than the default control.
- *
- * @param input the input whose status is checked
- */
- public void updatePartControl(IEditorInput input) {
-
- if (fStatusControl != null) {
- fStatusControl.dispose();
- fStatusControl= null;
- }
-
- Control front= null;
- if (fParent != null && input != null) {
- if (getDocumentProvider() instanceof IDocumentProviderExtension) {
- IDocumentProviderExtension extension= (IDocumentProviderExtension) getDocumentProvider();
- IStatus status= extension.getStatus(input);
- if (!isErrorStatus(status)) {
- front= fDefaultComposite;
- } else {
- fStatusControl= createStatusControl(fParent, status);
- front= fStatusControl;
- }
- }
- }
-
- if (fStackLayout.topControl != front) {
- fStackLayout.topControl= front;
- fParent.layout();
- updateStatusFields();
- }
- }
-
- /**
- * Returns whether the given status indicates an error. Subclasses may override.
- *
- * @param status the status to be checked
- * @return <code>true</code> if the status indicates an error, <code>false</code> otherwise\
- * @since 3.0
- */
- protected boolean isErrorStatus(IStatus status) {
- return status != null && !status.isOK();
- }
-
- /**
- * Creates the status control for the given status.
- * May be overridden by subclasses.
- *
- * @param parent the parent control
- * @param status the status
- * @return the new status control
- */
- protected Control createStatusControl(Composite parent, IStatus status) {
- InfoForm infoForm= new InfoForm(parent);
- infoForm.setHeaderText(getStatusHeader(status));
- infoForm.setBannerText(getStatusBanner(status));
- infoForm.setInfo(getStatusMessage(status));
- return infoForm.getControl();
- }
-
- /**
- * Returns a header for the given status
- *
- * @param status the status whose message is returned
- * @return a header for the given status
- */
- protected String getStatusHeader(IStatus status) {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Returns a banner for the given status.
- *
- * @param status the status whose message is returned
- * @return a banner for the given status
- */
- protected String getStatusBanner(IStatus status) {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Returns a message for the given status.
- *
- * @param status the status whose message is returned
- * @return a message for the given status
- */
- protected String getStatusMessage(IStatus status) {
- return status.getMessage();
- }
-
- /*
- * @see AbstractTextEditor#updateStatusField(String)
- */
- protected void updateStatusField(String category) {
- IDocumentProvider provider= getDocumentProvider();
- if (provider instanceof IDocumentProviderExtension) {
- IDocumentProviderExtension extension= (IDocumentProviderExtension) provider;
- IStatus status= extension.getStatus(getEditorInput());
- if (isErrorStatus(status)) {
- IStatusField field= getStatusField(category);
- if (field != null) {
- field.setText(fErrorLabel);
- return;
- }
- }
- }
-
- super.updateStatusField(category);
- }
-
- /*
- * @see AbstractTextEditor#doSetInput(IEditorInput)
- */
- protected void doSetInput(IEditorInput input) throws CoreException {
- super.doSetInput(input);
- if (fParent != null && !fParent.isDisposed())
- updatePartControl(getEditorInput());
- }
-
- /*
- * @see ITextEditor#doRevertToSaved()
- */
- public void doRevertToSaved() {
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=19014
- super.doRevertToSaved();
- if (fParent != null && !fParent.isDisposed())
- updatePartControl(getEditorInput());
- }
-
- /*
- * @see AbstractTextEditor#sanityCheckState(IEditorInput)
- */
- protected void sanityCheckState(IEditorInput input) {
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=19014
- super.sanityCheckState(input);
- if (fParent != null && !fParent.isDisposed())
- updatePartControl(getEditorInput());
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextEditorAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextEditorAction.java
deleted file mode 100644
index 8b11c57a49b..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextEditorAction.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.texteditor;
-
-
-import java.util.ResourceBundle;
-
-/**
- * Skeleton of a standard text editor action. The action is
- * initially associated with a text editor via the constructor,
- * but can subsequently be changed using <code>setEditor</code>.
- * Subclasses must implement the <code>run</code> method and if
- * required override the <code>update</code> method.
- */
-public abstract class TextEditorAction extends ResourceAction implements IUpdate {
-
- /** The action's editor */
- private ITextEditor fTextEditor;
-
- /**
- * Creates and initializes the action for the given text editor. The action
- * configures its visual representation from the given resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param editor the text editor
- * @see ResourceAction#ResourceAction
- */
- protected TextEditorAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
- super(bundle, prefix);
- setEditor(editor);
- update();
- }
-
- /**
- * Creates and initializes the action for the given text editor. The action
- * configures its visual representation from the given resource bundle.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param editor the text editor
- * @param style the style of this action
- * @see ResourceAction#ResourceAction
- * @since 3.0
- */
- protected TextEditorAction(ResourceBundle bundle, String prefix, ITextEditor editor, int style) {
- super(bundle, prefix, style);
- setEditor(editor);
- update();
- }
-
- /**
- * Returns the action's text editor.
- *
- * @return the action's text editor
- */
- protected ITextEditor getTextEditor() {
- return fTextEditor;
- }
-
- /**
- * Retargets this action to the given editor.
- *
- * @param editor the new editor, or <code>null</code> if none
- */
- public void setEditor(ITextEditor editor) {
- fTextEditor= editor;
- }
-
- /**
- * Always enables this action if it is connected to a text editor.
- * If the asocciated editor is <code>null</code>, the action is disabled.
- * Subclasses may override.
- */
- public void update() {
- setEnabled(getTextEditor() != null);
- }
-
- /**
- * Checks the editor's modifiable state. Returns <code>true</code> if the editor can be modified,
- * taking in account the possible editor extensions.
- *
- * <p>If the editor implements <code>ITextEditorExtension2</code>,
- * this method returns {@link ITextEditorExtension2#isEditorInputModifiable()};<br> else if the editor
- * implements <code>ITextEditorExtension2</code>, it returns {@link ITextEditorExtension#isEditorInputReadOnly()};<br>
- * else, {@link ITextEditor#isEditable()} is returned, or <code>false</code> if the editor is <code>null</code>.</p>
- *
- * <p>There is only a difference to {@link #validateEditorInputState()} if the editor implements
- * <code>ITextEditorExtension2</code>.</p>
- *
- * @return <code>true</code> if a modifying action should be enabled, <code>false</code> otherwise
- * @since 3.0
- */
- protected boolean canModifyEditor() {
- ITextEditor editor= getTextEditor();
- if (editor instanceof ITextEditorExtension2)
- return ((ITextEditorExtension2) editor).isEditorInputModifiable();
- else if (editor instanceof ITextEditorExtension)
- return !((ITextEditorExtension) editor).isEditorInputReadOnly();
- else if (editor != null)
- return editor.isEditable();
- else
- return false;
- }
-
- /**
- * Checks and validates the editor's modifiable state. Returns <code>true</code> if an action
- * can proceed modifying the editor's input, <code>false</code> if it should not.
- *
- * <p>If the editor implements <code>ITextEditorExtension2</code>,
- * this method returns {@link ITextEditorExtension2#validateEditorInputState()};<br> else if the editor
- * implements <code>ITextEditorExtension2</code>, it returns {@link ITextEditorExtension#isEditorInputReadOnly()};<br>
- * else, {@link ITextEditor#isEditable()} is returned, or <code>false</code> if the editor is <code>null</code>.</p>
- *
- * <p>There is only a difference to {@link #canModifyEditor()} if the editor implements
- * <code>ITextEditorExtension2</code>.</p>
- *
- * @return <code>true</code> if a modifying action can proceed to modify the underlying document, <code>false</code> otherwise
- * @since 3.0
- */
- protected boolean validateEditorInputState() {
- ITextEditor editor= getTextEditor();
- if (editor instanceof ITextEditorExtension2)
- return ((ITextEditorExtension2) editor).validateEditorInputState();
- else if (editor instanceof ITextEditorExtension)
- return !((ITextEditorExtension) editor).isEditorInputReadOnly();
- else if (editor != null)
- return editor.isEditable();
- else
- return false;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextNavigationAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextNavigationAction.java
deleted file mode 100644
index 4531b7d8c87..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextNavigationAction.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-
-package org.eclipse.ui.texteditor;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Event;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-
-
-/**
- * An <code>IAction</code> wrapper for text widget navigational and selection actions.
- * @since 2.0
- */
-public class TextNavigationAction implements IAction {
-
- /** The text widget */
- private StyledText fTextWidget;
- /** The styled text action id */
- private int fAction;
- /** The action's action id */
- private String fActionId;
- /** This action's action definition id */
- private String fActionDefinitionId;
-
-
- /**
- * Creates a new <code>TextNavigationAction</code>.
- * @param textWidget the text widget
- * @param action the styled text widget action
- */
- public TextNavigationAction(StyledText textWidget, int action) {
- fTextWidget= textWidget;
- fAction= action;
- }
-
- /**
- * Returns the text widget this actions is bound to.
- *
- * @return returns the text widget this actions is bound to
- */
- protected StyledText getTextWidget() {
- return fTextWidget;
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- Point selection= fTextWidget.getSelectionRange();
- fTextWidget.invokeAction(fAction);
- fireSelectionChanged(selection);
- }
-
- private void doFireSelectionChanged(Point selection) {
- Event event= new Event();
- event.x= selection.x;
- event.y= selection.y;
- fTextWidget.notifyListeners(SWT.Selection, event);
- }
-
- /**
- * Sends a selection event with the current selection to all
- * selection listeners of the action's text widget
- *
- * @since 3.0
- */
- protected void fireSelectionChanged() {
- fireSelectionChanged(fTextWidget.getSelection());
- }
-
- /**
- * Fires a selection event to all selection listener of the action's
- * text widget if the current selection differs from the given selection.
- *
- * @param oldSelection the old selection
- * @since 3.0
- */
- protected void fireSelectionChanged(Point oldSelection) {
- Point selection= fTextWidget.getSelectionRange();
- if (oldSelection == null || !selection.equals(oldSelection))
- doFireSelectionChanged(selection);
- }
-
- /*
- * @see IAction#runWithEvent(Event)
- */
- public void runWithEvent(Event event) {
- run();
- }
-
- /*
- * @see IAction#setActionDefinitionId(String)
- */
- public void setActionDefinitionId(String id) {
- fActionDefinitionId= id;
- }
-
- /*
- * @see IAction#getActionDefinitionId()
- */
- public String getActionDefinitionId() {
- return fActionDefinitionId;
- }
-
- /*
- * @see IAction#setId(String)
- */
- public void setId(String id) {
- fActionId= id;
- }
-
- /*
- * @see IAction#getId()
- */
- public String getId() {
- return fActionId;
- }
-
-
-// ----------------------------------------------------------------------------------------------------------------------------------
-// All the subsequent methods are just empty method bodies.
-
- /*
- * @see IAction#addPropertyChangeListener(IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- }
-
- /*
- * @see IAction#getAccelerator()
- */
- public int getAccelerator() {
- return 0;
- }
-
- /*
- * @see IAction#getDescription()
- */
- public String getDescription() {
- return null;
- }
-
- /*
- * @see IAction#getDisabledImageDescriptor()
- */
- public ImageDescriptor getDisabledImageDescriptor() {
- return null;
- }
-
- /*
- * @see IAction#getHelpListener()
- */
- public HelpListener getHelpListener() {
- return null;
- }
-
- /*
- * @see IAction#getHoverImageDescriptor()
- */
- public ImageDescriptor getHoverImageDescriptor() {
- return null;
- }
-
- /*
- * @see IAction#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /*
- * @see IAction#getMenuCreator()
- */
- public IMenuCreator getMenuCreator() {
- return null;
- }
-
- /*
- * @see IAction#getStyle()
- */
- public int getStyle() {
- return 0;
- }
-
- /*
- * @see IAction#getText()
- */
- public String getText() {
- return null;
- }
-
- /*
- * @see IAction#getToolTipText()
- */
- public String getToolTipText() {
- return null;
- }
-
- /*
- * @see IAction#isChecked()
- */
- public boolean isChecked() {
- return false;
- }
-
- /*
- * @see IAction#isEnabled()
- */
- public boolean isEnabled() {
- return true;
- }
-
- /*
- * @see IAction#removePropertyChangeListener(IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- }
-
- /**
- * @deprecated
- */
- public void setAccelerator(int keycode) {
- }
-
- /*
- * @see IAction#setChecked(boolean)
- */
- public void setChecked(boolean checked) {
- }
-
- /*
- * @see IAction#setDescription(String)
- */
- public void setDescription(String text) {
- }
-
- /*
- * @see IAction#setDisabledImageDescriptor(ImageDescriptor)
- */
- public void setDisabledImageDescriptor(ImageDescriptor newImage) {
- }
-
- /*
- * @see IAction#setEnabled(boolean)
- */
- public void setEnabled(boolean enabled) {
- }
-
- /*
- * @see IAction#setHelpListener(HelpListener)
- */
- public void setHelpListener(HelpListener listener) {
- }
-
- /*
- * @see IAction#setHoverImageDescriptor(ImageDescriptor)
- */
- public void setHoverImageDescriptor(ImageDescriptor newImage) {
- }
-
- /*
- * @see IAction#setImageDescriptor(ImageDescriptor)
- */
- public void setImageDescriptor(ImageDescriptor newImage) {
- }
-
- /*
- * @see IAction#setMenuCreator(IMenuCreator)
- */
- public void setMenuCreator(IMenuCreator creator) {
- }
-
- /*
- * @see IAction#setText(String)
- */
- public void setText(String text) {
- }
-
- /*
- * @see IAction#setToolTipText(String)
- */
- public void setToolTipText(String text) {
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextOperationAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextOperationAction.java
deleted file mode 100644
index cfd0845f93f..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextOperationAction.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.texteditor;
-
-
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.text.ITextOperationTarget;
-
-import org.eclipse.ui.IWorkbenchPartSite;
-
-
-/**
- * An action which gets a text operation target from its text editor.
- * <p>
- * The action is initially associated with a text editor via the constructor,
- * but can subsequently be changed using <code>setEditor</code>.</p>
- * <p>
- * If this class is used as is, it works by asking the text editor for its
- * text operation target adapter (using <code>getAdapter(ITextOperationTarget.class)</code>.
- * The action runs this operation with the pre-configured opcode.</p>
- */
-public final class TextOperationAction extends TextEditorAction {
-
- /** The text operation code */
- private int fOperationCode= -1;
- /** The text operation target */
- private ITextOperationTarget fOperationTarget;
- /**
- * Indicates whether this action can be executed on read only editors
- * @since 2.0
- */
- private boolean fRunsOnReadOnly= false;
-
- /**
- * Creates and initializes the action for the given text editor and operation
- * code. The action configures its visual representation from the given resource
- * bundle. The action works by asking the text editor at the time for its
- * text operation target adapter (using
- * <code>getAdapter(ITextOperationTarget.class)</code>. The action runs that
- * operation with the given opcode.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param editor the text editor
- * @param operationCode the operation code
- * @see ResourceAction#ResourceAction
- */
- public TextOperationAction(ResourceBundle bundle, String prefix, ITextEditor editor, int operationCode) {
- super(bundle, prefix, editor);
- fOperationCode= operationCode;
- update();
- }
-
- /**
- * Creates and initializes the action for the given text editor and operation
- * code. The action configures its visual representation from the given resource
- * bundle. The action works by asking the text editor at the time for its
- * text operation target adapter (using
- * <code>getAdapter(ITextOperationTarget.class)</code>. The action runs that
- * operation with the given opcode.
- *
- * @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in <code>ResourceAction</code> constructor), or
- * <code>null</code> if none
- * @param editor the text editor
- * @param operationCode the operation code
- * @param runsOnReadOnly <code>true</code> if action can be executed on read-only files
- *
- * @see ResourceAction#ResourceAction
- * @since 2.0
- */
- public TextOperationAction(ResourceBundle bundle, String prefix, ITextEditor editor, int operationCode, boolean runsOnReadOnly) {
- super(bundle, prefix, editor);
- fOperationCode= operationCode;
- fRunsOnReadOnly= runsOnReadOnly;
- update();
- }
-
- /**
- * The <code>TextOperationAction</code> implementation of this
- * <code>IAction</code> method runs the operation with the current
- * operation code.
- */
- public void run() {
- if (fOperationCode == -1 || fOperationTarget == null)
- return;
-
- ITextEditor editor= getTextEditor();
- if (editor == null)
- return;
-
- if (!fRunsOnReadOnly && !validateEditorInputState())
- return;
-
- Display display= null;
-
- IWorkbenchPartSite site= editor.getSite();
- Shell shell= site.getShell();
- if (shell != null && !shell.isDisposed())
- display= shell.getDisplay();
-
- BusyIndicator.showWhile(display, new Runnable() {
- public void run() {
- fOperationTarget.doOperation(fOperationCode);
- }
- });
- }
-
- /**
- * The <code>TextOperationAction</code> implementation of this
- * <code>IUpdate</code> method discovers the operation through the current
- * editor's <code>ITextOperationTarget</code> adapter, and sets the
- * enabled state accordingly.
- */
- public void update() {
- super.update();
-
- if (!fRunsOnReadOnly && !canModifyEditor()) {
- setEnabled(false);
- return;
- }
-
- ITextEditor editor= getTextEditor();
- if (fOperationTarget == null && editor!= null && fOperationCode != -1)
- fOperationTarget= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
-
- boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
- setEnabled(isEnabled);
- }
-
- /*
- * @see TextEditorAction#setEditor(ITextEditor)
- */
- public void setEditor(ITextEditor editor) {
- super.setEditor(editor);
- fOperationTarget= null;
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextSelectionNavigationLocation.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextSelectionNavigationLocation.java
deleted file mode 100644
index 909f6c16cfb..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextSelectionNavigationLocation.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.texteditor;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.DefaultPositionUpdater;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IPositionUpdater;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.INavigationLocation;
-import org.eclipse.ui.NavigationLocation;
-
-import org.eclipse.ui.internal.IWorkbenchConstants;
-
-
-/**
- * Represents the text selection context marked for the user in the navigation history.
- *
- * @since 2.1
- */
-public class TextSelectionNavigationLocation extends NavigationLocation {
-
-
- private final static String DELETED= "deleted"; //$NON-NLS-1$
- private final static String NOT_DELETED= "not_deleted"; //$NON-NLS-1$
-
- private final static String CATEGORY= "__navigation_" + TextSelectionNavigationLocation.class.hashCode(); //$NON-NLS-1$
- private static IPositionUpdater fgPositionUpdater= new DefaultPositionUpdater(CATEGORY);
-
- private Position fPosition;
- private IDocument fDocument;
- private Position fSavedPosition;
-
-
- /**
- * Creates a new text selection navigation location.
- *
- * @param part the text editor part
- * @param initialize a boolean indicating whether to initialize the new instance from the current selection
- */
- public TextSelectionNavigationLocation(ITextEditor part, boolean initialize) {
- super(part);
-
- if (initialize) {
-
- ISelection s= part.getSelectionProvider().getSelection();
- if(s == null || s.isEmpty())
- return;
-
- ITextSelection selection= (ITextSelection) s;
- if(selection.getOffset() == 0 && selection.getLength() == 0)
- return;
-
- IDocument document= getDocument(part);
- Position position= new Position(selection.getOffset(), selection.getLength());
- if (installOnDocument(document, position)) {
- fDocument= document;
- fPosition= position;
- if (!part.isDirty())
- fSavedPosition= new Position(fPosition.offset, fPosition.length);
- }
- }
- }
-
- /**
- * Returns the text editor's document.
- *
- * @param the text editor
- * @return the document of the given text editor
- */
- private IDocument getDocument(ITextEditor part) {
- IDocumentProvider provider= part.getDocumentProvider();
- return provider.getDocument(part.getEditorInput());
- }
-
- /**
- * Installs the given position on the given document.
- *
- * @param document the document
- * @param position the position
- * @return <code>true</code> if the position could be installed
- */
- private boolean installOnDocument(IDocument document, Position position) {
-
- if (document != null && position != null) {
-
- if (!document.containsPositionCategory(CATEGORY)) {
- document.addPositionCategory(CATEGORY);
- document.addPositionUpdater(fgPositionUpdater);
- }
-
- try {
- document.addPosition(CATEGORY, position);
- return true;
- } catch (BadLocationException e) {
- } catch (BadPositionCategoryException e) {
- }
- }
-
- return false;
- }
-
- /**
- * Uninstalls the given position from the given document.
- *
- * @param document the document
- * @param position the position
- * @return <code>true</code> if the position could be uninstalled
- */
- private boolean uninstallFromDocument(IDocument document, Position position) {
-
- if (document != null && position != null) {
- try {
-
- document.removePosition(CATEGORY, position);
-
- Position[] category= document.getPositions(CATEGORY);
- if (category == null || category.length == 0) {
- document.removePositionCategory(CATEGORY);
- document.removePositionUpdater(fgPositionUpdater);
- }
- return true;
-
- } catch (BadPositionCategoryException e) {
- }
- }
-
- return false;
- }
-
- /*
- * @see Object#toString()
- */
- public String toString() {
- return "Selection<" + fPosition + ">"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Tells whether this location is equal to the current
- * location in the given text editor.
- *
- * @param part the text editor
- * @return <code>true</code> if the locations are equal
- */
- private boolean equalsLocationOf(ITextEditor part) {
-
- if (fPosition == null)
- return true;
-
- if (fPosition.isDeleted)
- return false;
-
- ISelectionProvider provider= part.getSite().getSelectionProvider();
- ISelection selection= provider.getSelection();
- if (selection instanceof ITextSelection) {
- ITextSelection textSelection= (ITextSelection) selection;
- if (textSelection.getOffset() == fPosition.offset && textSelection.getLength() == fPosition.length) {
- String text= textSelection.getText();
- if (text != null) {
- try {
- return text.equals(fDocument.get(fPosition.offset, fPosition.length));
- } catch (BadLocationException e) {
- }
- }
- }
- }
-
- return false;
- }
-
- public void dispose() {
- uninstallFromDocument(fDocument, fPosition);
- fDocument= null;
- fPosition= null;
- fSavedPosition= null;
- super.dispose();
- }
-
- /**
- * Releases the state of this location.
- */
- public void releaseState() {
- // deactivate
- uninstallFromDocument(fDocument, fPosition);
- fDocument= null;
- fPosition= null;
- fSavedPosition= null;
- super.releaseState();
- }
-
- /**
- * Merges the given location into this one.
- *
- * @param location the location to merge into this one
- * @return <code>true<code> if merging was successful
- */
- public boolean mergeInto(INavigationLocation location) {
-
- if (location == null)
- return false;
-
- if (getClass() != location.getClass())
- return false;
-
- if (fPosition == null || fPosition.isDeleted)
- return true;
-
- TextSelectionNavigationLocation s= (TextSelectionNavigationLocation) location;
- if (s.fPosition == null || s.fPosition.isDeleted) {
- uninstallFromDocument(fDocument, fPosition);
- s.fDocument= fDocument;
- s. fPosition= fPosition;
- s.fSavedPosition= fSavedPosition;
- return true;
- }
-
- if (s.fDocument == fDocument) {
- if (s.fPosition.overlapsWith(fPosition.offset, fPosition.length) || fPosition.offset + fPosition.length == s.fPosition.offset || s.fPosition.offset + s.fPosition.length == fPosition.offset) {
- s.fPosition.offset= fPosition.offset;
- s.fPosition.length= fPosition.length;
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Restores this location.
- */
- public void restoreLocation() {
- if (fPosition == null || fPosition.isDeleted)
- return;
-
- IEditorPart part= getEditorPart();
- if (part instanceof ITextEditor) {
- ITextEditor editor= (ITextEditor) getEditorPart();
- editor.selectAndReveal(fPosition.offset, fPosition.length);
- }
- }
-
- /**
- * Restores the object state from the given memento.
- *
- * @param memento the memento
- */
- public void restoreState(IMemento memento) {
-
- IEditorPart part= getEditorPart();
- if (part instanceof ITextEditor) {
-
- // restore
- fDocument= getDocument((ITextEditor) part);
-
- Integer offset= memento.getInteger(IWorkbenchConstants.TAG_X);
- Integer length= memento.getInteger(IWorkbenchConstants.TAG_Y);
- String deleted= memento.getString(IWorkbenchConstants.TAG_INFO);
-
- if (offset != null && length != null) {
- Position p= new Position(offset.intValue(), length.intValue());
- if (deleted != null)
- p.isDeleted= DELETED.equals(deleted) ? true : false;
-
- // activate
- if (installOnDocument(fDocument, p)) {
- fPosition= p;
- if (!part.isDirty())
- fSavedPosition= new Position(fPosition.offset, fPosition.length);
- }
- }
- }
- }
-
- /**
- * Stores the object state into the given memento.
- *
- * @param memento the memento
- */
- public void saveState(IMemento memento) {
- if (fSavedPosition != null) {
- memento.putInteger(IWorkbenchConstants.TAG_X, fSavedPosition.offset);
- memento.putInteger(IWorkbenchConstants.TAG_Y, fSavedPosition.length);
- memento.putString(IWorkbenchConstants.TAG_INFO, (fSavedPosition.isDeleted ? DELETED : NOT_DELETED));
- }
- }
-
- /**
- * Hook method which is called when the given editor has been saved.
- *
- * @param part the editor part
- */
- public void partSaved(IEditorPart part) {
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=25440
- if (fPosition == null || fPosition.isDeleted())
- fSavedPosition= null;
- else
- fSavedPosition= new Position(fPosition.offset, fPosition.length);
- }
-
- /**
- * Updates the this location.
- */
- public void update() {
- IEditorPart part= getEditorPart();
- if (part instanceof ITextEditor) {
- ITextEditor textEditor= (ITextEditor) getEditorPart();
-
- if(equalsLocationOf(textEditor))
- return;
-
- ISelection s= textEditor.getSelectionProvider().getSelection();
- if(s == null || s.isEmpty())
- return;
-
- ITextSelection selection= (ITextSelection) s;
- if(selection.getOffset() == 0 && selection.getLength() == 0)
- return;
-
- fPosition.offset= selection.getOffset();
- fPosition.length= selection.getLength();
- fPosition.isDeleted= false;
-
- if (!part.isDirty())
- fSavedPosition= new Position(fPosition.offset, fPosition.length);
- }
- }
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ValidateStateException.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ValidateStateException.java
deleted file mode 100644
index 9c9e3288a17..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ValidateStateException.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.texteditor;
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * Formerly thrown by <code>AbstractDocumentProvider.doValidateState(Object, Object)</code>.
- * @deprecated
- * @since 2.1
- */
-public class ValidateStateException extends CoreException {
-
- /*
- * @see CoreException#CoreException(org.eclipse.core.runtime.IStatus)
- */
- public ValidateStateException(IStatus status) {
- super(status);
- }
-
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/WorkbenchChainedTextFontFieldEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/WorkbenchChainedTextFontFieldEditor.java
deleted file mode 100644
index ba37957d457..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/WorkbenchChainedTextFontFieldEditor.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.texteditor;
-
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.PropagatingFontFieldEditor;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-
-/**
- * This font field editor implements chaining between the workbench's preference
- * store and a given target preference store. Any time the workbench's preference
- * for the text font changes, the change is propagated to the target store.
- * Propagation means that the actual text font stored in the workbench store is set as
- * default text font in the target store. If the target store does not contain a value
- * rather than the default text font, the new default text font is immediately effective.
- *
- * @see org.eclipse.jface.preference.FontFieldEditor
- * @since 2.0
- */
-public class WorkbenchChainedTextFontFieldEditor extends PropagatingFontFieldEditor {
-
- /**
- * Creates a new font field editor with the given parameters.
- *
- * @param name the editor's name
- * @param labelText the text shown as editor description
- * @param parent the editor's parent widget
- */
- public WorkbenchChainedTextFontFieldEditor(String name, String labelText, Composite parent) {
- super(name, labelText, parent, EditorMessages.getString("WorkbenchChainedTextFontFieldEditor.defaultWorkbenchTextFont")); //$NON-NLS-1$
- }
-
- /**
- * Starts the propagation of the text font preference set in the workbench
- * to given target preference store using the given preference key.
- *
- * @param target the target preference store
- * @param targetKey the key to be used in the target preference store
- */
- public static void startPropagate(IPreferenceStore target, String targetKey) {
- Plugin plugin= Platform.getPlugin("org.eclipse.ui.workbench"); //$NON-NLS-1$
- if (plugin instanceof AbstractUIPlugin) {
- AbstractUIPlugin uiPlugin= (AbstractUIPlugin) plugin;
- IPreferenceStore store= uiPlugin.getPreferenceStore();
- if (store != null)
- PropagatingFontFieldEditor.startPropagate(store, JFaceResources.TEXT_FONT, target, targetKey);
- }
- }
-}
-
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/package.html b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/package.html
deleted file mode 100644
index 0ebf7f2db7f..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/package.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">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.51 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a framework for text editors obeying to the
-desktop rules.
-<h2>
-Package Specification</h2>
-<tt>ITextEditor</tt> extends <tt>IEditorPart</tt> with text editor specific
-functionality. Text editors use source viewers (<tt>ISourceViewer</tt>)
-for displaying and editing the given editor input. In order to translate
-the editor input into a document and vice versa (e.g., for saving a change),
-a text editor uses document providers (<tt>IDocumentProvider</tt>). A document
-provider is responsible not just for providing the document for a given
-editor input but for the complete translation between the domain model
-and the editor's internal document-based model. Document provider can be
-shared between editors.
-<br>The package provides a default implementation of <tt>ITextEditor</tt>
-(<tt>AbstractTextEditor</tt>). This default implementation also covers
-the editor's complete action management and activation. The package contains
-a number of configurable and predefined actions. <tt>AbstractMarkerAnnotationModel</tt>
-establishs a link between text annotations (<tt>Annotation</tt>) and desktop
-markers (<tt>IMarker</tt>).
-</body>
-</html>
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/IQuickDiffProviderImplementation.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/IQuickDiffProviderImplementation.java
deleted file mode 100644
index 110dc5bc2e6..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/IQuickDiffProviderImplementation.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.texteditor.quickdiff;
-
-
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Describes a reference provider for the quick diff facility. Any extension to the
- * <code>quickdiff.referenceprovider</code> extension point has to provide a class implementing
- * this interface.
- * <p>Extenders must provider a zero-arg constructor in order for the plug-in class loading mechanism
- * to work.</p>
- *
- * @since 3.0
- */
-public interface IQuickDiffProviderImplementation extends IQuickDiffReferenceProvider {
-
- /**
- * Sets the active editor for the provider implementation. Will usually just be called right after
- * creation of the implementation.
- *
- * @param editor the active editor.
- */
- void setActiveEditor(ITextEditor editor);
-
- /**
- * Gives the implementation a hook to publish its enablement. The action corresponding to this
- * implementation might be grayed out or not shown at all based on the value presented here.
- *
- * @return <code>false</code> if the implementation cannot be executed, <code>true</code> if it can,
- * or if it cannot be decided yet.
- */
- boolean isEnabled();
-
- /**
- * Sets the id of this implementation. This method will be called right after creation, and
- * <code>id</code> will be set to the <code>Id</code> attribute specified in the extension's
- * declaration.
- *
- * @param id the provider's new id.
- */
- void setId(String id);
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/IQuickDiffReferenceProvider.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/IQuickDiffReferenceProvider.java
deleted file mode 100644
index 328bf38853c..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/IQuickDiffReferenceProvider.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.texteditor.quickdiff;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.jface.text.IDocument;
-
-
-/**
- * The protocol a reference provider for quickdiff has to implement. Quickdiff references provide
- * a reference document (an <code>IDocument</code>) that is used as the original against which
- * diff information is generated.
- * <p>Extensions to the extension point <code>quickdiff.referenceprovider</code> have to implement
- * this interface (plus another interface for plugin and UI management.</p>
- *
- * @since 3.0
- * @see IQuickDiffProviderImplementation
- */
-public interface IQuickDiffReferenceProvider {
- /**
- * Returns the reference document for the quick diff display.
- *
- * @param monitor a preference monitor to monitor / cancel the process, or <code>null</code>
- * @return the reference document for the quick diff display or <code>null</code> if getting the
- * document was canceled or there is no reference available.
- * @throws CoreException if getting the document fails.
- */
- IDocument getReference(IProgressMonitor monitor) throws CoreException;
-
- /**
- * Called when the reference is no longer used and the provider can free resources.
- */
- void dispose();
-
- /**
- * Returns the id of this reference provider.
- *
- * @return the id of this provider as stated in the extending plugin's manifest.
- */
- String getId();
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiff.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiff.java
deleted file mode 100644
index d7204a3b114..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiff.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.texteditor.quickdiff;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.source.IAnnotationModel;
-
-import org.eclipse.ui.texteditor.ITextEditor;
-
-import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
-import org.eclipse.ui.internal.texteditor.quickdiff.DocumentLineDiffer;
-
-/**
- * Access class for the quick diff reference provider extension point.
- *
- * @since 3.0
- */
-public class QuickDiff {
-
- /** Extension point id for quick diff reference providers. */
- private static final String REFERENCE_PROVIDER_EXTENSION_POINT= "quickDiffReferenceProvider"; //$NON-NLS-1$
- /** The default reference provider's descriptor. */
- private ReferenceProviderDescriptor fDefaultDescriptor;
- /** The list returned to callers of <code>getExtensions</code>. */
- private List fDescriptors;
-
- /**
- * Creates a new instance.
- */
- public QuickDiff() {
- }
-
- /**
- * Returns the first descriptor with the <code>default</code> attribute set to <code>true</code>.
- *
- * @return the descriptor of the default reference provider.
- */
- public ReferenceProviderDescriptor getDefaultProvider() {
- ensureRegistered();
- return fDefaultDescriptor;
- }
-
- /**
- * Returns a non-modifiable list of <code>ReferenceProviderDescriptor</code> describing all extension
- * to the <code>quickDiffReferenceProvider</code> extension point.
- *
- * @return the list of extensions to the <code>quickDiffReferenceProvider</code> extension point.
- */
- public List getReferenceProviderDescriptors() {
- ensureRegistered();
- return fDescriptors;
- }
-
- /**
- * Returns the quick diff reference provider registered under <code>id</code>, or the default
- * reference provider. The returned provider gets its editor set to <code>editor</code>. If neither
- * the requested provider nor the default provider return <code>true</code> from <code>isEnabled</code> after
- * having the editor set, <code>null</code> is returned.
- *
- * @param editor the editor to be installed with the returned provider
- * @param id the id as specified in the <code>plugin.xml</code> that installs the reference provider
- * @return the reference provider registered under <code>id</code>, or the default reference provider, or <code>null</code>
- */
- public IQuickDiffReferenceProvider getReferenceProviderOrDefault(ITextEditor editor, String id) {
- Assert.isNotNull(editor);
- Assert.isNotNull(id);
-
- List descs= getReferenceProviderDescriptors();
- IQuickDiffProviderImplementation provider= null;
- // try to fetch preferred provider; load if needed
- for (Iterator iter= descs.iterator(); iter.hasNext();) {
- ReferenceProviderDescriptor desc= (ReferenceProviderDescriptor) iter.next();
- if (desc.getId().equals(id)) {
- provider= desc.createProvider();
- if (provider != null) {
- provider.setActiveEditor(editor);
- if (provider.isEnabled())
- break;
- provider.dispose();
- provider= null;
- }
- }
- }
-
- // if not found, get default provider as specified by the extension point
- if (provider == null) {
- ReferenceProviderDescriptor defaultDescriptor= getDefaultProvider();
- if (defaultDescriptor != null) {
- provider= defaultDescriptor.createProvider();
- if (provider != null) {
- provider.setActiveEditor(editor);
- if (!provider.isEnabled()) {
- provider.dispose();
- provider= null;
- }
- }
- }
- }
-
- return provider;
- }
-
- /**
- * Creates a new line differ annotation model with its reference provider set to the reference provider
- * obtained by calling <code>getReferenceProviderOrDefault(editor, id)</code>.
- *
- * @param editor the editor to be installed with the returned provider
- * @param id the id as specified in the <code>plugin.xml</code> that installs the reference provider
- * @return a quick diff annotation model
- */
- public IAnnotationModel createQuickDiffAnnotationModel(ITextEditor editor, String id) {
- IQuickDiffReferenceProvider provider= getReferenceProviderOrDefault(editor, id);
- if (provider != null) {
- DocumentLineDiffer differ= new DocumentLineDiffer();
- differ.setReferenceProvider(provider);
- return differ;
- } else
- return null;
- }
-
- /**
- * Ensures that the extensions are read and stored in <code>fDescriptors</code>.
- */
- private void ensureRegistered() {
- if (fDescriptors == null)
- registerExtensions();
- }
-
- /** Reads all extensions. */
- private void registerExtensions() {
- IPluginRegistry registry= Platform.getPluginRegistry();
- List list= new ArrayList();
-
- IConfigurationElement[] elements= registry.getConfigurationElementsFor(TextEditorPlugin.PLUGIN_ID, REFERENCE_PROVIDER_EXTENSION_POINT);
- for (int i= 0; i < elements.length; i++) {
- ReferenceProviderDescriptor desc= new ReferenceProviderDescriptor(elements[i]);
- if (fDefaultDescriptor == null && desc.getDefault())
- fDefaultDescriptor= desc;
- list.add(desc);
- }
-
- fDescriptors= Collections.unmodifiableList(list);
- }
-
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiffToggleAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiffToggleAction.java
deleted file mode 100644
index 803e722ce85..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiffToggleAction.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.texteditor.quickdiff;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.action.IAction;
-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.ISelection;
-
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorExtension;
-import org.eclipse.ui.texteditor.ITextEditorExtension3;
-import org.eclipse.ui.texteditor.IUpdate;
-
-import org.eclipse.ui.internal.texteditor.quickdiff.QuickDiffMessages;
-import org.eclipse.ui.internal.texteditor.quickdiff.QuickDiffRestoreAction;
-import org.eclipse.ui.internal.texteditor.quickdiff.ReferenceSelectionAction;
-import org.eclipse.ui.internal.texteditor.quickdiff.RestoreAction;
-import org.eclipse.ui.internal.texteditor.quickdiff.RevertBlockAction;
-import org.eclipse.ui.internal.texteditor.quickdiff.RevertLineAction;
-import org.eclipse.ui.internal.texteditor.quickdiff.RevertSelectionAction;
-
-/**
- * Action to toggle the line number bar's quick diff display. When turned on, quick diff shows
- * the changes relative to the saved version of the file.
- *
- * @since 3.0
- */
-public class QuickDiffToggleAction implements IEditorActionDelegate, IUpdate {
-
- /** The editor we are working on. */
- ITextEditor fEditor= null;
-
- /** Our UI proxy action. */
- IAction fProxy;
-
- /** The restore actions associated with this toggle action. */
- QuickDiffRestoreAction[] fRestoreActions=
- new QuickDiffRestoreAction[] {
- new RevertSelectionAction(fEditor),
- new RevertBlockAction(fEditor),
- new RevertLineAction(fEditor),
- new RestoreAction(fEditor)
- };
-
- /** The menu listener that adds the ruler context menu. */
- private IMenuListener fListener= new IMenuListener() {
- /** Group name for additions, in CompilationUnitEditor... */
- private static final String GROUP_ADD= "add"; //$NON-NLS-1$
- /** Group name for debug contributions */
- private static final String GROUP_DEBUB= "debug"; //$NON-NLS-1$
- private static final String GROUP_QUICKDIFF= "quickdiff"; //$NON-NLS-1$
- private static final String MENU_LABEL_KEY= "quickdiff.menu.label"; //$NON-NLS-1$
- private static final String MENU_ID= "quickdiff.menu"; //$NON-NLS-1$
- private static final String GROUP_RESTORE= "restore"; //$NON-NLS-1$
-
- public void menuAboutToShow(IMenuManager manager) {
- // update the toggle action itself
- update();
-
- IMenuManager menu= (IMenuManager)manager.find(MENU_ID);
- // only add menu if it isn't there yet
- if (menu == null) {
- /* HACK: preinstall menu groups
- * This is needed since we get the blank context menu, but want to show up
- * in the same position as the extension-added QuickDiffToggleAction.
- * The extension is added at the end (naturally), but other menus (debug, add)
- * don't add themselves to MB_ADDITIONS or alike, but rather to the end, too. So
- * we preinstall their respective menu groups here.
- */
- // TODO move these into editor as well
- if (manager.find(GROUP_DEBUB) == null)
- manager.insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, new Separator(GROUP_DEBUB));
- if (manager.find(GROUP_ADD) == null)
- manager.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS, new Separator(GROUP_ADD));
- if (manager.find(GROUP_RESTORE) == null)
- manager.insertAfter(GROUP_ADD, new Separator(GROUP_RESTORE));
- if (manager.find(GROUP_QUICKDIFF) == null)
- manager.insertAfter(GROUP_RESTORE, new Separator(GROUP_QUICKDIFF));
-
- // create quickdiff menu
- menu= new MenuManager(QuickDiffMessages.getString(MENU_LABEL_KEY), MENU_ID);
- List descriptors= new QuickDiff().getReferenceProviderDescriptors();
- for (Iterator it= descriptors.iterator(); it.hasNext();) {
- ReferenceProviderDescriptor desc= (ReferenceProviderDescriptor) it.next();
- ReferenceSelectionAction action= new ReferenceSelectionAction(desc, fEditor);
- if (action.isEnabled())
- menu.add(action);
- }
- manager.appendToGroup(GROUP_QUICKDIFF, menu);
-
- // create restore menu if this action is enabled
- if (isConnected()) {
- for (int i= 0; i < fRestoreActions.length; i++) {
- fRestoreActions[i].update();
- }
- // only add block action if selection action is not enabled
- if (fRestoreActions[0].isEnabled())
- manager.appendToGroup(GROUP_RESTORE, fRestoreActions[0]);
- else if (fRestoreActions[1].isEnabled())
- manager.appendToGroup(GROUP_RESTORE, fRestoreActions[1]);
- if (fRestoreActions[2].isEnabled())
- manager.appendToGroup(GROUP_RESTORE, fRestoreActions[2]);
- if (fRestoreActions[3].isEnabled())
- manager.appendToGroup(GROUP_RESTORE, fRestoreActions[3]);
- }
- }
- }
- };
-
- /*
- * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
- */
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- fProxy= action;
- removePopupMenu();
- if (targetEditor instanceof ITextEditor) {
- fEditor= (ITextEditor)targetEditor;
- } else
- fEditor= null;
- for (int i= 0; i < fRestoreActions.length; i++) {
- fRestoreActions[i].setEditor(fEditor);
- }
- setPopupMenu();
- }
-
- /**
- * Removes the ruler context menu listener from the current editor.
- */
- private void removePopupMenu() {
- if (!(fEditor instanceof ITextEditorExtension))
- return;
- ((ITextEditorExtension)fEditor).removeRulerContextMenuListener(fListener);
- }
-
- /**
- * Installs a submenu with <code>fEditor</code>'s ruler context menu that contains the choices
- * for the quick diff reference. This allows the toggle action to lazily install the menu once
- * quick diff has been enabled.
- *
- * @param editor the editor that the menu gets installed in.
- * @see QuickDiffToggleAction
- */
- private void setPopupMenu() {
- if (!(fEditor instanceof ITextEditorExtension))
- return;
- ((ITextEditorExtension)fEditor).addRulerContextMenuListener(fListener);
- }
-
- /**
- * States whether this toggle action has been installed and a incremental differ has been
- * installed with the line number bar.
- *
- * @return <code>true</code> if a differ has been installed on <code>fEditor</code>.
- */
- boolean isConnected() {
- if (!(fEditor instanceof ITextEditorExtension3))
- return false;
- return ((ITextEditorExtension3)fEditor).isChangeInformationShowing();
- }
-
- /*
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- fProxy= action;
- if (fEditor == null)
- return;
-
- if (fEditor instanceof ITextEditorExtension3) {
- ITextEditorExtension3 extension= (ITextEditorExtension3)fEditor;
- extension.showChangeInformation(!extension.isChangeInformationShowing());
- }
- }
-
- /*
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- fProxy= action;
- }
-
- /*
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- if (fProxy == null)
- return;
- if (isConnected())
- fProxy.setText(QuickDiffMessages.getString("quickdiff.toggle.disable")); //$NON-NLS-1$
- else
- fProxy.setText(QuickDiffMessages.getString("quickdiff.toggle.enable")); //$NON-NLS-1$
- }
-
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/ReferenceProviderDescriptor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/ReferenceProviderDescriptor.java
deleted file mode 100644
index d0119a94d0c..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/ReferenceProviderDescriptor.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.ui.texteditor.quickdiff;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginDescriptor;
-
-import org.eclipse.jface.util.Assert;
-
-
-
-/**
- * Describes an extension to the <code>quickdiff.referenceprovider</code> extension point.
- *
- * @since 3.0
- * @see ReferenceSelectionAction
- * @see QuickDiff
- */
-public class ReferenceProviderDescriptor {
-
- /** Name of the <code>label</code> attribute. */
- private static final String LABEL_ATTRIBUTE= "label"; //$NON-NLS-1$
- /** Name of the <code>class</code> attribute. */
- private static final String CLASS_ATTRIBUTE= "class"; //$NON-NLS-1$
- /** Name of the <code>id</code> attribute. */
- private static final String ID_ATTRIBUTE= "id"; //$NON-NLS-1$
- /** Name of the <code>default</code> attribute. */
- private static final String DEFAULT_ATTRIBUTE= "default"; //$NON-NLS-1$
-
- /** The configuration element describing this extension. */
- private IConfigurationElement fConfiguration;
- /** The value of the <code>label</code> attribute, if read. */
- private String fLabel;
- /** The value of the <code>id</code> attribute, if read. */
- private String fId;
- /** The value of the <code>default</code> attribute, if read. */
- private Boolean fDefault;
- /** The plugin id where this extension was defined. */
- private IPluginDescriptor fPluginDescriptor;
-
- /**
- * Creates a new descriptor for <code>element</code>.
- *
- * @param element the extension point element to be described.
- */
- ReferenceProviderDescriptor(IConfigurationElement element) {
- Assert.isLegal(element != null);
- fConfiguration= element;
- }
-
- /**
- * Reads (if needed) and returns the label of this extension.
- *
- * @return the label for this extension.
- */
- public String getLabel() {
- if (fLabel == null) {
- fLabel= fConfiguration.getAttribute(LABEL_ATTRIBUTE);
- Assert.isNotNull(fLabel);
- }
- return fLabel;
- }
-
- /**
- * Reads (if needed) and returns the id of this extension.
- *
- * @return the id for this extension.
- */
- public String getId() {
- if (fId == null) {
- fId= fConfiguration.getAttribute(ID_ATTRIBUTE);
- Assert.isNotNull(fId);
- }
- return fId;
- }
-
- /**
- * Creates a referenceprovider as described in the extension's xml. Sets the id on the provider.
- * @return a new instance of the reference provider described by this descriptor.
- */
- public IQuickDiffProviderImplementation createProvider() {
- try {
- IQuickDiffProviderImplementation impl= (IQuickDiffProviderImplementation)fConfiguration.createExecutableExtension(CLASS_ATTRIBUTE);
- impl.setId(getId());
- return impl;
- } catch (CoreException e) {
- return null;
- }
- }
-
- /**
- * States whether the plugin declaring this extensionhas been loaded already.
- *
- * @return <code>true</code> if the extension point's plugin has been loaded, <code>false</code> otherwise.
- */
- public boolean isPluginLoaded() {
- if (fPluginDescriptor == null)
- fPluginDescriptor= fConfiguration.getDeclaringExtension().getDeclaringPluginDescriptor();
-
- return (fPluginDescriptor != null && fPluginDescriptor.isPluginActivated());
- }
-
- /**
- * Reads (if needed) and returns the default attribute value of this extension.
- *
- * @return the default attribute value for this extension.
- */
- public boolean getDefault() {
- if (fDefault == null) {
- String def= fConfiguration.getAttribute(DEFAULT_ATTRIBUTE);
- if ("true".equalsIgnoreCase(def)) //$NON-NLS-1$
- fDefault= Boolean.TRUE;
- else
- fDefault= Boolean.FALSE;
- }
- return fDefault.booleanValue();
- }
-
-}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/package.html b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/package.html
deleted file mode 100644
index c85f51bf08a..00000000000
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/package.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.51 [en] (WinNT; I) [Netscape]">
- <title>QuickDiff API</title>
-</head>
-<body>
-Provides interfaces to for the <code>org.eclipse.ui.editors.quickDiffReferenceProvider</code>
-extension point and adds an action to enable quick diff display for an editor.
-</body>
-</html>

Back to the top