This commit was manufactured by cvs2svn to create branch 'Bug_36957'.
Sprout from master 2003-04-23 13:33:50 UTC Kai Maetzel <kmaetzel> '*** empty log message ***'
Delete:
org.eclipse.jface.text/.classpath
org.eclipse.jface.text/.cvsignore
org.eclipse.jface.text/.project
org.eclipse.jface.text/about.html
org.eclipse.jface.text/build.properties
org.eclipse.jface.text/plugin.properties
org.eclipse.jface.text/plugin.xml
org.eclipse.jface.text/projection/org/eclipse/jface/text/source/OutlinerRulerColumn.java
org.eclipse.jface.text/projection/org/eclipse/jface/text/source/ProjectionAnnotation.java
org.eclipse.jface.text/projection/org/eclipse/jface/text/source/ProjectionSourceViewer.java
org.eclipse.jface.text/scripts/exportplugin.xml
org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractHoverInformationControlManager.java
org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java
org.eclipse.jface.text/src/org/eclipse/jface/text/CursorLinePainter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultAutoIndentStrategy.java
org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java
org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java
org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java
org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentAdapter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentCommand.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IAutoEditStrategy.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IAutoIndentStrategy.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IDocumentAdapter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IDocumentAdapterExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IEventConsumer.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IFindReplaceTarget.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IFindReplaceTargetExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlCreator.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension2.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IMarkRegionTarget.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IMarkSelection.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IPaintPositionManager.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IPainter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IRewriteTarget.java
org.eclipse.jface.text/src/org/eclipse/jface/text/ITextDoubleClickStrategy.java
org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHover.java
org.eclipse.jface.text/src/org/eclipse/jface/text/ITextInputListener.java
org.eclipse.jface.text/src/org/eclipse/jface/text/ITextListener.java
org.eclipse.jface.text/src/org/eclipse/jface/text/ITextOperationTarget.java
org.eclipse.jface.text/src/org/eclipse/jface/text/ITextOperationTargetExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/ITextSelection.java
org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewer.java
org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension2.java
org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension3.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IUndoManager.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IViewportListener.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IWidgetTokenKeeper.java
org.eclipse.jface.text/src/org/eclipse/jface/text/IWidgetTokenOwner.java
org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextMessages.java
org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextMessages.properties
org.eclipse.jface.text/src/org/eclipse/jface/text/MarginPainter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/MarkSelection.java
org.eclipse.jface.text/src/org/eclipse/jface/text/PaintManager.java
org.eclipse.jface.text/src/org/eclipse/jface/text/PropagatingFontFieldEditor.java
org.eclipse.jface.text/src/org/eclipse/jface/text/TextAttribute.java
org.eclipse.jface.text/src/org/eclipse/jface/text/TextEvent.java
org.eclipse.jface.text/src/org/eclipse/jface/text/TextPresentation.java
org.eclipse.jface.text/src/org/eclipse/jface/text/TextSelection.java
org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposal.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformation.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationPopup.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationValidator.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/Helper.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposal.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension2.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistListener.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistProcessor.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistant.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformation.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationPresenter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationValidator.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/JFaceTextMessages.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/PopupCloser.java
org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/package.html
org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/ContentFormatter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategy.java
org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/package.html
org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationProvider.java
org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationProviderExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/information/InformationPresenter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/information/package.html
org.eclipse.jface.text/src/org/eclipse/jface/text/package.html
org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationDamager.java
org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationReconciler.java
org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationRepairer.java
org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/PresentationReconciler.java
org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/package.html
org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java
org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/DirtyRegion.java
org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/DirtyRegionQueue.java
org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconciler.java
org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcilingStrategy.java
org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcilingStrategyExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/MonoReconciler.java
org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/Reconciler.java
org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/package.html
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/BufferedRuleBasedScanner.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultDamagerRepairer.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultPartitioner.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/EndOfLineRule.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/ICharacterScanner.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IPartitionTokenScanner.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IPredicateRule.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IRule.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IToken.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/ITokenScanner.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IWhitespaceDetector.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IWordDetector.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/MultiLineRule.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/NumberRule.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedDamagerRepairer.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitionScanner.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitioner.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedScanner.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/SingleLineRule.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/Token.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WhitespaceRule.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordPatternRule.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordRule.java
org.eclipse.jface.text/src/org/eclipse/jface/text/rules/package.html
org.eclipse.jface.text/src/org/eclipse/jface/text/source/Annotation.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationBarHoverManager.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationColumn.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationModel.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationModelEvent.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/CompositeRuler.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccess.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationHover.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModel.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModelListener.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModelListenerExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcher.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/IOverviewRuler.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISharedTextColors.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRuler.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerColumn.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerExtension.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerInfo.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/JFaceTextMessages.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewerConfiguration.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/VisualAnnotationModel.java
org.eclipse.jface.text/src/org/eclipse/jface/text/source/package.html
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_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/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/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/RowLayouter.java
org.eclipse.search/search/org/eclipse/search/internal/ui/util/SWTUtil.java
org.eclipse.search/search/org/eclipse/search/internal/ui/util/StringMatcher.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/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/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/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/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/IDocumentPartitioningListener.java
org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListenerExtension.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/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.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/extensions/org/eclipse/ui/internal/SystemSummaryDocumentProvider.java
org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryEditor.java
org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryMessages.java
org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryMessages.properties
org.eclipse.ui.editors/migration_guidelines.html
org.eclipse.ui.editors/plugin.properties
org.eclipse.ui.editors/plugin.xml
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/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/package.html
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/IEditorsStatusConstants.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/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/AddTaskAction.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/JavaDocumentProvider.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/JavaEditorEnvironment.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/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/java/JavaPartitionScanner.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
diff --git a/org.eclipse.jface.text/.classpath b/org.eclipse.jface.text/.classpath
deleted file mode 100644
index 4a12f97..0000000
--- a/org.eclipse.jface.text/.classpath
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/"/>
- <classpathentry kind="src" path="projection"/>
- <classpathentry exported="true" kind="src" path="/org.eclipse.text"/>
- <classpathentry kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="src" path="/org.eclipse.jface"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.eclipse.core.boot"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.jface.text/.cvsignore b/org.eclipse.jface.text/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/org.eclipse.jface.text/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/org.eclipse.jface.text/.project b/org.eclipse.jface.text/.project
deleted file mode 100644
index b330056..0000000
--- a/org.eclipse.jface.text/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jface.text</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.jface</project>
- <project>org.eclipse.swt</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.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.jface.text/about.html b/org.eclipse.jface.text/about.html
deleted file mode 100644
index 9db411a..0000000
--- a/org.eclipse.jface.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 ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/org.eclipse.jface.text/build.properties b/org.eclipse.jface.text/build.properties
deleted file mode 100644
index 01abca1..0000000
--- a/org.eclipse.jface.text/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = plugin.properties,\
- plugin.xml,\
- *.jar,\
- about.html
-source.jfacetext.jar = src/,\
- projection/
diff --git a/org.eclipse.jface.text/plugin.properties b/org.eclipse.jface.text/plugin.properties
deleted file mode 100644
index eb29566..0000000
--- a/org.eclipse.jface.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 = JFace Text
-providerName = Eclipse.org
diff --git a/org.eclipse.jface.text/plugin.xml b/org.eclipse.jface.text/plugin.xml
deleted file mode 100644
index df28b39..0000000
--- a/org.eclipse.jface.text/plugin.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.jface.text"
- name="%pluginName"
- version="2.1.0"
- provider-name="%providerName">
-
- <runtime>
- <library name="jfacetext.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.jface.text"/>
- </library>
- </runtime>
-
- <requires>
- <import plugin="org.eclipse.text" export="true"/>
- <import plugin="org.eclipse.swt"/>
- <import plugin="org.eclipse.jface"/>
- </requires>
-
-</plugin>
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/OutlinerRulerColumn.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/OutlinerRulerColumn.java
deleted file mode 100644
index d97abcd..0000000
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/OutlinerRulerColumn.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.source;
-
-
-import java.util.Iterator;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-
-
-/**
- * A ruler column for controlling the behavior of a <code>ProjectionSourceViewer</code>.
- * This class is for internal use only.
- *
- * @since 2.1
- */
-public class OutlinerRulerColumn extends AnnotationRulerColumn {
-
- /**
- * Creates a new outliner ruler column.
- *
- * @param model the column's annotation model
- * @param width the width in pixels
- */
- public OutlinerRulerColumn(IAnnotationModel model, int width) {
- super(model, width);
- }
-
- /*
- * @see org.eclipse.jface.text.source.AnnotationRulerColumn#mouseDoubleClicked(int)
- */
- protected void mouseDoubleClicked(int line) {
- ProjectionAnnotation annotation= findAnnotation(line);
- if (annotation != null)
- annotation.run(getCachedTextViewer());
- }
-
- /**
- * Returns the projection annotation of the column's annotation
- * model that contains the given line.
- *
- * @param line the line
- * @return the projection annotation containing the given line
- */
- private ProjectionAnnotation findAnnotation(int line) {
- IAnnotationModel model= getModel();
- if (model != null) {
- Iterator e= model.getAnnotationIterator();
- while (e.hasNext()) {
- Object next= e.next();
- if (next instanceof ProjectionAnnotation) {
- ProjectionAnnotation annotation= (ProjectionAnnotation) next;
- Position p= model.getPosition(annotation);
- if (contains(p, line))
- return annotation;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns whether the given position contains the given line.
- *
- * @param p the position
- * @param line the line
- * @return <code>true</code> if the given position contains the given line, <code>false</code> otherwise
- */
- private boolean contains(Position p, int line) {
-
- IDocument document= getCachedTextViewer().getDocument();
-
- try {
-
- int startLine= document.getLineOfOffset(p.getOffset());
- if (line < startLine)
- return false;
- if (line == startLine)
- return true;
-
- int endLine= document.getLineOfOffset(p.getOffset() + Math.max(p.getLength() -1, 0));
- return (startLine < line && line <= endLine) ;
-
- } catch (BadLocationException x) {
- }
-
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IVerticalRulerColumn#createControl(org.eclipse.jface.text.source.CompositeRuler, org.eclipse.swt.widgets.Composite)
- */
- public Control createControl(CompositeRuler parentRuler, Composite parentControl) {
- Control control= super.createControl(parentRuler, parentControl);
- Display display= parentControl.getDisplay();
- Color background= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
- control.setBackground(background);
- return control;
- }
-}
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/ProjectionAnnotation.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/ProjectionAnnotation.java
deleted file mode 100644
index 6f3b0f0..0000000
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/ProjectionAnnotation.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.source;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Position;
-
-/**
- * Annotation used to represent the projection of a master document onto
- * a <code>ProjectionDocument</code>. A projection annotation can be either
- * expanded or collapsed. If expaned it corresponds to a fragment of the
- * projection document. If collapsed, it represents a region of the master document
- * that does not have a corresponding fragment in the projection document. <p>
- * Draws itself in a tree like fashion.<p>
- * This class if for internal use only.
- *
- * @since 2.1
- */
-public class ProjectionAnnotation extends Annotation {
-
- private static final int OUTER_MARGIN= 1;
- private static final int INNER_MARGIN= 1;
- private static final int PIXELS= 1;
- private static final int LEGS= 2;
- private static final int MIDDLE= PIXELS + INNER_MARGIN + LEGS;
- private static final int SIZE= 2 * MIDDLE + PIXELS;
-
- /** The range in the master document */
- private Position fProjectionRange;
- /** The state of this annotation */
- private boolean fIsFolded= false;
-
- /**
- * Creates a new projection annotation for the given range of the master document.
- *
- * @param range the range.
- */
- public ProjectionAnnotation(Position range) {
- fProjectionRange= range;
- }
-
- /*
- * @see org.eclipse.jface.text.source.Annotation#paint(org.eclipse.swt.graphics.GC, org.eclipse.swt.widgets.Canvas, org.eclipse.swt.graphics.Rectangle)
- */
- public void paint(GC gc, Canvas canvas, Rectangle rectangle) {
- Color fg= gc.getForeground();
- gc.setForeground(canvas.getDisplay().getSystemColor(SWT.COLOR_BLUE));
-
-
- Rectangle r= new Rectangle(rectangle.x + OUTER_MARGIN, rectangle.y + OUTER_MARGIN, SIZE -1 , SIZE -1);
- gc.drawRectangle(r);
- gc.drawLine(r.x + PIXELS + INNER_MARGIN, r.y + MIDDLE, r.x + r.width - PIXELS - INNER_MARGIN , r.y + MIDDLE);
- if (fIsFolded) {
- gc.drawLine(r.x + MIDDLE, r.y + PIXELS + INNER_MARGIN, r.x + MIDDLE, r.y + r.height - PIXELS - INNER_MARGIN);
- } else {
- gc.drawLine(r.x + MIDDLE, r.y + r.height, r.x + MIDDLE, rectangle.y + rectangle.height - OUTER_MARGIN);
- gc.drawLine(r.x + MIDDLE, rectangle.y + rectangle.height - OUTER_MARGIN, r.x + r.width - INNER_MARGIN, rectangle.y + rectangle.height - OUTER_MARGIN);
- }
-
- gc.setForeground(fg);
- }
-
- /**
- * Toogles the state of this annotation and updates the given viewer accordingly.
- *
- * @param viewer the viewer
- */
- public void run(ITextViewer viewer) {
-
- if (viewer instanceof ProjectionSourceViewer) {
- ProjectionSourceViewer projectionViewer= (ProjectionSourceViewer) viewer;
-
- if (fIsFolded) {
-
- fIsFolded= false;
- projectionViewer.expand(fProjectionRange.getOffset(), fProjectionRange.getLength());
-
- } else {
-
- try {
- IDocument document= projectionViewer.getDocument();
- int line= document.getLineOfOffset(fProjectionRange.getOffset());
- int offset= document.getLineOffset(line + 1);
-
- int length= fProjectionRange.getLength() - (offset - fProjectionRange.getOffset());
- if (length > 0) {
- fIsFolded= true;
- projectionViewer.collapse(offset, length);
- }
- } catch (BadLocationException x) {
- }
- }
- }
- }
-
- /**
- * Returns the state of this annotation.
- *
- * @return <code>true</code> if collapsed
- */
- public boolean isFolded() {
- return fIsFolded;
- }
-}
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/ProjectionSourceViewer.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/ProjectionSourceViewer.java
deleted file mode 100644
index 9185d4f..0000000
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/ProjectionSourceViewer.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.source;
-
-
-import java.util.Iterator;
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ISlaveDocumentManager;
-import org.eclipse.jface.text.ITextViewerExtension3;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.ProjectionDocument;
-import org.eclipse.jface.text.ProjectionDocumentManager;
-
-
-/**
- * A projection source viewer is a source viewer which does not support the concept of a visible region. Instead it supports
- * to dynamically hide and show regions of its document. Uses <code>ProjectionDocumentManager</code> as it internal slave document manager.<p>
- * This class is for internal use only.
- *
- * @since 2.1
- */
-public class ProjectionSourceViewer extends SourceViewer implements ISourceViewer, ITextViewerExtension3 {
-
- /** The projection annotation model */
- private IAnnotationModel fProjectionAnnotationModel;
-
- /**
- * Creates a new projection source viewer.
- *
- * @param parent the SWT parent control
- * @param ruler the vertical ruler
- * @param styles the SWT style bits
- */
- public ProjectionSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
- super(parent, ruler, styles);
- }
-
- /*
- * @see ISourceViewer#setDocument(IDocument, IAnnotationModel, int, int)
- */
- public void setDocument(IDocument document, IAnnotationModel annotationModel, int visibleRegionOffset, int visibleRegionLength) {
- if (getDocument() != null && fProjectionAnnotationModel != null)
- fProjectionAnnotationModel.disconnect(getDocument());
-
- super.setDocument(document, annotationModel, visibleRegionOffset, visibleRegionLength);
-
- if (getDocument() != null && fProjectionAnnotationModel != null)
- fProjectionAnnotationModel.connect(getDocument());
- }
-
- /*
- * @see TextViewer#handleDispose()
- */
- protected void handleDispose() {
-
- if (getDocument() != null && fProjectionAnnotationModel != null) {
- fProjectionAnnotationModel.disconnect(getDocument());
- fProjectionAnnotationModel= null;
- }
-
- super.handleDispose();
- }
-
- /**
- * Returns the projection annotation model.
- *
- * @return the projection annotation model
- */
- public IAnnotationModel getProjectionAnnotationModel() {
- return fProjectionAnnotationModel;
- }
-
- /**
- * Sets the projection annotation model.
- *
- * @param projectionAnnotationModel the projection annotation model
- */
- public void setProjectionAnnotationModel(IAnnotationModel projectionAnnotationModel) {
- fProjectionAnnotationModel= projectionAnnotationModel;
- }
-
- /*
- * @see org.eclipse.jface.text.TextViewer#createSlaveDocumentManager()
- */
- protected ISlaveDocumentManager createSlaveDocumentManager() {
- return new ProjectionDocumentManager();
- }
-
- /*
- * @see org.eclipse.jface.text.TextViewer#updateVisibleDocument(org.eclipse.jface.text.IDocument, int, int)
- */
- protected boolean updateVisibleDocument(IDocument visibleDocument, int visibleRegionOffset, int visibleRegionLength) throws BadLocationException {
- if (visibleDocument instanceof ProjectionDocument) {
- ProjectionDocument document= (ProjectionDocument) visibleDocument;
- document.addFragment(visibleRegionOffset, visibleRegionLength);
- }
- return true;
- }
-
- /**
- * Hides the given range by collapsing it.
- *
- * @param offset the offset of the range to hide
- * @param length the length of the range to hide
- */
- public void collapse(int offset, int length) {
-
- IDocument previous= getVisibleDocument();
- IDocument slave= createSlaveDocument(previous);
-
- if (slave instanceof ProjectionDocument) {
-
- StyledText textWidget= getTextWidget();
- try {
-
- if (textWidget != null)
- textWidget.setRedraw(false);
-
-
- int topIndex= getTopIndex();
- Point selection= getSelectedRange();
-
- // adapt selection
- int selectionEnd= selection.x + selection.y;
- if (offset < selectionEnd && selectionEnd <= offset + length) {
-
- int lineEnd= offset;
-
- try {
- IDocument document= getDocument();
- int line= document.getLineOfOffset(offset);
- IRegion lineInfo= document.getLineInformation(Math.max(line -1, 0));
- lineEnd= lineInfo.getOffset() + lineInfo.getLength();
- } catch (BadLocationException x) {
- }
-
- if (offset <= selection.x && selection.x < offset + length) {
- selection.x= lineEnd;
- selection.y= 0;
- } else {
- selection.y= Math.max(lineEnd - selection.x, 0);
- }
-
- } else if (offset <= selection.x && selection.x < offset + length) {
- int delta= offset + length - selection.x;
- selection.x= offset + length;
- selection.y -= delta;
- }
-
- ((ProjectionDocument) slave).hide(offset, length);
- setVisibleDocument(slave);
-
- setSelectedRange(selection.x, selection.y);
- setTopIndex(topIndex);
-
- } finally {
- if(textWidget != null)
- textWidget.setRedraw(true);
- }
- }
- }
-
- /**
- * Makes all hidden ranges in the given range visible again.
- *
- * @param offset the offset of the range
- * @param length the length of the range
- */
- public void expand(int offset, int length) {
- if (getVisibleDocument() instanceof ProjectionDocument) {
- ProjectionDocument document= (ProjectionDocument) getVisibleDocument();
-
- StyledText textWidget= getTextWidget();
- try {
-
- if (textWidget != null)
- textWidget.setRedraw(false);
-
- Point selection= getSelectedRange();
- int topIndex= getTopIndex();
-
- document.show(offset, length);
- setVisibleDocument(document);
-
- setSelectedRange(selection.x, selection.y);
- setTopIndex(topIndex);
-
- } finally {
- if (textWidget != null)
- textWidget.setRedraw(true);
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewer#getVisibleRegion()
- */
- public IRegion getVisibleRegion() {
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.TextViewer#getVisibleRegionOffset()
- */
- protected int getVisibleRegionOffset() {
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.TextViewer#internalGetVisibleRegion()
- */
- protected IRegion internalGetVisibleRegion() {
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewer#overlapsWithVisibleRegion(int,int)
- */
- public boolean overlapsWithVisibleRegion(int offset, int length) {
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.TextViewer#getVisibleDocument()
- */
- public IDocument getVisibleDocument() {
- return super.getVisibleDocument();
- }
-
- /*
- * @see org.eclipse.jface.text.TextViewer#handleVerifyEvent(org.eclipse.swt.events.VerifyEvent)
- */
- protected void handleVerifyEvent(VerifyEvent e) {
- IRegion modelRange= event2ModelRange(e);
- Iterator iterator= fProjectionAnnotationModel.getAnnotationIterator();
- while (iterator.hasNext()) {
- ProjectionAnnotation annotation= (ProjectionAnnotation) iterator.next();
- if (annotation.isFolded()) {
- Position position= fProjectionAnnotationModel.getPosition(annotation);
- if (position.overlapsWith(modelRange.getOffset(), modelRange.getLength()) /* || is a delete at the boundary */ ) {
- e.doit= false;
- annotation.run(this);
- }
- }
- }
- }
-}
diff --git a/org.eclipse.jface.text/scripts/exportplugin.xml b/org.eclipse.jface.text/scripts/exportplugin.xml
deleted file mode 100644
index 40eae04..0000000
--- a/org.eclipse.jface.text/scripts/exportplugin.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<project name="Export JFace Text" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.jface.text" />
- <property name="version" value="_2.1.0" />
- <property name="dest" value="${destdir}/${plugin}${version}" />
- </target>
-
- <target name="build" depends="init">
- <eclipse.incrementalBuild project="${plugin}" kind="incr"/>
- </target>
-
- <target name="export" depends="build">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/jfacetext.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <zip zipfile="${dest}/jfacetextsrc.zip">
- <fileset dir="src" />
- <fileset dir="projection"/>
- </zip>
- </target>
-</project>
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractHoverInformationControlManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractHoverInformationControlManager.java
deleted file mode 100644
index c9aa974..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractHoverInformationControlManager.java
+++ /dev/null
@@ -1,478 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-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.MouseMoveListener;
-import org.eclipse.swt.events.MouseTrackAdapter;
-import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-
-/**
- * An information control manager that shows information on mouse hover events.
- * The mouse hover events are caught by registering a <code>MouseTrackListener</code>
- * on the manager's subject control. The manager has by default an information control closer
- * that closes the information control as soon as the mouse pointer leaves the subject area, the
- * user presses a key, or the subject control is resized, moved, or deactivated.<p>
- * When being activated by a mouse hover event, the manager disables itself, until the mouse
- * leaves the subject area. Thus, the manager is usually still disabled, when the information control
- * has already been closed by the closer.
- *
- * @see org.eclipse.swt.events.MouseTrackListener
- * @since 2.0
- */
-abstract public class AbstractHoverInformationControlManager extends AbstractInformationControlManager {
-
-
- /**
- * The information control closer for the hover information. Closes the information control as
- * soon as the mouse pointer leaves the subject area, a mouse button is pressed, the user presses a key,
- * or the subject control is resized or moved.
- */
- class Closer extends MouseTrackAdapter
- implements IInformationControlCloser, MouseListener, MouseMoveListener, ControlListener, KeyListener {
-
- /** The closer's subject control */
- private Control fSubjectControl;
- /** The closer's information control */
- private IInformationControl fInformationControl;
- /** The subject area */
- private Rectangle fSubjectArea;
- /** Indicates whether this closer is active */
- private boolean fIsActive= false;
-
- /**
- * Creates a new information control closer.
- */
- public Closer() {
- }
-
- /*
- * @see IInformationControlCloser#setSubjectControl(Control)
- */
- public void setSubjectControl(Control control) {
- fSubjectControl= control;
- }
-
- /*
- * @see IInformationControlCloser#setHoverControl(IHoverControl)
- */
- public void setInformationControl(IInformationControl control) {
- fInformationControl= control;
- }
-
- /*
- * @see IInformationControlCloser#start(Rectangle)
- */
- public void start(Rectangle subjectArea) {
-
- if (fIsActive) return;
- fIsActive= true;
-
- fSubjectArea= subjectArea;
-
- if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
- fSubjectControl.addMouseListener(this);
- fSubjectControl.addMouseMoveListener(this);
- fSubjectControl.addMouseTrackListener(this);
- fSubjectControl.addControlListener(this);
- fSubjectControl.addKeyListener(this);
- }
- }
-
- /*
- * @see IInformationControlCloser#stop()
- */
- public void stop() {
- stop(false);
- }
-
- /**
- * Stops the information control and if <code>delayRestart</code> is set
- * allows restart only after a certain delay.
- *
- * @param delayRestart <code>true</code> if restart should be delayed
- */
- protected void stop(boolean delayRestart) {
-
- if (!fIsActive) return;
- fIsActive= false;
-
- hideInformationControl();
-
- if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
- fSubjectControl.removeMouseListener(this);
- fSubjectControl.removeMouseMoveListener(this);
- fSubjectControl.removeMouseTrackListener(this);
- fSubjectControl.removeControlListener(this);
- fSubjectControl.removeKeyListener(this);
- }
- }
-
- /*
- * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseMove(MouseEvent event) {
- if (!fSubjectArea.contains(event.x, event.y))
- stop();
- }
-
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseUp(MouseEvent event) {
- }
-
- /*
- * @see MouseListener#mouseDown(MouseEvent)
- */
- public void mouseDown(MouseEvent event) {
- stop();
- }
-
- /*
- * @see MouseListener#mouseDoubleClick(MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent event) {
- stop();
- }
-
- /*
- * @see MouseTrackAdapter#mouseExit(MouseEvent)
- */
- public void mouseExit(MouseEvent event) {
- stop();
- }
-
- /*
- * @see ControlListener#controlResized(ControlEvent)
- */
- public void controlResized(ControlEvent event) {
- stop();
- }
-
- /*
- * @see ControlListener#controlMoved(ControlEvent)
- */
- public void controlMoved(ControlEvent event) {
- stop();
- }
-
- /*
- * @see KeyListener#keyReleased(KeyEvent)
- */
- public void keyReleased(KeyEvent event) {
- }
-
- /*
- * @see KeyListener#keyPressed(KeyEvent)
- */
- public void keyPressed(KeyEvent event) {
- stop(true);
- }
- };
-
-
- /**
- * To be installed on the manager's subject control. Serves two different purposes:
- * <ul>
- * <li> start function: initiates the computation of the information to be presented. This happens on
- * receipt of a mouse hover event and disables the information control manager,
- * <li> restart function: tracks mouse move and shell activation event to determine when the information
- * control manager needs to be reactivated.
- * </ul>
- */
- class MouseTracker extends ShellAdapter implements MouseTrackListener, MouseMoveListener {
-
- /** Margin around the original hover event location for coputing the hover area. */
- private final static int EPSILON= 3;
-
- /** The area in which the original hover event occurred. */
- private Rectangle fHoverArea;
- /** The area for which is computed information is valid. */
- private Rectangle fSubjectArea;
- /** The tracker's subject control. */
- private Control fSubjectControl;
-
- /** Indicates whether the tracker is in restart mode ignoring hover events. */
- private boolean fIsInRestartMode= false;
- /** Indicates whether the tracker is computing the information to be presented. */
- private boolean fIsComputing= false;
- /** Indicates whether the mouse has been lost. */
- private boolean fMouseLostWhileComputing= false;
- /** Indicates whether the subject control's shell has been deactivated. */
- private boolean fShellDeactivatedWhileComputing= false;
-
- /**
- * Creates a new mouse tracker.
- */
- public MouseTracker() {
- }
-
- /**
- * Sets this mouse tracker's subject area, the area to be tracked in order
- * to re-enable the information control manager.
- *
- * @param subjectArea the subject area
- */
- public void setSubjectArea(Rectangle subjectArea) {
- Assert.isNotNull(subjectArea);
- fSubjectArea= subjectArea;
- }
-
- /**
- * Starts this mouse tracker. The given control becomes this tracker's subject control.
- * Installs itself as mouse track listener on the subject control.
- *
- * @param subjectControl the subject control
- */
- public void start(Control subjectControl) {
- fSubjectControl= subjectControl;
- if (fSubjectControl != null && !fSubjectControl.isDisposed())
- fSubjectControl.addMouseTrackListener(this);
-
- fIsInRestartMode= false;
- fIsComputing= false;
- fMouseLostWhileComputing= false;
- fShellDeactivatedWhileComputing= false;
- }
-
- /**
- * Stops this mouse tracker. Removes itself as mouse track, mouse move, and
- * shell listener from the subject control.
- */
- public void stop() {
- if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
- fSubjectControl.removeMouseTrackListener(this);
- fSubjectControl.removeMouseMoveListener(this);
- fSubjectControl.getShell().removeShellListener(this);
- }
- }
-
- /**
- * Initiates the computation of the information to be presented. Sets the initial hover area
- * to a small rectangle around the hover event location. Adds mouse move and shell activation listeners
- * to track whether the computed information is, after completion, useful for presentation and to
- * implement the restart function.
- *
- * @param event the mouse hover event
- */
- public void mouseHover(MouseEvent event) {
-
- if (fIsComputing || fIsInRestartMode) return;
-
- fIsInRestartMode= true;
- fIsComputing= true;
- fMouseLostWhileComputing= false;
- fShellDeactivatedWhileComputing= false;
-
- fHoverEventStateMask= event.stateMask;
- fHoverEventLocation= new Point(event.x, event.y);
- fHoverArea= new Rectangle(event.x - EPSILON, event.y - EPSILON, 2 * EPSILON, 2 * EPSILON );
- if (fHoverArea.x < 0) fHoverArea.x= 0;
- if (fHoverArea.y < 0) fHoverArea.y= 0;
- setSubjectArea(fHoverArea);
-
- if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
- fSubjectControl.addMouseMoveListener(this);
- fSubjectControl.getShell().addShellListener(this);
- }
- doShowInformation();
- }
-
- /**
- * Deactivates this tracker's restart function and enables the information control
- * manager. Does not have any effect if the tracker is still executing the start function (i.e.
- * computing the information to be presented.
- */
- protected void deactivate() {
- if (fIsComputing) return;
- fIsInRestartMode= false;
- if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
- fSubjectControl.removeMouseMoveListener(this);
- fSubjectControl.getShell().removeShellListener(this);
- }
- }
-
- /*
- * @see MouseTrackListener#mouseEnter(MouseEvent)
- */
- public void mouseEnter(MouseEvent e) {
- }
-
- /*
- * @see MouseTrackListener#mouseExit(MouseEvent)
- */
- public void mouseExit(MouseEvent e) {
- fMouseLostWhileComputing= true;
- deactivate();
- }
-
- /*
- * @see MouseMoveListener#mouseMove(MouseEvent)
- */
- public void mouseMove(MouseEvent event) {
- if (!fSubjectArea.contains(event.x, event.y))
- deactivate();
- }
-
- /*
- * @see ShellListener#shellDeactivated(ShellEvent)
- */
- public void shellDeactivated(ShellEvent e) {
- fShellDeactivatedWhileComputing= true;
- deactivate();
- }
-
- /*
- * @see ShellListener#shellIconified(ShellEvent)
- */
- public void shellIconified(ShellEvent e) {
- fShellDeactivatedWhileComputing= true;
- deactivate();
- }
-
- /**
- * Tells this tracker that the start function processing has been completed.
- */
- public void computationCompleted() {
- fIsComputing= false;
- fMouseLostWhileComputing= false;
- fShellDeactivatedWhileComputing= false;
- }
-
- /**
- * Determines whether the computed information is still useful for presentation.
- * This is not the case, if the shell of the subject control has been deactivated, the mouse
- * left the subject control, or the mouse moved on, so that it is no longer in the subject
- * area.
- *
- * @return <code>true</code> if information is still useful for presentation, <code>false</code> otherwise
- */
- public boolean isMouseLost() {
-
- if (fMouseLostWhileComputing || fShellDeactivatedWhileComputing)
- return true;
-
- if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
- Display display= fSubjectControl.getDisplay();
- Point p= display.getCursorLocation();
- p= fSubjectControl.toControl(p);
- if (!fSubjectArea.contains(p) && !fHoverArea.contains(p))
- return true;
- }
-
- return false;
- }
- };
-
- /** The mouse tracker on the subject control */
- private MouseTracker fMouseTracker= new MouseTracker();
- /** The remembered hover event location */
- private Point fHoverEventLocation= new Point(-1, -1);
- /** The remembered hover event sate mask of the keyboard modifiers */
- private int fHoverEventStateMask= 0;
-
- /**
- * Creates a new hover information control manager using the given information control creator.
- * By default a <code>Closer</code> instance is set as this manager's closer.
- *
- * @param creator the information control creator
- */
- protected AbstractHoverInformationControlManager(IInformationControlCreator creator) {
- super(creator);
- setCloser(new Closer());
- }
-
- /*
- * @see AbstractInformationControlManager#presentInformation()
- */
- protected void presentInformation() {
- if (fMouseTracker == null) {
- super.presentInformation();
- return;
- }
-
- Rectangle area= getSubjectArea();
- if (area != null)
- fMouseTracker.setSubjectArea(area);
-
- if (fMouseTracker.isMouseLost()) {
- fMouseTracker.computationCompleted();
- fMouseTracker.deactivate();
- } else {
- fMouseTracker.computationCompleted();
- super.presentInformation();
- }
- }
-
- /*
- * @see AbstractInformationControlManager#setEnabled(boolean)
- */
- public void setEnabled(boolean enabled) {
-
- boolean was= isEnabled();
- super.setEnabled(enabled);
- boolean is= isEnabled();
-
- if (was != is && fMouseTracker != null) {
- if (is)
- fMouseTracker.start(getSubjectControl());
- else
- fMouseTracker.stop();
- }
- }
-
- /**
- * Disposes this manager's information control.
- */
- public void dispose() {
- if (fMouseTracker != null) {
- fMouseTracker.stop();
- fMouseTracker.fSubjectControl= null;
- fMouseTracker= null;
- }
- super.dispose();
- }
-
- /**
- * Returns the location at which the most recent mouse hover event
- * has been issued.
- *
- * @return the location of the most recent mouse hover event
- */
- protected Point getHoverEventLocation() {
- return fHoverEventLocation;
- }
-
- /**
- * Returns the SWT event state of the most recent mouse hover event.
- *
- * @return the SWT event state of the most recent mouse hover event
- */
- protected int getHoverEventStateMask() {
- return fHoverEventStateMask;
- }
-
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java
deleted file mode 100644
index 125d5cb..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java
+++ /dev/null
@@ -1,730 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * Manages the life cycle, visibility, layout, and contents of an <code>IInformationControl</code>.
- * This manager can be installed on and uninstalled from a control, refered to as the subject control, i.e.
- * the one from which the subject of the information to be shown is retrieved. Also a manager can
- * be enabled or disabled. An installed and enabled manager can be forced to show information in
- * its information control using <code>showInformation</code>. An information control
- * manager uses an <code>IInformationControlCloser</code> to define the behavior when
- * a presented information control must be closed. The disposal of the subject and the information
- * control are internally handled by the information control manager and are not the responsibility
- * of the information control closer.
- *
- * @see org.eclipse.jface.text.IInformationControl
- * @since 2.0
- */
-abstract public class AbstractInformationControlManager {
-
- /**
- * Interface of a information control closer. An information control closer
- * monitors its information control and its subject control and closes
- * the information control if necessary. <p>
- * Clients must implement this interface in order to equipe an information
- * control manager accordingly.
- */
- public static interface IInformationControlCloser {
-
- /**
- * Sets the closer's subject control. This is the control that parents
- * the information control and from which the subject of the information
- * to be shown is retrieved. <p>
- * Must be called before <code>start</code>. May again be called
- * between <code>start</code> and <code>stop</code>.
- *
- * @param subject the subject control
- */
- public void setSubjectControl(Control subject);
-
- /**
- * Sets the closer's information control, the one to close if necessary. <p>
- * Must be called before <code>start</code>. May again be called
- * between <code>start</code> and <code>stop</code>.
- *
- * @param control the information control
- */
- public void setInformationControl(IInformationControl control);
-
- /**
- * Tells this closer to start monitoring the subject and the information
- * control. The presented information is considered valid for the given
- * area of the subject control's display.
- *
- * @param subjectArea the area for which the presented information is valid
- */
- public void start(Rectangle subjectArea);
-
- /**
- * Tells this closer to stop monitoring the subject and the information control.
- */
- public void stop();
- };
-
-
-
- /**
- * Constitutes entities to enumerate anchors for the layout of the information control.
- */
- public static final class Anchor {
- private Anchor() {
- };
- };
-
- /** Internal anchor list. */
- private final static Anchor[] ANCHORS= { new Anchor(), new Anchor(), new Anchor(), new Anchor() };
-
- /** Anchor representing the top of the information area */
- public final static Anchor ANCHOR_TOP= ANCHORS[0];
- /** Anchor representing the bottom of the information area */
- public final static Anchor ANCHOR_BOTTOM= ANCHORS[1];
- /** Anchor representing the left side of the information area */
- public final static Anchor ANCHOR_LEFT= ANCHORS[2];
- /** Anchor representing the right side of the information area */
- public final static Anchor ANCHOR_RIGHT= ANCHORS[3];
- /**
- * Anchor representing the middle of the subject control
- * @since 2.1
- */
- public final static Anchor ANCHOR_GLOBAL= new Anchor();
-
-
- /** The subject control of the information control */
- private Control fSubjectControl;
-
- /** The display area for which the information to be presented is valid */
- private Rectangle fSubjectArea;
-
- /** The information to be presented */
- private Object fInformation;
-
- /** Indicates whether the information control takes focus when visible */
- private boolean fTakesFocusWhenVisible= false;
-
- /** The information control */
- private IInformationControl fInformationControl;
-
- /** The information control creator */
- private IInformationControlCreator fInformationControlCreator;
-
- /** The information control closer */
- private IInformationControlCloser fInformationControlCloser;
-
- /** Indicates that the information control has been disposed */
- private boolean fDisposed= false;
-
- /** Indicates the enable state of this manager */
- private boolean fEnabled= false;
-
- /** Cached, computed size constraints of the information control in points */
- private Point fSizeConstraints;
-
- /** The y margin when laying out the information control */
- private int fMarginY= 5;
-
- /** The x margin when laying out the information control */
- private int fMarginX= 5;
-
- /** The width contraint of the information control in characters */
- private int fWidthConstraint= 60;
-
- /** The height constraint of the information control in characters */
- private int fHeightConstraint= 6;
-
- /** Indicates wether the size constraints should be enforced as minimal control size */
- private boolean fEnforceAsMinimalSize= false;
-
- /** Indicates whether the size constraints should be enforced as maximal control size */
- private boolean fEnforceAsMaximalSize= false;
-
- /** The anchor for laying out the information control in relation to the subject control */
- private Anchor fAnchor= ANCHOR_BOTTOM;
-
- /**
- * A list of anchors used to layout the information control if the original anchor can not
- * be used because the information control would not fit in the display client area.
- */
- private Anchor[] fFallbackAnchors= ANCHORS;
-
-
- /**
- * Creates a new information control manager using the given information control creator.
- * By default the following configuration is given:
- * <ul>
- * <li> enabled == false
- * <li> x-margin == 5 points
- * <li> y-margin == 5 points
- * <li> width constraint == 60 characters
- * <li> height constraint == 6 characters
- * <li> enforce constraints as minimal size == false
- * <li> enforce constraints as maximal size == false
- * <li> layout anchor == ANCHOR_BOTTOM
- * <li> fallback anchors == { ANCHOR_TOP, ANCHOR_BOTTOM, ANCHOR_LEFT, ANCHOR_RIGHT, ANCHOR_GLOBAL }
- * <li> takes focus when visible == false
- * </ul>
- *
- * @param creator the information control creator
- */
- protected AbstractInformationControlManager(IInformationControlCreator creator) {
- Assert.isNotNull(creator);
- fInformationControlCreator= creator;
- }
-
- /**
- * Computes the information to be displayed and the area in which the computed
- * information is valid. Implementation of this method must finish their computation
- * by setting the computation results using <code>setInformation</code>.
- */
- abstract protected void computeInformation();
-
- /**
- * Sets the parameters of the information to be displayed. These are the information itself and
- * the area for which the given information is valid. This so called subject area is a graphical
- * region of the information control's subject control. This method calls <code>presentInformation()</code>
- * to trigger the presentation of the computed information.
- *
- * @param information the information
- * @param subjectArea the subject area
- */
- protected final void setInformation(String information, Rectangle subjectArea) {
- fInformation= information;
- fSubjectArea= subjectArea;
- presentInformation();
- }
-
- /**
- * Sets the parameters of the information to be displayed. These are the information itself and
- * the area for which the given information is valid. This so called subject area is a graphical
- * region of the information control's subject control. This method calls <code>presentInformation()</code>
- * to trigger the presentation of the computed information.
- *
- * @param information the information
- * @param subjectArea the subject area
- * @since 2.1
- */
- protected final void setInformation(Object information, Rectangle subjectArea) {
- fInformation= information;
- fSubjectArea= subjectArea;
- presentInformation();
- }
-
- /**
- * Sets the information control closer for this manager.
- *
- * @param closer the information control closer for this manager
- */
- protected void setCloser(IInformationControlCloser closer) {
- fInformationControlCloser= closer;
- }
-
- /**
- * Sets the x- and y- margin to be used when laying out the information control
- * relative to the subject control.
- *
- * @param xMargin the x-margin
- * @param yMargin the y-Margin
- */
- public void setMargins(int xMargin, int yMargin) {
- fMarginX= xMargin;
- fMarginY= yMargin;
- }
-
- /**
- * Sets the width- and height constraints of the information control.
- *
- * @param widthInChar the width constraint in number of characters
- * @param heightInChar the height constrain in number of characters
- * @param enforceAsMinimalSize indicates whether the constraints describe the minimal allowed size of the control
- * @param enforceAsMaximalSize indicates whether the constraints describe the maximal allowed size of the control
- */
- public void setSizeConstraints(int widthInChar, int heightInChar, boolean enforceAsMinimalSize, boolean enforceAsMaximalSize) {
- fSizeConstraints= null;
- fWidthConstraint= widthInChar;
- fHeightConstraint= heightInChar;
- fEnforceAsMinimalSize= enforceAsMinimalSize;
- fEnforceAsMaximalSize= enforceAsMaximalSize;
- }
-
- /**
- * Sets the anchor used for laying out the information control relative to the
- * subject control. E.g, using <code>ANCHOR_TOP</code> indicates that the
- * information control is position above the area for which the information to
- * be displayed is valid.
- *
- * @param anchor the layout anchor
- */
- public void setAnchor(Anchor anchor) {
- fAnchor= anchor;
- }
-
- /**
- * Sets the sequence of anchors along which the information control is tried to
- * be laid out until it is fully visible. This fallback is initiated when the information
- * control does not fit into the client area of the subject control's display.
- *
- * @param fallbackAnchors the list of anchors to be tried
- */
- public void setFallbackAnchors(Anchor[] fallbackAnchors) {
- fFallbackAnchors= fallbackAnchors;
- }
-
- /**
- * Tells the manager whether it should set the focus to the information control when made visible.
- *
- * @param takesFocus <code>true</code> if information control should take focus when made visible
- */
- public void takesFocusWhenVisible(boolean takesFocus) {
- fTakesFocusWhenVisible= takesFocus;
- }
-
- /**
- * Handles the disposal of the subject control. By default, the information control
- * is disposed by calling <code>disposeInformationControl</code>. Subclasses may extend
- * this method.
- */
- protected void handleSubjectControlDisposed() {
- disposeInformationControl();
- }
-
- /**
- * Installs this manager on the given control. The control is now taking the role of
- * the subject control. This implementation sets the control also as the information
- * control closer's subject control and automatically enables this manager.
- *
- * @param subjectControl the subject control
- */
- public void install(Control subjectControl) {
- fSubjectControl= subjectControl;
-
- if (fSubjectControl != null) {
- fSubjectControl.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- handleSubjectControlDisposed();
- }
- });
- }
-
- if (fInformationControlCloser != null)
- fInformationControlCloser.setSubjectControl(subjectControl);
-
- setEnabled(true);
- }
-
- /**
- * Returns the subject control of this manager/information control.
- *
- * @return the subject control
- */
- protected Control getSubjectControl() {
- return fSubjectControl;
- }
-
- /**
- * Returns the actual subject area.
- *
- * @return the actual subject area
- */
- protected Rectangle getSubjectArea() {
- return fSubjectArea;
- }
-
- /**
- * Sets the enable state of this manager.
- *
- * @param enabled the enable state
- * @deprecated visibility will be changed to protected
- */
- public void setEnabled(boolean enabled) {
- fEnabled= enabled;
- }
-
- /**
- * Returns whether this manager is enabled or not.
- *
- * @return <code>true</code> if this manager is enabled otherwise <code>false</code>
- */
- protected boolean isEnabled() {
- return fEnabled;
- }
-
- /**
- * Computes the size constraints of the information control in points based on the
- * default font of the given subject control as well as the size constraints in character
- * width.
- *
- * @param subjectControl the subject control
- * @param informationControl the information control whose size constraints are computed
- * @return the computed size constraints in points
- */
- protected Point computeSizeConstraints(Control subjectControl, IInformationControl informationControl) {
-
- if (fSizeConstraints == null) {
-
- if (subjectControl == null)
- return null;
-
- GC gc= new GC(subjectControl);
- gc.setFont(subjectControl.getFont());
- int width= gc.getFontMetrics().getAverageCharWidth();
- int height = gc.getFontMetrics().getHeight();
- gc.dispose();
-
- fSizeConstraints= new Point (fWidthConstraint * width, fHeightConstraint * height);
- }
-
- return fSizeConstraints;
- }
-
- /**
- * Handles the disposal of the information control. By default, the information
- * control closer is stopped.
- */
- protected void handleInformationControlDisposed() {
- fInformationControl= null;
- if (fInformationControlCloser != null) {
- fInformationControlCloser.setInformationControl(null);
- fInformationControlCloser.stop();
- }
- }
-
- /**
- * Returns the information control. If the information control has not been created yet,
- * it is automatically created.
- *
- * @return the information control
- */
- protected IInformationControl getInformationControl() {
- if (fInformationControl == null && !fDisposed) {
-
- fInformationControl= fInformationControlCreator.createInformationControl(fSubjectControl.getShell());
-
- fInformationControl.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- handleInformationControlDisposed();
- }
- });
-
- if (fInformationControlCloser != null)
- fInformationControlCloser.setInformationControl(fInformationControl);
- }
- return fInformationControl;
- }
-
- /**
- * Computes the display location of the information control. The location is computed
- * considering the given subject area, the anchor at the subject area, and the
- * size of the information control. This method does not care about whether the information
- * control would be completely visible when placed at the result location.
- *
- * @param subjectArea the subject area
- * @param controlSize the size of the information control
- * @param anchor the anchor at the subject area
- * @return the display location of the information control
- */
- protected Point computeLocation(Rectangle subjectArea, Point controlSize, Anchor anchor) {
-
- if (ANCHOR_GLOBAL == anchor) {
- Point subjectControlSize= fSubjectControl.getSize();
- Point location= new Point(subjectControlSize.x / 2, subjectControlSize.y / 2);
- location.x -= (controlSize.x / 2);
- location.y -= (controlSize.y / 2);
- return fSubjectControl.toDisplay(location);
- }
-
- int xShift= 0;
- int yShift= 0;
-
- if (ANCHOR_BOTTOM == anchor) {
- xShift= fMarginX;
- yShift= subjectArea.height + fMarginY;
- } else if (ANCHOR_RIGHT == anchor) {
- xShift= fMarginX + subjectArea.width;
- yShift= fMarginY;
- } else if (ANCHOR_TOP == anchor) {
- xShift= fMarginX;
- yShift= -controlSize.y - fMarginY;
- } else if (ANCHOR_LEFT == anchor) {
- xShift= -controlSize.x - fMarginX;
- yShift= fMarginY;
- }
-
- return fSubjectControl.toDisplay(new Point(subjectArea.x + xShift, subjectArea.y + yShift));
- }
-
- /**
- * Checks whether a control of the given size at the given location would be completely visible
- * in the given display area when laid out by using the given anchor. If not, this method tries
- * to shift the control orthogonal to the direction given by the anchor to make it visible. If possible
- * it updates the location.<p>
- * This method returns <code>true</code> if the potentially updated position results in a
- * completely visible control, or <code>false</code> otherwise.
- *
- *
- * @param location the location of the control
- * @param size the size of the control
- * @param displayArea the display area in which the control should be visible
- * @param anchor anchor for alying out the control
- * @return <code>true</code>if the updated location is useful
- */
- protected boolean updateLocation(Point location, Point size, Rectangle displayArea, Anchor anchor) {
-
- int displayLowerRightX= displayArea.x + displayArea.width;
- int displayLowerRightY= displayArea.y + displayArea.height;
- int lowerRightX= location.x + size.x;
- int lowerRightY= location.y + size.y;
-
- if (ANCHOR_BOTTOM == anchor || ANCHOR_TOP == anchor) {
-
- if (ANCHOR_BOTTOM == anchor) {
- if (lowerRightY > displayLowerRightY)
- return false;
- } else {
- if (location.y < displayArea.y)
- return false;
- }
-
- if (lowerRightX > displayLowerRightX)
- location.x= location.x - (lowerRightX - displayLowerRightX);
-
- return (location.x >= 0 && location.y >= 0);
-
- } else if (ANCHOR_RIGHT == anchor || ANCHOR_LEFT == anchor) {
-
- if (ANCHOR_RIGHT == anchor) {
- if (lowerRightX > displayLowerRightX)
- return false;
- } else {
- if (location.x < displayArea.x)
- return false;
- }
-
- if (lowerRightY > displayLowerRightY)
- location.y= location.y - (lowerRightY - displayLowerRightY);
-
- return (location.x >= 0 && location.y >= 0);
-
- } else if (ANCHOR_GLOBAL == anchor) {
-
- if (lowerRightX > displayLowerRightX)
- location.x= location.x - (lowerRightX - displayLowerRightX);
-
- if (lowerRightY > displayLowerRightY)
- location.y= location.y - (lowerRightY - displayLowerRightY);
-
- return (location.x >= 0 && location.y >= 0);
- }
-
- return false;
- }
-
- /**
- * Returns the next fallback anchor from this manager's list of fallback anchors.
- * If no more fallback anchor is available <code>null</code> is returned.
- *
- * @param anchor the current anchor
- * @return the next fallback anchor or <code>null</code> if no more anchor is available
- */
- protected Anchor getNextFallbackAnchor(Anchor anchor) {
-
- if (anchor == null || fFallbackAnchors == null)
- return null;
-
- for (int i= 0; i < fFallbackAnchors.length; i++) {
- if (fFallbackAnchors[i] == anchor)
- return fFallbackAnchors[i + 1 == fFallbackAnchors.length ? 0 : i + 1];
- }
-
- return null;
- }
-
- /**
- * Computes the location of the information control depending on the
- * subject area and the size of the information control. This method attempts
- * to find a location at which the information control lies completely in the display's
- * client area honoring the manager's default anchor. If this isn't possible using the
- * default anchor, the fallback anchors are tried out.
- *
- * @param subjectArea the information area
- * @param controlSize the size of the information control
- * @return the computed location of the information control
- */
- protected Point computeInformationControlLocation(Rectangle subjectArea, Point controlSize) {
-
- Rectangle displayBounds= fSubjectControl.getDisplay().getClientArea();
-
- Point upperLeft;
- Anchor testAnchor= fAnchor;
- do {
-
- upperLeft= computeLocation(subjectArea, controlSize, testAnchor);
- if (updateLocation(upperLeft, controlSize, displayBounds, testAnchor))
- break;
- testAnchor= getNextFallbackAnchor(testAnchor);
-
- } while (testAnchor != fAnchor && testAnchor != null);
-
- return upperLeft;
- }
-
- /**
- * Computes information to be displayed as well as the subject area
- * and initiates that this information is presented in the information control.
- * This happens only if this controller is enabled.
- */
- public void showInformation() {
- if (fEnabled)
- doShowInformation();
- }
-
- /**
- * Computes information to be displayed as well as the subject area
- * and initiates that this information is presented in the information control.
- */
- protected void doShowInformation() {
- fSubjectArea= null;
- fInformation= null;
- computeInformation();
- }
-
- /**
- * Presents the information in the information control or hides the information
- * control if no information should be presented. The information has previously
- * been set using <code>setInformation</code>.
- */
- protected void presentInformation() {
- boolean hasContents= false;
- if (fInformation instanceof String)
- hasContents= ((String)fInformation).trim().length() > 0;
- else
- hasContents= (fInformation != null);
-
- if (fSubjectArea != null && hasContents)
- internalShowInformationControl(fSubjectArea, fInformation);
- else
- hideInformationControl();
- }
-
- /**
- * Opens the information control with the given information and the specified
- * subject area. It also activates the information control closer.
- *
- * @param subjectArea the information area
- * @param information the information
- */
- private void internalShowInformationControl(Rectangle subjectArea, Object information) {
-
- IInformationControl informationControl= getInformationControl();
- if (informationControl != null) {
-
- Point sizeConstraints= computeSizeConstraints(fSubjectControl, informationControl);
- informationControl.setSizeConstraints(sizeConstraints.x, sizeConstraints.y);
-
- if (informationControl instanceof IInformationControlExtension2)
- ((IInformationControlExtension2)informationControl).setInput(information);
- else
- informationControl.setInformation(information.toString());
-
- if (informationControl instanceof IInformationControlExtension) {
- IInformationControlExtension extension= (IInformationControlExtension)informationControl;
- if (!extension.hasContents())
- return;
- }
-
- Point size= informationControl.computeSizeHint();
-
- if (fEnforceAsMinimalSize) {
- if (size.x < sizeConstraints.x)
- size.x= sizeConstraints.x;
- if (size.y < sizeConstraints.y)
- size.y= sizeConstraints.y;
- }
-
- if (fEnforceAsMaximalSize) {
- if (size.x > sizeConstraints.x)
- size.x= sizeConstraints.x;
- if (size.y > sizeConstraints.y)
- size.y= sizeConstraints.y;
- }
-
- informationControl.setSize(size.x, size.y);
-
- Point location= computeInformationControlLocation(subjectArea, size);
- informationControl.setLocation(location);
-
- showInformationControl(subjectArea);
- }
- }
-
- /**
- * Hides the information control and stops the information control closer.
- */
- protected void hideInformationControl() {
- if (fInformationControl != null) {
- fInformationControl.setVisible(false);
- if (fInformationControlCloser != null)
- fInformationControlCloser.stop();
- }
- }
-
- /**
- * Shows the information control and starts the information control closer.
- * This method may not be called by clients.
- *
- * @param subjectArea the information area
- */
- protected void showInformationControl(Rectangle subjectArea) {
- fInformationControl.setVisible(true);
-
- if (fTakesFocusWhenVisible)
- fInformationControl.setFocus();
-
- if (fInformationControlCloser != null)
- fInformationControlCloser.start(subjectArea);
- }
-
- /**
- * Disposes this manager's information control.
- */
- public void disposeInformationControl() {
- if (fInformationControl != null) {
- fInformationControl.dispose();
- handleInformationControlDisposed();
- }
- }
-
- /**
- * Disposes this manager and if necessary all dependent parts such as
- * the information control. For symmetry it first disables this manager.
- */
- public void dispose() {
- if (!fDisposed) {
-
- fDisposed= true;
-
- setEnabled(false);
- disposeInformationControl();
-
- fInformationControlCreator= null;
- fInformationControlCloser= null;
- }
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/CursorLinePainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/CursorLinePainter.java
deleted file mode 100644
index c7ef1bf..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/CursorLinePainter.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.swt.custom.LineBackgroundEvent;
-import org.eclipse.swt.custom.LineBackgroundListener;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewerExtension3;
-import org.eclipse.jface.text.Position;
-
-
-/**
- * A painter the draws the background of the cursor line in a configured color.
- * Clients usually instantiate and configure object of this class.<p>
- * This class is not intended to be subclassed.
- *
- * @since 2.1
- */
-public class CursorLinePainter implements IPainter, LineBackgroundListener {
-
- /** The viewer the painter works on */
- private final ITextViewer fViewer;
- /** The cursor line back ground color */
- private Color fHighlightColor;
- /** The paint position manager for managing the line coordinates */
- private IPaintPositionManager fPositionManager;
-
- /** Keeps track of the line to be painted */
- private Position fCurrentLine= new Position(0, 0);
- /** Keeps track of the line to be cleared */
- private Position fLastLine= new Position(0, 0);
- /** Keeps track of the line number of the last painted line */
- private int fLastLineNumber= -1;
- /** Indicates whether this painter is active */
- private boolean fIsActive;
-
- /**
- * Creates a new painter for the given source viewer.
- *
- * @param textViewer the source viewer for which to create a painter
- */
- public CursorLinePainter(ITextViewer textViewer) {
- fViewer= textViewer;
- }
-
- /**
- * Sets the color in which to draw the background of the cursor line.
- *
- * @param highlightColor the color in which to draw the background of the cursor line
- */
- public void setHighlightColor(Color highlightColor) {
- fHighlightColor= highlightColor;
- }
-
- /*
- * @see LineBackgroundListener#lineGetBackground(LineBackgroundEvent)
- */
- public void lineGetBackground(LineBackgroundEvent event) {
- // don't use cached line information because of asynch painting
-
- StyledText textWidget= fViewer.getTextWidget();
- if (textWidget != null) {
-
- int caret= textWidget.getCaretOffset();
- int length= event.lineText.length();
-
- if (event.lineOffset <= caret && caret <= event.lineOffset + length)
- event.lineBackground= fHighlightColor;
- else
- event.lineBackground= textWidget.getBackground();
- }
- }
-
- /**
- * Updates all the cached information about the lines to be painted and to be cleared. Returns <code>true</code>
- * if the line number of the cursor line has changed.
- *
- * @return <code>true</code> if cursor line changed
- */
- private boolean updateHighlightLine() {
- try {
-
- IDocument document= fViewer.getDocument();
- int lineNumber= document.getLineOfOffset(getModelCaret());
-
- // redraw if the current line number is different from the last line number we painted
- // initially fLastLineNumber is -1
- if (lineNumber != fLastLineNumber) {
-
- fLastLine.offset= fCurrentLine.offset;
- fLastLine.length= fCurrentLine.length;
- fLastLine.isDeleted= fCurrentLine.isDeleted;
-
- fCurrentLine.isDeleted= false;
- fCurrentLine.offset= document.getLineOffset(lineNumber);
- if (lineNumber == document.getNumberOfLines() - 1)
- fCurrentLine.length= document.getLength() - fCurrentLine.offset;
- else
- fCurrentLine.length= document.getLineOffset(lineNumber + 1) - fCurrentLine.offset;
-
- fLastLineNumber= lineNumber;
- return true;
-
- }
-
- } catch (BadLocationException e) {
- }
-
- return false;
- }
-
- /**
- * Returns the location of the caret as offset in the source viewer's
- * input document.
- *
- * @return the caret location
- */
- private int getModelCaret() {
- int widgetCaret= fViewer.getTextWidget().getCaretOffset();
- if (fViewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) fViewer;
- return extension.modelOffset2WidgetOffset(widgetCaret);
- } else {
- IRegion visible= fViewer.getVisibleRegion();
- return widgetCaret + visible.getOffset();
- }
- }
-
- /**
- * Assumes the given position to specify offset and length of a line to be painted.
- *
- * @param position the specification of the line to be painted
- */
- private void drawHighlightLine(Position position) {
-
- // if the position that is about to be drawn was deleted then we can't
- if (position.isDeleted())
- return;
-
- int widgetOffset= 0;
- if (fViewer instanceof ITextViewerExtension3) {
-
- ITextViewerExtension3 extension= (ITextViewerExtension3) fViewer;
- widgetOffset= extension.modelOffset2WidgetOffset(position.getOffset());
- if (widgetOffset == -1)
- return;
-
- } else {
-
- IRegion visible= fViewer.getVisibleRegion();
- widgetOffset= position.getOffset() - visible.getOffset();
- if (widgetOffset < 0 || visible.getLength() < widgetOffset )
- return;
- }
-
- StyledText textWidget= fViewer.getTextWidget();
- Point upperLeft= textWidget.getLocationAtOffset(widgetOffset);
- int width= textWidget.getClientArea().width + textWidget.getHorizontalPixel();
- int height= textWidget.getLineHeight();
- textWidget.redraw(0, upperLeft.y, width, height, false);
- }
-
- /*
- * @see IPainter#deactivate(boolean)
- */
- public void deactivate(boolean redraw) {
- if (fIsActive) {
- fIsActive= false;
-
- /* on turning off the feature one has to paint the currently
- * highlighted line with the standard background color
- */
- if (redraw)
- drawHighlightLine(fCurrentLine);
-
- fViewer.getTextWidget().removeLineBackgroundListener(this);
-
- if (fPositionManager != null)
- fPositionManager.unmanagePosition(fCurrentLine);
-
- fLastLineNumber= -1;
- }
- }
-
- /*
- * @see IPainter#dispose()
- */
- public void dispose() {
- }
-
- /*
- * @see IPainter#paint(int)
- */
- public void paint(int reason) {
- if (fViewer.getDocument() == null) {
- deactivate(false);
- return;
- }
-
- // check selection
- Point selection= fViewer.getTextWidget().getSelectionRange();
- if (selection.y > 0) {
- deactivate(true);
- return;
- }
-
- // initialization
- if (!fIsActive) {
- fViewer.getTextWidget().addLineBackgroundListener(this);
- fPositionManager.managePosition(fCurrentLine);
- fIsActive= true;
- }
-
- //redraw line highlight only if it hasn't been drawn yet on the respective line
- if (updateHighlightLine()) {
- // clear last line
- drawHighlightLine(fLastLine);
- // draw new line
- drawHighlightLine(fCurrentLine);
- }
- }
-
- /*
- * @see IPainter#setPositionManager(IPaintPositionManager)
- */
- public void setPositionManager(IPaintPositionManager manager) {
- fPositionManager = manager;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultAutoIndentStrategy.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultAutoIndentStrategy.java
deleted file mode 100644
index 742322b..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultAutoIndentStrategy.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.jface.text;
-
-
-
-
-/**
- * Default implementation of <code>IAutoIndentStrategy</code>.
- * This strategy always copies the indentation of the previous line.
- */
-public class DefaultAutoIndentStrategy implements IAutoIndentStrategy {
-
- /**
- * Creates a new default auto indent strategy which can be installed on
- * text viewers.
- */
- public DefaultAutoIndentStrategy() {
- }
-
- /**
- * Returns the first offset greater than <code>offset</code> and smaller than
- * <code>end</code> whose character is not a space or tab character. If no such
- * offset is found, <code>end</code> is returned.
- *
- * @param document the document to search in
- * @param offset the offset at which searching start
- * @param end the offset at which searching stops
- * @return the offset in the specifed range whose character is not a space or tab
- * @exception BadLocationException if position is an invalid range in the given document
- */
- protected int findEndOfWhiteSpace(IDocument document, int offset, int end) throws BadLocationException {
- while (offset < end) {
- char c= document.getChar(offset);
- if (c != ' ' && c != '\t') {
- return offset;
- }
- offset++;
- }
- return end;
- }
-
- /**
- * Copies the indentation of the previous line.
- *
- * @param d the document to work on
- * @param c the command to deal with
- */
- private void autoIndentAfterNewLine(IDocument d, DocumentCommand c) {
-
- if (c.offset == -1 || d.getLength() == 0)
- return;
-
- try {
- // find start of line
- int p= (c.offset == d.getLength() ? c.offset - 1 : c.offset);
- IRegion info= d.getLineInformationOfOffset(p);
- int start= info.getOffset();
-
- // find white spaces
- int end= findEndOfWhiteSpace(d, start, c.offset);
-
- StringBuffer buf= new StringBuffer(c.text);
- if (end > start) {
- // append to input
- buf.append(d.get(start, end - start));
- }
-
- c.text= buf.toString();
-
- } catch (BadLocationException excp) {
- // stop work
- }
- }
-
- /*
- * @see IAutoIndentStrategy#customizeDocumentCommand
- */
- public void customizeDocumentCommand(IDocument d, DocumentCommand c) {
- if (c.length == 0 && c.text != null && TextUtilities.endsWith(d.getLegalLineDelimiters(), c.text) != -1)
- autoIndentAfterNewLine(d, c);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java
deleted file mode 100644
index 26a7987..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.graphics.Color;
-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.Display;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * Text based implementation of <code>IInformationControl</code>.
- * Displays information in a styled text widget. Before displaying, the
- * information set to this information control is processed by an
- * <code>IInformationPresenter</code>.
- *
- * @since 2.0
- */
-public class DefaultInformationControl implements IInformationControl, IInformationControlExtension {
-
- /**
- * An information presenter determines the style presentation
- * of information displayed in the default information control.
- * The interface can be implemented by clients.
- */
- public static interface IInformationPresenter {
-
- /**
- * Updates the given presentation of the given information and
- * thereby may manipulate the information to be displayed. The manipulation
- * could be the extraction of textual encoded style information etc. Returns the
- * manipulated information.
- *
- * @param display the display of the information control
- * @param hoverInfo the information to be presented
- * @param presentation the presentation to be updated
- * @param maxWidth the maximal width in pixels
- * @param maxHeight the maximal height in pixels
- *
- * @return the manipulated information
- */
- String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight);
- };
-
- /**
- * Layout used to achive the "tool tip" look, i.e., flat with a thin boarder.
- */
- private static class BorderFillLayout extends Layout {
-
- /** The border widths. */
- final int fBorderSize;
-
- /**
- * Creates a fill layout with a border.
- *
- * @param borderSize the size of the border
- */
- public BorderFillLayout(int borderSize) {
- if (borderSize < 0)
- throw new IllegalArgumentException();
- fBorderSize= borderSize;
- }
-
- /**
- * Returns the border size.
- *
- * @return the border size
- */
- public int getBorderSize() {
- return fBorderSize;
- }
-
- /*
- * @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) {
-
- Control[] children= composite.getChildren();
- Point minSize= new Point(0, 0);
-
- if (children != null) {
- for (int i= 0; i < children.length; i++) {
- Point size= children[i].computeSize(wHint, hHint, flushCache);
- minSize.x= Math.max(minSize.x, size.x);
- minSize.y= Math.max(minSize.y, size.y);
- }
- }
-
- minSize.x += fBorderSize * 2 + RIGHT_MARGIN;
- minSize.y += fBorderSize * 2;
-
- return minSize;
- }
- /*
- * @see org.eclipse.swt.widgets.Layout#layout(org.eclipse.swt.widgets.Composite, boolean)
- */
- protected void layout(Composite composite, boolean flushCache) {
-
- Control[] children= composite.getChildren();
- Point minSize= new Point(composite.getClientArea().width, composite.getClientArea().height);
-
- if (children != null) {
- for (int i= 0; i < children.length; i++) {
- Control child= children[i];
- child.setSize(minSize.x - fBorderSize * 2, minSize.y - fBorderSize * 2);
- child.setLocation(fBorderSize, fBorderSize);
- }
- }
- }
- }
-
-
- /** Border thickness in pixels. */
- private static final int BORDER= 1;
- /** Right margin in pixels. */
- private static final int RIGHT_MARGIN= 3;
-
- /** The control's shell */
- private Shell fShell;
- /** The control's text widget */
- private StyledText fText;
- /** The information presenter */
- private IInformationPresenter fPresenter;
- /** A cached text presentation */
- private TextPresentation fPresentation= new TextPresentation();
- /** The control width constraint */
- private int fMaxWidth= -1;
- /** The control height constraint */
- private int fMaxHeight= -1;
-
-
-
- /**
- * Creates a default information control with the given shell as parent. The given
- * information presenter is used to process the information to be displayed. The given
- * styles are applied to the created styled text widget.
- *
- * @param parent the parent shell
- * @param shellStyle the additional styles for the shell
- * @param style the additional styles for the styled text widget
- * @param presenter the presenter to be used
- */
- public DefaultInformationControl(Shell parent, int shellStyle, int style, IInformationPresenter presenter) {
-
- fShell= new Shell(parent, SWT.NO_FOCUS | SWT.ON_TOP | shellStyle);
- fText= new StyledText(fShell, SWT.MULTI | SWT.READ_ONLY | style);
-
- Display display= fShell.getDisplay();
-
- int border= ((shellStyle & SWT.NO_TRIM) == 0) ? 0 : BORDER;
-
- fShell.setLayout(new BorderFillLayout(border));
- fShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
-
- fText.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- fText.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-
- fText.addKeyListener(new KeyListener() {
-
- public void keyPressed(KeyEvent e) {
- if (e.character == 0x1B) // ESC
- fShell.dispose();
- }
-
- public void keyReleased(KeyEvent e) {}
- });
-
- fPresenter= presenter;
- }
-
- /**
- * Creates a default information control with the given shell as parent. The given
- * information presenter is used to process the information to be displayed. The given
- * styles are applied to the created styled text widget.
- *
- * @param parent the parent shell
- * @param style the additional styles for the styled text widget
- * @param presenter the presenter to be used
- */
- public DefaultInformationControl(Shell parent,int style, IInformationPresenter presenter) {
- this(parent, SWT.NO_TRIM, style, presenter);
- }
-
- /**
- * Creates a default information control with the given shell as parent.
- * No information presenter is used to process the information
- * to be displayed. No additional styles are applied to the styled text widget.
- *
- * @param parent the parent shell
- */
- public DefaultInformationControl(Shell parent) {
- this(parent, SWT.NONE, null);
- }
-
- /**
- * Creates a default information control with the given shell as parent. The given
- * information presenter is used to process the information to be displayed.
- * No additional styles are applied to the styled text widget.
- *
- * @param parent the parent shell
- * @param presenter the presenter to be used
- */
- public DefaultInformationControl(Shell parent, IInformationPresenter presenter) {
- this(parent, SWT.NONE, presenter);
- }
-
- /*
- * @see IInformationControl#setInformation(String)
- */
- public void setInformation(String content) {
- if (fPresenter == null) {
- fText.setText(content);
- } else {
- fPresentation.clear();
- content= fPresenter.updatePresentation(fShell.getDisplay(), content, fPresentation, fMaxWidth, fMaxHeight);
- if (content != null) {
- fText.setText(content);
- TextPresentation.applyTextPresentation(fPresentation, fText);
- } else {
- fText.setText(""); //$NON-NLS-1$
- }
- }
- }
-
- /*
- * @see IInformationControl#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- fShell.setVisible(visible);
- }
-
- /*
- * @see IInformationControl#dispose()
- */
- public void dispose() {
- if (fShell != null) {
- if (!fShell.isDisposed())
- fShell.dispose();
- fShell= null;
- fText= null;
- }
- }
-
- /*
- * @see IInformationControl#setSize(int, int)
- */
- public void setSize(int width, int height) {
- fShell.setSize(width, height);
- }
-
- /*
- * @see IInformationControl#setLocation(Point)
- */
- public void setLocation(Point location) {
- Rectangle trim= fShell.computeTrim(0, 0, 0, 0);
- Point textLocation= fText.getLocation();
- location.x += trim.x - textLocation.x;
- location.y += trim.y - textLocation.y;
- fShell.setLocation(location);
- }
-
- /*
- * @see IInformationControl#setSizeConstraints(int, int)
- */
- public void setSizeConstraints(int maxWidth, int maxHeight) {
- fMaxWidth= maxWidth;
- fMaxHeight= maxHeight;
- }
-
- /*
- * @see IInformationControl#computeSizeHint()
- */
- public Point computeSizeHint() {
- return fShell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
-
- /*
- * @see IInformationControl#addDisposeListener(DisposeListener)
- */
- public void addDisposeListener(DisposeListener listener) {
- fShell.addDisposeListener(listener);
- }
-
- /*
- * @see IInformationControl#removeDisposeListener(DisposeListener)
- */
- public void removeDisposeListener(DisposeListener listener) {
- fShell.removeDisposeListener(listener);
- }
-
- /*
- * @see IInformationControl#setForegroundColor(Color)
- */
- public void setForegroundColor(Color foreground) {
- fText.setForeground(foreground);
- }
-
- /*
- * @see IInformationControl#setBackgroundColor(Color)
- */
- public void setBackgroundColor(Color background) {
- fText.setBackground(background);
- }
-
- /*
- * @see IInformationControl#isFocusControl()
- */
- public boolean isFocusControl() {
- return fText.isFocusControl();
- }
-
- /*
- * @see IInformationControl#setFocus()
- */
- public void setFocus() {
- fShell.forceFocus();
- fText.setFocus();
- }
-
- /*
- * @see IInformationControl#addFocusListener(FocusListener)
- */
- public void addFocusListener(FocusListener listener) {
- fText.addFocusListener(listener);
- }
-
- /*
- * @see IInformationControl#removeFocusListener(FocusListener)
- */
- public void removeFocusListener(FocusListener listener) {
- fText.removeFocusListener(listener);
- }
-
- /*
- * @see IInformationControlExtension#hasContents()
- */
- public boolean hasContents() {
- return fText.getCharCount() > 0;
- }
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java
deleted file mode 100644
index 64013f2..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-import java.text.BreakIterator;
-import java.text.CharacterIterator;
-
-
-/**
- * Standard implementation of <code>ITextDoubleClickStrategy</code>.
- * Selects words using <code>java.text.BreakIterator</code> for the
- * default locale. This class is not intended to be subclassed.
- *
- * @see java.text.BreakIterator
- */
-public class DefaultTextDoubleClickStrategy implements ITextDoubleClickStrategy {
-
-
- /**
- * Implements a character iterator that works directly on
- * instances of <code>IDocument</code>. Used to collaborate with
- * the break iterator.
- *
- * @see IDocument
- * @since 2.0
- */
- static class DocumentCharacterIterator implements CharacterIterator {
-
- /** Document to iterate over. */
- private IDocument fDocument;
- /** Start offset of iteration. */
- private int fOffset= -1;
- /** Endoffset of iteration. */
- private int fEndOffset= -1;
- /** Current offset of iteration. */
- private int fIndex= -1;
-
- /** Creates a new document iterator. */
- public DocumentCharacterIterator() {
- }
-
- /**
- * Configures this document iterator with the document section to be iteratored.
- *
- * @param document the document to be iterated
- * @param iteratorRange the range in the document to be iterated
- */
- public void setDocument(IDocument document, IRegion iteratorRange) {
- fDocument= document;
- fOffset= iteratorRange.getOffset();
- fEndOffset= fOffset + iteratorRange.getLength();
- }
-
- /*
- * @see CharacterIterator#first()
- */
- public char first() {
- fIndex= fOffset;
- return current();
- }
-
- /*
- * @see CharacterIterator#last()
- */
- public char last() {
- fIndex= fOffset < fEndOffset ? fEndOffset -1 : fEndOffset;
- return current();
- }
-
- /*
- * @see CharacterIterator#current()
- */
- public char current() {
- if (fOffset <= fIndex && fIndex < fEndOffset) {
- try {
- return fDocument.getChar(fIndex);
- } catch (BadLocationException x) {
- }
- }
- return DONE;
- }
-
- /*
- * @see CharacterIterator#next()
- */
- public char next() {
- if (fIndex == fEndOffset -1)
- return DONE;
-
- if (fIndex < fEndOffset)
- ++ fIndex;
-
- return current();
- }
-
- /*
- * @see CharacterIterator#previous()
- */
- public char previous() {
- if (fIndex == fOffset)
- return DONE;
-
- if (fIndex > fOffset)
- -- fIndex;
-
- return current();
- }
-
- /*
- * @see CharacterIterator#setIndex(int)
- */
- public char setIndex(int index) {
- fIndex= index;
- return current();
- }
-
- /*
- * @see CharacterIterator#getBeginIndex()
- */
- public int getBeginIndex() {
- return fOffset;
- }
-
- /*
- * @see CharacterIterator#getEndIndex()
- */
- public int getEndIndex() {
- return fEndOffset;
- }
-
- /*
- * @see CharacterIterator#getIndex()
- */
- public int getIndex() {
- return fIndex;
- }
-
- /*
- * @see CharacterIterator#clone()
- */
- public Object clone() {
- DocumentCharacterIterator i= new DocumentCharacterIterator();
- i.fDocument= fDocument;
- i.fIndex= fIndex;
- i.fOffset= fOffset;
- i.fEndOffset= fEndOffset;
- return i;
- }
- };
-
-
- /**
- * The document character iterator used by this strategy.
- * @since 2.0
- */
- private DocumentCharacterIterator fDocIter= new DocumentCharacterIterator();
-
-
- /**
- * Creates a new default text double click strategy.
- */
- public DefaultTextDoubleClickStrategy() {
- super();
- }
-
- /*
- * @see ITextDoubleClickStrategy#doubleClicked
- */
- public void doubleClicked(ITextViewer text) {
-
- int position= text.getSelectedRange().x;
-
- if (position < 0)
- return;
-
- try {
-
- IDocument document= text.getDocument();
- IRegion line= document.getLineInformationOfOffset(position);
- if (position == line.getOffset() + line.getLength())
- return;
-
- fDocIter.setDocument(document, line);
-
- BreakIterator breakIter= BreakIterator.getWordInstance();
- breakIter.setText(fDocIter);
-
- int start= breakIter.preceding(position);
- if (start == BreakIterator.DONE)
- start= line.getOffset();
-
- int end= breakIter.following(position);
- if (end == BreakIterator.DONE)
- end= line.getOffset() + line.getLength();
-
- if (breakIter.isBoundary(position)) {
- if (end - position > position- start)
- start= position;
- else
- end= position;
- }
-
- if (start != end)
- text.setSelectedRange(start, end - start);
-
- } catch (BadLocationException x) {
- }
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java
deleted file mode 100644
index da8b40d..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.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.jface.text;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-
-
-/**
- * Standard implementation of <code>IUndoManager</code>.
- * It registers with the connected text viewer as text listeners and logs all changes.
- * It also monitors mouse and keyboard activities in order to partition the stream of
- * text changes into undoable edit commands. <p>
- * This class is not intended to be subclassed.
- *
- * @see ITextViewer
- * @see ITextListener
- * @see MouseListener
- * @see KeyListener
- */
-public class DefaultUndoManager implements IUndoManager {
-
- /**
- * Represents an undoable edit command.
- */
- class TextCommand {
-
- /** The start index of the replaced text */
- protected int fStart= -1;
- /** The end index of the replaced text */
- protected int fEnd= -1;
- /** The newly inserted text */
- protected String fText;
- /** The replaced text */
- protected String fPreservedText;
-
- /**
- * Reinitializes this text command.
- */
- protected void reinitialize() {
- fStart= fEnd= -1;
- fText= fPreservedText= null;
- }
-
- /**
- * Sets the start and the end index of this command.
- *
- * @param start the start index
- * @param end the end index
- */
- protected void set(int start, int end) {
- fStart= start;
- fEnd= end;
- fText= null;
- fPreservedText= null;
- }
-
- /**
- * Undo the change described by this command.
- *
- * @param text the text widget to be modified
- * @since 2.0
- */
- protected void undoTextChange(StyledText text) {
- text.replaceTextRange(fStart, fText.length(), fPreservedText);
- }
-
- /**
- * Undo the change described by this command. Also selects and
- * reveals the change.
- *
- * @param text the text widget to be modified
- */
- protected void undo(StyledText text) {
- undoTextChange(text);
- IRegion modelRange= widgetRange2ModelRange(fStart, fPreservedText == null ? 0 : fPreservedText.length());
- fTextViewer.setSelectedRange(modelRange.getOffset(), modelRange.getLength());
- fTextViewer.revealRange(modelRange.getOffset(), modelRange.getLength());
- }
-
- /**
- * Redo the change described by this command.
- *
- * @param text the text widget to be modified
- * @since 2.0
- */
- protected void redoTextChange(StyledText text) {
- text.replaceTextRange(fStart, fEnd - fStart, fText);
- }
-
- /**
- * Redo the change described by this command that previously been
- * rolled back. Also selects and reveals the change.
- *
- * @param text the text widget to be modified
- */
- protected void redo(StyledText text) {
- redoTextChange(text);
- IRegion modelRange= widgetRange2ModelRange(fStart, fText == null ? 0 : fText.length());
- fTextViewer.setSelectedRange(modelRange.getOffset(), modelRange.getLength());
- fTextViewer.revealRange(modelRange.getOffset(), modelRange.getLength());
- }
-
- /**
- * Translates a given widget range into the corresponding range of the source viewer's input document.
- *
- * @param offset the offset of the widget range
- * @param length the length of the widget range
- * @return the corresponding model range
- * @since 2.1
- */
- protected IRegion widgetRange2ModelRange(int offset, int length) {
- if (fTextViewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) fTextViewer;
- return extension.widgetRange2ModelRange(new Region(offset, length));
- }
-
- IRegion visible= fTextViewer.getVisibleRegion();
- return new Region(offset + visible.getOffset(), length);
- }
-
- /**
- * Updates the command stack in response to committing
- * the current change into this command.
- */
- protected void updateCommandStack() {
-
- int length= fCommandStack.size();
- for (int i= fCommandCounter + 1; i < length; i++)
- fCommandStack.remove(fCommandCounter + 1);
-
- fCommandStack.add(this);
-
- while (fCommandStack.size() > fUndoLevel)
- fCommandStack.remove(0);
-
- fCommandCounter= fCommandStack.size() - 1;
- }
-
- /**
- * Creates a new uncommitted text command depending on whether
- * a compound change is currently being executed.
- *
- * @return a new, uncommitted text command or a compound text command
- */
- protected TextCommand createCurrent() {
- return fFoldingIntoCompoundChange ? new CompoundTextCommand() : new TextCommand();
- }
-
- /**
- * Commits the current change into this command.
- */
- protected void commit() {
-
- if (fStart < 0) {
- reinitialize();
- } else {
-
- fText= fTextBuffer.toString();
- fTextBuffer.setLength(0);
- fPreservedText= fPreservedTextBuffer.toString();
- fPreservedTextBuffer.setLength(0);
-
- updateCommandStack();
- }
-
- fCurrent= createCurrent();
- }
- };
-
- /**
- * Represents an undoable edit command consisting of several
- * individual edit commands.
- */
- class CompoundTextCommand extends TextCommand {
-
- /** The list of individual commands */
- private List fCommands= new ArrayList();
-
- /**
- * Adds a new individual command to this compound command.
- *
- * @param command the command to be added
- */
- protected void add(TextCommand command) {
- fCommands.add(command);
- }
-
- /*
- * @see TextCommand#undo
- */
- protected void undo(StyledText text) {
- ITextViewerExtension extension= null;
- if (fTextViewer instanceof ITextViewerExtension)
- extension= (ITextViewerExtension) fTextViewer;
-
- if (extension != null)
- extension.setRedraw(false);
-
- try {
-
- int size= fCommands.size();
- if (size > 0) {
-
- TextCommand c;
-
- for (int i= size -1; i > 0; --i) {
- c= (TextCommand) fCommands.get(i);
- c.undoTextChange(text);
- }
-
- c= (TextCommand) fCommands.get(0);
- c.undo(text);
- }
-
- } finally {
- if (extension != null)
- extension.setRedraw(true);
- }
- }
-
- /*
- * @see TextCommand#redo
- */
- protected void redo(StyledText text) {
-
- ITextViewerExtension extension= null;
- if (fTextViewer instanceof ITextViewerExtension)
- extension= (ITextViewerExtension) fTextViewer;
-
- if (extension != null)
- extension.setRedraw(false);
-
- try {
-
- int size= fCommands.size();
- if (size > 0) {
-
- TextCommand c;
-
- for (int i= 0; i < size -1; ++i) {
- c= (TextCommand) fCommands.get(i);
- c.redoTextChange(text);
- }
-
- c= (TextCommand) fCommands.get(size -1);
- c.redo(text);
- }
-
- } finally {
- if (extension != null)
- extension.setRedraw(true);
- }
- }
-
- /*
- * @see TextCommand#updateCommandStack
- */
- protected void updateCommandStack() {
- TextCommand c= new TextCommand();
- c.fStart= fStart;
- c.fEnd= fEnd;
- c.fText= fText;
- c.fPreservedText= fPreservedText;
-
- add(c);
-
- if (!fFoldingIntoCompoundChange)
- super.updateCommandStack();
- }
-
- /*
- * @see TextCommand#createCurrent
- */
- protected TextCommand createCurrent() {
-
- if (!fFoldingIntoCompoundChange)
- return new TextCommand();
-
- reinitialize();
- return this;
- }
-
- /*
- * @see org.eclipse.jface.text.DefaultUndoManager.TextCommand#commit()
- */
- protected void commit() {
- if (fStart < 0) {
- if (fCommands.size() > 0 && !fFoldingIntoCompoundChange) {
- super.updateCommandStack();
- fCurrent= createCurrent();
- return;
- }
- }
- super.commit();
- }
- };
-
- /**
- * Represents pretended <code>UndoManager</code> state.
- */
- class PretendedUndoManagerState {
- /** The counter in the undo stack */
- protected int cmdCounter= -1;
- /** The size of the undo stack */
- protected int stackSize= -1;
- };
-
- /**
- * Internal listener to mouse and key events.
- */
- class KeyAndMouseListener implements MouseListener, KeyListener {
-
- /*
- * @see MouseListener#mouseDoubleClick
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- /*
- * If the right mouse button is pressed, the current editing command is closed
- * @see MouseListener#mouseDown
- */
- public void mouseDown(MouseEvent e) {
- if (e.button == 1)
- commit();
- }
-
- /*
- * @see MouseListener#mouseUp
- */
- public void mouseUp(MouseEvent e) {
- }
-
- /*
- * @see KeyListener#keyPressed
- */
- public void keyReleased(KeyEvent e) {
- }
-
- /*
- * On cursor keys, the current editing command is closed
- * @see KeyListener#keyPressed
- */
- public void keyPressed(KeyEvent e) {
- switch (e.keyCode) {
- case SWT.ARROW_UP:
- case SWT.ARROW_DOWN:
- case SWT.ARROW_LEFT:
- case SWT.ARROW_RIGHT:
- commit();
- break;
- }
- }
- };
-
- /**
- * Internal listener to text changes.
- */
- class TextListener implements ITextListener {
-
- /*
- * @see ITextListener#textChanged
- */
- public void textChanged(TextEvent e) {
- if (e.getDocumentEvent() != null)
- processTextEvent(e);
- }
- };
-
- /** Text buffer to collect text which is inserted into the viewer */
- private StringBuffer fTextBuffer= new StringBuffer();
- /** Text buffer to collect viewer content which has been replaced */
- private StringBuffer fPreservedTextBuffer= new StringBuffer();
- /** Pretended undo manager state */
- private PretendedUndoManagerState fPretendedState= new PretendedUndoManagerState();
-
- /** The internal text listener */
- private ITextListener fTextListener;
- /** The internal key and mouse event listener */
- private KeyAndMouseListener fKeyAndMouseListener;
-
-
- /** Indicates inserting state */
- private boolean fInserting= false;
- /** Indicates deleteing state */
- private boolean fDeleting= false;
- /** Indicates overwriting state */
- private boolean fOverwriting= false;
- /** Indicates whether the current change belongs to a compound change */
- private boolean fFoldingIntoCompoundChange= false;
-
- /** The text viewer the undo manager is connected to */
- private ITextViewer fTextViewer;
-
- /** Supported undo level */
- private int fUndoLevel;
- /** The list of undoable edit commands */
- private List fCommandStack;
- /** The currently constructed edit command */
- private TextCommand fCurrent;
- /** The last delete edit command */
- private TextCommand fPreviousDelete;
- /** Command counter into the edit command stack */
- private int fCommandCounter= -1;
-
-
- /**
- * Creates a new undo manager who remembers the specified number of edit commands.
- *
- * @param undoLevel the length of this manager's history
- */
- public DefaultUndoManager(int undoLevel) {
- setMaximalUndoLevel(undoLevel);
- }
-
- /*
- * @see IUndoManager#beginCompoundChange
- */
- public void beginCompoundChange() {
- fFoldingIntoCompoundChange= true;
- commit();
- }
-
- /*
- * @see IUndoManager#endCompoundChange
- */
- public void endCompoundChange() {
- fFoldingIntoCompoundChange= false;
- commit();
- }
-
- /**
- * Registers all necessary listeners with the text viewer.
- */
- private void addListeners() {
- StyledText text= fTextViewer.getTextWidget();
- if (text != null) {
- fKeyAndMouseListener= new KeyAndMouseListener();
- text.addMouseListener(fKeyAndMouseListener);
- text.addKeyListener(fKeyAndMouseListener);
- listenToTextChanges(true);
- }
- }
-
- /**
- * Deregister all previously installed listeners from the text viewer.
- */
- private void removeListeners() {
- StyledText text= fTextViewer.getTextWidget();
- if (text != null && fKeyAndMouseListener != null) {
- text.removeMouseListener(fKeyAndMouseListener);
- text.removeKeyListener(fKeyAndMouseListener);
- listenToTextChanges(false);
- }
- }
-
- /**
- * Switches the state of whether there is a text listener or not.
- *
- * @param listen the state which should be established
- */
- private void listenToTextChanges(boolean listen) {
- if (listen && fTextListener == null) {
- fTextListener= new TextListener();
- fTextViewer.addTextListener(fTextListener);
- } else if (!listen && fTextListener != null) {
- fTextViewer.removeTextListener(fTextListener);
- fTextListener= null;
- }
- }
-
- /**
- * Closes the current editing command and opens a new one.
- */
- private void commit() {
-
- fInserting= false;
- fDeleting= false;
- fOverwriting= false;
- fPreviousDelete.reinitialize();
-
- fCurrent.commit();
- }
-
- /**
- * Does redo the previously undone editing command.
- */
- private void internalRedo() {
- StyledText text= fTextViewer.getTextWidget();
- if (text != null) {
-
- ++fCommandCounter;
- TextCommand cmd= (TextCommand) fCommandStack.get(fCommandCounter);
-
- listenToTextChanges(false);
- cmd.redo(text);
- listenToTextChanges(true);
-
- fCurrent= new TextCommand();
- }
- }
-
- /**
- * Does undo the last editing command.
- */
- private void internalUndo() {
- StyledText text= fTextViewer.getTextWidget();
- if (text != null) {
-
- TextCommand cmd= (TextCommand) fCommandStack.get(fCommandCounter);
- -- fCommandCounter;
-
- listenToTextChanges(false);
- cmd.undo(text);
- listenToTextChanges(true);
-
- fCurrent= new TextCommand();
- }
- }
-
- /**
- * Checks whether the given text starts with a line delimiter and
- * subsequently contains a white space only.
- *
- * @param text the text to check
- */
- private boolean isWhitespaceText(String text) {
-
- if (text == null || text.length() == 0)
- return false;
-
- String[] delimiters= fTextViewer.getDocument().getLegalLineDelimiters();
- int index= TextUtilities.startsWith(delimiters, text);
- if (index > -1) {
- char c;
- int length= text.length();
- for (int i= delimiters[index].length(); i < length; i++) {
- c= text.charAt(i);
- if (c != ' ' && c != '\t')
- return false;
- }
- return true;
- }
-
- return false;
- }
-
- /**
- * Returns the state the would result if the current editing command would be closed.
- *
- * @return the pretended state after closing the current editing command
- */
- private PretendedUndoManagerState pretendCommit() {
- if (fCurrent.fStart < 0) {
- fPretendedState.stackSize= fCommandStack.size();
- fPretendedState.cmdCounter= fCommandCounter;
- } else {
- int sz= Math.max(fCommandCounter, 0) + 1;
- if (sz > fUndoLevel)
- sz -= fUndoLevel;
- fPretendedState.stackSize= sz;
- fPretendedState.cmdCounter= sz - 1;
- }
- return fPretendedState;
- }
-
- /**
- * Processes the given text event in order to determine editor command.
- *
- * @param e the text event
- */
- private void processTextEvent(TextEvent e) {
-
- int start= e.getOffset();
- int end= e.getOffset() + e.getLength();
- String newText= e.getText();
- String oldText= e.getReplacedText();
-
-
- if (newText == null)
- newText= ""; //$NON-NLS-1$
-
- if (oldText == null)
- oldText= ""; //$NON-NLS-1$
-
- int length= newText.length();
- int diff= end - start;
-
- // normalize verify command
- if (diff < 0) {
- int tmp= end;
- end= start;
- start= tmp;
- diff= -diff;
- }
-
- if (start == end) {
- // text will be inserted
- if ((length == 1) || isWhitespaceText(newText)) {
- // by typing or model manipulation
- if (!fInserting || (start != fCurrent.fStart + fTextBuffer.length())) {
- commit();
- fInserting= true;
- }
- if (fCurrent.fStart < 0)
- fCurrent.fStart= fCurrent.fEnd= start;
- if (length > 0)
- fTextBuffer.append(newText);
- } else if (length > 0) {
- // by pasting
- commit();
- fCurrent.fStart= fCurrent.fEnd= start;
- fTextBuffer.append(newText);
- commit();
- }
- } else {
- if (length == 0) {
- // text will be deleted by backspace or DEL key or empty clipboard
- length= oldText.length();
- String[] delimiters= fTextViewer.getDocument().getLegalLineDelimiters();
-
- if ((length == 1) || TextUtilities.equals(delimiters, oldText) > -1) {
-
- // whereby selection is empty
-
- if (fPreviousDelete.fStart == start && fPreviousDelete.fEnd == end) {
- // repeated DEL
-
- // correct wrong settings of fCurrent
- if (fCurrent.fStart == end && fCurrent.fEnd == start) {
- fCurrent.fStart= start;
- fCurrent.fEnd= end;
- }
- // append to buffer && extend command range
- fPreservedTextBuffer.append(oldText);
- ++fCurrent.fEnd;
-
- } else if (fPreviousDelete.fStart == end) {
- // repeated backspace
-
- // insert in buffer and extend command range
- fPreservedTextBuffer.insert(0, oldText);
- fCurrent.fStart= start;
-
- } else {
- // either DEL or backspace for the first time
-
- commit();
- fDeleting= true;
-
- // as we can not decide whether it was DEL or backspace we initialize for backspace
- fPreservedTextBuffer.append(oldText);
- fCurrent.fStart= start;
- fCurrent.fEnd= end;
- }
-
- fPreviousDelete.set(start, end);
-
- } else if (length > 0) {
- // whereby selection is not empty
- commit();
- fCurrent.fStart= start;
- fCurrent.fEnd= end;
- fPreservedTextBuffer.append(oldText);
- }
- } else {
- // text will be replaced
-
- if (length == 1) {
- length= oldText.length();
- String[] delimiters= fTextViewer.getDocument().getLegalLineDelimiters();
-
- if ((length == 1) || TextUtilities.equals(delimiters, oldText) > -1) {
- // because of overwrite mode or model manipulation
- if (!fOverwriting || (start != fCurrent.fStart + fTextBuffer.length())) {
- commit();
- fOverwriting= true;
- }
-
- if (fCurrent.fStart < 0)
- fCurrent.fStart= start;
-
- fCurrent.fEnd= end;
- fTextBuffer.append(newText);
- fPreservedTextBuffer.append(oldText);
- return;
- }
- }
- // because of typing or pasting whereby selection is not empty
- commit();
- fCurrent.fStart= start;
- fCurrent.fEnd= end;
- fTextBuffer.append(newText);
- fPreservedTextBuffer.append(oldText);
- }
- }
- }
-
- /*
- * @see IUndoManager#setMaximalUndoLevel
- */
- public void setMaximalUndoLevel(int undoLevel) {
- fUndoLevel= undoLevel;
- }
-
- /*
- * @see IUndoManager#connect
- */
- public void connect(ITextViewer textViewer) {
- if (fTextViewer == null) {
- fTextViewer= textViewer;
- fCommandStack= new ArrayList();
- fCurrent= new TextCommand();
- fPreviousDelete= new TextCommand();
- addListeners();
- }
- }
-
- /*
- * @see IUndoManager#disconnect
- */
- public void disconnect() {
- if (fTextViewer != null) {
-
- removeListeners();
-
- fCurrent= null;
- if (fCommandStack != null) {
- fCommandStack.clear();
- fCommandStack= null;
- }
- fTextBuffer= null;
- fPreservedTextBuffer= null;
- fTextViewer= null;
- }
- }
-
- /*
- * @see IUndoManager#reset
- */
- public void reset() {
- if (fCommandStack != null)
- fCommandStack.clear();
- fCommandCounter= -1;
- if (fCurrent != null)
- fCurrent.reinitialize();
- fFoldingIntoCompoundChange= false;
- fInserting= false;
- fDeleting= false;
- fOverwriting= false;
- fTextBuffer.setLength(0);
- fPreservedTextBuffer.setLength(0);
- }
-
- /*
- * @see IUndoManager#redoable
- */
- public boolean redoable() {
- if (fCommandStack != null) {
- PretendedUndoManagerState s= pretendCommit();
- return (0 <= s.cmdCounter + 1) && (s.cmdCounter + 1 < s.stackSize);
- }
- return false;
- }
-
- /*
- * @see IUndoManager#undoable
- */
- public boolean undoable() {
- if (fCommandStack != null) {
- PretendedUndoManagerState s= pretendCommit();
- return (0 <= s.cmdCounter) && (s.cmdCounter < s.stackSize);
- }
- return false;
- }
-
- /*
- * @see IUndoManager#redo
- */
- public void redo() {
- if (redoable()) {
- commit();
- internalRedo();
- }
- }
-
- /*
- * @see IUndoManager#undo
- */
- public void undo() {
- if (undoable()) {
- fFoldingIntoCompoundChange= false;
- commit();
- internalUndo();
- }
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentAdapter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentAdapter.java
deleted file mode 100644
index 32967f3..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentAdapter.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.Iterator;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TextChangeListener;
-import org.eclipse.swt.custom.TextChangedEvent;
-import org.eclipse.swt.custom.TextChangingEvent;
-
-
-/**
- * Adapts an <code>IDocument</code> to the <code>StyledTextContent</code> interface.
- */
-class DocumentAdapter implements IDocumentAdapter, IDocumentListener, IDocumentAdapterExtension {
-
- /** The adapted document. */
- private IDocument fDocument;
- /** The registered text change listeners */
- private List fTextChangeListeners= new ArrayList(1);
- /**
- * The remembered document event
- * @since 2.0
- */
- private DocumentEvent fEvent;
- /** The line delimiter */
- private String fLineDelimiter= null;
- /**
- * Indicates whether this adapter is forwarding document changes
- * @since 2.0
- */
- private boolean fIsForwarding= true;
- /**
- * Length of document at receipt of <code>documentAboutToBeChanged</code>
- * @since 2.1
- */
- private int fRememberedLengthOfDocument;
- /**
- * Length of first document line at receipt of <code>documentAboutToBeChanged</code>
- * @since 2.1
- */
- private int fRememberedLengthOfFirstLine;
- /**
- * The data of the event at receipt of <code>documentAboutToBeChanged</code>
- * @since 2.1
- */
- private DocumentEvent fOriginalEvent= new DocumentEvent();
-
-
- /**
- * Creates a new document adapter which is initiallly not connected to
- * any document.
- */
- public DocumentAdapter() {
- }
-
- /**
- * Sets the given document as the document to be adapted.
- *
- * @param document the document to be adapted or <code>null</code> if there is no document
- */
- public void setDocument(IDocument document) {
-
- if (fDocument != null)
- fDocument.removePrenotifiedDocumentListener(this);
-
- fDocument= document;
- fLineDelimiter= null;
-
- if (fDocument != null)
- fDocument.addPrenotifiedDocumentListener(this);
- }
-
- /*
- * @see StyledTextContent#addTextChangeListener(TextChangeListener)
- */
- public void addTextChangeListener(TextChangeListener listener) {
- Assert.isNotNull(listener);
- if (! fTextChangeListeners.contains(listener))
- fTextChangeListeners.add(listener);
- }
-
- /*
- * @see StyledTextContent#removeTextChangeListener(TextChangeListener)
- */
- public void removeTextChangeListener(TextChangeListener listener) {
- Assert.isNotNull(listener);
- fTextChangeListeners.remove(listener);
- }
-
- /*
- * @see StyledTextContent#getLine(int)
- */
- public String getLine(int line) {
- try {
- IRegion r= fDocument.getLineInformation(line);
- return fDocument.get(r.getOffset(), r.getLength());
- } catch (BadLocationException x) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return null;
- }
- }
-
- /*
- * @see StyledTextContent#getLineAtOffset(int)
- */
- public int getLineAtOffset(int offset) {
- try {
- return fDocument.getLineOfOffset(offset);
- } catch (BadLocationException x) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return -1;
- }
- }
-
- /*
- * @see StyledTextContent#getLineCount()
- */
- public int getLineCount() {
- return fDocument.getNumberOfLines();
- }
-
- /*
- * @see StyledTextContent#getOffsetAtLine(int)
- */
- public int getOffsetAtLine(int line) {
- try {
- return fDocument.getLineOffset(line);
- } catch (BadLocationException x) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return -1;
- }
- }
-
- /*
- * @see StyledTextContent#getTextRange(int, int)
- */
- public String getTextRange(int offset, int length) {
- try {
- return fDocument.get(offset, length);
- } catch (BadLocationException x) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return null;
- }
- }
-
- /*
- * @see StyledTextContent#replaceTextRange(int, int, String)
- */
- public void replaceTextRange(int pos, int length, String text) {
- try {
- fDocument.replace(pos, length, text);
- } catch (BadLocationException x) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- }
-
- /*
- * @see StyledTextContent#setText(String)
- */
- public void setText(String text) {
- fDocument.set(text);
- }
-
- /*
- * @see StyledTextContent#getCharCount()
- */
- public int getCharCount() {
- return fDocument.getLength();
- }
-
- /*
- * @see StyledTextContent#getLineDelimiter()
- */
- public String getLineDelimiter() {
-
- if (fLineDelimiter == null) {
-
- try {
- fLineDelimiter= fDocument.getLineDelimiter(0);
- } catch (BadLocationException x) {
- }
-
- if (fLineDelimiter == null) {
- /*
- * Follow up fix for: 1GF5UU0: ITPJUI:WIN2000 - "Organize Imports" in java editor inserts lines in wrong format
- * The line delimiter must always be a legal document line delimiter.
- */
- String sysLineDelimiter= System.getProperty("line.separator"); //$NON-NLS-1$
- String[] delimiters= fDocument.getLegalLineDelimiters();
- Assert.isTrue(delimiters.length > 0);
- for (int i= 0; i < delimiters.length; i++) {
- if (delimiters[i].equals(sysLineDelimiter)) {
- fLineDelimiter= sysLineDelimiter;
- break;
- }
- }
-
- if (fLineDelimiter == null) {
- // system line delimiter is not a legal document line delimiter
- fLineDelimiter= delimiters[0];
- }
- }
- }
-
- return fLineDelimiter;
- }
-
- /*
- * @see IDocumentListener#documentChanged(DocumentEvent)
- */
- public void documentChanged(DocumentEvent event) {
- // check whether the given event is the one which was remembered
- if (fEvent == null || event != fEvent)
- return;
-
- if (isPatchedEvent(event) || (event.getOffset() == 0 && event.getLength() == fRememberedLengthOfDocument)) {
- fLineDelimiter= null;
- fireTextSet();
- } else {
- if (event.getOffset() < fRememberedLengthOfFirstLine)
- fLineDelimiter= null;
- fireTextChanged();
- }
- }
-
- /*
- * @see IDocumentListener#documentAboutToBeChanged(DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
-
- fRememberedLengthOfDocument= fDocument.getLength();
- try {
- fRememberedLengthOfFirstLine= fDocument.getLineLength(0);
- } catch (BadLocationException e) {
- fRememberedLengthOfFirstLine= -1;
- }
-
- fEvent= event;
- rememberEventData(fEvent);
- fireTextChanging();
- }
-
- /**
- * Checks whether this event has been changed between <code>documentAboutToBeChanged</code> and
- * <code>documentChanged</code>.
- *
- * @param event the event to be checked
- * @return <code>true</code> if the event has been changed, <code>false</code> otherwise
- */
- private boolean isPatchedEvent(DocumentEvent event) {
- return fOriginalEvent.fOffset != event.fOffset || fOriginalEvent.fLength != event.fLength || fOriginalEvent.fText != event.fText;
- }
-
- /**
- * Makes a copy of the given event and remembers it.
- *
- * @param event the event to be copied
- */
- private void rememberEventData(DocumentEvent event) {
- fOriginalEvent.fOffset= event.fOffset;
- fOriginalEvent.fLength= event.fLength;
- fOriginalEvent.fText= event.fText;
- }
-
- /**
- * Sends a text changed event to all registered listeners.
- */
- private void fireTextChanged() {
-
- if (!fIsForwarding)
- return;
-
- TextChangedEvent event= new TextChangedEvent(this);
-
- if (fTextChangeListeners != null && fTextChangeListeners.size() > 0) {
- Iterator e= new ArrayList(fTextChangeListeners).iterator();
- while (e.hasNext())
- ((TextChangeListener) e.next()).textChanged(event);
- }
- }
-
- /**
- * Sends a text set event to all registered listeners.
- */
- private void fireTextSet() {
-
- if (!fIsForwarding)
- return;
-
- TextChangedEvent event = new TextChangedEvent(this);
-
- if (fTextChangeListeners != null && fTextChangeListeners.size() > 0) {
- Iterator e= new ArrayList(fTextChangeListeners).iterator();
- while (e.hasNext())
- ((TextChangeListener) e.next()).textSet(event);
- }
- }
-
- /**
- * Sends the text changing event to all registered listeners.
- */
- private void fireTextChanging() {
-
- if (!fIsForwarding)
- return;
-
- try {
- IDocument document= fEvent.getDocument();
- if (document == null)
- return;
-
- TextChangingEvent event= new TextChangingEvent(this);
- event.start= fEvent.fOffset;
- event.replaceCharCount= fEvent.fLength;
- event.replaceLineCount= document.getNumberOfLines(fEvent.fOffset, fEvent.fLength) - 1;
- event.newText= fEvent.fText;
- event.newCharCount= (fEvent.fText == null ? 0 : fEvent.fText.length());
- event.newLineCount= (fEvent.fText == null ? 0 : document.computeNumberOfLines(fEvent.fText));
-
- if (fTextChangeListeners != null && fTextChangeListeners.size() > 0) {
- Iterator e= new ArrayList(fTextChangeListeners).iterator();
- while (e.hasNext())
- ((TextChangeListener) e.next()).textChanging(event);
- }
-
- } catch (BadLocationException e) {
- }
- }
-
- /*
- * @see IDocumentAdapterExtension#resumeForwardingDocumentChanges()
- * @since 2.0
- */
- public void resumeForwardingDocumentChanges() {
- fIsForwarding= true;
- fireTextSet();
- }
-
- /*
- * @see IDocumentAdapterExtension#stopForwardingDocumentChanges()
- * @since 2.0
- */
- public void stopForwardingDocumentChanges() {
- fIsForwarding= false;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentCommand.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentCommand.java
deleted file mode 100644
index 5345cb9..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentCommand.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.NoSuchElementException;
-
-import org.eclipse.swt.events.VerifyEvent;
-
-
-/**
- * Represents a text modification as a document replace command. The text modification is given
- * as a <code>VerifyEvent</code> and translated into a document replace command relative
- * to a given offset. A document command can also be used to initialize a given <code>VerifyEvent</code>.<p>
- * A document command can also represent a list of related changes.
- */
-public class DocumentCommand {
-
- /**
- * A command which is added to document commands.
- * @since 2.1
- */
- private static class Command implements Comparable {
- /** The offset of the range to be replaced */
- private final int fOffset;
- /** The length of the range to be replaced. */
- private final int fLength;
- /** The replacement text */
- private final String fText;
- /** The listern who owns this command */
- private final IDocumentListener fOwner;
-
- /**
- * Creates a new command with the given specification.
- *
- * @param offset the offset of the replace command
- * @param length the length of the replace command
- * @param text the text to replace with, may be <code>null</code>
- * @param owner the document command owner, may be <code>null</code>
- */
- public Command(int offset, int length, String text, IDocumentListener owner) {
- if (offset < 0 || length < 0)
- throw new IllegalArgumentException();
- fOffset= offset;
- fLength= length;
- fText= text;
- fOwner= owner;
- }
-
- /**
- * Returns the length delta for this command.
- *
- * @return the length delta for this command
- */
- public int getDeltaLength() {
- return (fText == null ? 0 : fText.length()) - fLength;
- }
-
- /**
- * Executes the document command on the specified document.
- *
- * @param document the document on which to execute the command.
- * @throws BadLocationException in case this commands cannot be executed
- */
- public void execute(IDocument document) throws BadLocationException {
-
- if (fLength == 0 && fText == null)
- return;
-
- if (fOwner != null)
- document.removeDocumentListener(fOwner);
-
- document.replace(fOffset, fLength, fText);
-
- if (fOwner != null)
- document.addDocumentListener(fOwner);
- }
-
- /*
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compareTo(final Object object) {
- if (equals(object))
- return 0;
-
- final Command command= (Command) object;
-
- // diff middle points if not intersecting
- if (fOffset + fLength <= command.fOffset || command.fOffset + command.fLength <= fOffset) {
- int value= (2 * fOffset + fLength) - (2 * command.fOffset + command.fLength);
- if (value != 0)
- return value;
- }
- // the answer
- return 42;
- }
-
- /*
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object object) {
- if (object == this)
- return true;
- if (! (object instanceof Command))
- return false;
- final Command command= (Command) object;
- return command.fOffset == fOffset && command.fLength == fLength;
- }
- }
-
- /**
- * An iterator, which iterates in reverse over a list.
- */
- private static class ReverseListIterator implements Iterator {
-
- /** The list iterator. */
- private final ListIterator fListIterator;
-
- /**
- * Creates a reverse list iterator.
- */
- public ReverseListIterator(ListIterator listIterator) {
- if (listIterator == null)
- throw new IllegalArgumentException();
- fListIterator= listIterator;
- }
-
- /*
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return fListIterator.hasPrevious();
- }
-
- /*
- * @see java.util.Iterator#next()
- */
- public Object next() {
- return fListIterator.previous();
- }
-
- /*
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
- }
-
- /**
- * A command iterator.
- */
- private static class CommandIterator implements Iterator {
-
- /** The command iterator. */
- private final Iterator fIterator;
-
- /** The original command. */
- private Command fCommand;
-
- /** A flag indicating the direction of iteration. */
- private boolean fForward;
-
- /**
- * Creates a command iterator.
- *
- * @param commands an ascending ordered list of commands
- * @param command the original command
- * @param forward the direction
- */
- public CommandIterator(final List commands, final Command command, final boolean forward) {
- if (commands == null || command == null)
- throw new IllegalArgumentException();
- fIterator= forward ? commands.iterator() : new ReverseListIterator(commands.listIterator(commands.size()));
- fCommand= command;
- fForward= forward;
- }
-
- /*
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return fCommand != null || fIterator.hasNext();
- }
-
- /*
- * @see java.util.Iterator#next()
- */
- public Object next() {
-
- if (! hasNext())
- throw new NoSuchElementException();
-
- if (fCommand == null)
- return fIterator.next();
-
- if (!fIterator.hasNext()) {
- final Command tempCommand= fCommand;
- fCommand= null;
- return tempCommand;
- }
-
- final Command command= (Command) fIterator.next();
- final int compareValue= command.compareTo(fCommand);
-
- if ((compareValue < 0) ^ ! fForward) {
- return command;
-
- } else if ((compareValue > 0) ^ ! fForward) {
- final Command tempCommand= fCommand;
- fCommand= command;
- return tempCommand;
-
- } else {
- throw new IllegalArgumentException();
- }
- }
-
- /*
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
- }
-
- /** Must the command be updated */
- public boolean doit= false;
- /** The offset of the command. */
- public int offset;
- /** The length of the command */
- public int length;
- /** The text to be inserted */
- public String text;
- /**
- * The owner of the document command which will not be notified.
- * @since 2.1
- */
- public IDocumentListener owner;
- /**
- * The caret offset with respect to the document before the document command is executed.
- * @since 2.1
- */
- public int caretOffset;
- /** Additional document commands. */
- private final List fCommands= new ArrayList();
-
- /**
- * Creates a new document command.
- */
- protected DocumentCommand() {
- }
-
- /**
- * Translates a verify event into a document replace command using the given offset.
- *
- * @param event the event to be translated
- * @param modelRange the event range as model range
- */
- void setEvent(VerifyEvent event, IRegion modelRange) {
-
- doit= true;
- text= event.text;
-
- offset= modelRange.getOffset();
- length= modelRange.getLength();
-
- owner= null;
- caretOffset= -1;
- fCommands.clear();
- }
-
- /**
- * Fills the given verify event with the replace text and the doit
- * flag of this document command. Returns whether the document command
- * covers the same range as the verify event considering the given offset.
- *
- * @param event the event to be changed
- * @param modelRange to be considered for range comparison
- * @return <code>true</code> if this command and the event cover the same range
- */
- boolean fillEvent(VerifyEvent event, IRegion modelRange) {
- event.text= text;
- event.doit= (offset == modelRange.getOffset() && length == modelRange.getLength() && doit);
- return event.doit;
- }
-
- /**
- * Adds an additional replace command. The added replace command must not overlap
- * with existing ones. If the document command owner is not <code>null</code>, it will not
- * get document change notifications for the particular command.
- *
- * @param offset the offset of the region to replace
- * @param length the length of the region to replace
- * @param text the text to replace with, may be <code>null</code>
- * @param owner the command owner, may be <code>null</code>
- * @throws BadLocationException if the added command intersects with an existing one
- * @since 2.1
- */
- public void addCommand(int offset, int length, String text, IDocumentListener owner) throws BadLocationException {
- final Command command= new Command(offset, length, text, owner);
-
- if (intersects(command))
- throw new BadLocationException();
-
- final int index= Collections.binarySearch(fCommands, command);
-
- // a command with exactly the same ranges exists already
- if (index >= 0)
- throw new BadLocationException();
-
- // binary search result is defined as (-(insertionIndex) - 1)
- final int insertionIndex= -(index + 1);
-
- // overlaps to the right?
- if (insertionIndex != fCommands.size() && intersects((Command) fCommands.get(insertionIndex), command))
- throw new BadLocationException();
-
- // overlaps to the left?
- if (insertionIndex != 0 && intersects((Command) fCommands.get(insertionIndex - 1), command))
- throw new BadLocationException();
-
- fCommands.add(insertionIndex, command);
- }
-
- /**
- * Returns an iterator over the commands in ascending position order.
- * The iterator includes the original document command.
- * Commands cannot be removed.
- *
- * @return returns the command iterator
- */
- public Iterator getCommandIterator() {
- Command command= new Command(offset, length, text, owner);
- return new CommandIterator(fCommands, command, true);
- }
-
- /**
- * Returns the number of commands including the original document command.
- *
- * @return returns the number of commands
- * @since 2.1
- */
- public int getCommandCount() {
- return 1 + fCommands.size();
- }
-
- /**
- * Returns whether the two given commands intersect.
- *
- * @param command0 the first command
- * @param command1 the second command
- * @return <code>true</code> if the commands intersect
- * @since 2.1
- */
- private boolean intersects(Command command0, Command command1) {
- // diff middle points if not intersecting
- if (command0.fOffset + command0.fLength <= command1.fOffset || command1.fOffset + command1.fLength <= command0.fOffset)
- return (2 * command0.fOffset + command0.fLength) - (2 * command1.fOffset + command1.fLength) == 0;
- else
- return true;
- }
-
- /**
- * Returns whether the given command intersects with this command.
- *
- * @param command the command
- * @return <code>true</code> if the command intersects with this command
- * @since 2.1
- */
- private boolean intersects(Command command) {
- // diff middle points if not intersecting
- if (offset + length <= command.fOffset || command.fOffset + command.fLength <= offset)
- return (2 * offset + length) - (2 * command.fOffset + command.fLength) == 0;
- else
- return true;
- }
-
- /**
- * Executes the document commands on a document.
- *
- * @param document the document on which to execute the commands
- * @since 2.1
- */
- void execute(IDocument document) throws BadLocationException {
-
- if (length == 0 && text == null && fCommands.size() == 0)
- return;
-
- final Command originalCommand= new Command(offset, length, text, owner);
-
- for (final Iterator iterator= new CommandIterator(fCommands, originalCommand, false); iterator.hasNext(); ) {
- final Command command= (Command) iterator.next();
- command.execute(document);
- if (caretOffset != -1 && command.fOffset + command.fLength <= caretOffset)
- caretOffset += command.getDeltaLength();
- }
- }
-
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IAutoEditStrategy.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IAutoEditStrategy.java
deleted file mode 100644
index 05f4068..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IAutoEditStrategy.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;
-
-
-/**
- * An auto edit strategy can adapt changes that will be applied to
- * a text viewer's document. The strategy is informed by the text viewer
- * about each upcoming change in form of a document command. By manipulating
- * this document command, the strategy can influence in which way the text
- * viewer's document is changed. Clients may implement this interface.
- *
- * @since 2.1
- */
-public interface IAutoEditStrategy {
-
- /**
- * Allows the strategy to manipulate the document command.
- *
- * @param document the document that will be changed
- * @param command the document command describing the change
- */
- void customizeDocumentCommand(IDocument document, DocumentCommand command);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IAutoIndentStrategy.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IAutoIndentStrategy.java
deleted file mode 100644
index 53cf935..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IAutoIndentStrategy.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text;
-
-
-
-/**
- * Exists for backward compatibility.
- * Please use <code>IAutoEditStrategy</code> directly.
- */
-public interface IAutoIndentStrategy extends IAutoEditStrategy {
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IDocumentAdapter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IDocumentAdapter.java
deleted file mode 100644
index 2c91b6b..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IDocumentAdapter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text;
-
-
-
-import org.eclipse.swt.custom.StyledTextContent;
-
-
-/**
- * Adapts an <code>IDocument</code> to the <code>StyledTextContent</code> interface.
- * The document adapter is used by <code>TextViewer</code> to translate document changes
- * into styled text content changes and vice versa.
- * Clients may implement this interface and override <code>TextViewer.createDocumentAdapter</code>
- * if they want to intercept the communication between the viewer's text widget and
- * the viewer's document.
- *
- * @see IDocument
- * @see StyledTextContent
- */
-public interface IDocumentAdapter extends StyledTextContent {
-
- /**
- * Sets the adapters document.
- *
- * @param document the document to be adapted
- */
- void setDocument(IDocument document);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IDocumentAdapterExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IDocumentAdapterExtension.java
deleted file mode 100644
index 96906c3..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IDocumentAdapterExtension.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;
-
-/**
- * Extension interface for <code>IDocumentAdapter</code>. Introduces the concepts of
- * batching a series of document changes into one styled text content change. Batching start
- * when a client calls <code>stopForwardingDocumentChanges</code>. After that call this document
- * adapter does not send out any styled text content change until
- * <code>resumeForwardingDocumentChanges</code> is called. Then, it sends out one styled text
- * content change that covers all changes that have been applied to the document since calling
- * <code>stopForwardingDocumentChanges</code>.
- *
- * @since 2.0
- */
-public interface IDocumentAdapterExtension {
-
- /**
- * Stops forwarding document changes to the styled text.
- */
- void stopForwardingDocumentChanges();
-
- /**
- * Resumes forwarding document changes to the styled text.
- * Also forces the styled text to catch up with all the changes
- * that have been applied since <code>stopForwardingDocumentChanges</code>
- * has been called.
- */
- void resumeForwardingDocumentChanges();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IEventConsumer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IEventConsumer.java
deleted file mode 100644
index 4fed849..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IEventConsumer.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;
-
-
-
-import org.eclipse.swt.events.VerifyEvent;
-
-/**
- * Implementers can register with an text viewer and
- * receive <code>VerifyEvent</code>s before the text viewer
- * they are registered with. If the event consumer marks events
- * as processed by turning their <code>doit</code> field to
- * <code>false</code> the text viewer subsequently ignores them.
- * Clients may implement this interface.<p>
- *
- * <code>ITextViewerExtension2</code> allows clients to manage the
- * <code>VerifyListener</code>s of a <code>TextViewer</code>. This makes
- * <code>IEventConsumer</code> obsolete.
- *
- * @see ITextViewer
- * @see org.eclipse.swt.events.VerifyEvent
- */
-public interface IEventConsumer {
-
- /**
- * Processes the given event and marks it as done if it should
- * be ignored by subsequent receivers.
- *
- * @param event the verify event which will be investigated
- */
- public void processEvent(VerifyEvent event);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IFindReplaceTarget.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IFindReplaceTarget.java
deleted file mode 100644
index 94bf978..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IFindReplaceTarget.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.jface.text;
-
-
-
-import org.eclipse.swt.graphics.Point;
-
-
-/**
- * Defines the interface for finding and replacing strings.
- */
-public interface IFindReplaceTarget {
-
- /**
- * Returns whether a find operation can be performed.
- *
- * @return whether a find operation can be performed
- */
- boolean canPerformFind();
-
- /**
- * 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 searchForward <code>true</code> searches forward, <code>false</code> backwards
- * @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
- * @return the position of the specified string, or -1 if the string has not been found
- */
- int findAndSelect(int offset, String findString, boolean searchForward, boolean caseSensitive, boolean wholeWord);
-
- /**
- * Returns the currently selected range of characters as a offset and length.
- *
- * @return the currently selected character range
- */
- Point getSelection();
-
- /**
- * Returns the currently selected characters as a string.
- *
- * @return the currently selected characters
- */
- String getSelectionText();
-
- /**
- * Returns whether this target can be modified.
- *
- * @return <code>true</code> if target can be modified
- */
- boolean isEditable();
-
- /**
- * Replaces the currently selected range of characters with the given text.
- * This target must be editable. Otherwise nothing happens.
- *
- * @param text the substitution text
- */
- void replaceSelection(String text);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IFindReplaceTargetExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IFindReplaceTargetExtension.java
deleted file mode 100644
index 50b2476..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IFindReplaceTargetExtension.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-
-
-/**
- * Extension interface for <code>IFindReplaceTarget</code>. Extends the find replace target with
- * the concept of searching in a limiting scope and introduces a replace-all mode.
- *
- * @since 2.0
- */
-public interface IFindReplaceTargetExtension {
-
- /**
- * Indicates that a session with the target begins.
- * All calls except <code>beginSession()</code> and <code>endSession()</code> to
- * <code>IFindReplaceTarget</code> and
- * <code>IFindReplaceTargetExtension</code> must be embedded within calls to
- * <code>beginSession()</code> and <code>endSession()</code>.
- *
- * @see #endSession()
- */
- void beginSession();
-
- /**
- * Indicates that a session with the target ends.
- *
- * @see #beginSession()
- */
- void endSession();
-
- /**
- * Returns the find scope of the target, <code>null</code> for global scope.
- *
- * @return returns the find scope of the target, may be <code>null</code>
- */
- IRegion getScope();
-
- /**
- * Sets the find scope of the target to operate on. <code>null</code>
- * indicates that the global scope should be used.
- *
- * @param scope the find scope of the target, may be <code>null</code>
- */
- void setScope(IRegion scope);
-
- /**
- * Returns the currently selected range of lines as a offset and length.
- *
- * @return the currently selected line range
- */
- Point getLineSelection();
-
- /**
- * Sets a selection.
- *
- * @param offset the offset of the selection
- * @param length the length of the selection
- */
- void setSelection(int offset, int length);
-
- /**
- * Sets the scope highlight color
- *
- * @param color the color of the scope highlight
- */
- void setScopeHighlightColor(Color color);
-
-
- /**
- * Sets the target's replace-all mode.
- *
- * @param replaceAll <code>true</code> if this target should switch into replace-all mode,
- * <code>false</code> if it should leave the replace-all state
- */
- void setReplaceAllMode(boolean replaceAll);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.java
deleted file mode 100644
index d9cc1b1..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-
-
-/**
- * Interface of a control presenting information. The information is given
- * in textual form. It can be either the content itself or a description
- * of the content. This specification is left to the implementers of this interface.<p>
- * The information control may not grap focus when made visible using
- * <code>setVisible(true)</code>.
- *
- * @since 2.0
- */
-public interface IInformationControl {
-
- /**
- * Sets the information to be presented by this information control.
- *
- * @param information the information to be presented
- */
- void setInformation(String information);
-
- /**
- * Sets the information control's size constraints. A constraint value of
- * <code>-1</code> indicates no constraint. This method must be called before
- * <code>computeSizeHint</code> is called.
- *
- * @param maxWidth the maximal width of the control to present the information, or <code>-1</code> for not constraint
- * @param maxHeight the maximal height of the control to present the information, or <code>-1</code> for not constraint
- */
- void setSizeConstraints(int maxWidth, int maxHeight);
-
- /**
- * Computes and returns a proposal for the size of this information control depending
- * on the information to present. The method tries to honor known size constraints but might
- * returns a size that exceeds them.
- *
- * @return the computed size hint
- */
- Point computeSizeHint();
-
- /**
- * Controls the visibility of this information control.
- *
- * @param visible <code>true</code> if the control should be visible
- */
- void setVisible(boolean visible);
-
- /**
- * Sets the size of this information control.
- *
- * @param width the width of the control
- * @param height the height of the control
- */
- void setSize(int width, int height);
-
- /**
- * Sets the location of this information control.
- *
- * @param location the location
- */
- void setLocation(Point location);
-
- /**
- * Disposes this information control.
- */
- void dispose();
-
- /**
- * Adds the given listener to the list of dispose listeners.
- * If the listener is already registered it is not registered again.
- *
- * @param listener the listener to be added
- */
- void addDisposeListener(DisposeListener listener);
-
- /**
- * Removes the given listeners from the list of dispose listeners.
- * If the listener is not registered this call has no effect.
- *
- * @param listener the listener to be removed
- */
- void removeDisposeListener(DisposeListener listener);
-
- /**
- * Sets the foreground color of this information control.
- *
- * @param foreground the foreground color of this information control
- */
- void setForegroundColor(Color foreground);
-
- /**
- * Sets the background color of this information control.
- *
- * @param background the background color of this information control
- */
- void setBackgroundColor(Color background);
-
- /**
- * Returns whether this information control has the focus.
- *
- * @return <code>true</code> when the information control has the focus otherwise <code>false</code>
- */
- boolean isFocusControl();
-
- /**
- * Sets the keyboard focus to this information control.
- */
- void setFocus();
-
- /**
- * Adds the given listener to the list of focus listeners.
- * If the listener is already registered it is not registered again.
- *
- * @param listener the listener to be added
- */
- void addFocusListener(FocusListener listener);
-
- /**
- * Removes the given listeners from the list of focus listeners.
- * If the listener is not registered this call has no affect.
- *
- * @param listener the listener to be removed
- */
- void removeFocusListener(FocusListener listener);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlCreator.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlCreator.java
deleted file mode 100644
index 1af2737..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlCreator.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;
-
-
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Interface of a factory of information controls.
- *
- * @since 2.0
- */
-public interface IInformationControlCreator {
-
- /**
- * Creates a new information control with the given shell as the control's parent.
- *
- * @param parent the parent shell
- * @return the created information control
- */
- IInformationControl createInformationControl(Shell parent);
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension.java
deleted file mode 100644
index 0720fb4..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-/**
- * Extension interface for <code>IInformationControl</code>. As it is the responsibility of
- * the implementer of <code>IInformationControl</code> to specify whether the information
- * set is the information itself or a description of the information, only the information control
- * can decide whether there is something that must be displayed.
- *
- * @since 2.0
- */
-public interface IInformationControlExtension {
-
- /**
- * Returns whether this information control has contents to be displayed.
- * @return <code>true</code> if there is contents to be displayed.
- */
- boolean hasContents();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension2.java
deleted file mode 100644
index bc2b4b5..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension2.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text;
-
-
-/**
- * Extension interface for <code>IInformationControl</code>. Replaces the concept of
- * textual information to be displayed with the more general concept of an input of the
- * information control. Text to be displayed set with <code>setInformation(String)</code>
- * is ignored.
- *
- * @see org.eclipse.jface.text.IInformationControl
- * @since 2.1
- */
-public interface IInformationControlExtension2 {
-
- /**
- * Sets the input to be presented in this information control.
- *
- * @param input the object to be used as input for this control
- */
- void setInput(Object input);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IMarkRegionTarget.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IMarkRegionTarget.java
deleted file mode 100644
index 88e358b..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IMarkRegionTarget.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-/**
- * A mark region target to support marked regions as found in emacs.
- *
- * @since 2.0
- */
-public interface IMarkRegionTarget {
-
- /**
- * Sets or clears a mark at the current cursor position.
- *
- * @param set sets the mark if <code>true</code>, clears otherwise.
- */
- void setMarkAtCursor(boolean set);
-
- /**
- * Swaps the mark and cursor position if the mark is in the visible region.
- */
- void swapMarkAndCursor();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IMarkSelection.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IMarkSelection.java
deleted file mode 100644
index 3bc7aa1..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IMarkSelection.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-
-import org.eclipse.jface.viewers.ISelection;
-
-
-/**
- * A mark selection. Can be returned by text viewers implementing the
- * <code>IMarkRegionTarget</code> interface.
- *
- * @since 2.0
- */
-public interface IMarkSelection extends ISelection {
-
- /**
- * Returns the marked document.
- *
- * @return the marked document
- */
- IDocument getDocument();
-
- /**
- * Returns the mark position. The offset may be <code>-1</code> if there's no marked region.
- *
- * @return the mark position or <code>-1</code> if there is no marked region
- */
- int getOffset();
-
- /**
- * Returns the length of the mark selection. The length may be negative, if the caret
- * is before the mark position. The length has no meaning if <code>getOffset()</code>
- * returns <code>-1</code>.
- *
- * @return the length of the mark selection. Result is undefined for <code>getOffset == -1</code>
- */
- int getLength();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IPaintPositionManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IPaintPositionManager.java
deleted file mode 100644
index 00b1977..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IPaintPositionManager.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-
-import org.eclipse.jface.text.Position;
-
-/**
- * Manager that manages and updates positions used by <code>IPainter</code>s.
- *
- * @see org.eclipse.jface.text.IPainter
- * @since 2.1
- */
-public interface IPaintPositionManager {
-
- /**
- * Starts managing the given position until <code>unmanagePosition</code> is called.
- *
- * @param position the position to manage
- * @see #unmanagePosition(Position)
- */
- void managePosition(Position position);
-
- /**
- * Stops managing the given position. If the position is not managed
- * by this managed, this call has no effect.
- *
- * @param position the position that should no longer be managed
- */
- void unmanagePosition(Position position);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IPainter.java
deleted file mode 100644
index 26b5109..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IPainter.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-
-/**
- * A painter is responsible for creating, managing, updating, and removing visual decorations of an <code>ITextViewer</code>. Examples are
- * the highlighting of the cursor line, the print marging, or the highlighting of matching peer characters such as pairs of brackets. Clients
- * may implement this interface. Painters should be registered with a <code>PaintManager</code>. The paint manager tracks several classes
- * of events issued by an <code>ITextViewer</code> and reacts by appropriately invoking the registered painters.<p>
- * Painters can be activated or deactivated. Usually, painters are initially deactivated and are activated by the first call to their <code>paint</code>
- * method. Painters can be deactivated by calling <code>deactivate</code>. Deactivated painter can be reactivated by calling <code>paint</code>
- * again.<p>
- * Painters usually have to manage state information. E.g., a painter painting a cursor line highlight must redraw the previous and the actual cursor
- * line in the advent of a change of the cursor position. This state information must usually be adapted to changes of the viewer's content. In order
- * to support this common scenario, the <code>PaintManager</code> gives a painter access to a <code>IPaintPositionUpdater</code>. The painter
- * can use this updater to manage its state information.<p>
- *
- * @see org.eclipse.jface.text.PaintManager
- * @since 2.1
- */
-public interface IPainter {
-
- /**
- * Constant describing the reason of a repaint request: selection changed.
- */
- int SELECTION= 0;
- /**
- * Constant describing the reason of a repaint request: text changed.
- */
- int TEXT_CHANGE= 1;
- /**
- * Constant describing the reason of a repaint request: key pressed.
- */
- int KEY_STROKE= 2;
- /**
- * Constant describing the reason of a repaint request: mouse button pressed.
- */
- int MOUSE_BUTTON= 4;
- /**
- * Constant describing the reason of a repaint request: paint manager internal change.
- */
- int INTERNAL= 8;
- /**
- * Constant describing the reason of a repaint request: paint manager or painter configuration changed.
- */
- int CONFIGURATION= 16;
-
-
- /**
- * Disposes this painter. Prior to disposing, a painter should be deactivated. A disposed
- * painter can not be reactivated.
- *
- * @see #deactivate(boolean)
- */
- void dispose();
-
- /**
- * Requests this painter to repaint because of the given reason. Based on the given reason
- * the painter can decide whether it will repaint or not. If it repaints and is not yet activated,
- * it wil activate itself.
- *
- * @param reason the repaint reason, value is one of the constants defined in this interface
- */
- void paint(int reason);
-
- /**
- * Deactivates this painter. If the painter has not been activated before, this call does not
- * have any effect. <code>redraw</code> indicates whether the painter should remove
- * any decoration it previously applied. A deactivated painter can be reactivated by calling
- * <code>paint</code>.
- *
- * @param redraw <code>true</code> if any previously applied decoration should be removed
- * @see #paint(int)
- */
- void deactivate(boolean redraw);
-
- /**
- * Sets the paint position manager that can be used by this painter or removes any previously
- * set paint position manager.
- *
- * @param manager the paint position manager or <code>null</code>
- */
- void setPositionManager(IPaintPositionManager manager);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IRewriteTarget.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IRewriteTarget.java
deleted file mode 100644
index 317721e..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IRewriteTarget.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
- /**
- * A target publishing the required functions to modify a document that is displayed
- * in the ui, such as in a text viewer. It provides access to the document and control
- * over the redraw behavior and the batching of document changes into undo commands.
- *
- * @see org.eclipse.jface.text.ITextViewer
- * @see org.eclipse.jface.text.IDocument
- * @see org.eclipse.jface.text.IUndoManager
- * @since 2.0
- */
-public interface IRewriteTarget {
-
- /**
- * Returns the document of this target.
- *
- * @return the document of this target
- */
- IDocument getDocument();
-
- /**
- * Disables/enables redrawing of the ui while modifying the target's document.
- *
- * @param redraw <code>true</code> if the document's ui presentation should
- * be updated, <code>false</code> otherwise
- */
- void setRedraw(boolean redraw);
-
- /**
- * If an undo manager is connected to the document's ui presentation, this
- * method tells the undo manager to fold all subsequent changes into
- * one single undo command until <code>endCompoundChange</code> is called.
- */
- void beginCompoundChange();
-
- /**
- * If an undo manager is connected to the document's ui presentation, this method
- * tells the undo manager to stop the folding of changes into a single undo command.
- * After this call, all subsequent changes are considered to be individually undoable.
- */
- void endCompoundChange();
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextDoubleClickStrategy.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextDoubleClickStrategy.java
deleted file mode 100644
index b9ee145..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextDoubleClickStrategy.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;
-
-
-
-/**
- * A text double click strategy defines the reaction of a text viewer
- * to mouse double click events. For that the strategy must be installed
- * on the text viewer.<p>
- * Clients may implements this interface or use the standard implementation
- * <code>DefaultTextDoubleClickStrategy</code>.
- *
- * @see org.eclipse.jface.text.ITextViewer
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(MouseEvent)
- */
-public interface ITextDoubleClickStrategy {
-
- /**
- * The mouse has been double clicked on the given text viewer.
- *
- * @param viewer the viewer into which has been double clicked
- */
- void doubleClicked(ITextViewer viewer);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHover.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHover.java
deleted file mode 100644
index dce5cd7..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHover.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text;
-
-
-
-/**
- * Provides a hover popup which appears on top of the text viewer with
- * relevant display information. If the text hover does not provide information
- * no hover popup is shown. Any implementer of this interface must be capable of
- * operating in a non-UI thread.<p>
- * Clients may implement this interface.
- *
- * @see org.eclipse.jface.text.ITextViewer
- */
-public interface ITextHover {
-
- /**
- * Returns the text which should be presented if a hover popup is shown
- * for the specified hover region. The hover region has the same semantics
- * as the region returned by <code>getHoverRegion</code>. If the returned
- * string is <code>null</code> or empty no hover popup will be shown.
- *
- * @param textViewer the viewer on which the hover popup should be shown
- * @param hoverRegion the text range in the viewer which is used to determine
- * the hover display information
- * @return the hover popup display information
- */
- String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion);
-
- /**
- * Returns the text region which should serve as the source of information
- * to compute the hover popup display information. The popup has been requested
- * for the given offset.<p>
- * For example, if hover information can be provided on a per method basis in a
- * source viewer, the offset should be used to find the enclosing method and the
- * source range of the method should be returned.
- *
- * @param textViewer the viewer on which the hover popup should be shown
- * @param offset the offset for which the hover request has been issued
- * @return the hover region used to compute the hover display information
- */
- IRegion getHoverRegion(ITextViewer textViewer, int offset);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextInputListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextInputListener.java
deleted file mode 100644
index 2e7b505..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextInputListener.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text;
-
-
-
-/**
- * Text input listeners registered with an text viewer are informed
- * if the document serving as the text viewer's model is replaced.
- * Clients may implement this interface.
- *
- * @see org.eclipse.jface.text.ITextViewer
- * @see org.eclipse.jface.text.IDocument
- */
-public interface ITextInputListener {
-
- /**
- * Called before the input document is replaced.
- *
- * @param oldInput the text viewer's previous input document
- * @param newInput the text viewer's new input document
- */
- void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput);
-
- /**
- * Called after the input document has been replaced.
- *
- * @param oldInput the text viewer's previous input document
- * @param newInput the text viewer's new input document
- */
- void inputDocumentChanged(IDocument oldInput, IDocument newInput);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextListener.java
deleted file mode 100644
index 0df04f7..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextListener.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;
-
-
-
-/**
- * Text listeners registered with an text viewer are informed about
- * all text viewer modifications by means of text events. A text event
- * describes a change as a replace operation.<p>
- * The changes described in the event are the changes applied to the text viewer's
- * widget (i.e. its visual representation) and not those applied to the text viewer's
- * document. The text event can be asked to return the according document
- * event. If a text listener receives a text event, it is guaranteed that
- * both the document and the viewer's visual representation are in sync.<p>
- * Clients may implement this interface.
- *
- * @see org.eclipse.jface.text.ITextViewer
- * @see org.eclipse.jface.text.TextEvent
- * @see org.eclipse.jface.text.DocumentEvent
- */
-public interface ITextListener {
-
- /**
- * The visual representation of a text viewer this listener is registered with
- * has been changed.
- *
- * @param event the description of the change
- */
- void textChanged(TextEvent event);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextOperationTarget.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextOperationTarget.java
deleted file mode 100644
index 1608ff5..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextOperationTarget.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.jface.text;
-
-
-
-/**
- * Defines the target for a text operation.
- */
-public interface ITextOperationTarget {
-
-
- /**
- * Text operation code for undoing the last edit command.
- */
- static final int UNDO= 1;
-
- /**
- * Text operation code for redoing the last undone edit command.
- */
- static final int REDO= 2;
-
- /**
- * Text operation code for moving the selected text to the clipboard.
- */
- static final int CUT= 3;
-
- /**
- * Text operation code for copying the selected text to the clipboard.
- */
- static final int COPY= 4;
-
- /**
- * Text operation code for inserting the clipboard content at the
- * current position.
- */
- static final int PASTE= 5;
-
- /**
- * Text operation code for deleting the selected text or if selection
- * is empty the character at the right of the current position.
- */
- static final int DELETE= 6;
-
- /**
- * Text operation code for selecting the complete text.
- */
- static final int SELECT_ALL= 7;
-
- /**
- * Text operation code for shifting the selected text block to the right.
- */
- static final int SHIFT_RIGHT= 8;
-
- /**
- * Text operation code for unshifting the selected text block to the left.
- */
- static final int SHIFT_LEFT= 9;
-
- /**
- * Text operation code for printing the complete text.
- */
- static final int PRINT= 10;
-
- /**
- * Text operation code for prefixing the selected text block.
- */
- static final int PREFIX= 11;
-
- /**
- * Text operation code for removing the prefix from the selected text block.
- */
- static final int STRIP_PREFIX= 12;
-
-
- /**
- * Returns whether the operation specified by the given operation code
- * can be performed.
- *
- * @param operation the operation code
- * @return <code>true</code> if the specified operation can be performed
- */
- boolean canDoOperation(int operation);
-
- /**
- * Performs the operation specified by the operation code on the target.
- * <code>doOperation</code> must only be called if <code>canDoOperation</code>
- * returns <code>true</code>.
- *
- * @param operation the operation code
- */
- void doOperation(int operation);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextOperationTargetExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextOperationTargetExtension.java
deleted file mode 100644
index 4e0be75..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextOperationTargetExtension.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-
-/**
- * Extension interface to <code>ITextOperationTarget</code>. Allows a client to control
- * the enable state of operations provided by this target.
- *
- * @see org.eclipse.jface.text.ITextOperationTarget
- * @since 2.0
- */
-public interface ITextOperationTargetExtension {
-
- /**
- * Enables/disabled the given text operation.
- *
- * @param operation the operation to enable/disable
- * @param enable <code>true</code> to enable the operation otherwise <code>false</code>
- */
- void enableOperation(int operation, boolean enable);
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextSelection.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextSelection.java
deleted file mode 100644
index 2ddcc07..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextSelection.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.jface.text;
-
-
-
-import org.eclipse.jface.viewers.ISelection;
-
-
-/**
- * This interface represents a textual selection. A text selection is
- * a range of characters. Although a text selection is a snapshot taken
- * at a particular point in time, it must not copy the line information
- * and the selected text from the selection provider.<p>
- * If, for example, the selection provider is a source viewer, and a text
- * selection is created for the range [5, 10], the line formation for
- * the 5th character must not be determined and remembered at the point
- * of creation. It can rather be determined at the point, when
- * <code>getStartLine</code> is called. If the source viewer range [0, 15]
- * has been changed in the meantime between the creation of the text
- * selection object and the invocation of <code>getStartLine</code>, the returned
- * line number may differ from the line number of the 5th character at the
- * point of creation of the text selection object.<p> The contract of this
- * interface is that weak in order to allow for efficient implementations.<p>
- * Clients may implement this interface or use the default implementation provided
- * by <code>TextSelection</code>.
- *
- * @see org.eclipse.jface.text.TextSelection
- */
-public interface ITextSelection extends ISelection {
-
- /**
- * Returns the offset of the selected text.
- *
- * @return the offset of the selected text
- */
- int getOffset();
-
- /**
- * Returns the length of the selected text.
- *
- * @return the length of the selected text
- */
- int getLength();
-
- /**
- * Returns number of the line containing the offset of the selected text.
- * If the underlying text has been changed between the creation of this
- * selection object and the call of this method, the value returned might
- * differ from what it would have been at the point of creation.
- *
- * @return the start line of this selection or -1 if there is no valid line information
- */
- int getStartLine();
-
- /**
- * Returns the number of the line containing the last character of the selected text.
- * If the underlying text has been changed between the creation of this
- * selection object and the call of this method, the value returned might
- * differ from what it would have been at the point of creation.
- *
- * @return the end line of this selection or -1 if there is no valid line information
- */
- int getEndLine();
-
- /**
- * Returns the selected text.
- * If the underlying text has been changed between the creation of this
- * selection object and the call of this method, the value returned might
- * differ from what it would have been at the point of creation.
- *
- * @return the selected text or <code>null</code> if there is no valid text information
- */
- String getText();
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewer.java
deleted file mode 100644
index 312779b..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewer.java
+++ /dev/null
@@ -1,432 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-
-/**
- * A text viewer turns a text widget into a document-based text widget.
- * It supports the following kinds of listeners:
- * <ul>
- * <li> viewport listeners to inform about changes of the viewer's viewport
- * <li> text listeners to inform about changes of the document and the subsequent viewer change
- * <li> text input listeners to inform about changes of the viewer's input document.
- * </ul>
- * A text viewer supports a set of plug-ins which define its behavior:
- * <ul>
- * <li> undo manager
- * <li> double click behavior
- * <li> auto indentation
- * <li> text hover
- * </ul>
- * Installed plug-ins are not automatically activated. Plug-ins must be activated with the
- * <code>activatePlugins</code> call. Most plug-ins can be defined per content type.
- * Content types are derived from the partitioning of the text viewer's input document.<p>
- * A text viewer also provides the concept of event consumption. Events handled by the
- * viewer can be filtered and processed by a dynamic event consumer.<p>
- * A text viewer provides several text editing functions, some of them are configurable,
- * through a text operation target interface. It also supports a presentation mode
- * in which it only shows specified sections of its document. The viewer's presentation mode
- * does not affect any client of the viewer other than text listeners.<p>
- * Clients may implement this interface or use the standard implementation
- * <code>TextViewer</code>.
- *
- * @see IDocument
- * @see ITextInputListener
- * @see IViewportListener
- * @see ITextListener
- * @see IEventConsumer
- */
-public interface ITextViewer {
-
-
- /* ---------- widget --------- */
-
- /**
- * Returns this viewer's SWT control, <code>null</code> if the control is disposed.
- *
- * @return the SWT control
- */
- StyledText getTextWidget();
-
-
- /* --------- plugins --------- */
-
- /**
- * Sets this viewer's undo manager.
- *
- * @param undoManager the new undo manager. <code>null</code> is a valid argument.
- */
- void setUndoManager(IUndoManager undoManager);
-
- /**
- * Sets this viewer's text double click strategy for the given content type.
- *
- * @param strategy the new double click strategy. <code>null</code> is a valid argument.
- * @param contentType the type for which the strategy is registered
- */
- void setTextDoubleClickStrategy(ITextDoubleClickStrategy strategy, String contentType);
-
- /**
- * Sets this viewer's auto indent strategy for the given content type.
- *
- * @param strategy the new auto indent strategy. <code>null</code> is a valid argument.
- * @param contentType the type for which the strategy is registered
- */
- void setAutoIndentStrategy(IAutoIndentStrategy strategy, String contentType);
-
- /**
- * Sets this viewer's text hover for the given content type.
- *
- * @param textViewerHover the new hover. <code>null</code> is a valid argument.
- * @param contentType the type for which the hover is registered
- */
- void setTextHover(ITextHover textViewerHover, String contentType);
-
- /**
- * Activates the installed plug-ins. If the plug-ins are already activated
- * this call has no effect.
- */
- void activatePlugins();
-
- /**
- * Resets the installed plug-ins. If plug-ins change their state or
- * behavior over the course of time, this method causes them to be set
- * back to their initial state and behavior. E.g., if an <code>IUndoManager</code>
- * has been installed on this text viewer, the manager's list of remembered
- * text editing operations is removed.
- */
- void resetPlugins();
-
-
-
- /* ---------- listeners ------------- */
-
- /**
- * Adds the given viewport listener to this viewer. The listener
- * is informed about all changes to the visible area of this viewer.
- * If the listener is already registered with this viewer, this call
- * has no effect.
- *
- * @param listener the listener to be added
- */
- void addViewportListener(IViewportListener listener);
-
- /**
- * Removes the given listener from this viewer's set of viewport listeners.
- * If the listener is not registered with this viewer, this call has
- * no effect.
- *
- * @param listener the listener to be removed
- */
- void removeViewportListener(IViewportListener listener);
-
- /**
- * Adds a text listener to this viewer. If the listener is already registered
- * with this viewer, this call has no effect.
- *
- * @param listener the listener to be added
- */
- void addTextListener(ITextListener listener);
-
- /**
- * Removes the given listener from this viewer's set of text listeners.
- * If the listener is not registered with this viewer, this call has
- * no effect.
- *
- * @param listener the listener to be removed
- */
- void removeTextListener(ITextListener listener);
-
- /**
- * Adds a text input listener to this viewer. If the listener is already registered
- * with this viewer, this call has no effect.
- *
- * @param listener the listener to be added
- */
- void addTextInputListener(ITextInputListener listener);
-
- /**
- * Removes the given listener from this viewer's set of text input listeners.
- * If the listener is not registered with this viewer, this call has
- * no effect.
- *
- * @param listener the listener to be removed
- */
- void removeTextInputListener(ITextInputListener listener);
-
-
-
- /* -------------- model manipulation ------------- */
-
- /**
- * Sets the given document as the text viewer's model and updates the
- * presentation accordingly. An approriate <code>TextEvent</code> is
- * issued. This text event does not carry a related document event.
- *
- * @param document the viewer's new input document
- */
- void setDocument(IDocument document);
-
- /**
- * Returns the text viewer's input document.
- *
- * @return the viewer's input document
- */
- IDocument getDocument();
-
-
- /* -------------- event handling ----------------- */
-
- /**
- * Registers an event consumer with this viewer.
- *
- * @param consumer the viewer's event consumer. <code>null</code> is a valid argument.
- */
- void setEventConsumer(IEventConsumer consumer);
-
- /**
- * Sets the editable mode.
- *
- * @param editable the editable mode
- */
- void setEditable(boolean editable);
-
- /**
- * Returns whether the shown text can be manipulated.
- *
- * @return the viewer's editable mode
- */
- boolean isEditable();
-
-
- /* ----------- visible region support ------------- */
-
- /**
- * Sets the given document as this viewer's model and
- * makes the specified region visible in the presentation. An approriate
- * <code>TextEvent</code> is issued. The text event does not carry a
- * related document event. This method is a convenience method for
- * <code>setDocument(document);setVisibleRegion(offset, length)</code>.
- *
- * @param document the new input document
- * @param visibleRegionOffset the offset of the visible region
- * @param visibleRegionLength the length of the visible region
- */
- void setDocument(IDocument document, int visibleRegionOffset, int visibleRegionLength);
-
- /**
- * Sets the region of this viewer's document which will be visible in the presentation.
- *
- * @param offset the offset of the visible region
- * @param length the length of the visible region
- */
- void setVisibleRegion(int offset, int length);
-
- /**
- * Resets the region of this viewer's document which is visible in the presentation.
- * Afterwards, the whole document is presented again.
- */
- void resetVisibleRegion();
-
- /**
- * Returns the current visible region of this viewer's document.
- * The result may differ from the argument passed to <code>setVisibleRegion</code>
- * if the document has been modified since then.
- *
- * @return this viewer's current visible region
- */
- IRegion getVisibleRegion();
-
- /**
- * Returns whether a given range overlaps with the visible region of this viewer's document.
- *
- * @return <code>true</code> if the specified range overlaps with the visible region
- */
- boolean overlapsWithVisibleRegion(int offset, int length);
-
-
-
- /* ------------- presentation manipulation ----------- */
-
- /**
- * Applies the color information encoded in the given text presentation.
- * <code>controlRedraw</code> tells this viewer whether it should take care of
- * redraw management or not. If, e.g., this call is one in a sequence of multiple
- * coloring calls, it is more appropriate to explicitly control redrawing at the
- * beginning and the end of the sequence.
- *
- * @param presentation the presentation to be applied to this viewer
- * @param controlRedraw indicates whether this viewer should manage redraws
- */
- void changeTextPresentation(TextPresentation presentation, boolean controlRedraw);
-
- /**
- * Marks the currently applied text presentation as invalid. It is the viewer's
- * responsibility to take any action it can to repair the text presentation.
- *
- * @since 2.0
- */
- void invalidateTextPresentation();
-
- /**
- * Applies the given color to this viewer's selection.
- *
- * @param color the color to be applied
- */
- void setTextColor(Color color);
-
- /**
- * Applies the given color to the specified section of this viewer.
- * <code>controlRedraw</code> tells this viewer whether it should take care of
- * redraw management or not.
- *
- * @param color the color to be applied
- * @param offset the offset of the range to be colored
- * @param length the length of the range to be colored
- * @param controlRedraw indicates whether this viewer should manage redraws
- */
- void setTextColor(Color color, int offset, int length, boolean controlRedraw);
-
-
- /* --------- target handling and configuration ------------ */
-
- /**
- * Returns the text operation target of this viewer.
- *
- * @return the text operation target of this viewer
- */
- ITextOperationTarget getTextOperationTarget();
-
- /**
- * Returns the find/replace operation target of this viewer.
- *
- * @return the find/replace operation target of this viewer
- */
- IFindReplaceTarget getFindReplaceTarget();
-
- /**
- * Sets the string that is used as prefix when lines of the given
- * content type are prefixed by the prefix text operation.
- * Sets the strings that are used as prefixes when lines of the given content type
- * are prefixed using the prefix text operation. The prefixes are considered equivalent.
- * Inserting a prefix always inserts the defaultPrefixes[0].
- * Removing a prefix removes all of the specified prefixes.
- *
- * @param defaultPrefixes the prefixes to be used
- * @param contentType the content type for which the prefixes are specified
- * @since 2.0
- */
- void setDefaultPrefixes(String[] defaultPrefixes, String contentType);
-
- /**
- * Sets the strings that are used as prefixes when lines of the given content type
- * are shifted using the shift text operation. The prefixes are considered equivalent.
- * Thus "\t" and " " can both be used as prefix characters.
- * Shift right always inserts the indentPrefixes[0].
- * Shift left removes all of the specified prefixes.
- *
- * @param indentPrefixes the prefixes to be used
- * @param contentType the content type for which the prefixes are specified
- */
- void setIndentPrefixes(String[] indentPrefixes, String contentType);
-
-
-
- /* --------- selection handling -------------- */
-
- /**
- * Sets the selection to the specified range.
- *
- * @param offset the offset of the selection range
- * @param length the length of the selection range
- */
- void setSelectedRange(int offset, int length);
-
- /**
- * Returns the range of the current selection in coordinates of this viewer's document.
- *
- * @return the current selection
- */
- Point getSelectedRange();
-
- /**
- * Returns a selection provider dedicated to this viewer. Subsequent
- * calls to this method return always the same selection provider.
- *
- * @return this viewer's selection provider
- */
- ISelectionProvider getSelectionProvider();
-
-
- /* ------------- appearance manipulation --------------- */
-
- /**
- * Ensures that the given range is visible.
- *
- * @param offset the offset of the range to be revealed
- * @param length the length of the range to be revealed
- */
- void revealRange(int offset, int length);
-
- /**
- * Scrolls the widget so the the given index is the line
- * with the smallest line number of all visible lines.
- *
- * @param index the line which should become the top most line
- */
- void setTopIndex(int index);
-
- /**
- * Returns the visible line with the smallest line number.
- *
- * @return the number of the top most visible line
- */
- int getTopIndex();
-
- /**
- * Returns the document offset of the upper left corner of this viewer's viewport.
- *
- * @return the upper left corner offset
- */
- int getTopIndexStartOffset();
-
- /**
- * Returns the visible line with the highest line number.
- *
- * @return the number of the bottom most line
- */
- int getBottomIndex();
-
- /**
- * Returns the document offset of the lower right
- * corner of this viewer's viewport. This is the visible character
- * with the highest character position. If the content of this viewer
- * is shorter, the position of the last character of the content is returned.
- *
- * @return the lower right corner offset
- */
- int getBottomIndexEndOffset();
-
- /**
- * Returns the vertical offset of the first visible line.
- *
- * @return the vertical offset of the first visible line
- */
- int getTopInset();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension.java
deleted file mode 100644
index 9a5b745..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-
-import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * Extension interface for <code>ITextViewer</code>. Extends <code>ITextViewer</code> with
- * <ul>
- * <li> a replacement of the event consumer mechanism (methods dealing with <code>VerifyKeyListener</code>)
- * <li> access to the control of this viewer
- * <li> marked region support a la emacs
- * <li> control of the viewer's redraw behavior (@see #setRedraw)
- * <li> access to the viewer's rewrite target
- * </ul>
- *
- * @since 2.0
- */
-public interface ITextViewerExtension {
-
- /**
- * Inserts the verify key listener at the beginning of the viewer's
- * list of verify key listeners. If the listener is already registered
- * with the viewer this call moves the listener to the beginnng of
- * the list.
- *
- * @param listener the listener to be inserted
- */
- void prependVerifyKeyListener(VerifyKeyListener listener);
-
- /**
- * Appends a verify key listener to the viewer's list of verify
- * key listeners. If the listener is already registered with the viewer
- * this call moves the listener to the end of the list.
- *
- * @param listener the listener to be added
- */
- void appendVerifyKeyListener(VerifyKeyListener listener);
-
- /**
- * Removes the verify key listener from the viewer's list of verify key listeners.
- * If the listener is not registered with this viewer, this call has no effect.
- *
- * @param listener the listener to be removed
- */
- void removeVerifyKeyListener(VerifyKeyListener listener);
-
- /**
- * Returns the control of this viewer.
- *
- * @return the control of this viewer
- */
- Control getControl();
-
- /**
- * Sets or clears the mark. If offset is <code>-1</code>, the mark is cleared.
- * If a mark is set and the selection is empty, cut and copy actions performed on this
- * text viewer peform on the region limited by the positions of the mark and the cursor.
- *
- * @param offset the offset of the mark
- */
- void setMark(int offset);
-
- /**
- * Returns the mark position, <code>-1</code> if mark is not set.
- *
- * @return the mark position or <code>-1</code> if no mark is set
- */
- int getMark();
-
- /**
- * Enables/disables the redrawing of this text viewer. This temporarily disconnects
- * the viewer from its underlying StyledText widget. While being disconnected only
- * the viewer's selection may be changed using <code>setSelectedRange</code>.
- * Any direct manipulation of the widget as well as calls to methods that change the viewer's
- * presentation state (such as enabling the segmented view) are not allowed.
- * When redrawing is disabled the viewer does not send out any selection or
- * view port change notification. When redrawing is enabled again, a selection
- * change notification is sent out for the selected range and this range is revealed.
- *
- * @param redraw <code>true</code> to enable redrawing, <code>false</code> otherwise
- */
- void setRedraw(boolean redraw);
-
- /**
- * Returns the viewer's rewrite target.
- *
- * @return the viewer's rewrite target
- */
- IRewriteTarget getRewriteTarget();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension2.java
deleted file mode 100644
index 80187c3..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension2.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-import org.eclipse.swt.graphics.Point;
-
-/**
- * Extension interface for <code>ITextViewer</code>. Extends <code>ITextViewer</code> with
- * <ul>
- * <li> a replacement of the <code>ITextViewer.invalidateTextPresentation</code> method
- * <li> a replacement of the <code>ITextViewer.setTextHover</code> method now accepting state masks
- * </ul>
- *
- * @since 2.1
- */
-public interface ITextViewerExtension2 {
-
- /**
- * The state mask of the default hover (value <code>0xff</code>).
- */
- final int DEFAULT_HOVER_STATE_MASK= 0xff;
-
- /**
- * Invalidates the viewer's text presentation for the given range.
- *
- * @param offset the offset of the first character to be redrawn
- * @param length the length of the range to be redrawn
- */
- void invalidateTextPresentation(int offset, int length);
-
- /**
- * Sets this viewer's text hover for the given content type and the given state mask. If the given text hower
- * is <code>null</code>, any hover installed for the given content type and state mask is uninstalled.
- *
- * @param textViewerHover the new hover or <code>null</code>
- * @param contentType the type for which the hover is to be registered or unregistered
- * @param stateMask the SWT event state mask; <code>DEFAULT_HOVER_STATE_MASK</code> indicates that
- * the hover is installed as the default hover.
- */
- void setTextHover(ITextHover textViewerHover, String contentType, int stateMask);
-
- /**
- * Removes all text hovers for the given content type.
- * <p>
- * Note: To remove a hover for a given content type and state mask
- * use {@link #setTextHover(ITextHover, String, int)} with <code>null</code>
- * as parameter for the text hover.
- * </p>
- * @param contentType the type for which all text hovers are to be unregistered
- */
- void removeTextHovers(String contentType);
-
- /**
- * Returns the currently displayed text hover if any, <code>null</code> otherwise.
- */
- ITextHover getCurrentTextHover();
-
- /**
- * Returns the location at which the most recent mouse hover event
- * has been issued.
- *
- * @return the location of the most recent mouse hover event
- */
- Point getHoverEventLocation();
-
- /**
- * Prepends the given auto edit strategy to the existing list of strategies for the
- * specified content type. The strategies are called in the order in which they appear in the
- * list of strategies.
- *
- * @param strategy the auto edit strategy
- * @param contentType the content type
- */
- void prependAutoEditStrategy(IAutoEditStrategy strategy, String contentType);
-
- /**
- * Removes the first occurrence of the given auto edit strategy in the list of strategies
- * registered under the specified content type.
- *
- * @param strategy the auto edit strategy
- * @param contentType the content type
- */
- void removeAutoEditStrategy(IAutoEditStrategy strategy, String contentType);
-
- /**
- * Adds the given painter to this viewer.
- *
- * @param painter the painter to be added
- */
- void addPainter(IPainter painter);
-
- /**
- * Removes the given painter from this viewer. If the painter has not been
- * added to this viewer, this call is without effect.
- *
- * @param painter the painter to be removed
- */
- void removePainter(IPainter painter);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension3.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension3.java
deleted file mode 100644
index 7b5f691..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension3.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;
-
-
-/**
- * Extension interface for <code>ITextViewer</code>. Extends <code>ITextViewer</code> with the explicit
- * concept of model and widget coordinates. For example, a selection returned by the text viewer's control is
- * a widget selection. A widget selection always maps to a certain range of the viewer's document. This
- * range is considered the model selection.<p>
- * This general concepts replaces the notion of <code>visible region</code>.
- *
- * @since 2.1
- */
-public interface ITextViewerExtension3 {
-
-
- /**
- * Returns the minimal region of the viewer's document that completely comprises everything that is
- * visible in the viewer's widget.
- *
- * @return the minimal region of the viewer's document comprising the contents of the viewer's widget
- */
- public IRegion getModelCoverage();
-
-
- /**
- * Returns the widget line that corresponds to the given line of the viewer's document or <code>-1</code> if there is no such line.
- *
- * @param modelLine the line of the viewer's document
- * @return the corresponding widget line or <code>-1</code>
- */
- public int modelLine2WidgetLine(int modelLine);
-
- /**
- * Returns the widget offset that corresponds to the given offset in the viewer's document
- * or <code>-1</code> if there is no such offset
- *
- * @param modelOffset the offset in the viewer's document
- * @return the corresponding widget offset or <code>-1</code>
- */
- public int modelOffset2WidgetOffset(int modelOffset);
-
- /**
- * Returns the minimal region of the viewer's widget that completely comprises the given region of the
- * viewer's document or <code>null</code> if there is no such region.
- *
- * @param modelRange the region of the viewer's document
- * @return the minimal region of the widget comprising <code>modelRange</code> or <code>null</code>
- */
- public IRegion modelRange2WidgetRange(IRegion modelRange);
-
-
- /**
- * Returns the offset of the viewer's document that corresponds to the given widget offset
- * or <code>-1</code> if there is no such offset
- *
- * @param widgetOffset the widget offset
- * @return the corresponding offset in the viewer's document or <code>-1</code>
- */
- public int widgetOffset2ModelOffset(int widgetOffset);
-
- /**
- * Returns the minimal region of the viewer's document that completely comprises the given widget region
- * or <code>null</code> if there is no such region.
- *
- * @param widgetRange the widget region
- * @return the minimal region of the viewer's document comprising <code>widgetlRange</code> or <code>null</code>
- */
- public IRegion widgetRange2ModelRange(IRegion widgetRange);
-
- /**
- * Returns the line of the viewer's document that corresponds to the given widget line or <code>-1</code> if there is no such line.
- *
- * @param widgetLine the widget line
- * @return the corresponding line of the viewer's document or <code>-1</code>
- */
- public int widgetlLine2ModelLine(int widgetLine);
-
- /**
- * Returns the widget line of the given widget offset.
- *
- * @param widgetOffset the widget offset
- * @return the widget line of the widget offset
- */
- public int widgetLineOfWidgetOffset(int widgetOffset);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IUndoManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IUndoManager.java
deleted file mode 100644
index 48a9644..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IUndoManager.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text;
-
-
-
-/**
- * An undo manager is connected to at most one text viewer.
- * It monitors the text viewer and keeps a history of the
- * changes applied to the viewer. The undo manager groups those
- * changes into user interactions which on an undo request are
- * rolled back in one atomic change. <p>
- * Clients may implement this interface or use the standard
- * implementation <code>DefaultUndoManager</code>.
- *
- * @see org.eclipse.jface.text.DefaultUndoManager
- */
-public interface IUndoManager {
-
- /**
- * Connects this undo manager to the given text viewer.
- *
- * @param viewer the viewer the undo manager is connected to
- */
- void connect(ITextViewer viewer);
-
- /**
- * Disconnects this undo manager from its text viewer.
- * If this undo manager hasn't been connected before this
- * operation has no effect.
- */
- void disconnect();
-
- /**
- * Signals the undo manager that all subsequent changes until
- * <code>endCompoundChange</code> is called are to be undone in one piece.
- */
- void beginCompoundChange();
-
- /**
- * Signals the undo manager that the sequence of changes which started with
- * <code>beginCompoundChange</code> has been finished. All subsequent changes
- * are considered to be individually undoable.
- */
- void endCompoundChange();
-
- /**
- * Resets the history of the undo manager. After that call,
- * there aren't any undoable or redoable text changes.
- */
- void reset();
-
- /**
- * The given parameter determines the maximal length of the history
- * remembered by the undo manager.
- *
- * @param undoLevel the length of this undo manager's history
- */
- void setMaximalUndoLevel(int undoLevel);
-
- /**
- * Returns whether at least one text change can be rolled back.
- *
- * @return <code>true</code> if at least one text change can be rolled back
- */
- boolean undoable();
-
- /**
- * Returns whether at least one text change can be repeated. A text change
- * can be repeated only if it was executed and rolled back.
- *
- * @return <code>true</code> if at least on text change can be repeated
- */
- boolean redoable();
-
- /**
- * Rolls back the most recently executed text change.
- */
- void undo();
-
- /**
- * Repeats the most recently rolled back text change.
- */
- void redo();
-
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IViewportListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IViewportListener.java
deleted file mode 100644
index 65e5de9..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IViewportListener.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;
-
-
-
-/**
- * Registered with a text viewer, viewport listeners are
- * informed about changes of a text viewer's viewport. The view port is that
- * portion of the viewer's document which is visible in the viewer. <p>
- * Clients may implement this interface.
- *
- * @see org.eclipse.jface.text.ITextViewer
- */
-public interface IViewportListener {
-
- /**
- * Informs about viewport changes. The given vertical position
- * is the new vertical scrolling offset measured in pixels.
- */
- void viewportChanged(int verticalOffset);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IWidgetTokenKeeper.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IWidgetTokenKeeper.java
deleted file mode 100644
index 6507ddb..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IWidgetTokenKeeper.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.jface.text;
-
-/**
- * A widget token keeper may require a widget token from an
- * <code>IWidgetTokenOwner</code> and release the token
- * to the owner after usage. A widget token owner may request
- * the token from the token keeper. The keeper may deny that.
- *
- * @since 2.0
- */
-public interface IWidgetTokenKeeper {
-
- /**
- * The given widget token owner requests the widget token from
- * this token keeper. Returns <code>true</code> if the token is released
- * by this token keeper. Note, the keeper must not call
- * <code>releaseWidgetToken(IWidgetTokenKeeper)</code> explicitly.
- *
- * @param owner the token owner
- * @return <code>true</code> if token has been released <code>false</code> otherwise
- */
- boolean requestWidgetToken(IWidgetTokenOwner owner);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IWidgetTokenOwner.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IWidgetTokenOwner.java
deleted file mode 100644
index 7fee31d..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IWidgetTokenOwner.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 widget token must be aquired in order to display
- * information in a temporary window. The intent behind this concept is that
- * only one temporary window should be presented at any moment in time and
- * also to avoid overlapping temporary windows.
- *
- * @since 2.0
- */
-public interface IWidgetTokenOwner {
-
- /**
- * Requests the widget token from this token owner. Returns
- * <code>true</code> if the token has been aquired or is
- * already owned by the requester. This method is non-blocking.
- *
- * @param requester the token requester
- * @return <code>true</code> if requester aquires the token,
- * <code>false</code> otherwise
- */
- boolean requestWidgetToken(IWidgetTokenKeeper requester);
-
- /**
- * The given token keeper releases the token to this
- * token owner. If the token has previously not been held
- * by the given token keeper, nothing happens. This
- * method is non-blocking.
- *
- * @param tokenKeeper the token keeper
- */
- void releaseWidgetToken(IWidgetTokenKeeper tokenKeeper);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextMessages.java
deleted file mode 100644
index bff498f..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextMessages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-class JFaceTextMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.jface.text.JFaceTextMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private JFaceTextMessages() {
- }
-
- 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.jface.text/src/org/eclipse/jface/text/JFaceTextMessages.properties b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextMessages.properties
deleted file mode 100644
index 44d735b..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextMessages.properties
+++ /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
-###############################################################################
-
-
-TextViewer.error.bad_location.WidgetCommand.setEvent=TextViewer.WidgetCommand.setEvent: BadLocationException
-TextViewer.error.bad_location.findAndSelect=TextViewer.findAndSelect: BadLocationException
-TextViewer.error.bad_location.getBottomIndex=TextViewer.getBottomIndex: BadLocationException
-TextViewer.error.bad_location.getBottomIndexEndOffset=TextViewer.getBottomIndexEndOffset: BadLocationException
-TextViewer.error.bad_location.getFirstCompleteLineOfRegion=TextViewer.getFirstCompleteLineOfRegion: BadLocationException
-TextViewer.error.bad_location.getTopIndex=TextViewer.getTopIndex: BadLocationException
-TextViewer.error.bad_location.getTopIndexStartOffset=TextViewer.getTopIndexStartOffset: BadLocationException
-TextViewer.error.bad_location.selectContentTypePlugin=TextViewer.selectContentTypePlugin: BadLocationException
-TextViewer.error.bad_location.setTopIndex_1=TextViewer.setTopIndex: BadLocationException
-TextViewer.error.bad_location.setTopIndex_2=TextViewer.setTopIndex: BadLocationException
-TextViewer.error.bad_location.shift_1=TextViewer.shift: BadLocationException
-TextViewer.error.bad_location.shift_2=TextViewer.shift: BadLocationException
-TextViewer.error.bad_location.verifyText=TextViewer.verifyText: BadLocationException
-TextViewer.error.invalid_range=Invalid range argument
-TextViewer.error.invalid_visible_region_1=Invalid visible region argument
-TextViewer.error.invalid_visible_region_2=Invalid visible region argument
-
-InfoPopup.info_delay_timer_name=AdditionalInfo Delay
-
-ContentAssistant.assist_delay_timer_name=AutoAssist Delay
-
-AbstractHoverInformationControlManager.hover.restarter=Hover Restart Delay
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/MarginPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/MarginPainter.java
deleted file mode 100644
index 5009d00..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/MarginPainter.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Rectangle;
-
-
-/**
- * Paints a vertical line (margin line) after a given column respecting the text viewer's font.
- * Clients usually instantiate and configure objects of this class. <p>
- * This class is not intended to be subclassed.
- *
- * @since 2.1
- */
-public class MarginPainter implements IPainter, PaintListener {
-
- /** The widget of the text viewer */
- private StyledText fTextWidget;
-
- /** The column after which to paint the line, default value <code>60</code> */
- private int fMarginWidth= 80;
- /** The color in which to paint the line */
- private Color fColor;
- /** The line style of the line to be painted, default value <code>SWT.LINE_SOLID</code> */
- private int fLineStyle= SWT.LINE_SOLID;
- /** The line width of the line to be painted, default value <code>1</code> */
- private int fLineWidth= 1;
- /** The cached x-offset of the <code>fMarginWidth</code> for the current font */
- private int fCachedWidgetX= -1;
- /** The active state of this painter */
- private boolean fIsActive= false;
-
- /**
- * Creates a new painter for the given text viewer.
- *
- * @param textViewer the text viewer
- */
- public MarginPainter(ITextViewer textViewer) {
- fTextWidget= textViewer.getTextWidget();
- }
-
- /**
- * Sets the column after which to draw the margin line.
- *
- * @param width the column
- */
- public void setMarginRulerColumn(int width) {
- fMarginWidth= width;
- initialize();
- }
-
- /**
- * Sets the line style of the margin line.
- *
- * @param lineStyle a <code>SWT</code> style constant describing the line style
- */
- public void setMarginRulerStyle(int lineStyle) {
- fLineStyle= lineStyle;
- }
-
- /**
- * Sets the line width of the margin line.
- *
- * @param lineWidth the line width
- */
- public void setMarginRulerWidth(int lineWidth) {
- fLineWidth= lineWidth;
- }
-
- /**
- * Sets the color of the margin line. Must be called before <code>paint</code> is called the first time.
- *
- * @param color the color
- */
- public void setMarginRulerColor(Color color) {
- fColor= color;
- }
-
- /**
- * Initializes this painter, by flushing and recomputing all caches and causing
- * the widget to be redrawn. Must be called explicitly when font of text widget changes.
- */
- public void initialize() {
- computeWidgetX();
- fTextWidget.redraw();
- }
-
- /**
- * Computes and remembers the x-offset of the margin column for the
- * current widget font.
- */
- private void computeWidgetX() {
- GC gc= new GC(fTextWidget);
- int pixels= gc.getFontMetrics().getAverageCharWidth();
- gc.dispose();
-
- fCachedWidgetX= pixels * fMarginWidth;
- }
-
- /*
- * @see IPainter#deactivate(boolean)
- */
- public void deactivate(boolean redraw) {
- if (fIsActive) {
- fIsActive= false;
- fCachedWidgetX= -1;
- fTextWidget.removePaintListener(this);
- if (redraw)
- fTextWidget.redraw();
- }
- }
-
- /*
- * @see IPainter#dispose()
- */
- public void dispose() {
- fTextWidget= null;
- }
-
- /*
- * @see IPainter#paint(int)
- */
- public void paint(int reason) {
- if (!fIsActive) {
- fIsActive= true;
- fTextWidget.addPaintListener(this);
- if (fCachedWidgetX == -1)
- computeWidgetX();
- fTextWidget.redraw();
- } else if (CONFIGURATION == reason || INTERNAL == reason)
- fTextWidget.redraw();
- }
-
- /*
- * @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)
- */
- public void paintControl(PaintEvent e) {
- if (fTextWidget != null) {
- int x= fCachedWidgetX - fTextWidget.getHorizontalPixel();
- if (x >= 0) {
- Rectangle area= fTextWidget.getClientArea();
- e.gc.setForeground(fColor);
- e.gc.setLineStyle(fLineStyle);
- e.gc.setLineWidth(fLineWidth);
- e.gc.drawLine(x, 0, x, area.height);
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IPainter#setPositionManager(org.eclipse.jface.text.IPaintPositionManager)
- */
- public void setPositionManager(IPaintPositionManager manager) {
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/MarkSelection.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/MarkSelection.java
deleted file mode 100644
index 6463e61..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/MarkSelection.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;
-
-
-/**
- * Default implementation of <code>IMarkSelection</code>.
- * @since 2.0
- */
-public class MarkSelection implements IMarkSelection {
-
- /** The marked document. */
- private final IDocument fDocument;
- /** The offset of the mark selection. */
- private final int fOffset;
- /** The length of the mark selection. */
- private final int fLength;
-
- /**
- * Creates a MarkSelection.
- *
- * @param document the marked document
- * @param offset the offset of the mark
- * @param length the length of the mark, may be negative if caret before offset
- */
- public MarkSelection(IDocument document, int offset, int length) {
- fDocument= document;
- fOffset= offset;
- fLength= length;
- }
-
- /*
- * @see IMarkSelection#getDocument()
- */
- public IDocument getDocument() {
- return fDocument;
- }
-
- /*
- * @see IMarkSelection#getOffset()
- */
- public int getOffset() {
- return fOffset;
- }
-
- /*
- * @see IMarkSelection#getLength()
- */
- public int getLength() {
- return fLength;
- }
-
- /*
- * @see ISelection#isEmpty()
- */
- public boolean isEmpty() {
- return fLength == 0;
- }
-
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/PaintManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/PaintManager.java
deleted file mode 100644
index 1bd6162..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/PaintManager.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.Iterator;
-import java.util.List;
-
-import org.eclipse.swt.custom.StyledText;
-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.widgets.Control;
-
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-
-
-/**
- * Manages the painters of a text viewer. Clients usually instantiate and configure
- * objects of this type.
- *
- * @since 2.1
- */
-public final class PaintManager implements KeyListener, MouseListener, ISelectionChangedListener, ITextListener, ITextInputListener {
-
- /**
- * Position updater used by the position manager. This position updater differes from the default position
- * updater in that it extends a position when an insertion happens at the position's offset and right behind
- * the position.
- */
- static class PaintPositionUpdater extends DefaultPositionUpdater {
-
- /**
- * Creates the position updater for the given category.
- *
- * @param category the position category
- */
- protected PaintPositionUpdater(String category) {
- super(category);
- }
-
- /**
- * If an insertion happens at a position's 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.
- */
- 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;
- }
- };
-
- /**
- * The paint position manager used by this paint manager. The paint position
- * manager is installed on a single document and control the creation/disposed
- * and updating of a position category that will be used for managing positions.
- */
- static class PositionManager implements IPaintPositionManager {
-
- /** The document this positon manager works on */
- private IDocument fDocument;
- /** The position updater used for the managing position category */
- private IPositionUpdater fPositionUpdater;
- /** The managing position category */
- private String fCategory;
-
- /**
- * Creates a new position manager. Initializes the managing
- * position category using its class name and its hash value.
- */
- public PositionManager() {
- fCategory= getClass().getName() + hashCode();
- fPositionUpdater= new PaintPositionUpdater(fCategory);
- }
-
- /**
- * Installs this position manager in the given document. The position manager stays
- * active until <code>uninstall</code> or <code>dispose</code>
- * is called.
- *
- * @param document the document to be installed on
- */
- public void install(IDocument document) {
- fDocument= document;
- fDocument.addPositionCategory(fCategory);
- fDocument.addPositionUpdater(fPositionUpdater);
- }
-
- /**
- * Diposes this position manager. The position manager is automatically
- * uninstalled from the document it has previously been installed
- * on.
- */
- public void dispose() {
- uninstall(fDocument);
- }
-
- /**
- * Uninstalls this position manager form the given document. If the position
- * manager has no been installed on this document, this method is without effect.
- *
- * @param document the document form which to uninstall
- */
- public void uninstall(IDocument document) {
- if (document == fDocument && document != null) {
- try {
- fDocument.removePositionUpdater(fPositionUpdater);
- fDocument.removePositionCategory(fCategory);
- } catch (BadPositionCategoryException x) {
- // should not happen
- }
- fDocument= null;
- }
- }
-
- /*
- * @see IPositionManager#addManagedPosition(Position)
- */
- public void managePosition(Position position) {
- try {
- fDocument.addPosition(fCategory, position);
- } catch (BadPositionCategoryException x) {
- // should not happen
- } catch (BadLocationException x) {
- // should not happen
- }
- }
-
- /*
- * @see IPositionManager#removeManagedPosition(Position)
- */
- public void unmanagePosition(Position position) {
- try {
- fDocument.removePosition(fCategory, position);
- } catch (BadPositionCategoryException x) {
- // should not happen
- }
- }
- };
-
-
- /** The painters managed by this paint manager. */
- private List fPainters= new ArrayList(2);
- /** The position manager used by this paint manager */
- private PositionManager fManager;
- /** The associated text viewer */
- private ITextViewer fTextViewer;
-
- /**
- * Creates a new paint manager for the given text viewer.
- *
- * @param textViewer the text viewer associated to this newly created paint manager
- */
- public PaintManager(ITextViewer textViewer) {
- fTextViewer= textViewer;
- }
-
-
- /**
- * Adds the given painter to the list of painters managed by this paint manager.
- * If the painter is already registered with this paint manager, this method is
- * without effect.
- *
- * @param painter the painter to be added
- */
- public void addPainter(IPainter painter) {
- if (!fPainters.contains(painter)) {
- fPainters.add(painter);
- if (fPainters.size() == 1)
- install();
- painter.setPositionManager(fManager);
- painter.paint(IPainter.INTERNAL);
- }
- }
-
- /**
- * Removes the given painter from the list of painters managed by this
- * paint manager. If the painter has not previously been added to this
- * paint manager, this method is without effect.
- *
- * @param painter the painter to be removed
- */
- public void removePainter(IPainter painter) {
- if (fPainters.remove(painter))
- painter.setPositionManager(null);
- if (fPainters.size() == 0)
- dispose();
- }
-
- /**
- * Installs/activates this paint manager. Is called as soon as the
- * first painter is to be managed by this paint manager.
- */
- private void install() {
-
- fManager= new PositionManager();
- if (fTextViewer.getDocument() != null)
- fManager.install(fTextViewer.getDocument());
-
- fTextViewer.addTextInputListener(this);
-
- ISelectionProvider provider= fTextViewer.getSelectionProvider();
- provider.addSelectionChangedListener(this);
-
- fTextViewer.addTextListener(this);
-
- StyledText text= fTextViewer.getTextWidget();
- text.addKeyListener(this);
- text.addMouseListener(this);
- }
-
- /**
- * Disposes this paint manager. The paint manager uninstalls itself
- * and clears all registered painters. This method is also called when the
- * last painter is removed from the list of managed painters.
- */
- public void dispose() {
-
- if (fManager != null) {
- fManager.dispose();
- fManager= null;
- }
-
- for (Iterator e = fPainters.iterator(); e.hasNext();)
- ((IPainter) e.next()).dispose();
- fPainters.clear();
-
- fTextViewer.removeTextInputListener(this);
-
- ISelectionProvider provider= fTextViewer.getSelectionProvider();
- if (provider != null)
- provider.removeSelectionChangedListener(this);
-
- fTextViewer.removeTextListener(this);
-
- StyledText text= fTextViewer.getTextWidget();
- if (text != null && !text.isDisposed()) {
- text.removeKeyListener(this);
- text.removeMouseListener(this);
- }
- }
-
- /**
- * Triggers all registered painters for the given reason.
- *
- * @param reason the reason
- * @see IPainter
- */
- private void paint(int reason) {
- for (Iterator e = fPainters.iterator(); e.hasNext();)
- ((IPainter) e.next()).paint(reason);
- }
-
- /*
- * @see KeyListener#keyPressed(KeyEvent)
- */
- public void keyPressed(KeyEvent e) {
- paint(IPainter.KEY_STROKE);
- }
-
- /*
- * @see KeyListener#keyReleased(KeyEvent)
- */
- public void keyReleased(KeyEvent e) {
- }
-
- /*
- * @see MouseListener#mouseDoubleClick(MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- /*
- * @see MouseListener#mouseDown(MouseEvent)
- */
- public void mouseDown(MouseEvent e) {
- paint(IPainter.MOUSE_BUTTON);
- }
-
- /*
- * @see MouseListener#mouseUp(MouseEvent)
- */
- public void mouseUp(MouseEvent e) {
- }
-
- /*
- * @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- paint(IPainter.SELECTION);
- }
-
- /*
- * @see ITextListener#textChanged(TextEvent)
- */
- public void textChanged(TextEvent event) {
-
- if (!event.getViewerRedrawState())
- return;
-
- Control control= fTextViewer.getTextWidget();
- if (control != null) {
- control.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (fTextViewer != null)
- paint(IPainter.TEXT_CHANGE);
- }
- });
- }
- }
-
- /*
- * @see ITextInputListener#inputDocumentAboutToBeChanged(IDocument, IDocument)
- */
- public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
- if (oldInput != null) {
- for (Iterator e = fPainters.iterator(); e.hasNext();)
- ((IPainter) e.next()).deactivate(false);
- fManager.uninstall(oldInput);
- }
- }
-
- /*
- * @see ITextInputListener#inputDocumentChanged(IDocument, IDocument)
- */
- public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
- if (newInput != null) {
- fManager.install(newInput);
- paint(IPainter.TEXT_CHANGE);
- }
- }
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/PropagatingFontFieldEditor.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/PropagatingFontFieldEditor.java
deleted file mode 100644
index 78b9c9b..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/PropagatingFontFieldEditor.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.jface.text;
-
-
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-import org.eclipse.jface.preference.FontFieldEditor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-
-/**
- * This font field editor implements chaining between a source preference
- * store and a target preference store. Any time the source preference
- * store changes, the change is propagated to the target store. Propagation
- * means that the actual value stored in the source store is set as default
- * value in the target store. If the target store does not contain a value
- * other than the default value, the new default value is immediately
- * effective.
- *
- * @see FontFieldEditor
- * @since 2.0
- */
-public class PropagatingFontFieldEditor extends FontFieldEditor {
-
- /** The editor's parent widget */
- private Composite fParent;
- /** The representation of the default font choice */
- private String fDefaultFontLabel;
-
- /**
- * 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
- * @param defaultFontLabel the label shown in the editor value field when the default value should be taken
- */
- public PropagatingFontFieldEditor(String name, String labelText, Composite parent, String defaultFontLabel) {
- super(name, labelText, parent);
- fParent= parent;
- fDefaultFontLabel= defaultFontLabel == null ? "" : defaultFontLabel; //$NON-NLS-1$
- }
-
- /*
- * @see FontFieldEditor#doLoad()
- */
- protected void doLoad() {
- if (getPreferenceStore().isDefault(getPreferenceName()))
- loadDefault();
- super.doLoad();
- checkForDefault();
- }
-
- /*
- * @see FontFieldEditor#doLoadDefault()
- */
- protected void doLoadDefault() {
- super.doLoadDefault();
- checkForDefault();
- }
-
- /**
- * Checks whether this editor presents the default value "inheritated"
- * from the workbench rather than its own font.
- */
- private void checkForDefault() {
- if (presentsDefaultValue()) {
- Control c= getValueControl(fParent);
- if (c instanceof Label)
- ((Label) c).setText(fDefaultFontLabel);
- }
- }
-
- /**
- * Propagates the font set in the source store to the
- * target store using the given keys.
- *
- * @param source the store from which to read the text font
- * @param sourceKey the key under which the font can be found
- * @param target the store to which to propagate the font
- * @param targetKey the key under which to store the font
- */
- private static void propagateFont(IPreferenceStore source, String sourceKey, IPreferenceStore target, String targetKey) {
- FontData fd= PreferenceConverter.getFontData(source, sourceKey);
- if (fd != null) {
- boolean isDefault= target.isDefault(targetKey); // save old state!
- PreferenceConverter.setDefault(target, targetKey, fd);
- if (isDefault) {
- // restore old state
- target.setToDefault(targetKey);
- }
- }
- }
-
- /**
- * Starts the propagation of the font preference stored in the source preference
- * store under the source key to the target preference store using the target
- * preference key.
- *
- * @param source the source preference store
- * @param sourceKey the key to be used in the source preference store
- * @param target the target preference store
- * @param targetKey the key to be used in the target preference store
- */
- public static void startPropagate(final IPreferenceStore source, final String sourceKey, final IPreferenceStore target, final String targetKey) {
- source.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (sourceKey.equals(event.getProperty()))
- propagateFont(source, sourceKey, target, targetKey);
- }
- });
-
- propagateFont(source, sourceKey, target, targetKey);
- }
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextAttribute.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextAttribute.java
deleted file mode 100644
index dbc1dc0..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextAttribute.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.jface.text;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-
-
-/**
- * Description of textual attributes such as color and style.
- * Text attributes are considered value objects.
- */
-public class TextAttribute {
-
- /** Foreground color */
- private Color foreground;
-
- /** Background color */
- private Color background;
-
- /** The text style */
- private int style;
-
- /**
- * Creates a text attribute with the given colors and style.
- *
- * @param foreground the foreground color
- * @param background the background color
- * @param style the style
- */
- public TextAttribute(Color foreground, Color background, int style) {
- this.foreground= foreground;
- this.background= background;
- this.style= style;
- }
-
- /**
- * Creates a text attribute for the given foreground color, no background color and
- * with the SWT normal style.
- *
- * @param foreground the foreground color
- */
- public TextAttribute(Color foreground) {
- this(foreground, null, SWT.NORMAL);
- }
-
- /*
- * @see Object#equals(Object)
- */
- public boolean equals(Object object) {
-
- if (object == this)
- return true;
-
- if (!(object instanceof TextAttribute))
- return false;
-
- TextAttribute a= (TextAttribute) object;
- return (a.style == style && equals(a.foreground, foreground) && equals(a.background, background));
- }
-
- /**
- * Returns whether the two given objects are equal.
- *
- * @param o1 the first object, can be <code>null</code>
- * @param o2 the second object, can be <code>null</code>
- * @return <code>true</code> if the given objects are equals
- * @since 2.0
- */
- private boolean equals(Object o1, Object o2) {
- if (o1 != null)
- return o1.equals(o2);
- return (o2 == null);
- }
-
- /*
- * @see Object#hashCode()
- */
- public int hashCode() {
- int foregroundHash= foreground == null ? 0 : foreground.hashCode();
- int backgroundHash= background == null ? 0 : background.hashCode();
- return (foregroundHash << 24) | (backgroundHash << 16) | style;
- }
-
- /**
- * Returns the attribute's foreground color.
- *
- * @return the attribute's foreground color
- */
- public Color getForeground() {
- return foreground;
- }
-
- /**
- * Returns the attribute's background color.
- *
- * @return the attribute's background color
- */
- public Color getBackground() {
- return background;
- }
-
- /**
- * Returns the attribute's style.
- *
- * @return the attribute's style
- */
- public int getStyle() {
- return style;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextEvent.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextEvent.java
deleted file mode 100644
index eea6bb6..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextEvent.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-
-/**
- * This event is sent to implementers of <code>ITextListener</code>. It represents a
- * change applied to text viewer. The change is specified as a replace command using
- * offset, length, inserted text, and replaced text. The text viewer issues a text event
- * after the viewer has been changed either in response to a change of the viewer's document
- * or when the viewer's visual content has been changed. In the first case, the text event
- * also carries the original document event. Depending on the viewer's presentation mode,
- * the text event coordinates are different from the document event's coordinates.
- * Client's other than text viewer's don't create instances of this class.
- *
- * @see ITextListener
- * @see ITextViewer
- * @see DocumentEvent
- */
-public class TextEvent {
-
- /** Start offset of the change */
- private int fOffset;
- /** The length of the change */
- private int fLength;
- /** Inserted text */
- private String fText;
- /** Replaced text */
- private String fReplacedText;
- /** The original document event, may by null */
- private DocumentEvent fDocumentEvent;
- /**
- * The redraw state of the viewer issuing this event
- * @since 2.0
- */
- private boolean fViewerRedrawState;
-
- /**
- * Creates a new <code>TextEvent</code> based on the specification.
- *
- * @param offset the offset
- * @param length the length
- * @param replacedText the replaced text
- * @param event the associated document event or <code>null</code> if none
- * @param viewerRedrawState the redraw state of the viewer
- */
- protected TextEvent(int offset, int length, String text, String replacedText, DocumentEvent event, boolean viewerRedrawState) {
- fOffset= offset;
- fLength= length;
- fText= text;
- fReplacedText= replacedText;
- fDocumentEvent= event;
- fViewerRedrawState= viewerRedrawState;
- }
-
- /**
- * Returns the offset of the event.
- *
- * @return the offset of the event
- */
- public int getOffset() {
- return fOffset;
- }
-
- /**
- * Returns the length of the event.
- *
- * @return the length of the event
- */
- public int getLength() {
- return fLength;
- }
-
- /**
- * Returns the text of the event.
- *
- * @return the text of the event
- */
- public String getText() {
- return fText;
- }
-
- /**
- * Returns the text replaced by this event.
- *
- * @return the text replaced by this event
- */
- public String getReplacedText() {
- return fReplacedText;
- }
-
- /**
- * Returns the corresponding document event that caused the viewer change
- *
- * @return the corresponding document event, <code>null</code> if a visual change only
- */
- public DocumentEvent getDocumentEvent() {
- return fDocumentEvent;
- }
-
- /**
- * Returns the viewer's redraw state.
- *
- * @return <code>true</code> if the viewer's redraw state is <code>true</code>
- * @since 2.0
- */
- public boolean getViewerRedrawState() {
- return fViewerRedrawState;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextPresentation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextPresentation.java
deleted file mode 100644
index 7718518..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextPresentation.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.Iterator;
-import java.util.NoSuchElementException;
-
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-
-
-/**
- * Describes the presentation styles for a section of an indexed text
- * such as a document or string. A text presentation defines a default style
- * for the whole section and in addition style differences for individual
- * subsections. Text presentations can be narrowed down to a particular
- * result window. All methods are result window aware, i.e. ranges outside
- * the result window are always ignored.<p>
- * All iterators provided by a text presentation assume that they enumerate
- * non overlapping, consecutive ranges inside the default range. Thus, all
- * these iterators do not include the default range. The default style range
- * must be explicitly asked for using <code>getDefaultStyleRange</code>.
- */
-public class TextPresentation {
-
- /**
- * Applies the given presentation to the given text widget. Helper method.
- *
- * @param presentation the style information
- * @param the widget to which to apply the style information
- * @since 2.0
- */
- public static void applyTextPresentation(TextPresentation presentation, StyledText text) {
-
- StyleRange[] ranges= new StyleRange[presentation.getDenumerableRanges()];
-
- int i= 0;
- Iterator e= presentation.getAllStyleRangeIterator();
- while (e.hasNext())
- ranges[i++]= (StyleRange) e.next();
-
- text.setStyleRanges(ranges);
- }
-
-
-
-
- /**
- * Enumerates all the <code>StyleRange</code>s included in the presentation.
- */
- class FilterIterator implements Iterator {
-
- /** The index of the next style range to be enumerated */
- protected int fIndex;
- /** The upper bound of the indices of style ranges to be enumerated */
- protected int fLength;
- /** Indicates whether ranges similar to the default range should be enumerated */
- protected boolean fSkipDefaults;
- /** The result window */
- protected IRegion fWindow;
-
- /**
- * <code>skipDefaults</code> tells the enumeration to skip all those style ranges
- * which define the same style as the presentation's default style range.
- *
- * @param skipDefaults <code>false</code> if ranges similar to the default range should be enumerated
- */
- protected FilterIterator(boolean skipDefaults) {
-
- fSkipDefaults= skipDefaults;
-
- fWindow= fResultWindow;
- fIndex= getFirstIndexInWindow(fWindow);
- fLength= getFirstIndexAfterWindow(fWindow);
-
- if (fSkipDefaults)
- computeIndex();
- }
-
- /*
- * @see Iterator#next()
- */
- public Object next() {
- try {
- StyleRange r= (StyleRange) fRanges.get(fIndex++);
- return createWindowRelativeRange(fWindow, r);
- } catch (ArrayIndexOutOfBoundsException x) {
- throw new NoSuchElementException();
- } finally {
- if (fSkipDefaults)
- computeIndex();
- }
- }
-
- /*
- * @see Iterator#hasNext()
- */
- public boolean hasNext() {
- return fIndex < fLength;
- }
-
- /*
- * @see Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Returns whether the given object should be skipped.
- *
- * @param o the object to be checked
- * @return <code>true</code> if the object should be skipped by the iterator
- */
- protected boolean skip(Object o) {
- StyleRange r= (StyleRange) o;
- return r.similarTo(fDefaultRange);
- }
-
- /**
- * Computes the index of the styled range that is the next to be enumerated.
- */
- protected void computeIndex() {
- while (fIndex < fLength && skip(fRanges.get(fIndex)))
- ++ fIndex;
- }
- };
-
- /** The syle information for the range covered by the whole presentation */
- private StyleRange fDefaultRange;
- /** The member ranges of the presentation */
- private ArrayList fRanges;
- /** A clipping region against which the presentation can be clipped when asked for results */
- private IRegion fResultWindow;
-
-
- /**
- * Creates a new empty text presentation.
- */
- public TextPresentation() {
- fRanges= new ArrayList(50);
- }
-
- /**
- * Creates a new empty text presentation. <code>sizeHint</code> tells the
- * expected size of this presentation.
- *
- * @param sizeHint the expected size of this presentation
- */
- public TextPresentation(int sizeHint) {
- Assert.isTrue(sizeHint > 0);
- fRanges= new ArrayList(sizeHint);
- }
-
- /**
- * Sets the result window for this presentation. When dealing with
- * this presentation all ranges which are outside the result window
- * are ignored. For example, the size of the presentation is 0
- * when there is no range inside the window even if there are ranges
- * outside the window. All methods are aware of the result window.
- *
- * @param resultWindow the result window
- */
- public void setResultWindow(IRegion resultWindow) {
- fResultWindow= resultWindow;
- }
-
- /**
- * Set the default style range of this presentation.
- * The default style range defines the overall area covered
- * by this presentation and its style information.
- *
- * @param range the range decribing the default region
- */
- public void setDefaultStyleRange(StyleRange range) {
- fDefaultRange= range;
- }
-
- /**
- * Returns this presentation's default style range. The returned <code>StyleRange</code>
- * is relative to the start of the result window.
- *
- * @return this presentation's default style range
- */
- public StyleRange getDefaultStyleRange() {
- return createWindowRelativeRange(fResultWindow, fDefaultRange);
- }
-
- /**
- * Add the given range to the presentation. The range must be a
- * subrange of the presentation's default range.
- *
- * @param range the range to be added
- */
- public void addStyleRange(StyleRange range) {
- checkConsistency(range);
- fRanges.add(range);
- }
-
- /**
- * Checks whether the given range is a subrange of the presentation's
- * default style range.
- *
- * @param range the range to be checked
- * @exception IllegalArgumentAxception if range is not a subrange of the presentation's default range
- */
- private void checkConsistency(StyleRange range) {
-
- if (range == null)
- throw new IllegalArgumentException();
-
- if (fDefaultRange != null) {
-
- if (range.start < fDefaultRange.start)
- range.start= fDefaultRange.start;
-
- int defaultEnd= fDefaultRange.start + fDefaultRange.length;
- int end= range.start + range.length;
- if (end > defaultEnd)
- range.length -= (defaultEnd - end);
- }
- }
-
- /**
- * Returns the index of the first range which overlaps with the
- * specified window.
- *
- * @param window the window to be used for searching
- * @return the index of the first range overlapping with the window
- */
- private int getFirstIndexInWindow(IRegion window) {
- int i= 0;
- if (window != null) {
- int start= window.getOffset();
- while (i < fRanges.size()) {
- StyleRange r= (StyleRange) fRanges.get(i++);
- if (r.start + r.length > start) {
- -- i;
- break;
- }
- }
- }
- return i;
- }
-
- /**
- * Returns the index of the first range which comes after the specified window and does
- * not overlap with this window.
- *
- * @param window the window to be used for searching
- * @return the index of the first range behind the window and not overlapping with the window
- */
- private int getFirstIndexAfterWindow(IRegion window) {
- int i= fRanges.size();
- if (window != null) {
- int end= window.getOffset() + window.getLength();
- while (i > 0) {
- StyleRange r= (StyleRange) fRanges.get(--i);
- if (r.start < end) {
- ++ i;
- break;
- }
- }
- }
- return i;
- }
-
- /**
- * Returns a style range which is relative to the specified window and
- * appropriately clipped if necessary. The original style range is not
- * modified.
- *
- * @param window the reference window
- * @param range the absolute range
- * @return the window relative range based on the absolute range
- */
- private StyleRange createWindowRelativeRange(IRegion window, StyleRange range) {
- if (window == null || range == null)
- return range;
-
- int start= range.start - window.getOffset();
- if (start < 0)
- start= 0;
-
- int rangeEnd= range.start + range.length;
- int windowEnd= window.getOffset() + window.getLength();
- int end= (rangeEnd > windowEnd ? windowEnd : rangeEnd);
- end -= window.getOffset();
-
- StyleRange newRange= (StyleRange) range.clone();
- newRange.start= start;
- newRange.length= end - start;
- return newRange;
- }
-
-
- /**
- * Returns an iterator which enumerates all style ranged which define a style
- * different from the presentation's default style range. The default style range
- * is not enumerated.
- *
- * @return a style range interator
- */
- public Iterator getNonDefaultStyleRangeIterator() {
- return new FilterIterator(fDefaultRange != null);
- }
-
- /**
- * Returns an iterator which enumerates all style ranges of this presentation
- * except the default style range. The returned <code>StyleRange</code>s
- * are relative to the start of the presentation's result window.
- *
- * @return a style range iterator
- */
- public Iterator getAllStyleRangeIterator() {
- return new FilterIterator(false);
- }
-
- /**
- * Returns whether this collection contains any style range including
- * the default style range.
- *
- * @return <code>true</code> if there is no style range in this presentation
- */
- public boolean isEmpty() {
- return (fDefaultRange == null && getDenumerableRanges() == 0);
- }
-
- /**
- * Returns the number of style ranges in the presentation not counting the default
- * style range.
- *
- * @return the number of style ranges in the presentation excluding the default style range
- */
- public int getDenumerableRanges() {
- int size= getFirstIndexAfterWindow(fResultWindow) - getFirstIndexInWindow(fResultWindow);
- return (size < 0 ? 0 : size);
- }
-
- /**
- * Returns the style range with the smallest offset ignoring the default style range or null
- * if the presentation is empty.
- *
- * @return the style range with the smalled offset different from the default style range
- */
- public StyleRange getFirstStyleRange() {
- try {
-
- StyleRange range= (StyleRange) fRanges.get(getFirstIndexInWindow(fResultWindow));
- return createWindowRelativeRange(fResultWindow, range);
-
- } catch (NoSuchElementException x) {
- }
-
- return null;
- }
-
- /**
- * Returns the style range with the highest offset ignoring the default style range.
- *
- * @return the style range with the highest offset different from the default style range
- */
- public StyleRange getLastStyleRange() {
- try {
-
- StyleRange range= (StyleRange) fRanges.get(getFirstIndexAfterWindow(fResultWindow) - 1);
- return createWindowRelativeRange(fResultWindow, range);
-
- } catch (NoSuchElementException x) {
- }
-
- return null;
- }
-
- /**
- * Returns the coverage of this presentation as clipped by the presentation's
- * result window.
- *
- * @return the coverage of this presentation
- */
- public IRegion getCoverage() {
-
- if (fDefaultRange != null) {
- StyleRange range= getDefaultStyleRange();
- return new Region(range.start, range.length);
- }
-
- StyleRange first= getFirstStyleRange();
- StyleRange last= getLastStyleRange();
-
- if (first == null || last == null)
- return null;
-
- return new Region(first.start, last.start - first. start + last.length);
- }
-
- /**
- * Clears this presentation by resetting all applied changes.
- * @since 2.0
- */
- public void clear() {
- fDefaultRange= null;
- fResultWindow= null;
- fRanges.clear();
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextSelection.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextSelection.java
deleted file mode 100644
index ed8da0e..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextSelection.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.jface.text;
-
-
-
-
-/**
- * Standard implementation of <code>ITextSelection</code>.
- * Makes advantage of the weak contract of correctness of its
- * interface. If generated from a selection provider, it only
- * remembers its offset and length and computes the remaining
- * information on request.
- */
-public class TextSelection implements ITextSelection {
-
- /** Internal empty text selection */
- private final static ITextSelection NULL= new TextSelection();
-
- /**
- * Returns a shared instance of an empty text selection.
- *
- * @return a shared instance of an empty text selection
- */
- public static ITextSelection emptySelection() {
- return NULL;
- }
-
- /** Document which delivers the data of the selection */
- private IDocument fDocument;
- /** Offset of the selection */
- private int fOffset;
- /** Length of the selection */
- private int fLength;
-
-
- /**
- * Creates an empty text selection.
- */
- private TextSelection() {
- this(null, -1, -1);
- }
-
- /**
- * Creates a text selection for the given range. This
- * selection object describes generically a text range and
- * is intended to be an argument for the <code>setSelection</code>
- * method of selection providers.
- *
- * @param offset the offset of the range
- * @param length the length of the range
- */
- public TextSelection(int offset, int length) {
- this(null, offset, length);
- }
-
- /**
- * Creates a text selection for the given range of the given document.
- * This selection object is created by selection providers in responds
- * <code>getSelection</code>.
- *
- * @param document the document whose text range is selected in a viewer
- * @param offset the offset of the selected range
- * @param length the length of the selected range
- */
- public TextSelection(IDocument document, int offset, int length) {
- fDocument= document;
- fOffset= offset;
- fLength= length;
- }
-
- /**
- * Returns true if the offset and length are smaller than 0.
- * A selection of length 0, is a valid text selection as it
- * describes, e.g., the cursor position in a viewer.
- */
- /*
- * @see ISelection#isEmpty()
- */
- public boolean isEmpty() {
- return fOffset < 0 || fLength < 0;
- }
-
- /*
- * @see ITextSelection#getOffset()
- */
- public int getOffset() {
- return fOffset;
- }
-
- /*
- * @see ITextSelection#getLength()
- */
- public int getLength() {
- return fLength;
- }
-
- /*
- * @see ITextSelection#getStartLine()
- */
- public int getStartLine() {
-
- try {
- if (fDocument != null)
- return fDocument.getLineOfOffset(fOffset);
- } catch (BadLocationException x) {
- }
-
- return -1;
- }
-
- /*
- * @see ITextSelection#getEndLine()
- */
- public int getEndLine() {
- try {
- if (fDocument != null) {
- int endOffset= fOffset + fLength;
- if (fLength != 0)
- endOffset--;
- return fDocument.getLineOfOffset(endOffset);
- }
- } catch (BadLocationException x) {
- }
-
- return -1;
- }
-
- /*
- * @see ITextSelection#getText()
- */
- public String getText() {
- try {
- if (fDocument != null)
- return fDocument.get(fOffset, fLength);
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
- /*
- * @see java.lang.Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (obj == this)
- return true;
-
- if (obj == null || getClass() != obj.getClass())
- return false;
-
- TextSelection s= (TextSelection) obj;
- boolean sameRange= (s.fOffset == fOffset && s.fLength == fLength);
- if (sameRange) {
-
- if (s.fDocument == null && fDocument == null)
- return true;
- if (s.fDocument == null || fDocument == null)
- return false;
-
- try {
- String sContent= s.fDocument.get(fOffset, fLength);
- String content= fDocument.get(fOffset, fLength);
- return sContent.equals(content);
- } catch (BadLocationException x) {
- }
- }
-
- return false;
- }
-
- /*
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- int low= fDocument != null ? fDocument.hashCode() : 0;
- return (fOffset << 24) | (fLength << 16) | low;
- }
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
deleted file mode 100644
index 8432104..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
+++ /dev/null
@@ -1,4247 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.LineBackgroundEvent;
-import org.eclipse.swt.custom.LineBackgroundListener;
-import org.eclipse.swt.custom.ST;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.printing.PrintDialog;
-import org.eclipse.swt.printing.Printer;
-import org.eclipse.swt.printing.PrinterData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.ScrollBar;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-
-
-
-/**
- * SWT based implementation of <code>ITextViewer</code>. Once the viewer and its SWT control
- * have been created the viewer can only indirectly be disposed by disposing its SWT control.<p>
- * Clients are supposed to instantiate a text viewer and subsequently to communicate with it
- * exclusively using the <code>ITextViewer</code> interface or any of the implemented extension
- * interfaces. <p>
- * A text viewer serves as text operation target. It only partially supports the external control of
- * the enable state of its text operations. A text viewer is also a widget token owner. Anything that
- * wants to display an overlay window on top of a text viewer should implement the
- * <code>IWidgetTokenKeeper</code> interface and participate in the widget token negotiation between
- * the text viewer and all its potential widget token keepers.<p>
- * Clients should not subclass this class as it is rather likely that subclasses will be broken by
- * future releases.
- *
- * @see ITextViewer
- */
-public class TextViewer extends Viewer implements
- ITextViewer, ITextViewerExtension, ITextViewerExtension2,
- ITextOperationTarget, ITextOperationTargetExtension,
- IWidgetTokenOwner {
-
- /** Internal flag to indicate the debug state. */
- public static boolean TRACE_ERRORS= false;
-
- /**
- * Represents a replace command that brings the text viewer's text widget
- * back in sync with text viewer's document after the document has been changed.
- */
- protected class WidgetCommand {
-
- public DocumentEvent event;
- public int start, length;
- public String text, preservedText;
-
- /**
- * Translates a document event into the presentation coordinates of this text viewer.
- *
- * @param e the event to be translated
- */
- public void setEvent(DocumentEvent e) {
-
- event= e;
-
- start= e.getOffset();
- length= e.getLength();
- text= e.getText();
-
- if (length != 0) {
- try {
- preservedText= e.getDocument().get(e.getOffset(), e.getLength());
- } catch (BadLocationException x) {
- preservedText= null;
- if (TRACE_ERRORS)
- System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.WidgetCommand.setEvent")); //$NON-NLS-1$
- }
- } else
- preservedText= null;
- }
- };
-
- /**
- * Connects a text double click strategy to this viewer's text widget.
- * Calls the double click strategy when the mouse has been double clicked
- * inside the text editor.
- */
- class TextDoubleClickStrategyConnector extends MouseAdapter {
-
- /** Internal flag to remember that a double clicked occurred. */
- private boolean fDoubleClicked= false;
-
- public TextDoubleClickStrategyConnector() {
- }
-
- /*
- * @see MouseListener#mouseDoubleClick(MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- fDoubleClicked= true;
- }
-
- /*
- * @see MouseListener#mouseUp(MouseEvent)
- */
- public void mouseUp(MouseEvent e) {
- if (fDoubleClicked) {
- fDoubleClicked= false;
- ITextDoubleClickStrategy s= (ITextDoubleClickStrategy) selectContentTypePlugin(getSelectedRange().x, fDoubleClickStrategies);
- if (s != null)
- s.doubleClicked(TextViewer.this);
- }
- }
- };
-
- /**
- * Monitors the area of the viewer's document that is visible in the viewer.
- * If the area might have changed, it informs the text viewer about this
- * potential change and its origin. The origin is internally used for optimization
- * purposes.
- */
- class ViewportGuard extends MouseAdapter
- implements ControlListener, KeyListener, MouseMoveListener, SelectionListener {
-
- /*
- * @see ControlListener#controlResized(ControlEvent)
- */
- public void controlResized(ControlEvent e) {
- updateViewportListeners(RESIZE);
- }
-
- /*
- * @see ControlListener#controlMoved(ControlEvent)
- */
- public void controlMoved(ControlEvent e) {
- }
-
- /*
- * @see KeyListener#keyReleased
- */
- public void keyReleased(KeyEvent e) {
- updateViewportListeners(KEY);
- }
-
- /*
- * @see KeyListener#keyPressed
- */
- public void keyPressed(KeyEvent e) {
- updateViewportListeners(KEY);
- }
-
- /*
- * @see MouseListener#mouseUp
- */
- public void mouseUp(MouseEvent e) {
- if (fTextWidget != null)
- fTextWidget.removeMouseMoveListener(this);
- updateViewportListeners(MOUSE_END);
- }
-
- /*
- * @see MouseListener#mouseDown
- */
- public void mouseDown(MouseEvent e) {
- if (fTextWidget != null)
- fTextWidget.addMouseMoveListener(this);
- }
-
- /*
- * @see MouseMoveListener#mouseMove
- */
- public void mouseMove(MouseEvent e) {
- updateViewportListeners(MOUSE);
- }
-
- /*
- * @see SelectionListener#widgetSelected
- */
- public void widgetSelected(SelectionEvent e) {
- updateViewportListeners(SCROLLER);
- }
-
- /*
- * @see SelectionListener#widgetDefaultSelected
- */
- public void widgetDefaultSelected(SelectionEvent e) {}
- };
-
- /**
- * This position updater is used to keep the selection during text shift operations.
- */
- static class ShiftPositionUpdater extends DefaultPositionUpdater {
-
- /**
- * Creates the position updater for the given category.
- *
- * @param category the category this updater takes care of
- */
- protected ShiftPositionUpdater(String category) {
- super(category);
- }
-
- /**
- * If an insertion happens at the selection's start offset,
- * the position is extended rather than shifted.
- */
- 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 (myStart <= yoursStart) {
- fPosition.length += fReplaceLength;
- return;
- }
-
- if (myStart > yoursStart)
- fPosition.offset += fReplaceLength;
- }
- };
-
- /**
- * Internal document listener.
- */
- class DocumentListener implements IDocumentListener {
-
- /*
- * @see IDocumentListener#documentAboutToBeChanged
- */
- public void documentAboutToBeChanged(DocumentEvent e) {
- if (e.getDocument() == getVisibleDocument())
- fWidgetCommand.setEvent(e);
- }
-
- /*
- * @see IDocumentListener#documentChanged
- */
- public void documentChanged(final DocumentEvent e) {
- if (fWidgetCommand.event == e)
- updateTextListeners(fWidgetCommand);
- }
- };
-
-
- /**
- * Internal verify listener.
- */
- class TextVerifyListener implements VerifyListener {
-
- /**
- * Indicates whether verify events are forwarded or ignored.
- * @since 2.0
- */
- private boolean fForward= true;
-
- /**
- * Tells the listener to forward received events.
- *
- * @param forward <code>true</code> if forwarding should be enabled.
- * @since 2.0
- */
- public void forward(boolean forward) {
- fForward= forward;
- }
-
- /*
- * @see VerifyListener#verifyText(VerifyEvent)
- */
- public void verifyText(VerifyEvent e) {
- if (fForward)
- handleVerifyEvent(e);
- }
- };
-
- /**
- * The viewer's manager reponsible for registered verify key listeners.
- * Uses batches rather than robust iterators because of performance issues.
- *
- * @since 2.0
- */
- class VerifyKeyListenersManager implements VerifyKeyListener {
-
- /**
- * Represents a batched addListener/removeListener command.
- */
- class Batch {
- /** The index at which to insert the listener. */
- int index;
- /** The listener to be inserted. */
- VerifyKeyListener listener;
-
- /**
- * Creates a new batch containing the given listener for the given index.
- *
- * @param l the listener to be added
- * @param i the index at which to insert the listener
- */
- public Batch(VerifyKeyListener l, int i) {
- listener= l;
- index= i;
- }
- };
-
- /** List of registed verify key listeners. */
- private List fListeners= new ArrayList();
- /** List of pending batches. */
- private List fBatched= new ArrayList();
- /** The currently active iterator. */
- private Iterator fIterator;
-
- /*
- * @see VerifyKeyListener#verifyKey(VerifyEvent)
- */
- public void verifyKey(VerifyEvent event) {
- if (fListeners.isEmpty())
- return;
-
- fIterator= fListeners.iterator();
- while (fIterator.hasNext() && event.doit) {
- VerifyKeyListener listener= (VerifyKeyListener) fIterator.next();
- listener.verifyKey(event);
- }
- fIterator= null;
-
- processBatchedRequests();
- }
-
- /**
- * Processes the pending batched requests.
- */
- private void processBatchedRequests() {
- if (!fBatched.isEmpty()) {
- Iterator e= fBatched.iterator();
- while (e.hasNext()) {
- Batch batch= (Batch) e.next();
- insertListener(batch.listener, batch.index);
- }
- fBatched.clear();
- }
- }
-
- /**
- * Returns the number of registered verify key listeners.
- *
- * @return the number of registered verify key listeners
- */
- public int numberOfListeners() {
- return fListeners.size();
- }
-
- /**
- * Inserts the given listener at the given index or moves it
- * to that index.
- *
- * @param listener the listener to be inserted
- * @param index the index of the listener or -1 for remove
- */
- public void insertListener(VerifyKeyListener listener, int index) {
-
- if (index == -1) {
- removeListener(listener);
- } else if (listener != null) {
-
- if (fIterator != null) {
-
- fBatched.add(new Batch(listener, index));
-
- } else {
-
- int idx= -1;
-
- // find index based on identity
- int size= fListeners.size();
- for (int i= 0; i < size; i++) {
- if (listener == fListeners.get(i)) {
- idx= i;
- break;
- }
- }
-
- // move or add it
- if (idx != index) {
-
- if (idx != -1)
- fListeners.remove(idx);
-
- if (index > fListeners.size())
- fListeners.add(listener);
- else
- fListeners.add(index, listener);
- }
-
- if (size == 0) // checking old size, i.e. current size == size + 1
- install();
- }
- }
- }
-
- /**
- * Removes the given listener.
- *
- * @param listener the listener to be removed
- */
- public void removeListener(VerifyKeyListener listener) {
- if (listener == null)
- return;
-
- if (fIterator != null) {
-
- fBatched.add(new Batch(listener, -1));
-
- } else {
-
- int size= fListeners.size();
- for (int i= 0; i < size; i++) {
- if (listener == fListeners.get(i)) {
- fListeners.remove(i);
- if (size == 1) // checking old size, i.e. current size == size - 1
- uninstall();
- return;
- }
- }
- }
- }
-
- /**
- * Installs this manager.
- */
- private void install() {
- StyledText textWidget= getTextWidget();
- if (textWidget != null && !textWidget.isDisposed())
- textWidget.addVerifyKeyListener(this);
- }
-
- /**
- * Uninstalls this manager.
- */
- private void uninstall() {
- StyledText textWidget= getTextWidget();
- if (textWidget != null && !textWidget.isDisposed())
- textWidget.removeVerifyKeyListener(this);
- }
- };
-
-
- /**
- * Reification of a range in which a find replace operation is performed. This range is visually
- * highlighted in the viewer as long as the replace operation is in progress.
- *
- * @since 2.0
- */
- class FindReplaceRange implements LineBackgroundListener, ITextListener, IPositionUpdater {
-
- /** Internal name for the position category used to update the range. */
- private final static String RANGE_CATEGORY= "org.eclipse.jface.text.TextViewer.find.range"; //$NON-NLS-1$
-
- /** The highlight color of this range. */
- private Color fHighlightColor;
- /** The position used to lively update this range's extent. */
- private Position fPosition;
-
- /** Creates a new find/replace range with the given extent.
- *
- * @param range the extent of this range
- */
- public FindReplaceRange(IRegion range) {
- setRange(range);
- }
-
- /**
- * Sets the extent of this range.
- *
- * @param range the extent of this range
- */
- public void setRange(IRegion range) {
- fPosition= new Position(range.getOffset(), range.getLength());
- }
-
- /**
- * Returns the extent of this range.
- *
- * @return the extent of this range
- */
- public IRegion getRange() {
- return new Region(fPosition.getOffset(), fPosition.getLength());
- }
-
- /**
- * Sets the highlight color of this range. Causes the range to be redrawn.
- *
- * @param color the highlight color
- */
- public void setHighlightColor(Color color) {
- fHighlightColor= color;
- paint();
- }
-
- /*
- * @see LineBackgroundListener#lineGetBackground(LineBackgroundEvent)
- * @since 2.0
- */
- public void lineGetBackground(LineBackgroundEvent event) {
- /* Don't use cached line information because of patched redrawing events. */
-
- if (fTextWidget != null) {
- int offset= widgetOffset2ModelOffset(event.lineOffset);
- if (fPosition.includes(offset))
- event.lineBackground= fHighlightColor;
- }
- }
-
- /**
- * Installs this range. The range registers itself as background
- * line painter and text listener. Also, it creates a category with the
- * viewer's document to maintain its own extent.
- */
- public void install() {
- TextViewer.this.addTextListener(this);
- fTextWidget.addLineBackgroundListener(this);
-
- IDocument document= TextViewer.this.getDocument();
- try {
- document.addPositionCategory(RANGE_CATEGORY);
- document.addPosition(RANGE_CATEGORY, fPosition);
- document.addPositionUpdater(this);
- } catch (BadPositionCategoryException e) {
- // should not happen
- } catch (BadLocationException e) {
- // should not happen
- }
-
- paint();
- }
-
- /**
- * Uninstalls this range.
- * @see #install()
- */
- public void uninstall() {
-
- // http://bugs.eclipse.org/bugs/show_bug.cgi?id=19612
-
- IDocument document= TextViewer.this.getDocument();
- if (document != null) {
- document.removePositionUpdater(this);
- document.removePosition(fPosition);
- }
-
- if (fTextWidget != null && !fTextWidget.isDisposed())
- fTextWidget.removeLineBackgroundListener(this);
-
- TextViewer.this.removeTextListener(this);
-
- clear();
- }
-
- /**
- * Clears the highlighting of this range.
- */
- private void clear() {
- if (fTextWidget != null && !fTextWidget.isDisposed())
- fTextWidget.redraw();
- }
-
- /**
- * Paints the highlighting of this range.
- */
- private void paint() {
-
- IRegion widgetRegion= modelRange2WidgetRange(fPosition);
- int offset= widgetRegion.getOffset();
- int length= widgetRegion.getLength();
-
- int count= fTextWidget.getCharCount();
- if (offset + length >= count) {
- length= count - offset; // clip
-
- Point upperLeft= fTextWidget.getLocationAtOffset(offset);
- Point lowerRight= fTextWidget.getLocationAtOffset(offset + length);
- int width= fTextWidget.getClientArea().width;
- int height= fTextWidget.getLineHeight() + lowerRight.y - upperLeft.y;
- fTextWidget.redraw(upperLeft.x, upperLeft.y, width, height, false);
- }
-
- fTextWidget.redrawRange(offset, length, true);
- }
-
- /*
- * @see ITextListener#textChanged(TextEvent)
- * @since 2.0
- */
- public void textChanged(TextEvent event) {
- if (event.getViewerRedrawState())
- paint();
- }
-
- /*
- * @see IPositionUpdater#update(DocumentEvent)
- * @since 2.0
- */
- public void update(DocumentEvent event) {
- int offset= event.getOffset();
- int length= event.getLength();
- int delta= event.getText().length() - length;
-
- if (offset < fPosition.getOffset())
- fPosition.setOffset(fPosition.getOffset() + delta);
- else if (offset < fPosition.getOffset() + fPosition.getLength())
- fPosition.setLength(fPosition.getLength() + delta);
- }
- };
-
- /**
- * This viewer's find/replace target.
- */
- class FindReplaceTarget implements IFindReplaceTarget, IFindReplaceTargetExtension {
-
- /** The range for this target. */
- private FindReplaceRange fRange;
- /** The highlight color of the range of this target. */
- private Color fScopeHighlightColor;
- /** The document partitioner remembered in case of a "Replace All". */
- private IDocumentPartitioner fRememberedPartitioner;
-
- /*
- * @see IFindReplaceTarget#getSelectionText()
- */
- public String getSelectionText() {
- Point s= TextViewer.this.getSelectedRange();
- if (s.x > -1 && s.y > -1) {
- try {
- IDocument document= TextViewer.this.getDocument();
- return document.get(s.x, s.y);
- } catch (BadLocationException x) {
- }
- }
- return null;
- }
-
- /*
- * @see IFindReplaceTarget#replaceSelection(String)
- */
- public void replaceSelection(String text) {
- Point s= TextViewer.this.getSelectedRange();
- if (s.x > -1 && s.y > -1) {
- try {
- IDocument document= TextViewer.this.getDocument();
- document.replace(s.x, s.y, text);
- if (text != null && text.length() > 0)
- TextViewer.this.setSelectedRange(s.x, text.length());
- } catch (BadLocationException x) {
- }
- }
- }
-
- /*
- * @see IFindReplaceTarget#isEditable()
- */
- public boolean isEditable() {
- return TextViewer.this.isEditable();
- }
-
- /*
- * @see IFindReplaceTarget#getSelection()
- */
- public Point getSelection() {
- Point point= TextViewer.this.getSelectedRange();
- return modelSelection2WidgetSelection(point);
- }
-
- /*
- * @see IFindReplaceTarget#findAndSelect(int, String, boolean, boolean, boolean)
- */
- public int findAndSelect(int offset, String findString, boolean searchForward, boolean caseSensitive, boolean wholeWord) {
-
- int modelOffset= offset == -1 ? -1 : widgetOffset2ModelOffset(offset);
-
- if (fRange != null) {
- IRegion range= fRange.getRange();
- modelOffset= TextViewer.this.findAndSelectInRange(modelOffset, findString, searchForward, caseSensitive, wholeWord, range.getOffset(), range.getLength());
- } else {
- modelOffset= TextViewer.this.findAndSelect(modelOffset, findString, searchForward, caseSensitive, wholeWord);
- }
-
- offset= modelOffset == -1 ? -1 : modelOffset2WidgetOffset(modelOffset);
- return offset;
- }
-
- /*
- * @see IFindReplaceTarget#canPerformFind()
- */
- public boolean canPerformFind() {
- return TextViewer.this.canPerformFind();
- }
-
- /*
- * @see IFindReplaceTargetExtension#beginSession()
- * @since 2.0
- */
- public void beginSession() {
- fRange= null;
- }
-
- /*
- * @see IFindReplaceTargetExtension#endSession()
- * @since 2.0
- */
- public void endSession() {
- if (fRange != null) {
- fRange.uninstall();
- fRange= null;
- }
- }
-
- /*
- * @see IFindReplaceTargetExtension#getScope()
- * @since 2.0
- */
- public IRegion getScope() {
- return fRange == null ? null : fRange.getRange();
- }
-
- /*
- * @see IFindReplaceTargetExtension#getLineSelection()
- * @since 2.0
- */
- public Point getLineSelection() {
- Point point= TextViewer.this.getSelectedRange();
-
- try {
- IDocument document= TextViewer.this.getDocument();
-
- // beginning of line
- int line= document.getLineOfOffset(point.x);
- int offset= document.getLineOffset(line);
-
- // end of line
- line= document.getLineOfOffset(point.x + point.y);
- int length= document.getLineOffset(line) + document.getLineLength(line) - offset;
-
- return new Point(offset, length);
-
- } catch (BadLocationException e) {
- // should not happen
- return null;
- }
- }
-
- /*
- * @see IFindReplaceTargetExtension#setSelection(int, int)
- * @since 2.0
- */
- public void setSelection(int modelOffset, int modelLength) {
- TextViewer.this.setSelectedRange(modelOffset, modelLength);
- }
-
- /*
- * @see IFindReplaceTargetExtension#setScope(IRegion)
- * @since 2.0
- */
- public void setScope(IRegion scope) {
- if (fRange != null)
- fRange.uninstall();
-
- if (scope == null) {
- fRange= null;
- return;
- }
-
- fRange= new FindReplaceRange(scope);
- fRange.setHighlightColor(fScopeHighlightColor);
- fRange.install();
- }
-
- /*
- * @see IFindReplaceTargetExtension#setScopeHighlightColor(Color)
- * @since 2.0
- */
- public void setScopeHighlightColor(Color color) {
- if (fRange != null)
- fRange.setHighlightColor(color);
- fScopeHighlightColor= color;
- }
-
- /*
- * @see IFindReplaceTargetExtension#setReplaceAllMode(boolean)
- * @since 2.0
- */
- public void setReplaceAllMode(boolean replaceAll) {
-
- // http://bugs.eclipse.org/bugs/show_bug.cgi?id=18232
-
- if (replaceAll) {
-
- TextViewer.this.setRedraw(false);
- TextViewer.this.startSequentialRewriteMode(false);
-
- if (fUndoManager != null)
- fUndoManager.beginCompoundChange();
-
- IDocument document= TextViewer.this.getDocument();
- fRememberedPartitioner= document.getDocumentPartitioner();
- if (fRememberedPartitioner != null) {
- fRememberedPartitioner.disconnect();
- document.setDocumentPartitioner(null);
- }
-
- } else {
-
- TextViewer.this.setRedraw(true);
- TextViewer.this.stopSequentialRewriteMode();
-
- if (fUndoManager != null)
- fUndoManager.endCompoundChange();
-
- if (fRememberedPartitioner != null) {
- IDocument document= TextViewer.this.getDocument();
- fRememberedPartitioner.connect(document);
- document.setDocumentPartitioner(fRememberedPartitioner);
- }
- }
- }
- };
-
-
- /**
- * The viewer's rewrite target.
- * @since 2.0
- */
- class RewriteTarget implements IRewriteTarget {
-
- /*
- * @see org.eclipse.jface.text.IRewriteTarget#beginCompoundChange()
- */
- public void beginCompoundChange() {
- if (fUndoManager != null)
- fUndoManager.beginCompoundChange();
- }
-
- /*
- * @see org.eclipse.jface.text.IRewriteTarget#endCompoundChange()
- */
- public void endCompoundChange() {
- if (fUndoManager != null)
- fUndoManager.endCompoundChange();
- }
-
- /*
- * @see org.eclipse.jface.text.IRewriteTarget#getDocument()
- */
- public IDocument getDocument() {
- return TextViewer.this.getDocument();
- }
-
- /*
- * @see org.eclipse.jface.text.IRewriteTarget#setRedraw(boolean)
- */
- public void setRedraw(boolean redraw) {
- TextViewer.this.setRedraw(redraw);
- }
- };
-
- /**
- * Value object used as key in the text hover configuration table. It is
- * modifiable only inside this compilation unit to allow the reuse of created
- * objects for efficiency reasons
- *
- * @since 2.1
- */
- protected class TextHoverKey {
-
- /** The content type this key belongs to */
- private String fContentType;
- /** The state mask */
- private int fStateMask;
-
- /**
- * Creates a new text hover key for the given content type and state mask.
- *
- * @param contentType the content type
- * @param stateMask the state mask
- */
- protected TextHoverKey(String contentType, int stateMask) {
- Assert.isNotNull(contentType);
- fContentType= contentType;
- fStateMask= stateMask;
- }
-
- /*
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj == null || obj.getClass() != getClass())
- return false;
- TextHoverKey textHoverKey= (TextHoverKey)obj;
- return textHoverKey.fContentType.equals(fContentType) && textHoverKey.fStateMask == fStateMask;
- }
-
- /*
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fStateMask << 16 | fContentType.hashCode();
- }
-
- /**
- * Sets the state mask of this text hover key.
- *
- * @param stateMask the state mask
- */
- private void setStateMask(int stateMask) {
- fStateMask= stateMask;
- }
- };
-
- /**
- * A position reflecting a viewer selection and the selection anchor.
- * The anchor is represnted by the caret.
- *
- * @since 2.1
- */
- static class SelectionPosition extends Position {
-
- /** The flag indicating the anchor of this selection */
- private boolean reverse;
-
- /**
- * Creates a new selection position for the specified selection.
- *
- * @param point the specified selection
- */
- public SelectionPosition(Point point) {
- super();
- reverse= point.y < 0;
- if (reverse) {
- offset= point.x + point.y;
- length= -point.y;
- } else {
- offset= point.x;
- length= point.y;
- }
- }
-
- /**
- * Returns the selection in a format where the selection length
- * is always non-negative.
- *
- * @return the normalized selection
- */
- public Point getNormalizedSelection() {
- return new Point(offset, length);
- }
-
- /**
- * Returns the selection reflecting its anchor.
- *
- * @return the selection reflecting the selection achor.
- */
- public Point getSelection() {
- return reverse ? new Point(offset - length, -length) : new Point(offset, length);
- }
- };
-
- /**
- * Identifies the scrollbars as originators of a view port change.
- */
- protected static final int SCROLLER= 1;
- /**
- * Identifies mouse moves as originators of a view port change.
- */
- protected static final int MOUSE= 2;
- /**
- * Identifies mouse button up as originator of a view port change.
- */
- protected static final int MOUSE_END= 3;
- /**
- * Identifies key strokes as originators of a view port change.
- */
- protected static final int KEY= 4;
- /**
- * Identifies window resizing as originator of a view port change.
- */
- protected static final int RESIZE= 5;
- /**
- * Identifies internal reasons as originators of a view port change.
- */
- protected static final int INTERNAL= 6;
-
- /** Internal name of the position category used selection preservation during shift */
- protected static final String SHIFTING= "__TextViewer_shifting"; //$NON-NLS-1$
-
- /** The viewer's text widget */
- private StyledText fTextWidget;
- /** The viewer's input document */
- private IDocument fDocument;
- /** The viewer's visible document */
- private IDocument fVisibleDocument;
- /** The viewer's document adapter */
- private IDocumentAdapter fDocumentAdapter;
- /** The slave document manager */
- private ISlaveDocumentManager fSlaveDocumentManager;
- /** The text viewer's double click strategies connector */
- private TextDoubleClickStrategyConnector fDoubleClickStrategyConnector;
- /**
- * The text viewer's hovering controller
- * @since 2.0
- */
- private TextViewerHoverManager fTextHoverManager;
- /** The text viewer's viewport guard */
- private ViewportGuard fViewportGuard;
- /** Caches the graphical coordinate of the first visible line */
- private int fTopInset= 0;
- /** The most recent document modification as widget command */
- private WidgetCommand fWidgetCommand= new WidgetCommand();
- /** The SWT control's scrollbars */
- private ScrollBar fScroller;
- /** Document listener */
- private DocumentListener fDocumentListener= new DocumentListener();
- /** Verify listener */
- private TextVerifyListener fVerifyListener= new TextVerifyListener();
- /** The most recent widget modification as document command */
- private DocumentCommand fDocumentCommand= new DocumentCommand();
- /** The viewer's find/replace target */
- private IFindReplaceTarget fFindReplaceTarget;
- /**
- * The viewer widget token keeper
- * @since 2.0
- */
- private IWidgetTokenKeeper fWidgetTokenKeeper;
- /**
- * The viewer's manager of verify key listeners
- * @since 2.0
- */
- private VerifyKeyListenersManager fVerifyKeyListenersManager= new VerifyKeyListenersManager();
- /**
- * The mark position.
- * @since 2.0
- */
- private Position fMarkPosition;
- /**
- * The mark position category.
- * @since 2.0
- */
- private final String MARK_POSITION_CATEGORY="__mark_category_" + hashCode(); //$NON-NLS-1$
- /**
- * The mark position updater
- * @since 2.0
- */
- private final IPositionUpdater fMarkPositionUpdater= new DefaultPositionUpdater(MARK_POSITION_CATEGORY);
- /**
- * The flag indicating the redraw behavior
- * @since 2.0
- */
- private int fRedrawCounter= 0;
- /**
- * The selection when working in non-redraw state
- * @since 2.0
- */
- private SelectionPosition fDocumentSelection;
- /**
- * The viewer's rewrite target
- * @since 2.0
- */
- private IRewriteTarget fRewriteTarget;
-
-
- /** Should the auto indent strategies ignore the next edit operation */
- protected boolean fIgnoreAutoIndent= false;
- /** The strings a line is prefixed with on SHIFT_RIGHT and removed from each line on SHIFT_LEFT */
- protected Map fIndentChars;
- /** The string a line is prefixed with on PREFIX and removed from each line on STRIP_PREFIX */
- protected Map fDefaultPrefixChars;
- /** The text viewer's text double click strategies */
- protected Map fDoubleClickStrategies;
- /** The text viewer's undo manager */
- protected IUndoManager fUndoManager;
- /** The text viewer's auto indent strategies */
- protected Map fAutoIndentStrategies;
- /** The text viewer's text hovers */
- protected Map fTextHovers;
- /**
- * The creator of the text hover control
- * @since 2.0
- */
- protected IInformationControlCreator fHoverControlCreator;
- /** All registered viewport listeners> */
- protected List fViewportListeners;
- /** The last visible vertical position of the top line */
- protected int fLastTopPixel;
- /** All registered text listeners */
- protected List fTextListeners;
- /** All registered text input listeners */
- protected List fTextInputListeners;
- /** The text viewer's event consumer */
- protected IEventConsumer fEventConsumer;
- /** Indicates whether the viewer's text presentation should be replaced are modified. */
- protected boolean fReplaceTextPresentation= false;
- /**
- * The mapping between model and visible document.
- * @since 2.1
- */
- protected IDocumentInformationMapping fInformationMapping;
- /**
- * The viewer's paint manager;
- * @since 2.1
- */
- protected PaintManager fPaintManager;
-
-
-
- //---- Construction and disposal ------------------
-
-
- /**
- * Internal use only
- */
- protected TextViewer() {
- }
-
- /**
- * Create a new text viewer with the given SWT style bits.
- * The viewer is ready to use but does not have any plug-in installed.
- *
- * @param parent the parent of the viewer's control
- * @param styles the SWT style bits for the viewer's control
- */
- public TextViewer(Composite parent, int styles) {
- createControl(parent, styles);
- }
-
- /**
- * Factory method to create the text widget to be used as the viewer's text widget.
- *
- * @return the text widget to be used
- */
- protected StyledText createTextWidget(Composite parent, int styles) {
- return new StyledText(parent, styles);
- }
-
- /**
- * Factory method to create the document adapter to be used by this viewer.
- *
- * @return the document adapter to be used
- */
- protected IDocumentAdapter createDocumentAdapter() {
- return new DocumentAdapter();
- }
-
- /**
- * Creates the viewer's SWT control. The viewer's text widget either is
- * the control or is a child of the control.
- *
- * @param parent the parent of the viewer's control
- * @param styles the SWT style bits for the viewer's control
- */
- protected void createControl(Composite parent, int styles) {
-
- fTextWidget= createTextWidget(parent, styles);
- fTextWidget.addDisposeListener(
- new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- setDocument(null);
- handleDispose();
- fTextWidget= null;
- }
- }
- );
-
- fTextWidget.setFont(parent.getFont());
- fTextWidget.setDoubleClickEnabled(false);
-
- /*
- * Disable SWT Shift+TAB traversal in this viewer
- * 1GIYQ9K: ITPUI:WINNT - StyledText swallows Shift+TAB
- */
- fTextWidget.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- if ((SWT.SHIFT == e.stateMask) && ('\t' == e.character))
- e.doit = false;
- }
- });
-
- // where does the first line start
- fTopInset= -fTextWidget.computeTrim(0, 0, 0, 0).y;
-
- fVerifyListener.forward(true);
- fTextWidget.addVerifyListener(fVerifyListener);
-
- fTextWidget.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent event) {
- selectionChanged(event.x, event.y - event.x);
- }
- public void widgetSelected(SelectionEvent event) {
- selectionChanged(event.x, event.y - event.x);
- }
- });
-
- initializeViewportUpdate();
- }
-
- /*
- * @see Viewer#getControl()
- */
- public Control getControl() {
- return fTextWidget;
- }
-
- /*
- * @see ITextViewer#activatePlugins()
- */
- public void activatePlugins() {
-
- if (fDoubleClickStrategies != null && !fDoubleClickStrategies.isEmpty() && fDoubleClickStrategyConnector == null) {
- fDoubleClickStrategyConnector= new TextDoubleClickStrategyConnector();
- fTextWidget.addMouseListener(fDoubleClickStrategyConnector);
- }
-
- ensureHoverControlManagerInstalled();
-
- if (fUndoManager != null) {
- fUndoManager.connect(this);
- fUndoManager.reset();
- }
- }
-
- /**
- * After this method has been executed the caller knows that any installed text hover has been installed.
- */
- private void ensureHoverControlManagerInstalled() {
- if (fTextHovers != null && !fTextHovers.isEmpty() && fHoverControlCreator != null && fTextHoverManager == null) {
- fTextHoverManager= new TextViewerHoverManager(this, fHoverControlCreator);
- fTextHoverManager.install(this.getTextWidget());
- }
- }
-
- /*
- * @see ITextViewer#resetPlugins()
- */
- public void resetPlugins() {
- if (fUndoManager != null)
- fUndoManager.reset();
- }
-
- /**
- * Frees all resources allocated by this viewer. Internally called when the viewer's
- * control has been disposed.
- */
- protected void handleDispose() {
-
- if (fPaintManager != null) {
- fPaintManager.dispose();
- fPaintManager= null;
- }
-
- removeViewPortUpdate();
- fViewportGuard= null;
-
- if (fViewportListeners != null) {
- fViewportListeners.clear();
- fViewportListeners= null;
- }
-
- if (fTextListeners != null) {
- fTextListeners.clear();
- fTextListeners= null;
- }
-
- if (fAutoIndentStrategies != null) {
- fAutoIndentStrategies.clear();
- fAutoIndentStrategies= null;
- }
-
- if (fUndoManager != null) {
- fUndoManager.disconnect();
- fUndoManager= null;
- }
-
- if (fDoubleClickStrategies != null) {
- fDoubleClickStrategies.clear();
- fDoubleClickStrategies= null;
- }
-
- if (fTextHovers != null) {
- fTextHovers.clear();
- fTextHovers= null;
- }
-
- fDoubleClickStrategyConnector= null;
-
- if (fTextHoverManager != null) {
- fTextHoverManager.dispose();
- fTextHoverManager= null;
- }
-
- if (fDocumentListener !=null) {
- if (fVisibleDocument != null)
- fVisibleDocument.removeDocumentListener(fDocumentListener);
- fDocumentListener= null;
- }
-
- if (fDocumentAdapter != null) {
- fDocumentAdapter.setDocument(null);
- fDocumentAdapter= null;
- }
-
- if (fSlaveDocumentManager != null) {
- if (fVisibleDocument != null)
- fSlaveDocumentManager.freeSlaveDocument(fVisibleDocument);
- fSlaveDocumentManager= null;
- }
-
- fVisibleDocument= null;
- fDocument= null;
- fScroller= null;
- }
-
-
- //---- simple getters and setters
-
- /**
- * Returns viewer's text widget.
- */
- public StyledText getTextWidget() {
- return fTextWidget;
- }
-
- /*
- * @see ITextViewer#setAutoIndentStrategy(IAutoIndentStrategy, String)
- */
- public void setAutoIndentStrategy(IAutoIndentStrategy strategy, String contentType) {
-
- if (fAutoIndentStrategies == null)
- fAutoIndentStrategies= new HashMap();
-
- List autoEditStrategies= (List) fAutoIndentStrategies.get(contentType);
-
- if (strategy == null) {
- if (autoEditStrategies == null)
- return;
-
- fAutoIndentStrategies.put(contentType, null);
-
- } else {
- if (autoEditStrategies == null) {
- autoEditStrategies= new ArrayList();
- fAutoIndentStrategies.put(contentType, autoEditStrategies);
- }
-
- autoEditStrategies.clear();
- autoEditStrategies.add(strategy);
- }
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension2#prependAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy, java.lang.String)
- * @since 2.1
- */
- public void prependAutoEditStrategy(IAutoEditStrategy strategy, String contentType) {
-
- if (strategy == null || contentType == null)
- throw new IllegalArgumentException();
-
- if (fAutoIndentStrategies == null)
- fAutoIndentStrategies= new HashMap();
-
- List autoEditStrategies= (List) fAutoIndentStrategies.get(contentType);
- if (autoEditStrategies == null) {
- autoEditStrategies= new ArrayList();
- fAutoIndentStrategies.put(contentType, autoEditStrategies);
- }
-
- autoEditStrategies.add(0, strategy);
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension2#removeAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy, java.lang.String)
- * @since 2.1
- */
- public void removeAutoEditStrategy(IAutoEditStrategy strategy, String contentType) {
- if (fAutoIndentStrategies == null)
- return;
-
- List autoEditStrategies= (List) fAutoIndentStrategies.get(contentType);
- if (autoEditStrategies == null)
- return;
-
- for (final Iterator iterator= autoEditStrategies.iterator(); iterator.hasNext(); ) {
- if (iterator.next().equals(strategy)) {
- iterator.remove();
- break;
- }
- }
-
- if (autoEditStrategies.isEmpty())
- fAutoIndentStrategies.put(contentType, null);
- }
-
- /*
- * @see ITextViewer#setEventConsumer(IEventConsumer)
- */
- public void setEventConsumer(IEventConsumer consumer) {
- fEventConsumer= consumer;
- }
-
- /*
- * @see ITextViewer#setIndentPrefixes(String[], String)
- */
- public void setIndentPrefixes(String[] indentPrefixes, String contentType) {
-
- int i= -1;
- boolean ok= (indentPrefixes != null);
- while (ok && ++i < indentPrefixes.length)
- ok= (indentPrefixes[i] != null);
-
- if (ok) {
-
- if (fIndentChars == null)
- fIndentChars= new HashMap();
-
- fIndentChars.put(contentType, indentPrefixes);
-
- } else if (fIndentChars != null)
- fIndentChars.remove(contentType);
- }
-
- /*
- * @see ITextViewer#getTopInset()
- */
- public int getTopInset() {
- return fTopInset;
- }
-
- /*
- * @see ITextViewer#isEditable()
- */
- public boolean isEditable() {
- if (fTextWidget == null)
- return false;
- return fTextWidget.getEditable();
- }
-
- /*
- * @see ITextViewer#setEditable(boolean)
- */
- public void setEditable(boolean editable) {
- if (fTextWidget != null)
- fTextWidget.setEditable(editable);
- }
-
- /*
- * @see ITextViewer#setDefaultPrefixes
- * @since 2.0
- */
- public void setDefaultPrefixes(String[] defaultPrefixes, String contentType) {
-
- if (defaultPrefixes != null && defaultPrefixes.length > 0) {
- if (fDefaultPrefixChars == null)
- fDefaultPrefixChars= new HashMap();
- fDefaultPrefixChars.put(contentType, defaultPrefixes);
- } else if (fDefaultPrefixChars != null)
- fDefaultPrefixChars.remove(contentType);
- }
-
- /*
- * @see ITextViewer#setUndoManager(IUndoManager)
- */
- public void setUndoManager(IUndoManager undoManager) {
- fUndoManager= undoManager;
- }
-
- /*
- * @see ITextViewer#setTextHover(ITextHover, String)
- */
- public void setTextHover(ITextHover hover, String contentType) {
- setTextHover(hover, contentType, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
- }
-
- /*
- * @see ITextViewerExtension2#setTextHover(ITextHover, String, int)
- * @since 2.1
- */
- public void setTextHover(ITextHover hover, String contentType, int stateMask) {
- TextHoverKey key= new TextHoverKey(contentType, stateMask);
- if (hover != null) {
- if (fTextHovers == null) {
- fTextHovers= new HashMap();
- }
- fTextHovers.put(key, hover);
- } else if (fTextHovers != null)
- fTextHovers.remove(key);
-
- ensureHoverControlManagerInstalled();
- }
-
- /*
- * @see ITextViewerExtension2#removeTextHovers(String)
- * @since 2.1
- */
- public void removeTextHovers(String contentType) {
- if (fTextHovers == null)
- return;
-
- Iterator iter= new HashSet(fTextHovers.keySet()).iterator();
- while (iter.hasNext()) {
- TextHoverKey key= (TextHoverKey)iter.next();
- if (key.fContentType.equals(contentType))
- fTextHovers.remove(key);
- }
- }
-
- /**
- * Returns the text hover for a given offset.
- *
- * @param offset the offset for which to return the text hover
- * @return the text hover for the given offset
- */
- protected ITextHover getTextHover(int offset) {
- return getTextHover(offset, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
- }
-
- /**
- * Returns the text hover for a given offset and a given state mask.
- *
- * @param offset the offset for which to return the text hover
- * @param stateMask the SWT event state mask
- * @return the text hover for the given offset and state mask
- * @since 2.1
- */
- protected ITextHover getTextHover(int offset, int stateMask) {
- if (fTextHovers == null)
- return null;
-
- try {
- TextHoverKey key= new TextHoverKey(getDocument().getContentType(offset), stateMask);
- Object textHover= fTextHovers.get(key);
- if (textHover == null) {
- // Use default text hover
- key.setStateMask(ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
- textHover= fTextHovers.get(key);
- }
- return (ITextHover)textHover;
- } catch (BadLocationException x) {
- if (TRACE_ERRORS)
- System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.selectContentTypePlugin")); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * Returns the text hovering controller of this viewer.
- *
- * @return the text hovering controller of this viewer
- * @since 2.0
- */
- protected AbstractInformationControlManager getTextHoveringController() {
- return fTextHoverManager;
- }
-
- /**
- * Sets the creator for the hover controls.
- *
- * @param creator the hover control creator
- * @since 2.0
- */
- public void setHoverControlCreator(IInformationControlCreator creator) {
- fHoverControlCreator= creator;
- }
-
- /*
- * @see IWidgetTokenOwner#requestWidgetToken(IWidgetTokenKeeper)
- * @since 2.0
- */
- public boolean requestWidgetToken(IWidgetTokenKeeper requester) {
- if (fTextWidget != null) {
- if (fWidgetTokenKeeper != null) {
- if (fWidgetTokenKeeper == requester)
- return true;
- if (fWidgetTokenKeeper.requestWidgetToken(this)) {
- fWidgetTokenKeeper= requester;
- return true;
- }
- } else {
- fWidgetTokenKeeper= requester;
- return true;
- }
- }
- return false;
- }
-
- /*
- * @see IWidgetTokenOwner#releaseWidgetToken(IWidgetTokenKeeper)
- * @since 2.0
- */
- public void releaseWidgetToken(IWidgetTokenKeeper tokenKeeper) {
- if (fWidgetTokenKeeper == tokenKeeper)
- fWidgetTokenKeeper= null;
- }
-
-
- //---- Selection
-
- /*
- * @see ITextViewer#getSelectedRange()
- */
- public Point getSelectedRange() {
-
- if (!redraws())
- return fDocumentSelection.getNormalizedSelection();
-
- if (fTextWidget != null) {
- Point p= fTextWidget.getSelectionRange();
- return widgetSelection2ModelSelection(p);
- }
-
- return new Point(-1, -1);
- }
-
- /*
- * @see ITextViewer#setSelectedRange(int, int)
- */
- public void setSelectedRange(int selectionOffset, int selectionLength) {
-
- if (!redraws()) {
- if (fDocumentSelection != null) {
- fDocumentSelection.offset= selectionOffset;
- fDocumentSelection.length= selectionLength;
- // http://bugs.eclipse.org/bugs/show_bug.cgi?id=32795
- fDocumentSelection.isDeleted= false;
- }
- return;
- }
-
- if (fTextWidget == null)
- return;
-
- IRegion widgetSelection= modelRange2WidgetRange(new Region(selectionOffset, selectionLength));
- if (widgetSelection != null) {
-
- int[] selectionRange= new int[] { widgetSelection.getOffset(), widgetSelection.getLength() };
- validateSelectionRange(selectionRange);
- if (selectionRange[0] >= 0) {
- fTextWidget.setSelectionRange(selectionRange[0], selectionRange[1]);
- selectionChanged(selectionRange[0], selectionRange[1]);
- }
- }
- }
-
- /**
- * Validates and adapts the given selection range if it is not a valid
- * widget selection. The widget selection is invalid if it starts or ends
- * inside a multi-character line delimiter. If so, the selection is adapted to
- * start <b>after</b> the divided line delimiter and to end <b>before</b>
- * the divided line delimiter. The parameter passed in is changed in-place
- * when being adapted. An adaptation to <code>[-1, -1]</code> indicates
- * that the selection range could not be validated.
- * Subclasses may reimplement this method.
- *
- * @param selectionRange selectionRange[0] is the offset, selectionRange[1]
- * the length of the selection to validate.
- * @since 2.0
- */
- protected void validateSelectionRange(int[] selectionRange) {
-
- IDocument document= getVisibleDocument();
- if (document == null) {
- selectionRange[0]= -1;
- selectionRange[1]= -1;
- return;
- }
-
- int documentLength= document.getLength();
- int offset= selectionRange[0];
- int length= selectionRange[1];
-
- if (length < 0) {
- length= - length;
- offset -= length;
- }
-
- if (offset <0)
- offset= 0;
-
- if (offset > documentLength)
- offset= documentLength;
-
- int delta= (offset + length) - documentLength;
- if (delta > 0)
- length -= delta;
-
- try {
-
- int lineNumber= document.getLineOfOffset(offset);
- IRegion lineInformation= document.getLineInformation(lineNumber);
-
- int lineEnd= lineInformation.getOffset() + lineInformation.getLength();
- delta= offset - lineEnd;
- if (delta > 0) {
- // in the middle of a multi-character line delimiter
- offset= lineEnd;
- String delimiter= document.getLineDelimiter(lineNumber);
- if (delimiter != null)
- offset += delimiter.length();
- }
-
- int end= offset + length;
- lineInformation= document.getLineInformationOfOffset(end);
- lineEnd= lineInformation.getOffset() + lineInformation.getLength();
- delta= end - lineEnd;
- if (delta > 0) {
- // in the middle of a multi-character line delimiter
- length -= delta;
- }
-
- } catch (BadLocationException x) {
- selectionRange[0]= -1;
- selectionRange[1]= -1;
- return;
- }
-
- if (selectionRange[1] < 0) {
- selectionRange[0]= offset + length;
- selectionRange[1]= -length;
- } else {
- selectionRange[0]= offset;
- selectionRange[1]= length;
- }
- }
-
- /*
- * @see Viewer#setSelection(ISelection)
- */
- public void setSelection(ISelection selection, boolean reveal) {
- if (selection instanceof ITextSelection) {
- ITextSelection s= (ITextSelection) selection;
- setSelectedRange(s.getOffset(), s.getLength());
- if (reveal)
- revealRange(s.getOffset(), s.getLength());
- }
- }
-
- /*
- * @see Viewer#getSelection()
- */
- public ISelection getSelection() {
- Point p= getSelectedRange();
- if (p.x == -1 || p.y == -1)
- return TextSelection.emptySelection();
-
- return new TextSelection(getDocument(), p.x, p.y);
- }
-
- /*
- * @see ITextViewer#getSelectionProvider()
- */
- public ISelectionProvider getSelectionProvider() {
- return this;
- }
-
- /**
- * Sends out a text selection changed event to all registered listeners.
- *
- * @param offset the offset of the newly selected range in the visible document
- * @param length the length of the newly selected range in the visible document
- */
- protected void selectionChanged(int offset, int length) {
- if (redraws()) {
- IRegion r= widgetRange2ModelRange(new Region(offset, length));
- ISelection selection= r != null ? new TextSelection(getDocument(), r.getOffset(), r.getLength()) : TextSelection.emptySelection();
- SelectionChangedEvent event= new SelectionChangedEvent(this, selection);
- fireSelectionChanged(event);
- }
- }
-
- /**
- * Sends out a mark selection changed event to all registered listeners.
- *
- * @param offset the offset of the mark selection in the visible document, the offset is <code>-1</code> if the mark was cleared
- * @param length the length of the mark selection, may be negative if the caret is before the mark.
- * @since 2.0
- */
- protected void markChanged(int offset, int length) {
- if (redraws()) {
-
- if (offset != -1) {
- IRegion r= widgetRange2ModelRange(new Region(offset, length));
- offset= r.getOffset();
- length= r.getLength();
- }
-
- ISelection selection= new MarkSelection(getDocument(), offset, length);
- SelectionChangedEvent event= new SelectionChangedEvent(this, selection);
- fireSelectionChanged(event);
- }
- }
-
-
- //---- Text listeners
-
- /*
- * @see ITextViewer#addTextListener(ITextListener)
- */
- public void addTextListener(ITextListener listener) {
- if (fTextListeners == null)
- fTextListeners= new ArrayList();
-
- if (!fTextListeners.contains(listener))
- fTextListeners.add(listener);
- }
-
- /*
- * @see ITextViewer#removeTextListener(ITextListener)
- */
- public void removeTextListener(ITextListener listener) {
- if (fTextListeners != null) {
- fTextListeners.remove(listener);
- if (fTextListeners.size() == 0)
- fTextListeners= null;
- }
- }
-
- /**
- * Informs all registered text listeners about the change specified by the
- * widget command. This method does not use a robust iterator.
- *
- * @param cmd the widget command translated into a text event sent to all text listeners
- */
- protected void updateTextListeners(WidgetCommand cmd) {
-
- if (fTextListeners != null) {
-
- DocumentEvent event= cmd.event;
- if (event instanceof SlaveDocumentEvent)
- event= ((SlaveDocumentEvent) event).getMasterEvent();
-
- TextEvent e= new TextEvent(cmd.start, cmd.length, cmd.text, cmd.preservedText, event, redraws());
- for (int i= 0; i < fTextListeners.size(); i++) {
- ITextListener l= (ITextListener) fTextListeners.get(i);
- l.textChanged(e);
- }
- }
- }
-
- //---- Text input listeners
-
- /*
- * @see ITextViewer#addTextInputListener(ITextInputListener)
- */
- public void addTextInputListener(ITextInputListener listener) {
- if (fTextInputListeners == null)
- fTextInputListeners= new ArrayList();
-
- if (!fTextInputListeners.contains(listener))
- fTextInputListeners.add(listener);
- }
-
- /*
- * @see ITextViewer#removeTextInputListener(ITextInputListener)
- */
- public void removeTextInputListener(ITextInputListener listener) {
- if (fTextInputListeners != null) {
- fTextInputListeners.remove(listener);
- if (fTextInputListeners.size() == 0)
- fTextInputListeners= null;
- }
- }
-
- /**
- * Informs all registered text input listeners about the forthcoming input change,
- * This method does not use a robust iterator.
- *
- * @param oldInput the old input document
- * @param newInput the new input document
- */
- protected void fireInputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
- if (fTextInputListeners != null) {
- for (int i= 0; i < fTextInputListeners.size(); i++) {
- ITextInputListener l= (ITextInputListener) fTextInputListeners.get(i);
- l.inputDocumentAboutToBeChanged(oldInput, newInput);
- }
- }
- }
-
- /**
- * Informs all registered text input listeners about the sucessful input change,
- * This method does not use a robust iterator.
- *
- * @param oldInput the old input document
- * @param newInput the new input document
- */
- protected void fireInputDocumentChanged(IDocument oldInput, IDocument newInput) {
- if (fTextInputListeners != null) {
- for (int i= 0; i < fTextInputListeners.size(); i++) {
- ITextInputListener l= (ITextInputListener) fTextInputListeners.get(i);
- l.inputDocumentChanged(oldInput, newInput);
- }
- }
- }
-
- //---- Document
-
- /*
- * @see Viewer#getInput()
- */
- public Object getInput() {
- return getDocument();
- }
-
- /*
- * @see ITextViewer#getDocument()
- */
- public IDocument getDocument() {
- return fDocument;
- }
-
- /*
- * @see Viewer#setInput(Object)
- */
- public void setInput(Object input) {
-
- IDocument document= null;
- if (input instanceof IDocument)
- document= (IDocument) input;
-
- setDocument(document);
- }
-
- /*
- * @see ITextViewer#setDocument(IDocument)
- */
- public void setDocument(IDocument document) {
-
- fReplaceTextPresentation= true;
- fireInputDocumentAboutToBeChanged(fDocument, document);
-
- IDocument oldDocument= fDocument;
- fDocument= document;
-
- setVisibleDocument(fDocument);
-
- inputChanged(fDocument, oldDocument);
-
- fireInputDocumentChanged(oldDocument, fDocument);
- fReplaceTextPresentation= false;
- }
-
- /*
- * @see ITextViewer#setDocument(IDocument, int, int)
- */
- public void setDocument(IDocument document, int visibleRegionOffset, int visibleRegionLength) {
-
- fReplaceTextPresentation= true;
- fireInputDocumentAboutToBeChanged(fDocument, document);
-
- IDocument oldDocument= fDocument;
- fDocument= document;
-
- try {
-
- IDocument visibleDocument= createSlaveDocument(document);
- updateVisibleDocument(visibleDocument, visibleRegionOffset, visibleRegionLength);
- setVisibleDocument(visibleDocument);
-
- } catch (BadLocationException x) {
- throw new IllegalArgumentException(JFaceTextMessages.getString("TextViewer.error.invalid_visible_region_1")); //$NON-NLS-1$
- }
-
- inputChanged(fDocument, oldDocument);
-
- fireInputDocumentChanged(oldDocument, fDocument);
- fReplaceTextPresentation= false;
- }
-
- /**
- * Creates a slave document for the given document if there is a slave document manager
- * associated with this viewer.
- *
- * @param document the master document
- * @return the newly created slave document
- * @since 2.1
- */
- protected IDocument createSlaveDocument(IDocument document) {
- ISlaveDocumentManager manager= getSlaveDocumentManager();
- if (manager != null) {
- if (manager.isSlaveDocument(document))
- return document;
- return manager.createSlaveDocument(document);
- }
- return document;
- }
-
- /**
- * Sets the given slave document to the specified range of its master document.
- *
- * @param visibleDocument the slave document
- * @param visibleRegionOffset the offset of the master document range
- * @param visibleRegionLength the length of the master document range
- * @return <code>true</code> if the slave has been adapted successfully
- * @throws BadLocationException in case the specified range is not valid in the master document
- * @since 2.1
- */
- protected boolean updateVisibleDocument(IDocument visibleDocument, int visibleRegionOffset, int visibleRegionLength) throws BadLocationException {
- if (visibleDocument instanceof ChildDocument) {
- ChildDocument childDocument= (ChildDocument) visibleDocument;
-
- IDocument document= childDocument.getParentDocument();
- int line= document.getLineOfOffset(visibleRegionOffset);
- int offset= document.getLineOffset(line);
- int length= (visibleRegionOffset - offset) + visibleRegionLength;
-
- Position parentRange= childDocument.getParentDocumentRange();
- if (offset != parentRange.getOffset() || length != parentRange.getLength()) {
- childDocument.setParentDocumentRange(offset, length);
- return true;
- }
- }
- return false;
- }
-
-
- //---- Viewports
-
- /**
- * Initializes all listeners and structures required to set up viewport listeners.
- */
- private void initializeViewportUpdate() {
-
- if (fViewportGuard != null)
- return;
-
- if (fTextWidget != null) {
-
- fViewportGuard= new ViewportGuard();
- fLastTopPixel= -1;
-
- fTextWidget.addKeyListener(fViewportGuard);
- fTextWidget.addMouseListener(fViewportGuard);
-
- fScroller= fTextWidget.getVerticalBar();
- if (fScroller != null)
- fScroller.addSelectionListener(fViewportGuard);
- }
- }
-
- /**
- * Removes all listeners and structures required to set up viewport listeners.
- */
- private void removeViewPortUpdate() {
-
- if (fTextWidget != null) {
-
- fTextWidget.removeKeyListener(fViewportGuard);
- fTextWidget.removeMouseListener(fViewportGuard);
-
- if (fScroller != null && !fScroller.isDisposed()) {
- fScroller.removeSelectionListener(fViewportGuard);
- fScroller= null;
- }
-
- fViewportGuard= null;
- }
- }
-
- /*
- * @see ITextViewer#addViewportListener(IViewportListener)
- */
- public void addViewportListener(IViewportListener listener) {
-
- if (fViewportListeners == null) {
- fViewportListeners= new ArrayList();
- initializeViewportUpdate();
- }
-
- if (!fViewportListeners.contains(listener))
- fViewportListeners.add(listener);
- }
-
- /*
- * @see ITextViewer#removeViewportListener(IVewportListener)
- */
- public void removeViewportListener(IViewportListener listener) {
- if (fViewportListeners != null)
- fViewportListeners.remove(listener);
- }
-
- /**
- * Checks whether the viewport changed and if so informs all registered
- * listeners about the change.
- *
- * @param origin describes under which circumstances this method has been called.
- *
- * @see IViewportListener
- */
- protected void updateViewportListeners(int origin) {
-
- if (redraws()) {
- int topPixel= fTextWidget.getTopPixel();
- if (topPixel >= 0 && topPixel != fLastTopPixel) {
- if (fViewportListeners != null) {
- for (int i= 0; i < fViewportListeners.size(); i++) {
- IViewportListener l= (IViewportListener) fViewportListeners.get(i);
- l.viewportChanged(topPixel);
- }
- }
- fLastTopPixel= topPixel;
- }
- }
- }
-
- //---- scrolling and revealing
-
- /*
- * @see ITextViewer#getTopIndex()
- */
- public int getTopIndex() {
-
- if (fTextWidget != null) {
-
- int top= fTextWidget.getTopIndex();
- return widgetlLine2ModelLine(top);
- }
-
- return -1;
- }
-
- /*
- * @see ITextViewer#setTopIndex(int)
- */
- public void setTopIndex(int index) {
-
- if (fTextWidget != null) {
-
- int widgetLine= modelLine2WidgetLine(index);
- if (widgetLine == -1)
- widgetLine= getClosestWidgetLineForModelLine(index);
-
- if (widgetLine > -1) {
- fTextWidget.setTopIndex(widgetLine);
- updateViewportListeners(INTERNAL);
- }
- }
- }
-
- /**
- * Returns the viewport height in lines. The actual visible lines can be fewer if the
- * document is shorter than the viewport.
- *
- * @return the viewport height in lines
- */
- protected int getVisibleLinesInViewport() {
- if (fTextWidget != null) {
- Rectangle clArea= fTextWidget.getClientArea();
- if (!clArea.isEmpty())
- return clArea.height / fTextWidget.getLineHeight();
- }
- return -1;
- }
-
- /*
- * @see ITextViewer#getBottomIndex()
- */
- public int getBottomIndex() {
-
- if (fTextWidget == null)
- return -1;
-
- IRegion coverage= getModelCoverage();
-
- try {
-
- IDocument d= getDocument();
- int startLine= d.getLineOfOffset(coverage.getOffset());
- int endLine= d.getLineOfOffset(coverage.getOffset() + coverage.getLength() - 1);
- int lines= getVisibleLinesInViewport();
-
- if (startLine + lines < endLine) {
- int widgetTopIndex= fTextWidget.getTopIndex();
- int widgetBottomIndex= widgetTopIndex + lines -1;
- return widgetlLine2ModelLine(widgetBottomIndex);
- }
-
- return endLine;
-
- } catch (BadLocationException x) {
- if (TRACE_ERRORS)
- System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.getBottomIndex")); //$NON-NLS-1$
- }
-
- return -1;
- }
-
- /*
- * @see ITextViewer#getTopIndexStartOffset()
- */
- public int getTopIndexStartOffset() {
-
- if (fTextWidget != null) {
- int top= fTextWidget.getTopIndex();
- try {
- top= getVisibleDocument().getLineOffset(top);
- return widgetlLine2ModelLine(top);
- } catch (BadLocationException ex) {
- if (TRACE_ERRORS)
- System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.getTopIndexStartOffset")); //$NON-NLS-1$
- }
- }
-
- return -1;
- }
-
- /*
- * @see ITextViewer#getBottomIndexEndOffset()
- */
- public int getBottomIndexEndOffset() {
- try {
-
- IRegion line= getDocument().getLineInformation(getBottomIndex());
- int bottomEndOffset= line.getOffset() + line.getLength() - 1;
-
- IRegion coverage= getModelCoverage();
- int coverageEndOffset= coverage.getOffset() + coverage.getLength() - 1;
- return Math.min(coverageEndOffset, bottomEndOffset);
-
- } catch (BadLocationException ex) {
- if (TRACE_ERRORS)
- System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.getBottomIndexEndOffset")); //$NON-NLS-1$
- return getDocument().getLength() - 1;
- }
- }
-
- /*
- * @see ITextViewer#revealRange(int, int)
- */
- public void revealRange(int start, int length) {
-
- if (fTextWidget == null || !redraws())
- return;
-
- IRegion modelRange= new Region(start, length);
- IRegion widgetRange= modelRange2WidgetRange(modelRange);
- if (widgetRange != null) {
-
- int[] range= new int[] { widgetRange.getOffset(), widgetRange.getLength() };
- validateSelectionRange(range);
- if (range[0] >= 0)
- internalRevealRange(range[0], range[0] + range[1]);
-
- } else {
-
- IRegion coverage= getModelCoverage();
- int cursor= start < coverage.getOffset() ? 0 : getVisibleDocument().getLength();
- internalRevealRange(cursor, cursor);
- }
- }
-
- /**
- * Reveals the given range of the visible document.
- *
- * @param start the start offset of the range
- * @param end the end offset of the range
- */
- protected void internalRevealRange(int start, int end) {
-
- try {
-
- IDocument doc= getVisibleDocument();
-
- int startLine= doc.getLineOfOffset(start);
- int endLine= doc.getLineOfOffset(end);
-
- int top= fTextWidget.getTopIndex();
- if (top > -1) {
-
- // scroll vertically
-
- int lines= getVisibleLinesInViewport();
- int bottom= top + lines;
-
- // two lines at the top and the bottom should always be left
- // if window is smaller than 5 lines, always center position is chosen
- int bufferZone= 2;
-
- if (startLine >= top + bufferZone
- && startLine <= bottom - bufferZone
- && endLine >= top + bufferZone
- && endLine <= bottom - bufferZone) {
-
- // do not scroll at all as it is already visible
-
- } else {
-
- int delta= Math.max(0, lines - (endLine - startLine));
- fTextWidget.setTopIndex(startLine - delta/3);
- updateViewportListeners(INTERNAL);
- }
-
- // scroll horizontally
-
- if (endLine < startLine) {
- endLine += startLine;
- startLine= endLine - startLine;
- endLine -= startLine;
- }
-
- int startPixel= -1;
- int endPixel= -1;
-
- if (endLine > startLine) {
- // reveal the beginning of the range in the start line
- IRegion extent= getExtent(start, start);
- startPixel= extent.getOffset() + fTextWidget.getHorizontalPixel();
- endPixel= startPixel;
-
- } else {
- IRegion extent= getExtent(start, end);
- startPixel= extent.getOffset() + fTextWidget.getHorizontalPixel();;
- endPixel= startPixel + extent.getLength();
- }
-
- int visibleStart= fTextWidget.getHorizontalPixel();
- int visibleEnd= visibleStart + fTextWidget.getClientArea().width;
-
- // scroll only if not yet visible
- if (startPixel < visibleStart || visibleEnd < endPixel) {
-
- // set buffer zone to 10 pixels
- bufferZone= 10;
-
- int newOffset= visibleStart;
-
- int visibleWidth= visibleEnd - visibleStart;
- int selectionPixelWidth= endPixel - startPixel;
-
- if (startPixel < visibleStart)
- newOffset= startPixel;
- else if (selectionPixelWidth + bufferZone < visibleWidth)
- newOffset= endPixel + bufferZone - visibleWidth;
- else
- newOffset= startPixel;
-
- float index= ((float)newOffset) / ((float)getAverageCharWidth());
-
- fTextWidget.setHorizontalIndex(Math.round(index));
- }
-
- }
- } catch (BadLocationException e) {
- throw new IllegalArgumentException(JFaceTextMessages.getString("TextViewer.error.invalid_range")); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns the width of the text when being drawed into this viewer's widget.
- *
- * @param the string to messure
- * @return the width of the presentation of the given string
- * @deprecated use <code>getWidthInPixels(int, int)</code> instead
- */
- final protected int getWidthInPixels(String text) {
- GC gc= new GC(fTextWidget);
- gc.setFont(fTextWidget.getFont());
- Point extent= gc.textExtent(text);
- gc.dispose();
- return extent.x;
- }
-
- /**
- * Returns the region covered by the given start and end offset.
- * The result is relative to the upper left corner of the widget
- * client area.
- *
- * @param start offset relative to the start of this viewer's viewport
- * 0 <= offset <= getCharCount()
- * @param end offset relative to the start of this viewer's viewport
- * 0 <= offset <= getCharCount()
- * @return the region covered by start and end offset
- */
- final protected IRegion getExtent(int start, int end) {
- Point left= fTextWidget.getLocationAtOffset(start);
- Point right= new Point(left.x, left.y);
-
- for (int i= start +1; i <= end; i++) {
-
- Point p= fTextWidget.getLocationAtOffset(i);
-
- if (left.x > p.x)
- left.x= p.x;
-
- if (right.x < p.x)
- right.x= p.x;
- }
-
- return new Region(left.x, right.x - left.x);
- }
-
- /**
- * Returns the width of the representation of a text range in the
- * visible region of the viewer's document as drawn in this viewer's
- * widget.
- *
- * @param offset the offset of the text range in the visible region
- * @param length the length of the text range in the visible region
- * @return the width of the presentation of the specified text range
- * @since 2.0
- */
- final protected int getWidthInPixels(int offset, int length) {
-
- Point left= fTextWidget.getLocationAtOffset(offset);
- Point right= new Point(left.x, left.y);
-
- int end= offset + length;
- for (int i= offset +1; i <= end; i++) {
-
- Point p= fTextWidget.getLocationAtOffset(i);
-
- if (left.x > p.x)
- left.x= p.x;
-
- if (right.x < p.x)
- right.x= p.x;
- }
-
- return right.x - left.x;
- }
-
- /**
- * Returns the average character width of this viewer's widget.
- *
- * @return the average character width of this viewer's widget
- */
- final protected int getAverageCharWidth() {
- GC gc= new GC(fTextWidget);
- gc.setFont(fTextWidget.getFont());
- int increment= gc.getFontMetrics().getAverageCharWidth();
- gc.dispose();
- return increment;
- }
-
- /*
- * @see Viewer#refresh()
- */
- public void refresh() {
- setDocument(getDocument());
- }
-
- //---- visible range support
-
- /**
- * Returns the slave document manager
- *
- * @return the slave document manager
- * @since 2.1
- */
- protected ISlaveDocumentManager getSlaveDocumentManager() {
- if (fSlaveDocumentManager == null)
- fSlaveDocumentManager= createSlaveDocumentManager();
- return fSlaveDocumentManager;
- }
-
- /**
- * Creates a new slave document manager. This implementation always
- * returns a <code>ChildDocumentManager</code>.
- *
- * @return ISlaveDocumentManager
- * @since 2.1
- */
- protected ISlaveDocumentManager createSlaveDocumentManager() {
- return new ChildDocumentManager();
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewer#invalidateTextPresentation()
- */
- public final void invalidateTextPresentation() {
- if (fVisibleDocument != null) {
- fWidgetCommand.event= null;
- fWidgetCommand.start= 0;
- fWidgetCommand.length= fVisibleDocument.getLength();
- fWidgetCommand.text= fVisibleDocument.get();
- updateTextListeners(fWidgetCommand);
- }
- }
-
- /**
- * Invalidates the given range of the text presentation.
- *
- * @param offset the offset of the range to be invalidated
- * @param length the length of the range to be invalidated
- * @since 2.1
- */
- public final void invalidateTextPresentation(int offset, int length) {
- if (fVisibleDocument != null) {
-
- IRegion widgetRange= modelRange2WidgetRange(new Region(offset, length));
- if (widgetRange != null) {
-
- fWidgetCommand.event= null;
- fWidgetCommand.start= widgetRange.getOffset();
- fWidgetCommand.length= widgetRange.getLength();
-
- try {
- fWidgetCommand.text= fVisibleDocument.get(widgetRange.getOffset(), widgetRange.getLength());
- updateTextListeners(fWidgetCommand);
- } catch (BadLocationException x) {
- // can not happen because of previous checking
- }
- }
- }
- }
-
- /**
- * Initializes the text widget with the visual document and
- * invalidates the overall presentation.
- */
- private void initializeWidgetContents() {
-
- if (fTextWidget != null && fVisibleDocument != null) {
-
- // set widget content
- if (fDocumentAdapter == null)
- fDocumentAdapter= createDocumentAdapter();
-
- fDocumentAdapter.setDocument(fVisibleDocument);
- fTextWidget.setContent(fDocumentAdapter);
-
- // invalidate presentation
- invalidateTextPresentation();
- }
- }
-
- /**
- * Sets this viewer's visible document. The visible document represents the
- * visible region of the viewer's input document.
- *
- * @param document the visible document
- */
- protected void setVisibleDocument(IDocument document) {
-
- if (fVisibleDocument != null && fDocumentListener != null)
- fVisibleDocument.removeDocumentListener(fDocumentListener);
-
- fVisibleDocument= document;
- initializeDocumentInformationMapping(fVisibleDocument);
-
- initializeWidgetContents();
- resetPlugins();
-
- if (fVisibleDocument != null && fDocumentListener != null)
- fVisibleDocument.addDocumentListener(fDocumentListener);
- }
-
- /**
- * Initializes the document information mapping between the given slave document and
- * its master document.
- *
- * @param visibleDocument the slave document
- * @since 2.1
- */
- protected void initializeDocumentInformationMapping(IDocument visibleDocument) {
- ISlaveDocumentManager manager= getSlaveDocumentManager();
- fInformationMapping= manager == null ? null : manager.createMasterSlaveMapping(visibleDocument);
- }
-
- /**
- * Returns the viewer's visible document.
- *
- * @return the viewer's visible document
- */
- protected IDocument getVisibleDocument() {
- return fVisibleDocument;
- }
-
- /**
- * Returns the offset of the visible region.
- *
- * @return the offset of the visible region
- */
- protected int _getVisibleRegionOffset() {
-
- IDocument document= getVisibleDocument();
- if (document instanceof ChildDocument) {
- ChildDocument cdoc= (ChildDocument) document;
- return cdoc.getParentDocumentRange().getOffset();
- }
-
- return 0;
- }
-
- /*
- * @see ITextViewer#getVisibleRegion()
- */
- public IRegion getVisibleRegion() {
-
- IDocument document= getVisibleDocument();
- if (document instanceof ChildDocument) {
- Position p= ((ChildDocument) document).getParentDocumentRange();
- return new Region(p.getOffset(), p.getLength());
- }
-
- return new Region(0, document == null ? 0 : document.getLength());
- }
-
- /*
- * @see ITextViewer#overlapsWithVisibleRegion(int, int)
- */
- public boolean overlapsWithVisibleRegion(int start, int length) {
- IDocument document= getVisibleDocument();
- if (document instanceof ChildDocument) {
- ChildDocument cdoc= (ChildDocument) document;
- return cdoc.getParentDocumentRange().overlapsWith(start, length);
- } else if (document != null) {
- int size= document.getLength();
- return (start >= 0 && length >= 0 && start + length <= size);
- }
- return false;
- }
-
- /*
- * @see ITextViewer#setVisibleRegion(int, int)
- */
- public void setVisibleRegion(int start, int length) {
-
- IRegion region= getVisibleRegion();
- if (start == region.getOffset() && length == region.getLength()) {
- // nothing to change
- return;
- }
-
- try {
- IDocument visibleDocument= createSlaveDocument(getVisibleDocument());
- if (updateVisibleDocument(visibleDocument, start, length))
- setVisibleDocument(visibleDocument);
- } catch (BadLocationException x) {
- throw new IllegalArgumentException(JFaceTextMessages.getString("TextViewer.error.invalid_visible_region_2")); //$NON-NLS-1$
- }
- }
-
- /*
- * @see ITextViewer#resetVisibleRegion()
- */
- public void resetVisibleRegion() {
- ISlaveDocumentManager manager= getSlaveDocumentManager();
- if (manager != null) {
- IDocument slave= getVisibleDocument();
- IDocument master= manager.getMasterDocument(slave);
- if (master != null) {
- setVisibleDocument(master);
- manager.freeSlaveDocument(slave);
- }
- }
- }
-
-
- //--------------------------------------
-
- /*
- * @see ITextViewer#setTextDoubleClickStrategy(ITextDoubleClickStrategy, String)
- */
- public void setTextDoubleClickStrategy(ITextDoubleClickStrategy strategy, String contentType) {
-
- if (strategy != null) {
- if (fDoubleClickStrategies == null)
- fDoubleClickStrategies= new HashMap();
- fDoubleClickStrategies.put(contentType, strategy);
- } else if (fDoubleClickStrategies != null)
- fDoubleClickStrategies.remove(contentType);
- }
-
- /**
- * Selects from the given map the one which is registered under
- * the content type of the partition in which the given offset is located.
- *
- * @param plugins the map from which to choose
- * @param offset the offset for which to find the plugin
- * @return the plugin registered under the offset's content type
- */
- protected Object selectContentTypePlugin(int offset, Map plugins) {
- try {
- return selectContentTypePlugin(getDocument().getContentType(offset), plugins);
- } catch (BadLocationException x) {
- if (TRACE_ERRORS)
- System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.selectContentTypePlugin")); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * Selects from the given <code>plugins</code> this one which is registered for
- * the given content <code>type</code>.
- *
- * @param type the type to be used as lookup key
- * @param plugins the table to be searched
- */
- private Object selectContentTypePlugin(String type, Map plugins) {
-
- if (plugins == null)
- return null;
-
- return plugins.get(type);
- }
-
- /**
- * Hook called on receipt of a <code>VerifyEvent</code>. The event has
- * been translated into a <code>DocumentCommand</code> which can now be
- * manipulated by interested parties. By default, the hook forwards the command
- * to the installed instances of <code>IAutoEditStrategy</code>.
- *
- * @param command the document command representing the verify event
- */
- protected void customizeDocumentCommand(DocumentCommand command) {
- if (isIgnoringAutoEditStrategies())
- return;
-
- List strategies= (List) selectContentTypePlugin(command.offset, fAutoIndentStrategies);
- if (strategies == null)
- return;
-
- switch (strategies.size()) {
- // optimizations
- case 0:
- break;
-
- case 1:
- ((IAutoEditStrategy) strategies.iterator().next()).customizeDocumentCommand(getDocument(), command);
- break;
-
- // make iterator robust against adding/removing strategies from within strategies
- default:
- strategies= new ArrayList(strategies);
-
- IDocument document= getDocument();
- for (final Iterator iterator= strategies.iterator(); iterator.hasNext(); )
- ((IAutoEditStrategy) iterator.next()).customizeDocumentCommand(document, command);
-
- break;
- }
- }
-
- /**
- * @see VerifyListener#verifyText(VerifyEvent)
- */
- protected void handleVerifyEvent(VerifyEvent e) {
-
- if (fEventConsumer != null) {
- fEventConsumer.processEvent(e);
- if (!e.doit)
- return;
- }
-
- IRegion modelRange= event2ModelRange(e);
- fDocumentCommand.setEvent(e, modelRange);
- customizeDocumentCommand(fDocumentCommand);
- if (!fDocumentCommand.fillEvent(e, modelRange)) {
-
- boolean compoundChange= fDocumentCommand.getCommandCount() > 1;
- try {
-
- fVerifyListener.forward(false);
-
- if (compoundChange && fUndoManager != null)
- fUndoManager.beginCompoundChange();
-
- if (fSlaveDocumentManager != null) {
- IDocument visible= getVisibleDocument();
- try {
- fSlaveDocumentManager.setAutoExpandMode(visible, true);
- fDocumentCommand.execute(getDocument());
- } finally {
- fSlaveDocumentManager.setAutoExpandMode(visible, false);
- }
- } else {
- fDocumentCommand.execute(getDocument());
- }
-
- if (fTextWidget != null) {
- int documentCaret= fDocumentCommand.caretOffset;
- if (documentCaret == -1) {
- // old behaviour of document command
- documentCaret= fDocumentCommand.offset + (fDocumentCommand.text == null ? 0 : fDocumentCommand.text.length());
- }
-
- int widgetCaret= modelOffset2WidgetOffset(documentCaret);
- if (widgetCaret == -1) {
- // try to move it to the closest spot
- IRegion region= getModelCoverage();
- if (documentCaret <= region.getOffset())
- widgetCaret= 0;
- else if (documentCaret >= region.getOffset() + region.getLength())
- widgetCaret= getVisibleRegion().getLength();
- }
-
- if (widgetCaret != -1) {
- // there is a valid widget caret
- fTextWidget.setCaretOffset(widgetCaret);
- }
-
- fTextWidget.showSelection();
- }
- } catch (BadLocationException x) {
-
- if (TRACE_ERRORS)
- System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.verifyText")); //$NON-NLS-1$
-
- } finally {
-
- if (compoundChange && fUndoManager != null)
- fUndoManager.endCompoundChange();
-
- fVerifyListener.forward(true);
-
- }
- }
- }
-
- //---- text manipulation
-
- /**
- * Returns whether the marked region of this viewer is empty.
- *
- * @return <code>true</code> if the marked region of this viewer is empty, otherwise <code>false</code>
- * @since 2.0
- */
- private boolean isMarkedRegionEmpty() {
- return
- fTextWidget == null ||
- fMarkPosition == null ||
- fMarkPosition.isDeleted() ||
- modelRange2WidgetRange(fMarkPosition) == null;
- }
-
- /*
- * @see ITextViewer#canDoOperation(int)
- */
- public boolean canDoOperation(int operation) {
-
- if (fTextWidget == null || !redraws())
- return false;
-
- switch (operation) {
- case CUT:
- return isEditable() &&(fTextWidget.getSelectionCount() > 0 || !isMarkedRegionEmpty());
- case COPY:
- return fTextWidget.getSelectionCount() > 0 || !isMarkedRegionEmpty();
- case DELETE:
- case PASTE:
- return isEditable();
- case SELECT_ALL:
- return true;
- case SHIFT_RIGHT:
- case SHIFT_LEFT:
- return isEditable() && fIndentChars != null && areMultipleLinesSelected();
- case PREFIX:
- case STRIP_PREFIX:
- return isEditable() && fDefaultPrefixChars != null;
- case UNDO:
- return fUndoManager != null && fUndoManager.undoable();
- case REDO:
- return fUndoManager != null && fUndoManager.redoable();
- case PRINT:
- return isPrintable();
- }
-
- return false;
- }
-
- /*
- * @see ITextViewer#doOperation(int)
- */
- public void doOperation(int operation) {
-
- if (fTextWidget == null || !redraws())
- return;
-
- switch (operation) {
-
- case UNDO:
- if (fUndoManager != null) {
- ignoreAutoEditStrategies(true);
- fUndoManager.undo();
- ignoreAutoEditStrategies(false);
- }
- break;
- case REDO:
- if (fUndoManager != null) {
- ignoreAutoEditStrategies(true);
- fUndoManager.redo();
- ignoreAutoEditStrategies(false);
- }
- break;
- case CUT:
- if (fTextWidget.getSelectionCount() == 0)
- copyMarkedRegion(true);
- else
- fTextWidget.cut();
- break;
- case COPY:
- if (fTextWidget.getSelectionCount() == 0)
- copyMarkedRegion(false);
- else
- fTextWidget.copy();
- break;
- case PASTE:
-// ignoreAutoEditStrategies(true);
- fTextWidget.paste();
-// ignoreAutoEditStrategies(false);
- break;
- case DELETE:
- deleteText();
- break;
- case SELECT_ALL: {
- if (getDocument() != null)
- setSelectedRange(0, getDocument().getLength());
- break;
- }
- case SHIFT_RIGHT:
- shift(false, true, false);
- break;
- case SHIFT_LEFT:
- shift(false, false, false);
- break;
- case PREFIX:
- shift(true, true, true);
- break;
- case STRIP_PREFIX:
- shift(true, false, true);
- break;
- case PRINT:
- print();
- break;
- }
- }
-
- /**
- * Tells this viewer whether the registered auto edit strategies should be ignored.
- *
- * @param ignore <code>true</code> if the strategies should be ignored.
- * @since 2.1
- */
- protected void ignoreAutoEditStrategies(boolean ignore) {
-
- fIgnoreAutoIndent= ignore;
-
- IDocument document= getDocument();
- if (document instanceof IDocumentExtension2) {
- IDocumentExtension2 extension= (IDocumentExtension2) document;
- if (ignore)
- extension.ignorePostNotificationReplaces();
- else
- extension.acceptPostNotificationReplaces();
- }
- }
-
- /**
- * Returns whether this viewer ignores the registered auto edit strategies.
- *
- * @return <code>true</code> if the strategies are ignored
- * @since 2.1
- */
- protected boolean isIgnoringAutoEditStrategies() {
- return fIgnoreAutoIndent;
- }
-
- /*
- * @see ITextOperationTargetExtension#enableOperation(int, boolean)
- * @since 2.0
- */
- public void enableOperation(int operation, boolean enable) {
- /*
- * No-op by default.
- * Will be changed to regularily disable the known operations.
- */
- }
-
- /**
- * Copies/cuts the marked region.
- *
- * @param delete <code>true</code> if the region should be deleted rather than copied.
- * @since 2.0
- */
- private void copyMarkedRegion(boolean delete) {
-
- if (fTextWidget == null)
- return;
-
- if (fMarkPosition == null || fMarkPosition.isDeleted() || modelRange2WidgetRange(fMarkPosition) == null)
- return;
-
- int widgetMarkOffset= modelOffset2WidgetOffset(fMarkPosition.offset);
- Point selection= fTextWidget.getSelection();
- if (selection.x <= widgetMarkOffset)
- fTextWidget.setSelection(selection.x, widgetMarkOffset);
- else
- fTextWidget.setSelection(widgetMarkOffset, selection.x);
-
- if (delete) {
- fTextWidget.cut();
- } else {
- fTextWidget.copy();
- fTextWidget.setSelection(selection.x); // restore old cursor position
- }
- }
-
- /**
- * Deletes the current selection. If the selection has the length 0
- * the selection is automatically extended to the right - either by 1
- * or by the length of line delimiter if at the end of a line.
- *
- * @deprecated use <code>StyledText.invokeAction</code> instead
- */
- protected void deleteText() {
- fTextWidget.invokeAction(ST.DELETE_NEXT);
- }
-
- /**
- * A block is selected if the character preceding the start of the
- * selection is a new line character.
- *
- * @return <code>true</code> if a block is selected
- */
- protected boolean isBlockSelected() {
-
- Point s= getSelectedRange();
- if (s.y == 0)
- return false;
-
- try {
-
- IDocument document= getDocument();
- int line= document.getLineOfOffset(s.x);
- int start= document.getLineOffset(line);
- return (s.x == start);
-
- } catch (BadLocationException x) {
- }
-
- return false;
- }
-
- /**
- * Returns <code>true</code> if one line is completely selected or if multiple lines are selected.
- * Being completely selected means that all characters except the new line characters are
- * selected.
- *
- * @return <code>true</code> if one or multiple lines are selected
- * @since 2.0
- */
- protected boolean areMultipleLinesSelected() {
- Point s= getSelectedRange();
- if (s.y == 0)
- return false;
-
- try {
-
- IDocument document= getDocument();
- int startLine= document.getLineOfOffset(s.x);
- int endLine= document.getLineOfOffset(s.x + s.y);
- IRegion line= document.getLineInformation(startLine);
- return startLine != endLine || (s.x == line.getOffset() && s.y == line.getLength());
-
- } catch (BadLocationException x) {
- }
-
- return false;
- }
-
- /**
- * Returns the index of the first line whose start offset is in the given text range.
- *
- * @param region the text range in characters where to find the line
- * @return the first line whose start index is in the given range, -1 if there is no such line
- */
- private int getFirstCompleteLineOfRegion(IRegion region) {
-
- try {
-
- IDocument d= getDocument();
-
- int startLine= d.getLineOfOffset(region.getOffset());
-
- int offset= d.getLineOffset(startLine);
- if (offset >= region.getOffset())
- return startLine;
-
- offset= d.getLineOffset(startLine + 1);
- return (offset > region.getOffset() + region.getLength() ? -1 : startLine + 1);
-
- } catch (BadLocationException x) {
- if (TRACE_ERRORS)
- System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.getFirstCompleteLineOfRegion")); //$NON-NLS-1$
- }
-
- return -1;
- }
-
-
- /**
- * Creates a region describing the text block (something that starts at
- * the beginning of a line) completely containing the current selection.
- *
- * @param selection the selection to use
- * @return the region describing the text block comprising the given selection
- * @since 2.0
- */
- private IRegion getTextBlockFromSelection(Point selection) {
-
- try {
- IDocument document= getDocument();
- IRegion line= document.getLineInformationOfOffset(selection.x);
- int length= selection.y == 0 ? line.getLength() : selection.y + (selection.x - line.getOffset());
- return new Region(line.getOffset(), length);
-
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
- /**
- * Shifts a text block to the right or left using the specified set of prefix characters.
- * The prefixes must start at the beginnig of the line.
- *
- * @param useDefaultPrefixes says whether the configured default or indent prefixes should be used
- * @param right says whether to shift to the right or the left
- *
- * @deprecated use shift(boolean, boolean, boolean) instead
- */
- protected void shift(boolean useDefaultPrefixes, boolean right) {
- shift(useDefaultPrefixes, right, false);
- }
-
- /**
- * Shifts a text block to the right or left using the specified set of prefix characters.
- * If white space should be ignored the prefix characters must not be at the beginning of
- * the line when shifting to the left. There may be whitespace in front of the prefixes.
- *
- * @param useDefaultPrefixes says whether the configured default or indent prefixes should be used
- * @param right says whether to shift to the right or the left
- * @param ignoreWhitespace says whether whitepsace in front of prefixes is allowed
- * @since 2.0
- */
- protected void shift(boolean useDefaultPrefixes, boolean right, boolean ignoreWhitespace) {
-
- if (fUndoManager != null)
- fUndoManager.beginCompoundChange();
-
- setRedraw(false);
- startSequentialRewriteMode(true);
-
- IDocument d= getDocument();
- IDocumentPartitioner partitioner= null;
-
- try {
-
- Point selection= getSelectedRange();
- IRegion block= getTextBlockFromSelection(selection);
- ITypedRegion[] regions= d.computePartitioning(block.getOffset(), block.getLength());
-
- int lineCount= 0;
- int[] lines= new int[regions.length * 2]; // [startline, endline, startline, endline, ...]
- for (int i= 0, j= 0; i < regions.length; i++, j+= 2) {
- // start line of region
- lines[j]= getFirstCompleteLineOfRegion(regions[i]);
- // end line of region
- int offset= regions[i].getOffset() + regions[i].getLength() - 1;
- lines[j + 1]= (lines[j] == -1 ? -1 : d.getLineOfOffset(offset));
- lineCount += lines[j + 1] - lines[j] + 1;
- }
-
- if (lineCount >= 20) {
- partitioner= d.getDocumentPartitioner();
- if (partitioner != null) {
- partitioner.disconnect();
- d.setDocumentPartitioner(null);
- }
- }
-
- // Remember the selection range.
- IPositionUpdater positionUpdater= new ShiftPositionUpdater(SHIFTING);
- Position rememberedSelection= new Position(selection.x, selection.y);
- d.addPositionCategory(SHIFTING);
- d.addPositionUpdater(positionUpdater);
- try {
- d.addPosition(SHIFTING, rememberedSelection);
- } catch (BadPositionCategoryException ex) {
- // should not happen
- }
-
- // Perform the shift operation.
- Map map= (useDefaultPrefixes ? fDefaultPrefixChars : fIndentChars);
- for (int i= 0, j= 0; i < regions.length; i++, j += 2) {
- String[] prefixes= (String[]) selectContentTypePlugin(regions[i].getType(), map);
- if (prefixes != null && prefixes.length > 0 && lines[j] >= 0 && lines[j + 1] >= 0) {
- if (right)
- shiftRight(lines[j], lines[j + 1], prefixes[0]);
- else
- shiftLeft(lines[j], lines[j + 1], prefixes, ignoreWhitespace);
- }
- }
-
- // Restore the selection.
- setSelectedRange(rememberedSelection.getOffset(), rememberedSelection.getLength());
-
- try {
- d.removePositionUpdater(positionUpdater);
- d.removePositionCategory(SHIFTING);
- } catch (BadPositionCategoryException ex) {
- // should not happen
- }
-
- } catch (BadLocationException x) {
- if (TRACE_ERRORS)
- System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.shift_1")); //$NON-NLS-1$
-
- } finally {
-
- if (partitioner != null) {
- partitioner.connect(d);
- d.setDocumentPartitioner(partitioner);
- }
-
- stopSequentialRewriteMode();
- setRedraw(true);
-
- if (fUndoManager != null)
- fUndoManager.endCompoundChange();
- }
- }
-
- /**
- * Shifts the specified lines to the right inserting the given prefix
- * at the beginning of each line
- *
- * @param prefix the prefix to be inserted
- * @param startLine the first line to shift
- * @param endLine the last line to shift
- * @since 2.0
- */
- private void shiftRight(int startLine, int endLine, String prefix) {
-
- try {
-
- IDocument d= getDocument();
- while (startLine <= endLine) {
- d.replace(d.getLineOffset(startLine++), 0, prefix);
- }
-
- } catch (BadLocationException x) {
- if (TRACE_ERRORS)
- System.out.println("TextViewer.shiftRight: BadLocationException"); //$NON-NLS-1$
- }
- }
-
- /**
- * Shifts the specified lines to the right or to the left. On shifting to the right
- * it insert <code>prefixes[0]</code> at the beginning of each line. On shifting to the
- * left it tests whether each of the specified lines starts with one of the specified
- * prefixes and if so, removes the prefix.
- *
- * @param prefixes the prefixes to be used for shifting
- * @param right if <code>true</code> shift to the right otherwise to the left
- * @param startLine the first line to shift
- * @param endLine the last line to shift
- * @since 2.0
- */
- private void shiftLeft(int startLine, int endLine, String[] prefixes, boolean ignoreWhitespace) {
-
- IDocument d= getDocument();
-
- try {
-
- IRegion[] occurrences= new IRegion[endLine - startLine + 1];
-
- // find all the first occurrences of prefix in the given lines
- for (int i= 0; i < occurrences.length; i++) {
-
- IRegion line= d.getLineInformation(startLine + i);
- String text= d.get(line.getOffset(), line.getLength());
-
- int index= -1;
- int[] found= TextUtilities.indexOf(prefixes, text, 0);
- if (found[0] != -1) {
- if (ignoreWhitespace) {
- String s= d.get(line.getOffset(), found[0]);
- s= s.trim();
- if (s.length() == 0)
- index= line.getOffset() + found[0];
- } else if (found[0] == 0)
- index= line.getOffset();
- }
-
- if (index > -1) {
- // remember where prefix is in line, so that it can be removed
- int length= prefixes[found[1]].length();
- if (length == 0 && !ignoreWhitespace && line.getLength() > 0) {
- // found a non-empty line which cannot be shifted
- return;
- } else
- occurrences[i]= new Region(index, length);
- } else {
- // found a line which cannot be shifted
- return;
- }
- }
-
- // ok - change the document
- int decrement= 0;
- for (int i= 0; i < occurrences.length; i++) {
- IRegion r= occurrences[i];
- d.replace(r.getOffset() - decrement, r.getLength(), ""); //$NON-NLS-1$
- decrement += r.getLength();
- }
-
- } catch (BadLocationException x) {
- if (TRACE_ERRORS)
- System.out.println("TextViewer.shiftLeft: BadLocationException"); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns whether the shown text can be printed.
- *
- * @return the viewer's printable mode
- */
- protected boolean isPrintable() {
- /*
- * 1GK7Q10: ITPUI:WIN98 - internal error after invoking print at editor view
- * Changed from returning true to testing the length of the printer queue
- */
- PrinterData[] printerList= Printer.getPrinterList();
- return (printerList != null && printerList.length > 0);
- }
-
- /**
- * Brings up a print dialog and calls <code>printContents(Printer)</code> which
- * performs the actual print.
- */
- protected void print() {
-
- final PrintDialog dialog= new PrintDialog(fTextWidget.getShell(), SWT.PRIMARY_MODAL);
- final PrinterData data= dialog.open();
-
- if (data != null) {
-
- final Printer printer= new Printer(data);
- final Runnable styledTextPrinter= fTextWidget.print(printer);
-
- Thread printingThread= new Thread("Printing") { //$NON-NLS-1$
- public void run() {
- styledTextPrinter.run();
- printer.dispose();
- }
- };
- printingThread.start();
- }
- }
-
-
- //------ find support
-
- /**
- * @see IFindReplaceTarget#canPerformFind
- */
- protected boolean canPerformFind() {
- IDocument d= getVisibleDocument();
- return (fTextWidget != null && d != null && d.getLength() > 0);
- }
-
- /**
- * @see IFindReplaceTarget#findAndSelect(int, String, boolean, boolean, boolean)
- */
- protected int findAndSelect(int startPosition, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord) {
- if (fTextWidget == null)
- return -1;
-
- try {
-
- int widgetOffset= (startPosition == -1 ? startPosition : modelOffset2WidgetOffset(startPosition));
- int widgetPos= getVisibleDocument().search(widgetOffset, findString, forwardSearch, caseSensitive, wholeWord);
- if (widgetPos > -1) {
-
- int length= findString.length();
- if (redraws()) {
- fTextWidget.setSelectionRange(widgetPos, length);
- internalRevealRange(widgetPos, widgetPos + length);
- selectionChanged(widgetPos, length);
- } else {
- setSelectedRange(widgetOffset2ModelOffset(widgetPos), length);
- }
-
- return widgetOffset2ModelOffset(widgetPos);
- }
-
- } catch (BadLocationException x) {
- if (TRACE_ERRORS)
- System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.findAndSelect")); //$NON-NLS-1$
- }
-
- return -1;
- }
-
- /**
- * @see IFindReplaceTarget#findAndSelect(int, String, boolean, boolean, boolean)
- * @since 2.0
- */
- private int findAndSelectInRange(int startPosition, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord, int rangeOffset, int rangeLength) {
- if (fTextWidget == null)
- return -1;
-
- try {
-
- int modelOffset;
- if (forwardSearch && (startPosition == -1 || startPosition < rangeOffset)) {
- modelOffset= rangeOffset;
- } else if (!forwardSearch && (startPosition == -1 || startPosition > rangeOffset + rangeLength)) {
- modelOffset= rangeOffset + rangeLength;
- } else {
- modelOffset= startPosition;
- }
-
- int widgetOffset= modelOffset2WidgetOffset(modelOffset);
- if (widgetOffset == -1)
- return -1;
-
- int widgetPos= getVisibleDocument().search(widgetOffset, findString, forwardSearch, caseSensitive, wholeWord);
- int modelPos= widgetPos == -1 ? -1 : widgetOffset2ModelOffset(widgetPos);
-
- int length = findString.length();
- if (widgetPos != -1 && (modelPos < rangeOffset || modelPos + length > rangeOffset + rangeLength))
- widgetPos= -1;
-
- if (widgetPos > -1) {
-
- if (redraws()) {
- fTextWidget.setSelectionRange(widgetPos, length);
- internalRevealRange(widgetPos, widgetPos + length);
- selectionChanged(widgetPos, length);
- } else {
- setSelectedRange(modelPos, length);
- }
-
- return modelPos;
- }
-
-
- } catch (BadLocationException x) {
- if (TRACE_ERRORS)
- System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.findAndSelect")); //$NON-NLS-1$
- }
-
- return -1;
- }
-
- //---------- text presentation support
-
- /*
- * @see ITextViewer#setTextColor(Color)
- */
- public void setTextColor(Color color) {
- if (color != null)
- setTextColor(color, 0, getDocument().getLength(), true);
- }
-
- /*
- * @see ITextViewer#setTextColor(Color, start, length, boolean)
- */
- public void setTextColor(Color color, int start, int length, boolean controlRedraw) {
-
- if (fTextWidget != null) {
-
- if (controlRedraw)
- fTextWidget.setRedraw(false);
-
- StyleRange s= new StyleRange();
- s.foreground= color;
- s.start= start;
- s.length= length;
-
- s= modelStyleRange2WidgetStyleRange(s);
- if (s != null) {
-
- if (controlRedraw)
- fTextWidget.setRedraw(false);
-
- fTextWidget.setStyleRange(s);
-
- if (controlRedraw)
- fTextWidget.setRedraw(true);
- }
- }
- }
-
- /**
- * Adds the given presentation to the viewer's style information.
- *
- * @param presentation the presentation to be added
- */
- private void addPresentation(TextPresentation presentation) {
-
- StyleRange range= presentation.getDefaultStyleRange();
- if (range != null) {
-
- range= modelStyleRange2WidgetStyleRange(range);
- if (range != null)
- fTextWidget.setStyleRange(range);
-
- Iterator e= presentation.getNonDefaultStyleRangeIterator();
- while (e.hasNext()) {
- range= (StyleRange) e.next();
- range= modelStyleRange2WidgetStyleRange(range);
- if (range != null)
- fTextWidget.setStyleRange(range);
- }
-
- } else {
-
- List list= new ArrayList();
- Iterator e= presentation.getAllStyleRangeIterator();
- while (e.hasNext()) {
- range= (StyleRange) e.next();
- range= modelStyleRange2WidgetStyleRange(range);
- if (range != null)
- list.add(range);
- }
-
- if (!list.isEmpty()) {
- StyleRange[] ranges= new StyleRange[list.size()];
- list.toArray(ranges);
- IRegion region= modelRange2WidgetRange(presentation.getCoverage());
- fTextWidget.replaceStyleRanges(region.getOffset(), region.getLength(), ranges);
- }
- }
- }
-
- /**
- * Applies the given presentation to the given text widget. Helper method.
- *
- * @param presentation the style information
- * @since 2.1
- */
- private void applyTextPresentation(TextPresentation presentation) {
-
- List list= new ArrayList(presentation.getDenumerableRanges());
- Iterator e= presentation.getAllStyleRangeIterator();
- while (e.hasNext()) {
- StyleRange range= (StyleRange) e.next();
- range= modelStyleRange2WidgetStyleRange(range);
- if (range != null)
- list.add(range);
- }
-
- if (!list.isEmpty()) {
- StyleRange[] ranges= new StyleRange[list.size()];
- list.toArray(ranges);
- fTextWidget.setStyleRanges(ranges);
- }
- }
-
- /**
- * Returns the visible region if it is not equal to the whole document.
- * Otherwise returns <code>null</code>.
- *
- * @return the viewer's visible region if smaller than input document, otherwise <code>null</code>
- */
- protected IRegion _internalGetVisibleRegion() {
-
- IDocument document= getVisibleDocument();
- if (document instanceof ChildDocument) {
- Position p= ((ChildDocument) document).getParentDocumentRange();
- return new Region(p.getOffset(), p.getLength());
- }
-
- return null;
- }
-
- /*
- * @see ITextViewer#changeTextPresentation(TextPresentation, boolean)
- */
- public void changeTextPresentation(TextPresentation presentation, boolean controlRedraw) {
-
- if (presentation == null || !redraws())
- return;
-
- if (presentation.isEmpty() || fTextWidget == null)
- return;
-
- if (controlRedraw)
- fTextWidget.setRedraw(false);
-
- if (fReplaceTextPresentation)
- applyTextPresentation(presentation);
- else
- addPresentation(presentation);
-
- if (controlRedraw)
- fTextWidget.setRedraw(true);
- }
-
- /*
- * @see ITextViewer#getFindReplaceTarget()
- */
- public IFindReplaceTarget getFindReplaceTarget() {
- if (fFindReplaceTarget == null)
- fFindReplaceTarget= new FindReplaceTarget();
- return fFindReplaceTarget;
- }
-
- /*
- * @see ITextViewer#getTextOperationTarget()
- */
- public ITextOperationTarget getTextOperationTarget() {
- return this;
- }
-
- /*
- * @see ITextViewerExtension#appendVerifyKeyListener(VerifyKeyListener)
- * @since 2.0
- */
- public void appendVerifyKeyListener(VerifyKeyListener listener) {
- int index= fVerifyKeyListenersManager.numberOfListeners();
- fVerifyKeyListenersManager.insertListener(listener, index);
- }
-
- /*
- * @see ITextViewerExtension#prependVerifyKeyListener(VerifyKeyListener)
- * @since 2.0
- */
- public void prependVerifyKeyListener(VerifyKeyListener listener) {
- fVerifyKeyListenersManager.insertListener(listener, 0);
-
- }
-
- /*
- * @see ITextViewerExtension#removeVerifyKeyListener(VerifyKeyListener)
- * @since 2.0
- */
- public void removeVerifyKeyListener(VerifyKeyListener listener) {
- fVerifyKeyListenersManager.removeListener(listener);
- }
-
- /*
- * @see ITextViewerExtension#getMark()
- * @since 2.0
- */
- public int getMark() {
- return fMarkPosition == null || fMarkPosition.isDeleted() ? -1 : fMarkPosition.getOffset();
- }
-
- /*
- * @see ITextViewerExtension#setMark(int)
- * @since 2.0
- */
- public void setMark(int offset) {
-
- // clear
- if (offset == -1) {
- if (fMarkPosition != null && !fMarkPosition.isDeleted()) {
-
- IDocument document= getDocument();
- if (document != null)
- document.removePosition(fMarkPosition);
- }
-
- fMarkPosition= null;
-
- markChanged(-1, 0);
-
- // set
- } else {
-
- IDocument document= getDocument();
- if (document == null) {
- fMarkPosition= null;
- return;
- }
-
- if (fMarkPosition != null)
- document.removePosition(fMarkPosition);
-
- fMarkPosition= null;
-
- try {
-
- Position position= new Position(offset);
- document.addPosition(MARK_POSITION_CATEGORY, position);
- fMarkPosition= position;
-
- } catch (BadLocationException e) {
- return;
- } catch (BadPositionCategoryException e) {
- return;
- }
-
- markChanged(modelOffset2WidgetOffset(fMarkPosition.offset), 0);
- }
- }
-
- /*
- * @see Viewer#inputChanged(Object, Object)
- * @since 2.0
- */
- protected void inputChanged(Object newInput, Object oldInput) {
-
- IDocument oldDocument= (IDocument) oldInput;
- if (oldDocument != null) {
- if (fMarkPosition != null && !fMarkPosition.isDeleted())
- oldDocument.removePosition(fMarkPosition);
-
- try {
- oldDocument.removePositionUpdater(fMarkPositionUpdater);
- oldDocument.removePositionCategory(MARK_POSITION_CATEGORY);
-
- } catch (BadPositionCategoryException e) {
- }
- }
-
- fMarkPosition= null;
-
- super.inputChanged(newInput, oldInput);
-
- IDocument newDocument= (IDocument) newInput;
- if (newDocument != null) {
- newDocument.addPositionCategory(MARK_POSITION_CATEGORY);
- newDocument.addPositionUpdater(fMarkPositionUpdater);
- }
- }
-
- /**
- * Informs all text listeners about the change of the viewer's redraw state.
- * @since 2.0
- */
- private void fireRedrawChanged() {
- fWidgetCommand.start= 0;
- fWidgetCommand.length= 0;
- fWidgetCommand.text= null;
- fWidgetCommand.event= null;
- updateTextListeners(fWidgetCommand);
- }
-
- /**
- * Forgets the previously remembered selection position. After that
- * call the selection position can no longer be queried and is longer updated
- * in responds to content changes of the viewer.
- *
- * @return the remembered and updated selection position or <code>null</code> if no selection position has been remembered
- * @since 2.1
- */
- private Point forgetDocumentSelection() {
- if (fDocumentSelection == null)
- return null;
-
- Point selection= fDocumentSelection.isDeleted() ? null : fDocumentSelection.getSelection();
- IDocument document= getDocument();
- if (document != null)
- document.removePosition(fDocumentSelection);
- fDocumentSelection= null;
-
- return selection;
- }
-
- /**
- * Enables the redrawing of this text viewer.
- * @since 2.0
- */
- protected void enabledRedrawing() {
- if (fDocumentAdapter instanceof IDocumentAdapterExtension) {
- IDocumentAdapterExtension extension= (IDocumentAdapterExtension) fDocumentAdapter;
- StyledText textWidget= getTextWidget();
- if (textWidget != null && !textWidget.isDisposed()) {
- int topPixel= textWidget.getTopPixel();
- extension.resumeForwardingDocumentChanges();
- if (topPixel > -1) {
- try {
- textWidget.setTopPixel(topPixel);
- } catch (IllegalArgumentException x) {
- // changes don't allow for the previous top pixel
- }
- }
- }
- }
-
- Point selection= forgetDocumentSelection();
- if (selection != null) {
- setSelectedRange(selection.x, selection.y);
- revealRange(selection.x, selection.y);
- }
-
- if (fTextWidget != null && !fTextWidget.isDisposed())
- fTextWidget.setRedraw(true);
-
- fireRedrawChanged();
- }
-
- /**
- * Remembers the current selection in a <code>SelectionPosition</code> . The selection
- * position can be queried and is updated to changes made to the viewer's contents.
- * @since 2.1
- */
- private void rememberDocumentSelection() {
- Point selection= getSelectedRange();
- if (selection != null) {
- SelectionPosition p= new SelectionPosition(selection);
- IDocument document= getDocument();
- if (document != null) {
- try {
- document.addPosition(p);
- fDocumentSelection= p;
- } catch (BadLocationException x) {
- }
- }
- }
- }
-
- /**
- * Disables the redrawing of this text viewer. Subclasses may extend.
- * @since 2.0
- */
- protected void disableRedrawing() {
-
- rememberDocumentSelection();
-
- if (fDocumentAdapter instanceof IDocumentAdapterExtension) {
- IDocumentAdapterExtension extension= (IDocumentAdapterExtension) fDocumentAdapter;
- extension.stopForwardingDocumentChanges();
- }
-
- if (fTextWidget != null && !fTextWidget.isDisposed())
- fTextWidget.setRedraw(false);
- }
-
- /*
- * @see ITextViewerExtension#setRedraw(boolean)
- * @since 2.0
- */
- public final void setRedraw(boolean redraw) {
- if (!redraw) {
- if (fRedrawCounter == 0)
- disableRedrawing();
- ++ fRedrawCounter;
- } else {
- -- fRedrawCounter;
- if (fRedrawCounter == 0)
- enabledRedrawing();
- }
- }
-
- /**
- * Returns whether this viewer redraws itself.
- *
- * @return <code>true</code> if this viewer redraws itself
- * @since 2.0
- */
- protected final boolean redraws() {
- return fRedrawCounter <= 0;
- }
-
- /**
- * Starts the sequential rewrite mode of the viewer's document.
- *
- * @param normalized <code>true</code> if the rewrite is performed from the start to the end of the document
- * @since 2.0
- */
- protected final void startSequentialRewriteMode(boolean normalized) {
- IDocument document= getDocument();
- if (document instanceof IDocumentExtension) {
- IDocumentExtension extension= (IDocumentExtension) document;
- extension.startSequentialRewrite(normalized);
- }
- }
-
- /**
- * Sets the sequential rewrite mode of the viewer's document.
- * @since 2.0
- */
- protected final void stopSequentialRewriteMode() {
- IDocument document= getDocument();
- if (document instanceof IDocumentExtension) {
- IDocumentExtension extension= (IDocumentExtension) document;
- extension.stopSequentialRewrite();
- }
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension#getRewriteTarget()
- * @since 2.0
- */
- public IRewriteTarget getRewriteTarget() {
- if (fRewriteTarget == null)
- fRewriteTarget= new RewriteTarget();
- return fRewriteTarget;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension2#getCurrentTextHover()
- */
- public ITextHover getCurrentTextHover() {
- if (fTextHoverManager == null)
- return null;
- return fTextHoverManager.getCurrentTextHover();
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension2#getHoverEventLocation()
- */
- public Point getHoverEventLocation() {
- if (fTextHoverManager == null)
- return null;
- return fTextHoverManager.getHoverEventLocation();
- }
-
- /**
- * Returns the paint manager of this viewer.
- *
- * @return the paint manager of this viewer
- * @since 2.1
- */
- protected PaintManager getPaintManager() {
- if (fPaintManager == null)
- fPaintManager= new PaintManager(this);
- return fPaintManager;
- }
-
- /**
- * Adds the given painter to this viewer. If the painter is already registered
- * this method is without effect.
- *
- * @param painter the painter to be added
- * @since 2.1
- */
- public void addPainter(IPainter painter) {
- getPaintManager().addPainter(painter);
- }
-
- /**
- * Removes the given painter from this viewer. If the painter has previously not been
- * added to this viewer this method is without effect.
- *
- * @param painter the painter to be removed
- * @since 2.1
- */
- public void removePainter(IPainter painter) {
- getPaintManager().removePainter(painter);
- }
-
- // ----------------------------------- conversions -------------------------------------------------------
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension3#modelLine2WidgetLine(int)
- * @since 2.1
- */
- public int modelLine2WidgetLine(int modelLine) {
- if (fInformationMapping == null)
- return modelLine;
-
- try {
- return fInformationMapping.toImageLine(modelLine);
- } catch (BadLocationException x) {
- }
-
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension3#modelOffset2WidgetOffset(int)
- * @since 2.1
- */
- public int modelOffset2WidgetOffset(int modelOffset) {
- if (fInformationMapping == null)
- return modelOffset;
-
- try {
- return fInformationMapping.toImageOffset(modelOffset);
- } catch (BadLocationException x) {
- }
-
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension3#modelRange2WidgetRange(org.eclipse.jface.text.IRegion)
- * @since 2.1
- */
- public IRegion modelRange2WidgetRange(IRegion modelRange) {
- if (fInformationMapping == null)
- return modelRange;
-
- try {
-
- if (modelRange.getLength() < 0) {
- Region reversed= new Region(modelRange.getOffset() + modelRange.getLength(), -modelRange.getLength());
- IRegion result= fInformationMapping.toImageRegion(reversed);
- return new Region(result.getOffset() + result.getLength(), -result.getLength());
- } else {
- return fInformationMapping.toImageRegion(modelRange);
- }
-
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension3#widgetlLine2ModelLine(int)
- * @since 2.1
- */
- public int widgetlLine2ModelLine(int widgetLine) {
- if (fInformationMapping == null)
- return widgetLine;
-
- try {
- return fInformationMapping.toOriginLine(widgetLine);
- } catch (BadLocationException x) {
- }
-
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension3#widgetOffset2ModelOffset(int)
- * @since 2.1
- */
- public int widgetOffset2ModelOffset(int widgetOffset) {
- if (fInformationMapping == null)
- return widgetOffset;
-
- try {
- return fInformationMapping.toOriginOffset(widgetOffset);
- } catch (BadLocationException x) {
- if (widgetOffset == getVisibleDocument().getLength()) {
- IRegion coverage= fInformationMapping.getCoverage();
- return coverage.getOffset() + coverage.getLength();
- }
- }
-
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension3#widgetRange2ModelRange(org.eclipse.jface.text.IRegion)
- * @since 2.1
- */
- public IRegion widgetRange2ModelRange(IRegion widgetRange) {
- if (fInformationMapping == null)
- return widgetRange;
-
- try {
-
- if (widgetRange.getLength() < 0) {
- Region reveresed= new Region(widgetRange.getOffset() + widgetRange.getLength(), -widgetRange.getLength());
- IRegion result= fInformationMapping.toOriginRegion(reveresed);
- return new Region(result.getOffset() + result.getLength(), -result.getLength());
- } else {
- return fInformationMapping.toOriginRegion(widgetRange);
- }
-
- } catch (BadLocationException x) {
- int modelOffset= widgetOffset2ModelOffset(widgetRange.getOffset());
- if (modelOffset > -1) {
- int modelEndOffset= widgetOffset2ModelOffset(widgetRange.getOffset() + widgetRange.getLength());
- if (modelEndOffset > -1)
- return new Region(modelOffset, modelEndOffset - modelOffset);
- }
- }
-
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension3#getModelCoverage()
- * @since 2.1
- */
- public IRegion getModelCoverage() {
- if (fInformationMapping == null) {
- IDocument document= getDocument();
- if (document == null)
- return null;
- return new Region(0, document.getLength());
- }
-
- return fInformationMapping.getCoverage();
- }
-
- /**
- * Returns the line of the widget whose corresponding line in the viewer's document
- * is closest to the given line in the viewer's document.
- *
- * @param modelLine the line in the viewer's document
- * @return the line in the widget that corresponds best to the given line in the viewer's document
- * @since 2.1
- */
- protected int getClosestWidgetLineForModelLine(int modelLine) {
- if (fInformationMapping == null)
- return modelLine;
-
- try {
- return fInformationMapping.toClosestImageLine(modelLine);
- } catch (BadLocationException x) {
- }
-
- return -1;
- }
-
- /**
- * Translates a style range given relative to the viewer's document into style
- * ranges relative to the viewer's widget.
- *
- * @param range the style range in the coordinates of the viewer's document
- * @return the style range in the coordinates of the viewer's widget
- * @since 2.1
- */
- protected StyleRange modelStyleRange2WidgetStyleRange(StyleRange range) {
- IRegion region= modelRange2WidgetRange(new Region(range.start, range.length));
- if (region != null) {
- StyleRange result= (StyleRange) range.clone();
- result.start= region.getOffset();
- result.length= region.getLength();
- return result;
- }
- return null;
- }
-
- /**
- * @see #modelRange2WidgetRange(IRegion)
- *
- * @param modelPosition the position describing a range in the viewer's document
- * @return a region describing a range in the viewer's widget
- * @since 2.1
- */
- protected IRegion modelRange2WidgetRange(Position modelPosition) {
- return modelRange2WidgetRange(new Region(modelPosition.getOffset(), modelPosition.getLength()));
- }
-
- /**
- * Translates the widget region of the given verify event into
- * the corresponding region of the viewer's document.
- *
- * @param event the verify event
- * @return the region of the viewer's document corresponding to the verify event
- * @since 2.1
- */
- protected IRegion event2ModelRange(VerifyEvent event) {
-
- Region region= null;
- if (event.start <= event.end)
- region= new Region(event.start, event.end - event.start);
- else
- region= new Region(event.end, event.start - event.end);
-
- return widgetRange2ModelRange(region);
- }
-
- /**
- * Translates the given widget selection into the corresponding region
- * of the viewer's document.
- *
- * @param widgetSelection the widget selection
- * @return the region of the viewer's document corresponding to the widget selection
- * @since 2.1
- */
- protected Point widgetSelection2ModelSelection(Point widgetSelection) {
- IRegion region= new Region(widgetSelection.x, widgetSelection.y);
- region= widgetRange2ModelRange(region);
- return region == null ? null : new Point(region.getOffset(), region.getLength());
- }
-
- /**
- * Translates the given selection range of the viewer's document into
- * the corresponding widget range.
- *
- * @param modelSelection the selection range of the viewer's document
- * @return the widget range corresponding to the selection range
- * @since 2.1
- */
- protected Point modelSelection2WidgetSelection(Point modelSelection) {
- if (fInformationMapping == null)
- return modelSelection;
-
- try {
- IRegion region= new Region(modelSelection.x, modelSelection.y);
- region= fInformationMapping.toImageRegion(region);
- return new Point(region.getOffset(), region.getLength());
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextViewerExtension3#widgetLineOfWidgetOffset(int)
- */
- public int widgetLineOfWidgetOffset(int widgetOffset) {
- IDocument document= getVisibleDocument();
- if (document != null) {
- try {
- return document.getLineOfOffset(widgetOffset);
- } catch (BadLocationException e) {
- }
- }
- return -1;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java
deleted file mode 100644
index a96b607..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Display;
-
-
-/**
- * This manager controls the layout, content, and visibility of an information
- * control in reaction to mouse hover events issued by the text widget of a
- * text viewer. It overrides <code>computeInformation</code>, so that the
- * computation is performed in a dedicated background thread. This implies
- * that the used <code>ITextHover</code> objects must be capable of
- * operating in a non-UI thread.
- *
- * @since 2.0
- */
-class TextViewerHoverManager extends AbstractHoverInformationControlManager implements IWidgetTokenKeeper {
-
- /** The text viewer */
- private TextViewer fTextViewer;
- /** The hover information computation thread */
- private Thread fThread;
- /** The stopper of the computation thread */
- private ITextListener fStopper;
- /** Internal monitor */
- private Object fMutex= new Object();
- /** The currently shown text hover. */
- private volatile ITextHover fTextHover;
-
- /**
- * Creates a new text viewer hover manager specific for the given text viewer.
- * The manager uses the given information control creator.
- *
- * @param textViewer the viewer for which the controller is created
- * @param creator the information control creator
- */
- public TextViewerHoverManager(TextViewer textViewer, IInformationControlCreator creator) {
- super(creator);
- fTextViewer= textViewer;
- fStopper= new ITextListener() {
- public void textChanged(TextEvent event) {
- synchronized (fMutex) {
- if (fThread != null) {
- fThread.interrupt();
- fThread= null;
- }
- }
- }
- };
- }
-
- /**
- * Determines all necessary details and delegates the computation into
- * a background thread.
- */
- protected void computeInformation() {
-
- Point location= getHoverEventLocation();
- int offset= computeOffsetAtLocation(location.x, location.y);
- if (offset == -1) {
- setInformation(null, null);
- return;
- }
-
- final ITextHover hover= fTextViewer.getTextHover(offset, getHoverEventStateMask());
- if (hover == null) {
- setInformation(null, null);
- return;
- }
-
- final IRegion region= hover.getHoverRegion(fTextViewer, offset);
- if (region == null) {
- setInformation(null, null);
- return;
- }
-
- final Rectangle area= computeArea(region);
- if (area == null || area.isEmpty()) {
- setInformation(null, null);
- return;
- }
-
- if (fThread != null) {
- setInformation(null, null);
- return;
- }
-
- fThread= new Thread("Text Viewer Hover Presenter") { //$NON-NLS-1$
- public void run() {
- // http://bugs.eclipse.org/bugs/show_bug.cgi?id=17693
- try {
-
- if (fThread != null) {
- String information;
- try {
- information= hover.getHoverInfo(fTextViewer, region);
- } catch (ArrayIndexOutOfBoundsException x) {
- /*
- * This code runs in a separate thread which can
- * lead to text offsets being out of bounds when
- * computing the hover info (see bug 32848).
- */
- information= null;
- }
- setInformation(information, area);
- if (information != null && area != null)
- fTextHover= hover;
- } else {
- setInformation(null, null);
- }
-
- } finally {
- synchronized (fMutex) {
- if (fTextViewer != null)
- fTextViewer.removeTextListener(fStopper);
- fThread= null;
- }
- }
- }
- };
-
- fThread.setDaemon(true);
- fThread.setPriority(Thread.MIN_PRIORITY);
- synchronized (fMutex) {
- fTextViewer.addTextListener(fStopper);
- fThread.start();
- }
- }
-
- /**
- * As computation is done in the background, this method is
- * also called in the background thread. Delegates the control
- * flow back into the ui thread, in order to allow displaying the
- * information in the information control.
- */
- protected void presentInformation() {
- if (fTextViewer == null)
- return;
-
- StyledText textWidget= fTextViewer.getTextWidget();
- if (textWidget != null && !textWidget.isDisposed()) {
- Display display= textWidget.getDisplay();
- if (display == null)
- return;
-
- display.asyncExec(new Runnable() {
- public void run() {
- doPresentInformation();
- }
- });
- }
- }
-
- /*
- * @see AbstractInformationControlManager#presentInformation()
- */
- protected void doPresentInformation() {
- super.presentInformation();
- }
-
- /**
- * Computes the document offset underlying the given text widget coordinates.
- * This method uses a linear search as it cannot make any assumption about
- * how the document is actually presented in the widget. (Covers cases such
- * as bidi text.)
- *
- * @param x the x coordinate inside the text widget
- * @param y the y coordinate inside the text widget
- * @return the document offset corresponding to the given point
- */
- private int computeOffsetAtLocation(int x, int y) {
-
- try {
-
- StyledText styledText= fTextViewer.getTextWidget();
- int widgetOffset= styledText.getOffsetAtLocation(new Point(x, y));
-
- if (fTextViewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) fTextViewer;
- return extension.widgetOffset2ModelOffset(widgetOffset);
- }
-
- return widgetOffset + fTextViewer._getVisibleRegionOffset();
-
- } catch (IllegalArgumentException e) {
- return -1;
- }
- }
-
- /**
- * Determines graphical area covered by the given text region.
- *
- * @param region the region whose graphical extend must be computed
- * @return the graphical extend of the given region
- */
- private Rectangle computeArea(IRegion region) {
-
- IRegion widgetRegion= modelRange2WidgetRange(region);
- int start= widgetRegion.getOffset();
- int end= widgetRegion.getOffset() + widgetRegion.getLength();
-
- StyledText styledText= fTextViewer.getTextWidget();
- Point upperLeft= styledText.getLocationAtOffset(start);
- Point lowerRight= new Point(upperLeft.x, upperLeft.y);
-
- for (int i= start +1; i < end; i++) {
-
- Point p= styledText.getLocationAtOffset(i);
-
- if (upperLeft.x > p.x)
- upperLeft.x= p.x;
-
- if (upperLeft.y > p.y)
- upperLeft.y= p.y;
-
- if (lowerRight.x < p.x)
- lowerRight.x= p.x;
-
- if (lowerRight.y < p.y)
- lowerRight.y= p.y;
- }
-
- lowerRight.x += fTextViewer.getAverageCharWidth();
- lowerRight.y += styledText.getLineHeight();
-
- int width= lowerRight.x - upperLeft.x;
- int height= lowerRight.y - upperLeft.y;
- return new Rectangle(upperLeft.x, upperLeft.y, width, height);
- }
-
- /**
- * Translates a given region of the text viewer's document into
- * the corresponding region of the viewer's widget.
- *
- * @param region the document region
- * @return the corresponding widget region
- * @since 2.1
- */
- private IRegion modelRange2WidgetRange(IRegion region) {
- if (fTextViewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) fTextViewer;
- return extension.modelRange2WidgetRange(region);
- }
-
- IRegion visibleRegion= fTextViewer.getVisibleRegion();
- int start= region.getOffset() - visibleRegion.getOffset();
- int end= start + region.getLength();
- if (end > visibleRegion.getLength())
- end= visibleRegion.getLength();
-
- return new Region(start, end - start);
- }
-
- /*
- * @see AbstractInformationControlManager#showInformationControl(Rectangle)
- */
- protected void showInformationControl(Rectangle subjectArea) {
- if (fTextViewer != null && fTextViewer.requestWidgetToken(this))
- super.showInformationControl(subjectArea);
- }
-
- /*
- * @see AbstractInformationControlManager#hideInformationControl()
- */
- protected void hideInformationControl() {
- try {
- fTextHover= null;
- super.hideInformationControl();
- } finally {
- if (fTextViewer != null)
- fTextViewer.releaseWidgetToken(this);
- }
- }
-
- /*
- * @see AbstractInformationControlManager#handleInformationControlDisposed()
- */
- protected void handleInformationControlDisposed() {
- try {
- super.handleInformationControlDisposed();
- } finally {
- if (fTextViewer != null)
- fTextViewer.releaseWidgetToken(this);
- }
- }
-
- /*
- * @see IWidgetTokenKeeper#requestWidgetToken(IWidgetTokenOwner)
- */
- public boolean requestWidgetToken(IWidgetTokenOwner owner) {
- fTextHover= null;
- super.hideInformationControl();
- return true;
- }
-
- /**
- * Returns the currently shown text hover or <code>null</code> if no text
- * hover is shown.
- *
- * @return the currently shown text hover or <code>null</code>
- */
- protected ITextHover getCurrentTextHover() {
- return fTextHover;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java
deleted file mode 100644
index 7315d1c..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.contentassist;
-
-
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-
-import org.eclipse.jface.text.AbstractInformationControlManager;
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-
-
-
-/**
- * Displays the additional information available for a completion proposal.
- *
- * @since 2.0
- */
-class AdditionalInfoController extends AbstractInformationControlManager implements Runnable {
-
- /**
- * Internal table selection listener.
- */
- private class TableSelectionListener implements SelectionListener {
-
- /*
- * @see SelectionListener#widgetSelected(SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
- handleTableSelectionChanged();
- }
-
- /*
- * @see SelectionListener#widgetDefaultSelected(SelectionEvent)
- */
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
-
-
- /** The proposal table */
- private Table fProposalTable;
- /** The thread controlling the delayed display of the additional info */
- private Thread fThread;
- /** Indicates whether the display delay has been reset */
- private boolean fIsReset= false;
- /** Object to synchronize display thread and table selection changes */
- private Object fMutex= new Object();
- /** Object to synchronize initial display of additonal info */
- private Object fStartSignal;
- /** The table selection listener */
- private SelectionListener fSelectionListener= new TableSelectionListener();
- /** The delay after which additional information is displayed */
- private int fDelay;
-
-
- /**
- * Creates a new additional information controller.
- *
- * @param creator the information control creator to be used by this controller
- * @param delay time in milliseconds after which additional info should be displayed
- */
- AdditionalInfoController(IInformationControlCreator creator, int delay) {
- super(creator);
- fDelay= delay;
- setAnchor(ANCHOR_RIGHT);
- setFallbackAnchors(new Anchor[] { ANCHOR_LEFT, ANCHOR_BOTTOM, ANCHOR_RIGHT });
- }
-
- /*
- * @see AbstractInformationControlManager#install(Control)
- */
- public void install(Control control) {
-
- if (fProposalTable == control) {
- // already installed
- return;
- }
-
- super.install(control);
-
- Assert.isTrue(control instanceof Table);
- fProposalTable= (Table) control;
- fProposalTable.addSelectionListener(fSelectionListener);
- fThread= new Thread(this, JFaceTextMessages.getString("InfoPopup.info_delay_timer_name")); //$NON-NLS-1$
-
- fStartSignal= new Object();
- synchronized (fStartSignal) {
- fThread.start();
- try {
- // wait until thread is ready
- fStartSignal.wait();
- } catch (InterruptedException x) {
- }
- }
- }
-
- /*
- * @see AbstractInformationControlManager#disposeInformationControl()
- */
- public void disposeInformationControl() {
-
- if (fThread != null) {
- fThread.interrupt();
- fThread= null;
- }
-
- if (fProposalTable != null && !fProposalTable.isDisposed()) {
- fProposalTable.removeSelectionListener(fSelectionListener);
- fProposalTable= null;
- }
-
- super.disposeInformationControl();
- }
-
- /*
- * @see java.lang.Runnable#run()
- */
- public void run() {
- try {
- while (true) {
-
- synchronized (fMutex) {
-
- if (fStartSignal != null) {
- synchronized (fStartSignal) {
- fStartSignal.notifyAll();
- fStartSignal= null;
- }
- }
-
- // Wait for a selection event to occur.
- fMutex.wait();
-
- while (true) {
- fIsReset= false;
- // Delay before showing the popup.
- fMutex.wait(fDelay);
- if (!fIsReset)
- break;
- }
- }
-
- if (fProposalTable != null && !fProposalTable.isDisposed()) {
- fProposalTable.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (!fIsReset)
- showInformation();
- }
- });
- }
-
- }
- } catch (InterruptedException e) {
- }
-
- fThread= null;
- }
-
- /**
- *Handles a change of the line selected in the associated selector.
- */
- public void handleTableSelectionChanged() {
-
- if (fProposalTable != null && !fProposalTable.isDisposed() && fProposalTable.isVisible()) {
- synchronized (fMutex) {
- fIsReset= true;
- fMutex.notifyAll();
- }
- }
- }
-
- /*
- * @see AbstractInformationControlManager#computeInformation()
- */
- protected void computeInformation() {
-
- if (fProposalTable == null || fProposalTable.isDisposed())
- return;
-
- TableItem[] selection= fProposalTable.getSelection();
- if (selection != null && selection.length > 0) {
-
- TableItem item= selection[0];
-
- // compute information
- String information= null;
- Object d= item.getData();
- if (d instanceof ICompletionProposal) {
- ICompletionProposal p= (ICompletionProposal) d;
- information= p.getAdditionalProposalInfo();
- }
-
- // compute subject area
- setMargins(4, -1);
- Rectangle area= fProposalTable.getBounds();
- area.x= 0; // subject area is the whole subject control
- area.y= 0;
-
- // set information & subject area
- setInformation(information, area);
- }
- }
-
- /*
- * @see org.eclipse.jface.text.AbstractInformationControlManager#computeSizeConstraints(Control, IInformationControl)
- */
- protected Point computeSizeConstraints(Control subjectControl, IInformationControl informationControl) {
- Point sizeConstraint= super.computeSizeConstraints(subjectControl, informationControl);
- Point size= subjectControl.getSize();
- if (sizeConstraint.x < size.x)
- sizeConstraint.x= size.x;
- if (sizeConstraint.y < size.y)
- sizeConstraint.y= size.y;
- return sizeConstraint;
- }
-}
-
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposal.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposal.java
deleted file mode 100644
index 21f1f69..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposal.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.contentassist;
-
-
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-
-
-/**
- * The standard implementation of the <code>ICompletionProposal</code> interface.
- */
-public final class CompletionProposal implements ICompletionProposal {
-
- /** The string to be displayed in the completion proposal popup */
- private String fDisplayString;
- /** The replacement string */
- private String fReplacementString;
- /** The replacement offset */
- private int fReplacementOffset;
- /** The replacement length */
- private int fReplacementLength;
- /** The cursor position after this proposal has been applied */
- private int fCursorPosition;
- /** The image to be displayed in the completion proposal popup */
- private Image fImage;
- /** The context information of this proposal */
- private IContextInformation fContextInformation;
- /** The additional info of this proposal */
- private String fAdditionalProposalInfo;
-
- /**
- * Creates a new completion proposal based on the provided information. The replacement string is
- * considered being the display string too. All remaining fields are set to <code>null</code>.
- *
- * @param replacementString the actual string to be inserted into the document
- * @param replacementOffset the offset of the text to be replaced
- * @param replacementLength the length of the text to be replaced
- * @param cursorPosition the position of the cursor following the insert relative to replacementOffset
- */
- public CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition) {
- this(replacementString, replacementOffset, replacementLength, cursorPosition, null, null, null, null);
- }
-
- /**
- * Creates a new completion proposal. All fields are initialized based on the provided information.
- *
- * @param replacementString the actual string to be inserted into the document
- * @param replacementOffset the offset of the text to be replaced
- * @param replacementLength the length of the text to be replaced
- * @param cursorPosition the position of the cursor following the insert relative to replacementOffset
- * @param image the image to display for this proposal
- * @param displayString the string to be displayed for the proposal
- * @param contentInformation the context information associated with this proposal
- * @param additionalProposalInfo the additional information associated with this proposal
- */
- public CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) {
- Assert.isNotNull(replacementString);
- Assert.isTrue(replacementOffset >= 0);
- Assert.isTrue(replacementLength >= 0);
- Assert.isTrue(cursorPosition >= 0);
-
- fReplacementString= replacementString;
- fReplacementOffset= replacementOffset;
- fReplacementLength= replacementLength;
- fCursorPosition= cursorPosition;
- fImage= image;
- fDisplayString= displayString;
- fContextInformation= contextInformation;
- fAdditionalProposalInfo= additionalProposalInfo;
- }
-
- /*
- * @see ICompletionProposal#apply(IDocument)
- */
- public void apply(IDocument document) {
- try {
- document.replace(fReplacementOffset, fReplacementLength, fReplacementString);
- } catch (BadLocationException x) {
- // ignore
- }
- }
-
- /*
- * @see ICompletionProposal#getSelection(IDocument)
- */
- public Point getSelection(IDocument document) {
- return new Point(fReplacementOffset + fCursorPosition, 0);
- }
-
- /*
- * @see ICompletionProposal#getContextInformation()
- */
- public IContextInformation getContextInformation() {
- return fContextInformation;
- }
-
- /*
- * @see ICompletionProposal#getImage()
- */
- public Image getImage() {
- return fImage;
- }
-
- /*
- * @see ICompletionProposal#getDisplayString()
- */
- public String getDisplayString() {
- if (fDisplayString != null)
- return fDisplayString;
- return fReplacementString;
- }
-
- /*
- * @see ICompletionProposal#getAdditionalProposalInfo()
- */
- public String getAdditionalProposalInfo() {
- return fAdditionalProposalInfo;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java
deleted file mode 100644
index 0a29e40..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java
+++ /dev/null
@@ -1,740 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.contentassist;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-
-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.IRewriteTarget;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension;
-import org.eclipse.jface.text.TextUtilities;
-
-
-
-/**
- * This class is used to present proposals to the user. If additional
- * information exists for a proposal, then selecting that proposal
- * will result in the information being displayed in a secondary
- * window.
- *
- * @see org.eclipse.jface.text.contentassist.ICompletionProposal
- * @see org.eclipse.jface.text.contentassist.AdditionalInfoController
- */
-class CompletionProposalPopup implements IContentAssistListener {
-
- /** The associated text viewer */
- private ITextViewer fViewer;
- /** The associated content assistant */
- private ContentAssistant fContentAssistant;
- /** The used additional info controller */
- private AdditionalInfoController fAdditionalInfoController;
- /** The closing strategy for this completion proposal popup */
- private PopupCloser fPopupCloser= new PopupCloser();
- /** The popup shell */
- private Shell fProposalShell;
- /** The proposal table */
- private Table fProposalTable;
- /** Indicates whether a completion proposal is being inserted */
- private boolean fInserting= false;
- /** The key listener to control navigation */
- private KeyListener fKeyListener;
- /** List of document events used for filtering proposals */
- private List fDocumentEvents= new ArrayList();
- /** Listener filling the document event queue */
- private IDocumentListener fDocumentListener= new IDocumentListener() {
- public void documentAboutToBeChanged(DocumentEvent event) {}
- public void documentChanged(DocumentEvent event) {
- fDocumentEvents.add(event);
- }
- };
- /** Reentrance count for <code>filterProposals</code> */
- private long fInvocationCounter= 0;
- /** The filter list of proposals */
- private ICompletionProposal[] fFilteredProposals;
- /** The computed list of proposals */
- private ICompletionProposal[] fComputedProposals;
- /** The offset for which the proposals have been computed */
- private int fInvocationOffset;
- /** The offset for which the computed proposaks have been filtered */
- private int fFilterOffset;
- /** The default line delimiter of the viewer's widget */
- private String fLineDelimiter;
-
-
- /**
- * Creates a new completion proposal popup for the given elements.
- *
- * @param contentAssistant the content assistant feeding this popup
- * @param viewer the viewer on top of which this popup appears
- * @param infoController the info control collaborating with this popup
- * @since 2.0
- */
- public CompletionProposalPopup(ContentAssistant contentAssistant, ITextViewer viewer, AdditionalInfoController infoController) {
- fContentAssistant= contentAssistant;
- fViewer= viewer;
- fAdditionalInfoController= infoController;
- }
-
- /**
- * Computes and presents completion proposals. The flag indicates whether this call has
- * be made out of an auto activation context.
- *
- * @param autoActivated <code>true</code> if auto activation context
- * @return an error message or <code>null</code> in case of no error
- */
- public String showProposals(final boolean autoActivated) {
-
- IDocument document= fViewer.getDocument();
- if (document != null)
- document.addDocumentListener(fDocumentListener);
-
- if (fKeyListener == null) {
- fKeyListener= new KeyListener() {
- public void keyPressed(KeyEvent e) {
- if (!Helper.okToUse(fProposalShell))
- return;
-
- if (e.character == 0 && e.keyCode == SWT.MOD1) {
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=34754
- int index= fProposalTable.getSelectionIndex();
- if (index >= 0)
- selectProposal(index, true);
- }
- }
-
- public void keyReleased(KeyEvent e) {
- if (!Helper.okToUse(fProposalShell))
- return;
-
- if (e.character == 0 && e.keyCode == SWT.MOD1) {
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=34754
- int index= fProposalTable.getSelectionIndex();
- if (index >= 0)
- selectProposal(index, false);
- }
- }
- };
- }
-
- final StyledText styledText= fViewer.getTextWidget();
- if (styledText != null && !styledText.isDisposed())
- styledText.addKeyListener(fKeyListener);
-
- BusyIndicator.showWhile(styledText.getDisplay(), new Runnable() {
- public void run() {
-
- fInvocationOffset= fViewer.getSelectedRange().x;
- fComputedProposals= computeProposals(fInvocationOffset);
-
- int count= (fComputedProposals == null ? 0 : fComputedProposals.length);
- if (count == 0) {
-
- if (!autoActivated)
- styledText.getDisplay().beep();
-
- } else {
-
- if (count == 1 && !autoActivated && fContentAssistant.isAutoInserting())
-
- insertProposal(fComputedProposals[0], (char) 0, 0, fInvocationOffset);
-
- else {
-
- if (fLineDelimiter == null)
- fLineDelimiter= styledText.getLineDelimiter();
-
- createProposalSelector();
- setProposals(fComputedProposals);
- displayProposals();
- }
- }
- }
- });
-
- return getErrorMessage();
- }
-
- /**
- * Returns the completion proposal available at the given offset of the
- * viewer's document. Delegates the work to the content assistant.
- *
- * @param offset the offset
- * @return the completion proposals available at this offset
- */
- private ICompletionProposal[] computeProposals(int offset) {
- return fContentAssistant.computeCompletionProposals(fViewer, offset);
- }
-
- /**
- * Returns the error message.
- *
- * @return the error message
- */
- private String getErrorMessage() {
- return fContentAssistant.getErrorMessage();
- }
-
- /**
- * Creates the proposal selector.
- */
- private void createProposalSelector() {
- if (Helper.okToUse(fProposalShell))
- return;
-
- Control control= fViewer.getTextWidget();
- fProposalShell= new Shell(control.getShell(), SWT.ON_TOP | SWT.RESIZE );
- fProposalTable= new Table(fProposalShell, SWT.H_SCROLL | SWT.V_SCROLL);
-
- fProposalTable.setLocation(0, 0);
- if (fAdditionalInfoController != null)
- fAdditionalInfoController.setSizeConstraints(50, 10, true, false);
-
- GridLayout layout= new GridLayout();
- layout.marginWidth= 0;
- layout.marginHeight= 0;
- fProposalShell.setLayout(layout);
-
- GridData data= new GridData(GridData.FILL_BOTH);
- data.heightHint= fProposalTable.getItemHeight() * 10;
- data.widthHint= 300;
- fProposalTable.setLayoutData(data);
-
- fProposalShell.pack();
-
- if (fAdditionalInfoController != null) {
- fProposalShell.addControlListener(new ControlListener() {
-
- public void controlMoved(ControlEvent e) {}
-
- public void controlResized(ControlEvent e) {
- // resets the cached resize constraints
- fAdditionalInfoController.setSizeConstraints(50, 10, true, false);
- }
- });
- }
-
- fProposalShell.setBackground(control.getDisplay().getSystemColor(SWT.COLOR_BLACK));
-
- Color c= fContentAssistant.getProposalSelectorBackground();
- if (c == null)
- c= control.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
- fProposalTable.setBackground(c);
-
- c= fContentAssistant.getProposalSelectorForeground();
- if (c == null)
- c= control.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND);
- fProposalTable.setForeground(c);
-
- fProposalTable.addSelectionListener(new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {}
-
- public void widgetDefaultSelected(SelectionEvent e) {
- selectProposalWithMask(e.stateMask);
- }
- });
-// if (fKeyListener != null)
-// fProposalTable.addKeyListener(fKeyListener);
-
- fPopupCloser.install(fContentAssistant, fProposalTable);
-
- fProposalTable.setHeaderVisible(false);
- fContentAssistant.addToLayout(this, fProposalShell, ContentAssistant.LayoutManager.LAYOUT_PROPOSAL_SELECTOR, fContentAssistant.getSelectionOffset());
- }
-
- /**
- * Returns the proposal selected in the proposal selector.
- *
- * @return the selected proposal
- * @since 2.0
- */
- private ICompletionProposal getSelectedProposal() {
- int i= fProposalTable.getSelectionIndex();
- if (i < 0 || i >= fFilteredProposals.length)
- return null;
- return fFilteredProposals[i];
- }
-
- /**
- * Takes the selected proposal and applies it.
- *
- * @param stateMask the state mask
- * @since 2.1
- */
- private void selectProposalWithMask(int stateMask) {
- ICompletionProposal p= getSelectedProposal();
- hide();
- if (p != null)
- insertProposal(p, (char) 0, stateMask, fViewer.getSelectedRange().x);
- }
-
- /**
- * Applies the given proposal at the given offset. The given character is the
- * one that triggered the insertion of this proposal.
- *
- * @param p the completion proposal
- * @param trigger the trigger character
- * @param offset the offset
- * @since 2.1
- */
- private void insertProposal(ICompletionProposal p, char trigger, int stateMask, int offset) {
-
- fInserting= true;
- IRewriteTarget target= null;
-
- try {
-
- IDocument document= fViewer.getDocument();
-
- if (fViewer instanceof ITextViewerExtension) {
- ITextViewerExtension extension= (ITextViewerExtension) fViewer;
- target= extension.getRewriteTarget();
- }
-
- if (target != null)
- target.beginCompoundChange();
-
- if (p instanceof ICompletionProposalExtension2) {
- ICompletionProposalExtension2 e= (ICompletionProposalExtension2) p;
- e.apply(fViewer, trigger, stateMask, offset);
- } else if (p instanceof ICompletionProposalExtension) {
- ICompletionProposalExtension e= (ICompletionProposalExtension) p;
- e.apply(document, trigger, offset);
- } else {
- p.apply(document);
- }
-
- Point selection= p.getSelection(document);
- if (selection != null) {
- fViewer.setSelectedRange(selection.x, selection.y);
- fViewer.revealRange(selection.x, selection.y);
- }
-
- IContextInformation info= p.getContextInformation();
- if (info != null) {
-
- int position;
- if (p instanceof ICompletionProposalExtension) {
- ICompletionProposalExtension e= (ICompletionProposalExtension) p;
- position= e.getContextInformationPosition();
- } else {
- if (selection == null)
- selection= fViewer.getSelectedRange();
- position= selection.x + selection.y;
- }
-
- fContentAssistant.showContextInformation(info, position);
- }
-
- } finally {
- if (target != null)
- target.endCompoundChange();
- fInserting= false;
- }
- }
-
- /**
- * Returns whether this popup has the focus.
- *
- * @return <code>true</code> if the popup has the focus
- */
- public boolean hasFocus() {
- if (Helper.okToUse(fProposalShell))
- return (fProposalShell.isFocusControl() || fProposalTable.isFocusControl());
-
- return false;
- }
-
- /**
- * Hides this popup.
- */
- public void hide() {
-
- IDocument document= fViewer.getDocument();
- if (document != null)
- document.removeDocumentListener(fDocumentListener);
- fDocumentEvents.clear();
-
- StyledText styledText= fViewer.getTextWidget();
- if (fKeyListener != null && styledText != null && !styledText.isDisposed())
- styledText.removeKeyListener(fKeyListener);
-
- if (Helper.okToUse(fProposalTable)) {
- ICompletionProposal proposal= getSelectedProposal();
- if (proposal instanceof ICompletionProposalExtension2) {
- ICompletionProposalExtension2 extension= (ICompletionProposalExtension2) proposal;
- extension.unselected(fViewer);
- }
-// if (fKeyListener != null)
-// fProposalTable.removeKeyListener(fKeyListener);
- }
-
- if (Helper.okToUse(fProposalShell)) {
-
- fContentAssistant.removeContentAssistListener(this, ContentAssistant.PROPOSAL_SELECTOR);
-
- fPopupCloser.uninstall();
- fProposalShell.setVisible(false);
- fProposalShell.dispose();
- fProposalShell= null;
- }
-
- fFilteredProposals= null;
-
- fContentAssistant.possibleCompletionsClosed();
- }
-
- /**
- *Returns whether this popup is active. It is active if the propsal selector is visible.
- *
- * @return <code>true</code> if this popup is active
- */
- public boolean isActive() {
- return fProposalShell != null && !fProposalShell.isDisposed();
- }
-
- /**
- * Initializes the proposal selector with these given proposals.
- *
- * @param proposals the proposals
- */
- private void setProposals(ICompletionProposal[] proposals) {
- if (Helper.okToUse(fProposalTable)) {
-
- ICompletionProposal oldProposal= getSelectedProposal();
- if (oldProposal instanceof ICompletionProposalExtension2)
- ((ICompletionProposalExtension2) oldProposal).unselected(fViewer);
-
- fFilteredProposals= proposals;
-
- fProposalTable.setRedraw(false);
- fProposalTable.removeAll();
-
- TableItem item;
- ICompletionProposal p;
- for (int i= 0; i < proposals.length; i++) {
- p= proposals[i];
- item= new TableItem(fProposalTable, SWT.NULL);
- if (p.getImage() != null)
- item.setImage(p.getImage());
- item.setText(p.getDisplayString());
- item.setData(p);
- }
-
- Point currentLocation= fProposalShell.getLocation();
- Point newLocation= getLocation();
- if ((newLocation.x < currentLocation.x && newLocation.y == currentLocation.y) || newLocation.y < currentLocation.y)
- fProposalShell.setLocation(newLocation);
-
- selectProposal(0, false);
- fProposalTable.setRedraw(true);
- }
- }
-
- /**
- * Returns the graphical location at which this popup should be made visible.
- *
- * @return the location of this popup
- */
- private Point getLocation() {
- StyledText text= fViewer.getTextWidget();
- int caret= text.getCaretOffset();
- Point p= text.getLocationAtOffset(caret);
- if (p.x < 0) p.x= 0;
- if (p.y < 0) p.y= 0;
- p= new Point(p.x, p.y + text.getLineHeight());
- p= text.toDisplay(p);
- if (p.x < 0) p.x= 0;
- if (p.y < 0) p.y= 0;
- return p;
- }
-
- /**
- *Displays this popup and install the additional info controller, so that additional info
- * is displayed when a proposal is selected and additional info is available.
- */
- private void displayProposals() {
- if (fContentAssistant.addContentAssistListener(this, ContentAssistant.PROPOSAL_SELECTOR)) {
- fProposalShell.setVisible(true);
- if (fAdditionalInfoController != null) {
- fAdditionalInfoController.install(fProposalTable);
- fAdditionalInfoController.handleTableSelectionChanged();
- }
- }
- }
-
- /*
- * @see IContentAssistListener#verifyKey(VerifyEvent)
- */
- public boolean verifyKey(VerifyEvent e) {
- if (!Helper.okToUse(fProposalShell))
- return true;
-
- char key= e.character;
- if (key == 0) {
- int newSelection= fProposalTable.getSelectionIndex();
- int visibleRows= (fProposalTable.getSize().y / fProposalTable.getItemHeight()) - 1;
- boolean smartToggle= false;
- switch (e.keyCode) {
-
- case SWT.ARROW_LEFT :
- case SWT.ARROW_RIGHT :
- filterProposal();
- return true;
-
- case SWT.ARROW_UP :
- newSelection -= 1;
- if (newSelection < 0)
- newSelection= fProposalTable.getItemCount() - 1;
- break;
-
- case SWT.ARROW_DOWN :
- newSelection += 1;
- if (newSelection > fProposalTable.getItemCount() - 1)
- newSelection= 0;
- break;
-
- case SWT.PAGE_DOWN :
- newSelection += visibleRows;
- if (newSelection >= fProposalTable.getItemCount())
- newSelection= fProposalTable.getItemCount() - 1;
- break;
-
- case SWT.PAGE_UP :
- newSelection -= visibleRows;
- if (newSelection < 0)
- newSelection= 0;
- break;
-
- case SWT.HOME :
- newSelection= 0;
- break;
-
- case SWT.END :
- newSelection= fProposalTable.getItemCount() - 1;
- break;
-
- default :
- if (e.keyCode != SWT.MOD1 && e.keyCode != SWT.MOD2 && e.keyCode != SWT.MOD3 && e.keyCode != SWT.MOD4)
- hide();
- return true;
- }
-
- selectProposal(newSelection, smartToggle);
-
- e.doit= false;
- return false;
-
- } else {
-
- switch (key) {
- case 0x1B: // Esc
- e.doit= false;
- hide();
- break;
-
- case '\n': // Ctrl-Enter on w2k
- case '\r': // Enter
- e.doit= false;
- selectProposalWithMask(e.stateMask);
- break;
-
- case '\t':
- e.doit= false;
- fProposalShell.setFocus();
- return false;
-
- default:
- ICompletionProposal p= getSelectedProposal();
- if (p instanceof ICompletionProposalExtension) {
- ICompletionProposalExtension t= (ICompletionProposalExtension) p;
- char[] triggers= t.getTriggerCharacters();
- if (contains(triggers, key)) {
- e.doit= false;
- hide();
- insertProposal(p, key, e.stateMask, fViewer.getSelectedRange().x);
- }
- }
- }
- }
-
- return true;
- }
-
- /**
- * Selects the entry with the given index in the proposal selector and feeds
- * the selection to the additional info controller.
- *
- * @param index the index in the list
- * @param smartToggle <code>true</code> if the smart toogle key has been pressed
- * @since 2.1
- */
- private void selectProposal(int index, boolean smartToggle) {
-
- ICompletionProposal oldProposal= getSelectedProposal();
- if (oldProposal instanceof ICompletionProposalExtension2)
- ((ICompletionProposalExtension2) oldProposal).unselected(fViewer);
-
- ICompletionProposal proposal= fFilteredProposals[index];
- if (proposal instanceof ICompletionProposalExtension2)
- ((ICompletionProposalExtension2) proposal).selected(fViewer, smartToggle);
-
-
- fProposalTable.setSelection(index);
- fProposalTable.showSelection();
- if (fAdditionalInfoController != null)
- fAdditionalInfoController.handleTableSelectionChanged();
- }
-
- /**
- * Returns whether the given character is contained in the given array of
- * characters.
- *
- * @param characters the list of characters
- * @param c the character to look for in the list
- * @return <code>true</code> if character belongs to the list
- * @since 2.0
- */
- private boolean contains(char[] characters, char c) {
-
- if (characters == null)
- return false;
-
- for (int i= 0; i < characters.length; i++) {
- if (c == characters[i])
- return true;
- }
-
- return false;
- }
-
- /*
- * @see IEventConsumer#processEvent(VerifyEvent)
- */
- public void processEvent(VerifyEvent e) {
- if (!fInserting)
- filterProposal();
- }
-
- /**
- * Filters the displayed proposal based on the given cursor position and the
- * offset of the original invocation of the content assistant.
- */
- private void filterProposal() {
- ++ fInvocationCounter;
- Control control= fViewer.getTextWidget();
- control.getDisplay().asyncExec(new Runnable() {
- long fCounter= fInvocationCounter;
- public void run() {
-
- if (fCounter != fInvocationCounter) return;
-
- int offset= fViewer.getSelectedRange().x;
- ICompletionProposal[] proposals= (offset == -1 ? null : computeFilteredProposals(offset));
- fDocumentEvents.clear();
- fFilterOffset= offset;
-
- if (proposals != null && proposals.length > 0)
- setProposals(proposals);
- else
- hide();
- }
- });
- }
-
- /**
- * Computes the subset of already computed propsals that are still valid for
- * the given offset.
- *
- * @param offset the offset
- * @return the set of filtered proposals
- * @since 2.0
- */
- private ICompletionProposal[] computeFilteredProposals(int offset) {
-
- if (offset == fInvocationOffset)
- return fComputedProposals;
-
- if (offset < fInvocationOffset) {
- fInvocationOffset= offset;
- fComputedProposals= computeProposals(fInvocationOffset);
- return fComputedProposals;
- }
-
- ICompletionProposal[] proposals= fComputedProposals;
- if (offset > fFilterOffset)
- proposals= fFilteredProposals;
-
- if (proposals == null)
- return null;
-
- IDocument document= fViewer.getDocument();
- int length= proposals.length;
- List filtered= new ArrayList(length);
- for (int i= 0; i < length; i++) {
-
- if (proposals[i] instanceof ICompletionProposalExtension2) {
-
- ICompletionProposalExtension2 p= (ICompletionProposalExtension2) proposals[i];
-
- try {
- DocumentEvent event= TextUtilities.mergeProcessedDocumentEvents(fDocumentEvents);
- if (p.validate(document, offset, event))
- filtered.add(p);
- } catch (BadLocationException e) {
- }
-
- } else if (proposals[i] instanceof ICompletionProposalExtension) {
-
- ICompletionProposalExtension p= (ICompletionProposalExtension) proposals[i];
- if (p.isValidFor(document, offset))
- filtered.add(p);
-
- } else {
- // restore original behavior
- fInvocationOffset= offset;
- fComputedProposals= computeProposals(fInvocationOffset);
- return fComputedProposals;
- }
- }
-
- ICompletionProposal[] p= new ICompletionProposal[filtered.size()];
- filtered.toArray(p);
- return p;
- }
-
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
deleted file mode 100644
index 61f0326..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
+++ /dev/null
@@ -1,1403 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.contentassist;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-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.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Widget;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IEventConsumer;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension;
-import org.eclipse.jface.text.IViewportListener;
-import org.eclipse.jface.text.IWidgetTokenKeeper;
-import org.eclipse.jface.text.IWidgetTokenOwner;
-
-
-
-/**
- * The standard implementation of the <code>IContentAssistant</code> interface.
- * Usually, clients instantiate this class and configure it before using it.
- */
-public class ContentAssistant implements IContentAssistant, IWidgetTokenKeeper {
-
- /**
- * A generic closer class used to monitor various
- * interface events in order to determine whether
- * content-assist should be terminated and all
- * associated windows closed.
- */
- class Closer implements ControlListener, MouseListener, FocusListener, DisposeListener, IViewportListener {
-
- /**
- * Installs this closer on it's viewer's text widget.
- */
- protected void install() {
- Control w= fViewer.getTextWidget();
- if (Helper.okToUse(w)) {
-
- Control shell= w.getShell();
- shell.addControlListener(this);
-
- w.addMouseListener(this);
- w.addFocusListener(this);
-
- /*
- * 1GGYYWK: ITPJUI:ALL - Dismissing editor with code assist up causes lots of Internal Errors
- */
- w.addDisposeListener(this);
- }
-
- fViewer.addViewportListener(this);
- }
-
- /**
- * Uninstalls this closer from the viewer's text widget.
- */
- protected void uninstall() {
- Control w= fViewer.getTextWidget();
- if (Helper.okToUse(w)) {
-
- Control shell= w.getShell();
- if (Helper.okToUse(shell))
- shell.removeControlListener(this);
-
- w.removeMouseListener(this);
- w.removeFocusListener(this);
-
- /*
- * 1GGYYWK: ITPJUI:ALL - Dismissing editor with code assist up causes lots of Internal Errors
- */
- w.removeDisposeListener(this);
- }
-
- fViewer.removeViewportListener(this);
- }
-
- /*
- * @see ControlListener#controlResized(ControlEvent)
- */
- public void controlResized(ControlEvent e) {
- hide();
- }
-
- /*
- * @see ControlListener#controlMoved(ControlEvent)
- */
- public void controlMoved(ControlEvent e) {
- hide();
- }
-
- /*
- * @see MouseListener#mouseDown(MouseEvent)
- */
- public void mouseDown(MouseEvent e) {
- hide();
- }
-
- /*
- * @see MouseListener#mouseUp(MouseEvent)
- */
- public void mouseUp(MouseEvent e) {
- }
-
- /*
- * @see MouseListener#mouseDoubleClick(MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- hide();
- }
-
- /*
- * @see FocusListener#focusGained(FocusEvent)
- */
- public void focusGained(FocusEvent e) {
- }
-
- /*
- * @see FocusListener#focusLost(FocusEvent)
- */
- public void focusLost(FocusEvent e) {
- if (fViewer != null) {
- Control control= fViewer.getTextWidget();
- if (control != null) {
- Display d= control.getDisplay();
- if (d != null) {
- d.asyncExec(new Runnable() {
- public void run() {
- if (!fProposalPopup.hasFocus() && !fContextInfoPopup.hasFocus())
- hide();
- }
- });
- }
- }
- }
- }
-
- /*
- * @seeDisposeListener#widgetDisposed(DisposeEvent)
- */
- public void widgetDisposed(DisposeEvent e) {
- /*
- * 1GGYYWK: ITPJUI:ALL - Dismissing editor with code assist up causes lots of Internal Errors
- */
- hide();
- }
-
- /*
- * @see IViewportListener#viewportChanged(int)
- */
- public void viewportChanged(int topIndex) {
- hide();
- }
-
- /**
- * Hides any open popups.
- */
- protected void hide() {
- fProposalPopup.hide();
- fContextInfoPopup.hide();
- }
- };
-
- /**
- * An implementation of <code>IContentAssistListener</code>, this class is
- * used to monitor key events in support of automatic activation
- * of the content assistant. If enabled, the implementation utilizes a
- * thread to watch for input characters matching the activation
- * characters specified by the content assist processor, and if
- * detected, will wait the indicated delay interval before
- * activating the content assistant.
- */
- class AutoAssistListener implements VerifyKeyListener, Runnable {
-
- private Thread fThread;
- private boolean fIsReset= false;
- private Object fMutex= new Object();
- private int fShowStyle;
-
- private final static int SHOW_PROPOSALS= 1;
- private final static int SHOW_CONTEXT_INFO= 2;
-
- protected AutoAssistListener() {
- }
-
- protected void start(int showStyle) {
- fShowStyle= showStyle;
- fThread= new Thread(this, JFaceTextMessages.getString("ContentAssistant.assist_delay_timer_name")); //$NON-NLS-1$
- fThread.start();
- }
-
- public void run() {
- try {
- while (true) {
- synchronized (fMutex) {
- if (fAutoActivationDelay != 0)
- fMutex.wait(fAutoActivationDelay);
- if (fIsReset) {
- fIsReset= false;
- continue;
- }
- }
- showAssist(fShowStyle);
- break;
- }
- } catch (InterruptedException e) {
- }
- fThread= null;
- }
-
- protected void reset(int showStyle) {
- synchronized (fMutex) {
- fShowStyle= showStyle;
- fIsReset= true;
- fMutex.notifyAll();
- }
- }
-
- protected void stop() {
- if (fThread != null) {
- fThread.interrupt();
- }
- }
-
- private boolean contains(char[] characters, char character) {
- if (characters != null) {
- for (int i= 0; i < characters.length; i++) {
- if (character == characters[i])
- return true;
- }
- }
- return false;
- }
-
- public void verifyKey(VerifyEvent e) {
-
- int showStyle;
- int pos= fViewer.getSelectedRange().x;
- char[] activation= getCompletionProposalAutoActivationCharacters(fViewer.getDocument(), pos);
-
- if (contains(activation, e.character) && !fProposalPopup.isActive())
- showStyle= SHOW_PROPOSALS;
- else {
- activation= getContextInformationAutoActivationCharacters(fViewer.getDocument(), pos);
- if (contains(activation, e.character) && !fContextInfoPopup.isActive())
- showStyle= SHOW_CONTEXT_INFO;
- else {
- if (fThread != null && fThread.isAlive())
- stop();
- return;
- }
- }
-
- if (fThread != null && fThread.isAlive())
- reset(showStyle);
- else
- start(showStyle);
- }
-
- protected void showAssist(final int showStyle) {
- Control control= fViewer.getTextWidget();
- Display d= control.getDisplay();
- if (d != null) {
- try {
- d.syncExec(new Runnable() {
- public void run() {
- if (showStyle == SHOW_PROPOSALS)
- fProposalPopup.showProposals(true);
- else if (showStyle == SHOW_CONTEXT_INFO)
- fContextInfoPopup.showContextProposals(true);
- }
- });
- } catch (SWTError e) {
- }
- }
- }
- };
-
- /**
- * The laypout manager layouts the various
- * windows associated with the content assistant based on the
- * settings of the content assistant.
- */
- class LayoutManager implements Listener {
-
- // Presentation types.
- public final static int LAYOUT_PROPOSAL_SELECTOR= 0;
- public final static int LAYOUT_CONTEXT_SELECTOR= 1;
- public final static int LAYOUT_CONTEXT_INFO_POPUP= 2;
-
- int fContextType= LAYOUT_CONTEXT_SELECTOR;
- Shell[] fShells= new Shell[3];
- Object[] fPopups= new Object[3];
-
- protected void add(Object popup, Shell shell, int type, int offset) {
- Assert.isNotNull(popup);
- Assert.isTrue(shell != null && !shell.isDisposed());
- checkType(type);
-
- if (fShells[type] != shell) {
- if (fShells[type] != null)
- fShells[type].removeListener(SWT.Dispose, this);
- shell.addListener(SWT.Dispose, this);
- fShells[type]= shell;
- }
-
- fPopups[type]= popup;
- if (type == LAYOUT_CONTEXT_SELECTOR || type == LAYOUT_CONTEXT_INFO_POPUP)
- fContextType= type;
-
- layout(type, offset);
- adjustListeners(type);
- }
-
- protected void checkType(int type) {
- Assert.isTrue(type == LAYOUT_PROPOSAL_SELECTOR ||
- type == LAYOUT_CONTEXT_SELECTOR || type == LAYOUT_CONTEXT_INFO_POPUP);
- }
-
- public void handleEvent(Event event) {
- Widget source= event.widget;
- source.removeListener(SWT.Dispose, this);
-
- int type= getShellType(source);
- checkType(type);
- fShells[type]= null;
-
- switch (type) {
- case LAYOUT_PROPOSAL_SELECTOR:
- if (fContextType == LAYOUT_CONTEXT_SELECTOR &&
- Helper.okToUse(fShells[LAYOUT_CONTEXT_SELECTOR])) {
- // Restore event notification to the tip popup.
- addContentAssistListener((IContentAssistListener) fPopups[LAYOUT_CONTEXT_SELECTOR], CONTEXT_SELECTOR);
- }
- break;
-
- case LAYOUT_CONTEXT_SELECTOR:
- if (Helper.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) {
- if (fProposalPopupOrientation == PROPOSAL_STACKED)
- layout(LAYOUT_PROPOSAL_SELECTOR, getSelectionOffset());
- // Restore event notification to the proposal popup.
- addContentAssistListener((IContentAssistListener) fPopups[LAYOUT_PROPOSAL_SELECTOR], PROPOSAL_SELECTOR);
- }
- fContextType= LAYOUT_CONTEXT_INFO_POPUP;
- break;
-
- case LAYOUT_CONTEXT_INFO_POPUP:
- if (Helper.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) {
- if (fContextInfoPopupOrientation == CONTEXT_INFO_BELOW)
- layout(LAYOUT_PROPOSAL_SELECTOR, getSelectionOffset());
- }
- fContextType= LAYOUT_CONTEXT_SELECTOR;
- break;
- }
- }
-
- protected int getShellType(Widget shell) {
- for (int i=0; i<fShells.length; i++) {
- if (fShells[i] == shell)
- return i;
- }
- return -1;
- }
-
- protected void layout(int type, int offset) {
- switch (type) {
- case LAYOUT_PROPOSAL_SELECTOR:
- layoutProposalSelector(offset);
- break;
- case LAYOUT_CONTEXT_SELECTOR:
- layoutContextSelector(offset);
- break;
- case LAYOUT_CONTEXT_INFO_POPUP:
- layoutContextInfoPopup(offset);
- break;
- }
- }
-
- protected void layoutProposalSelector(int offset) {
- if (fContextType == LAYOUT_CONTEXT_INFO_POPUP &&
- fContextInfoPopupOrientation == CONTEXT_INFO_BELOW &&
- Helper.okToUse(fShells[LAYOUT_CONTEXT_INFO_POPUP])) {
- // Stack proposal selector beneath the tip box.
- Shell shell= fShells[LAYOUT_PROPOSAL_SELECTOR];
- Shell parent= fShells[LAYOUT_CONTEXT_INFO_POPUP];
- shell.setLocation(getStackedLocation(shell, parent));
- } else if (fContextType != LAYOUT_CONTEXT_SELECTOR ||
- !Helper.okToUse(fShells[LAYOUT_CONTEXT_SELECTOR])) {
- // There are no other presentations to be concerned with,
- // so place the proposal selector beneath the cursor line.
- Shell shell= fShells[LAYOUT_PROPOSAL_SELECTOR];
- shell.setLocation(getBelowLocation(shell, offset));
- } else {
- switch (fProposalPopupOrientation) {
- case PROPOSAL_REMOVE: {
- // Remove the tip selector and place the
- // proposal selector beneath the cursor line.
- fShells[LAYOUT_CONTEXT_SELECTOR].dispose();
- Shell shell= fShells[LAYOUT_PROPOSAL_SELECTOR];
- shell.setLocation(getBelowLocation(shell, offset));
- break;
- }
- case PROPOSAL_OVERLAY: {
- // Overlay the tip selector with the proposal selector.
- Shell shell= fShells[LAYOUT_PROPOSAL_SELECTOR];
- shell.setLocation(getBelowLocation(shell, offset));
- break;
- }
- case PROPOSAL_STACKED: {
- // Stack the proposal selector beneath the tip selector.
- Shell shell= fShells[LAYOUT_PROPOSAL_SELECTOR];
- Shell parent= fShells[LAYOUT_CONTEXT_SELECTOR];
- shell.setLocation(getStackedLocation(shell, parent));
- break;
- }
- }
- }
- }
-
- protected void layoutContextSelector(int offset) {
- // Always place the context selector beneath the cursor line.
- Shell shell= fShells[LAYOUT_CONTEXT_SELECTOR];
- shell.setLocation(getBelowLocation(shell, offset));
-
- if (Helper.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) {
- switch (fProposalPopupOrientation) {
- case PROPOSAL_REMOVE:
- // Remove the proposal selector.
- fShells[LAYOUT_PROPOSAL_SELECTOR].dispose();
- break;
-
- case PROPOSAL_OVERLAY:
- // The proposal selector has been overlayed by the tip selector.
- break;
-
- case PROPOSAL_STACKED: {
- // Stack the proposal selector beneath the tip selector.
- shell= fShells[LAYOUT_PROPOSAL_SELECTOR];
- Shell parent= fShells[LAYOUT_CONTEXT_SELECTOR];
- shell.setLocation(getStackedLocation(shell, parent));
- break;
- }
- }
- }
- }
-
- protected void layoutContextInfoPopup(int offset) {
- switch (fContextInfoPopupOrientation) {
- case CONTEXT_INFO_ABOVE: {
- // Place the popup above the cursor line.
- Shell shell= fShells[LAYOUT_CONTEXT_INFO_POPUP];
- shell.setLocation(getAboveLocation(shell, offset));
- break;
- }
- case CONTEXT_INFO_BELOW: {
- // Place the popup beneath the cursor line.
- Shell parent= fShells[LAYOUT_CONTEXT_INFO_POPUP];
- parent.setLocation(getBelowLocation(parent, offset));
- if (Helper.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) {
- // Stack the proposal selector beneath the context info popup.
- Shell shell= fShells[LAYOUT_PROPOSAL_SELECTOR];
- shell.setLocation(getStackedLocation(shell, parent));
- }
- break;
- }
- }
- }
-
- protected void shiftHorizontalLocation(Point location, Rectangle shellBounds, Rectangle displayBounds) {
- if (location.x + shellBounds.width > displayBounds.width)
- location.x= displayBounds.width - shellBounds.width;
-
- if (location.x < displayBounds.x)
- location.x= displayBounds.x;
- }
-
- protected void shiftVerticalLocation(Point location, Rectangle shellBounds, Rectangle displayBounds) {
- if (location.y + shellBounds.height > displayBounds.height)
- location.y= displayBounds.height - shellBounds.height;
-
- if (location.y < displayBounds.y)
- location.y= displayBounds.y;
- }
-
- protected Point getAboveLocation(Shell shell, int offset) {
- StyledText text= fViewer.getTextWidget();
- Point location= text.getLocationAtOffset(offset);
- location= text.toDisplay(location);
-
- Rectangle shellBounds= shell.getBounds();
- Rectangle displayBounds= shell.getDisplay().getClientArea();
-
- location.y=location.y - shellBounds.height;
-
- shiftHorizontalLocation(location, shellBounds, displayBounds);
- shiftVerticalLocation(location, shellBounds, displayBounds);
-
- return location;
- }
-
- protected Point getBelowLocation(Shell shell, int offset) {
- StyledText text= fViewer.getTextWidget();
- Point location= text.getLocationAtOffset(offset);
- if (location.x < 0) location.x= 0;
- if (location.y < 0) location.y= 0;
- location= text.toDisplay(location);
-
- Rectangle shellBounds= shell.getBounds();
- Rectangle displayBounds= shell.getDisplay().getClientArea();
-
- location.y= location.y + text.getLineHeight();
- shiftHorizontalLocation(location, shellBounds, displayBounds);
- shiftVerticalLocation(location, shellBounds, displayBounds);
-
- return location;
- }
-
- protected Point getStackedLocation(Shell shell, Shell parent) {
- Point p= parent.getLocation();
- Point size= parent.getSize();
- p.x += size.x / 4;
- p.y += size.y;
-
- p= parent.toDisplay(p);
-
- Rectangle shellBounds= shell.getBounds();
- Rectangle displayBounds= shell.getDisplay().getClientArea();
- shiftHorizontalLocation(p, shellBounds, displayBounds);
- shiftVerticalLocation(p, shellBounds, displayBounds);
-
- return p;
- }
-
- protected void adjustListeners(int type) {
- switch (type) {
- case LAYOUT_PROPOSAL_SELECTOR:
- if (fContextType == LAYOUT_CONTEXT_SELECTOR &&
- Helper.okToUse(fShells[LAYOUT_CONTEXT_SELECTOR]))
- // Disable event notification to the tip selector.
- removeContentAssistListener((IContentAssistListener) fPopups[LAYOUT_CONTEXT_SELECTOR], CONTEXT_SELECTOR);
- break;
- case LAYOUT_CONTEXT_SELECTOR:
- if (Helper.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR]))
- // Disable event notification to the proposal selector.
- removeContentAssistListener((IContentAssistListener) fPopups[LAYOUT_PROPOSAL_SELECTOR], PROPOSAL_SELECTOR);
- break;
- case LAYOUT_CONTEXT_INFO_POPUP:
- break;
- }
- }
- };
-
- /**
- * Internal key listener and event consumer.
- */
- class InternalListener implements VerifyKeyListener, IEventConsumer {
-
- /**
- * Verifies key events by notifying the registered listeners.
- * Each listener is allowed to indicate that the event has been
- * handled and should not be further processed.
- *
- * @param event the verify event
- * @see VerifyKeyListener#verifyKey
- */
- public void verifyKey(VerifyEvent e) {
- IContentAssistListener[] listeners= (IContentAssistListener[]) fListeners.clone();
- for (int i= 0; i < listeners.length; i++) {
- if (listeners[i] != null) {
- if (!listeners[i].verifyKey(e) || !e.doit)
- return;
- }
- }
- }
-
- /*
- * @see IEventConsumer#processEvent
- */
- public void processEvent(VerifyEvent event) {
-
- installKeyListener();
-
- IContentAssistListener[] listeners= (IContentAssistListener[])fListeners.clone();
- for (int i= 0; i < listeners.length; i++) {
- if (listeners[i] != null) {
- listeners[i].processEvent(event);
- if (!event.doit)
- return;
- }
- }
- }
- };
-
-
- // Content-Assist Listener types
- final static int CONTEXT_SELECTOR= 0;
- final static int PROPOSAL_SELECTOR= 1;
- final static int CONTEXT_INFO_POPUP= 2;
-
- private IInformationControlCreator fInformationControlCreator;
- private int fAutoActivationDelay= 500;
- private boolean fIsAutoActivated= false;
- private boolean fIsAutoInserting= false;
- private int fProposalPopupOrientation= PROPOSAL_OVERLAY;
- private int fContextInfoPopupOrientation= CONTEXT_INFO_ABOVE;
- private Map fProcessors;
-
- private Color fContextInfoPopupBackground;
- private Color fContextInfoPopupForeground;
- private Color fContextSelectorBackground;
- private Color fContextSelectorForeground;
- private Color fProposalSelectorBackground;
- private Color fProposalSelectorForeground;
-
- private ITextViewer fViewer;
- private String fLastErrorMessage;
-
- private Closer fCloser;
- private LayoutManager fLayoutManager;
- private AutoAssistListener fAutoAssistListener;
- private InternalListener fInternalListener;
- private CompletionProposalPopup fProposalPopup;
- private ContextInformationPopup fContextInfoPopup;
-
- private boolean fKeyListenerHooked= false;
- private IContentAssistListener[] fListeners= new IContentAssistListener[4];
-
- /**
- * Creates a new content assistant. The content assistant is not automatically activated,
- * overlays the completion proposals with context information list if necessary, and
- * shows the context information above the location at which it was activated. If auto
- * activation will be enabled, without further configuration steps, this content assistant
- * is activated after a 500 ms delay.
- */
- public ContentAssistant() {
- }
-
- /**
- * Registers a given content assist processor for a particular content type.
- * If there is already a processor registered for this type, the new processor
- * is registered instead of the old one.
- *
- * @param processor the content assist processor to register, or <code>null</code> to remove an existing one
- * @param contentType the content type under which to register
- */
- public void setContentAssistProcessor(IContentAssistProcessor processor, String contentType) {
-
- Assert.isNotNull(contentType);
-
- if (fProcessors == null)
- fProcessors= new HashMap();
-
- if (processor == null)
- fProcessors.remove(contentType);
- else
- fProcessors.put(contentType, processor);
- }
-
- /*
- * @see IContentAssistant#getContentAssistProcessor
- */
- public IContentAssistProcessor getContentAssistProcessor(String contentType) {
- if (fProcessors == null)
- return null;
-
- return (IContentAssistProcessor) fProcessors.get(contentType);
- }
-
- /**
- * Enables the content assistant's auto activation mode.
- *
- * @param enabled indicates whether auto activation is enabled or not
- */
- public void enableAutoActivation(boolean enabled) {
- fIsAutoActivated= enabled;
- manageAutoActivation(fIsAutoActivated);
- }
-
- /**
- * Enables the content assistant's auto insertion mode. If enabled,
- * the content assistant inserts a proposal automatically if it is
- * the only proposal. In the case of ambiguities, the user must
- * make the choice.
- *
- * @param enabled indicates whether auto insertion is enabled or not
- * @since 2.0
- */
- public void enableAutoInsert(boolean enabled) {
- fIsAutoInserting= enabled;
- }
-
- /**
- * Returns whether this content assistant is in the auto insertion
- * mode or not.
- *
- * @return <code>true</code> if in auto insertion mode
- * @since 2.0
- */
- boolean isAutoInserting() {
- return fIsAutoInserting;
- }
-
- /**
- * Installs and uninstall the listeners needed for autoactivation.
- * @param start <code>true</code> if listeners must be installed,
- * <code>false</code> if they must be removed
- * @since 2.0
- */
- private void manageAutoActivation(boolean start) {
- if (start) {
-
- if (fViewer != null && fAutoAssistListener == null) {
- fAutoAssistListener= new AutoAssistListener();
- if (fViewer instanceof ITextViewerExtension) {
- ITextViewerExtension extension= (ITextViewerExtension) fViewer;
- extension.appendVerifyKeyListener(fAutoAssistListener);
- } else {
- StyledText textWidget= fViewer.getTextWidget();
- if (Helper.okToUse(textWidget))
- textWidget.addVerifyKeyListener(fAutoAssistListener);
- }
- }
-
- } else if (fAutoAssistListener != null) {
-
- if (fViewer instanceof ITextViewerExtension) {
- ITextViewerExtension extension= (ITextViewerExtension) fViewer;
- extension.removeVerifyKeyListener(fAutoAssistListener);
- } else {
- StyledText textWidget= fViewer.getTextWidget();
- if (Helper.okToUse(textWidget))
- textWidget.removeVerifyKeyListener(fAutoAssistListener);
- }
-
- fAutoAssistListener= null;
- }
- }
-
- /**
- * Sets the delay after which the content assistant is automatically invoked
- * if the cursor is behind an auto activation character.
- *
- * @param delay the auto activation delay
- */
- public void setAutoActivationDelay(int delay) {
- fAutoActivationDelay= delay;
- }
-
- /**
- * Sets the proposal popups' orientation.
- * The following values may be used:
- * <ul>
- * <li>PROPOSAL_OVERLAY<p>
- * proposal popup windows should overlay each other
- * </li>
- * <li>PROPOSAL_REMOVE<p>
- * any currently shown proposal popup should be closed
- * </li>
- * <li>PROPOSAL_STACKED<p>
- * proposal popup windows should be vertical stacked, with no overlap,
- * beneath the line containing the current cursor location
- * </li>
- * </ul>
- *
- * @param orientation the popup's orientation
- */
- public void setProposalPopupOrientation(int orientation) {
- fProposalPopupOrientation= orientation;
- }
-
- /**
- * Sets the context information popup's orientation.
- * The following values may be used:
- * <ul>
- * <li>CONTEXT_ABOVE<p>
- * context information popup should always appear above the line containing
- * the current cursor location
- * </li>
- * <li>CONTEXT_BELOW<p>
- * context information popup should always appear below the line containing
- * the current cursor location
- * </li>
- * </ul>
- *
- * @param orientation the popup's orientation
- */
- public void setContextInformationPopupOrientation(int orientation) {
- fContextInfoPopupOrientation= orientation;
- }
-
- /**
- * Sets the context information popup's background color.
- *
- * @param background the background color
- */
- public void setContextInformationPopupBackground(Color background) {
- fContextInfoPopupBackground= background;
- }
-
- /**
- * Returns the background of the context information popup.
- *
- * @return the background of the context information popup
- * @since 2.0
- */
- Color getContextInformationPopupBackground() {
- return fContextInfoPopupBackground;
- }
-
- /**
- * Sets the context information popup's foreground color.
- *
- * @param foreground the foreground color
- * @since 2.0
- */
- public void setContextInformationPopupForeground(Color foreground) {
- fContextInfoPopupForeground= foreground;
- }
-
- /**
- * Returns the foreground of the context information popup.
- *
- * @return the foreground of the context information popup
- * @since 2.0
- */
- Color getContextInformationPopupForeground() {
- return fContextInfoPopupForeground;
- }
-
- /**
- * Sets the proposal selector's background color.
- *
- * @param background the background color
- * @since 2.0
- */
- public void setProposalSelectorBackground(Color background) {
- fProposalSelectorBackground= background;
- }
-
- /**
- * Returns the background of the proposal selector.
- *
- * @return the background of the proposal selector
- * @since 2.0
- */
- Color getProposalSelectorBackground() {
- return fProposalSelectorBackground;
- }
-
- /**
- * Sets the proposal's foreground color.
- *
- * @param foreground the foreground color
- * @since 2.0
- */
- public void setProposalSelectorForeground(Color foreground) {
- fProposalSelectorForeground= foreground;
- }
-
- /**
- * Returns the foreground of the proposal selector.
- *
- * @return the foreground of the proposal selector
- * @since 2.0
- */
- Color getProposalSelectorForeground() {
- return fProposalSelectorForeground;
- }
-
- /**
- * Sets the context selector's background color.
- *
- * @param background the background color
- * @since 2.0
- */
- public void setContextSelectorBackground(Color background) {
- fContextSelectorBackground= background;
- }
-
- /**
- * Returns the background of the context selector.
- *
- * @return the background of the context selector
- * @since 2.0
- */
- Color getContextSelectorBackground() {
- return fContextSelectorBackground;
- }
-
- /**
- * Sets the context selector's foreground color.
- *
- * @param foreground the foreground color
- * @since 2.0
- */
- public void setContextSelectorForeground(Color foreground) {
- fContextSelectorForeground= foreground;
- }
-
- /**
- * Returns the foreground of the context selector.
- *
- * @return the foreground of the context selector
- * @since 2.0
- */
- Color getContextSelectorForeground() {
- return fContextSelectorForeground;
- }
-
- /**
- * Sets the information control creator for the additional information control.
- *
- * @param creator the information control creator for the additional information control
- * @since 2.0
- */
- public void setInformationControlCreator(IInformationControlCreator creator) {
- fInformationControlCreator= creator;
- }
-
- /*
- * @see IContentAssist#install
- */
- public void install(ITextViewer textViewer) {
- Assert.isNotNull(textViewer);
-
- fViewer= textViewer;
-
- fLayoutManager= new LayoutManager();
- fInternalListener= new InternalListener();
-
- AdditionalInfoController controller= null;
- if (fInformationControlCreator != null)
- controller= new AdditionalInfoController(fInformationControlCreator, Math.round(fAutoActivationDelay * 1.5f));
-
- fContextInfoPopup= new ContextInformationPopup(this, fViewer);
- fProposalPopup= new CompletionProposalPopup(this, fViewer, controller);
-
- manageAutoActivation(fIsAutoActivated);
- }
-
- /*
- * @see IContentAssist#uninstall
- */
- public void uninstall() {
-
- if (fProposalPopup != null)
- fProposalPopup.hide();
-
- if (fContextInfoPopup != null)
- fContextInfoPopup.hide();
-
- manageAutoActivation(false);
-
- if (fCloser != null) {
- fCloser.uninstall();
- fCloser= null;
- }
-
- fViewer= null;
- }
-
- /**
- * Adds the given shell of the specified type to the layout.
- * Valid types are defined by <code>LayoutManager</code>.
- *
- * @param popup a content assist popup
- * @param shell the shell of the content-assist popup
- * @param type the type of popup
- * @param visibleOffset the offset at which to layout the popup relative to the offset of the viewer's visible region
- * @since 2.0
- */
- void addToLayout(Object popup, Shell shell, int type, int visibleOffset) {
- fLayoutManager.add(popup, shell, type, visibleOffset);
- }
-
- /**
- * Layouts the registered popup of the given type relative to the
- * given offset. The offset is relative to the offset of the viewer's visible region.
- * Valid types are defined by <code>LayoutManager</code>.
- *
- * @param type the type of popup to layout
- * @param visibleOffset the offset at which to layout relative to the offset of the viewer's visible region
- * @since 2.0
- */
- void layout(int type, int visibleOffset) {
- fLayoutManager.layout(type, visibleOffset);
- }
-
- /**
- * Notifies the controller that a popup has lost focus.
- *
- * @param e the focus event
- */
- void popupFocusLost(FocusEvent e) {
- fCloser.focusLost(e);
- }
-
- /**
- * Returns the offset of the selection relative to the offset of the visible region.
- *
- * @return the offset of the selection relative to the offset of the visible region
- * @since 2.0
- */
- int getSelectionOffset() {
- StyledText text= fViewer.getTextWidget();
- return text.getSelectionRange().x;
- }
-
- /**
- * Returns whether the widget token could be acquired.
- * The following are valid listener types:
- * <ul>
- * <li>AUTO_ASSIST
- * <li>CONTEXT_SELECTOR
- * <li>PROPOSAL_SELECTOR
- * <li>CONTEXT_INFO_POPUP
- * <ul>
- * @param type the listener type for which to acquire
- * @return <code>true</code> if the widget token could be acquired
- * @since 2.0
- */
- private boolean acquireWidgetToken(int type) {
- switch (type) {
- case CONTEXT_SELECTOR:
- case PROPOSAL_SELECTOR:
- if (fViewer instanceof IWidgetTokenOwner) {
- IWidgetTokenOwner owner= (IWidgetTokenOwner) fViewer;
- return owner.requestWidgetToken(this);
- }
- return false;
- }
- return true;
- }
-
- /**
- * Registers a content assist listener.
- * The following are valid listener types:
- * <ul>
- * <li>AUTO_ASSIST
- * <li>CONTEXT_SELECTOR
- * <li>PROPOSAL_SELECTOR
- * <li>CONTEXT_INFO_POPUP
- * <ul>
- * Returns whether the listener could be added successfully. A listener
- * can not be added if the widget token could not be acquired.
- *
- * @param listener the listener to register
- * @param type the type of listener
- * @return <code>true</code> if the listener could be added
- */
- boolean addContentAssistListener(IContentAssistListener listener, int type) {
-
- if (acquireWidgetToken(type)) {
-
- fListeners[type]= listener;
-
- if (getNumberOfListeners() == 1) {
- fCloser= new Closer();
- fCloser.install();
- fViewer.setEventConsumer(fInternalListener);
- installKeyListener();
- }
- return true;
- }
-
- return false;
- }
-
- /**
- * Installs a key listener on the text viewer's widget.
- */
- private void installKeyListener() {
- if (!fKeyListenerHooked) {
- StyledText text= fViewer.getTextWidget();
- if (Helper.okToUse(text)) {
-
- if (fViewer instanceof ITextViewerExtension) {
- ITextViewerExtension e= (ITextViewerExtension) fViewer;
- e.prependVerifyKeyListener(fInternalListener);
- } else {
- text.addVerifyKeyListener(fInternalListener);
- }
-
- fKeyListenerHooked= true;
- }
- }
- }
-
- /**
- * Releases the previously acquired widget token if the token
- * is no longer necessary.
- * The following are valid listener types:
- * <ul>
- * <li>AUTO_ASSIST
- * <li>CONTEXT_SELECTOR
- * <li>PROPOSAL_SELECTOR
- * <li>CONTEXT_INFO_POPUP
- * <ul>
- *
- * @param type the listener type
- * @since 2.0
- */
- private void releaseWidgetToken(int type) {
- if (fListeners[CONTEXT_SELECTOR] == null && fListeners[PROPOSAL_SELECTOR] == null) {
- if (fViewer instanceof IWidgetTokenOwner) {
- IWidgetTokenOwner owner= (IWidgetTokenOwner) fViewer;
- owner.releaseWidgetToken(this);
- }
- }
- }
-
- /**
- * Unregisters a content assist listener.
- *
- * @param listener the listener to unregister
- * @param type the type of listener
- *
- * @see #addContentAssistListener
- */
- void removeContentAssistListener(IContentAssistListener listener, int type) {
- fListeners[type]= null;
-
- if (getNumberOfListeners() == 0) {
-
- if (fCloser != null) {
- fCloser.uninstall();
- fCloser= null;
- }
-
- uninstallKeyListener();
- fViewer.setEventConsumer(null);
- }
-
- releaseWidgetToken(type);
- }
-
- /**
- * Uninstall the key listener from the text viewer's widget.
- */
- private void uninstallKeyListener() {
- if (fKeyListenerHooked) {
- StyledText text= fViewer.getTextWidget();
- if (Helper.okToUse(text)) {
-
- if (fViewer instanceof ITextViewerExtension) {
- ITextViewerExtension e= (ITextViewerExtension) fViewer;
- e.removeVerifyKeyListener(fInternalListener);
- } else {
- text.removeVerifyKeyListener(fInternalListener);
- }
-
- fKeyListenerHooked= false;
- }
- }
- }
-
- /**
- * Returns the number of listeners.
- *
- * @return the number of listeners
- * @since 2.0
- */
- private int getNumberOfListeners() {
- int count= 0;
- for (int i= 0; i <= CONTEXT_INFO_POPUP; i++) {
- if (fListeners[i] != null)
- ++ count;
- }
- return count;
- }
-
- /*
- * @see IContentAssist#showPossibleCompletions
- */
- public String showPossibleCompletions() {
- return fProposalPopup.showProposals(false);
- }
-
- /**
- * Callback to signal this content assistant that the presentation of the possible completions has been stopped.
- * @since 2.1
- */
- protected void possibleCompletionsClosed() {
- }
-
- /*
- * @see IContentAssist#showContextInformation
- */
- public String showContextInformation() {
- return fContextInfoPopup.showContextProposals(false);
- }
-
- /**
- * Callback to signal this content assistant that the presentation of the context information has been stopped.
- * @since 2.1
- */
- protected void contextInformationClosed() {
- }
-
- /**
- * Requests that the specified context information to be shown.
- *
- * @param contextInformation the context information to be shown
- * @param position the position to which the context information refers to
- * @since 2.0
- */
- void showContextInformation(IContextInformation contextInformation, int position) {
- fContextInfoPopup.showContextInformation(contextInformation, position);
- }
-
- /**
- * Returns the current content assist error message.
- *
- * @return an error message or <code>null</code> if no error has occurred
- */
- String getErrorMessage() {
- return fLastErrorMessage;
- }
-
- /**
- * Returns the content assist processor for the content
- * type of the specified document position.
- *
- * @param document the document
- * @param position a position within the document
- * @return a content-assist processor or <code>null</code> if none exists
- */
- private IContentAssistProcessor getProcessor(IDocument document, int position) {
- try {
- String type= document.getContentType(position);
- return getContentAssistProcessor(type);
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
- /**
- * Returns an array of completion proposals computed based on
- * the specified document position. The position is used to
- * determine the appropriate content assist processor to invoke.
- *
- * @param viewer the viewer for which to compute the prosposals
- * @param position a document position
- * @return an array of completion proposals
- *
- * @see IContentAssistProcessor#computeCompletionProposals
- */
- ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int position) {
- fLastErrorMessage= null;
-
- ICompletionProposal[] result= null;
-
- IContentAssistProcessor p= getProcessor(viewer.getDocument(), position);
- if (p != null) {
- result= p.computeCompletionProposals(viewer, position);
- fLastErrorMessage= p.getErrorMessage();
- }
-
- return result;
- }
-
- /**
- * Returns an array of context information objects computed based
- * on the specified document position. The position is used to determine
- * the appropriate content assist processor to invoke.
- *
- * @param viewer the viewer for which to compute the context information
- * @param position a document position
- * @return an array of context information objects
- *
- * @see IContentAssistProcessor#computeContextInformation
- */
- IContextInformation[] computeContextInformation(ITextViewer viewer, int position) {
- fLastErrorMessage= null;
-
- IContextInformation[] result= null;
-
- IContentAssistProcessor p= getProcessor(viewer.getDocument(), position);
- if (p != null) {
- result= p.computeContextInformation(viewer, position);
- fLastErrorMessage= p.getErrorMessage();
- }
-
- return result;
- }
-
- /**
- * Returns the context information validator that should be used to
- * determine when the currently displayed context information should
- * be dismissed. The position is used to determine the appropriate
- * content assist processor to invoke.
- *
- * @param document the document
- * @param position a document position
- * @return an validator
- *
- * @see IContentAssistProcessor#getContextInformationValidator
- */
- IContextInformationValidator getContextInformationValidator(IDocument document, int position) {
- IContentAssistProcessor p= getProcessor(document, position);
- if (p != null)
- return p.getContextInformationValidator();
- return null;
- }
-
- /**
- * Returns the context information presenter that should be used to
- * display context information. The position is used to determine the appropriate
- * content assist processor to invoke.
- *
- * @param document the document
- * @param position a document position
- * @return a presenter
- * @since 2.0
- */
- IContextInformationPresenter getContextInformationPresenter(IDocument document, int position) {
- IContextInformationValidator validator= getContextInformationValidator(document, position);
- if (validator instanceof IContextInformationPresenter)
- return (IContextInformationPresenter) validator;
- return null;
- }
-
- /**
- * Returns the characters which when typed by the user should automatically
- * initiate proposing completions. The position is used to determine the
- * appropriate content assist processor to invoke.
- *
- * @param document the document
- * @param position a document position
- * @return the auto activation characters
- *
- * @see IContentAssistProcessor#getCompletionProposalAutoActivationCharacters
- */
- private char[] getCompletionProposalAutoActivationCharacters(IDocument document, int position) {
- IContentAssistProcessor p= getProcessor(document, position);
- if (p != null)
- return p.getCompletionProposalAutoActivationCharacters();
- return null;
- }
-
- /**
- * Returns the characters which when typed by the user should automatically
- * initiate the presentation of context information. The position is used
- * to determine the appropriate content assist processor to invoke.
- *
- * @param document the document
- * @param position a document position
- * @return the auto activation characters
- *
- * @see IContentAssistProcessor#getContextInformationAutoActivationCharacters
- */
- private char[] getContextInformationAutoActivationCharacters(IDocument document, int position) {
- IContentAssistProcessor p= getProcessor(document, position);
- if (p != null)
- return p.getContextInformationAutoActivationCharacters();
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.IWidgetTokenKeeper#requestWidgetToken(IWidgetTokenOwner)
- * @since 2.0
- */
- public boolean requestWidgetToken(IWidgetTokenOwner owner) {
- return false;
- }
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformation.java
deleted file mode 100644
index 9931964..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformation.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.contentassist;
-
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.text.Assert;
-
-
-
-/**
- * A default implementation of the <code>IContextInformation</code> interface.
- */
-public final class ContextInformation implements IContextInformation {
-
- /** The name of the context */
- private String fContextDisplayString;
- /** The information to be displayed */
- private String fInformationDisplayString;
- /** The image to be displayed */
- private Image fImage;
-
- /**
- * Creates a new context information without an image.
- *
- * @param contextDisplayString the string to be used when presenting the context
- * @param informationDisplayString the string to be displayed when presenting the context information
- */
- public ContextInformation(String contextDisplayString, String informationDisplayString) {
- this(null, contextDisplayString, informationDisplayString);
- }
-
- /**
- * Creates a new context information with an image.
- *
- * @param image the image to display when presenting the context information
- * @param contextDisplayString the string to be used when presenting the context
- * @param informationDisplayString the string to be displayed when presenting the context information,
- * may not be <code>null</code>
- */
- public ContextInformation(Image image, String contextDisplayString, String informationDisplayString) {
-
- Assert.isNotNull(informationDisplayString);
-
- fImage= image;
- fContextDisplayString= contextDisplayString;
- fInformationDisplayString= informationDisplayString;
- }
-
- /*
- * @see IContextInformation#equals(Object)
- */
- public boolean equals(Object object) {
- if (object instanceof IContextInformation) {
- IContextInformation contextInformation= (IContextInformation) object;
- boolean equals= fInformationDisplayString.equalsIgnoreCase(contextInformation.getInformationDisplayString());
- if (fContextDisplayString != null)
- equals= equals && fContextDisplayString.equalsIgnoreCase(contextInformation.getContextDisplayString());
- return equals;
- }
- return false;
- }
-
- /*
- * @see IContextInformation#getInformationDisplayString()
- */
- public String getInformationDisplayString() {
- return fInformationDisplayString;
- }
-
- /*
- * @see IContextInformation#getImage()
- */
- public Image getImage() {
- return fImage;
- }
-
- /*
- * @see IContextInformation#getContextDisplayString()
- */
- public String getContextDisplayString() {
- if (fContextDisplayString != null)
- return fContextDisplayString;
- return fInformationDisplayString;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationPopup.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationPopup.java
deleted file mode 100644
index e546dc4..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationPopup.java
+++ /dev/null
@@ -1,626 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.contentassist;
-
-
-import java.util.Stack;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.TextPresentation;
-
-
-/**
- * This class is used to present context information to the user.
- * If multiple contexts are valid at the current cursor location,
- * a list is presented from which the user may choose one context.
- * Once the user makes their choice, or if there was only a single
- * possible context, the context information is shown in a tooltip like popup. <p>
- * If the tooltip is visible and the user wants to see context information of
- * a context embedded into the one for which context information is displayed,
- * context information for the embedded context is shown. As soon as the
- * cursor leaves the embedded context area, the context information for
- * the embedding context is shown again.
- *
- * @see IContextInformation
- * @see IContextInformationValidator
- */
-class ContextInformationPopup implements IContentAssistListener {
-
-
-
- /**
- * Represents the state necessary for embedding contexts.
- * @since 2.0
- */
- static class ContextFrame {
- public int fBeginOffset;
- public int fOffset;
- public int fVisibleOffset;
- public IContextInformation fInformation;
- public IContextInformationValidator fValidator;
- public IContextInformationPresenter fPresenter;
- };
-
- private ITextViewer fViewer;
- private ContentAssistant fContentAssistant;
-
- private PopupCloser fPopupCloser= new PopupCloser();
- private Shell fContextSelectorShell;
- private Table fContextSelectorTable;
- private IContextInformation[] fContextSelectorInput;
- private String fLineDelimiter= null;
-
- private Shell fContextInfoPopup;
- private StyledText fContextInfoText;
- private TextPresentation fTextPresentation;
-
- private Stack fContextFrameStack= new Stack();
-
-
- /**
- * Creates a new context information popup.
- *
- * @param contentAssistant the content assist for computing the context information
- * @param viewer the viewer on top of which the context information is shown
- */
- public ContextInformationPopup(ContentAssistant contentAssistant, ITextViewer viewer) {
- fContentAssistant= contentAssistant;
- fViewer= viewer;
- }
-
- /**
- * Shows all possible contexts for the given cursor position of the viewer.
- *
- * @param autoActivated <code>true</code> if auto activated
- * @return a potential error message or <code>null</code> in case of no error
- */
- public String showContextProposals(final boolean autoActivated) {
- final StyledText styledText= fViewer.getTextWidget();
- BusyIndicator.showWhile(styledText.getDisplay(), new Runnable() {
- public void run() {
-
- int position= fViewer.getSelectedRange().x;
-
- IContextInformation[] contexts= computeContextInformation(position);
- int count = (contexts == null ? 0 : contexts.length);
- if (count == 1) {
-
- // Show context information directly
- internalShowContextInfo(contexts[0], position);
-
- } else if (count > 0) {
- // Precise context must be selected
-
- if (fLineDelimiter == null)
- fLineDelimiter= styledText.getLineDelimiter();
-
- createContextSelector();
- setContexts(contexts);
- displayContextSelector();
- hideContextInfoPopup();
-
- } else if (!autoActivated) {
- styledText.getDisplay().beep();
- }
- }
- });
-
- return getErrorMessage();
- }
-
- /**
- * Displays the given context information for the given offset.
- *
- * @param info the context information
- * @param position the offset
- * @since 2.0
- */
- public void showContextInformation(final IContextInformation info, final int position) {
- Control control= fViewer.getTextWidget();
- BusyIndicator.showWhile(control.getDisplay(), new Runnable() {
- public void run() {
- internalShowContextInfo(info, position);
- hideContextSelector();
- }
- });
- }
-
- /**
- * Displays the given context information for the given offset.
- *
- * @param info the context information
- * @param position the offset
- * @since 2.0
- */
-
- private void internalShowContextInfo(IContextInformation information, int offset) {
-
- IContextInformationValidator validator= fContentAssistant.getContextInformationValidator(fViewer.getDocument(), offset);
-
- if (validator != null) {
- ContextFrame current= new ContextFrame();
- current.fInformation= information;
- current.fBeginOffset= (information instanceof IContextInformationExtension) ? ((IContextInformationExtension) information).getContextInformationPosition() : offset;
- if (current.fBeginOffset == -1) current.fBeginOffset= offset;
- current.fOffset= offset;
- current.fVisibleOffset= fViewer.getTextWidget().getSelectionRange().x - (offset - current.fBeginOffset);
- current.fValidator= validator;
- current.fPresenter= fContentAssistant.getContextInformationPresenter(fViewer.getDocument(), offset);
-
- fContextFrameStack.push(current);
-
- internalShowContextFrame(current, fContextFrameStack.size() == 1);
- }
- }
-
- /**
- * Shows the given context frame.
- *
- * @param frame the frane to display
- * @param initial <code>true</code> if this is the first frame to be displayed
- * @since 2.0
- */
- private void internalShowContextFrame(ContextFrame frame, boolean initial) {
-
- frame.fValidator.install(frame.fInformation, fViewer, frame.fOffset);
-
- if (frame.fPresenter != null) {
- if (fTextPresentation == null)
- fTextPresentation= new TextPresentation();
- frame.fPresenter.install(frame.fInformation, fViewer, frame.fBeginOffset);
- frame.fPresenter.updatePresentation(frame.fOffset, fTextPresentation);
- }
-
- createContextInfoPopup();
-
- fContextInfoText.setText(frame.fInformation.getInformationDisplayString());
- if (fTextPresentation != null)
- TextPresentation.applyTextPresentation(fTextPresentation, fContextInfoText);
- resize();
-
- if (initial) {
- if (fContentAssistant.addContentAssistListener(this, ContentAssistant.CONTEXT_INFO_POPUP)) {
- fContentAssistant.addToLayout(this, fContextInfoPopup, ContentAssistant.LayoutManager.LAYOUT_CONTEXT_INFO_POPUP, frame.fVisibleOffset);
- fContextInfoPopup.setVisible(true);
- }
- } else {
- fContentAssistant.layout(ContentAssistant.LayoutManager.LAYOUT_CONTEXT_INFO_POPUP, frame.fVisibleOffset);
- }
- }
-
- /**
- * Computes all possible context information for the given offset.
- *
- * @param position the offset
- * @return all possible context information for the given offset
- * @since 2.0
- */
- private IContextInformation[] computeContextInformation(int position) {
- return fContentAssistant.computeContextInformation(fViewer, position);
- }
-
- /**
- *Returns the error message generated while computing context information.
- *
- * @return the error message
- */
- private String getErrorMessage() {
- return fContentAssistant.getErrorMessage();
- }
-
- /**
- * Creates the context information popup. This is the tooltip like overlay window.
- */
- private void createContextInfoPopup() {
- if (Helper.okToUse(fContextInfoPopup))
- return;
-
- Control control= fViewer.getTextWidget();
- Display display= control.getDisplay();
-
- fContextInfoPopup= new Shell(control.getShell(), SWT.NO_TRIM | SWT.ON_TOP);
- fContextInfoPopup.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
-
- fContextInfoText= new StyledText(fContextInfoPopup, SWT.MULTI | SWT.READ_ONLY);
-
- Color c= fContentAssistant.getContextInformationPopupBackground();
- if (c == null)
- c= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
- fContextInfoText.setBackground(c);
-
- c= fContentAssistant.getContextInformationPopupForeground();
- if (c == null)
- c= display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
- fContextInfoText.setForeground(c);
- }
-
- /**
- * Resizes the context information popup.
- * @since 2.0
- */
- private void resize() {
- Point size= fContextInfoText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- size.x += 3;
- fContextInfoText.setSize(size);
- fContextInfoText.setLocation(1,1);
- size.x += 2;
- size.y += 2;
- fContextInfoPopup.setSize(size);
- }
-
- /**
- *Hides the context information popup.
- */
- private void hideContextInfoPopup() {
-
- if (Helper.okToUse(fContextInfoPopup)) {
-
- int size= fContextFrameStack.size();
- if (size > 0) {
- fContextFrameStack.pop();
- -- size;
- }
-
- if (size > 0) {
- ContextFrame current= (ContextFrame) fContextFrameStack.peek();
- internalShowContextFrame(current, false);
- } else {
-
- fContentAssistant.removeContentAssistListener(this, ContentAssistant.CONTEXT_INFO_POPUP);
-
- fContextInfoPopup.setVisible(false);
- fContextInfoPopup.dispose();
- fContextInfoPopup= null;
-
- if (fTextPresentation != null) {
- fTextPresentation.clear();
- fTextPresentation= null;
- }
- }
- }
-
- if (fContextInfoPopup == null)
- fContentAssistant.contextInformationClosed();
- }
-
- /**
- * Creates the context selector in case the user has the choice between multiple valid contexts
- * at a given offset.
- */
- private void createContextSelector() {
- if (Helper.okToUse(fContextSelectorShell))
- return;
-
- Control control= fViewer.getTextWidget();
- fContextSelectorShell= new Shell(control.getShell(), SWT.NO_TRIM | SWT.ON_TOP);
- fContextSelectorTable= new Table(fContextSelectorShell, SWT.H_SCROLL | SWT.V_SCROLL);
-
- int height= fContextSelectorTable.getItemHeight() * 10;
- fContextSelectorShell.setSize(302, height + 2);
- fContextSelectorTable.setSize(300, height);
- fContextSelectorTable.setLocation(1, 1);
-
- fContextSelectorShell.setBackground(control.getDisplay().getSystemColor(SWT.COLOR_BLACK));
-
- Color c= fContentAssistant.getContextSelectorBackground();
- if (c == null)
- c= control.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
- fContextSelectorTable.setBackground(c);
-
- c= fContentAssistant.getContextSelectorForeground();
- if (c == null)
- c= control.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND);
- fContextSelectorTable.setForeground(c);
-
- fContextSelectorTable.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- insertSelectedContext();
- hideContextSelector();
- }
- });
-
- fPopupCloser.install(fContentAssistant, fContextSelectorTable);
-
- fContextSelectorTable.setHeaderVisible(false);
- fContentAssistant.addToLayout(this, fContextSelectorShell, ContentAssistant.LayoutManager.LAYOUT_CONTEXT_SELECTOR, fContentAssistant.getSelectionOffset());
- }
-
- /**
- * Causes the context information of the context selected in the context selector
- * to be displayed in the context information popup.
- */
- private void insertSelectedContext() {
- int i= fContextSelectorTable.getSelectionIndex();
-
- if (i < 0 || i >= fContextSelectorInput.length)
- return;
-
- int position= fViewer.getSelectedRange().x;
- internalShowContextInfo(fContextSelectorInput[i], position);
- }
-
- /**
- * Sets the contexts in the context selector to the given set.
- *
- * @param contexts the possible contexts
- */
- private void setContexts(IContextInformation[] contexts) {
- if (Helper.okToUse(fContextSelectorTable)) {
-
- fContextSelectorInput= contexts;
-
- fContextSelectorTable.setRedraw(false);
- fContextSelectorTable.removeAll();
-
- TableItem item;
- IContextInformation t;
- for (int i= 0; i < contexts.length; i++) {
- t= contexts[i];
- item= new TableItem(fContextSelectorTable, SWT.NULL);
- if (t.getImage() != null)
- item.setImage(t.getImage());
- item.setText(t.getContextDisplayString());
- }
-
- fContextSelectorTable.select(0);
- fContextSelectorTable.setRedraw(true);
- }
- }
-
- /**
- * Displays the context selector.
- */
- private void displayContextSelector() {
- if (fContentAssistant.addContentAssistListener(this, ContentAssistant.CONTEXT_SELECTOR))
- fContextSelectorShell.setVisible(true);
- }
-
- /**
- * Hodes the context selector.
- */
- private void hideContextSelector() {
- if (Helper.okToUse(fContextSelectorShell)) {
- fContentAssistant.removeContentAssistListener(this, ContentAssistant.CONTEXT_SELECTOR);
-
- fPopupCloser.uninstall();
- fContextSelectorShell.setVisible(false);
- fContextSelectorShell.dispose();
- fContextSelectorShell= null;
- }
-
- if (!Helper.okToUse(fContextInfoPopup))
- fContentAssistant.contextInformationClosed();
- }
-
- /**
- *Returns whether the context selector has the focus.
- *
- * @return <code>true</code> if teh context selector has the focus
- */
- public boolean hasFocus() {
- if (Helper.okToUse(fContextSelectorShell))
- return (fContextSelectorShell.isFocusControl() || fContextSelectorTable.isFocusControl());
-
- return false;
- }
-
- /**
- * Hides context selector and context information popup.
- */
- public void hide() {
- hideContextSelector();
- hideContextInfoPopup();
- }
-
- /**
- * Returns whether this context information popup is active. I.e., either
- * a context selector or context information is displayed.
- *
- * @return <code>true</code> if the context selector is active
- */
- public boolean isActive() {
- return (Helper.okToUse(fContextInfoPopup) || Helper.okToUse(fContextSelectorShell));
- }
-
- /*
- * @see IContentAssistListener#verifyKey(VerifyEvent)
- */
- public boolean verifyKey(VerifyEvent e) {
- if (Helper.okToUse(fContextSelectorShell))
- return contextSelectorKeyPressed(e);
- if (Helper.okToUse(fContextInfoPopup))
- return contextInfoPopupKeyPressed(e);
- return true;
- }
-
- /**
- * Processes a key stroke in the context selector.
- *
- * @param e the verify event describing the key stroke
- * @return <code>true</code> if processing can be stopped
- */
- private boolean contextSelectorKeyPressed(VerifyEvent e) {
-
- char key= e.character;
- if (key == 0) {
-
- int change;
- int visibleRows= (fContextSelectorTable.getSize().y / fContextSelectorTable.getItemHeight()) - 1;
- int selection= fContextSelectorTable.getSelectionIndex();
-
- switch (e.keyCode) {
-
- case SWT.ARROW_UP:
- change= (fContextSelectorTable.getSelectionIndex() > 0 ? -1 : 0);
- break;
-
- case SWT.ARROW_DOWN:
- change= (fContextSelectorTable.getSelectionIndex() < fContextSelectorTable.getItemCount() - 1 ? 1 : 0);
- break;
-
- case SWT.PAGE_DOWN :
- change= visibleRows;
- if (selection + change >= fContextSelectorTable.getItemCount())
- change= fContextSelectorTable.getItemCount() - selection;
- break;
-
- case SWT.PAGE_UP :
- change= -visibleRows;
- if (selection + change < 0)
- change= -selection;
- break;
-
- case SWT.HOME :
- change= -selection;
- break;
-
- case SWT.END :
- change= fContextSelectorTable.getItemCount() - selection;
- break;
-
- default:
- if (e.keyCode != SWT.MOD1 && e.keyCode != SWT.MOD2 && e.keyCode != SWT.MOD3 && e.keyCode != SWT.MOD4)
- hideContextSelector();
- return true;
- }
-
- fContextSelectorTable.setSelection(selection + change);
- fContextSelectorTable.showSelection();
- e.doit= false;
- return false;
-
- } else if ('\t' == key) {
- // switch focus to selector shell
- e.doit= false;
- fContextSelectorShell.setFocus();
- return false;
- } else if (key == 0x1B) {
- // terminate on Esc
- hideContextSelector();
- }
-
- return true;
- }
-
- /**
- * Processes a key stroke while the info popup is up.
- *
- * @param e the verify event describing the key stroke
- * @return <code>true</code> if processing can be stopped
- */
- private boolean contextInfoPopupKeyPressed(KeyEvent e) {
-
- char key= e.character;
- if (key == 0) {
-
- switch (e.keyCode) {
-
- case SWT.ARROW_LEFT:
- case SWT.ARROW_RIGHT:
- validateContextInformation();
- break;
- default:
- if (e.keyCode != SWT.MOD1 && e.keyCode != SWT.MOD2 && e.keyCode != SWT.MOD3 && e.keyCode != SWT.MOD4)
- hideContextInfoPopup();
- break;
- }
-
- } else if (key == 0x1B) {
- // terminate on Esc
- hideContextInfoPopup();
- } else {
- validateContextInformation();
- }
- return true;
- }
-
- /*
- * @see IEventConsumer#processEvent(VerifyEvent)
- */
- public void processEvent(VerifyEvent event) {
- if (Helper.okToUse(fContextSelectorShell))
- contextSelectorProcessEvent(event);
- if (Helper.okToUse(fContextInfoPopup))
- contextInfoPopupProcessEvent(event);
- }
-
- /**
- * Processes a key stroke in the context selector.
- *
- * @param e the verify event describing the key stroke
- */
- private void contextSelectorProcessEvent(VerifyEvent e) {
-
- if (e.start == e.end && e.text != null && e.text.equals(fLineDelimiter)) {
- e.doit= false;
- insertSelectedContext();
- }
-
- hideContextSelector();
- }
-
- /**
- * Processes a key stroke while the info popup is up.
- *
- * @param e the verify event describing the key stroke
- */
- private void contextInfoPopupProcessEvent(VerifyEvent e) {
- if (e.start != e.end && (e.text == null || e.text.length() == 0))
- validateContextInformation();
- }
-
- /**
- * Validates the context information for the viewer's actual cursor position.
- */
- private void validateContextInformation() {
- /*
- * Post the code in the event queue in order to ensure that the
- * action described by this verify key event has already beed executed.
- * Otherwise, we'd validate the context information based on the
- * pre-key-stroke state.
- */
- fContextInfoPopup.getDisplay().asyncExec(new Runnable() {
-
- private ContextFrame fFrame= (ContextFrame) fContextFrameStack.peek();
-
- public void run() {
- if (Helper.okToUse(fContextInfoPopup) && fFrame == fContextFrameStack.peek()) {
- int offset= fViewer.getSelectedRange().x;
- if (fFrame.fValidator == null || !fFrame.fValidator.isContextInformationValid(offset)) {
- hideContextInfoPopup();
- } else if (fFrame.fPresenter != null && fFrame.fPresenter.updatePresentation(offset, fTextPresentation)) {
- TextPresentation.applyTextPresentation(fTextPresentation, fContextInfoText);
- resize();
- }
- }
- }
- });
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationValidator.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationValidator.java
deleted file mode 100644
index d35ef2d..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationValidator.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.contentassist;
-
-
-
-import org.eclipse.jface.text.ITextViewer;
-
-
-/**
- * A default implementation of the <code>IContextInfomationValidator</code> interface.
- * This implementation determines whether the information is valid by asking the content
- * assist processor for all context information objects for the current position. If the
- * currently displayed information is in the result set, the context information is
- * considered valid.
- */
-public final class ContextInformationValidator implements IContextInformationValidator {
-
- /** The content assist processor */
- private IContentAssistProcessor fProcessor;
- /** The context information to be validated */
- private IContextInformation fContextInformation;
- /** The associated text viewer */
- private ITextViewer fViewer;
-
- /**
- * Creates a new context information validator which is ready to be installed on
- * a particular context information.
- *
- * @param processor the processor to be used for validation
- */
- public ContextInformationValidator(IContentAssistProcessor processor) {
- fProcessor= processor;
- }
-
- /*
- * @see IContextInformationValidator#install(IContextInformation, ITextViewer, int)
- */
- public void install(IContextInformation contextInformation, ITextViewer viewer, int position) {
- fContextInformation= contextInformation;
- fViewer= viewer;
- }
-
- /*
- * @see IContentAssistTipCloser#isContextInformationValid(int)
- */
- public boolean isContextInformationValid(int position) {
- IContextInformation[] infos= fProcessor.computeContextInformation(fViewer, position);
- if (infos != null && infos.length > 0) {
- for (int i= 0; i < infos.length; i++)
- if (fContextInformation.equals(infos[i]))
- return true;
- }
- return false;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/Helper.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/Helper.java
deleted file mode 100644
index 79fd6b2..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/Helper.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.contentassist;
-
-
-
-import org.eclipse.swt.widgets.Widget;
-
-
-/**
- * Helper class for testing widget state.
- */
-class Helper {
-
- /**
- * Returns whether the widget is <code>null</code> or disposed.
- *
- * @param widget the widget to check
- * @return <code>true</code> if the widget is neither <code>null</code> nor disposed
- */
- public static boolean okToUse(Widget widget) {
- return (widget != null && !widget.isDisposed());
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposal.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposal.java
deleted file mode 100644
index cbf8ecb..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposal.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.contentassist;
-
-
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-
-import org.eclipse.jface.text.IDocument;
-
-
-/**
- * The interface of completion proposals generated by content assist processors.
- * A completion proposal contains information used to present the proposed completion
- * to the user, to insert the completion should the user select it, and to present
- * context information for the choosen completion once it has been inserted.<p>
- * The interface can be implemented by clients. By default, clients use
- * <code>CompletionProposal</code> as the standard implementer of this interface.
- *
- * @see IContentAssistProcessor
- */
-public interface ICompletionProposal {
-
- /**
- * Inserts the proposed completion into the given document.
- *
- * @param document the document into which to insert the proposed completion
- */
- void apply(IDocument document);
-
- /**
- * Returns the new selection after the proposal has been applied to
- * the given document in absolute document coordinates. If it returns
- * <code>null</code>, no new selection is set.
- *
- * A document change can trigger other document changes, which have
- * to be taken into account when calculating the new selection. Typically,
- * this would be done by installing a document listener or by using a
- * document position during apply().
- *
- * @param document the document into which the proposed completion has been inserted
- * @return the new selection in absolute document coordinates
- */
- Point getSelection(IDocument document);
-
- /**
- * Returns optional additional information about the proposal.
- * The additional information will be presented to assist the user
- * in deciding if the selected proposal is the desired choice.
- *
- * @return the additional information or <code>null</code>
- */
- String getAdditionalProposalInfo();
-
- /**
- * Returns the string to be displayed in the list of completion proposals.
- *
- * @return the string to be displayed
- */
- String getDisplayString();
-
- /**
- * Returns the image to be displayed in the list of completion proposals.
- * The image would typically be shown to the left of the display string.
- *
- * @return the image to be shown or <code>null</code> if no image is desired
- */
- Image getImage();
-
- /**
- * Returns optional context information associated with this proposal.
- * The context information will automatically be shown if the proposal
- * has been applied.
- *
- * @return the context information for this proposal or <code>null</code>
- */
- IContextInformation getContextInformation();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension.java
deleted file mode 100644
index 504f47d..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.contentassist;
-
-
-import org.eclipse.jface.text.IDocument;
-
-
-/**
- * Extension interface to <code>ICompletionProposal</code>.
- * Add the following functions:
- * <ul>
- * <li> handling of trigger characters other then ENTER
- * <li> completion proposal validation for a given offset
- * <li> freely positionable context information
- * </ul>
- *
- * @since 2.0
- */
-public interface ICompletionProposalExtension {
-
- /**
- * Applies the proposed completion to the given document. The insertion
- * has been triggered by entering the given character at the given offset.
- * This method assumes that <code>isValidFor</code> returns
- * <code>true</code> if called for <code>offset</code>.
- *
- * @param document the document into which to insert the proposed completion
- * @param trigger the trigger to apply the completion
- * @param offset the offset at which the trigger has been activated
- */
- void apply(IDocument document, char trigger, int offset);
-
- /**
- * Returns whether this completion proposal is valid for the given
- * position in the given document.
- *
- * @param document the document for which the proposal is tested
- * @param offset the offset for which the proposal is tested
- */
- boolean isValidFor(IDocument document, int offset);
-
- /**
- * Returns the characters which trigger the application of this completion proposal.
- *
- * @return the completion characters for this completion proposal or <code>null</code>
- * if no completion other than the new line character is possible
- */
- char[] getTriggerCharacters();
-
- /**
- * Returns the position to which the computed context information refers to or
- * <code>-1</code> if no context information can be provided by this completion proposal.
- *
- * @return the position to which the context information refers to or <code>-1</code> for no information
- */
- int getContextInformationPosition();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension2.java
deleted file mode 100644
index eba9b8f..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension2.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.contentassist;
-
-
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-
-
-/**
- * Extension interface to <code>ICompletionProposal</code>.
- * Add the following functions:
- * <ul>
- * <li> handling of trigger characters with modifiers
- * <li> visual indication for selection of a proposal
- * </ul>
- *
- * @since 2.1
- */
-public interface ICompletionProposalExtension2 {
-
- /**
- * Applies the proposed completion to the given document. The insertion
- * has been triggered by entering the given character with a modifier at the given offset.
- * This method assumes that <code>isValidFor</code> returns
- * <code>true</code> if called for <code>offset</code>.
- *
- * @param viewer the text viewer into which to insert the proposed completion
- * @param trigger the trigger to apply the completion
- * @param stateMask the state mask of the modifiers
- * @param offset the offset at which the trigger has been activated
- */
- void apply(ITextViewer viewer, char trigger, int stateMask, int offset);
-
- /**
- * Called when the proposal is selected.
- *
- * @param viewer the text viewer.
- * @param smartToggle the smart toggle key was pressed
- */
- void selected(ITextViewer viewer, boolean smartToggle);
-
- /**
- * Called when the proposal is unselected.
- *
- * @param viewer the text viewer.
- */
- void unselected(ITextViewer viewer);
-
- /**
- * Requests the proposal to be validated with respect to the document event.
- * If the proposal cannot be validated, the methods returns <code>false</code>.
- * If the document event was <code>null</code>, only the caret offset was changed, but not the document.
- *
- * This method deprecates ICompletionProposalExtension.isValidFor(IDocument, int)
- *
- * @param document the document
- * @param offset the caret offset
- * @param event the document event, may be <code>null</code>
- * @return boolean
- */
- boolean validate(IDocument document, int offset, DocumentEvent event);
-
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistListener.java
deleted file mode 100644
index f688c20..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.contentassist;
-
-
-
-import org.eclipse.swt.events.VerifyEvent;
-
-import org.eclipse.jface.text.IEventConsumer;
-
-
-
-/**
- * An interface whereby listeners can not only receive key events,
- * but can also consume them to prevent subsequent listeners from
- * processing the event.
- */
-interface IContentAssistListener extends IEventConsumer {
-
- /**
- * Verifies the key event.
- *
- * @return <code>true</code> if processing should be continued by additional listeners
- * @see org.eclipse.swt.custom.VerifyKeyListener#verifyKey(VerifyEvent)
- */
- public boolean verifyKey(VerifyEvent event);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistProcessor.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistProcessor.java
deleted file mode 100644
index 9fb6364..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistProcessor.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.jface.text.contentassist;
-
-
-
-import org.eclipse.jface.text.ITextViewer;
-
-
-
-/**
- * A content assist processor proposes completions and
- * computes context information for a particular content type.
- * A content assist processor is an <code>IContentAssistant</code>-plug-ins.
- * This interface must be implemented by clients. Implementers should be
- * registered with a content assistant in order to get involved in the
- * assisting process.
-*/
-public interface IContentAssistProcessor {
-
- /**
- * Returns a list of completion proposals based on the
- * specified location within the document that corresponds
- * to the current cursor position within the text viewer.
- *
- * @param viewer the viewer whose document is used to compute the proposals
- * @param documentPosition an offset within the document for which completions should be computed
- * @return an array of completion proposals or <code>null</code> if no proposals are possible
- */
- ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset);
-
- /**
- * Returns information about possible contexts based on the
- * specified location within the document that corresponds
- * to the current cursor position within the text viewer.
- *
- * @param viewer the viewer whose document is used to compute the possible contexts
- * @param documentPosition an offset within the document for which context information should be computed
- * @return an array of context information objects or <code>null</code> if no context could be found
- */
- IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset);
-
- /**
- * Returns the characters which when entered by the user should
- * automatically trigger the presentation of possible completions.
- *
- * @return the auto activation characters for completion proposal or <code>null</code>
- * if no auto activation is desired
- */
- char[] getCompletionProposalAutoActivationCharacters();
-
- /**
- * Returns the characters which when entered by the user should
- * automatically trigger the presentation of context information.
- *
- * @return the auto activation characters for presenting context information
- * or <code>null</code> if no auto activation is desired
- */
- char[] getContextInformationAutoActivationCharacters();
-
- /**
- * Returns the reason why this content assist processor
- * was unable to produce any completion proposals or context information.
- *
- * @return an error message or <code>null</code> if no error occurred
- */
- String getErrorMessage();
-
- /**
- * Returns a validator used to determine when displayed context information
- * should be dismissed. May only return <code>null</code> if the processor is
- * incapable of computing context information. <p>
- *
- * @return a context information validator, or <code>null</code> if the processor
- * is incapable of computing context information
- */
- IContextInformationValidator getContextInformationValidator();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistant.java
deleted file mode 100644
index edb152a..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistant.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.jface.text.contentassist;
-
-
-import org.eclipse.jface.text.ITextViewer;
-
-
-/**
- * An <code>IContentAssistant</code> provides support on interactive content completion.
- * The content assistant is a <code>ITextViewer</code> add-on. Its
- * purpose is to propose, display, and insert completions of the content
- * of the text viewer's document at the viewer's cursor position. In addition
- * to handle completions, a content assistant can also be requested to provide
- * context information. Context information is shown in a tooltip like popup.
- * As it is not always possible to determine the exact context at a given
- * document offset, a content assistant displays the possible contexts and requests
- * the user to choose the one whose information should be displayed.<p>
- * A content assistant has a list of <code>IContentAssistProcessor</code>
- * objects each of which is registered for a particular document content
- * type. The content assistant uses the processors to react on the request
- * of completing documents or presenting context information.<p>
- * The interface can be implemented by clients. By default, clients use
- * <code>ContentAssistant</code> as the standard implementer of this interface.
- *
- * @see ITextViewer
- * @see IContentAssistProcessor
- */
-
- public interface IContentAssistant {
-
- //------ proposal popup orientation styles ------------
- /** The context info list will overlay the list of completion proposals. */
- public final static int PROPOSAL_OVERLAY= 10;
- /** The completion proposal list will be removed before the context info list will be shown. */
- public final static int PROPOSAL_REMOVE= 11;
- /** The context info list will be presented without hiding or overlapping the completion proposal list. */
- public final static int PROPOSAL_STACKED= 12;
-
- //------ context info box orientation styles ----------
- /** Context info will be shown above the location it has been requested for without hiding the location. */
- public final static int CONTEXT_INFO_ABOVE= 20;
- /** Context info will be shown below the location it has been requested for without hiding the location. */
- public final static int CONTEXT_INFO_BELOW= 21;
-
-
- /**
- * Installs content assist support on the given text viewer.
- *
- * @param textViewer the text viewer on which content assist will work
- */
- void install(ITextViewer textViewer);
-
- /**
- * Uninstalls content assist support from the text viewer it has
- * previously be installed on.
- */
- void uninstall();
-
- /**
- * Shows all possible completions of the content at the viewer's cursor position.
- *
- * @return an optional error message if no proposals can be computed
- */
- String showPossibleCompletions();
-
- /**
- * Shows context information for the content at the viewer's cursor position.
- *
- * @return an optional error message if no context information can be computed
- */
- String showContextInformation();
-
- /**
- * Returns the content assist processor to be used for the given content type.
- *
- * @param contentType the type of the content for which this
- * content assistant is to be requested
- * @return an instance content assist processor or
- * <code>null</code> if none exists for the specified content type
- */
- IContentAssistProcessor getContentAssistProcessor(String contentType);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformation.java
deleted file mode 100644
index a87158f..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformation.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.contentassist;
-
-
-
-import org.eclipse.swt.graphics.Image;
-
-
-/**
- * The inferface of context information presented to the user and
- * generated by content assist processors.
- * The interface can be implemented by clients. By default, clients use
- * <code>ContextInformation</code> as the standard implementer of this interface.
- *
- * @see IContentAssistProcessor
- */
-public interface IContextInformation {
-
- /**
- * Returns the string to be displayed in the list of contexts.
- * This method is used to supply a unique presentation for
- * situations where the context is ambiguous. These strings are
- * used to allow the user to select the specific context.
- *
- * @return the string to be displayed for the context
- */
- String getContextDisplayString();
-
- /**
- * Returns the image for this context information.
- * The image will be shown to the left of the display string.
- *
- * @return the image to be shown or <code>null</code> if no image is desired
- */
- Image getImage();
-
- /**
- * Returns the string to be displayed in the tooltip like information popup.
- *
- * @return the string to be displayed
- */
- String getInformationDisplayString();
-
- /**
- * Compares the given object with this receiver. Two context informations are
- * equal if there information display strings and their context display strings
- * are equal.
- *
- * @see Object#equals(Object)
- */
- boolean equals(Object object);
-}
-
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationExtension.java
deleted file mode 100644
index 7da3180..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationExtension.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.contentassist;
-
-
-/**
- * Extension interface for <code>IContextInformation</code>.
- * Adds the functionality of freely positionable context information.
- *
- * @since 2.0
- */
-public interface IContextInformationExtension {
-
- /**
- * Returns the start offset of the range for which this context information is valid.
- *
- * @return the start offset of the range for which this context information is valid
- */
- int getContextInformationPosition();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationPresenter.java
deleted file mode 100644
index f7d60fd..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationPresenter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.contentassist;
-
-
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.TextPresentation;
-
-
-/**
- * A context information presenter determines the presentation
- * of context information depending on a given document position.
- * The interface can be implemented by clients.
- *
- * @since 2.0
- */
-public interface IContextInformationPresenter {
-
- /**
- * Installs this presenter for the given context information.
- *
- * @param info the context information which this presenter should style
- * @param viewer the text viewer on which the information is presented
- * @param documentPosition the document position for which the information has been computed
- */
- void install(IContextInformation info, ITextViewer viewer, int documentPosition);
-
- /**
- * Updates the given presentation of the given context information
- * at the given document position. Returns whether update changed the
- * presentation.
- *
- * @param documentPosition the current position within the document
- * @param presentation the presentation to be updated
- * @return <code>true</code> if the given presentation has been changed
- */
- boolean updatePresentation(int documentPosition, TextPresentation presentation);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationValidator.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationValidator.java
deleted file mode 100644
index 35cec4c..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationValidator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.contentassist;
-
-
-
-import org.eclipse.jface.text.ITextViewer;
-
-
-/**
- * A context information validator is used to determine if
- * a displayed context information is still valid or should
- * be dismissed. The interface can be implemented by clients. <p>
- *
- * @see IContextInformationPresenter
- */
-public interface IContextInformationValidator {
-
- /**
- * Installs this validator for the given context information.
- *
- * @param info the context information which this validator should check
- * @param viewer the text viewer on which the information is presented
- * @param documentPosition the document position for which the information has been computed
- */
- void install(IContextInformation info, ITextViewer viewer, int documentPosition);
-
- /**
- * Returns whether the information this validator is installed on is still valid
- * at the given document position.
- *
- * @param documentPosition the current position within the document
- * @return <code>true</code> if the information also valid at the given document position
- */
- boolean isContextInformationValid(int documentPosition);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/JFaceTextMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/JFaceTextMessages.java
deleted file mode 100644
index cdc432e..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/JFaceTextMessages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.contentassist;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-class JFaceTextMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.jface.text.JFaceTextMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private JFaceTextMessages() {
- }
-
- 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.jface.text/src/org/eclipse/jface/text/contentassist/PopupCloser.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/PopupCloser.java
deleted file mode 100644
index 2acc7ab..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/PopupCloser.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.jface.text.contentassist;
-
-
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.Table;
-
-
-/**
- * A generic closer class used to monitor various
- * interface events in order to determine whether
- * a content assistant should be terminated and all
- * associated windows be closed.
- */
-class PopupCloser implements FocusListener, SelectionListener {
-
- /** The content assistant to be monitored */
- private ContentAssistant fContentAssistant;
- /** The table of a selector popup opened by the content assistant */
- private Table fTable;
- /** The scrollbar of the table for the selector popup */
- private ScrollBar fScrollbar;
- /** Indicates whether the scrollbar thumb has been grabed */
- private boolean fScrollbarClicked= false;
-
- /**
- * Installs this closer on the given table opened by the given content assistant.
- *
- * @param contentAssistant the content assistant
- * @param table the table to be tracked
- */
- public void install(ContentAssistant contentAssistant, Table table) {
- fContentAssistant= contentAssistant;
- fTable= table;
- if (Helper.okToUse(fTable)) {
- fTable.addFocusListener(this);
- fScrollbar= fTable.getVerticalBar();
- if (fScrollbar != null)
- fScrollbar.addSelectionListener(this);
- }
- }
-
- /**
- * Uninstalls this closer if previously installed.
- */
- public void uninstall() {
- if (Helper.okToUse(fTable)) {
- fTable.removeFocusListener(this);
- if (fScrollbar != null)
- fScrollbar.removeSelectionListener(this);
- }
- }
-
- /*
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
- fScrollbarClicked= true;
- }
-
- /*
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetDefaultSelected(SelectionEvent e) {
- fScrollbarClicked= true;
- }
-
- /*
- * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
- */
- public void focusGained(FocusEvent e) {
- }
-
- /*
- * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
- */
- public void focusLost(final FocusEvent e) {
- fScrollbarClicked= false;
- Display d= fTable.getDisplay();
- d.asyncExec(new Runnable() {
- public void run() {
- if (Helper.okToUse(fTable) && !fTable.isFocusControl() && !fScrollbarClicked)
- fContentAssistant.popupFocusLost(e);
- }
- });
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/package.html b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/package.html
deleted file mode 100644
index 2d94dfb..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/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.51 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a content assist add-on for an <tt>ITextViewer</tt>.
-Content assist supports the user in writing by proposing context
-sensitive completions at a given document position. A completion can also
-be a incomplete in itself and content assist provides means to deal with
-nested completions.
-<h2>
-Package Specification</h2>
-<tt>IContentAssistant</tt> defines the concept of the content assist add-on.
-It collaborates with content type specific completion processors (<tt>IContentAssistProcessor</tt>)
-in order to generate completion proposals (<tt>ICompletionProposal</tt>)
-valid at the current document position. The package provides a default
-implementation <tt>ContentAssistant</tt> which completely defines and implements
-the UI and the control flow for content assist.
-<br>
-</body>
-</html>
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/ContentFormatter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/ContentFormatter.java
deleted file mode 100644
index 97e5a64..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/ContentFormatter.java
+++ /dev/null
@@ -1,748 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.formatter;
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-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.BadPositionCategoryException;
-import org.eclipse.jface.text.ChildDocumentManager;
-import org.eclipse.jface.text.DefaultPositionUpdater;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IPositionUpdater;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.TypedPosition;
-
-
-/**
- * Standard implementation of <code>IContentFormatter</code>.
- * The formatter supports two operation modi: partition aware and
- * partition unaware. <p>
- * In the partition aware mode, the formatter determines the
- * partitioning of the document region to be formatted. For each
- * partition it determines all document positions which are affected
- * when text changes are applied to the partition. Those which overlap
- * with the partition are remembered as character positions. These
- * character positions are passed over to the formatting strategy
- * registered for the partition's content type. The formatting strategy
- * returns a string containing the formatted document partition as well
- * as the adapted character positions. The formatted partition replaces
- * the old content of the partition. The remembered document postions
- * are updated with the adapted character positions. In addition, all
- * other document positions are accordingly adapted to the formatting
- * changes.<p>
- * In the partition unaware mode, the document's partitioning is ignored
- * and the document is considered consisting of only one partition of
- * the content type <code>IDocument.DEFAULT_CONTENT_TYPE</code>. The
- * formatting process is similar to the partition aware mode, with the
- * exception of having only one partition.<p>
- * Usually, clients instantiate this class and configure it before using it.
- *
- * @see IContentFormatter
- * @see IDocument
- * @see ITypedRegion
- * @see Position
- */
-public class ContentFormatter implements IContentFormatter {
-
- /**
- * Defines a reference to either the offset or the end offset of
- * a particular position.
- */
- static class PositionReference implements Comparable {
-
- /** The referenced position */
- protected Position fPosition;
- /** The reference to either the offset or the end offset */
- protected boolean fRefersToOffset;
- /** The original category of the referenced position */
- protected String fCategory;
-
- /**
- * Creates a new position reference.
- *
- * @param position the position to be referenced
- * @param refersToOffset <code>true</code> if position offset should be referenced
- * @param category the categpry the given position belongs to
- */
- protected PositionReference(Position position, boolean refersToOffset, String category) {
- fPosition= position;
- fRefersToOffset= refersToOffset;
- fCategory= category;
- }
-
- /**
- * Returns the offset of the referenced position.
- *
- * @return the offset of the referenced position
- */
- protected int getOffset() {
- return fPosition.getOffset();
- }
-
- /**
- * Manipulates the offset of the referenced position.
- *
- * @param offset the new offset of the referenced position
- */
- protected void setOffset(int offset) {
- fPosition.setOffset(offset);
- }
-
- /**
- * Returns the length of the referenced position.
- *
- * @return the length of the referenced position
- */
- protected int getLength() {
- return fPosition.getLength();
- }
-
- /**
- * Manipulates the length of the referenced position.
- *
- * @param the new length of the referenced position
- */
- protected void setLength(int length) {
- fPosition.setLength(length);
- }
-
- /**
- * Returns whether this reference points to the offset or endoffset
- * of the references position.
- *
- * @return <code>true</code> if the offset of the position is referenced, <code>false</code> otherwise
- */
- protected boolean refersToOffset() {
- return fRefersToOffset;
- }
-
- /**
- * Returns the category of the referenced position.
- *
- * @return the category of the referenced position
- */
- protected String getCategory() {
- return fCategory;
- }
-
- /**
- * Returns the referenced position.
- *
- * @return the referenced position
- */
- protected Position getPosition() {
- return fPosition;
- }
-
- /**
- * Returns the referenced character position
- *
- * @return the referenced character position
- */
- protected int getCharacterPosition() {
- if (fRefersToOffset)
- return getOffset();
- return getOffset() + getLength();
- }
-
- /*
- * @see Comparable#compareTo(Object)
- */
- public int compareTo(Object obj) {
-
- if (obj instanceof PositionReference) {
- PositionReference r= (PositionReference) obj;
- return getCharacterPosition() - r.getCharacterPosition();
- }
-
- throw new ClassCastException();
- }
- };
-
- /**
- * The position updater used to update the remembered partitions.
- *
- * @see IPositionUpdater
- * @see DefaultPositionUpdater
- */
- class NonDeletingPositionUpdater extends DefaultPositionUpdater {
-
- /**
- * Creates a new updater for the given category.
- *
- * @param category the category
- */
- protected NonDeletingPositionUpdater(String category) {
- super(category);
- }
-
- /*
- * @see DefaultPositionUpdater#notDeleted()
- */
- protected boolean notDeleted() {
- return true;
- }
- };
-
- /**
- * The position updater which runs as first updater on the document's positions.
- * Used to remove all affected positions from their categories to avoid them
- * from being regularily updated.
- *
- * @see IPositionUpdater
- */
- class RemoveAffectedPositions implements IPositionUpdater {
- /**
- * @see IPositionUpdater#update(DocumentEvent)
- */
- public void update(DocumentEvent event) {
- removeAffectedPositions(event.getDocument());
- }
- };
-
- /**
- * The position updater which runs as last updater on the document's positions.
- * Used to update all affected positions and adding them back to their
- * original categories.
- *
- * @see IPositionUpdater
- */
- class UpdateAffectedPositions implements IPositionUpdater {
-
- /** The affected positions */
- private int[] fPositions;
- /** The offset */
- private int fOffset;
-
- /**
- * Creates a new updater.
- *
- * @param positions the affected positions
- * @param offset the offset
- */
- public UpdateAffectedPositions(int[] positions, int offset) {
- fPositions= positions;
- fOffset= offset;
- }
-
- /*
- * @see IPositionUpdater#update(DocumentEvent)
- */
- public void update(DocumentEvent event) {
- updateAffectedPositions(event.getDocument(), fPositions, fOffset);
- }
- };
-
-
- /** Internal position category used for the formatter partitioning */
- private final static String PARTITIONING= "__formatter_partitioning"; //$NON-NLS-1$
-
- /** The map of <code>IFormattingStrategy</code> objects */
- private Map fStrategies;
- /** The indicator of whether the formatter operates in partition aware mode or not */
- private boolean fIsPartitionAware= true;
-
- /** The partition information managing document position categories */
- private String[] fPartitionManagingCategories;
- /** The list of references to offset and end offset of all overlapping positions */
- private List fOverlappingPositionReferences;
- /** Position updater used for partitioning positions */
- private IPositionUpdater fPartitioningUpdater;
-
-
-
- /**
- * Creates a new content formatter. The content formatter operates by default
- * in the partition-aware mode. There are no preconfigured formatting strategies.
- */
- public ContentFormatter() {
- }
-
- /**
- * Registers a strategy for a particular content type. If there is already a strategy
- * registered for this type, the new strategy is registered instead of the old one.
- * If the given content type is <code>null</code> the given strategy is registered for
- * all content types as is called only once per formatting session.
- *
- * @param strategy the formatting strategy to register, or <code>null</code> to remove an existing one
- * @param contentType the content type under which to register, or <code>null</code> for all content types
- */
- public void setFormattingStrategy(IFormattingStrategy strategy, String contentType) {
-
- Assert.isNotNull(contentType);
-
- if (fStrategies == null)
- fStrategies= new HashMap();
-
- if (strategy == null)
- fStrategies.remove(contentType);
- else
- fStrategies.put(contentType, strategy);
- }
-
- /**
- * Informs this content formatter about the names of those position categories
- * which are used to manage the document's partitioning information and thus should
- * be ignored when this formatter updates positions.
- *
- * @param categories the categories to be ignored
- */
- public void setPartitionManagingPositionCategories(String[] categories) {
- fPartitionManagingCategories= categories;
- }
-
- /**
- * Sets the formatter's operation mode.
- *
- * @param enable indicates whether the formatting process should be partition ware
- */
- public void enablePartitionAwareFormatting(boolean enable) {
- fIsPartitionAware= enable;
- }
-
- /*
- * @see IContentFormatter#getFormattingStrategy(String)
- */
- public IFormattingStrategy getFormattingStrategy(String contentType) {
-
- Assert.isNotNull(contentType);
-
- if (fStrategies == null)
- return null;
-
- return (IFormattingStrategy) fStrategies.get(contentType);
- }
-
- /*
- * @see IContentFormatter#format(IDocument, IRegion)
- */
- public void format(IDocument document, IRegion region) {
- if (fIsPartitionAware)
- formatPartitions(document, region);
- else
- formatRegion(document, region);
- }
-
- /**
- * Determines the partitioning of the given region of the document.
- * Informs the formatting strategies of each partition about the start,
- * the process, and the termination of the formatting session.
- *
- * @param document the document to be formatted
- * @param region the document region to be formatted
- */
- private void formatPartitions(IDocument document, IRegion region) {
-
- addPartitioningUpdater(document);
-
- try {
-
- TypedPosition[] ranges= getPartitioning(document, region);
- if (ranges != null) {
- start(ranges, getIndentation(document, region.getOffset()));
- format(document, ranges);
- stop(ranges);
- }
-
- } catch (BadLocationException x) {
- }
-
- removePartitioningUpdater(document);
- }
-
- /**
- * Formats the given region with the strategy registered for the default
- * content type. The strategy is informed about the start, the process, and
- * the termination of the formatting session.
- *
- * @param document the document to be formatted
- * @param region the region to be formatted
- */
- private void formatRegion(IDocument document, IRegion region) {
-
- IFormattingStrategy strategy= getFormattingStrategy(IDocument.DEFAULT_CONTENT_TYPE);
- if (strategy != null) {
- strategy.formatterStarts(getIndentation(document, region.getOffset()));
- format(document, strategy, new TypedPosition(region.getOffset(), region.getLength(), IDocument.DEFAULT_CONTENT_TYPE));
- strategy.formatterStops();
- }
- }
-
- /**
- * Returns the partitioning of the given region of the specified document.
- * As one partition after the other will be formatted and formatting will
- * probably change the length of the formatted partition, it must be kept
- * track of the modifications in order to submit the correct partition to all
- * formatting strategies. For this, all partitions are remembered as positions
- * in a dedicated position category. (As formatting stratgies might rely on each
- * other, calling them in reversed order is not an option.)
- *
- * @param document the document
- * @param region the region for which the partitioning must be determined
- * @return the partitioning of the specified region
- * @exception BadLocationException of region is invalid in the document
- */
- private TypedPosition[] getPartitioning(IDocument document, IRegion region) throws BadLocationException {
-
- ITypedRegion[] regions= document.computePartitioning(region.getOffset(), region.getLength());
- TypedPosition[] positions= new TypedPosition[regions.length];
-
- for (int i= 0; i < regions.length; i++) {
- positions[i]= new TypedPosition(regions[i]);
- try {
- document.addPosition(PARTITIONING, positions[i]);
- } catch (BadPositionCategoryException x) {
- // should not happen
- }
- }
-
- return positions;
- }
-
- /**
- * Fires <code>formatterStarts</code> to all formatter strategies
- * which will be involved in the forthcoming formatting process.
- *
- * @param regions the partitioning of the document to be formatted
- * @param indentation the initial indentation
- */
- private void start(TypedPosition[] regions, String indentation) {
- for (int i= 0; i < regions.length; i++) {
- IFormattingStrategy s= getFormattingStrategy(regions[i].getType());
- if (s != null)
- s.formatterStarts(indentation);
- }
- }
-
- /**
- * Formats one partition after the other using the formatter strategy registered for
- * the partition's content type.
- *
- * @param document to document to be formatted
- * @param ranges the partitioning of the document region to be formatted
- */
- private void format(final IDocument document, TypedPosition[] ranges) {
- for (int i= 0; i < ranges.length; i++) {
- IFormattingStrategy s= getFormattingStrategy(ranges[i].getType());
- if (s != null) {
- format(document, s, ranges[i]);
- }
- }
- }
-
- /**
- * Formats the given region of the document using the specified formatting
- * strategy. In order to maintain positions correctly, first all affected
- * positions determined, after all document listeners have been informed about
- * the upcoming change, the affected positions are removed to avoid that they
- * are regularily updated. After all position updaters have run, the affected
- * positions are updated with the formatter's information and added back to
- * their categories, right before the first document listener is informed about
- * that a change happend.
- *
- * @param document the document to be formatted
- * @param strategy the strategy to be used
- * @param region the region to be formatted
- */
- private void format(final IDocument document, IFormattingStrategy strategy, TypedPosition region) {
- try {
-
- final int offset= region.getOffset();
- int length= region.getLength();
-
- String content= document.get(offset, length);
- final int[] positions= getAffectedPositions(document, offset, length);
- String formatted= strategy.format(content, isLineStart(document, offset), getIndentation(document, offset), positions);
-
- IPositionUpdater first= new RemoveAffectedPositions();
- document.insertPositionUpdater(first, 0);
- IPositionUpdater last= new UpdateAffectedPositions(positions, offset);
- document.addPositionUpdater(last);
-
- document.replace(offset, length, formatted);
-
- document.removePositionUpdater(first);
- document.removePositionUpdater(last);
-
- } catch (BadLocationException x) {
- // should not happen
- }
- }
-
- /**
- * Fires <code>formatterStops</code> to all formatter strategies which were
- * involved in the formatting process which is about to terminate.
- *
- * @param regions the partitioning of the document which has been formatted
- */
- private void stop(TypedPosition[] regions) {
- for (int i= 0; i < regions.length; i++) {
- IFormattingStrategy s= getFormattingStrategy(regions[i].getType());
- if (s != null)
- s.formatterStops();
- }
- }
-
- /**
- * Installs those updaters which the formatter needs to keep
- * track of the partitions.
- *
- * @param document the document to be formatted
- */
- private void addPartitioningUpdater(IDocument document) {
- fPartitioningUpdater= new NonDeletingPositionUpdater(PARTITIONING);
- document.addPositionCategory(PARTITIONING);
- document.addPositionUpdater(fPartitioningUpdater);
- }
-
- /**
- * Removes the formatter's internal position updater and category.
- *
- * @param document the document that has been formatted
- */
- private void removePartitioningUpdater(IDocument document) {
-
- try {
-
- document.removePositionUpdater(fPartitioningUpdater);
- document.removePositionCategory(PARTITIONING);
- fPartitioningUpdater= null;
-
- } catch (BadPositionCategoryException x) {
- // should not happen
- }
- }
-
- /**
- * Determines whether the given document position category should be ignored
- * by this formatter's position updating.
- *
- * @param category the category to check
- * @return <code>true</code> if the category should be ignored, <code>false</code> otherwise
- */
- private boolean ignoreCategory(String category) {
-
- if (PARTITIONING.equals(category))
- return true;
-
- if (fPartitionManagingCategories != null) {
- for (int i= 0; i < fPartitionManagingCategories.length; i++) {
- if (fPartitionManagingCategories[i].equals(category))
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Determines all embracing, overlapping, and follow up positions
- * for the given region of the document.
- *
- * @param document the document to be formatted
- * @param offset the offset of the document region to be formatted
- * @param length the length of the document to be formatted
- */
- private void determinePositionsToUpdate(IDocument document, int offset, int length) {
-
- String[] categories= document.getPositionCategories();
- if (categories != null) {
- for (int i= 0; i < categories.length; i++) {
-
- if (ignoreCategory(categories[i]))
- continue;
-
- try {
-
- Position[] positions= document.getPositions(categories[i]);
-
- for (int j= 0; j < positions.length; j++) {
-
- Position p= (Position) positions[j];
- if (p.overlapsWith(offset, length)) {
-
- if (offset < p.getOffset())
- fOverlappingPositionReferences.add(new PositionReference(p, true, categories[i]));
-
- if (p.getOffset() + p.getLength() < offset + length)
- fOverlappingPositionReferences.add(new PositionReference(p, false, categories[i]));
- }
- }
-
- } catch (BadPositionCategoryException x) {
- // can not happen
- }
- }
- }
- }
-
- /**
- * Returns all offset and the end offset of all positions overlapping with the
- * specified document range.
- *
- * @param document the document to be formatted
- * @param offset the offset of the document region to be formatted
- * @param length the length of the document to be formatted
- * @return all character positions of the interleaving positions
- */
- private int[] getAffectedPositions(IDocument document, int offset, int length) {
-
- fOverlappingPositionReferences= new ArrayList();
-
- determinePositionsToUpdate(document, offset, length);
-
- Collections.sort(fOverlappingPositionReferences);
-
- int[] positions= new int[fOverlappingPositionReferences.size()];
- for (int i= 0; i < positions.length; i++) {
- PositionReference r= (PositionReference) fOverlappingPositionReferences.get(i);
- positions[i]= r.getCharacterPosition() - offset;
- }
-
- return positions;
- }
-
- /**
- * Removes the affected positions from their categories to avoid
- * that they are invalidly updated.
- *
- * @param document the document
- */
- private void removeAffectedPositions(IDocument document) {
- int size= fOverlappingPositionReferences.size();
- for (int i= 0; i < size; i++) {
- PositionReference r= (PositionReference) fOverlappingPositionReferences.get(i);
- try {
- document.removePosition(r.getCategory(), r.getPosition());
- } catch (BadPositionCategoryException x) {
- // can not happen
- }
- }
- }
-
- /**
- * Updates all the overlapping positions. Note, all other positions are
- * automatically updated by their document position updaters.
- *
- * @param document the document to has been formatted
- * @param positions the adapted character positions to be used to update the document positions
- * @param offset the offset of the document region that has been formatted
- */
- protected void updateAffectedPositions(IDocument document, int[] positions, int offset) {
-
- if (positions.length == 0)
- return;
-
- for (int i= 0; i < positions.length; i++) {
-
- PositionReference r= (PositionReference) fOverlappingPositionReferences.get(i);
-
- if (r.refersToOffset())
- r.setOffset(offset + positions[i]);
- else
- r.setLength((offset + positions[i]) - r.getOffset());
-
- Position p= r.getPosition();
- String category= r.getCategory();
- if (!document.containsPosition(category, p.offset, p.length)) {
- try {
- if (positionAboutToBeAdded(document, category, p))
- document.addPosition(r.getCategory(), p);
- } catch (BadPositionCategoryException x) {
- // can not happen
- } catch (BadLocationException x) {
- // should not happen
- }
- }
-
- }
-
- fOverlappingPositionReferences= null;
- }
-
- /**
- * The given position is about to be added to the given position category of the given document. <p>
- * This default implementation enacts the same rule as the TextViewer, i.e. if the position is used for
- * managing slave documents it is ensured that the slave document starts at a line offset.
- *
- * @param document the document
- * @param category the position categroy
- * @param position the position that will be added
- * @return <code>true</code> if the position can be added, <code>false</code> if it should be ignored
- */
- protected boolean positionAboutToBeAdded(IDocument document, String category, Position position) {
- if (ChildDocumentManager.CHILDDOCUMENTS.equals(category)) {
- /*
- * We assume child document offsets to be at the beginning
- * of a line. Because the formatter might have moved the
- * position to be somewhere in the middle of a line we patch it here.
- */
- try {
- int lineOffset= document.getLineInformationOfOffset(position.offset).getOffset();
- position.setLength(position.length + position.offset - lineOffset);
- position.setOffset(lineOffset);
- } catch (BadLocationException x) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns the indentation of the line of the given offset.
- *
- * @param document the document
- * @param offset the offset
- * @return the indentation of the line of the offset
- */
- private String getIndentation(IDocument document, int offset) {
-
- try {
- int start= document.getLineOfOffset(offset);
- start= document.getLineOffset(start);
-
- int end= start;
- char c= document.getChar(end);
- while ('\t' == c || ' ' == c)
- c= document.getChar(++end);
-
- return document.get(start, end - start);
- } catch (BadLocationException x) {
- }
-
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Determines whether the offset is the beginning of a line in the given document.
- *
- * @param document the document
- * @param offset the offset
- * @return <code>true</code> if offset is the beginning of a line
- * @exception BadLocationException if offset is invalid in document
- */
- private boolean isLineStart(IDocument document, int offset) throws BadLocationException {
- int start= document.getLineOfOffset(offset);
- start= document.getLineOffset(start);
- return (start == offset);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatter.java
deleted file mode 100644
index 4b60fdd..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.formatter;
-
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-
-
-/**
- * The interface of a document content formatter. The formatter formats ranges
- * within documents. The documents are modified by the formatter.<p>
- * The content formatter is assumed to determine the partitioning of the document
- * range to be formatted. For each partition, the formatter determines based
- * on the partition's content type the formatting strategy to be used. Before
- * the first strategy is activated all strategies are informed about the
- * start of the formatting process. After that, the formatting strategies are
- * activated in the sequence defined by the partitioning of the document range to be
- * formatted. It is assumed that a strategy must be finished before the next strategy
- * can be activated. After the last strategy has been finished, all strategies are
- * informed about the termination of the formatting process.<p>
- * The interface can be implemented by clients. By default, clients use <code>ContentFormatter</code>
- * as the standard implementer of this interface.
- *
- * @see IDocument
- * @see IFormattingStrategy
- */
-public interface IContentFormatter {
-
- /**
- * Formats the given region of the specified document.The formatter may safely
- * assume that it is the only subject that modifies the document at this point in time.
- *
- * @param document the document to be formatted
- * @param region the region within the document to be formatted
- */
- void format(IDocument document, IRegion region);
-
- /**
- * Returns the formatting strategy registered for the given content type.
- *
- * @param contentType the content type for which to look up the formatting strategy
- * @return the formatting strategy for the given content type, or
- * <code>null</code> if there is no such strategy
- */
- IFormattingStrategy getFormattingStrategy(String contentType);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategy.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategy.java
deleted file mode 100644
index 892ec64..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategy.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.formatter;
-
-
-/**
- * An formatting strategy is assumed to be specialized on formatting text
- * of a particular content type. Each formatting process calls the strategy's
- * methods in the following sequence:
- * <ul>
- * <li><code>formatterStarts</code>
- * <li><code>format</code>
- * <li><code>formatterStops</code>
- * </ul>
- * This interface must be implemented by clients. Implementers should be registered with
- * a content formatter in order get involved in the formatting process.
- */
-public interface IFormattingStrategy {
-
- /**
- * Informs the strategy about the start of a formatting process in which it will
- * participate.
- *
- * @param initialIndentation the indent string of the first line at which the
- * overall formatting process starts.
- */
- void formatterStarts(String initialIndentation);
-
- /**
- * Formats the given string. During the formatting process this strategy must update
- * the given character positions according to the changes applied to the given string.
- *
- * @param content the initial string to be formatted
- * @param isLineStart indicates whether the beginning of content is a line start in its document
- * @param indentation the indentation string to be used
- * @param positions the character positions to be updated
- * @return the formatted string
- */
- String format(String content, boolean isLineStart, String indentation, int[] positions);
-
- /**
- * Informs the strategy that the formatting process in which it has participated
- * has been finished.
- */
- void formatterStops();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/package.html b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/package.html
deleted file mode 100644
index 33f16a7..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/package.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.51 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a text formatter add-on for an <tt>ITextViewer</tt>.
-A text formatter changes the formatting of document region while
-preserving and correctly updating the positions of the document.
-<h2>
-Package Specification</h2>
-<tt>IContentFormatter</tt> defines the concept of a text formatter. It
-collaborates with content type specific formatting stratgies (<tt>IFormattingStrategy</tt>)
-which for a given document region format the subregion with the matching
-content type. The package contains a default implementation of <tt>IContentFormatter</tt>
-(<tt>ContentFormatter</tt>).
-</body>
-</html>
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenter.java
deleted file mode 100644
index 489f4e8..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenter.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.information;
-
-
-import org.eclipse.jface.text.ITextViewer;
-
-
-/**
- * An information presenter shows information available at the text viewer's
- * current document position. An <code>IInformationPresenter</code> is a
- * <code>ITextViewer</code> add-on.<p>
- * An information presenters has a list of <code>IInformationProvider</code> objects
- * each of which is registered for a particular document content type.
- * The presenter uses the strategy objects to retrieve the information to present.<p>
- * The interface can be implemented by clients. By default, clients use
- * <code>InformationPresenter</code> as the standard implementer of this interface.
- *
- * @see ITextViewer
- * @see IInformationProvider
- * @since 2.0
- */
-public interface IInformationPresenter {
-
- /**
- * Installs the information presenter on the given text viewer. After this method has been
- * finished, the presenter is operational. I.e., the method <code>showInformation</code>
- * can be called until <code>uninstall</code> is called.
- *
- * @param textViewer the viewer on which the presenter is installed
- */
- void install(ITextViewer textViewer);
-
- /**
- * Removes the information presenter from the text viewer it has previously been
- * installed on.
- */
- void uninstall();
-
- /**
- * Shows information related to the cursor position of the text viewer
- * this information presenter is installed on.
- *
- * @return an optional error message if
- */
- void showInformation();
-
- /**
- * Returns the information provider to be used for the given content type.
- *
- * @param contentType the type of the content for which information will be requested
- * @return an information provider or
- * <code>null</code> if none exists for the specified content type
- */
- IInformationProvider getInformationProvider(String contentType);
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationProvider.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationProvider.java
deleted file mode 100644
index 527aec4..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationProvider.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.information;
-
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-
-
-/**
- * Provides information related to the content of a text viewer.<p>
- * Clients may implement this interface.
- *
- * @see ITextViewer
- * @since 2.0
- */
-public interface IInformationProvider {
-
- /**
- * Returns the region of the text viewer's document close to the given
- * offset that contains a subject about which information can be provided.<p>
- * For example, if information can be provided on a per code block basis,
- * the offset should be used to find the enclosing code block and the source
- * range of the block should be returned.
- *
- * @param textViewer the text viewer in which informationhas been requested
- * @param offset the offset at which information has been requested
- * @return the region of the text viewer's document containing the information subject
- */
- IRegion getSubject(ITextViewer textViewer, int offset);
-
- /**
- * Returns the information about the given subject or <code>null</code> if
- * no information is available. It depends on the concrete configuration in which
- * format the information is to be provided. For example, information presented
- * in an information control displaying HTML, should be provided in HTML.
- *
- * @param textViewer the viewer in whose document the subject is contained
- * @param subject the text region constituting the information subject
- * @return the information about the subject
- * @see IInformationPresenter
- * @deprecated As of 2.1, replaced by {@link IInformationProviderExtension#getInformation2(ITextViewer, IRegion)}
- */
- String getInformation(ITextViewer textViewer, IRegion subject);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationProviderExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationProviderExtension.java
deleted file mode 100644
index 077c9f1..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationProviderExtension.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.information;
-
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-
-
-/**
- * Extension interface for <code>IInformationProvider</code> to provide
- * the element for a given subject.
- *
- * @see org.eclipse.jface.text.information.IInformationProvider
- * @since 2.1
- */
-public interface IInformationProviderExtension {
-
- /**
- * Returns the element for the given subject or <code>null</code> if
- * no element is available.
- * <p>
- * Implementers should ignore the text returned by <code>IInformationProvider.getInformation()</code>.
- * </p>
- *
- * @param textViewer the viewer in whose document the subject is contained
- * @param subject the text region constituting the information subject
- * @return the element for the subject
- *
- * @see IInformationProvider#getInformation(ITextViewer, IRegion)
- * @see org.eclipse.jface.text.ITextViewer
- */
- Object getInformation2(ITextViewer textViewer, IRegion subject);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/InformationPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/information/InformationPresenter.java
deleted file mode 100644
index ed56d0e..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/InformationPresenter.java
+++ /dev/null
@@ -1,435 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.information;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-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.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.text.AbstractInformationControlManager;
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension3;
-import org.eclipse.jface.text.IViewportListener;
-import org.eclipse.jface.text.IWidgetTokenKeeper;
-import org.eclipse.jface.text.IWidgetTokenOwner;
-import org.eclipse.jface.text.Region;
-
-
-/**
- * Standard implementation of <code>IInformationPresenter</code>.
- * This implementation extends <code>AbstractInformationControlManager</code>.
- * The information control is made visible on request by calling
- * <code>showInformation</code>.<p>
- * Usually, clients instantiate this class and configure it before using it. The configuration
- * must be consistent: This means the used <code>IInformationControlCreator</code>
- * must create an information control expecting information in the same format the configured
- * <code>IInformationProvider</code>s use to encode the information they provide.
- *
- * @since 2.0
- */
-public class InformationPresenter extends AbstractInformationControlManager implements IInformationPresenter, IWidgetTokenKeeper {
-
- /**
- * Internal information control closer. Listens to several events issued by its subject control
- * and closes the information control when necessary.
- */
- class Closer implements IInformationControlCloser, ControlListener, MouseListener,
- FocusListener, IViewportListener, KeyListener {
-
- /** The subject control */
- private Control fSubjectControl;
- /** The information control */
- private IInformationControl fInformationControl;
- /** Indicates whether this closer is active */
- private boolean fIsActive= false;
-
- /*
- * @see IInformationControlCloser#setSubjectControl(Control)
- */
- public void setSubjectControl(Control control) {
- fSubjectControl= control;
- }
-
- /*
- * @see IInformationControlCloser#setInformationControl(IInformationControl)
- */
- public void setInformationControl(IInformationControl control) {
- fInformationControl= control;
- }
-
- /*
- * @see IInformationControlCloser#start(Rectangle)
- */
- public void start(Rectangle informationArea) {
-
- if (fIsActive)
- return;
- fIsActive= true;
-
- if (fSubjectControl != null && ! fSubjectControl.isDisposed()) {
- fSubjectControl.addControlListener(this);
- fSubjectControl.addMouseListener(this);
- fSubjectControl.addFocusListener(this);
- fSubjectControl.addKeyListener(this);
- }
-
- if (fInformationControl != null)
- fInformationControl.addFocusListener(this);
-
- fTextViewer.addViewportListener(this);
- }
-
- /*
- * @see IInformationControlCloser#stop()
- */
- public void stop() {
-
- if (!fIsActive)
- return;
- fIsActive= false;
-
- fTextViewer.removeViewportListener(this);
-
- if (fInformationControl != null)
- fInformationControl.removeFocusListener(this);
-
- hideInformationControl();
-
- if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
- fSubjectControl.removeControlListener(this);
- fSubjectControl.removeMouseListener(this);
- fSubjectControl.removeFocusListener(this);
- fSubjectControl.removeKeyListener(this);
- }
- }
-
- /*
- * @see ControlListener#controlResized(ControlEvent)
- */
- public void controlResized(ControlEvent e) {
- stop();
- }
-
- /*
- * @see ControlListener#controlMoved(ControlEvent)
- */
- public void controlMoved(ControlEvent e) {
- stop();
- }
-
- /*
- * @see MouseListener#mouseDown(MouseEvent)
- */
- public void mouseDown(MouseEvent e) {
- stop();
- }
-
- /*
- * @see MouseListener#mouseUp(MouseEvent)
- */
- public void mouseUp(MouseEvent e) {
- }
-
- /*
- * @see MouseListener#mouseDoubleClick(MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- stop();
- }
-
- /*
- * @see FocusListener#focusGained(FocusEvent)
- */
- public void focusGained(FocusEvent e) {
- }
-
- /*
- * @see FocusListener#focusLost(FocusEvent)
- */
- public void focusLost(FocusEvent e) {
- Display d= fSubjectControl.getDisplay();
- d.asyncExec(new Runnable() {
- public void run() {
- if (fInformationControl == null || !fInformationControl.isFocusControl())
- stop();
- }
- });
- }
-
- /*
- * @see IViewportListenerListener#viewportChanged(int)
- */
- public void viewportChanged(int topIndex) {
- stop();
- }
-
- /*
- * @see KeyListener#keyPressed(KeyEvent)
- */
- public void keyPressed(KeyEvent e) {
- stop();
- }
-
- /*
- * @see KeyListener#keyReleased(KeyEvent)
- */
- public void keyReleased(KeyEvent e) {
- }
- };
-
-
- /** The text viewer this information presenter works on */
- private ITextViewer fTextViewer;
- /** The map of <code>IInformationProvider</code> objects */
- private Map fProviders;
- /** The offset to override selection. */
- private int fOffset= -1;
-
-
- /**
- * Creates a new information presenter that uses the given information control creator.
- * The presenter is not installed on any text viewer yet. By default, an information
- * control closer is set that closes the information control in the event of key strokes,
- * resizing, moves, focus changes, mouse clicks, and disposal - all of those applied to
- * the information control's parent control. Also, the setup ensures that the information
- * control when made visible will request thel focus.
- *
- * @param creator the information control creator to be used
- */
- public InformationPresenter(IInformationControlCreator creator) {
- super(creator);
- setCloser(new Closer());
- takesFocusWhenVisible(true);
- }
-
- /**
- * Registers a given information provider for a particular content type.
- * If there is already a provider registered for this type, the new provider
- * is registered instead of the old one.
- *
- * @param provider the information provider to register, or <code>null</code> to remove an existing one
- * @param contentType the content type under which to register
- */
- public void setInformationProvider(IInformationProvider provider, String contentType) {
-
- Assert.isNotNull(contentType);
-
- if (fProviders == null)
- fProviders= new HashMap();
-
- if (provider == null)
- fProviders.remove(contentType);
- else
- fProviders.put(contentType, provider);
- }
-
- /*
- * @see IInformationPresenter#getInformationProvider(String)
- */
- public IInformationProvider getInformationProvider(String contentType) {
- if (fProviders == null)
- return null;
-
- return (IInformationProvider) fProviders.get(contentType);
- }
-
- /**
- * Sets a offset to override the selection. Setting the value to <code>-1</code> will disable
- * overriding.
- *
- * @param offset the offset to override selection or <code>-1</code>
- */
- public void setOffset(int offset) {
- fOffset= offset;
- }
-
- /*
- * @see AbstractInformationControlManager#computeInformation()
- */
- protected void computeInformation() {
-
- int offset= fOffset < 0 ? fTextViewer.getSelectedRange().x : fOffset;
- if (offset == -1)
- return;
-
- fOffset= -1;
-
- IInformationProvider provider= null;
- try {
- IDocument document= fTextViewer.getDocument();
- String type= document.getContentType(offset);
- provider= getInformationProvider(type);
- } catch (BadLocationException x) {
- }
- if (provider == null)
- return;
-
- IRegion subject= provider.getSubject(fTextViewer, offset);
- if (subject == null)
- return;
-
- if (provider instanceof IInformationProviderExtension) {
- IInformationProviderExtension extension= (IInformationProviderExtension) provider;
- setInformation(extension.getInformation2(fTextViewer, subject), computeArea(subject));
- } else
- setInformation(provider.getInformation(fTextViewer, subject), computeArea(subject));
- }
-
- /**
- * Determines the graphical area covered by the given text region.
- *
- * @param region the region whose graphical extend must be computed
- * @return the graphical extend of the given region
- */
- private Rectangle computeArea(IRegion region) {
-
- IRegion widgetRegion= modelRange2WidgetRange(region);
- int start= widgetRegion.getOffset();
- int end= widgetRegion.getOffset() + widgetRegion.getLength();
-
- StyledText styledText= fTextViewer.getTextWidget();
- Point upperLeft= styledText.getLocationAtOffset(start);
- Point lowerRight= new Point(upperLeft.x, upperLeft.y);
-
- for (int i= start +1; i < end; i++) {
-
- Point p= styledText.getLocationAtOffset(i);
-
- if (upperLeft.x > p.x)
- upperLeft.x= p.x;
-
- if (upperLeft.y > p.y)
- upperLeft.y= p.y;
-
- if (lowerRight.x < p.x)
- lowerRight.x= p.x;
-
- if (lowerRight.y < p.y)
- lowerRight.y= p.y;
- }
-
- GC gc= new GC(styledText);
- lowerRight.x += gc.getFontMetrics().getAverageCharWidth();
- lowerRight.y += styledText.getLineHeight();
- gc.dispose();
-
- int width= lowerRight.x - upperLeft.x;
- int height= lowerRight.y - upperLeft.y;
- return new Rectangle(upperLeft.x, upperLeft.y, width, height);
- }
-
- /**
- * Translated the given range in the viewer's document into the corresponding
- * range of the viewer's widget.
- *
- * @param region the range in the viewer's document
- * @return the corresponding widget range
- * @since 2.1
- */
- private IRegion modelRange2WidgetRange(IRegion region) {
- if (fTextViewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) fTextViewer;
- return extension.modelRange2WidgetRange(region);
- }
-
- IRegion visibleRegion= fTextViewer.getVisibleRegion();
- int start= region.getOffset() - visibleRegion.getOffset();
- int end= start + region.getLength();
- if (end > visibleRegion.getLength())
- end= visibleRegion.getLength();
-
- return new Region(start, end - start);
- }
-
- /*
- * @see IInformationPresenter#install(ITextViewer)
- */
- public void install(ITextViewer textViewer) {
- fTextViewer= textViewer;
- install(fTextViewer.getTextWidget());
- }
-
- /*
- * @see IInformationPresenter#uninstall()
- */
- public void uninstall() {
- dispose();
- }
-
- /*
- * @see AbstractInformationControlManager#showInformationControl(Rectangle)
- */
- protected void showInformationControl(Rectangle subjectArea) {
- if (fTextViewer instanceof IWidgetTokenOwner) {
- IWidgetTokenOwner owner= (IWidgetTokenOwner) fTextViewer;
- if (owner.requestWidgetToken(this))
- super.showInformationControl(subjectArea);
- }
- }
-
- /*
- * @see AbstractInformationControlManager#hideInformationControl()
- */
- protected void hideInformationControl() {
- try {
- super.hideInformationControl();
- } finally {
- if (fTextViewer instanceof IWidgetTokenOwner) {
- IWidgetTokenOwner owner= (IWidgetTokenOwner) fTextViewer;
- owner.releaseWidgetToken(this);
- }
- }
- }
-
- /*
- * @see AbstractInformationControlManager#handleInformationControlDisposed()
- */
- protected void handleInformationControlDisposed() {
- try {
- super.handleInformationControlDisposed();
- } finally {
- if (fTextViewer instanceof IWidgetTokenOwner) {
- IWidgetTokenOwner owner= (IWidgetTokenOwner) fTextViewer;
- owner.releaseWidgetToken(this);
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IWidgetTokenKeeper#requestWidgetToken(IWidgetTokenOwner)
- */
- public boolean requestWidgetToken(IWidgetTokenOwner owner) {
- return false;
- }
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/package.html b/org.eclipse.jface.text/src/org/eclipse/jface/text/information/package.html
deleted file mode 100644
index 2c20da0..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/package.html
+++ /dev/null
@@ -1,22 +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.76 [en] (Windows NT 5.0; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides an information provider add-on for an <tt>ITextViewer</tt>.
-An information provider presents information for a certain subject in a
-specific information control. An information control usually is a floating
-window.
-<h2>
-Package Specification</h2>
-<tt>IInformationPresenter</tt> defines the concept of an information provider.
-It collaborates with content type specific information providers (<tt>IInformationProvider</tt>)
-which determine for a certain offset in a text viewer an information subject
-and the information available about this subject.. The package contains
-a default implementation of <tt>IInformationPresenter</tt> (<tt>InformationPresenter</tt>).
-</body>
-</html>
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/package.html b/org.eclipse.jface.text/src/org/eclipse/jface/text/package.html
deleted file mode 100644
index 5561c37..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/package.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <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 creating, manipulating, displaying
-and editing text documents.
-<h2>
-Package Specification</h2>
-The packages is divided into two parts. The first part defines and implements
-the notion of text documents, whereas the second part defines and implements
-a viewer for text documents.
-<h3>
-Text Model</h3>
-<tt>IDocument</tt> is the major text model abstraction. It provides content
-management, position management using position categories, document partition
-management, searching, and change notification. In order to be notified
-about document changes, an object must implements <tt>IDocumentListener</tt>
-and must be registered with the document. Position updating in responds
-to a document change is performed by implementers of <tt>IDocumentPositionUpdater</tt>.
-Partition updating in responds to a document change is performed by implements
-of <tt>IDocumentPartitioner</tt>. In order to be notified about document
-partition changes, objects must implement <tt>IDocumentParititoningListener</tt>
-and must be registered with the document.
-<p>The package contains default implementations for document position updaters
-and for documents. <tt>AbstractDocument</tt> uses <tt>ITextStorage</tt>
-for storing and managing its content and <tt>ILineTracker</tt> to maintain
-a line structure of its content. As defaults a gap text implementation
-of <tt>ITextStore</tt> is provided, together with a line tracker understanding
-the three standard line delimiters ("\r", "\n", "\r\n") and a line
-tracker which can be freely configured to consider any given set of strings
-as valid line delimiters.
-<h3>
-Text Viewer</h3>
-<tt>ITextViewer</tt> defines the concept of a document based, editiable
-viewer. <tt>ITextViewer</tt> offers the following functionality:
-<ul>
-<li>
-present a document</li>
-
-<li>
-event consumption (<tt>IEventConsumer</tt>)</li>
-
-<li>
-viewport tracking and notification (<tt>IIViewportListener</tt>)</li>
-
-<li>
-change notification (<tt>ITextListener</tt>, <tt>ITextInputListener</tt>)</li>
-
-<li>
-listeners (combined view/model notification, input document)</li>
-
-<li>
-standard text editing functions plus text hover support</li>
-
-<li>
-visual region support</li>
-</ul>
-An ITextViewer supports the following plugins
-<ul>
-<li>
-<tt>IUndoManager</tt> for the undo/redo mechanism</li>
-
-<li>
-<tt>IDoubleClickStrategy</tt> for partition type specific behavior on mouse
-double click</li>
-
-<li>
-<tt>IAutoIndentStrategy</tt> for content type specific behavior on
-inserting a line break</li>
-
-<li>
-<tt>ITextHover</tt> for content type specific behavior when overing over
-text</li>
-</ul>
-The package provides default implementations for all these interfaces.
-</body>
-</html>
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationDamager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationDamager.java
deleted file mode 100644
index fcd9560..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationDamager.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.jface.text.presentation;
-
-
-
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-
-
-/**
- * Presentation damagers are used by a presentation reconciler to determine the
- * region of the document's presentation which must be rebuilt because of the
- * occurrence of a document change. A presentation damager is assumed to be
- * specific for a particular document content type. A presentation damager is
- * expected to return a damage region which is a valid input for a presentation repairer.
- * I.e. having access to the damage region only the repairer must be able to derive
- * all the information neede to sucessfully repair this region.<p>
- * This interface must either be implemented by clients or clients use the rule-based
- * default implementation <code>RuleBasedDamagerRepairer</code>. Implementers should be
- * registered with a presentation reconciler in order get involved in the reconciling
- * process.
- *
- * @see IPresentationReconciler
- * @see IDocument
- * @see DocumentEvent
- * @see IPresentationRepairer
- */
-public interface IPresentationDamager {
-
- /**
- * Tells the presentation damager on which document it will work.
- *
- * @param document the damager's working document
- */
- void setDocument(IDocument document);
-
- /**
- * Returns the damage in the document's presentation caused by the given document change.
- * The damage is restricted to the specified partition for which the presentation damager is
- * responsible. The damage may also depend on whether the document change also caused changes
- * of the document's partitioning.
- *
- * @param partition the partition inside which the damage must be determined
- * @param event the event describing the change whose damage must be determined
- * @param documentPartitioningChange indicates whether the given change changed the document's partitioning
- * @return the computed damage
- */
- IRegion getDamageRegion(ITypedRegion partition, DocumentEvent event, boolean documentPartitioningChanged);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationReconciler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationReconciler.java
deleted file mode 100644
index fc92652..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationReconciler.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.jface.text.presentation;
-
-
-import org.eclipse.jface.text.ITextViewer;
-
-
-/**
- * An <code>IPresentationReconciler</code> defines and maintains the representation of a
- * text viewer's document in the presence of changes applied to the document.
- * An <code>IPresentationReconciler</code> is a <code>ITextViewer</code> add-on.<p>
- * The presentation reconciler keeps track of changes applied to the text viewer. It sends
- * each change to presentation damagers which are registered for the content types of the
- * regions in which the change occurred. The presentation reconciler passes the computed
- * damage to presentation repairers which construct text presentations. Those text presentation
- * when applied to the presentation reconciler's text viewer bring the document's presentation
- * in sync with the document's content and thus repair the damage. A presentation damager
- * is expected to return damage which is a valid input for a presentation repairer registered
- * for the same content type as the damager.<p>
- * A presentation reconciler should always be configured with damager/repairer pairs. I.e.
- * for each damager there should be a corresponding repairer.<p>
- * The interface can be implemented by clients. By default, clients use
- * <code>PresentationReconciler</code> as the standard implementer of this interface.
- *
- * @see ITextViewer
- * @see IPresentationDamager
- * @see IPresentationRepairer
- * @see org.eclipse.jface.text.TextPresentation
- */
-public interface IPresentationReconciler {
-
- /**
- * Installs this presentation reconciler on the given text viewer. After
- * this method has been finished, the reconciler is operational. I.e., it
- * works without requesting further client actions until <code>uninstall</code>
- * is called.
- *
- * @param textViewer the viewer on which this presentation reconciler is installed
- */
- void install(ITextViewer viewer);
-
- /**
- * Removes the reconciler from the text viewer it has previously been
- * installed on.
- */
- void uninstall();
-
- /**
- * Returns the presentation damager registered with this presentation reconciler
- * for the specified content type.
- *
- * @param contentType the content type for which to determine the damager
- * @return the presentation damager registered for the given content type, or
- * <code>null</code> if there is no such strategy
- */
- IPresentationDamager getDamager(String contentType);
-
- /**
- * Returns the presentation repairer registered with this presentation reconciler
- * for the specified content type.
- *
- * @param contentType the content type for which to determine the repairer
- * @return the presentation repairer registered for the given content type, or
- * <code>null</code> if there is no such strategy
- */
- IPresentationRepairer getRepairer(String contentType);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationRepairer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationRepairer.java
deleted file mode 100644
index 571de0a..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/IPresentationRepairer.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.presentation;
-
-
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.TextPresentation;
-
-
-/**
- * Presentation repairers are used by a presentation reconciler
- * to rebuild a damaged region in a document's presentation. A presentation repairer
- * is assumed to be specific for a particular document content type. The presentation
- * repairer gets the region which it should repair and constructs a "repair description"
- * The presentation repairer adds the individual steps of this sequence into the
- * text presentation it gets passed in.<p>
- * This interface must either be implemented by clients or clients use the rule-based
- * default implementation <code>RuleBasedDamagerRepairer</code>. Implementers should be
- * registered with a presentation reconciler in order get involved in the reconciling
- * process.
- *
- * @see IPresentationReconciler
- * @see IDocument
- * @see org.eclipse.swt.custom.StyleRange
- * @see TextPresentation
- */
-public interface IPresentationRepairer {
-
-
- /**
- * Tells the presentation repairer on which document it will work.
- *
- * @param document the damager's working document
- */
- void setDocument(IDocument document);
-
- /**
- * Fills the given presentation with the style ranges which when applied to the
- * presentation reconciler's text viewer repair the presentational damage described by
- * the given region.
- *
- * @param presentation the text presentation to be filled by this repairer
- * @param damage the damage to be repaired
- */
- void createPresentation(TextPresentation presentation, ITypedRegion damage);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/PresentationReconciler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/PresentationReconciler.java
deleted file mode 100644
index 3058320..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/PresentationReconciler.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.presentation;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.DefaultPositionUpdater;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IDocumentPartitioningListener;
-import org.eclipse.jface.text.IDocumentPartitioningListenerExtension;
-import org.eclipse.jface.text.IPositionUpdater;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextInputListener;
-import org.eclipse.jface.text.ITextListener;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension3;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextEvent;
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.jface.text.TypedPosition;
-
-
-
-/**
- * Standard implementation of <code>IPresentationReconciler</code>.
- * This implementation assumes that the tasks performed by its
- * presentation damagers and repairers are lightweight and of low cost.
- * This presentation reconciler runs in the UI thread and always repairs
- * the complete damage caused by a document change rather than just the
- * portion overlapping with the viewer's viewport.<p>
- * Usually, clients instantiate this class and configure it before using it.
- */
-public class PresentationReconciler implements IPresentationReconciler {
-
- /** Prefix of the name of the position category for tracking damage regions. */
- protected final static String TRACKED_PARTITION= "__reconciler_tracked_partition"; //$NON-NLS-1$
-
-
- /**
- * Internal listener class.
- */
- class InternalListener implements
- ITextInputListener, IDocumentListener, ITextListener,
- IDocumentPartitioningListener, IDocumentPartitioningListenerExtension {
-
- /** Set to <code>true</code> if between a document about to be changed and a changed event. */
- private boolean fDocumentChanging= false;
-
- /*
- * @see ITextInputListener#inputDocumentAboutToBeChanged(IDocument, IDocument)
- */
- public void inputDocumentAboutToBeChanged(IDocument oldDocument, IDocument newDocument) {
- if (oldDocument != null) {
- try {
-
- fViewer.removeTextListener(this);
- oldDocument.removeDocumentListener(this);
- oldDocument.removeDocumentPartitioningListener(this);
-
- oldDocument.removePositionUpdater(fPositionUpdater);
- oldDocument.removePositionCategory(fPositionCategory);
-
- } catch (BadPositionCategoryException x) {
- // should not happend for former input documents;
- }
- }
- }
-
- /*
- * @see ITextInputListener#inputDocumenChanged(IDocument, IDocument)
- */
- public void inputDocumentChanged(IDocument oldDocument, IDocument newDocument) {
-
- fDocumentChanging= false;
-
- if (newDocument != null) {
-
- newDocument.addPositionCategory(fPositionCategory);
- newDocument.addPositionUpdater(fPositionUpdater);
-
- newDocument.addDocumentPartitioningListener(this);
- newDocument.addDocumentListener(this);
- fViewer.addTextListener(this);
-
- setDocumentToDamagers(newDocument);
- setDocumentToRepairers(newDocument);
- processDamage(new Region(0, newDocument.getLength()), newDocument);
- }
- }
-
- /*
- * @see IDocumentPartitioningListener#documentPartitioningChanged(IDocument)
- */
- public void documentPartitioningChanged(IDocument document) {
- if (!fDocumentChanging)
- processDamage(new Region(0, document.getLength()), document);
- else
- fDocumentPartitioningChanged= true;
- }
-
- /*
- * @see IDocumentPartitioningListenerExtension#documentPartitioningChanged(IDocument, IRegion)
- * @since 2.0
- */
- public void documentPartitioningChanged(IDocument document, IRegion changedRegion) {
- if (!fDocumentChanging) {
- processDamage(new Region(changedRegion.getOffset(), changedRegion.getLength()), document);
- } else {
- fDocumentPartitioningChanged= true;
- fChangedDocumentPartitions= changedRegion;
- }
- }
-
- /*
- * @see IDocumentListener#documentAboutToBeChanged(DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent e) {
-
- fDocumentChanging= true;
-
- try {
- int offset= e.getOffset() + e.getLength();
- fRememberedPosition= new TypedPosition(e.getDocument().getPartition(offset));
- e.getDocument().addPosition(fPositionCategory, fRememberedPosition);
- } catch (BadLocationException x) {
- // can not happen
- } catch (BadPositionCategoryException x) {
- // should not happen on input elements
- }
- }
-
- /*
- * @see IDocumentListener#documentChanged(DocumentEvent)
- */
- public void documentChanged(DocumentEvent e) {
- try {
- e.getDocument().removePosition(fPositionCategory, fRememberedPosition);
- } catch (BadPositionCategoryException x) {
- // can not happen on input documents
- }
-
- fDocumentChanging= false;
- }
-
- /*
- * @see ITextListener#textChanged(TextEvent)
- */
- public void textChanged(TextEvent e) {
-
- if (!e.getViewerRedrawState())
- return;
-
- DocumentEvent de= e.getDocumentEvent();
-
- if (de == null) {
-
- if (e.getOffset() == 0 && e.getLength() == 0 && e.getText() == null) {
- // redraw state change
- IDocument d= fViewer.getDocument();
- processDamage(new Region(0, d.getLength()), d);
- } else {
- IRegion region= widgetRegion2ModelRegion(e);
- processDamage(region, fViewer.getDocument());
- }
-
- } else {
-
- IRegion damage= getDamage(de);
- if (damage != null)
- processDamage(damage, de.getDocument());
- }
-
- fDocumentPartitioningChanged= false;
- fChangedDocumentPartitions= null;
- }
-
- /**
- * Translates the given text event into the corresponding range of the viewer's document.
- *
- * @param e the text event
- * @return the widget region corresponding the region of the given event
- * @since 2.1
- */
- protected IRegion widgetRegion2ModelRegion(TextEvent e) {
- if (fViewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) fViewer;
- return extension.widgetRange2ModelRange(new Region(e.getOffset(), e.getLength()));
- }
-
- IRegion visible= fViewer.getVisibleRegion();
- IRegion region= new Region(e.getOffset() + visible.getOffset(), e.getLength());
- return region;
- }
- };
-
- /** The map of presentation damagers. */
- private Map fDamagers;
- /** The map of presentation repairers. */
- private Map fRepairers;
- /** The target viewer. */
- private ITextViewer fViewer;
- /** The internal listener. */
- private InternalListener fInternalListener= new InternalListener();
- /** The name of the position category to track damage regions. */
- private String fPositionCategory;
- /** The position updated for the damage regions' position category. */
- private IPositionUpdater fPositionUpdater;
- /** The positions representing the damage regions. */
- private TypedPosition fRememberedPosition;
- /** Flag indicating the receipt of a partitioning changed notification. */
- private boolean fDocumentPartitioningChanged= false;
- /** The range covering the changed parititoning. */
- private IRegion fChangedDocumentPartitions= null;
-
-
- /**
- * Creates a new presentation reconciler. There are no damagers or repairers
- * registered with this reconciler.
- */
- public PresentationReconciler() {
- super();
- fPositionCategory= TRACKED_PARTITION + hashCode();
- fPositionUpdater= new DefaultPositionUpdater(fPositionCategory);
- }
-
- /**
- * Registers a given presentation damager for a particular content type.
- * If there is already a damager registered for this type, the new damager
- * is registered instead of the old one.
- *
- * @param damager the presentation damager to register, or <code>null</code> to remove an existing one
- * @param contentType the content type under which to register
- */
- public void setDamager(IPresentationDamager damager, String contentType) {
-
- Assert.isNotNull(contentType);
-
- if (fDamagers == null)
- fDamagers= new HashMap();
-
- if (damager == null)
- fDamagers.remove(contentType);
- else
- fDamagers.put(contentType, damager);
- }
-
- /**
- * Registers a given presentation repairer for a particular content type.
- * If there is already a repairer registered for this type, the new repairer
- * is registered instead of the old one.
- *
- * @param repairer the presentation repairer to register, or <code>null</code> to remove an existing one
- * @param contentType the content type under which to register
- */
- public void setRepairer(IPresentationRepairer repairer, String contentType) {
-
- Assert.isNotNull(contentType);
-
- if (fRepairers == null)
- fRepairers= new HashMap();
-
- if (repairer == null)
- fRepairers.remove(contentType);
- else
- fRepairers.put(contentType, repairer);
- }
-
- /*
- * @see IPresentationReconciler#install(ITextViewer)
- */
- public void install(ITextViewer viewer) {
- Assert.isNotNull(viewer);
-
- fViewer= viewer;
- fViewer.addTextInputListener(fInternalListener);
- }
-
- /*
- * @see IPresentationReconciler#uninstall()
- */
- public void uninstall() {
- fViewer.removeTextInputListener(fInternalListener);
- }
-
- /*
- * @see IPresentationReconciler#getDamager(String)
- */
- public IPresentationDamager getDamager(String contentType) {
-
- if (fDamagers == null)
- return null;
-
- return (IPresentationDamager) fDamagers.get(contentType);
- }
-
- /*
- * @see IPresentationReconciler#getRepairer(String)
- */
- public IPresentationRepairer getRepairer(String contentType) {
-
- if (fRepairers == null)
- return null;
-
- return (IPresentationRepairer) fRepairers.get(contentType);
- }
-
- /**
- * Informs all registed damagers about the document on which they will work.
- *
- * @param document the document on which to work
- */
- private void setDocumentToDamagers(IDocument document) {
- if (fDamagers != null) {
- Iterator e= fDamagers.values().iterator();
- while (e.hasNext()) {
- IPresentationDamager damager= (IPresentationDamager) e.next();
- damager.setDocument(document);
- }
- }
- }
-
- /**
- * Informs all registed repairers about the document on which they will work.
- *
- * @param document the document on which to work
- */
- private void setDocumentToRepairers(IDocument document) {
- if (fRepairers != null) {
- Iterator e= fRepairers.values().iterator();
- while (e.hasNext()) {
- IPresentationRepairer repairer= (IPresentationRepairer) e.next();
- repairer.setDocument(document);
- }
- }
- }
-
- /**
- * Constructs a "repair description" for the given damage and returns
- * this description as a text presentation. For this, it queries the
- * partitioning of the damage region and asks for each partition an
- * appropriate presentation repairer to construct the "repair description"
- * for this partition.
- *
- * @param damage the damage to be repaired
- * @param document the document whose presentation must be repaired
- * @return the presentation repair descritption as text presentation
- */
- private TextPresentation createPresentation(IRegion damage, IDocument document) {
- try {
-
- TextPresentation presentation= new TextPresentation(1000);
-
- ITypedRegion[] partitioning= document.computePartitioning(damage.getOffset(), damage.getLength());
- for (int i= 0; i < partitioning.length; i++) {
- ITypedRegion r= partitioning[i];
- IPresentationRepairer repairer= getRepairer(r.getType());
- if (repairer != null)
- repairer.createPresentation(presentation, r);
- }
-
- return presentation;
-
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
-
- /**
- * Checks for the first and the last affected partition and calls their damagers.
- * Invalidates everything from the start of the damage for the first partition
- * until the end of the damage for the last partition.
- *
- * @param e the event describing the document change
- * @return the damaged caused by the change
- */
- private IRegion getDamage(DocumentEvent e) {
-
- IRegion damage= null;
-
- try {
-
- ITypedRegion partition= e.getDocument().getPartition(e.getOffset());
- IPresentationDamager damager= getDamager(partition.getType());
- if (damager == null)
- return null;
-
- IRegion r= damager.getDamageRegion(partition, e, fDocumentPartitioningChanged);
-
- if (!fDocumentPartitioningChanged) {
- damage= r;
- } else {
-
- int damageEnd= getDamageEndOffset(e);
-
- int parititionDamageEnd= -1;
- if (fChangedDocumentPartitions != null)
- parititionDamageEnd= fChangedDocumentPartitions.getOffset() + fChangedDocumentPartitions.getLength();
-
- int end= Math.max(damageEnd, parititionDamageEnd);
-
- damage= end == -1 ? r : new Region(r.getOffset(), end - r.getOffset());
- }
-
- } catch (BadLocationException x) {
- }
-
- return damage;
- }
-
- /**
- * Returns the end offset of the damage. If a partition has been splitted by
- * the given document event also the second half of the original
- * partition must be considered. This is achieved by using the remembered
- * partition range.
- *
- * @param e the event describing the change
- * @return the damage end offset (excluding)
- * @exception BadLocationException if method accesses invalid offset
- */
- private int getDamageEndOffset(DocumentEvent e) throws BadLocationException {
-
- IDocument d= e.getDocument();
-
- int length= 0;
- if (e.getText() != null) {
- length= e.getText().length();
- if (length > 0)
- -- length;
- }
-
- ITypedRegion partition= d.getPartition(e.getOffset() + length);
- int endOffset= partition.getOffset() + partition.getLength();
- if (endOffset == e.getOffset())
- return -1;
-
- int end= fRememberedPosition.getOffset() + fRememberedPosition.getLength();
- if (endOffset < end)
- partition= d.getPartition(end);
-
- IPresentationDamager damager= getDamager(partition.getType());
- if (damager == null)
- return -1;
-
- IRegion r= damager.getDamageRegion(partition, e, fDocumentPartitioningChanged);
-
- return r.getOffset() + r.getLength();
- }
-
- /**
- * Processes the given damage.
- * @param damage the damage to be repaired
- * @param document the document whose presentation must be repaired
- */
- private void processDamage(IRegion damage, IDocument document) {
- if (damage != null && damage.getLength() > 0) {
- TextPresentation p= createPresentation(damage, document);
- if (p != null && !p.isEmpty())
- applyTextRegionCollection(p);
- }
- }
-
- /**
- * Applies the given text presentation to the text viewer the presentation
- * reconciler is installed on.
- *
- * @param presentation the text presentation to be applied to the text viewer
- */
- private void applyTextRegionCollection(TextPresentation presentation) {
- fViewer.changeTextPresentation(presentation, false);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/package.html b/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/package.html
deleted file mode 100644
index 9574694..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/package.html
+++ /dev/null
@@ -1,24 +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 presentation reconciler add-on for an <tt>ITextViewer</tt>.
-A presentation reconciler keep the presentation (styles and colors) in
-sync with the content of the document serving as the <tt>ITextViewer</tt>'s
-input.
-<h2>
-Package Specification</h2>
-<tt>IPresentationReconciler</tt> defines the concept of a presentation
-reconciler. It collaborates with content type specific presentation damagers
-(<tt>IPresentationDamager</tt>) which for a given document change determine
-the region of the presentation which must be rebuild, and content type
-specific presentation repairers (<tt>IPresentationRepairer</tt>) which
-construct for a given damage region the document presentation. The package
-contains a default implementation of <tt>IPresentationReconciler </tt>(<tt>PresentationReconciler</tt>).
-</body>
-</html>
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java
deleted file mode 100644
index be8bf83..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.reconciler;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-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.ITextInputListener;
-import org.eclipse.jface.text.ITextViewer;
-
-
-
-
-/**
- * Abstract implementation of <code>IReconciler</code>. The reconciler
- * listens to input document changes as well as changes of
- * the input document of the text viewer it is installed on. Depending on
- * its configuration it manages the received change notifications in a
- * queue folding neighboring or overlapping changes together. The reconciler
- * processes the dirty regions as a background activity after having waited for further
- * changes for the configured duration of time. A reconciler is started using its
- * <code>install</code> method. As a first step <code>initialProcess</code> is
- * executed in the background. Then, the reconciling thread waits for changes that
- * need to be reconciled. A reconciler can be resumed by calling <code>forceReconciling</code>
- * independent from the existence of actual changes. This mechanism is for subclasses only.
- * It is the clients responsibility to stop a reconciler using its <code>uninstall</code>
- * method. Unstopped reconcilers do not free their resources.<p>
- * It is subclass responsibility to specify how dirty regions are processed.
- *
- * @see IReconciler
- * @see IDocumentListener
- * @see ITextInputListener
- * @see DirtyRegion
- * @since 2.0
- */
-abstract public class AbstractReconciler implements IReconciler {
-
-
- /**
- * Background thread for the reconciling activity.
- */
- class BackgroundThread extends Thread {
-
- /** Has the reconciler been canceled */
- private boolean fCanceled= false;
- /** Has the reconciler been reset */
- private boolean fReset= false;
- /** Has a change been applied */
- private boolean fIsDirty= false;
- /** Is a reconciling strategy active */
- private boolean fIsActive= false;
-
- /**
- * Creates a new background thread. The thread
- * runs with minimal priority.
- *
- * @param name the thread's name
- */
- public BackgroundThread(String name) {
- super(name);
- setPriority(Thread.MIN_PRIORITY);
- setDaemon(true);
- }
-
- /**
- * Returns whether a reconciling strategy is active right now.
- *
- * @return <code>true</code> if a activity is active
- */
- public boolean isActive() {
- return fIsActive;
- }
-
- /**
- * Cancels the background thread.
- */
- public void cancel() {
- fCanceled= true;
- synchronized (fDirtyRegionQueue) {
- fDirtyRegionQueue.notifyAll();
- }
- }
-
- /**
- * Suspends the caller of this method until this background thread has
- * emptied the dirty region queue.
- */
- public void suspendCallerWhileDirty() {
- while (fIsDirty) {
- synchronized (fDirtyRegionQueue) {
- if (fIsDirty) {
- try {
- fDirtyRegionQueue.wait();
- } catch (InterruptedException x) {
- }
- }
- }
- }
- }
-
- /**
- * Reset the background thread as the text viewer has been changed,
- */
- public void reset() {
-
- if (fDelay > 0) {
-
- synchronized (this) {
- fIsDirty= true;
- fReset= true;
- }
-
- } else {
-
- synchronized(this) {
- fIsDirty= true;
- }
-
- synchronized (fDirtyRegionQueue) {
- fDirtyRegionQueue.notifyAll();
- }
- }
-
- reconcilerReset();
- }
-
- /**
- * The background activity. Waits until there is something in the
- * queue managing the changes that have been applied to the text viewer.
- * Removes the first change from the queue and process it.<p>
- * Calls <code>initialProcess</code> on entrance.
- */
- public void run() {
-
- synchronized (fDirtyRegionQueue) {
- try {
- fDirtyRegionQueue.wait(fDelay);
- } catch (InterruptedException x) {
- }
- }
-
- initialProcess();
-
- while (!fCanceled) {
-
- synchronized (fDirtyRegionQueue) {
- try {
- fDirtyRegionQueue.wait(fDelay);
- } catch (InterruptedException x) {
- }
- }
-
- if (fCanceled)
- break;
-
- if (!fIsDirty)
- continue;
-
- if (fReset) {
- synchronized (this) {
- fReset= false;
- }
- continue;
- }
-
- DirtyRegion r= null;
- synchronized (fDirtyRegionQueue) {
- r= fDirtyRegionQueue.removeNextDirtyRegion();
- }
-
- fIsActive= true;
-
- if (fProgressMonitor != null)
- fProgressMonitor.setCanceled(false);
-
- process(r);
-
- synchronized (fDirtyRegionQueue) {
- if (0 == fDirtyRegionQueue.getSize()) {
- synchronized (this) {
- fIsDirty= false;
- }
- fDirtyRegionQueue.notifyAll();
- }
- }
-
- fIsActive= false;
- }
- }
- };
-
- /**
- * Internal document listener and text input listener.
- */
- class Listener implements IDocumentListener, ITextInputListener {
-
- /*
- * @see IDocumentListener#documentAboutToBeChanged(DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent e) {
- }
-
- /*
- * @see IDocumentListener#documentChanged(DocumentEvent)
- */
- public void documentChanged(DocumentEvent e) {
-
- if (fProgressMonitor != null && fThread.isActive())
- fProgressMonitor.setCanceled(true);
-
- if (fIsIncrementalReconciler)
- createDirtyRegion(e);
-
- fThread.reset();
- }
-
- /*
- * @see ITextInputListener#inputDocumentAboutToBeChanged(IDocument, IDocument)
- */
- public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
-
- if (oldInput == fDocument) {
-
- if (fDocument != null)
- fDocument.removeDocumentListener(this);
-
- if (fIsIncrementalReconciler) {
- fDirtyRegionQueue.purgeQueue();
- if (fDocument != null && fDocument.getLength() > 0) {
- DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), null);
- createDirtyRegion(e);
- fThread.suspendCallerWhileDirty();
- }
- }
-
- fDocument= null;
- }
- }
-
- /*
- * @see ITextInputListener#inputDocumentChanged(IDocument, IDocument)
- */
- public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
-
- fDocument= newInput;
- if (fDocument == null)
- return;
-
-
- reconcilerDocumentChanged(fDocument);
-
- fDocument.addDocumentListener(this);
-
- if (fIsIncrementalReconciler) {
- DocumentEvent e= new DocumentEvent(fDocument, 0, 0, fDocument.get());
- createDirtyRegion(e);
- }
-
- startReconciling();
- }
- };
-
- /** Queue to manage the changes applied to the text viewer */
- private DirtyRegionQueue fDirtyRegionQueue;
- /** The background thread */
- private BackgroundThread fThread;
- /** Internal document and text input listener */
- private Listener fListener;
- /** The background thread delay */
- private int fDelay= 500;
- /** Are there incremental reconciling strategies? */
- private boolean fIsIncrementalReconciler= true;
- /** The progress monitor used by this reconciler */
- private IProgressMonitor fProgressMonitor;
-
- /** The text viewer's document */
- private IDocument fDocument;
- /** The text viewer */
- private ITextViewer fViewer;
-
-
- /**
- * Processes a dirty region. If the dirty region is <code>null</code> the whole
- * document is consider being dirty. The dirty region is partitioned by the
- * document and each partition is handed over to a reconciling strategy registered
- * for the partition's content type.
- *
- * @param dirtyRegion the dirty region to be processed
- */
- abstract protected void process(DirtyRegion dirtyRegion);
-
- /**
- * Hook called when the document whose contents should be reconciled
- * has been changed, i.e., the input document of the text viewer this
- * reconciler is installed on. Usually, subclasses use this hook to
- * inform all their reconciling strategies about the change.
- *
- * @param newDocument the new reconciler document
- */
- abstract protected void reconcilerDocumentChanged(IDocument newDocument);
-
-
- /**
- * Creates a new reconciler without configuring it.
- */
- protected AbstractReconciler() {
- super();
- }
-
- /**
- * Tells the reconciler how long it should wait for further text changes before
- * activating the appropriate reconciling strategies.
- *
- * @param delay the duration in milli seconds of a change collection period.
- */
- public void setDelay(int delay) {
- fDelay= delay;
- }
-
- /**
- * Tells the reconciler whether any of the available reconciling strategies
- * is interested in getting detailed dirty region information or just in the
- * fact the the document has been changed. In the second case, the reconciling
- * can not incrementally be pursued.
- *
- * @param isIncremental indicates whether this reconciler will be configured with
- * incremental reconciling strategies
- *
- * @see DirtyRegion
- * @see IReconcilingStrategy
- */
- public void setIsIncrementalReconciler(boolean isIncremental) {
- fIsIncrementalReconciler= isIncremental;
- }
-
- /**
- * Sets the progress monitor of this reconciler.
- *
- * @param monitor the monitor to be used
- */
- public void setProgressMonitor(IProgressMonitor monitor) {
- fProgressMonitor= monitor;
- }
-
- /**
- * Returns whether any of the reconciling strategies is interested in
- * detailed dirty region information.
- *
- * @return whether this reconciler is incremental
- *
- * @see IReconcilingStrategy
- */
- protected boolean isIncrementalReconciler() {
- return fIsIncrementalReconciler;
- }
-
- /**
- * Returns the input document of the text viewer this reconciler is installed on.
- *
- * @return the reconciler document
- */
- protected IDocument getDocument() {
- return fDocument;
- }
-
- /**
- * Returns the text viewer this reconciler is installed on.
- *
- * @return the text viewer this reconciler is installed on
- */
- protected ITextViewer getTextViewer() {
- return fViewer;
- }
-
- /**
- * Returns the progress monitor of this reconciler.
- *
- * @return the progress monitor of this reconciler
- */
- protected IProgressMonitor getProgressMonitor() {
- return fProgressMonitor;
- }
-
- /*
- * @see IReconciler#install(ITextViewer)
- */
- public void install(ITextViewer textViewer) {
-
- Assert.isNotNull(textViewer);
-
- fViewer= textViewer;
-
- fListener= new Listener();
- fViewer.addTextInputListener(fListener);
-
- fDirtyRegionQueue= new DirtyRegionQueue();
- fThread= new BackgroundThread(getClass().getName());
- }
-
- /*
- * @see IReconciler#uninstall()
- */
- public void uninstall() {
- if (fListener != null) {
-
- fViewer.removeTextInputListener(fListener);
- if (fDocument != null) fDocument.removeDocumentListener(fListener);
- fListener= null;
-
- synchronized (this) {
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=19135
- BackgroundThread bt= fThread;
- fThread= null;
- bt.cancel();
- }
- }
- }
-
- /**
- * Creates a dirty region for a document event and adds it to the queue.
- *
- * @param e the document event for which to create a dirty region
- */
- private void createDirtyRegion(DocumentEvent e) {
-
- if (e.getLength() == 0 && e.getText() != null) {
- // Insert
- fDirtyRegionQueue.addDirtyRegion(new DirtyRegion(e.getOffset(), e.getText().length(), DirtyRegion.INSERT, e.getText()));
-
- } else if (e.getText() == null || e.getText().length() == 0) {
- // Remove
- fDirtyRegionQueue.addDirtyRegion(new DirtyRegion(e.getOffset(), e.getLength(), DirtyRegion.REMOVE, null));
-
- } else {
- // Replace (Remove + Insert)
- fDirtyRegionQueue.addDirtyRegion(new DirtyRegion(e.getOffset(), e.getLength(), DirtyRegion.REMOVE, null));
- fDirtyRegionQueue.addDirtyRegion(new DirtyRegion(e.getOffset(), e.getText().length(), DirtyRegion.INSERT, e.getText()));
- }
- }
-
- /**
- * This method is called on startup of the background activity. It is called only
- * once during the life time of the reconciler. Clients may reimplement this method.
- */
- protected void initialProcess() {
- }
-
- /**
- * Forces the reconciler to reconcile the structure of the whole document.
- * Clients may extend this method.
- */
- protected void forceReconciling() {
-
- if (fDocument != null) {
-
- if (fIsIncrementalReconciler) {
- DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), fDocument.get());
- createDirtyRegion(e);
- }
-
- startReconciling();
- }
- }
-
- /**
- * Starts the reconciler to reconcile the queued dirty-regions.
- * Clients may extend this method.
- */
- protected synchronized void startReconciling() {
- if (fThread == null)
- return;
-
- if (!fThread.isAlive())
- fThread.start();
-
- fThread.reset();
- }
-
- /**
- * Hook that is called after the reconciler thread has been reset.
- */
- protected void reconcilerReset() {
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/DirtyRegion.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/DirtyRegion.java
deleted file mode 100644
index a35e072..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/DirtyRegion.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.reconciler;
-
-
-import org.eclipse.jface.text.ITypedRegion;
-
-/**
- * A dirty region describes a document range which has been changed.
- */
-public class DirtyRegion implements ITypedRegion {
-
- /**
- * Identifies an insert operation.
- */
- final static public String INSERT= "__insert"; //$NON-NLS-1$
- /**
- * Identifies a remove operation.
- */
- final static public String REMOVE= "__remove"; //$NON-NLS-1$
-
- /** The region's offset */
- private int fOffset;
- /** The region's length */
- private int fLength;
- /** Indicates the type of the applied change */
- private String fType;
- /** The text which has been inserted */
- private String fText;
-
- /**
- * Creates a new dirty region.
- *
- *
- * @param offset the offset within the document where the change occurred
- * @param length the length of the text within the document that changed
- * @param type the type of change that this region represents: <code>INSERT</code> or <code>REMOVE</code>
- * @param text the substitution text
- */
- public DirtyRegion(int offset, int length, String type, String text) {
- fOffset= offset;
- fLength= length;
- fType= type;
- fText= text;
- }
-
- /*
- * @see ITypedRegion#getOffset()
- */
- public int getOffset() {
- return fOffset;
- }
-
- /*
- * @see ITypedRegion#getLength()
- */
- public int getLength() {
- return fLength;
- }
-
- /*
- * @see ITypedRegion#getType
- */
- public String getType() {
- return fType;
- }
-
- /**
- * Returns the text that changed as part of the region change.
- *
- * @return the changed text
- */
- public String getText() {
- return fText;
- }
-
- /**
- * Modify the receiver so that it encompasses the region specified by the dirty region.
- *
- * @param dr the dirty region with which to merge
- */
- void mergeWith(DirtyRegion dr) {
- int start= Math.min(fOffset, dr.fOffset);
- int end= Math.max(fOffset + fLength, dr.fOffset + dr.fLength);
- fOffset= start;
- fLength= end - start;
- fText= (dr.fText == null ? fText : (fText == null) ? dr.fText : fText + dr.fText);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/DirtyRegionQueue.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/DirtyRegionQueue.java
deleted file mode 100644
index c076bbf..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/DirtyRegionQueue.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.reconciler;
-
-
-import java.util.List;
-import java.util.ArrayList;
-
-
-/**
- * Queue used by <code>Reconciler</code> to manage dirty regions. When a dirty region
- * is inserted into the queue, the queue tries to fold it into the neighboring dirty region.
- *
- * @see Reconciler
- * @see DirtyRegion
- */
-class DirtyRegionQueue {
-
- /** The list of dirty regions */
- private List fDirtyRegions= new ArrayList();
-
- /**
- * Creates a new empty dirty region.
- */
- public DirtyRegionQueue() {
- super();
- }
-
- /**
- * Adds a dirty region to the end of the dirty-region queue.
- *
- * @param dr the dirty region to add
- */
- public void addDirtyRegion(DirtyRegion dr) {
- // If the dirty region being added is directly after the last dirty
- // region on the queue then merge the two dirty regions together.
- DirtyRegion lastDR= getLastDirtyRegion();
- boolean wasMerged= false;
- if (lastDR != null)
- if (lastDR.getType() == dr.getType())
- if (lastDR.getType() == DirtyRegion.INSERT) {
- if (lastDR.getOffset() + lastDR.getLength() == dr.getOffset()) {
- lastDR.mergeWith(dr);
- wasMerged= true;
- }
- } else if (lastDR.getType() == DirtyRegion.REMOVE) {
- if (dr.getOffset() + dr.getLength() == lastDR.getOffset()) {
- lastDR.mergeWith(dr);
- wasMerged= true;
- }
- }
-
- if (!wasMerged)
- // Don't merge- just add the new one onto the queue.
- fDirtyRegions.add(dr);
- }
-
- /**
- * Returns the last dirty region that was added to the queue.
- *
- * @return the last DirtyRegion on the queue
- */
- private DirtyRegion getLastDirtyRegion() {
- int size= fDirtyRegions.size();
- return (size == 0 ? null : (DirtyRegion) fDirtyRegions.get(size - 1));
- }
-
- /**
- * Returns the number of regions in the queue.
- *
- * @return the dirty-region queue-size
- */
- public int getSize() {
- return fDirtyRegions.size();
- }
-
- /**
- * Throws away all entries in the queue.
- */
- public void purgeQueue() {
- fDirtyRegions.clear();
- }
-
- /**
- * Removes and returns the first dirty region in the queue
- *
- * @return the next dirty region on the queue
- */
- public DirtyRegion removeNextDirtyRegion() {
- if (fDirtyRegions.size() == 0)
- return null;
- DirtyRegion dr= (DirtyRegion) fDirtyRegions.get(0);
- fDirtyRegions.remove(0);
- return dr;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconciler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconciler.java
deleted file mode 100644
index 36778f1..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconciler.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.reconciler;
-
-
-
-import org.eclipse.jface.text.ITextViewer;
-
-
-
-/**
- * An <code>IReconciler</code> defines and maintains a model of the content
- * of the text viewer's document in the presence of changes applied to this
- * document. An <code>IReconciler</code> is a <code>ITextViewer</code> add-on.<p>
- * Reconcilers are assumed to be asynchronous, i.e. they allow a certain
- * temporal window of inconsistency between the document and the model of
- * the content of this document. <p>
- * Reconcilers have a list of <code>IReconcilingStrategy</code> objects
- * each of which is registered for a particular document content type.
- * The reconciler uses the strategy objects to react on the changes applied
- * to the text viewer's document.<p>
- * The interface can be implemented by clients. By default, clients use
- * <code>Reconciler</code> as the standard implementer of this interface.
- *
- * @see ITextViewer
- * @see IReconcilingStrategy
- */
-public interface IReconciler {
-
- /**
- * Installs the reconciler on the given text viewer. After this method has been
- * finished, the reconciler is operational. I.e., it works without requesting
- * further client actions until <code>uninstall</code> is called.
- *
- * @param textViewer the viewer on which the reconciler is installed
- */
- void install(ITextViewer textViewer);
-
- /**
- * Removes the reconciler from the text viewer it has previously been
- * installed on.
- */
- void uninstall();
-
- /**
- * Returns the reconciling strategy registered with the reconciler
- * for the specified content type.
- *
- * @param contentType the content type for which to determine the reconciling strategy
- * @return the reconciling strategy registered for the given content type, or
- * <code>null</code> if there is no such strategy
- */
- IReconcilingStrategy getReconcilingStrategy(String contentType);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcilingStrategy.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcilingStrategy.java
deleted file mode 100644
index 55be9a3..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcilingStrategy.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.jface.text.reconciler;
-
-
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-
-
-/**
- * A reconciling strategy is used by an reconciler to reconcile a model
- * based on text of a particular content type. It provides methods for
- * incremental as well as non-incremental reconciling.<p>
- * This interface must be implemented by clients. Implementers should be
- * registered with a reconciler in order get involved in the reconciling
- * process.
- */
-public interface IReconcilingStrategy {
-
- /**
- * Tells this reconciling strategy on which document it will
- * work. This method will be called before any other method
- * and can be called multiple times. The regions passed to the
- * other methods always refer to the most recent document
- * passed into this method.
- *
- * @param document the document on which this strategy will work
- */
- void setDocument(IDocument document);
-
- /**
- * Activates incremental reconciling of the specified dirty region.
- * As a dirty region might span multiple content types, the segment of the
- * dirty region which should be investigated is also provided to this
- * reconciling strategy. The given regions refer to the document passed into
- * the most recent call of <code>setDocument</code>.
- *
- * @param dirtyRegion the document region which has been changed
- * @param subRegion the sub region in the dirty region which should be reconciled
- */
- void reconcile(DirtyRegion dirtyRegion, IRegion subRegion);
-
- /**
- * Activates non-incremental reconciling. The reconciling strategy is just told
- * that there are changes and that it should reconcile the given partition of the
- * document most recently passed into <code>setDocument</code>.
- *
- * @param partition the document partition to be reconciled
- */
- void reconcile(IRegion partition);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcilingStrategyExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcilingStrategyExtension.java
deleted file mode 100644
index 5dc7a3c..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcilingStrategyExtension.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.reconciler;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-
-/**
- * Extension interface for <code>IReconcilingStrategy</code>.
- * The new functions are:
- * <ul>
- * <li> usage of a progress monitor
- * <li> initial reconciling step: If a reconciler runs as periodic activity in the background, this
- * methods offers the reconciler a chance for initializing its startegies and achieving a
- * reconciled state before the periodic activity starts.
- * </ul>
- *
- * @since 2.0
- */
-public interface IReconcilingStrategyExtension {
-
- /**
- * Tells this reconciling strategy with which progress monitor
- * it will work. This method will be called before any other
- * method and can be called multiple times.
- *
- * @param monitor the progress monitor with which this strategy will work
- */
- void setProgressMonitor(IProgressMonitor monitor);
-
- /**
- * Called only once in the life time of this reconciling strategy.
- */
- void initialReconcile();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/MonoReconciler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/MonoReconciler.java
deleted file mode 100644
index a8e413b..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/MonoReconciler.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.reconciler;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Region;
-
-
-/**
- * Standard implementation of <code>IReconciler</code>. The reconciler
- * is configured with a single <code>IReconcilingStrategy</code> that is
- * used independ from where a dirty region is located in the reconciler's
- * document. <p>
- * Usually, clients instantiate this class and configure it before using it.
- *
- * @see IReconciler
- * @see org.eclipse.jface.text.IDocumentListener
- * @see org.eclipse.jface.text.ITextInputListener
- * @see DirtyRegion
- * @since 2.0
- */
-public class MonoReconciler extends AbstractReconciler {
-
-
- /** The reconciling strategy */
- private IReconcilingStrategy fStrategy;
-
-
- /**
- * Creates a new reconciler that uses the same reconciling strategy to
- * reconcile its document independent of the type of the document's contents.
- *
- * @param strategy the reconciling strategy to be used
- * @param isIncremental the indication whether strategy is incremental or not
- */
- public MonoReconciler(IReconcilingStrategy strategy, boolean isIncremental) {
- super();
-
- Assert.isNotNull(strategy);
-
- fStrategy= strategy;
- setIsIncrementalReconciler(isIncremental);
- }
-
- /*
- * @see IReconciler#getReconcilingStrategy(String)
- */
- public IReconcilingStrategy getReconcilingStrategy(String contentType) {
- Assert.isNotNull(contentType);
- return fStrategy;
- }
-
- /*
- * @see AbstractReconciler#process(DirtyRegion)
- */
- protected void process(DirtyRegion dirtyRegion) {
-
- if(dirtyRegion != null)
- fStrategy.reconcile(dirtyRegion, dirtyRegion);
- else {
- IDocument document= getDocument();
- if (document != null)
- fStrategy.reconcile(new Region(0, document.getLength()));
- }
- }
-
- /*
- * @see AbstractReconciler#reconcilerDocumentChanged(IDocument)
- */
- protected void reconcilerDocumentChanged(IDocument document) {
- fStrategy.setDocument(document);
- }
-
- /*
- * @see AbstractReconciler#setProgressMonitor(IProgressMonitor)
- */
- public void setProgressMonitor(IProgressMonitor monitor) {
- super.setProgressMonitor(monitor);
- if (fStrategy instanceof IReconcilingStrategyExtension) {
- IReconcilingStrategyExtension extension= (IReconcilingStrategyExtension) fStrategy;
- extension.setProgressMonitor(monitor);
- }
- }
-
- /*
- * @see AbstractReconciler#initialProcess()
- */
- protected void initialProcess() {
- if (fStrategy instanceof IReconcilingStrategyExtension) {
- IReconcilingStrategyExtension extension= (IReconcilingStrategyExtension) fStrategy;
- extension.initialReconcile();
- }
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/Reconciler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/Reconciler.java
deleted file mode 100644
index a97e9db..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/Reconciler.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.reconciler;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-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.ITypedRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TypedRegion;
-
-/**
- * Standard implementation of <code>IReconciler</code>. The reconciler
- * is configured with a set of reconciling strategies each of which is
- * responsible for a particular content type. <p>
- * Usually, clients instantiate this class and configure it before using it.
- *
- * @see IReconciler
- * @see org.eclipse.jface.text.IDocumentListener
- * @see org.eclipse.jface.text.ITextInputListener
- * @see DirtyRegion
- */
-public class Reconciler extends AbstractReconciler {
-
- /** The map of reconciling strategies */
- private Map fStrategies;
-
- /**
- * Creates a new reconciler with the following configuration: it is
- * an incremental reconciler with a standard delay of 500 ms. There
- * are no predefined reconciling strategies.
- */
- public Reconciler() {
- super();
- }
-
- /**
- * Registers a given reconciling strategy for a particular content type.
- * If there is already a strategy registered for this type, the new strategy
- * is registered instead of the old one.
- *
- * @param strategy the reconciling strategy to register, or <code>null</code> to remove an existing one
- * @param contentType the content type under which to register
- */
- public void setReconcilingStrategy(IReconcilingStrategy strategy, String contentType) {
-
- Assert.isNotNull(contentType);
-
- if (fStrategies == null)
- fStrategies= new HashMap();
-
- if (strategy == null)
- fStrategies.remove(contentType);
- else {
- fStrategies.put(contentType, strategy);
- if (strategy instanceof IReconcilingStrategyExtension && getProgressMonitor() == null) {
- IReconcilingStrategyExtension extension= (IReconcilingStrategyExtension) strategy;
- extension.setProgressMonitor(getProgressMonitor());
- }
- }
- }
-
- /*
- * @see IReconciler#getReconcilingStrategy(String)
- */
- public IReconcilingStrategy getReconcilingStrategy(String contentType) {
-
- Assert.isNotNull(contentType);
-
- if (fStrategies == null)
- return null;
-
- return (IReconcilingStrategy) fStrategies.get(contentType);
- }
-
- /**
- * Processes a dirty region. If the dirty region is <code>null</code> the whole
- * document is consider being dirty. The dirty region is partitioned by the
- * document and each partition is handed over to a reconciling strategy registered
- * for the partition's content type.
- *
- * @param dirtyRegion the dirty region to be processed
- * @see AbstractReconciler#process(DirtyRegion)
- */
- protected void process(DirtyRegion dirtyRegion) {
-
- IRegion region= dirtyRegion;
-
- if (region == null)
- region= new Region(0, getDocument().getLength());
-
- ITypedRegion[] regions= null;
- try {
- regions= getDocument().computePartitioning(region.getOffset(), region.getLength());
- } catch (BadLocationException x) {
- regions= new TypedRegion[0];
- }
-
- for (int i= 0; i < regions.length; i++) {
- ITypedRegion r= regions[i];
- IReconcilingStrategy s= getReconcilingStrategy(r.getType());
- if (s == null)
- continue;
-
- if(dirtyRegion != null)
- s.reconcile(dirtyRegion, r);
- else
- s.reconcile(r);
- }
- }
-
- /*
- * @see AbstractReconciler#reconcilerDocumentChanged(IDocument)
- * @since 2.0
- */
- protected void reconcilerDocumentChanged(IDocument document) {
- if (fStrategies != null) {
- Iterator e= fStrategies.values().iterator();
- while (e.hasNext()) {
- IReconcilingStrategy strategy= (IReconcilingStrategy) e.next();
- strategy.setDocument(document);
- }
- }
- }
-
- /*
- * @see AbstractReconciler#setProgressMonitor(IProgressMonitor)
- * @since 2.0
- */
- public void setProgressMonitor(IProgressMonitor monitor) {
- super.setProgressMonitor(monitor);
-
- if (fStrategies != null) {
- Iterator e= fStrategies.values().iterator();
- while (e.hasNext()) {
- IReconcilingStrategy strategy= (IReconcilingStrategy) e.next();
- if (strategy instanceof IReconcilingStrategyExtension) {
- IReconcilingStrategyExtension extension= (IReconcilingStrategyExtension) strategy;
- extension.setProgressMonitor(monitor);
- }
- }
- }
- }
-
- /*
- * @see AbstractReconciler#initialProcess()
- * @since 2.0
- */
- protected void initialProcess() {
-
- IRegion region= new Region(0, getDocument().getLength());
-
- ITypedRegion[] regions= null;
- try {
- regions= getDocument().computePartitioning(region.getOffset(), region.getLength());
- } catch (BadLocationException x) {
- regions= new TypedRegion[0];
- }
-
- for (int i= 0; i < regions.length; i++) {
- ITypedRegion r= regions[i];
- IReconcilingStrategy s= getReconcilingStrategy(r.getType());
- if (s instanceof IReconcilingStrategyExtension) {
- IReconcilingStrategyExtension e= (IReconcilingStrategyExtension) s;
- e.initialReconcile();
- }
- }
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/package.html b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/package.html
deleted file mode 100644
index 8f46d6c..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/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.76 [en] (Windows NT 5.0; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a reconciler add-on for an <tt>ITextViewer</tt>.
-A reconciler provides generic synchronization support with
-the content of the document serving as the <tt>ITextViewer</tt>'s input.
-There is no explicit model of what is synchronized.
-<h2>
-Package Specification</h2>
-<tt>IReconciler</tt> defines the concept of a reconciler. It collaborates
-with content type specific reconciling strategies (<tt>IReconcilingStrategy</tt>)
-which perform the synchronization for a given dirty region. The package
-contains a default implementation of <tt>IReconciler</tt> (<tt>Reconciler</tt>).
-
-<tt>Reconciler</tt> and <tt>MonoReconciler</tt> implements reconciling
-as a periodic background activity and folds co-located changes while being
-inactive.
-</body>
-</html>
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/BufferedRuleBasedScanner.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/BufferedRuleBasedScanner.java
deleted file mode 100644
index 66ba10f..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/BufferedRuleBasedScanner.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.jface.text.rules;
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * A buffered rule based scanner. The buffer always contains a section
- * of a fixed size of the document to be scanned. Completely adheres to
- * the contract of <code>RuleBasedScanner</code>.
- */
-public class BufferedRuleBasedScanner extends RuleBasedScanner {
-
- /** The default buffer size. Value = 500 */
- private final static int DEFAULT_BUFFER_SIZE= 500;
- /** The actual size of the buffer. Initially set to <code>DEFAULT_BUFFER_SIZE</code> */
- private int fBufferSize= DEFAULT_BUFFER_SIZE;
- /** The buffer */
- private char[] fBuffer= new char[DEFAULT_BUFFER_SIZE];
- /** The offset of the document at which the buffer starts */
- private int fStart;
- /** The offset of the document at which the buffer ends */
- private int fEnd;
- /** The cached length of the document */
- private int fDocumentLength;
-
-
- /**
- * Creates a new buffered rule based scanner which does
- * not have any rule and a default buffer size of 500 characters.
- */
- protected BufferedRuleBasedScanner() {
- super();
- }
-
- /**
- * Creates a new buffered rule based scanner which does
- * not have any rule. The buffer size is set to the given
- * number of characters.
- *
- * @param size the buffer size
- */
- public BufferedRuleBasedScanner(int size) {
- super();
- setBufferSize(size);
- }
-
- /**
- * Sets the buffer to the given number of characters.
- *
- * @param size the buffer size
- */
- protected void setBufferSize(int size) {
- Assert.isTrue(size > 0);
- fBufferSize= size;
- fBuffer= new char[size];
- }
-
- /**
- * Shifts the buffer so that the buffer starts at the
- * given document offset.
- *
- * @param offset the document offset at which the buffer starts
- */
- private void shiftBuffer(int offset) {
-
- fStart= offset;
- fEnd= fStart + fBufferSize;
- if (fEnd > fDocumentLength)
- fEnd= fDocumentLength;
-
- try {
-
- String content= fDocument.get(fStart, fEnd - fStart);
- content.getChars(0, fEnd - fStart, fBuffer, 0);
-
- } catch (BadLocationException x) {
- }
- }
-
- /*
- * @see RuleBasedScanner#setRange(IDocument, int, int)
- */
- public void setRange(IDocument document, int offset, int length) {
-
- super.setRange(document, offset, length);
-
- fDocumentLength= document.getLength();
- shiftBuffer(offset);
- }
-
- /*
- * @see RuleBasedScanner#read()
- */
- public int read() {
-
- if (fOffset >= fRangeEnd) {
- ++ fOffset;
- return EOF;
- }
-
- if (fOffset == fEnd)
- shiftBuffer(fEnd);
- else if (fOffset < fStart || fEnd < fOffset)
- shiftBuffer(fOffset);
-
- return fBuffer[fOffset++ - fStart];
- }
-
- /*
- * @see RuleBasedScanner#unread()
- */
- public void unread() {
-
- if (fOffset == fStart)
- shiftBuffer(Math.max(0, fStart - (fBufferSize / 2)));
-
- -- fOffset;
- }
-}
-
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultDamagerRepairer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultDamagerRepairer.java
deleted file mode 100644
index edbd92d..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultDamagerRepairer.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.rules;
-
-
-import org.eclipse.swt.custom.StyleRange;
-
-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.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.jface.text.presentation.IPresentationDamager;
-import org.eclipse.jface.text.presentation.IPresentationRepairer;
-
-
-/**
- * A standard implementation of a syntax driven presentation damager
- * and presentation repairer. It uses a token scanner to scan
- * the document and to determine its damage and new text presentation.
- * The tokens returned by the scanner are supposed to return text attributes
- * as their data.
- *
- * @see ITokenScanner
- * @since 2.0
- */
-public class DefaultDamagerRepairer implements IPresentationDamager, IPresentationRepairer {
-
- /** The document this object works on */
- protected IDocument fDocument;
- /** The scanner it uses */
- protected ITokenScanner fScanner;
- /** The default text attribute if non is returned as data by the current token */
- protected TextAttribute fDefaultTextAttribute;
-
- /**
- * Creates a damager/repairer that uses the given scanner and returns the given default
- * text attribute if the current token does not carry a text attribute.
- *
- * @param scanner the token scanner to be used
- * @param defaultTextAttribute the text attribute to be returned if non is specified by the current token,
- * may not be <code>null</code>
- *
- * @deprecated use DefaultDamagerRepairer(ITokenScanner) instead
- */
- public DefaultDamagerRepairer(ITokenScanner scanner, TextAttribute defaultTextAttribute) {
-
- Assert.isNotNull(defaultTextAttribute);
-
- fScanner= scanner;
- fDefaultTextAttribute= defaultTextAttribute;
- }
-
- /**
- * Creates a damager/repairer that uses the given scanner. The scanner may not be <code>null</code>
- * and is assumed to return only token that carry text attributes.
- *
- * @param scanner the token scanner to be used, may not be <code>null</code>
- */
- public DefaultDamagerRepairer(ITokenScanner scanner) {
-
- Assert.isNotNull(scanner);
-
- fScanner= scanner;
- }
-
- /*
- * @see IPresentationDamager#setDocument(IDocument)
- * @see IPresentationRepairer#setDocument(IDocument)
- */
- public void setDocument(IDocument document) {
- fDocument= document;
- }
-
-
- //---- IPresentationDamager
-
- /**
- * Returns the end offset of the line that contains the specified offset or
- * if the offset is inside a line delimiter, the end offset of the next line.
- *
- * @param offset the offset whose line end offset must be computed
- * @return the line end offset for the given offset
- * @exception BadLocationException if offset is invalid in the current document
- */
- protected int endOfLineOf(int offset) throws BadLocationException {
-
- IRegion info= fDocument.getLineInformationOfOffset(offset);
- if (offset <= info.getOffset() + info.getLength())
- return info.getOffset() + info.getLength();
-
- int line= fDocument.getLineOfOffset(offset);
- try {
- info= fDocument.getLineInformation(line + 1);
- return info.getOffset() + info.getLength();
- } catch (BadLocationException x) {
- return fDocument.getLength();
- }
- }
-
- /*
- * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean)
- */
- public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) {
-
- if (!documentPartitioningChanged) {
- try {
-
- IRegion info= fDocument.getLineInformationOfOffset(e.getOffset());
- int start= Math.max(partition.getOffset(), info.getOffset());
-
- int end= e.getOffset() + (e.getText() == null ? e.getLength() : e.getText().length());
-
- if (info.getOffset() <= end && end <= info.getOffset() + info.getLength()) {
- // optimize the case of the same line
- end= info.getOffset() + info.getLength();
- } else
- end= endOfLineOf(end);
-
- end= Math.min(partition.getOffset() + partition.getLength(), end);
- return new Region(start, end - start);
-
- } catch (BadLocationException x) {
- }
- }
-
- return partition;
- }
-
- //---- IPresentationRepairer
-
- /*
- * @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion)
- */
- public void createPresentation(TextPresentation presentation, ITypedRegion region) {
-
- if (fScanner == null) {
- // will be removed if deprecated constructor will be removed
- addRange(presentation, region.getOffset(), region.getLength(), fDefaultTextAttribute);
- return;
- }
-
- int lastStart= region.getOffset();
- int length= 0;
- IToken lastToken= Token.UNDEFINED;
- TextAttribute lastAttribute= getTokenTextAttribute(lastToken);
-
- fScanner.setRange(fDocument, lastStart, region.getLength());
-
- while (true) {
- IToken token= fScanner.nextToken();
- if (token.isEOF())
- break;
-
- TextAttribute attribute= getTokenTextAttribute(token);
- if (lastAttribute != null && lastAttribute.equals(attribute)) {
- length += fScanner.getTokenLength();
- } else {
- addRange(presentation, lastStart, length, lastAttribute);
- lastToken= token;
- lastAttribute= attribute;
- lastStart= fScanner.getTokenOffset();
- length= fScanner.getTokenLength();
- }
- }
-
- addRange(presentation, lastStart, length, lastAttribute);
- }
-
- /**
- * Returns a text attribute encoded in the given token. If the token's
- * data is not <code>null</code> and a text attribute it is assumed that
- * it is the encoded text attribute. It returns the default text attribute
- * if there is no encoded text attribute found.
- *
- * @param token the token whose text attribute is to be determined
- * @return the token's text attribute
- */
- protected TextAttribute getTokenTextAttribute(IToken token) {
- Object data= token.getData();
- if (data instanceof TextAttribute)
- return (TextAttribute) data;
- return fDefaultTextAttribute;
- }
-
- /**
- * Adds style information to the given text presentation.
- *
- * @param presentation the text presentation to be extended
- * @param offset the offset of the range to be styled
- * @param length the length of the range to be styled
- * @param attr the attribute describing the style of the range to be styled
- */
- protected void addRange(TextPresentation presentation, int offset, int length, TextAttribute attr) {
- if (attr != null)
- presentation.addStyleRange(new StyleRange(offset, length, attr.getForeground(), attr.getBackground(), attr.getStyle()));
- }
-}
-
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultPartitioner.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultPartitioner.java
deleted file mode 100644
index 9c08f72..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultPartitioner.java
+++ /dev/null
@@ -1,525 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.rules;
-
-
-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.BadPositionCategoryException;
-import org.eclipse.jface.text.DefaultPositionUpdater;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.IDocumentPartitionerExtension;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TypedPosition;
-import org.eclipse.jface.text.TypedRegion;
-
-
-
-/**
- * A standard implementation of a document partitioner.
- * It uses a partition token scanner to scan the document and to determine
- * the document's partitioning. The tokens returned by the
- * scanner are supposed to return the partition type
- * as their data. The partitoner remembers the document's partitions
- * in the document itself rather than maintaining its own data structure.
- *
- * @see IPartitionTokenScanner
- * @since 2.0
- */
-public class DefaultPartitioner implements IDocumentPartitioner, IDocumentPartitionerExtension {
-
- /** The position category this partitioner uses to store the document's partitioning information */
- public final static String CONTENT_TYPES_CATEGORY= "__content_types_category"; //$NON-NLS-1$
-
-
- /** The partitioner's scanner */
- protected IPartitionTokenScanner fScanner;
- /** The legal content types of this partitioner */
- protected String[] fLegalContentTypes;
- /** The partitioner's document */
- protected IDocument fDocument;
- /** The document length before a document change occured */
- protected int fPreviousDocumentLength;
- /** The position updater used to for the default updating of partitions */
- protected DefaultPositionUpdater fPositionUpdater= new DefaultPositionUpdater(CONTENT_TYPES_CATEGORY);
- /** The offset at which the first changed partition starts */
- protected int fStartOffset;
- /** The offset at which the last changed partition ends */
- protected int fEndOffset;
- /**The offset at which a partition has been deleted */
- protected int fDeleteOffset;
-
-
- /**
- * Creates a new partitioner that uses the given scanner and may return
- * partitions of the given legal content types.
- *
- * @param scanner the scanner this partitioner is supposed to use
- * @param legalContentTypes the legal content types of this partitioner
- */
- public DefaultPartitioner(IPartitionTokenScanner scanner, String[] legalContentTypes) {
- fScanner= scanner;
- fLegalContentTypes= legalContentTypes;
- }
-
- /*
- * @see IDocumentPartitioner#connect(IDocument)
- */
- public void connect(IDocument document) {
- Assert.isNotNull(document);
- Assert.isTrue(!document.containsPositionCategory(CONTENT_TYPES_CATEGORY));
-
- fDocument= document;
- fDocument.addPositionCategory(CONTENT_TYPES_CATEGORY);
-
- initialize();
- }
-
- /**
- * Performs the initial partitioning of the partitioner's document.
- */
- protected void initialize() {
-
- fScanner.setRange(fDocument, 0, fDocument.getLength());
-
- try {
- IToken token= fScanner.nextToken();
- while (!token.isEOF()) {
-
- String contentType= getTokenContentType(token);
-
- if (isSupportedContentType(contentType)) {
- TypedPosition p= new TypedPosition(fScanner.getTokenOffset(), fScanner.getTokenLength(), contentType);
- fDocument.addPosition(CONTENT_TYPES_CATEGORY, p);
- }
-
- token= fScanner.nextToken();
- }
- } catch (BadLocationException x) {
- // cannot happen as offsets come from scanner
- } catch (BadPositionCategoryException x) {
- // cannot happen if document has been connected before
- }
- }
-
- /*
- * @see IDocumentPartitioner#disconnect()
- */
- public void disconnect() {
-
- Assert.isTrue(fDocument.containsPositionCategory(CONTENT_TYPES_CATEGORY));
-
- try {
- fDocument.removePositionCategory(CONTENT_TYPES_CATEGORY);
- } catch (BadPositionCategoryException x) {
- // can not happen because of Assert
- }
- }
-
- /*
- * @see IDocumentPartitioner#documentAboutToBeChanged(DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent e) {
-
- Assert.isTrue(e.getDocument() == fDocument);
-
- fPreviousDocumentLength= e.getDocument().getLength();
- fStartOffset= -1;
- fEndOffset= -1;
- fDeleteOffset= -1;
- }
-
- /*
- * @see IDocumentPartitioner#documentChanged(DocumentEvent)
- */
- public boolean documentChanged(DocumentEvent e) {
- IRegion region= documentChanged2(e);
- return (region != null);
- }
-
- /**
- * Helper method for tracking the minimal region containg all partition changes.
- * If <code>offset</code> is smaller than the remembered offset, <code>offset</code>
- * will from now on be remembered. If <code>offset + length</code> is greater than
- * the remembered end offset, it will be remembered from now on.
- *
- * @param offset the offset
- * @param length the length
- */
- private void rememberRegion(int offset, int length) {
- // remember start offset
- if (fStartOffset == -1)
- fStartOffset= offset;
- else if (offset < fStartOffset)
- fStartOffset= offset;
-
- // remember end offset
- int endOffset= offset + length;
- if (fEndOffset == -1)
- fEndOffset= endOffset;
- else if (endOffset > fEndOffset)
- fEndOffset= endOffset;
- }
-
- /**
- * Remembers the given offset as the deletion offset.
- *
- * @param offset the offset
- */
- private void rememberDeletedOffset(int offset) {
- fDeleteOffset= offset;
- }
-
- /**
- * Creates the minimal region containing all partition changes using the
- * remembered offset, end offset, and deletion offset.
- *
- * @return the minimal region containing all the partition changes
- */
- private IRegion createRegion() {
- if (fDeleteOffset == -1) {
- if (fStartOffset == -1 || fEndOffset == -1)
- return null;
- return new Region(fStartOffset, fEndOffset - fStartOffset);
- } else if (fStartOffset == -1 || fEndOffset == -1) {
- return new Region(fDeleteOffset, 0);
- } else {
- int offset= Math.min(fDeleteOffset, fStartOffset);
- int endOffset= Math.max(fDeleteOffset, fEndOffset);
- return new Region(offset, endOffset - offset);
- }
- }
-
- /*
- * @see IDocumentPartitionerExtension#documentChanged2(DocumentEvent)
- * @since 2.0
- */
- public IRegion documentChanged2(DocumentEvent e) {
-
- try {
-
- IDocument d= e.getDocument();
- Position[] category= d.getPositions(CONTENT_TYPES_CATEGORY);
- IRegion line= d.getLineInformationOfOffset(e.getOffset());
- int reparseStart= line.getOffset();
- int partitionStart= -1;
- String contentType= null;
-
- int first= d.computeIndexInCategory(CONTENT_TYPES_CATEGORY, reparseStart);
- if (first > 0) {
- TypedPosition partition= (TypedPosition) category[first - 1];
- if (partition.includes(reparseStart)) {
- partitionStart= partition.getOffset();
- contentType= partition.getType();
- if (e.getOffset() == partition.getOffset() + partition.getLength())
- reparseStart= partitionStart;
- -- first;
- } else if (reparseStart == e.getOffset() && reparseStart == partition.getOffset() + partition.getLength()) {
- partitionStart= partition.getOffset();
- contentType= partition.getType();
- reparseStart= partitionStart;
- -- first;
- } else {
- partitionStart= partition.getOffset() + partition.getLength();
- contentType= IDocument.DEFAULT_CONTENT_TYPE;
- }
- }
-
- fPositionUpdater.update(e);
- for (int i= first; i < category.length; i++) {
- Position p= category[i];
- if (p.isDeleted) {
- rememberDeletedOffset(e.getOffset());
- break;
- }
- }
- category= d.getPositions(CONTENT_TYPES_CATEGORY);
-
- fScanner.setPartialRange(d, reparseStart, d.getLength() - reparseStart, contentType, partitionStart);
-
- int lastScannedPosition= reparseStart;
- IToken token= fScanner.nextToken();
-
- while (!token.isEOF()) {
-
- contentType= getTokenContentType(token);
-
- if (!isSupportedContentType(contentType)) {
- token= fScanner.nextToken();
- continue;
- }
-
- int start= fScanner.getTokenOffset();
- int length= fScanner.getTokenLength();
-
- lastScannedPosition= start + length - 1;
-
- // remove all affected positions
- while (first < category.length) {
- TypedPosition p= (TypedPosition) category[first];
- if (lastScannedPosition >= p.offset + p.length ||
- (p.overlapsWith(start, length) &&
- (!d.containsPosition(CONTENT_TYPES_CATEGORY, start, length) ||
- !contentType.equals(p.getType())))) {
-
- rememberRegion(p.offset, p.length);
- d.removePosition(CONTENT_TYPES_CATEGORY, p);
- ++ first;
-
- } else
- break;
- }
-
- // if position already exists we are done
- if (d.containsPosition(CONTENT_TYPES_CATEGORY, start, length)) {
- if (lastScannedPosition > e.getOffset())
- return createRegion();
- ++ first;
- } else {
- // insert the new type position
- try {
- d.addPosition(CONTENT_TYPES_CATEGORY, new TypedPosition(start, length, contentType));
- rememberRegion(start, length);
- } catch (BadPositionCategoryException x) {
- } catch (BadLocationException x) {
- }
- }
-
- token= fScanner.nextToken();
- }
-
-
- // remove all positions behind lastScannedPosition since there aren't any further types
- if (lastScannedPosition != reparseStart) {
- // if this condition is not met, nothing has been scanned because of a deletion
- ++ lastScannedPosition;
- }
- first= d.computeIndexInCategory(CONTENT_TYPES_CATEGORY, lastScannedPosition);
-
- TypedPosition p;
- while (first < category.length) {
- p= (TypedPosition) category[first++];
- d.removePosition(CONTENT_TYPES_CATEGORY, p);
- rememberRegion(p.offset, p.length);
- }
-
- } catch (BadPositionCategoryException x) {
- // should never happen on connected documents
- } catch (BadLocationException x) {
- }
-
- return createRegion();
- }
-
-
- /**
- * Returns the position in the partitoner's position category which is
- * close to the given offset. This is, the position has either an offset which
- * is the same as the given offset or an offset which is smaller than the given
- * offset. This method profits from the knowledge that a partitioning is
- * a ordered set of disjoint position.
- *
- * @param offset the offset for which to search the closest position
- * @return the closest position in the partitioner's category
- */
- protected TypedPosition findClosestPosition(int offset) {
-
- try {
-
- int index= fDocument.computeIndexInCategory(CONTENT_TYPES_CATEGORY, offset);
- Position[] category= fDocument.getPositions(CONTENT_TYPES_CATEGORY);
-
- if (category.length == 0)
- return null;
-
- if (index < category.length) {
- if (offset == category[index].offset)
- return (TypedPosition) category[index];
- }
-
- if (index > 0)
- index--;
-
- return (TypedPosition) category[index];
-
- } catch (BadPositionCategoryException x) {
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
-
- /*
- * @see IDocumentPartitioner#getContentType(int)
- */
- public String getContentType(int offset) {
-
- TypedPosition p= findClosestPosition(offset);
- if (p != null && p.includes(offset))
- return p.getType();
-
- return IDocument.DEFAULT_CONTENT_TYPE;
- }
-
- /*
- * @see IDocumentPartitioner#getPartition(int)
- */
- public ITypedRegion getPartition(int offset) {
-
- try {
-
- Position[] category = fDocument.getPositions(CONTENT_TYPES_CATEGORY);
-
- if (category == null || category.length == 0)
- return new TypedRegion(0, fDocument.getLength(), IDocument.DEFAULT_CONTENT_TYPE);
-
- int index= fDocument.computeIndexInCategory(CONTENT_TYPES_CATEGORY, offset);
-
- if (index < category.length) {
-
- TypedPosition next= (TypedPosition) category[index];
-
- if (offset == next.offset)
- return new TypedRegion(next.getOffset(), next.getLength(), next.getType());
-
- if (index == 0)
- return new TypedRegion(0, next.offset, IDocument.DEFAULT_CONTENT_TYPE);
-
- TypedPosition previous= (TypedPosition) category[index - 1];
- if (previous.includes(offset))
- return new TypedRegion(previous.getOffset(), previous.getLength(), previous.getType());
-
- int endOffset= previous.getOffset() + previous.getLength();
- return new TypedRegion(endOffset, next.getOffset() - endOffset, IDocument.DEFAULT_CONTENT_TYPE);
- }
-
- TypedPosition previous= (TypedPosition) category[category.length - 1];
- if (previous.includes(offset))
- return new TypedRegion(previous.getOffset(), previous.getLength(), previous.getType());
-
- int endOffset= previous.getOffset() + previous.getLength();
- return new TypedRegion(endOffset, fDocument.getLength() - endOffset, IDocument.DEFAULT_CONTENT_TYPE);
-
- } catch (BadPositionCategoryException x) {
- } catch (BadLocationException x) {
- }
-
- return new TypedRegion(0, fDocument.getLength(), IDocument.DEFAULT_CONTENT_TYPE);
- }
-
- /*
- * @see IDocumentPartitioner#computePartitioning(int, int)
- */
- public ITypedRegion[] computePartitioning(int offset, int length) {
-
- List list= new ArrayList();
-
- try {
-
- int endOffset= offset + length;
-
- Position[] category= fDocument.getPositions(CONTENT_TYPES_CATEGORY);
-
- TypedPosition previous= null, current= null;
- int start, end, gapOffset;
- Position gap= null;
-
- for (int i= 0; i < category.length; i++) {
-
- current= (TypedPosition) category[i];
-
- gapOffset= (previous != null) ? previous.getOffset() + previous.getLength() : 0;
- gap= new Position(gapOffset, current.getOffset() - gapOffset);
- if (gap.getLength() > 0 && gap.overlapsWith(offset, length)) {
- start= Math.max(offset, gapOffset);
- end= Math.min(endOffset, gap.getOffset() + gap.getLength());
- list.add(new TypedRegion(start, end - start, IDocument.DEFAULT_CONTENT_TYPE));
- }
-
- if (current.overlapsWith(offset, length)) {
- start= Math.max(offset, current.getOffset());
- end= Math.min(endOffset, current.getOffset() + current.getLength());
- list.add(new TypedRegion(start, end - start, current.getType()));
- }
-
- previous= current;
- }
-
- if (previous != null) {
- gapOffset= previous.getOffset() + previous.getLength();
- gap= new Position(gapOffset, fDocument.getLength() - gapOffset);
- if (gap.getLength() > 0 && gap.overlapsWith(offset, length)) {
- start= Math.max(offset, gapOffset);
- end= Math.min(endOffset, fDocument.getLength());
- list.add(new TypedRegion(start, end - start, IDocument.DEFAULT_CONTENT_TYPE));
- }
- }
-
- if (list.isEmpty())
- list.add(new TypedRegion(offset, length, IDocument.DEFAULT_CONTENT_TYPE));
-
- } catch (BadPositionCategoryException x) {
- }
-
- TypedRegion[] result= new TypedRegion[list.size()];
- list.toArray(result);
- return result;
- }
-
- /*
- * @see IDocumentPartitioner#getLegalContentTypes()
- */
- public String[] getLegalContentTypes() {
- return fLegalContentTypes;
- }
-
- /**
- * Returns whether the given type is one of the legal content types.
- *
- * @param contentType the content type to check
- * @return <code>true</code> if the content type is a legal content type
- */
- protected boolean isSupportedContentType(String contentType) {
- if (contentType != null) {
- for (int i= 0; i < fLegalContentTypes.length; i++) {
- if (fLegalContentTypes[i].equals(contentType))
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Returns a content type encoded in the given token. If the token's
- * data is not <code>null</code> and a string it is assumed that
- * it is the encoded content type.
- *
- * @param token the token whose content type is to be determined
- * @return the token's content type
- */
- protected String getTokenContentType(IToken token) {
- Object data= token.getData();
- if (data instanceof String)
- return (String) data;
- return null;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/EndOfLineRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/EndOfLineRule.java
deleted file mode 100644
index 7a5bb9f..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/EndOfLineRule.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.rules;
-
-
-/**
- * A specific configuration of a single line rule
- * whereby the pattern begins with a specific sequence but
- * is only ended by a line delimiter.
- */
-public class EndOfLineRule extends SingleLineRule {
-
- /**
- * Creates a rule for the given starting sequence
- * which, if detected, will return the specified token.
- *
- * @param startSequence the pattern's start sequence
- * @param token the token to be returned on success
- */
- public EndOfLineRule(String startSequence, IToken token) {
- this(startSequence, token, (char) 0);
- }
-
- /**
- * Creates a rule for the given starting sequence
- * which, if detected, will return the specified token.
- * Any character which follows the given escape character
- * will be ignored.
- *
- * @param startSequence the pattern's start sequence
- * @param token the token to be returned on success
- * @param escapeCharacter the escape character
- */
- public EndOfLineRule(String startSequence, IToken token, char escapeCharacter) {
- super(startSequence, null, token, escapeCharacter, true);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/ICharacterScanner.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/ICharacterScanner.java
deleted file mode 100644
index 2edc15e..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/ICharacterScanner.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.rules;
-
-
-/**
- * Defines the interface of a character scanner used by rules.
- * Rules may request the next character or ask the character
- * scanner to unread the last read character.
- */
-public interface ICharacterScanner {
-
- /**
- * The value returned when this scanner has read EOF.
- */
- public static final int EOF= -1;
-
- /**
- * Provides rules access to the legal line delimiters.
- *
- * @return the legal line delimiters
- */
- char[][] getLegalLineDelimiters();
-
- /**
- * Returns the column of the character scanner.
- *
- * @return the column of the character scanner
- */
- int getColumn();
-
- /**
- * Returns the next character or EOF if end of file has been reached
- *
- * @return the next character or EOF
- */
- int read();
-
- /**
- * Rewinds the scanner before the last read character.
- */
- void unread();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IPartitionTokenScanner.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IPartitionTokenScanner.java
deleted file mode 100644
index 420261f..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IPartitionTokenScanner.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.rules;
-
-
-import org.eclipse.jface.text.IDocument;
-
-
-/**
- * A partition token scanner returns tokens that represent partitions. For that reason,
- * a partition token scanner is vulnerable in respect to the document offset it starts
- * scanning. In a simple case, a partition token scanner must always start at a partition
- * boundary. A partition token scanner can also start in the middle of a partition,
- * if it knows the type of the partition.
- *
- * @since 2.0
- */
-public interface IPartitionTokenScanner extends ITokenScanner {
-
- /**
- * Configures the scanner by providing access to the document range that should be scanned.
- * The range may no only contain complete partitions but starts at the beginning of a line in the
- * middle of a partition of the given content type. This requires that a partition delimiter can not
- * contain a line delimiter.
- *
- * @param document the document to scan
- * @param offset the offset of the document range to scan
- * @param length the length of the document range to scan
- * @param contentType the content type at the given offset
- * @param partitionOffset the offset at which the partition of the given offset starts
- */
- void setPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IPredicateRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IPredicateRule.java
deleted file mode 100644
index 8e4f99e..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IPredicateRule.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.rules;
-
-/**
- * Defines the interface for a rule used in the scanning of text for the purpose of
- * document partitioning or text styling. A predicate rule can only return one single
- * token after having successfully detected content. This token is called success token.
- * Also, it also returns a token indicating that this rule has not been successful.
- *
- * @see ICharacterScanner
- * @since 2.0
- */
-public interface IPredicateRule extends IRule {
-
- /**
- * Returns the success token of this predicate rule.
- *
- * @return the success token of this rule
- */
- IToken getSuccessToken();
-
- /**
- * Evaluates the rule by examining the characters available from
- * the provided character scanner. The token returned by this rule
- * returns <code>true</code> when calling <code>isUndefined</code>,
- * if the text the rule investigated does not match the rule's requirements. Otherwise,
- * this method returns this rule's success token. If this rules relies on a text pattern
- * comprising a opening and a closing character sequence this method can also be called
- * when the scanner is positioned already between the opening and the closing sequence.
- * In this case, <code>resume</code> must be set to <code>true</code>.
- *
- * @param scanner the character scanner to be used by this rule
- * @param resume indicates that the rule starts working between the opening and the closing character sequence
- * @return the token computed by the rule
- */
- IToken evaluate(ICharacterScanner scanner, boolean resume);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IRule.java
deleted file mode 100644
index 4b5dce4..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IRule.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.rules;
-
-
-/**
- * Defines the interface for a rule used in the
- * scanning of text for the purpose of document
- * partitioning or text styling.
- *
- * @see ICharacterScanner
- */
-public interface IRule {
-
- /**
- * Evaluates the rule by examining the characters available from
- * the provided character scanner. The token returned by this rule
- * returns <code>true</code> when calling <code>isUndefined</code>,
- * if the text the rule investigated does not match the rule's requirements.
- *
- * @param scanner the character scanner to be used by this rule
- * @return the token computed by the rule
- */
- IToken evaluate(ICharacterScanner scanner);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IToken.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IToken.java
deleted file mode 100644
index ad02d81..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IToken.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.rules;
-
-
-/**
- * A token to be returned by a rule.
- */
-public interface IToken {
-
- /**
- * Return whether this token is undefined.
- *
- * @return <code>true</code>if this token is undefined
- */
- boolean isUndefined();
-
- /**
- * Return whether this token represents a whitespace.
- *
- * @return <code>true</code>if this token represents a whitespace
- */
- boolean isWhitespace();
-
- /**
- * Return whether this token represents End Of File.
- *
- * @return <code>true</code>if this token represents EOF
- */
- boolean isEOF();
-
- /**
- * Return whether this token is neither undefined, nor whitespace, nor EOF.
- *
- * @return <code>true</code>if this token is not undefined, not a whitespace, and not EOF
- */
- boolean isOther();
-
- /**
- * Return a data attacted to this token. The semantics of this data kept undefined by this interface.
- *
- * @return the data attached to this token.
- */
- Object getData();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/ITokenScanner.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/ITokenScanner.java
deleted file mode 100644
index 0dab8df..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/ITokenScanner.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.rules;
-
-
-import org.eclipse.jface.text.IDocument;
-
-
-/**
- * A token scanner scans a range of a document and reports about the token it finds.
- * A scanner has state. When asked, the scanner returns the offset and the length of the
- * last found token.
- *
- * @see org.eclipse.jface.text.rules.IToken
- * @since 2.0
- */
-public interface ITokenScanner {
-
- /**
- * Configures the scanner by providing access to the document range that should
- * be scanned.
- *
- * @param document the document to scan
- * @param offset the offset of the document range to scan
- * @param length the length of the document range to scan
- */
- void setRange(IDocument document, int offset, int length);
-
- /**
- * Returns the next token in the document.
- *
- * @return the next token in the document
- */
- IToken nextToken();
-
- /**
- * Returns the offset of the last token read by this scanner.
- *
- * @return the offset of the last token read by this scanner
- */
- int getTokenOffset();
-
- /**
- * Returns the length of the last token read by this scanner.
- *
- * @return the length of the last token read by this scanner
- */
- int getTokenLength();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IWhitespaceDetector.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IWhitespaceDetector.java
deleted file mode 100644
index 0719ea0..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IWhitespaceDetector.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.rules;
-
-
-/**
- * Defines the interface by which <code>WhitespaceRule</code>
- * determines whether a given character is to be considered
- * whitespace in the current context.
- */
-public interface IWhitespaceDetector {
-
- /**
- * Returns whether the specified character is whitespace.
- *
- * @param c the character to be checked
- */
- boolean isWhitespace(char c);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IWordDetector.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IWordDetector.java
deleted file mode 100644
index 5b7db6f..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IWordDetector.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.rules;
-
-
-/**
- * Defines the interface by which <code>WordRule</code>
- * determines whether a given character is valid as part
- * of a word in the current context.
- */
-public interface IWordDetector {
-
- /**
- * Returns whether the specified character is
- * valid as the first character in a word.
- *
- * @param c the character to be checked
- * @return <code>true</code> is a valid first character in a word, <code>false</code> otherwise
- */
- boolean isWordStart(char c);
-
- /**
- * Returns whether the specified character is
- * valid as a subsequent character in a word.
- *
- * @param c the character to be checked
- * @return <code>true</code> if the character is a valid word part, <code>false</code> otherwise
- */
- boolean isWordPart(char c);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/MultiLineRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/MultiLineRule.java
deleted file mode 100644
index 9f35df2..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/MultiLineRule.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.rules;
-
-
-/**
- * A rule for detecting patterns which begin with a given
- * sequence and may end with a given sequence thereby spanning
- * multiple lines.
- */
-public class MultiLineRule extends PatternRule {
-
- /**
- * Creates a rule for the given starting and ending sequence
- * which, if detected, will return the specified token.
- *
- * @param startSequence the pattern's start sequence
- * @param endSequence the pattern's end sequence
- * @param token the token to be returned on success
- */
- public MultiLineRule(String startSequence, String endSequence, IToken token) {
- this(startSequence, endSequence, token, (char) 0);
- }
-
- /**
- * Creates a rule for the given starting and ending sequence
- * which, if detected, will return the specific token.
- * Any character which follows the given escape character will be ignored.
- *
- * @param startSequence the pattern's start sequence
- * @param endSequence the pattern's end sequence
- * @param token the token to be returned on success
- * @param escapeCharacter the escape character
- */
- public MultiLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter) {
- this(startSequence, endSequence, token, escapeCharacter, false);
- }
-
- /**
- * Creates a rule for the given starting and ending sequence
- * which, if detected, will return the specific token. Any character that follows the
- * given escape character will be ignored. <code>breakOnEOF</code> indicates whether
- * EOF is equivalent to detecting the <code>endSequence</code>.
- *
- * @param startSequence the pattern's start sequence
- * @param endSequence the pattern's end sequence
- * @param token the token to be returned on success
- * @param escapeCharacter the escape character
- * @param breaksOnEOF indicates whether the end of the file terminates this rule successfully
- * @since 2.1
- */
- public MultiLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter, boolean breaksOnEOF) {
- super(startSequence, endSequence, token, escapeCharacter, false, breaksOnEOF);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/NumberRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/NumberRule.java
deleted file mode 100644
index 42fb5c9..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/NumberRule.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.jface.text.rules;
-
-import org.eclipse.jface.text.Assert;
-
-
-/**
- * An implementation of <code>IRule</code> capable of detecting a numerical value.
- */
-public class NumberRule implements IRule {
-
- /** Internal setting for the uninitialized column constraint */
- protected static final int UNDEFINED= -1;
- /** The token to be returned when this rule is successful */
- protected IToken fToken;
- /** The column constraint */
- protected int fColumn= UNDEFINED;
-
- /**
- * Creates a rule which will return the specified
- * token when a numerical sequence is detected.
- *
- * @param token the token to be returned
- */
- public NumberRule(IToken token) {
- Assert.isNotNull(token);
- fToken= token;
- }
-
- /**
- * Sets a column constraint for this rule. If set, the rule's token
- * will only be returned if the pattern is detected starting at the
- * specified column. If the column is smaller then 0, the column
- * constraint is considered removed.
- *
- * @param column the column in which the pattern starts
- */
- public void setColumnConstraint(int column) {
- if (column < 0)
- column= UNDEFINED;
- fColumn= column;
- }
-
- /*
- * @see IRule#evaluate(ICharacterScanner)
- */
- public IToken evaluate(ICharacterScanner scanner) {
- int c= scanner.read();
- if (Character.isDigit((char)c)) {
- if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) {
- do {
- c= scanner.read();
- } while (Character.isDigit((char) c));
- scanner.unread();
- return fToken;
- }
- }
-
- scanner.unread();
- return Token.UNDEFINED;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java
deleted file mode 100644
index 2b451d2..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.rules;
-
-import org.eclipse.jface.text.Assert;
-
-
-
-
-/**
- * Standard implementation of <code>IPredicateRule</code>.
- * Is is capable of detecting a pattern which begins with a given start
- * sequence and ends with a given end sequence. If the end sequence is
- * not specified, it can be either end of line, end or file, or both. Additionally,
- * the pattern can be constrained to begin in a certain column. The rule can also
- * be used to check whether the text to scan covers half of the pattern, i.e. contains
- * the end sequence required by the rule.
- */
-public class PatternRule implements IPredicateRule {
-
- /** Internal setting for the uninitialized column constraint */
- protected static final int UNDEFINED= -1;
-
- /** The token to be returned on success */
- protected IToken fToken;
- /** The pattern's start sequence */
- protected char[] fStartSequence;
- /** The pattern's end sequence */
- protected char[] fEndSequence;
- /** The pattern's column constrain */
- protected int fColumn= UNDEFINED;
- /** The pattern's escape character */
- protected char fEscapeCharacter;
- /** Indicates whether end of line terminates the pattern */
- protected boolean fBreaksOnEOL;
- /** Indicates whether end of file terminates the pattern */
- protected boolean fBreaksOnEOF;
-
- /**
- * Creates a rule for the given starting and ending sequence.
- * When these sequences are detected the rule will return the specified token.
- * Alternatively, the sequence can also be ended by the end of the line.
- * Any character which follows the given escapeCharacter will be ignored.
- *
- * @param startSequence the pattern's start sequence
- * @param endSequence the pattern's end sequence, <code>null</code> is a legal value
- * @param token the token which will be returned on success
- * @param escapeCharacter any character following this one will be ignored
- * @param breaksOnEOL indicates whether the end of the line also terminates the pattern
- */
- public PatternRule(String startSequence, String endSequence, IToken token, char escapeCharacter, boolean breaksOnEOL) {
- Assert.isTrue(startSequence != null && startSequence.length() > 0);
- Assert.isTrue(endSequence != null || breaksOnEOL);
- Assert.isNotNull(token);
-
- fStartSequence= startSequence.toCharArray();
- fEndSequence= (endSequence == null ? new char[0] : endSequence.toCharArray());
- fToken= token;
- fEscapeCharacter= escapeCharacter;
- fBreaksOnEOL= breaksOnEOL;
- }
-
- /**
- * Creates a rule for the given starting and ending sequence.
- * When these sequences are detected the rule will return the specified token.
- * Alternatively, the sequence can also be ended by the end of the line or the end of the file.
- * Any character which follows the given escapeCharacter will be ignored.
- *
- * @param startSequence the pattern's start sequence
- * @param endSequence the pattern's end sequence, <code>null</code> is a legal value
- * @param token the token which will be returned on success
- * @param escapeCharacter any character following this one will be ignored
- * @param breaksOnEOL indicates whether the end of the line also terminates the pattern
- * @param breaksOnEOF indicates whether the end of the file also terminates the pattern
- * @since 2.1
- */
- public PatternRule(String startSequence, String endSequence, IToken token, char escapeCharacter, boolean breaksOnEOL, boolean breaksOnEOF) {
- this(startSequence, endSequence, token, escapeCharacter, breaksOnEOL);
- fBreaksOnEOF= breaksOnEOF;
- }
-
- /**
- * Sets a column constraint for this rule. If set, the rule's token
- * will only be returned if the pattern is detected starting at the
- * specified column. If the column is smaller then 0, the column
- * constraint is considered removed.
- *
- * @param column the column in which the pattern starts
- */
- public void setColumnConstraint(int column) {
- if (column < 0)
- column= UNDEFINED;
- fColumn= column;
- }
-
-
- /**
- * Evaluates this rules without considering any column constraints.
- *
- * @param scanner the character scanner to be used
- * @return the token resulting from this evaluation
- */
- protected IToken doEvaluate(ICharacterScanner scanner) {
- return doEvaluate(scanner, false);
- }
-
- /**
- * Evaluates this rules without considering any column constraints. Resumes
- * detection, i.e. look sonly for the end sequence required by this rule if the
- * <code>resume</code> flag is set.
- *
- * @param scanner the character scanner to be used
- * @param resume <code>true</code> if detection should be resumed, <code>false</code> otherwise
- * @return the token resulting from this evaluation
- * @since 2.0
- */
- protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) {
-
- if (resume) {
-
- if (endSequenceDetected(scanner))
- return fToken;
-
- } else {
-
- int c= scanner.read();
- if (c == fStartSequence[0]) {
- if (sequenceDetected(scanner, fStartSequence, false)) {
- if (endSequenceDetected(scanner))
- return fToken;
- }
- }
- }
-
- scanner.unread();
- return Token.UNDEFINED;
- }
-
- /*
- * @see IRule#evaluate(ICharacterScanner)
- */
- public IToken evaluate(ICharacterScanner scanner) {
- return evaluate(scanner, false);
- }
-
- /**
- * Returns whether the end sequence was detected. As the pattern can be considered
- * ended by a line delimiter, the result of this method is <code>true</code> if the
- * rule breaks on the end of the line, or if the EOF character is read.
- *
- * @param scanner the character scanner to be used
- * @return <code>true</code> if the end sequence has been detected
- */
- protected boolean endSequenceDetected(ICharacterScanner scanner) {
- int c;
- char[][] delimiters= scanner.getLegalLineDelimiters();
- while ((c= scanner.read()) != ICharacterScanner.EOF) {
- if (c == fEscapeCharacter) {
- // Skip the escaped character.
- scanner.read();
- } else if (fEndSequence.length > 0 && c == fEndSequence[0]) {
- // Check if the specified end sequence has been found.
- if (sequenceDetected(scanner, fEndSequence, true))
- return true;
- } else if (fBreaksOnEOL) {
- // Check for end of line since it can be used to terminate the pattern.
- for (int i= 0; i < delimiters.length; i++) {
- if (c == delimiters[i][0] && sequenceDetected(scanner, delimiters[i], true))
- return true;
- }
- }
- }
- if (fBreaksOnEOF) return true;
- scanner.unread();
- return false;
- }
-
- /**
- * Returns whether the next characters to be read by the character scanner
- * are an exact match with the given sequence. No escape characters are allowed
- * within the sequence. If specified the sequence is considered to be found
- * when reading the EOF character.
- *
- * @param scanner the character scanner to be used
- * @param sequence the sequence to be detected
- * @param eofAllowed indicated whether EOF terminates the pattern
- * @return <code>true</code> if the given sequence has been detected
- */
- protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
- for (int i= 1; i < sequence.length; i++) {
- int c= scanner.read();
- if (c == ICharacterScanner.EOF && eofAllowed) {
- return true;
- } else if (c != sequence[i]) {
- // Non-matching character detected, rewind the scanner back to the start.
- // Do not unread the first character.
- scanner.unread();
- for (int j= i-1; j > 0; j--)
- scanner.unread();
- return false;
- }
- }
-
- return true;
- }
-
- /*
- * @see IPredicateRule#evaluate(ICharacterScanner, boolean)
- * @since 2.0
- */
- public IToken evaluate(ICharacterScanner scanner, boolean resume) {
- if (fColumn == UNDEFINED)
- return doEvaluate(scanner, resume);
-
- int c= scanner.read();
- scanner.unread();
- if (c == fStartSequence[0])
- return (fColumn == scanner.getColumn() ? doEvaluate(scanner, resume) : Token.UNDEFINED);
- else
- return Token.UNDEFINED;
- }
-
- /*
- * @see IPredicateRule#getSuccessToken()
- * @since 2.0
- */
- public IToken getSuccessToken() {
- return fToken;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedDamagerRepairer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedDamagerRepairer.java
deleted file mode 100644
index 84f73ba..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedDamagerRepairer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.rules;
-
-
-import org.eclipse.jface.text.TextAttribute;
-
-
-/**
- * @deprecated use <code>DefaultDamagerRepairer</code>
- */
-public class RuleBasedDamagerRepairer extends DefaultDamagerRepairer {
-
- /**
- * Creates a damager/repairer that uses the given scanner and returns the given default
- * text attribute if the current token does not carry a text attribute.
- *
- * @param scanner the rule based scanner to be used
- * @param defaultTextAttribute the text attribute to be returned if non is specified by the current token,
- * may not be <code>null</code>
- *
- * @deprecated use RuleBasedDamagerRepairer(RuleBasedScanner) instead
- */
- public RuleBasedDamagerRepairer(RuleBasedScanner scanner, TextAttribute defaultTextAttribute) {
- super(scanner, defaultTextAttribute);
- }
-
- /**
- * Creates a damager/repairer that uses the given scanner. The scanner may not be <code>null</code>
- * and is assumed to return only token that carry text attributes.
- *
- * @param scanner the rule based scanner to be used, may not be <code>null</code>
- * @since 2.0
- */
- public RuleBasedDamagerRepairer(RuleBasedScanner scanner) {
- super(scanner);
- }
-}
-
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitionScanner.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitionScanner.java
deleted file mode 100644
index 5ce40bc..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitionScanner.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.jface.text.rules;
-
-
-import org.eclipse.jface.text.IDocument;
-
-
-/**
- * Scanner that exclusively uses predicate rules.
- * @since 2.0
- */
-public class RuleBasedPartitionScanner extends BufferedRuleBasedScanner implements IPartitionTokenScanner {
-
- /** The content type of the partition in which to resume scanning. */
- protected String fContentType;
- /** The offset of the partition inside which to resume. */
- protected int fPartitionOffset;
-
-
- /*
- * @see RuleBasedScanner#setRules(IRule[])
- */
- public void setRules(IRule[] rules) {
- throw new UnsupportedOperationException();
- }
-
- /*
- * @see RuleBasedScanner#setRules(IRule[])
- */
- public void setPredicateRules(IPredicateRule[] rules) {
- super.setRules(rules);
- }
-
- /*
- * @see ITokenScanner#setRange(IDocument, int, int)
- */
- public void setRange(IDocument document, int offset, int length) {
- setPartialRange(document, offset, length, null, -1);
- }
-
- /*
- * @see IPartitionTokenScanner#setPartialRange(IDocument, int, int, String, int)
- */
- public void setPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset) {
- fContentType= contentType;
- fPartitionOffset= partitionOffset;
- if (partitionOffset > -1) {
- int delta= offset - partitionOffset;
- if (delta > 0) {
- super.setRange(document, partitionOffset, length + delta);
- fOffset= offset;
- return;
- }
- }
- super.setRange(document, offset, length);
- }
-
- /*
- * @see ITokenScanner#nextToken()
- */
- public IToken nextToken() {
-
-
- if (fContentType == null || fRules == null) {
- //don't try to resume
- return super.nextToken();
- }
-
- // inside a partition
-
- fColumn= UNDEFINED;
- boolean resume= (fPartitionOffset > -1 && fPartitionOffset < fOffset);
- fTokenOffset= resume ? fPartitionOffset : fOffset;
-
- IPredicateRule rule;
- IToken token;
-
- for (int i= 0; i < fRules.length; i++) {
- rule= (IPredicateRule) fRules[i];
- token= rule.getSuccessToken();
- if (fContentType.equals(token.getData())) {
- token= rule.evaluate(this, resume);
- if (!token.isUndefined()) {
- fContentType= null;
- return token;
- }
- }
- }
-
- // haven't found any rule for this type of partition
- fContentType= null;
- if (resume)
- fOffset= fPartitionOffset;
- return super.nextToken();
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitioner.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitioner.java
deleted file mode 100644
index 7be6b9a..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitioner.java
+++ /dev/null
@@ -1,532 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.rules;
-
-
-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.BadPositionCategoryException;
-import org.eclipse.jface.text.DefaultPositionUpdater;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.IDocumentPartitionerExtension;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TypedPosition;
-import org.eclipse.jface.text.TypedRegion;
-
-
-
-/**
- * A standard implementation of a syntax driven document partitioner.
- * It uses a rule based scanner to scan the document and to determine
- * the document's partitioning. The tokens returned by the rules the
- * scanner is configured with are supposed to return the partition type
- * as their data. The partitioner remembers the document's partitions
- * in the document itself rather than maintaining its own data structure.
- *
- * @see IRule
- * @see RuleBasedScanner
- *
- * @deprecated use <code>DefaultPartitioner</code> instead
- */
-public class RuleBasedPartitioner implements IDocumentPartitioner, IDocumentPartitionerExtension {
-
- /** The position category this partitioner uses to store the document's partitioning information */
- public final static String CONTENT_TYPES_CATEGORY= "__content_types_category"; //$NON-NLS-1$
-
-
- /** The partitioner's scanner */
- protected RuleBasedScanner fScanner;
- /** The legal content types of this partitioner */
- protected String[] fLegalContentTypes;
- /** The partitioner's document */
- protected IDocument fDocument;
- /** The document length before a document change occured */
- protected int fPreviousDocumentLength;
- /** The position updater used to for the default updating of partitions */
- protected DefaultPositionUpdater fPositionUpdater= new DefaultPositionUpdater(CONTENT_TYPES_CATEGORY);
- /** The offset at which the first changed partition starts */
- protected int fStartOffset;
- /** The offset at which the last changed partition ends */
- protected int fEndOffset;
- /**The offset at which a partition has been deleted */
- protected int fDeleteOffset;
-
-
- /**
- * Creates a new partitioner that uses the given scanner and may return
- * partitions of the given legal content types.
- *
- * @param scanner the scanner this partitioner is supposed to use
- * @param legalContentTypes the legal content types of this partitioner
- */
- public RuleBasedPartitioner(RuleBasedScanner scanner, String[] legalContentTypes) {
- fScanner= scanner;
- fLegalContentTypes= legalContentTypes;
- }
-
- /*
- * @see IDocumentPartitioner#connect
- */
- public void connect(IDocument document) {
- Assert.isNotNull(document);
- Assert.isTrue(!document.containsPositionCategory(CONTENT_TYPES_CATEGORY));
-
- fDocument= document;
- fDocument.addPositionCategory(CONTENT_TYPES_CATEGORY);
-
- initialize();
- }
-
- /**
- * Performs the initial partitioning of the partitioner's document.
- */
- protected void initialize() {
-
- fScanner.setRange(fDocument, 0, fDocument.getLength());
-
- try {
- IToken token= fScanner.nextToken();
- while (!token.isEOF()) {
-
- String contentType= getTokenContentType(token);
-
- if (isSupportedContentType(contentType)) {
- TypedPosition p= new TypedPosition(fScanner.getTokenOffset(), fScanner.getTokenLength(), contentType);
- fDocument.addPosition(CONTENT_TYPES_CATEGORY, p);
- }
-
- token= fScanner.nextToken();
- }
- } catch (BadLocationException x) {
- // cannot happen as offsets come from scanner
- } catch (BadPositionCategoryException x) {
- // cannot happen if document has been connected before
- }
- }
-
- /*
- * @see IDocumentPartitioner#disconnect
- */
- public void disconnect() {
-
- Assert.isTrue(fDocument.containsPositionCategory(CONTENT_TYPES_CATEGORY));
-
- try {
- fDocument.removePositionCategory(CONTENT_TYPES_CATEGORY);
- } catch (BadPositionCategoryException x) {
- // can not happen because of Assert
- }
- }
-
- /*
- * @see IDocumentPartitioner#documentAboutToBeChanged
- */
- public void documentAboutToBeChanged(DocumentEvent e) {
-
- Assert.isTrue(e.getDocument() == fDocument);
-
- fPreviousDocumentLength= e.getDocument().getLength();
- fStartOffset= -1;
- fEndOffset= -1;
- fDeleteOffset= -1;
- }
-
- /*
- * @see IDocumentPartitioner#documentChanged
- */
- public boolean documentChanged(DocumentEvent e) {
- IRegion region= documentChanged2(e);
- return (region != null);
- }
-
- /**
- * Helper method for tracking the minimal region containg all partition changes.
- * If <code>offset</code> is smaller than the remembered offset, <code>offset</code>
- * will from now on be remembered. If <code>offset + length</code> is greater than
- * the remembered end offset, it will be remembered from now on.
- *
- * @param offset the offset
- * @param length the length
- */
- private void rememberRegion(int offset, int length) {
- // remember start offset
- if (fStartOffset == -1)
- fStartOffset= offset;
- else if (offset < fStartOffset)
- fStartOffset= offset;
-
- // remember end offset
- int endOffset= offset + length;
- if (fEndOffset == -1)
- fEndOffset= endOffset;
- else if (endOffset > fEndOffset)
- fEndOffset= endOffset;
- }
-
- /**
- * Remembers the given offset as the deletion offset.
- *
- * @param offset the offset
- */
- private void rememberDeletedOffset(int offset) {
- fDeleteOffset= offset;
- }
-
- /**
- * Creates the minimal region containing all partition changes using the
- * remembered offset, end offset, and deletion offset.
- * @return the minimal region containing all the partition changes
- */
- private IRegion createRegion() {
- if (fDeleteOffset == -1) {
- if (fStartOffset == -1 || fEndOffset == -1)
- return null;
- return new Region(fStartOffset, fEndOffset - fStartOffset);
- } else if (fStartOffset == -1 || fEndOffset == -1) {
- return new Region(fDeleteOffset, 0);
- } else {
- int offset= Math.min(fDeleteOffset, fStartOffset);
- int endOffset= Math.max(fDeleteOffset, fEndOffset);
- return new Region(offset, endOffset - offset);
- }
- }
-
- /*
- * @see IDocumentPartitionerExtension#documentChanged2(DocumentEvent)
- * @since 2.0
- */
- public IRegion documentChanged2(DocumentEvent e) {
-
- try {
-
- IDocument d= e.getDocument();
- Position[] category= d.getPositions(CONTENT_TYPES_CATEGORY);
- int first= 0;
- int reparseStart= 0;
- int originalSize= category.length;
-
- if (originalSize > 0) {
-
- /*
- * determine character position at which the scanner starts:
- * first position behind the last non-default partition the actual position is not involved with
- */
-
- first= d.computeIndexInCategory(CONTENT_TYPES_CATEGORY, e.getOffset());
-
- Position p= null;
- do {
- --first;
- if (first < 0)
- break;
-
- p= category[first];
-
- } while (p.overlapsWith(e.getOffset(), e.getLength()) ||
- (e.getOffset() == fPreviousDocumentLength &&
- (p.getOffset() + p.getLength() == fPreviousDocumentLength)));
-
- fPositionUpdater.update(e);
- for (int i= 0; i < category.length; i++) {
- p= category[i];
- if (p.isDeleted) {
- rememberDeletedOffset(e.getOffset());
- break;
- }
- }
- category= d.getPositions(CONTENT_TYPES_CATEGORY);
-
- if (first >= 0) {
- p= category[first];
- reparseStart= p.getOffset() + p.getLength();
- }
-
- ++first;
- }
-
- fScanner.setRange(d, reparseStart, d.getLength() - reparseStart);
-
- int lastScannedPosition= reparseStart;
- IToken token= fScanner.nextToken();
-
- while (!token.isEOF()) {
-
-
- String contentType= getTokenContentType(token);
-
- if (!isSupportedContentType(contentType)) {
- token= fScanner.nextToken();
- continue;
- }
-
- int start= fScanner.getTokenOffset();
- int length= fScanner.getTokenLength();
-
- lastScannedPosition= start + length - 1;
-
- // remove all affected positions
- while (first < category.length) {
- TypedPosition p= (TypedPosition) category[first];
- if (lastScannedPosition >= p.offset + p.length ||
- (p.overlapsWith(start, length) &&
- (!d.containsPosition(CONTENT_TYPES_CATEGORY, start, length) ||
- !contentType.equals(p.getType())))) {
-
- rememberRegion(p.offset, p.length);
- d.removePosition(CONTENT_TYPES_CATEGORY, p);
- ++ first;
-
- } else
- break;
- }
-
- // if position already exists we are done
- if (d.containsPosition(CONTENT_TYPES_CATEGORY, start, length))
- return createRegion();
-
- // insert the new type position
- try {
- d.addPosition(CONTENT_TYPES_CATEGORY, new TypedPosition(start, length, contentType));
- rememberRegion(start, length);
- } catch (BadPositionCategoryException x) {
- } catch (BadLocationException x) {
- }
-
- token= fScanner.nextToken();
- }
-
-
- // remove all positions behind lastScannedPosition since there aren't any further types
- if (lastScannedPosition != reparseStart) {
- // if this condition is not met, nothing has been scanned because of a delete
- ++ lastScannedPosition;
- }
- first= d.computeIndexInCategory(CONTENT_TYPES_CATEGORY, lastScannedPosition);
-
- TypedPosition p;
- while (first < category.length) {
- p= (TypedPosition) category[first++];
- d.removePosition(CONTENT_TYPES_CATEGORY, p);
- rememberRegion(p.offset, p.length);
- }
-
- } catch (BadPositionCategoryException x) {
- // should never happen on connected documents
- } catch (BadLocationException x) {
- }
-
- return createRegion();
- }
-
-
- /**
- * Returns the position in the partitoner's position category which is
- * close to the given offset. This is, the position has either an offset which
- * is the same as the given offset or an offset which is smaller than the given
- * offset. This method profits from the knowledge that a partitioning is
- * a ordered set of disjoint position.
- *
- * @param offset the offset for which to search the closest position
- * @return the closest position in the partitioner's category
- */
- protected TypedPosition findClosestPosition(int offset) {
-
- try {
-
- int index= fDocument.computeIndexInCategory(CONTENT_TYPES_CATEGORY, offset);
- Position[] category= fDocument.getPositions(CONTENT_TYPES_CATEGORY);
-
- if (category.length == 0)
- return null;
-
- if (index < category.length) {
- if (offset == category[index].offset)
- return (TypedPosition) category[index];
- }
-
- if (index > 0)
- index--;
-
- return (TypedPosition) category[index];
-
- } catch (BadPositionCategoryException x) {
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
-
- /*
- * @see IDocumentPartitioner#getContentType
- */
- public String getContentType(int offset) {
-
- TypedPosition p= findClosestPosition(offset);
- if (p != null && p.includes(offset))
- return p.getType();
-
- return IDocument.DEFAULT_CONTENT_TYPE;
- }
-
- /*
- * @see IDocumentPartitioner#getPartition
- */
- public ITypedRegion getPartition(int offset) {
-
- try {
-
- Position[] category = fDocument.getPositions(CONTENT_TYPES_CATEGORY);
-
- if (category == null || category.length == 0)
- return new TypedRegion(0, fDocument.getLength(), IDocument.DEFAULT_CONTENT_TYPE);
-
- int index= fDocument.computeIndexInCategory(CONTENT_TYPES_CATEGORY, offset);
-
- if (index < category.length) {
-
- TypedPosition next= (TypedPosition) category[index];
-
- if (offset == next.offset)
- return new TypedRegion(next.getOffset(), next.getLength(), next.getType());
-
- if (index == 0)
- return new TypedRegion(0, next.offset, IDocument.DEFAULT_CONTENT_TYPE);
-
- TypedPosition previous= (TypedPosition) category[index - 1];
- if (previous.includes(offset))
- return new TypedRegion(previous.getOffset(), previous.getLength(), previous.getType());
-
- int endOffset= previous.getOffset() + previous.getLength();
- return new TypedRegion(endOffset, next.getOffset() - endOffset, IDocument.DEFAULT_CONTENT_TYPE);
- }
-
- TypedPosition previous= (TypedPosition) category[category.length - 1];
- if (previous.includes(offset))
- return new TypedRegion(previous.getOffset(), previous.getLength(), previous.getType());
-
- int endOffset= previous.getOffset() + previous.getLength();
- return new TypedRegion(endOffset, fDocument.getLength() - endOffset, IDocument.DEFAULT_CONTENT_TYPE);
-
- } catch (BadPositionCategoryException x) {
- } catch (BadLocationException x) {
- }
-
- return new TypedRegion(0, fDocument.getLength(), IDocument.DEFAULT_CONTENT_TYPE);
- }
-
- /*
- * @see IDocumentPartitioner#computePartitioning
- */
- public ITypedRegion[] computePartitioning(int offset, int length) {
-
- List list= new ArrayList();
-
- try {
-
- int endOffset= offset + length;
-
- Position[] category= fDocument.getPositions(CONTENT_TYPES_CATEGORY);
-
- TypedPosition previous= null, current= null;
- int start, end, gapOffset;
- Position gap= null;
-
- for (int i= 0; i < category.length; i++) {
-
- current= (TypedPosition) category[i];
-
- gapOffset= (previous != null) ? previous.getOffset() + previous.getLength() : 0;
- gap= new Position(gapOffset, current.getOffset() - gapOffset);
- if (gap.getLength() > 0 && gap.overlapsWith(offset, length)) {
- start= Math.max(offset, gapOffset);
- end= Math.min(endOffset, gap.getOffset() + gap.getLength());
- list.add(new TypedRegion(start, end - start, IDocument.DEFAULT_CONTENT_TYPE));
- }
-
- if (current.overlapsWith(offset, length)) {
- start= Math.max(offset, current.getOffset());
- end= Math.min(endOffset, current.getOffset() + current.getLength());
- list.add(new TypedRegion(start, end - start, current.getType()));
- }
-
- previous= current;
- }
-
- if (previous != null) {
- gapOffset= previous.getOffset() + previous.getLength();
- gap= new Position(gapOffset, fDocument.getLength() - gapOffset);
- if (gap.getLength() > 0 && gap.overlapsWith(offset, length)) {
- start= Math.max(offset, gapOffset);
- end= Math.min(endOffset, fDocument.getLength());
- list.add(new TypedRegion(start, end - start, IDocument.DEFAULT_CONTENT_TYPE));
- }
- }
-
- if (list.isEmpty())
- list.add(new TypedRegion(offset, length, IDocument.DEFAULT_CONTENT_TYPE));
-
- } catch (BadPositionCategoryException x) {
- }
-
- TypedRegion[] result= new TypedRegion[list.size()];
- list.toArray(result);
- return result;
- }
-
- /*
- * @see IDocumentPartitioner#getLegalContentTypes
- */
- public String[] getLegalContentTypes() {
- return fLegalContentTypes;
- }
-
- /**
- * Returns whether the given type is one of the legal content types.
- *
- * @param contentType the content type to check
- * @return <code>true</code> if the content type is a legal content type
- */
- protected boolean isSupportedContentType(String contentType) {
- if (contentType != null) {
- for (int i= 0; i < fLegalContentTypes.length; i++) {
- if (fLegalContentTypes[i].equals(contentType))
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Returns a content type encoded in the given token. If the token's
- * data is not <code>null</code> and a string it is assumed that
- * it is the encoded content type.
- *
- * @param token the token whose content type is to be determined
- * @return the token's content type
- */
- protected String getTokenContentType(IToken token) {
- Object data= token.getData();
- if (data instanceof String)
- return (String) data;
- return null;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedScanner.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedScanner.java
deleted file mode 100644
index c477452..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedScanner.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.jface.text.rules;
-
-
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-
-/**
- * A generic scanner which can be "programmed" with a sequence of rules.
- * The scanner is used to get the next token by evaluating its rule in sequence until
- * one is successful. If a rule returns a token which is undefined, the scanner will proceed to
- * the next rule. Otherwise the token provided by the rule will be returned by
- * the scanner. If no rule returned a defined token, this scanner returns a token
- * which returns <code>true</code> when calling <code>isOther</code>, unless the end
- * of the file is reached. In this case the token returns <code>true</code> when calling
- * <code>isEOF</code>.
- *
- * @see IRule
- */
-public class RuleBasedScanner implements ICharacterScanner, ITokenScanner {
-
- /** The list of rules of this scanner */
- protected IRule[] fRules;
- /** The token to be returned by default if no rule fires */
- protected IToken fDefaultReturnToken;
- /** The document to be scanned */
- protected IDocument fDocument;
- /** The cached legal line delimiters of the document */
- protected char[][] fDelimiters;
- /** The offset of the next character to be read */
- protected int fOffset;
- /** The end offset of the range to be scanned */
- protected int fRangeEnd;
- /** The offset of the last read token */
- protected int fTokenOffset;
- /** The cached column of the current scanner position */
- protected int fColumn;
- /** Internal setting for the uninitialized column cache. */
- protected static final int UNDEFINED= -1;
-
- /**
- * Creates a new rule based scanner which does not have any rule.
- */
- public RuleBasedScanner() {
- }
-
- /**
- * Configures the scanner with the given sequence of rules.
- *
- * @param rules the sequence of rules controlling this scanner
- */
- public void setRules(IRule[] rules) {
- fRules= rules;
- }
-
- /**
- * Configures the scanner's default return token. This is the token
- * which is returned when non of the rules fired and EOF has not been
- * reached.
- *
- * @param token the default return token
- * @since 2.0
- */
- public void setDefaultReturnToken(IToken defaultReturnToken) {
- Assert.isNotNull(defaultReturnToken.getData());
- fDefaultReturnToken= defaultReturnToken;
- }
-
- /*
- * @see ITokenScanner#setRange(IDocument, int, int)
- */
- public void setRange(IDocument document, int offset, int length) {
-
- fDocument= document;
- fOffset= offset;
- fRangeEnd= Math.min(fDocument.getLength(), offset + length);
-
- String[] delimiters= fDocument.getLegalLineDelimiters();
- fDelimiters= new char[delimiters.length][];
- for (int i= 0; i < delimiters.length; i++)
- fDelimiters[i]= delimiters[i].toCharArray();
-
- if (fDefaultReturnToken == null)
- fDefaultReturnToken= new Token(null);
- }
-
- /*
- * @see ITokenScanner#getTokenOffset()
- */
- public int getTokenOffset() {
- return fTokenOffset;
- }
-
- /*
- * @see ITokenScanner#getTokenLength()
- */
- public int getTokenLength() {
- if (fOffset < fRangeEnd)
- return fOffset - getTokenOffset();
- return fRangeEnd - getTokenOffset();
- }
-
-
- /*
- * @see ICharacterScanner#getColumn()
- */
- public int getColumn() {
- if (fColumn == UNDEFINED) {
- try {
- int line= fDocument.getLineOfOffset(fOffset);
- int start= fDocument.getLineOffset(line);
-
- fColumn= fOffset - start;
-
- } catch (BadLocationException ex) {
- }
- }
- return fColumn;
- }
-
- /*
- * @see ICharacterScanner#getLegalLineDelimiters()
- */
- public char[][] getLegalLineDelimiters() {
- return fDelimiters;
- }
-
- /*
- * @see ITokenScanner#nextToken()
- */
- public IToken nextToken() {
-
- IToken token;
-
- while (true) {
-
- fTokenOffset= fOffset;
- fColumn= UNDEFINED;
-
- if (fRules != null) {
- for (int i= 0; i < fRules.length; i++) {
- token= (fRules[i].evaluate(this));
- if (!token.isUndefined())
- return token;
- }
- }
-
- if (read() == EOF)
- return Token.EOF;
- else
- return fDefaultReturnToken;
- }
- }
-
- /*
- * @see ICharacterScanner#read()
- */
- public int read() {
-
- try {
-
- if (fOffset < fRangeEnd) {
- try {
- return fDocument.getChar(fOffset);
- } catch (BadLocationException e) {
- }
- }
-
- return EOF;
-
- } finally {
- ++ fOffset;
- }
- }
-
- /*
- * @see ICharacterScanner#unread()
- */
- public void unread() {
- --fOffset;
- }
-}
-
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/SingleLineRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/SingleLineRule.java
deleted file mode 100644
index 4d5bc14..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/SingleLineRule.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.jface.text.rules;
-
-
-/**
- * A specific configuration of pattern rule whereby
- * the pattern begins with a specific sequence and may
- * end with a specific sequence, but will not span more
- * than a single line.
- */
-public class SingleLineRule extends PatternRule {
-
- /**
- * Creates a rule for the given starting and ending sequence
- * which, if detected, will return the specified token.
- *
- * @param startSequence the pattern's start sequence
- * @param token the token to be returned on success
- */
- public SingleLineRule(String startSequence, String endSequence, IToken token) {
- this(startSequence, endSequence, token, (char) 0);
- }
-
- /**
- * Creates a rule for the given starting and ending sequence
- * which, if detected, will return the specified token.
- * Any character which follows the given escape character
- * will be ignored.
- *
- * @param startSequence the pattern's start sequence
- * @param endSequence the pattern's end sequence
- * @param token the token to be returned on success
- * @param escapeCharacter the escape character
- */
- public SingleLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter) {
- this(startSequence, endSequence, token, escapeCharacter, false);
- }
-
- /**
- * Creates a rule for the given starting and ending sequence
- * which, if detected, will return the specified token. Alternatively, the
- * line can also be ended with the end of the file.
- * Any character which follows the given escape character
- * will be ignored.
- *
- * @param startSequence the pattern's start sequence
- * @param endSequence the pattern's end sequence
- * @param token the token to be returned on success
- * @param escapeCharacter the escape character
- * @param breaksOnEOF indicates whether the end of the file successfully terminates this rule
- * @since 2.1
- */
- public SingleLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter, boolean breaksOnEOF) {
- super(startSequence, endSequence, token, escapeCharacter, true, breaksOnEOF);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/Token.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/Token.java
deleted file mode 100644
index 1fd18cf..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/Token.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.jface.text.rules;
-
-import org.eclipse.jface.text.Assert;
-
-
-/**
- * Standard implementation of <code>IToken</code>.
- */
-public class Token implements IToken {
-
- /** Internal token type: Undefined */
- private static final int T_UNDEFINED= 0;
- /** Internal token type: EOF */
- private static final int T_EOF= 1;
- /** Internal token type: Whitespace */
- private static final int T_WHITESPACE= 2;
- /** Internal token type: Others */
- private static final int T_OTHER= 3;
-
-
- /**
- * Standard token: Undefined.
- */
- public static final IToken UNDEFINED= new Token(T_UNDEFINED);
- /**
- * Standard token: End Of File.
- */
- public static final IToken EOF= new Token(T_EOF);
- /**
- * Standard token: Whitespace.
- */
- public static final IToken WHITESPACE= new Token(T_WHITESPACE);
-
- /**
- * Standard token: Neither Undefine, Whitespace, nor End Of File.
- * @deprecated will be removed
- */
- public static final IToken OTHER= new Token(T_OTHER);
-
- /** The type of this token */
- private int fType;
- /** The data associated with this token */
- private Object fData;
-
- /**
- * Creates a new token according to the given specification which does not
- * have any data attached to it.
- *
- * @param type the type of the token
- * @since 2.0
- */
- private Token(int type) {
- fType= type;
- fData= null;
- }
-
- /**
- * Creates a new token which represents neither undefined, whitespace, nor EOF.
- * The newly created token has the given data attached to it.
- *
- * @param data the data attached to the newly created token
- */
- public Token(Object data) {
- fType= T_OTHER;
- fData= data;
- }
-
- /**
- * Reinitializes the data of this token. The token may not represent
- * undefined, whitepsace, or EOF.
- *
- * @param the data to be attached to the token
- * @since 2.0
- */
- public void setData(Object data) {
- Assert.isTrue(isOther());
- fData= data;
- }
-
- /*
- * @see IToken#getData()
- */
- public Object getData() {
- return fData;
- }
-
- /*
- * @see IToken#isOther()
- */
- public boolean isOther() {
- return (fType == T_OTHER);
- }
-
- /*
- * @see IToken#isEOF()
- */
- public boolean isEOF() {
- return (fType == T_EOF);
- }
-
- /*
- * @see IToken#isWhitespace()
- */
- public boolean isWhitespace() {
- return (fType == T_WHITESPACE);
- }
-
- /*
- * @see IToken#isUndefined()
- */
- public boolean isUndefined() {
- return (fType == T_UNDEFINED);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WhitespaceRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WhitespaceRule.java
deleted file mode 100644
index 7fc02d3..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WhitespaceRule.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.rules;
-
-
-import org.eclipse.jface.text.Assert;
-
-
-/**
- * An implementation of <code>IRule</code> capable of detecting whitespace.
- * A whitespace rule uses a whitespace detector in order to find out which
- * characters are whitespace characters.
- *
- * @see IWhitespaceDetector
- */
-public class WhitespaceRule implements IRule {
-
- /** The whitespace detector used by this rule */
- protected IWhitespaceDetector fDetector;
-
- /**
- * Creates a rule which, with the help of an
- * whitespace detector, will return a whitespace
- * token when a whitespace is detected.
- *
- * @param detector the rule's whitespace detector, may not be <code>null</code>
- */
- public WhitespaceRule(IWhitespaceDetector detector) {
- Assert.isNotNull(detector);
- fDetector= detector;
- }
-
- /*
- * @see IRule#evaluate(ICharacterScanner)
- */
- public IToken evaluate(ICharacterScanner scanner) {
- int c= scanner.read();
- if (fDetector.isWhitespace((char) c)) {
- do {
- c= scanner.read();
- } while (fDetector.isWhitespace((char) c));
- scanner.unread();
- return Token.WHITESPACE;
- } else {
- scanner.unread();
- return Token.UNDEFINED;
- }
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordPatternRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordPatternRule.java
deleted file mode 100644
index ee09cbe..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordPatternRule.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.rules;
-
-
-import org.eclipse.jface.text.Assert;
-
-
-
-/**
- * A specific single line rule which stipulates that the start
- * and end sequence occur within a single word, as defined by a word detector.
- *
- * @see IWordDetector
- */
-public class WordPatternRule extends SingleLineRule {
-
- /** The word detector used by this rule */
- protected IWordDetector fDetector;
- /** The internal buffer used for pattern detection */
- private StringBuffer fBuffer= new StringBuffer();
-
- /**
- * Creates a rule for the given starting and ending word
- * pattern which, if detected, will return the specified token.
- * A word detector is used to identify words.
- *
- * @param detected the word detector to be used
- * @param startSequence the start sequence of the word pattern
- * @param endSequence the end sequence of the word pattern
- * @param token the token to be returned on success
- */
- public WordPatternRule(IWordDetector detector, String startSequence, String endSequence, IToken token) {
- this(detector, startSequence, endSequence, token, (char)0);
- }
-
- /**
- /**
- * Creates a rule for the given starting and ending word
- * pattern which, if detected, will return the specified token.
- * A word detector is used to identify words.
- * Any character which follows the given escapeCharacter will be ignored.
- *
- * @param detected the word detector to be used
- * @param startSequence the start sequence of the word pattern
- * @param endSequence the end sequence of the word pattern
- * @param token the token to be returned on success
- * @param escapeCharacter the escape character
- */
- public WordPatternRule(IWordDetector detector, String startSequence, String endSequence, IToken token, char escapeCharacter) {
- super(startSequence, endSequence, token, escapeCharacter);
- Assert.isNotNull(detector);
- fDetector= detector;
- }
-
- /**
- * Returns whether the end sequence was detected.
- * The rule acquires the rest of the word, using the
- * provided word detector, and tests to determine if
- * it ends with the end sequence.
- *
- * @param scanner the scanner to be used
- * @return <code>true</code> if the word ends on the given end sequence
- */
- protected boolean endSequenceDetected(ICharacterScanner scanner) {
- fBuffer.setLength(0);
- int c= scanner.read();
- while (fDetector.isWordPart((char) c)) {
- fBuffer.append((char) c);
- c= scanner.read();
- }
- scanner.unread();
-
- if (fBuffer.length() >= fEndSequence.length) {
- for (int i=fEndSequence.length - 1, j= fBuffer.length() - 1; i >= 0; i--, j--) {
- if (fEndSequence[i] != fBuffer.charAt(j)) {
- unreadBuffer(scanner);
- return false;
- }
- }
- return true;
- }
-
- unreadBuffer(scanner);
- return false;
- }
-
- /**
- * Returns the characters in the buffer to the scanner.
- * Note that the rule must also return the characters
- * read in as part of the start sequence expect the first one.
- *
- * @param scanner the scanner to be used
- */
- protected void unreadBuffer(ICharacterScanner scanner) {
- fBuffer.insert(0, fStartSequence);
- for (int i= fBuffer.length() - 1; i > 0; i--)
- scanner.unread();
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordRule.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordRule.java
deleted file mode 100644
index 6d162d2..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordRule.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.jface.text.rules;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.text.Assert;
-
-
-/**
- * An implementation of <code>IRule</code> capable of detecting words
- * Word rules also allow for the association of tokens with specific words.
- * That is, not only can the rule be used to provide tokens for exact matches,
- * but also for the generalized notion of a word in the context in which it is used.
- * A word rules uses a word detector to determine what a word is.
- *
- * @see IWordDetector
- */
-public class WordRule implements IRule {
-
- /** Internal setting for the uninitialized column constraint */
- protected static final int UNDEFINED= -1;
-
- /** The word detector used by this rule */
- protected IWordDetector fDetector;
- /** The default token to be returned on success and if nothing else has been specified. */
- protected IToken fDefaultToken;
- /** The column constraint */
- protected int fColumn= UNDEFINED;
- /** The table of predefined words and token for this rule */
- protected Map fWords= new HashMap();
- /** Buffer used for pattern detection */
- private StringBuffer fBuffer= new StringBuffer();
-
- /**
- * Creates a rule which, with the help of an word detector, will return the token
- * associated with the detected word. If no token has been associated, the scanner
- * will be rolled back and an undefined token will be returned in order to allow
- * any subsequent rules to analyze the characters.
- *
- * @param detector the word detector to be used by this rule, may not be <code>null</code>
- *
- * @see #addWord
- */
- public WordRule(IWordDetector detector) {
- this(detector, Token.UNDEFINED);
- }
-
- /**
- * Creates a rule which, with the help of an word detector, will return the token
- * associated with the detected word. If no token has been associated, the
- * specified default token will be returned.
- *
- * @param detector the word detector to be used by this rule, may not be <code>null</code>
- * @param defaultToken the default token to be returned on success
- * if nothing else is specified, may not be <code>null</code>
- *
- * @see #addWord
- */
- public WordRule(IWordDetector detector, IToken defaultToken) {
-
- Assert.isNotNull(detector);
- Assert.isNotNull(defaultToken);
-
- fDetector= detector;
- fDefaultToken= defaultToken;
- }
-
- /**
- * Adds a word and the token to be returned if it is detected.
- *
- * @param word the word this rule will search for, may not be <code>null</code>
- * @param token the token to be returned if the word has been found, may not be <code>null</code>
- */
- public void addWord(String word, IToken token) {
- Assert.isNotNull(word);
- Assert.isNotNull(token);
-
- fWords.put(word, token);
- }
-
- /**
- * Sets a column constraint for this rule. If set, the rule's token
- * will only be returned if the pattern is detected starting at the
- * specified column. If the column is smaller then 0, the column
- * constraint is considered removed.
- *
- * @param column the column in which the pattern starts
- */
- public void setColumnConstraint(int column) {
- if (column < 0)
- column= UNDEFINED;
- fColumn= column;
- }
-
- /*
- * @see IRule#evaluate(ICharacterScanner)
- */
- public IToken evaluate(ICharacterScanner scanner) {
- int c= scanner.read();
- if (fDetector.isWordStart((char) c)) {
- if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) {
-
- fBuffer.setLength(0);
- do {
- fBuffer.append((char) c);
- c= scanner.read();
- } while (c != ICharacterScanner.EOF && fDetector.isWordPart((char) c));
- scanner.unread();
-
- IToken token= (IToken) fWords.get(fBuffer.toString());
- if (token != null)
- return token;
-
- if (fDefaultToken.isUndefined())
- unreadBuffer(scanner);
-
- return fDefaultToken;
- }
- }
-
- scanner.unread();
- return Token.UNDEFINED;
- }
-
- /**
- * Returns the characters in the buffer to the scanner.
- *
- * @param scanner the scanner to be used
- */
- protected void unreadBuffer(ICharacterScanner scanner) {
- for (int i= fBuffer.length() - 1; i >= 0; i--)
- scanner.unread();
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/package.html b/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/package.html
deleted file mode 100644
index 253c053..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/rules/package.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.51 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a framework for rule based text scanning
-and uses the framework to provide rule-driven default implementations of
-<tt>IPresentationDamager</tt>, <tt>IPresentationRepairer</tt> and <tt>IDocumentPartitioner</tt>.
-<h2>
-Package Specification</h2>
-<tt>RuleBasedScanner</tt> is a document-based scanner controlled by <tt>IRule</tt>
-objects. When evaluated an <tt>IRule</tt> always returns an <tt>IToken</tt>.
-The package provides a set of rules whereby <tt>PatternRule</tt> is the
-most important one. <tt>PatternRule</tt> defines a pattern-configurable
-rule.
-</body>
-</html>
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/Annotation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/Annotation.java
deleted file mode 100644
index 8fcf997..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/Annotation.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.source;
-
-
-
-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;
-
-/**
- * Abstract annotation managed by an <code>IAnnotationModel</code>.
- * Annotations are considered being located at layers and are considered being painted
- * starting with layer 0 upwards. Thus an annotation of layer 5 will be drawn on top of
- * all co-located annotations at the layers 4 - 0. Subclasses must provide the annotations
- * paint method.
- *
- * @see IVerticalRuler
- */
-public abstract class Annotation {
-
- /** The layer of this annotation. */
- private int fLayer;
-
- /**
- * Creates a new annotation.
- */
- protected Annotation() {
- }
-
- /**
- * Sets the layer of this annotation.
- *
- * @param layer the layer of this annotation
- */
- protected void setLayer(int layer) {
- fLayer= layer;
- }
-
- /**
- * Convenience method for drawing an image aligned inside a rectangle.
- *
- * @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
- */
- protected 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:
- break;
- case SWT.CENTER:
- y= (r.height - bounds.height) / 2;
- break;
- case SWT.BOTTOM:
- y= r.height - bounds.height;
- break;
- }
-
- gc.drawImage(image, r.x+x, r.y+y);
- }
- }
-
- /**
- * Convenience method for drawing an image aligned inside a rectangle.
- *
- * @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
- */
- protected static void drawImage(Image image, GC gc, Canvas canvas, Rectangle r, int align) {
- drawImage(image, gc, canvas, r, align, SWT.CENTER);
- }
-
- /**
- * Returns the annotations drawing layer.
- *
- * @return the annotations drawing layer
- */
- public int getLayer() {
- return fLayer;
- }
-
- /**
- * Implement this method to draw a graphical representation
- * of this annotation within the given bounds.
- *
- * @param GC the drawing GC
- * @param canvas the canvas to draw on
- * @param bounds the bounds inside the canvas to draw on
- */
- public abstract void paint(GC gc, Canvas canvas, Rectangle bounds);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationBarHoverManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationBarHoverManager.java
deleted file mode 100644
index a9f475d..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationBarHoverManager.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.source;
-
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-
-import org.eclipse.jface.text.AbstractHoverInformationControlManager;
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewerExtension3;
-
-
-
-/**
- * This manager controls the layout, content, and visibility of an information
- * control in reaction to mouse hover events issued by the vertical ruler of a
- * source viewer.
- * @since 2.0
- */
-public class AnnotationBarHoverManager extends AbstractHoverInformationControlManager {
-
- /** The source viewer the manager is connected to */
- private ISourceViewer fSourceViewer;
- /** The vertical ruler the manager is registered with */
- private IVerticalRulerInfo fVerticalRulerInfo;
- /** The annotation hover the manager uses to retrieve the information to display */
- private IAnnotationHover fAnnotationHover;
-
-
- /**
- * Creates an annotation hover manager with the given parameters. In addition,
- * the hovers anchor is RIGHT and the margin is 5 points to the right.
- *
- * @param sourceViewer the source viewer this manager connects to
- * @param ruler the vertical ruler this manager connects to
- * @param annotationHover the annotation hover providing the information to be displayed
- * @param creator the information control creator
- * @deprecated As of 2.1, replaced by {@link AnnotationBarHoverManager#AnnotationBarHoverManager(IVerticalRulerInfo, ISourceViewer, IAnnotationHover, IInformationControlCreator)}
- */
- public AnnotationBarHoverManager(ISourceViewer sourceViewer, IVerticalRuler ruler, IAnnotationHover annotationHover, IInformationControlCreator creator) {
- this(ruler, sourceViewer, annotationHover, creator);
- }
-
- /**
- * Creates an annotation hover manager with the given parameters. In addition,
- * the hovers anchor is RIGHT and the margin is 5 points to the right.
- *
- * @param ruler the vertical ruler this manager connects to
- * @param sourceViewer the source viewer this manager connects to
- * @param annotationHover the annotation hover providing the information to be displayed
- * @param creator the information control creator
- * @since 2.1
- */
- public AnnotationBarHoverManager(IVerticalRulerInfo rulerInfo, ISourceViewer sourceViewer, IAnnotationHover annotationHover, IInformationControlCreator creator) {
- super(creator);
-
- Assert.isNotNull(sourceViewer);
- Assert.isNotNull(annotationHover);
-
- fSourceViewer= sourceViewer;
- fVerticalRulerInfo= rulerInfo;
- fAnnotationHover= annotationHover;
-
- setAnchor(ANCHOR_RIGHT);
- setMargins(5, 0);
- }
-
- /*
- * @see AbstractHoverInformationControlManager#computeInformation()
- */
- protected void computeInformation() {
- Point location= getHoverEventLocation();
- int line= fVerticalRulerInfo.toDocumentLineNumber(location.y);
- setInformation(fAnnotationHover.getHoverInfo(fSourceViewer, line), computeArea(line));
- }
-
- /**
- * Returns for the widget line number for the given document line number.
- *
- * @param line the absolute line number
- * @return the line number relative to the viewer's visible region
- * @throws BadLocationException if <code>line</code> is not valid in the viewer's document
- */
- private int getWidgetLineNumber(int line) throws BadLocationException {
- if (fSourceViewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) fSourceViewer;
- return extension.modelLine2WidgetLine(line);
- }
-
- IRegion region= fSourceViewer.getVisibleRegion();
- int firstLine= fSourceViewer.getDocument().getLineOfOffset(region.getOffset());
- return line - firstLine;
- }
-
- /**
- * Determines graphical area covered by the given line.
- *
- * @param line the number of the line in the viewer whose graphical extend in the vertical ruler must be computed
- * @return the graphical extend of the given line
- */
- private Rectangle computeArea(int line) {
- try {
- StyledText text= fSourceViewer.getTextWidget();
- int lineHeight= text.getLineHeight();
- int y= getWidgetLineNumber(line) * lineHeight - text.getTopPixel();
- Point size= fVerticalRulerInfo.getControl().getSize();
- return new Rectangle(0, y, size.x, lineHeight);
- } catch (BadLocationException x) {
- }
- return null;
- }
-
- /**
- * Returns the annotation hover for this hover manager.
- *
- * @return the annotation hover for this hover manager
- * @since 2.1
- */
- protected IAnnotationHover getAnnotationHover() {
- return fAnnotationHover;
- }
-
- /**
- * Returns the source viewer for this hover manager.
- *
- * @return the source viewer for this hover manager
- * @since 2.1
- */
- protected ISourceViewer getSourceViewer() {
- return fSourceViewer;
- }
-
- /**
- * Returns the vertical ruler info for this hover manager
- *
- * @return the vertical ruler info for this hover manager
- * @since 2.1
- */
- protected IVerticalRulerInfo getVerticalRulerInfo() {
- return fVerticalRulerInfo;
- }
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationColumn.java
deleted file mode 100644
index 176d666..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationColumn.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.source;
-
-
-/**
- * @deprecated use <code>AnnotationRulerColumn</code> instead.
- * @since 2.0
- */
-public final class AnnotationColumn extends AnnotationRulerColumn {
-
- /**
- * Creates a new <code>AnnotationColumn</code> of the given width.
- *
- * @param width the width of this column
- * @deprecated
- */
- public AnnotationColumn(int width) {
- super(width);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationModel.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationModel.java
deleted file mode 100644
index 4ee712f..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationModel.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.source;
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-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.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.Position;
-
-
-/**
- * Standard implementation of <code>IAnnotationModel</code>. This class can directly
- * be used by clients. Subclasses may adapt this annotation model to other exsisting
- * annotation mechanisms.
- */
-public class AnnotationModel implements IAnnotationModel {
-
- /** The list of managed annotations */
- protected Map fAnnotations;
- /** The list of annotation model listeners */
- protected ArrayList fAnnotationModelListeners;
- /** The document conntected with this model */
- protected IDocument fDocument;
- /** The number of open connections to the same document */
- private int fOpenConnections= 0;
- /** The document listener for tracking whether document positions might have been changed. */
- private IDocumentListener fDocumentListener;
- /** The flag indicating whether the document positions might have been changed. */
- private boolean fDocumentChanged= true;
-
- /**
- * Creates a new annotation model. The annotation is empty, i.e. does not
- * manage any annotations and is not connected to any document.
- */
- public AnnotationModel() {
- fAnnotations= Collections.synchronizedMap(new HashMap(10));
- fAnnotationModelListeners= new ArrayList(2);
-
- fDocumentListener= new IDocumentListener() {
-
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- public void documentChanged(DocumentEvent event) {
- fDocumentChanged= true;
- }
- };
- }
-
- /*
- * @see IAnnotationModel#addAnnotation(Annotation, Position)
- */
- public void addAnnotation(Annotation annotation, Position position) {
- addAnnotation(annotation, position, true);
- }
-
- /**
- * Adds the given annotation to this model. Associates the
- * annotation with the given position. If requested, all annotation
- * model listeners are informed about this model change. If the annotation
- * is already managed by this model nothing happens.
- *
- * @param annotation the annotation to add
- * @param position the associate position
- * @param fireModelChange indicates whether to notify all model listeners
- */
- protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged) {
- if (!fAnnotations.containsKey(annotation)) {
-
- fAnnotations.put(annotation, position);
- addPosition(fDocument, position);
-
- if (fireModelChanged)
- fireModelChanged();
- }
- }
-
- /*
- * @see IAnnotationModel#addAnnotationModelListener(IAnnotationModelListener)
- */
- public void addAnnotationModelListener(IAnnotationModelListener listener) {
- if (!fAnnotationModelListeners.contains(listener)) {
- fAnnotationModelListeners.add(listener);
- listener.modelChanged(this);
- }
- }
-
- /**
- * Adds the given position to the default position category of the
- * given document.
- *
- * @param document the document to which to add the position
- * @param position the position to add
- */
- protected void addPosition(IDocument document, Position position) {
- if (document != null) {
- try {
- document.addPosition(position);
- } catch (BadLocationException x) {
- }
- }
- }
-
- /*
- * @see IAnnotationModel#connect(IDocument)
- */
- public void connect(IDocument document) {
- Assert.isTrue(fDocument == null || fDocument == document);
-
- if (fDocument == null) {
- fDocument= document;
- Iterator e= fAnnotations.values().iterator();
- while (e.hasNext())
- addPosition(fDocument, (Position) e.next());
- }
-
- ++ fOpenConnections;
- if (fOpenConnections == 1) {
- fDocument.addDocumentListener(fDocumentListener);
- connected();
- }
- }
-
- /**
- * Hook method. Is called as soon as this model becomes connected to a document.
- * Subclasses may re-implement.
- */
- protected void connected() {
- }
-
- /**
- * Hook method. Is called as soon as this model becomes diconnected from its document.
- * Subclasses may re-implement.
- */
- protected void disconnected() {
- }
-
- /*
- * @see IAnnotationModel#disconnect(IDocument)
- */
- public void disconnect(IDocument document) {
-
- Assert.isTrue(fDocument == document);
-
- -- fOpenConnections;
- if (fOpenConnections == 0) {
-
- disconnected();
- fDocument.removeDocumentListener(fDocumentListener);
-
- if (fDocument != null) {
- Iterator e= fAnnotations.values().iterator();
- while (e.hasNext()) {
- Position p= (Position) e.next();
- fDocument.removePosition(p);
- }
- fDocument= 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
- * @since 2.0
- */
- 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);
- }
- }
-
- /**
- * Removes the given annotations from this model. If requested all
- * annotation model listeners will be informed about this change.
- * <code>modelInitiated</code> indicates whether the deletion has
- * been initiated by this model or by one of its clients.
- *
- * @param annotations the annotations to be removed
- * @param fireModelChanged indicates whether to notify all model listeners
- * @param modelInitiated indicates whether this changes has been initiated by this model
- */
- protected void removeAnnotations(List annotations, boolean fireModelChanged, boolean modelInitiated) {
- if (annotations.size() > 0) {
- Iterator e= annotations.iterator();
- while (e.hasNext())
- removeAnnotation((Annotation) e.next(), false);
-
- if (fireModelChanged)
- fireModelChanged();
- }
- }
-
- /**
- * Removes all annotations from the model whose associated positions have been
- * deleted. If requested inform all model listeners about the change.
- *
- * @param fireModelChanged indicates whether to notify all model listeners
- */
- protected void cleanup(boolean fireModelChanged) {
- if (fDocumentChanged) {
- fDocumentChanged= false;
-
- ArrayList deleted= new ArrayList();
- Iterator e= new ArrayList(fAnnotations.keySet()).iterator();
- while (e.hasNext()) {
- Annotation a= (Annotation) e.next();
- Position p= (Position) fAnnotations.get(a);
- if (p == null || p.isDeleted())
- deleted.add(a);
- }
-
- removeAnnotations(deleted, fireModelChanged, false);
- }
- }
-
- /*
- * @see IAnnotationModel#getAnnotationsIterator()
- */
- public Iterator getAnnotationIterator() {
- return getAnnotationIterator(true);
- }
-
- /**
- * Returns all annotations managed by this model. <code>cleanup</code>
- * indicates whether all annotations whose associated positions are
- * deleted should previously be removed from the model.
- *
- * @param cleanup indicates whether annotations with deleted associated positions are removed
- * @return all annotations managed by this model
- */
- protected Iterator getAnnotationIterator(boolean cleanup) {
- if (cleanup)
- cleanup(false);
-
- synchronized (fAnnotations) {
- return new ArrayList(fAnnotations.keySet()).iterator();
- }
- }
-
- /*
- * @see IAnnotationModel#getPosition(Annotation)
- */
- public Position getPosition(Annotation annotation) {
- return (Position) fAnnotations.get(annotation);
- }
-
- /**
- * Removes all annotations from the annotation model and
- * informs all model listeners about this change.
- */
- public void removeAllAnnotations() {
- removeAllAnnotations(true);
- }
-
- /**
- * Removes all annotations from the annotation model. If requested
- * inform all model change listeners about this change.
- *
- * @param fireModelChanged indicates whether to notify all model listeners
- */
- protected void removeAllAnnotations(boolean fireModelChanged) {
-
- if (fDocument != null) {
- Iterator e= fAnnotations.values().iterator();
- while (e.hasNext()) {
- Position p= (Position) e.next();
- fDocument.removePosition(p);
- }
- }
-
- fAnnotations.clear();
-
- if (fireModelChanged)
- fireModelChanged();
- }
-
- /*
- * @see IAnnotationModel#removeAnnotation(Annotation)
- */
- public void removeAnnotation(Annotation annotation) {
- removeAnnotation(annotation, true);
- }
-
- /**
- * Removes the given annotation from the annotation model.
- * If requested inform all model change listeners about this change.
- *
- * @param annotation the annotation to be removed
- * @param fireModelChanged indicates whether to notify all model listeners
- */
- protected void removeAnnotation(Annotation annotation, boolean fireModelChanged) {
- if (fAnnotations.containsKey(annotation)) {
-
- if (fDocument != null) {
- Position p= (Position) fAnnotations.get(annotation);
- fDocument.removePosition(p);
- }
-
- fAnnotations.remove(annotation);
-
- if (fireModelChanged)
- fireModelChanged();
- }
- }
-
- /*
- * @see IAnnotationModel#removeAnnotationModelListener(IAnnotationModelListener)
- */
- public void removeAnnotationModelListener(IAnnotationModelListener listener) {
- fAnnotationModelListeners.remove(listener);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationModelEvent.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationModelEvent.java
deleted file mode 100644
index 855cca7..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationModelEvent.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.source;
-
-/**
- * Specification of changes applied to annotation models.
- * The event carries the changed annotation model. <p>
- * Work in progress. Intented to also contain added, removed, and modified annotations.
- *
- * @see IAnnotationModel
- * @since 2.0
- */
-public class AnnotationModelEvent {
-
- /** The model this event refers to. For internal use only. */
- IAnnotationModel fAnnotationModel;
-
- /**
- * Creates a new annotation model event for the given model.
- *
- * @param model the model
- */
- public AnnotationModelEvent(IAnnotationModel model) {
- fAnnotationModel= model;
- }
-
- /**
- * Returns the model this event refers to.
- *
- * @return the model this events belongs to
- */
- public IAnnotationModel getAnnotationModel() {
- return fAnnotationModel;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java
deleted file mode 100644
index 8d762e2..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java
+++ /dev/null
@@ -1,521 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.source;
-
-
-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.swt.custom.StyledText;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IPaintPositionManager;
-import org.eclipse.jface.text.IPainter;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewerExtension3;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-
-
-
-/**
- * Paints annotations provided by an annotation model as squigglies onto an
- * associated source viewer. Clients usually instantiate and configure objects
- * of this class.
- *
- * @since 2.1
- */
-public class AnnotationPainter implements IPainter, PaintListener, IAnnotationModelListener {
-
- /**
- * The presentation information (decoration) for an annotation. Each such
- * object represents one squiggly.
- */
- private static class Decoration {
- /** The position of this decoration */
- Position fPosition;
- /** The color of this decoration */
- Color fColor;
- /** Indicates whether this decoration might span multiple lines */
- boolean fMultiLine;
- };
-
- /** Indicates whether this painter is active */
- private boolean fIsActive= false;
- /** Indicates whether this painter is managing decorations */
- private boolean fIsPainting= false;
- /** Indicates whether this painter is setting its annotation model */
- private boolean fIsSettingModel= false;
- /** The associated source viewer */
- private ISourceViewer fSourceViewer;
- /** The cached widget of the source viewer */
- private StyledText fTextWidget;
- /** The annotation model providing the annotations to be drawn */
- private IAnnotationModel fModel;
- /** The annotation access */
- private IAnnotationAccess fAnnotationAccess;
- /** The list of decorations */
- private List fDecorations= new ArrayList();
- /** The internal color table */
- private Map fColorTable= new HashMap();
- /** The list of types of annotations that are painted by this painter */
- private Set fAnnotationTypes= new HashSet();
-
-
- /**
- * Creates a new annotation painter for the given source viewer and with the given
- * annotation access. The painter is uninitialized, i.e. no annotation types are configured
- * to be painted.
- *
- * @param sourceViewer the source viewer for this painter
- * @param access the annotation access for this painter
- */
- public AnnotationPainter(ISourceViewer sourceViewer, IAnnotationAccess access) {
- fSourceViewer= sourceViewer;
- fAnnotationAccess= access;
- fTextWidget= sourceViewer.getTextWidget();
- }
-
- /**
- * Returns whether this painter has to draw any suiggly.
- *
- * @return <code>true</code> if there are squigglies to be drawn, <code>false</code> otherwise
- */
- private boolean hasDecorations() {
- return !fDecorations.isEmpty();
- }
-
- /**
- * Enables painting. This painter registers a paint listener with the
- * source viewer's widget.
- */
- private void enablePainting() {
- if (!fIsPainting && hasDecorations()) {
- fIsPainting= true;
- fTextWidget.addPaintListener(this);
- handleDrawRequest(null);
- }
- }
-
- /**
- * Disables painting, if is has previously been enabled. Removes
- * any paint listeners registered with the source viewer's widget.
- *
- * @param redraw <code>true</code> if the widget should be redrawn after disabling
- */
- private void disablePainting(boolean redraw) {
- if (fIsPainting) {
- fIsPainting= false;
- fTextWidget.removePaintListener(this);
- if (redraw && hasDecorations())
- handleDrawRequest(null);
- }
- }
-
- /**
- * Sets the annotation model for this painter. Registers this painter
- * as listener of the give model, if the model is not <code>null</code>.
- *
- * @param model the annotation model
- */
- private void setModel(IAnnotationModel model) {
- if (fModel != model) {
- if (fModel != null)
- fModel.removeAnnotationModelListener(this);
- fModel= model;
- if (fModel != null) {
- try {
- fIsSettingModel= true;
- fModel.addAnnotationModelListener(this);
- } finally {
- fIsSettingModel= false;
- }
- }
- }
- }
-
- /**
- * Updates the set of decorations based on the current state of
- * the painter's annotation model.
- */
- private void catchupWithModel() {
- if (fDecorations != null) {
- fDecorations.clear();
- if (fModel != null) {
-
- Iterator e= fModel.getAnnotationIterator();
- while (e.hasNext()) {
-
- Annotation annotation= (Annotation) e.next();
- Object annotationType= fAnnotationAccess.getType(annotation);
- if (annotationType == null)
- continue;
-
- Color color= null;
- if (fAnnotationTypes.contains(annotationType))
- color= (Color) fColorTable.get(annotationType);
-
- if (color != null) {
- Decoration pp= new Decoration();
- pp.fPosition= fModel.getPosition(annotation);
- pp.fColor= color;
- pp.fMultiLine= fAnnotationAccess.isMultiLine(annotation);
- fDecorations.add(pp);
- }
- }
- }
- }
- }
-
- /**
- * Recomputes the squigglies to be drawn and redraws them.
- */
- private void updatePainting() {
- disablePainting(true);
- catchupWithModel();
- enablePainting();
- }
-
- /*
- * @see IAnnotationModelListener#modelChanged(IAnnotationModel)
- */
- public void modelChanged(final IAnnotationModel model) {
- if (fTextWidget != null && !fTextWidget.isDisposed()) {
- if (fIsSettingModel) {
- // inside the ui thread -> no need for posting
- updatePainting();
- } else {
- Display d= fTextWidget.getDisplay();
- if (d != null) {
- d.asyncExec(new Runnable() {
- public void run() {
- if (fTextWidget != null && !fTextWidget.isDisposed())
- updatePainting();
- }
- });
- }
- }
- }
- }
-
- /**
- * Sets the color in which the squiggly for the given annotation type should be drawn.
- *
- * @param annotationType the annotation type
- * @param color the color
- */
- public void setAnnotationTypeColor(Object annotationType, Color color) {
- if (color != null)
- fColorTable.put(annotationType, color);
- else
- fColorTable.remove(annotationType);
- }
-
- /**
- * Adds the given annotation type to the list of annotation types whose
- * annotations should be painted by this painter. If the annotation type
- * is already in this list, this method is without effect.
- *
- * @param annotationType the annotation type
- */
- public void addAnnotationType(Object annotationType) {
- fAnnotationTypes.add(annotationType);
- }
-
- /**
- * Removes the given annotation type from the list of annotation types whose
- * annotations are painted by this painter. If the annotation type is not
- * in this list, this method is wihtout effect.
- *
- * @param annotationType the annotation type
- */
- public void removeAnnotationType(Object annotationType) {
- fAnnotationTypes.remove(annotationType);
- }
-
- /**
- * Clears the list of annotation types whose annotations are
- * painted by this painter.
- */
- public void removeAllAnnotationTypes() {
- fAnnotationTypes.clear();
- }
-
- /**
- * Returns whether the list of annotation types whose annotations are painted
- * by this painter contains at least on element.
- *
- * @return <code>true</code> if there is an annotation type whose annotations are painted
- */
- public boolean isPaintingAnnotations() {
- return !fAnnotationTypes.isEmpty();
- }
-
- /*
- * @see IPainter#dispose()
- */
- public void dispose() {
-
- if (fColorTable != null)
- fColorTable.clear();
- fColorTable= null;
-
- if (fAnnotationTypes != null)
- fAnnotationTypes.clear();
- fAnnotationTypes= null;
-
- fTextWidget= null;
- fSourceViewer= null;
- fAnnotationAccess= null;
- fModel= null;
- fDecorations= null;
- }
-
- /**
- * Returns the document offset of the upper left corner of the source viewer's viewport,
- * possibly including partially visible lines.
- *
- * @return the document offset if the upper left corner of the viewport
- */
- private int getInclusiveTopIndexStartOffset() {
-
- if (fTextWidget != null && !fTextWidget.isDisposed()) {
- int top= fSourceViewer.getTopIndex();
- if ((fTextWidget.getTopPixel() % fTextWidget.getLineHeight()) != 0)
- top--;
- try {
- IDocument document= fSourceViewer.getDocument();
- return document.getLineOffset(top);
- } catch (BadLocationException ex) {
- }
- }
-
- return -1;
- }
-
- /*
- * @see PaintListener#paintControl(PaintEvent)
- */
- public void paintControl(PaintEvent event) {
- if (fTextWidget != null)
- handleDrawRequest(event.gc);
- }
-
- /**
- * Handles the request to draw the annotations using the given gaphical context.
- *
- * @param gc the graphical context
- */
- private void handleDrawRequest(GC gc) {
-
- if (fTextWidget == null) {
- // is already disposed
- return;
- }
-
- int vOffset= getInclusiveTopIndexStartOffset();
- // http://bugs.eclipse.org/bugs/show_bug.cgi?id=17147
- int vLength= fSourceViewer.getBottomIndexEndOffset() + 1;
-
- for (Iterator e = fDecorations.iterator(); e.hasNext();) {
- Decoration pp = (Decoration) e.next();
- Position p= pp.fPosition;
- if (p.overlapsWith(vOffset, vLength)) {
-
- if (!pp.fMultiLine) {
-
- IRegion widgetRange= getWidgetRange(p);
- if (widgetRange != null)
- draw(gc, widgetRange.getOffset(), widgetRange.getLength(), pp.fColor);
-
- } else {
-
- IDocument document= fSourceViewer.getDocument();
- try {
-
- int startLine= document.getLineOfOffset(p.getOffset());
- int lastInclusive= Math.max(p.getOffset(), p.getOffset() + p.getLength() - 1);
- int endLine= document.getLineOfOffset(lastInclusive);
-
- for (int i= startLine; i <= endLine; i++) {
- IRegion line= document.getLineInformation(i);
- int paintStart= Math.max(line.getOffset(), p.getOffset());
- int paintEnd= Math.min(line.getOffset() + line.getLength(), p.getOffset() + p.getLength());
- if (paintEnd > paintStart) {
- // otherwise inside a line delimiter
- IRegion widgetRange= getWidgetRange(new Position(paintStart, paintEnd - paintStart));
- if (widgetRange != null)
- draw(gc, widgetRange.getOffset(), widgetRange.getLength(), pp.fColor);
- }
- }
-
- } catch (BadLocationException x) {
- }
- }
- }
- }
- }
-
- /**
- * Returns the widget region that corresponds to the given region in the
- * viewer's document.
- *
- * @param p the region in the viewer's document
- * @return the corresponding widget region
- */
- private IRegion getWidgetRange(Position p) {
- if (fSourceViewer instanceof ITextViewerExtension3) {
-
- ITextViewerExtension3 extension= (ITextViewerExtension3) fSourceViewer;
- return extension.modelRange2WidgetRange(new Region(p.getOffset(), p.getLength()));
-
- } else {
-
- IRegion region= fSourceViewer.getVisibleRegion();
- int offset= region.getOffset();
- int length= region.getLength();
-
- if (p.overlapsWith(offset , length)) {
- int p1= Math.max(offset, p.getOffset());
- int p2= Math.min(offset + length, p.getOffset() + p.getLength());
- return new Region(p1 - offset, p2 - p1);
- }
- }
-
- return null;
- }
-
- /**
- * Computes an array of alternating x and y values which are the corners of the squiggly line of the
- * given height between the given end points.
- *
- * @param left the left end point
- * @param right the right end point
- * @param height the height of the squiggly line
- * @return the array of alternating x and y values which are the corners of the squiggly line
- */
- private int[] computePolyline(Point left, Point right, int height) {
-
- final int WIDTH= 4; // must be even
- final int HEIGHT= 2; // can be any number
-// final int MINPEEKS= 2; // minimal number of peeks
-
- int peeks= (right.x - left.x) / WIDTH;
-// if (peeks < MINPEEKS) {
-// int missing= (MINPEEKS - peeks) * WIDTH;
-// left.x= Math.max(0, left.x - missing/2);
-// peeks= MINPEEKS;
-// }
-
- int leftX= left.x;
-
- // compute (number of point) * 2
- int length= ((2 * peeks) + 1) * 2;
- if (length < 0)
- return new int[0];
-
- int[] coordinates= new int[length];
-
- // cache peeks' y-coordinates
- int bottom= left.y + height - 1;
- int top= bottom - HEIGHT;
-
- // populate array with peek coordinates
- for (int i= 0; i < peeks; i++) {
- int index= 4 * i;
- coordinates[index]= leftX + (WIDTH * i);
- coordinates[index+1]= bottom;
- coordinates[index+2]= coordinates[index] + WIDTH/2;
- coordinates[index+3]= top;
- }
-
- // the last down flank is missing
- coordinates[length-2]= left.x + (WIDTH * peeks);
- coordinates[length-1]= bottom;
-
- return coordinates;
- }
-
- /**
- * Draws a squiggly line of the given length start at the given offset in the
- * given color.
- *
- * @param gc the grahical context
- * @param offset the offset of the line
- * @param length the length of the line
- * @param color the color of the line
- */
- private void draw(GC gc, int offset, int length, Color color) {
- if (gc != null) {
-
- Point left= fTextWidget.getLocationAtOffset(offset);
- Point right= fTextWidget.getLocationAtOffset(offset + length);
-
- gc.setForeground(color);
- int[] polyline= computePolyline(left, right, gc.getFontMetrics().getHeight());
- gc.drawPolyline(polyline);
-
- } else {
- fTextWidget.redrawRange(offset, length, true);
- }
- }
-
- /*
- * @see IPainter#deactivate(boolean)
- */
- public void deactivate(boolean redraw) {
- if (fIsActive) {
- fIsActive= false;
- disablePainting(redraw);
- setModel(null);
- catchupWithModel();
- }
- }
-
- /*
- * @see IPainter#paint(int)
- */
- public void paint(int reason) {
-
- if (fSourceViewer.getDocument() == null) {
- deactivate(false);
- return;
- }
-
- if (!fIsActive) {
- IAnnotationModel model= fSourceViewer.getAnnotationModel();
- if (model != null) {
- fIsActive= true;
- setModel(fSourceViewer.getAnnotationModel());
- }
- } else if (CONFIGURATION == reason || INTERNAL == reason)
- updatePainting();
- }
-
- /*
- * @see org.eclipse.jface.text.IPainter#setPositionManager(org.eclipse.jface.text.IPaintPositionManager)
- */
- public void setPositionManager(IPaintPositionManager manager) {
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java
deleted file mode 100644
index 6f4b8cb..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java
+++ /dev/null
@@ -1,495 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.source;
-
-
-import java.util.Iterator;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-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.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-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.ITextViewerExtension3;
-import org.eclipse.jface.text.IViewportListener;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextEvent;
-
-
-/**
- * A vertical ruler column showing graphical representations of annotations.
- * Will become final. Do not subclass.
- * @since 2.0
- */
-public class AnnotationRulerColumn implements IVerticalRulerColumn {
-
- /**
- * Internal listener class.
- */
- class InternalListener implements IViewportListener, IAnnotationModelListener, ITextListener {
-
- /*
- * @see IViewportListener#viewportChanged(int)
- */
- public void viewportChanged(int verticalPosition) {
- if (verticalPosition != fScrollPos)
- redraw();
- }
-
- /*
- * @see IAnnotationModelListener#modelChanged(IAnnotationModel)
- */
- public void modelChanged(IAnnotationModel model) {
- postRedraw();
- }
-
- /*
- * @see ITextListener#textChanged(TextEvent)
- */
- public void textChanged(TextEvent e) {
- if (e.getViewerRedrawState())
- postRedraw();
- }
- };
-
-
- /** This column's parent ruler */
- private CompositeRuler fParentRuler;
- /** The cached text viewer */
- private ITextViewer fCachedTextViewer;
- /** The cached text widget */
- private StyledText fCachedTextWidget;
- /** The ruler's canvas */
- private Canvas fCanvas;
- /** The vertical ruler's model */
- private IAnnotationModel fModel;
- /** Cache for the actual scroll position in pixels */
- private int fScrollPos;
- /** The drawable for double buffering */
- private Image fBuffer;
- /** The internal listener */
- private InternalListener fInternalListener= new InternalListener();
- /** The width of this vertical ruler */
- private int fWidth;
- /** Switch for enabling/disabling the setModel method. */
- private boolean fAllowSetModel= true;
-
-
- /**
- * Constructs this column with the given width.
- *
- * @param width the width of the vertical ruler
- */
- public AnnotationRulerColumn(IAnnotationModel model, int width) {
- fWidth= width;
- fAllowSetModel= false;
- fModel= model;
- fModel.addAnnotationModelListener(fInternalListener);
- }
-
- /**
- * Constructs this column with the given width.
- *
- * @param width the width of the vertical ruler
- */
- public AnnotationRulerColumn(int width) {
- fWidth= width;
- }
-
- /*
- * @see IVerticalRulerColumn#getControl()
- */
- public Control getControl() {
- return fCanvas;
- }
-
- /*
- * @see IVerticalRulerColumn#getWidth()
- */
- public int getWidth() {
- return fWidth;
- }
-
- /*
- * @see IVerticalRulerColumn#createControl(CompositeRuler, Composite)
- */
- public Control createControl(CompositeRuler parentRuler, Composite parentControl) {
-
- fParentRuler= parentRuler;
- fCachedTextViewer= parentRuler.getTextViewer();
- fCachedTextWidget= fCachedTextViewer.getTextWidget();
-
- fCanvas= new Canvas(parentControl, SWT.NO_BACKGROUND);
-
- fCanvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- if (fCachedTextViewer != null)
- doubleBufferPaint(event.gc);
- }
- });
-
- fCanvas.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- handleDispose();
- fCachedTextViewer= null;
- fCachedTextWidget= null;
- }
- });
-
- fCanvas.addMouseListener(new MouseListener() {
- public void mouseUp(MouseEvent event) {
- }
-
- public void mouseDown(MouseEvent event) {
- fParentRuler.setLocationOfLastMouseButtonActivity(event.x, event.y);
- }
-
- public void mouseDoubleClick(MouseEvent event) {
- fParentRuler.setLocationOfLastMouseButtonActivity(event.x, event.y);
- mouseDoubleClicked(fParentRuler.getLineOfLastMouseButtonActivity());
- }
- });
-
- if (fCachedTextViewer != null) {
- fCachedTextViewer.addViewportListener(fInternalListener);
- fCachedTextViewer.addTextListener(fInternalListener);
- }
-
- return fCanvas;
- }
-
- /**
- * Hook method for a mouse double click event on the given ruler line.
- *
- * @param rulerLine the ruler line
- */
- protected void mouseDoubleClicked(int rulerLine) {
- }
-
- /**
- * Disposes the ruler's resources.
- */
- private void handleDispose() {
-
- if (fCachedTextViewer != null) {
- fCachedTextViewer.removeViewportListener(fInternalListener);
- fCachedTextViewer.removeTextListener(fInternalListener);
- }
-
- if (fModel != null)
- fModel.removeAnnotationModelListener(fInternalListener);
-
- if (fBuffer != null) {
- fBuffer.dispose();
- fBuffer= null;
- }
- }
-
- /**
- * Double buffer drawing.
- *
- * @param dest the gc to draw into
- */
- private void doubleBufferPaint(GC dest) {
-
- Point size= fCanvas.getSize();
-
- if (size.x <= 0 || size.y <= 0)
- return;
-
- if (fBuffer != null) {
- Rectangle r= fBuffer.getBounds();
- if (r.width != size.x || r.height != size.y) {
- fBuffer.dispose();
- fBuffer= null;
- }
- }
- if (fBuffer == null)
- fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
-
- GC gc= new GC(fBuffer);
- try {
- gc.setBackground(fCanvas.getBackground());
- gc.fillRectangle(0, 0, size.x, size.y);
-
- if (fCachedTextViewer instanceof ITextViewerExtension3)
- doPaint1(gc);
- else
- doPaint(gc);
- } finally {
- gc.dispose();
- }
-
- dest.drawImage(fBuffer, 0, 0);
- }
-
- /**
- * Returns the document offset of the upper left corner of the source viewer's
- * viewport, possibly including partially visible lines.
- *
- * @return document offset of the upper left corner including partially visible lines
- */
- protected int getInclusiveTopIndexStartOffset() {
-
- if (fCachedTextWidget != null && !fCachedTextWidget.isDisposed()) {
- int top= fCachedTextViewer.getTopIndex();
- if ((fCachedTextWidget.getTopPixel() % fCachedTextWidget.getLineHeight()) != 0)
- top--;
- try {
- IDocument document= fCachedTextViewer.getDocument();
- return document.getLineOffset(top);
- } catch (BadLocationException ex) {
- }
- }
-
- return -1;
- }
-
- /**
- * Draws the vertical ruler w/o drawing the Canvas background.
- *
- * @param gc the gc to draw into
- */
- protected void doPaint(GC gc) {
-
- if (fModel == null || fCachedTextViewer == null)
- return;
-
- int topLeft= getInclusiveTopIndexStartOffset();
- int bottomRight= fCachedTextViewer.getBottomIndexEndOffset();
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=14938
- int viewPort= bottomRight + 1 - topLeft;
-
- fScrollPos= fCachedTextWidget.getTopPixel();
- int lineheight= fCachedTextWidget.getLineHeight();
- Point dimension= fCanvas.getSize();
- int shift= fCachedTextViewer.getTopInset();
-
- IDocument doc= fCachedTextViewer.getDocument();
-
- int topLine= -1, bottomLine= -1;
- try {
- IRegion region= fCachedTextViewer.getVisibleRegion();
- topLine= doc.getLineOfOffset(region.getOffset());
- bottomLine= doc.getLineOfOffset(region.getOffset() + region.getLength());
- } catch (BadLocationException x) {
- return;
- }
-
- // draw Annotations
- Rectangle r= new Rectangle(0, 0, 0, 0);
- int maxLayer= 1; // loop at least once thru layers.
-
- for (int layer= 0; layer < maxLayer; layer++) {
- Iterator iter= fModel.getAnnotationIterator();
- while (iter.hasNext()) {
- Annotation annotation= (Annotation) iter.next();
-
- int lay= annotation.getLayer();
- maxLayer= Math.max(maxLayer, lay+1); // dynamically update layer maximum
- if (lay != layer) // wrong layer: skip annotation
- continue;
-
- Position position= fModel.getPosition(annotation);
- if (position == null)
- continue;
-
- if (!position.overlapsWith(topLeft, viewPort))
- continue;
-
- try {
-
- int offset= position.getOffset();
- int length= position.getLength();
-
- int startLine= doc.getLineOfOffset(offset);
- if (startLine < topLine)
- startLine= topLine;
-
- int endLine= startLine;
- if (length > 0)
- endLine= doc.getLineOfOffset(offset + length - 1);
- if (endLine > bottomLine)
- endLine= bottomLine;
-
- startLine -= topLine;
- endLine -= topLine;
-
- r.x= 0;
- r.y= (startLine * lineheight) - fScrollPos + shift;
- r.width= dimension.x;
- int lines= endLine - startLine;
- if (lines < 0)
- lines= -lines;
- r.height= (lines+1) * lineheight;
-
- if (r.y < dimension.y) // annotation within visible area
- annotation.paint(gc, fCanvas, r);
-
- } catch (BadLocationException e) {
- }
- }
- }
- }
-
- /**
- * Draws the vertical ruler w/o drawing the Canvas background. Implementation based
- * on <code>ITextViewerExtension3</code>. Will replace <code>doPaint(GC)</code>.
- *
- * @param gc the gc to draw into
- */
- protected void doPaint1(GC gc) {
-
- if (fModel == null || fCachedTextViewer == null)
- return;
-
- ITextViewerExtension3 extension= (ITextViewerExtension3) fCachedTextViewer;
-
- fScrollPos= fCachedTextWidget.getTopPixel();
- int lineheight= fCachedTextWidget.getLineHeight();
- Point dimension= fCanvas.getSize();
- int shift= fCachedTextViewer.getTopInset();
-
- // draw Annotations
- Rectangle r= new Rectangle(0, 0, 0, 0);
- int maxLayer= 1; // loop at least once thru layers.
-
- for (int layer= 0; layer < maxLayer; layer++) {
- Iterator iter= fModel.getAnnotationIterator();
- while (iter.hasNext()) {
-
- Annotation annotation= (Annotation) iter.next();
-
- int lay= annotation.getLayer();
- maxLayer= Math.max(maxLayer, lay+1); // dynamically update layer maximum
- if (lay != layer) // wrong layer: skip annotation
- continue;
-
- Position position= fModel.getPosition(annotation);
- if (position == null)
- continue;
-
- IRegion widgetRegion= extension.modelRange2WidgetRange(new Region(position.getOffset(), position.getLength()));
- if (widgetRegion == null)
- continue;
-
- int startLine= extension.widgetLineOfWidgetOffset(widgetRegion.getOffset());
- if (startLine == -1)
- continue;
-
- int endLine= extension.widgetLineOfWidgetOffset(widgetRegion.getOffset() + Math.max(widgetRegion.getLength() -1, 0));
- if (endLine == -1)
- continue;
-
- r.x= 0;
- r.y= (startLine * lineheight) - fScrollPos + shift;
- r.width= dimension.x;
- int lines= endLine - startLine;
- if (lines < 0)
- lines= -lines;
- r.height= (lines+1) * lineheight;
-
- if (r.y < dimension.y) // annotation within visible area
- annotation.paint(gc, fCanvas, r);
- }
- }
- }
-
-
- /**
- * Post a redraw request for this column into the UI thread.
- */
- private void postRedraw() {
- if (fCanvas != null && !fCanvas.isDisposed()) {
- Display d= fCanvas.getDisplay();
- if (d != null) {
- d.asyncExec(new Runnable() {
- public void run() {
- redraw();
- }
- });
- }
- }
- }
-
- /*
- * @see IVerticalRulerColumn#redraw()
- */
- public void redraw() {
- if (fCanvas != null && !fCanvas.isDisposed()) {
- GC gc= new GC(fCanvas);
- doubleBufferPaint(gc);
- gc.dispose();
- }
- }
-
- /*
- * @see IVerticalRulerColumn#setModel
- */
- public void setModel(IAnnotationModel model) {
- if (fAllowSetModel && model != fModel) {
-
- if (fModel != null)
- fModel.removeAnnotationModelListener(fInternalListener);
-
- fModel= model;
-
- if (fModel != null)
- fModel.addAnnotationModelListener(fInternalListener);
-
- postRedraw();
- }
- }
-
- /*
- * @see IVerticalRulerColumn#setFont(Font)
- */
- public void setFont(Font font) {
- }
-
- /**
- * Returns the cached text viewer.
- *
- * @return the cached text viewer
- */
- protected ITextViewer getCachedTextViewer() {
- return fCachedTextViewer;
- }
-
- /**
- * Returns this column's annotation model.
- *
- * @return this column's annotation model
- */
- protected IAnnotationModel getModel() {
- return fModel;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/CompositeRuler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/CompositeRuler.java
deleted file mode 100644
index 59e4892..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/CompositeRuler.java
+++ /dev/null
@@ -1,747 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.source;
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.internal.SWTEventListener;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Menu;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension;
-import org.eclipse.jface.text.ITextViewerExtension3;
-
-
-/**
- * Standard implementation of <code>IVerticalRuler</code>. This ruler does not have a
- * a visual representation of its own. The presentation comes from the configurable list
- * of decorators. Decorators must implement the <code>IVerticalRulerColumn</code>
- * interface.<p>
- * Clients may instantiate and configure this class.
- *
- * @see IVerticalRulerColumn
- * @see ITextViewer
- * @since 2.0
- */
-public class CompositeRuler implements IVerticalRuler, IVerticalRulerExtension {
-
-
- /**
- * Layout of the composite vertical ruler. Arranges the list of decorators.
- */
- class RulerLayout extends Layout {
-
- /**
- * Creates the new ruler layout.
- */
- protected RulerLayout() {
- }
-
- /*
- * @see Layout#computeSize(Composite, int, int, boolean)
- */
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- Control[] children= composite.getChildren();
- Point size= new Point(0, 0);
- for (int i= 0; i < children.length; i++) {
- Point s= children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- size.x += s.x;
- size.y= Math.max(size.y, s.y);
- }
- size.x += (Math.max(0, children.length -1) * fGap);
- return size;
- }
-
- /*
- * @see Layout#layout(Composite, boolean)
- */
- protected void layout(Composite composite, boolean flushCache) {
- Rectangle clArea= composite.getClientArea();
- int rulerHeight= clArea.height;
-
- int x= 0;
- Iterator e= fDecorators.iterator();
- while (e.hasNext()) {
- IVerticalRulerColumn column= (IVerticalRulerColumn) e.next();
- int columnWidth= column.getWidth();
- column.getControl().setBounds(x, 0, columnWidth, rulerHeight);
- x += (columnWidth + fGap);
- }
- }
- };
-
- /**
- * A canvas that adds listeners to all its children. Used by the implementation of the
- * vertical ruler to propagate listener additions and removals to the ruler's columns.
- */
- static class CompositeRulerCanvas extends Canvas {
-
- /**
- * Keeps the information for which event type a listener object has been added.
- */
- static class ListenerInfo {
- Class fClass;
- SWTEventListener fListener;
- };
-
- /** The list of listeners added to this canvas. */
- private List fCachedListeners= new ArrayList();
- /** Internal mouse listener for opening the context menu. */
- private MouseListener fMouseListener;
-
- /**
- * Creates a new composite ruler canvas.
- *
- * @param parent the parent composite
- * @param style the SWT styles
- */
- public CompositeRulerCanvas(Composite parent, int style) {
- super(parent, style);
- fMouseListener= new MouseAdapter() {
- public void mouseUp(MouseEvent e) {
- if (3 == e.button) {
- Menu menu= getMenu();
- if (menu != null) {
- Control c= (Control) e.widget;
- Point p= new Point(e.x, e.y);
- Point p2= c.toDisplay(p);
- menu.setLocation(p2.x, p2.y);
- menu.setVisible(true);
- }
- }
- }
- };
- super.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (fCachedListeners != null) {
- fCachedListeners.clear();
- fCachedListeners= null;
- }
- }
- });
- }
-
- /**
- * Adds the given listener object as listner of the given type (<code>clazz</code>) to
- * the given control.
- *
- * @param clazz the listener type
- * @param control the control to add the listener to
- * @param listener the listener to be added
- */
- private void addListener(Class clazz, Control control, SWTEventListener listener) {
- if (ControlListener.class.equals(clazz)) {
- control. addControlListener((ControlListener) listener);
- return;
- }
- if (FocusListener.class.equals(clazz)) {
- control. addFocusListener((FocusListener) listener);
- return;
- }
- if (HelpListener.class.equals(clazz)) {
- control. addHelpListener((HelpListener) listener);
- return;
- }
- if (KeyListener.class.equals(clazz)) {
- control. addKeyListener((KeyListener) listener);
- return;
- }
- if (MouseListener.class.equals(clazz)) {
- control. addMouseListener((MouseListener) listener);
- return;
- }
- if (MouseMoveListener.class.equals(clazz)) {
- control. addMouseMoveListener((MouseMoveListener) listener);
- return;
- }
- if (MouseTrackListener.class.equals(clazz)) {
- control. addMouseTrackListener((MouseTrackListener) listener);
- return;
- }
- if (PaintListener.class.equals(clazz)) {
- control. addPaintListener((PaintListener) listener);
- return;
- }
- if (TraverseListener.class.equals(clazz)) {
- control. addTraverseListener((TraverseListener) listener);
- return;
- }
- if (DisposeListener.class.equals(clazz)) {
- control. addDisposeListener((DisposeListener) listener);
- return;
- }
- }
-
- /**
- * Removes the given listener object as listner of the given type (<code>clazz</code>) from
- * the given control.
- *
- * @param clazz the listener type
- * @param control the control to remove the listener from
- * @param listener the listener to be removed
- */
- private void removeListener(Class clazz, Control control, SWTEventListener listener) {
- if (ControlListener.class.equals(clazz)) {
- control. removeControlListener((ControlListener) listener);
- return;
- }
- if (FocusListener.class.equals(clazz)) {
- control. removeFocusListener((FocusListener) listener);
- return;
- }
- if (HelpListener.class.equals(clazz)) {
- control. removeHelpListener((HelpListener) listener);
- return;
- }
- if (KeyListener.class.equals(clazz)) {
- control. removeKeyListener((KeyListener) listener);
- return;
- }
- if (MouseListener.class.equals(clazz)) {
- control. removeMouseListener((MouseListener) listener);
- return;
- }
- if (MouseMoveListener.class.equals(clazz)) {
- control. removeMouseMoveListener((MouseMoveListener) listener);
- return;
- }
- if (MouseTrackListener.class.equals(clazz)) {
- control. removeMouseTrackListener((MouseTrackListener) listener);
- return;
- }
- if (PaintListener.class.equals(clazz)) {
- control. removePaintListener((PaintListener) listener);
- return;
- }
- if (TraverseListener.class.equals(clazz)) {
- control. removeTraverseListener((TraverseListener) listener);
- return;
- }
- if (DisposeListener.class.equals(clazz)) {
- control. removeDisposeListener((DisposeListener) listener);
- return;
- }
- }
-
- /**
- * Adds the given listener object to the internal book keeping under
- * the given listener type (<code>clazz</code>).
- *
- * @param clazz the listener type
- * @param listener the listener object
- */
- private void addListener(Class clazz, SWTEventListener listener) {
- Control[] children= getChildren();
- for (int i= 0; i < children.length; i++) {
- if (children[i] != null && !children[i].isDisposed())
- addListener(clazz, children[i], listener);
- }
-
- ListenerInfo info= new ListenerInfo();
- info.fClass= clazz;
- info.fListener= listener;
- fCachedListeners.add(info);
- }
-
- /**
- * Removes the given listener object from the internal book keeping under
- * the given listener type (<code>clazz</code>).
- *
- * @param clazz the listener type
- * @param listener the listener object
- */
- private void removeListener(Class clazz, SWTEventListener listener) {
- int length= fCachedListeners.size();
- for (int i= 0; i < length; i++) {
- ListenerInfo info= (ListenerInfo) fCachedListeners.get(i);
- if (listener == info.fListener && clazz.equals(info.fClass)) {
- fCachedListeners.remove(i);
- break;
- }
- }
-
- Control[] children= getChildren();
- for (int i= 0; i < children.length; i++) {
- if (children[i] != null && !children[i].isDisposed())
- removeListener(clazz, children[i], listener);
- }
- }
-
- /**
- * Tells this canvas that a child has been added.
- *
- * @param child the child
- */
- public void childAdded(Control child) {
- if (child != null && !child.isDisposed()) {
- int length= fCachedListeners.size();
- for (int i= 0; i < length; i++) {
- ListenerInfo info= (ListenerInfo) fCachedListeners.get(i);
- addListener(info.fClass, child, info.fListener);
- }
- child.addMouseListener(fMouseListener);
- }
- }
-
- /**
- * Tells this canvas that a child has been removed.
- *
- * @param child the child
- */
- public void childRemoved(Control child) {
- if (child != null && !child.isDisposed()) {
- int length= fCachedListeners.size();
- for (int i= 0; i < length; i++) {
- ListenerInfo info= (ListenerInfo) fCachedListeners.get(i);
- removeListener(info.fClass, child, info.fListener);
- }
- child.removeMouseListener(fMouseListener);
- }
- }
-
- /*
- * @see Control#removeControlListener(ControlListener)
- */
- public void removeControlListener(ControlListener listener) {
- removeListener(ControlListener.class, listener);
- super.removeControlListener(listener);
- }
-
- /*
- * @see Control#removeFocusListener(FocusListener)
- */
- public void removeFocusListener(FocusListener listener) {
- removeListener(FocusListener.class, listener);
- super.removeFocusListener(listener);
- }
-
- /*
- * @see Control#removeHelpListener(HelpListener)
- */
- public void removeHelpListener(HelpListener listener) {
- removeListener(HelpListener.class, listener);
- super.removeHelpListener(listener);
- }
-
- /*
- * @see Control#removeKeyListener(KeyListener)
- */
- public void removeKeyListener(KeyListener listener) {
- removeListener(KeyListener.class, listener);
- super.removeKeyListener(listener);
- }
-
- /*
- * @see Control#removeMouseListener(MouseListener)
- */
- public void removeMouseListener(MouseListener listener) {
- removeListener(MouseListener.class, listener);
- super.removeMouseListener(listener);
- }
-
- /*
- * @see Control#removeMouseMoveListener(MouseMoveListener)
- */
- public void removeMouseMoveListener(MouseMoveListener listener) {
- removeListener(MouseMoveListener.class, listener);
- super.removeMouseMoveListener(listener);
- }
-
- /*
- * @see Control#removeMouseTrackListener(MouseTrackListener)
- */
- public void removeMouseTrackListener(MouseTrackListener listener) {
- removeListener(MouseTrackListener.class, listener);
- super.removeMouseTrackListener(listener);
- }
-
- /*
- * @see Control#removePaintListener(PaintListener)
- */
- public void removePaintListener(PaintListener listener) {
- removeListener(PaintListener.class, listener);
- super.removePaintListener(listener);
- }
-
- /*
- * @see Control#removeTraverseListener(TraverseListener)
- */
- public void removeTraverseListener(TraverseListener listener) {
- removeListener(TraverseListener.class, listener);
- super.removeTraverseListener(listener);
- }
-
- /*
- * @see Widget#removeDisposeListener(DisposeListener)
- */
- public void removeDisposeListener(DisposeListener listener) {
- removeListener(DisposeListener.class, listener);
- super.removeDisposeListener(listener);
- }
-
- /*
- * @seeControl#addControlListener(ControlListener)
- */
- public void addControlListener(ControlListener listener) {
- super.addControlListener(listener);
- addListener(ControlListener.class, listener);
- }
-
- /*
- * @see Control#addFocusListener(FocusListener)
- */
- public void addFocusListener(FocusListener listener) {
- super.addFocusListener(listener);
- addListener(FocusListener.class, listener);
- }
-
- /*
- * @see Control#addHelpListener(HelpListener)
- */
- public void addHelpListener(HelpListener listener) {
- super.addHelpListener(listener);
- addListener(HelpListener.class, listener);
- }
-
- /*
- * @see Control#addKeyListener(KeyListener)
- */
- public void addKeyListener(KeyListener listener) {
- super.addKeyListener(listener);
- addListener(KeyListener.class, listener);
- }
-
- /*
- * @see Control#addMouseListener(MouseListener)
- */
- public void addMouseListener(MouseListener listener) {
- super.addMouseListener(listener);
- addListener(MouseListener.class, listener);
- }
-
- /*
- * @see Control#addMouseMoveListener(MouseMoveListener)
- */
- public void addMouseMoveListener(MouseMoveListener listener) {
- super.addMouseMoveListener(listener);
- addListener(MouseMoveListener.class, listener);
- }
-
- /*
- * @see Control#addMouseTrackListener(MouseTrackListener)
- */
- public void addMouseTrackListener(MouseTrackListener listener) {
- super.addMouseTrackListener(listener);
- addListener(MouseTrackListener.class, listener);
- }
-
- /*
- * @seeControl#addPaintListener(PaintListener)
- */
- public void addPaintListener(PaintListener listener) {
- super.addPaintListener(listener);
- addListener(PaintListener.class, listener);
- }
-
- /*
- * @see Control#addTraverseListener(TraverseListener)
- */
- public void addTraverseListener(TraverseListener listener) {
- super.addTraverseListener(listener);
- addListener(TraverseListener.class, listener);
- }
-
- /*
- * @see Widget#addDisposeListener(DisposeListener)
- */
- public void addDisposeListener(DisposeListener listener) {
- super.addDisposeListener(listener);
- addListener(DisposeListener.class, listener);
- }
- };
-
- /** The ruler's viewer */
- private ITextViewer fTextViewer;
- /** The ruler's canvas to which to add the ruler columns */
- private CompositeRulerCanvas fComposite;
- /** The ruler's annotation model */
- private IAnnotationModel fModel;
- /** The list of decorators */
- private List fDecorators= new ArrayList(2);
- /** The cached location of the last mouse button activity */
- private Point fLocation= new Point(-1, -1);
- /** The cached line of the list mouse button activity */
- private int fLastMouseButtonActivityLine= -1;
- /** The gap between the individual columns of this composite ruler */
- private int fGap;
-
-
- /**
- * Constructs a new composite vertical ruler.
- */
- public CompositeRuler() {
- this(0);
- }
-
- /**
- * Constructs a new composite ruler with the given gap between its columns.
- *
- * @param gap
- */
- public CompositeRuler(int gap) {
- fGap= gap;
- }
-
- /**
- * Inserts the given decorator at the specfied slot to this composite ruler.
- * Decorators are counted from left to right.
- *
- * @param index the index
- * @param rulerColumn the decorator to be inserted
- */
- public void addDecorator(int index, IVerticalRulerColumn rulerColumn) {
- fDecorators.add(index, rulerColumn);
- if (fComposite != null && !fComposite.isDisposed()) {
- rulerColumn.createControl(this, fComposite);
- fComposite.childAdded(rulerColumn.getControl());
- layoutTextViewer();
- }
- }
-
- /**
- * Removes the decorator in the specified slot from this composite ruler.
- *
- * @param index the index
- */
- public void removeDecorator(int index) {
- IVerticalRulerColumn column= (IVerticalRulerColumn) fDecorators.get(index);
- fDecorators.remove(index);
- Control cc= column.getControl();
- if (cc != null && !cc.isDisposed()) {
- fComposite.childRemoved(cc);
- cc.dispose();
- }
- layoutTextViewer();
- }
-
- /**
- * Relayouts the text viewer. This also causes this ruler to get
- * relayouted.
- */
- private void layoutTextViewer() {
-
- Control parent= fTextViewer.getTextWidget();
-
- if (fTextViewer instanceof ITextViewerExtension) {
- ITextViewerExtension extension= (ITextViewerExtension) fTextViewer;
- parent= extension.getControl();
- }
-
- if (parent instanceof Composite && !parent.isDisposed())
- ((Composite) parent).layout(true);
- }
-
- /*
- * @see IVerticalRuler#getControl()
- */
- public Control getControl() {
- return fComposite;
- }
-
- /*
- * @see IVerticalRuler#createControl(Composite, ITextViewer)
- */
- public Control createControl(Composite parent, ITextViewer textViewer) {
-
- fTextViewer= textViewer;
-
- fComposite= new CompositeRulerCanvas(parent, SWT.NONE);
- fComposite.setLayout(new RulerLayout());
-
- Iterator e= fDecorators.iterator();
- while (e.hasNext()) {
- IVerticalRulerColumn column= (IVerticalRulerColumn) e.next();
- column.createControl(this, fComposite);
- fComposite.childAdded(column.getControl());
- }
-
- parent.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- fTextViewer= null;
- fComposite= null;
- fModel= null;
- fDecorators.clear();
- }
- });
-
- return fComposite;
- }
-
- /*
- * @see IVerticalRuler#setModel(IAnnotationModel)
- */
- public void setModel(IAnnotationModel model) {
-
- fModel= model;
-
- Iterator e= fDecorators.iterator();
- while (e.hasNext()) {
- IVerticalRulerColumn column= (IVerticalRulerColumn) e.next();
- column.setModel(model);
- }
- }
-
- /*
- * @see IVerticalRuler#getModel()
- */
- public IAnnotationModel getModel() {
- return fModel;
- }
-
- /*
- * @see IVerticalRuler#update()
- */
- public void update() {
- if (fComposite != null && !fComposite.isDisposed()) {
- Display d= fComposite.getDisplay();
- if (d != null) {
- d.asyncExec(new Runnable() {
- public void run() {
- Iterator e= fDecorators.iterator();
- while (e.hasNext()) {
- IVerticalRulerColumn column= (IVerticalRulerColumn) e.next();
- column.redraw();
- }
- }
- });
- }
- }
- }
-
- /*
- * @see IVerticalRulerExtension#setFont(Font)
- */
- public void setFont(Font font) {
- Iterator e= fDecorators.iterator();
- while (e.hasNext()) {
- IVerticalRulerColumn column= (IVerticalRulerColumn) e.next();
- column.setFont(font);
- }
- }
-
- /*
- * @see IVerticalRulerInfo#getWidth()
- */
- public int getWidth() {
- int width= 0;
- Iterator e= fDecorators.iterator();
- while (e.hasNext()) {
- IVerticalRulerColumn column= (IVerticalRulerColumn) e.next();
- width += (column.getWidth() + fGap);
- }
- return Math.max(0, width - fGap);
- }
-
- /*
- * @see IVerticalRulerInfo#getLineOfLastMouseButtonActivity()
- */
- public int getLineOfLastMouseButtonActivity() {
- if (fLastMouseButtonActivityLine == -1)
- fLastMouseButtonActivityLine= toDocumentLineNumber(fLocation.y);
- return fLastMouseButtonActivityLine;
- }
-
- /*
- * @see IVerticalRulerInfo#toDocumentLineNumber(int)
- */
- public int toDocumentLineNumber(int y_coordinate) {
-
- if (fTextViewer == null || y_coordinate == -1)
- return -1;
-
- StyledText text= fTextViewer.getTextWidget();
- int line= ((y_coordinate + text.getTopPixel()) / text.getLineHeight());
- return widgetLine2ModelLine(fTextViewer, line);
- }
-
- /**
- * Returns the line in the given viewer's document that correspond to the given
- * line of the viewer's widget.
- *
- * @param viewer the viewer
- * @param widgetLine the widget line
- * @return the corresponding line the viewer's document
- * @since 2.1
- */
- protected final static int widgetLine2ModelLine(ITextViewer viewer, int widgetLine) {
-
- if (viewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) viewer;
- return extension.widgetlLine2ModelLine(widgetLine);
- }
-
- try {
- IRegion r= viewer.getVisibleRegion();
- IDocument d= viewer.getDocument();
- return widgetLine += d.getLineOfOffset(r.getOffset());
- } catch (BadLocationException x) {
- }
- return widgetLine;
- }
-
- /**
- * Returns this ruler's text viewer.
- *
- * @return this ruler's text viewer
- */
- public ITextViewer getTextViewer() {
- return fTextViewer;
- }
-
- /*
- * @see IVerticalRulerExtension#setLocationOfLastMouseButtonActivity(int, int)
- */
- public void setLocationOfLastMouseButtonActivity(int x, int y) {
- fLocation.x= x;
- fLocation.y= y;
- fLastMouseButtonActivityLine= -1;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccess.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccess.java
deleted file mode 100644
index a1f8f0c..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccess.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.source;
-
-/**
- * An annotation access provides access to information that is not available via the
- * API of <code>Annotation</code>. Clients usually implement this interface.
- *
- * @see org.eclipse.jface.text.source.Annotation
- * @since 2.1
- */
-public interface IAnnotationAccess {
-
- /**
- * Returns the type of the given annotation.
- *
- * @param annotation the annotation
- * @return the type of the given annotation or <code>null</code> if it has none.
- */
- Object getType(Annotation annotation);
-
- /**
- * Returns whether the given annotation spans multiple lines.
- *
- * @param annotation the annotation
- * @return <code>true</code> if the annotation spans multiple lines,
- * <code>false</code> otherwise
- */
- boolean isMultiLine(Annotation annotation);
-
- /**
- * Returns whether the given annotation is temporary rather than persistent.
- *
- * @param annotation the annotation
- * @return <code>true</code> if the annotation is temporary,
- * <code>false</code> otherwise
- */
- boolean isTemporary(Annotation annotation);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationHover.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationHover.java
deleted file mode 100644
index c2e51af..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationHover.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.source;
-
-
-
-
-/**
- * Provides the information to be displayed in a hover popup window
- * which appears over the presentation area of annotations. Clients
- * may implement this interface.
- */
-public interface IAnnotationHover {
-
- /**
- * Returns the text which should be presented in the a
- * hover popup window. This information is requested based on
- * the specified line number.
- *
- * @param sourceViewer the source viewer this hover is registered with
- * @param lineNumber the line number for which information is requested
- * @return the requested information or <code>null</code> if no such information exists
- */
- String getHoverInfo(ISourceViewer sourceViewer, int lineNumber);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModel.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModel.java
deleted file mode 100644
index bf95bc8..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModel.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.source;
-
-
-
-import java.util.Iterator;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-
-
-/**
- * This interface defines the model for managing annotations attached to a document.
- * The model maintains a set of annotations for a given document and notifies registered annotation
- * model listeners about annotation model changes. It also provides methods
- * for inquerying the current offset and length of an annotation managed
- * by this model.<p>
- * Clients may implement this interface or use the default implementation provided
- * by <code>AnnotationModel</code>.
- *
- * @see Annotation
- * @see IAnnotationModelListener
- */
-public interface IAnnotationModel {
-
- /**
- * Registers the annotation model listener with this annotation model.
- * After registration listener is informed about each change of this model.
- * If the listener is already registered nothing happens.
- *
- * @param listener the listener to be registered, may not be <code>null</code>
- */
- void addAnnotationModelListener(IAnnotationModelListener listener);
-
- /**
- * Removes the listener from the model's list of annotation model listeners.
- * If the listener is not registered with the model nothing happens.
- *
- * @param listener the listener to be removed, may not be <code>null</code>
- */
- void removeAnnotationModelListener(IAnnotationModelListener listener);
-
- /**
- * Connects the annotation model to a document. The annotations managed
- * by this model must subsequently update according to the changes applied
- * to the document. Once an annotation model is connected to a document,
- * all further <code>connect</code> calls must mention the document the
- * model is already connected to. An annotation model primarily uses
- * <code>connect</code> and <code>disconnect</code> for reference counting
- * the document. Reference counting frees the clients from keeping tracker
- * whether a model has already been connected to a document.
- *
- * @param document the document the model gets connected to,
- * may not be <code>null</code>
- *
- * @see #disconnect
- */
- void connect(IDocument document);
-
- /**
- * Disconnects this model from a document. After that, document changes no longer matter.
- * An annotation model may only be disconnected from a document to which it has been
- * connected before. If the model reference counts the connections to a document,
- * the connection to the document may only be terminated if the reference count does
- * down to 0.
- *
- * @param document the document the model gets disconnected from,
- * may not be <code>null</code>
- *
- * @see #connect for further specification details
- */
- void disconnect(IDocument document);
-
- /**
- * Adds a annotation to this annotation model. The annotation is associated with
- * with the given position which desscribes the range covered by the annotation.
- * All registered annotation model listeners are informed about the change.
- * If the model is connected to a document, the position is automatically
- * updated on document changes. If the annotation is already managed by
- * this annotation model nothing happens.
- *
- * @param annotation the annotation to add, may not be <code>null</code>
- * @param position the position describing the range covered by this annotation,
- * may not be <code>null</code>
- */
- void addAnnotation(Annotation annotation, Position position);
-
- /**
- * Removes the given annotation from the model. I.e. the annotation is no
- * longer managed by this model. The position associated with the annotation
- * is no longer updated on document changes. If the annotation is not
- * managed by this model, nothing happens.
- *
- * @param annotation the annotation to be removed from this model,
- * may not be <code>null</code>
- */
- void removeAnnotation(Annotation annotation);
-
- /**
- * Returns all annotations managed by this model.
- *
- * @return all annotations managed by this model
- */
- Iterator getAnnotationIterator();
-
- /**
- * Returns the position associated with the given annotation.
- *
- * @param annotation the annotation whose position should be returned
- * @return the position of the given annotation or <code>null</code> if no
- * associated annotation exists
- */
- Position getPosition(Annotation annotation);
-}
-
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModelListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModelListener.java
deleted file mode 100644
index db9708b..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModelListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.source;
-
-
-
-/**
- * Interface for objects interested in getting informed about
- * annotation model changes. Changes are the addition or removal
- * of annotations managed by the model. Clients may implement
- * this interface.
- *
- * @see IAnnotationModel
- */
-public interface IAnnotationModelListener {
-
- /**
- * Called if a model change occurred on the given model.
- *
- * @param model the changed annotation model
- */
- void modelChanged(IAnnotationModel model);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModelListenerExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModelListenerExtension.java
deleted file mode 100644
index 6e3042f..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationModelListenerExtension.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.source;
-
-/**
- * Extension interface for <code>IAnnotationModelListener</code>. Introduces a
- * notification mechanism that notifies the user by means of <code>AnnotationModelEvent</code>s.
- * Thus, more detailed information can be sent to the listener. Will replace the original notification
- * mechanism of <code>IAnnotationModelListener</code>.
- *
- * @since 2.0
- */
-public interface IAnnotationModelListenerExtension {
-
- /**
- * Called if a model change occurred on the given model.
- *
- * @param event the event to be sent out
- */
- void modelChanged(AnnotationModelEvent event);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcher.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcher.java
deleted file mode 100644
index e626951..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcher.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.source;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-
-/**
- * A character pair matcher finds to a character at a certain document offset the matching peer character.
- * It is the matchers responsibility to define the concepts of "matching" and "peer". The matching process
- * starts at a given offset. Starting of this offset, the matcher chooses a character close to this offset. The
- * anchor defines whether the chosen character is left or right of the initial offset. The matcher then searches
- * for the matching peer character of the chosen character and if it finds one, delivers the minimal region of
- * the document that contains both characters.
- *
- * @since 2.1
- */
-public interface ICharacterPairMatcher {
-
- /**
- * Indicates the anchor value "right".
- */
- int RIGHT= 0;
- /**
- * Indicates the anchor value "left".
- */
- int LEFT= 1;
-
-
- /**
- * Disposes this pair matcher.
- */
- void dispose();
-
- /**
- * Clears this pair matcher. I.e. the matcher throws away all state it might
- * remember and prepares itself for a new call of the <code>match</code>
- * method.
- */
- void clear();
-
- /**
- * Starting at the given offset, the matcher chooses a character close to this offset.
- * The matcher then searches for the matching peer character of the chosen character
- * and if it finds one, returns the minimal region of the document that contains both characters.
- * It returns <code>null</code> if there is no peer character.
- *
- * @param iDocument the document to work on
- * @param i the start offset
- * @return the minimal region containg the peer characters
- */
- IRegion match(IDocument iDocument, int i);
-
- /**
- * Returns the anchor for the region of the matching peer characters. The anchor
- * says whether the character that has been chosen to search for its peer character
- * has been left or right of the initial offset.
- *
- * @return <code>RIGHT</code> or <code>LEFT</code>
- */
- int getAnchor();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IOverviewRuler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IOverviewRuler.java
deleted file mode 100644
index f19c752..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IOverviewRuler.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.source;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * This interface defines a visual component which may serve
- * text viewers as an overview annotation presentation area. This means,
- * presentation of annotations is independent from the actual viewport of
- * the text viewer. The annotations of the viewer's whole document are
- * visible in the overview ruler.
- *
- * This interfaces comprises three contracts:
- * <ul>
- * <li> The overview ruler retrieves the annotations it presents from an annotation model.
- * <li> The ruler is a visual component which must be integrated in a hierarchy of SWT controls.
- * <li> The ruler provides interested clients with mapping and
- * interaction information. This covers the mapping between
- * coordinates of the ruler's control and line numbers based
- * on the connected text viewer's document (<code>IVerticalRulerInfo</code>).
- * </ul>
- * Clients may implement this interface or use the default implementation provided
- * by <code>OverviewlRuler</code>.
- *
- * @see org.eclipse.jface.text.ITextViewer
- * @since 2.1
- */
-public interface IOverviewRuler extends IVerticalRuler {
-
- /**
- * Returns whether there is an annotation an the given y coordinate. This
- * method takes the compression factor of the overview ruler into account.
- *
- * @param y the y-coordinate
- * @return <code>true</code> if there is an annotation, <code>false</code> otherwise
- */
- boolean hasAnnotation(int y);
-
- /**
- * Returns the height of the visual presentation of an annotation in this
- * overview ruler. Assumes that all annotations are represented using the
- * same height.
- *
- * @return int the visual height of an annotation
- */
- int getAnnotationHeight();
-
- /**
- * Sets the color for the given annotation type in this overview ruler.
- *
- * @param annotationType the annotation type
- * @param color the color
- */
- void setAnnotationTypeColor(Object annotationType, Color color);
-
- /**
- * Sets the drawing layer for the given annotation type in this overview ruler.
- *
- * @param annotationType the annotation type
- * @param layer the drawing layer
- */
- void setAnnotationTypeLayer(Object annotationType, int layer);
-
- /**
- * Adds the given annotation type to this overview ruler. Starting with this
- * call, annotations of the given type are shown in the overview ruler.
- *
- * @param annotationType the annotation type
- */
- void addAnnotationType(Object annotationType);
-
- /**
- * Removes the given annotation type from this overview ruler. Annotations
- * of the given type are no longer shown in the overview ruler.
- *
- * @param annotationType the annotation type
- */
- void removeAnnotationType(Object annotationType);
-
- /**
- * Adds the given annotation type to the header of this ruler. Starting with
- * this call, the presence of annotations is tracked and the header is drawn
- * in the configured color.
- *
- * @param annotationType the annotation type to be tracked
- */
- void addHeaderAnnotationType(Object annotationType);
-
- /**
- * Removes the given annotation type from the header of this ruler. The
- * presence of annotations of the given type is no longer tracked and the
- * header is drawn in the default color, depending on the other configured
- * configured annotation types.
- *
- * @param annotationType the annotation type to be removed
- */
- void removeHeaderAnnotationType(Object annotationType);
-
- /**
- * Returns this rulers header control. This is the little area between the
- * top of the text widget and the top of this overview ruler.
- *
- * @return the header control of this overview ruler.
- */
- Control getHeaderControl();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISharedTextColors.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISharedTextColors.java
deleted file mode 100644
index 4f1cf98..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISharedTextColors.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.source;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-
-
-/**
- * Manages SWT color objects. Until the <code>dispose</code> method is called,
- * the same color object is returned for equal <code>RGB</code> values.
- * <p> This interface may be implemented by clients. </p>
- *
- * @since 2.1
- */
-public interface ISharedTextColors {
-
- /**
- * Returns the color object for the value represented by the given
- * <code>RGB</code> object.
- *
- * @param rgb the rgb color specification
- * @return the color object for the given rgb value
- */
- Color getColor(RGB rgb);
-
- /**
- * Tells this object to dispose all its managed colors.
- */
- void dispose();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java
deleted file mode 100644
index 0fc6338..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.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.jface.text.source;
-
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextViewer;
-
-
-/**
- * In addition to the text viewer functionality a source viewer supports:
- * <ul>
- * <li> visual annotations based on an annotation model
- * <li> visual range indication
- * <li> management of text viewer add-ons
- * <li> explicit configuration
- * </ul>
- * It is assumed that range indication and visual annotations are shown
- * inside the same presentation area. There are no assumptions about
- * whether this area is different from the viewer's text widget.<p>
- * As the visibility of visual annotations can dynamically be changed,
- * it is assumed that the annotation presentation area can dynamically
- * be hidden if it is different from the text widget.<p>
- * Clients may implement this interface or use the default implementation provided
- * by <code>SourceViewer</code>.
- */
-public interface ISourceViewer extends ITextViewer {
-
- /**
- * Text operation code for requesting content assist to show completetion
- * proposals for the current insert position.
- */
- static final int CONTENTASSIST_PROPOSALS= ITextOperationTarget.STRIP_PREFIX + 1;
-
- /**
- * Text operation code for requesting content assist to show
- * the content information for the current insert position.
- */
- static final int CONTENTASSIST_CONTEXT_INFORMATION= ITextOperationTarget.STRIP_PREFIX + 2;
-
- /**
- * Text operation code for formatting the selected text or complete document
- * of this viewer if the selection is empty.
- */
- static final int FORMAT= ITextOperationTarget.STRIP_PREFIX + 3;
-
- /**
- * Text operation code for requesting information at the current insertion position.
- * @since 2.0
- */
- static final int INFORMATION= ITextOperationTarget.STRIP_PREFIX + 4;
-
- /**
- * Configures the source viewer using the given configuration.
- *
- * @param configuration the source viewer configuration to be used
- */
- void configure(SourceViewerConfiguration configuration);
-
- /**
- * Sets the annotation hover of this source viewer. The annotation hover
- * provides the information to be displayed in a hover popup window
- * if requested over the annotation presentation area. The annotation
- * hover is assumed to be line oriented.
- *
- * @param annotationHover the hover to be used, <code>null</code> is a valid argument
- */
- void setAnnotationHover(IAnnotationHover annotationHover);
-
- /**
- * Sets the given document as this viewer's text model and the
- * given annotation model as the model for this viewer's visual
- * annotations. The presentation is accordingly updated. An approriate
- * <code>TextEvent</code> is issued. This text event does not carry
- * a related document event.
- *
- * @param document the viewer's new input document
- * @param annotationModel the model for the viewer's visual annotations
- *
- * @see ITextViewer#setDocument(IDocument)
- */
- void setDocument(IDocument document, IAnnotationModel annotationModel);
-
- /**
- * Sets the given document as this viewer's text model and the
- * given annotation model as the model for this viewer's visual
- * annotations. The presentation is accordingly updated whereby
- * only the specified region is made visible. An approriate
- * <code>TextEvent</code> is issued. The text event does not carry a
- * related document event. This method is a convenience method for
- * <code>setDocument(document, annotationModel);setVisibleRegion(offset, length)</code>.
- *
- * @param document the new input document
- * @param annotationModel the model of the viewer's visual annotations
- * @param visibleRegionOffset the offset of the visible region
- * @param visibleRegionLength the length of the visible region
- *
- * @see ITextViewer#setDocument(IDocument, int, int)
- */
- void setDocument(IDocument document, IAnnotationModel annotationModel, int visibleRegionOffset, int visibleRegionLength);
-
- /**
- * Returns this viewer's annotation model.
- *
- * @return this viewer's annotation model
- */
- IAnnotationModel getAnnotationModel();
-
- /**
- * Sets the annotation used by this viewer as range indicator. The
- * range covered by this annotation is referred to as range indication.
- *
- * @param rangeIndicator the annotation to be used as this viewer's range indicator
- */
- void setRangeIndicator(Annotation rangeIndicator);
-
- /**
- * Sets the viewers's range indication to the specified range. Its is indicated
- * whether the cursor should also be moved to the beginning of the specified range.
- *
- * @param offset the offset of the range
- * @param length the length of the range
- * @param moveCursor indicates whether the cursor should be moved to the given offset
- */
- void setRangeIndication(int offset, int length, boolean moveCursor);
-
- /**
- * Returns the viewer's range indication.
- *
- * @return the viewer's range indication.
- */
- IRegion getRangeIndication();
-
- /**
- * Removes the viewer's range indication. There is no visible range indication
- * after this method completed.
- *
- * @return the viewer's range indication
- */
- void removeRangeIndication();
-
- /**
- * Controls the visibility of annotations and in the case of separate
- * presentation areas of text and annotations, the visibility of the
- * annotation's presentation area.<p>
- * By default, annotations and their presentation area are visible.
- *
- * @param show indicates the visibility of annotations
- */
- void showAnnotations(boolean show);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension.java
deleted file mode 100644
index 008399a..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.source;
-
-/**
- * Extension interface for <code>ISourceViewer</code>.
- * Extends the source viewer with the concept of an annotation overview.
- * The annotation overview differs from the annotation presentation in that it is
- * independent from the viewer's viewport, i.e. the annotations of the
- * whole document are visible. There are no assumptions about
- * the area in which the annotation overview is shown.<p>
- * As the visibility of annotation overview can dynamically be changed,
- * it is assumed that the presentation area can dynamically
- * be hidden if it is different from the text widget.<p>
- * Clients may implement this interface or use the default implementation provided
- * by <code>SourceViewer</code>.
- *
- * @since 2.1
- */
-public interface ISourceViewerExtension {
-
- /**
- * Shows/hides an overview representation of the annotations of the whole document of this viewer.
- *
- * @param show <code>true</code> if annotation overview should be visible, <code>false</code> otherwise
- */
- void showAnnotationsOverview(boolean show);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRuler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRuler.java
deleted file mode 100644
index 5e7c9b9..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRuler.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.jface.text.source;
-
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-import org.eclipse.jface.text.ITextViewer;
-
-
-/**
- * This interface defines a visual component which may serve text viewers as an annotation presentation
- * area. Implementers of this interface have to define the presentation modus. This can either depend
- * on the connected viewer's view port or not. If the modus is view port dependent the ruler only shows
- * those annotations that are attached to document regions that are visible in the view port. If independent,
- * the presented annotations can also be attached to invisible document regions.
- *
- * This interfaces comprises three contracts:
- * <ul>
- * <li> The vertical ruler retrieves the annotations it presents from an annotation model.
- * <li> The ruler is a visual component which must be integrated in a hierarchy of SWT controls.
- * <li> The ruler provides interested clients with mapping and
- * interaction information. This covers the mapping between
- * coordinates of the ruler's control and line numbers based
- * on the connected text viewer's document (<code>IVerticalRulerInfo</code>).
- * </ul>
- * Clients may implement this interface or use the default implementation provided
- * by <code>CompositeRuler</code> and <code>VerticalRuler</code>.
- *
- * @see ITextViewer
- * @see IVerticalRulerInfo
- */
-public interface IVerticalRuler extends IVerticalRulerInfo {
-
- /**
- * Associates an annotation model with this ruler.
- * A value <code>null</code> is acceptable and clears the ruler.
- *
- * @param model the new annotation model, may be <code>null</code>
- */
- void setModel(IAnnotationModel model);
-
- /**
- * Returns the current annotation model of this ruler or <code>null</code>
- * if the ruler has no model.
- *
- * @return this ruler's annotation model or <code>null</code> if there is no model
- */
- IAnnotationModel getModel();
-
- /**
- * Forces the vertical ruler to synchronize itself with its
- * annotation model and its viewer's viewport.
- */
- void update();
-
- /**
- * Creates the ruler's SWT control.
- *
- * @param parent the parent control of the ruler's control
- * @param textViewer the text viewer to which this ruler belongs
- * @return the ruler's SWT control
- */
- Control createControl(Composite parent, ITextViewer textViewer);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerColumn.java
deleted file mode 100644
index 2c442e6..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerColumn.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.source;
-
-
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * A <code>IVerticalRulerColumn</code> is an element that can be added
- * to a composite vertical ruler. A composite vertical ruler is a vertical ruler
- * with a dynamically changing appearance and behavior depending on its
- * actual arrangement of ruler columns. A vertical ruler column supports a
- * subset of the contract of a vertical ruler.
- *
- * @see org.eclipse.jface.text.source.CompositeRuler
- * @since 2.0
- */
-public interface IVerticalRulerColumn {
-
- /**
- * Associates an annotation model with this ruler column.
- * A value <code>null</code> is acceptable and clears the ruler.
- *
- * @param model the new annotation model, may be <code>null</code>
- */
- void setModel(IAnnotationModel model);
-
- /**
- * Redraws this column.
- */
- void redraw();
-
- /**
- * Creates the column's SWT control.
- *
- * @param parentRuler the parent ruler of this column
- * @param parentControl the control of the parent ruler
- * @return the column's SWT control
- */
- Control createControl(CompositeRuler parentRuler, Composite parentControl);
-
- /**
- * Returns the column's SWT control.
- *
- * @return the column's SWT control
- */
- Control getControl();
-
- /**
- * Returns the width of this column's control.
- *
- * @return the width of this column's control
- */
- int getWidth();
-
- /**
- * Sets the font of this ruler column.
- *
- * @param font the new font of the ruler column
- */
- void setFont(Font font);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerExtension.java
deleted file mode 100644
index 7e0f3bf..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerExtension.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.source;
-
-
-import org.eclipse.swt.graphics.Font;
-
-
-/**
- * Extension interface for <code>IVerticalRuler</code>. Allows to set the font of the
- * vertical ruler and to set the location of the last mouse button activity.
- *
- * @since 2.0
- */
-public interface IVerticalRulerExtension {
-
- /**
- * Sets the font of this vertical ruler.
- *
- * @param font the new font of the vertical ruler
- */
- void setFont(Font font);
-
- /**
- * Sets the location of the last mouse button activity. This method is used for
- * example by external mouse listeners.
- *
- * @param x the x-coordinate
- * @param y the y-coordinate
- */
- void setLocationOfLastMouseButtonActivity(int x, int y);
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerInfo.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerInfo.java
deleted file mode 100644
index 0b686eb..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerInfo.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.source;
-
-
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * A vertical ruler is a visual component which may serve
- * text viewers as an annotation presentation
- * area. The vertical ruler info provides interested clients with the
- * mapping and interaction aspect of the vertical ruler. This
- * covers the mapping between coordinates of the ruler's
- * control and line numbers based on the connected text viewer's
- * document.
- *
- * @since 2.0
- */
-public interface IVerticalRulerInfo {
-
- /**
- * Returns the ruler's SWT control.
- *
- * @return the ruler's SWT control
- */
- Control getControl();
-
- /**
- * Returns the line number of the last mouse button activity.
- * Based on the input document of the connected text viewer.
- *
- * @return the line number of the last mouse button activity
- */
- int getLineOfLastMouseButtonActivity();
-
- /**
- * Translates a y-coordinate of the ruler's SWT control into
- * the according line number of the document of the connected text viewer.
- *
- * @param y_coordinate a y-coordinate of the ruler's SWT control
- * @return the line number of that coordinate or <code>-1</code> if that
- * coordinate does not correspond to a valid document line
- */
- int toDocumentLineNumber(int y_coordinate);
-
- /**
- * Returns the width of this ruler's control.
- *
- * @return the width of this ruler's control
- */
- int getWidth();
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/JFaceTextMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/JFaceTextMessages.java
deleted file mode 100644
index ec4945e..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/JFaceTextMessages.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.source;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Accessor for the <code>JFaceTextMessages.properties</code> file in
- * package <code>org.eclipse.jface.text</code>.
- * @since 2.0
- */
-class JFaceTextMessages {
-
- /** The resource bundle name. */
- private static final String RESOURCE_BUNDLE= "org.eclipse.jface.text.JFaceTextMessages";//$NON-NLS-1$
-
- /** The resource bundle. */
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- /**
- * Prohibits the creation of accessor objects.
- */
- private JFaceTextMessages() {
- }
-
- /**
- * Returns the string found in the resource bundle under the given key or a place holder string.
- *
- * @param key the look up key
- * @return the value found under the given key
- */
- 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.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java
deleted file mode 100644
index b6c82d0..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java
+++ /dev/null
@@ -1,742 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.source;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-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.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-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.ITextViewerExtension;
-import org.eclipse.jface.text.ITextViewerExtension3;
-import org.eclipse.jface.text.IViewportListener;
-import org.eclipse.jface.text.TextEvent;
-
-
-/**
- * A vertical ruler column displaying line numbers.
- * Clients usually instantiate and configure object of this class.
- *
- * @since 2.0
- */
-public final class LineNumberRulerColumn implements IVerticalRulerColumn {
-
- /**
- * Internal listener class.
- */
- class InternalListener implements IViewportListener, ITextListener {
-
- /*
- * @see IViewportListener#viewportChanged(int)
- */
- public void viewportChanged(int verticalPosition) {
- if (verticalPosition != fScrollPos)
- redraw();
- }
-
- /*
- * @see ITextListener#textChanged(TextEvent)
- */
- public void textChanged(TextEvent event) {
-
- if (computeNumberOfDigits()) {
- computeIndentations();
- layout(event.getViewerRedrawState());
- return;
- }
-
- if (!event.getViewerRedrawState())
- return;
-
- if (fSensitiveToTextChanges || event.getDocumentEvent() == null) {
- if (fCanvas != null && !fCanvas.isDisposed()) {
- Display d= fCanvas.getDisplay();
- if (d != null) {
- d.asyncExec(new Runnable() {
- public void run() {
- redraw();
- }
- });
- }
- }
- }
- }
- };
-
- /**
- * Handles all the mouse interaction in this line number ruler column.
- */
- class MouseHandler implements MouseListener, MouseMoveListener, MouseTrackListener {
-
- /** The cached view port size */
- private int fCachedViewportSize;
- /** The area of the line at which line selection started */
- private IRegion fStartLine;
- /** The number of the line at which line selection started */
- private int fStartLineNumber;
- /** The auto scroll direction */
- private int fAutoScrollDirection;
-
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseUp(MouseEvent event) {
- stopSelecting();
- stopAutoScroll();
- }
-
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDown(MouseEvent event) {
- fParentRuler.setLocationOfLastMouseButtonActivity(event.x, event.y);
- startSelecting();
- }
-
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent event) {
- fParentRuler.setLocationOfLastMouseButtonActivity(event.x, event.y);
- stopSelecting();
- stopAutoScroll();
- }
-
- /*
- * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseMove(MouseEvent event) {
- if (!autoScroll(event)) {
- int newLine= fParentRuler.toDocumentLineNumber(event.y);
- expandSelection(newLine);
- }
- }
-
- /*
- * @see org.eclipse.swt.events.MouseTrackListener#mouseEnter(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseEnter(MouseEvent event) {
- }
-
- /*
- * @see org.eclipse.swt.events.MouseTrackListener#mouseExit(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseExit(MouseEvent event) {
- }
-
- /*
- * @see org.eclipse.swt.events.MouseTrackListener#mouseHover(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseHover(MouseEvent event) {
- }
-
- /**
- * Called when line drag selection started. Adds mouse move and track
- * listeners to this column's control.
- */
- private void startSelecting() {
- try {
-
- // select line
- IDocument document= fCachedTextViewer.getDocument();
- fStartLineNumber= fParentRuler.getLineOfLastMouseButtonActivity();
- fStartLine= document.getLineInformation(fStartLineNumber);
- fCachedTextViewer.setSelectedRange(fStartLine.getOffset(), fStartLine.getLength());
- fCachedViewportSize= getVisibleLinesInViewport();
-
- // prepare for drag selection
- fCanvas.addMouseMoveListener(this);
- fCanvas.addMouseTrackListener(this);
-
- } catch (BadLocationException x) {
- }
- }
-
- /**
- * Called when line drag selection stopped. Removes all previously
- * installed listeners from this column's control.
- */
- private void stopSelecting() {
- // drag selection stopped
- fCanvas.removeMouseMoveListener(this);
- fCanvas.removeMouseTrackListener(this);
- }
-
- /**
- * Expands the line selection from the remembered start line to the
- * given line.
- *
- * @param lineNumber the line to which to expand the selection
- */
- private void expandSelection(int lineNumber) {
- try {
-
- IDocument document= fCachedTextViewer.getDocument();
- IRegion lineInfo= document.getLineInformation(lineNumber);
-
- int start= Math.min(fStartLine.getOffset(), lineInfo.getOffset());
- int end= Math.max(fStartLine.getOffset() + fStartLine.getLength(), lineInfo.getOffset() + lineInfo.getLength());
-
- if (lineNumber < fStartLineNumber)
- fCachedTextViewer.setSelectedRange(end, start - end);
- else
- fCachedTextViewer.setSelectedRange(start, end - start);
-
- } catch (BadLocationException x) {
- }
- }
-
- /**
- * Called when auto scrolling stopped. Clears the auto scroll direction.
- */
- private void stopAutoScroll() {
- fAutoScrollDirection= SWT.NULL;
- }
-
- /**
- * Called on drag selection.
- *
- * @param event the mouse event caught by the mouse move listener
- * @return <code>true</code> if scrolling happend, <code>false</code> otherwise
- */
- private boolean autoScroll(MouseEvent event) {
- Rectangle area= fCanvas.getClientArea();
-
- if (event.y > area.height) {
- autoScroll(SWT.DOWN);
- return true;
- }
-
- if (event.y < 0) {
- autoScroll(SWT.UP);
- return true;
- }
-
- stopAutoScroll();
- return false;
- }
-
- /**
- * Scrolls the viewer into the given direction.
- *
- * @param direction the scroll direction
- */
- private void autoScroll(int direction) {
-
- if (fAutoScrollDirection == direction)
- return;
-
- final int TIMER_INTERVAL= 5;
- final Display display = fCanvas.getDisplay();
- Runnable timer= null;
- switch (direction) {
- case SWT.UP:
- timer= new Runnable() {
- public void run() {
- if (fAutoScrollDirection == SWT.UP) {
- int top= getInclusiveTopIndex();
- if (top > 0) {
- fCachedTextViewer.setTopIndex(top -1);
- expandSelection(top -1);
- display.timerExec(TIMER_INTERVAL, this);
- }
- }
- }
- };
- break;
- case SWT.DOWN:
- timer = new Runnable() {
- public void run() {
- if (fAutoScrollDirection == SWT.DOWN) {
- int top= getInclusiveTopIndex();
- fCachedTextViewer.setTopIndex(top +1);
- expandSelection(top +1 + fCachedViewportSize);
- display.timerExec(TIMER_INTERVAL, this);
- }
- }
- };
- break;
- }
-
- if (timer != null) {
- fAutoScrollDirection= direction;
- display.timerExec(TIMER_INTERVAL, timer);
- }
- }
-
- /**
- * Returns the viewer's first visible line, even if only partially visible.
- *
- * @return the viewer's first visible line
- */
- private int getInclusiveTopIndex() {
- if (fCachedTextWidget != null && !fCachedTextWidget.isDisposed()) {
- int top= fCachedTextViewer.getTopIndex();
- if ((fCachedTextWidget.getTopPixel() % fCachedTextWidget.getLineHeight()) != 0)
- -- top;
- return top;
- }
- return -1;
- }
- };
-
- /** This column's parent ruler */
- private CompositeRuler fParentRuler;
- /** Cached text viewer */
- private ITextViewer fCachedTextViewer;
- /** Cached text widget */
- private StyledText fCachedTextWidget;
- /** The columns canvas */
- private Canvas fCanvas;
- /** Cache for the actual scroll position in pixels */
- private int fScrollPos;
- /** The drawable for double buffering */
- private Image fBuffer;
- /** The internal listener */
- private InternalListener fInternalListener= new InternalListener();
- /** The font of this column */
- private Font fFont;
- /** The indentation cache */
- private int[] fIndentation;
- /** Indicates whether this column reacts on text change events */
- private boolean fSensitiveToTextChanges= false;
- /** The foreground color */
- private Color fForeground;
- /** The background color */
- private Color fBackground;
- /** Cached number of displayed digits */
- private int fCachedNumberOfDigits= -1;
- /** Flag indicating whether a relayout is required */
- private boolean fRelayoutRequired= false;
-
-
- /**
- * Constructs a new vertical ruler column.
- */
- public LineNumberRulerColumn() {
- }
-
- /**
- * Sets the foreground color of this column.
- *
- * @param foreground the foreground color
- */
- public void setForeground(Color foreground) {
- fForeground= foreground;
- }
-
- /**
- * Sets the background color of this column.
- *
- * @param background the background color
- */
- public void setBackground(Color background) {
- fBackground= background;
- if (fCanvas != null && !fCanvas.isDisposed())
- fCanvas.setBackground(getBackground(fCanvas.getDisplay()));
- }
-
- /**
- * Returns the System background color for list widgets.
- *
- * @param display the display
- * @return the System background color for list widgets
- */
- protected Color getBackground(Display display) {
- if (fBackground == null)
- return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
- return fBackground;
- }
-
- /*
- * @see IVerticalRulerColumn#getControl()
- */
- public Control getControl() {
- return fCanvas;
- }
-
- /*
- * @see IVerticalRuleColumnr#getWidth
- */
- public int getWidth() {
- return fIndentation[0];
- }
-
- /**
- * Computes the number of digits to be displayed. Returns
- * <code>true</code> if the number of digits changed compared
- * to the previous call of this method. If the method is called
- * for the first time, the return value is also <code>true</code>.
- *
- * @return whether the number of digits has been changed
- */
- protected boolean computeNumberOfDigits() {
-
- IDocument document= fCachedTextViewer.getDocument();
- int lines= document == null ? 0 : document.getNumberOfLines();
-
- int digits= 2;
- while (lines > Math.pow(10, digits) -1) {
- ++digits;
- }
-
- if (fCachedNumberOfDigits != digits) {
- fCachedNumberOfDigits= digits;
- return true;
- }
-
- return false;
- }
-
- /**
- * Layouts the enclosing viewer to adapt the layout to changes of the
- * size of the individual components.
- *
- * @param redraw <code>true</code> if this column can be redrawn
- */
- protected void layout(boolean redraw) {
- if (!redraw) {
- fRelayoutRequired= true;
- return;
- }
-
- fRelayoutRequired= false;
- if (fCachedTextViewer instanceof ITextViewerExtension) {
- ITextViewerExtension extension= (ITextViewerExtension) fCachedTextViewer;
- Control control= extension.getControl();
- if (control instanceof Composite && !control.isDisposed()) {
- Composite composite= (Composite) control;
- composite.layout(true);
- }
- }
- }
-
- /**
- * Computes the indentations for the given font and stores them in
- * <code>fIndentation</code>.
- */
- protected void computeIndentations() {
- GC gc= new GC(fCanvas);
- try {
-
- gc.setFont(fCanvas.getFont());
-
- fIndentation= new int[fCachedNumberOfDigits + 1];
-
- Float number= new Float(Math.pow(10, fCachedNumberOfDigits) - 1);
- Point p= gc.stringExtent(Integer.toString(number.intValue()));
- fIndentation[0]= p.x;
-
- for (int i= 1; i <= fCachedNumberOfDigits; i++) {
- number= new Float(Math.pow(10, i) - 1);
- p= gc.stringExtent(Integer.toString(number.intValue()));
- fIndentation[i]= fIndentation[0] - p.x;
- }
-
- } finally {
- gc.dispose();
- }
- }
-
- /*
- * @see IVerticalRulerColumn#createControl(CompositeRuler, Composite)
- */
- public Control createControl(CompositeRuler parentRuler, Composite parentControl) {
-
- fParentRuler= parentRuler;
- fCachedTextViewer= parentRuler.getTextViewer();
- fCachedTextWidget= fCachedTextViewer.getTextWidget();
-
- fCanvas= new Canvas(parentControl, SWT.NONE);
- fCanvas.setBackground(getBackground(fCanvas.getDisplay()));
- fCanvas.setForeground(fForeground);
-
- fCanvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- if (fCachedTextViewer != null)
- doubleBufferPaint(event.gc);
- }
- });
-
- fCanvas.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- handleDispose();
- fCachedTextViewer= null;
- fCachedTextWidget= null;
- }
- });
-
- fCanvas.addMouseListener(new MouseHandler());
-
- if (fCachedTextViewer != null) {
-
- fCachedTextViewer.addViewportListener(fInternalListener);
- fCachedTextViewer.addTextListener(fInternalListener);
-
- if (fFont == null) {
- if (fCachedTextWidget != null && !fCachedTextWidget.isDisposed())
- fFont= fCachedTextWidget.getFont();
- }
- }
-
- if (fFont != null)
- fCanvas.setFont(fFont);
-
- computeNumberOfDigits();
- computeIndentations();
- return fCanvas;
- }
-
- /**
- * Disposes the column's resources.
- */
- private void handleDispose() {
-
- if (fCachedTextViewer != null) {
- fCachedTextViewer.removeViewportListener(fInternalListener);
- fCachedTextViewer.removeTextListener(fInternalListener);
- }
-
- if (fBuffer != null) {
- fBuffer.dispose();
- fBuffer= null;
- }
- }
-
- /**
- * Double buffer drawing.
- *
- * @param dest the gc to draw into
- */
- private void doubleBufferPaint(GC dest) {
-
- Point size= fCanvas.getSize();
-
- if (size.x <= 0 || size.y <= 0)
- return;
-
- if (fBuffer != null) {
- Rectangle r= fBuffer.getBounds();
- if (r.width != size.x || r.height != size.y) {
- fBuffer.dispose();
- fBuffer= null;
- }
- }
- if (fBuffer == null)
- fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
-
- GC gc= new GC(fBuffer);
- gc.setFont(fCanvas.getFont());
- if (fForeground != null)
- gc.setForeground(fForeground);
-
- try {
- gc.setBackground(getBackground(fCanvas.getDisplay()));
- gc.fillRectangle(0, 0, size.x, size.y);
-
- if (fCachedTextViewer instanceof ITextViewerExtension3)
- doPaint1(gc);
- else
- doPaint(gc);
-
- } finally {
- gc.dispose();
- }
-
- dest.drawImage(fBuffer, 0, 0);
- }
-
- /**
- * Returns the viewport height in lines.
- *
- * @return the viewport height in lines
- */
- protected int getVisibleLinesInViewport() {
- Rectangle clArea= fCachedTextWidget.getClientArea();
- if (!clArea.isEmpty())
- return clArea.height / fCachedTextWidget.getLineHeight();
- return -1;
- }
-
- /**
- * Draws the ruler column.
- *
- * @param gc the gc to draw into
- */
- private void doPaint(GC gc) {
-
- if (fCachedTextViewer == null)
- return;
-
-
- int firstLine= 0;
-
- int topLine= fCachedTextViewer.getTopIndex() -1;
- int bottomLine= fCachedTextViewer.getBottomIndex() + 1;
-
- try {
-
- IRegion region= fCachedTextViewer.getVisibleRegion();
- IDocument doc= fCachedTextViewer.getDocument();
-
- firstLine= doc.getLineOfOffset(region.getOffset());
- if (firstLine > topLine)
- topLine= firstLine;
-
- int lastLine= doc.getLineOfOffset(region.getOffset() + region.getLength());
- if (lastLine < bottomLine)
- bottomLine= lastLine;
-
- } catch (BadLocationException x) {
- return;
- }
-
- fSensitiveToTextChanges= bottomLine - topLine < getVisibleLinesInViewport();
-
- int lineheight= fCachedTextWidget.getLineHeight();
- fScrollPos= fCachedTextWidget.getTopPixel();
- int canvasheight= fCanvas.getSize().y;
-
- int y= ((topLine - firstLine) * lineheight) - fScrollPos + fCachedTextViewer.getTopInset();
- for (int line= topLine; line <= bottomLine; line++, y+= lineheight) {
-
- if (y >= canvasheight)
- break;
-
- String s= Integer.toString(line + 1);
- int indentation= fIndentation[s.length()];
- gc.drawString(s, indentation, y);
- }
- }
-
- /**
- * Draws the ruler column. Uses <code>ITextViewerExtension3</code> for the
- * implementation. Will replace <code>doPinat(GC)</code>.
- *
- * @param gc the gc to draw into
- */
- private void doPaint1(GC gc) {
-
- if (fCachedTextViewer == null)
- return;
-
- ITextViewerExtension3 extension= (ITextViewerExtension3) fCachedTextViewer;
-
- int firstLine= 0;
-
-
- int widgetTopLine= fCachedTextWidget.getTopIndex();
- if (widgetTopLine > 0)
- -- widgetTopLine;
-
- int topLine= extension.widgetlLine2ModelLine(widgetTopLine);
- int bottomLine= fCachedTextViewer.getBottomIndex();
- if (bottomLine >= 0)
- ++ bottomLine;
-
- try {
-
- IRegion region= extension.getModelCoverage();
- IDocument doc= fCachedTextViewer.getDocument();
-
- firstLine= doc.getLineOfOffset(region.getOffset());
- if (firstLine > topLine || topLine == -1)
- topLine= firstLine;
-
- int lastLine= doc.getLineOfOffset(region.getOffset() + region.getLength());
- if (lastLine < bottomLine || bottomLine == -1)
- bottomLine= lastLine;
-
- } catch (BadLocationException x) {
- return;
- }
-
- fSensitiveToTextChanges= bottomLine - topLine < getVisibleLinesInViewport();
-
- int lineheight= fCachedTextWidget.getLineHeight();
- fScrollPos= fCachedTextWidget.getTopPixel();
- int canvasheight= fCanvas.getSize().y;
-
- int y= (widgetTopLine * lineheight) - fScrollPos + fCachedTextViewer.getTopInset();
- for (int modelLine= topLine; modelLine <= bottomLine; modelLine++) {
-
- if (y >= canvasheight)
- break;
-
- int widgetLine= extension.modelLine2WidgetLine(modelLine);
- if (widgetLine == -1)
- continue;
-
- String s= Integer.toString(modelLine + 1);
- int indentation= fIndentation[s.length()];
- gc.drawString(s, indentation, y);
- y+= lineheight;
- }
- }
-
- /*
- * @see IVerticalRulerColumn#redraw()
- */
- public void redraw() {
-
- if (fRelayoutRequired) {
- layout(true);
- return;
- }
-
- if (fCanvas != null && !fCanvas.isDisposed()) {
- GC gc= new GC(fCanvas);
- doubleBufferPaint(gc);
- gc.dispose();
- }
- }
-
- /*
- * @see IVerticalRulerColumn#setModel(IAnnotationModel)
- */
- public void setModel(IAnnotationModel model) {
- }
-
- /*
- * @see IVerticalRulerColumn#setFont(Font)
- */
- public void setFont(Font font) {
- fFont= font;
- if (fCanvas != null && !fCanvas.isDisposed()) {
- fCanvas.setFont(fFont);
- computeNumberOfDigits();
- computeIndentations();
- }
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java
deleted file mode 100644
index 0520a7b..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.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.jface.text.source;
-
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IPaintPositionManager;
-import org.eclipse.jface.text.IPainter;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewerExtension3;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-
-/**
- * Highlights the peer character matching the character near the caret position. This
- * painter can be configured with an <code>ICharacterPairMatcher</code>.
- * Clients instantiate and configure object of this class.
- *
- * @since 2.1
- */
-public final class MatchingCharacterPainter implements IPainter, PaintListener {
-
- /** Indicates whether this painter is active */
- private boolean fIsActive= false;
- /** The source viewer this painter is associated with */
- private ISourceViewer fSourceViewer;
- /** The viewer's widget */
- private StyledText fTextWidget;
- /** The color in which to highlight the peer character */
- private Color fColor;
- /** The paint position manager */
- private IPaintPositionManager fPaintPositionManager;
- /** The startegy for finding matching characters */
- private ICharacterPairMatcher fMatcher;
- /** The position tracking the matching characters */
- private Position fPairPosition= new Position(0, 0);
- /** The anchor indicating whether the character is left or right of the caret */
- private int fAnchor;
-
-
- /**
- * Creates a new MatchingCharacterPainter for the given source viewer using
- * the given character pair matcher. The character matcher is not adopted by
- * this painter. Thus, it is not disposed. However, this painter requires
- * exlucsive access to the given pair matcher.
- *
- * @param sourceViewer
- * @param matcher
- */
- public MatchingCharacterPainter(ISourceViewer sourceViewer, ICharacterPairMatcher matcher) {
- fSourceViewer= sourceViewer;
- fMatcher= matcher;
- fTextWidget= sourceViewer.getTextWidget();
- }
-
- /**
- * Sets the color in which to highlight the match character.
- *
- * @param color the color
- */
- public void setColor(Color color) {
- fColor= color;
- }
-
- /*
- * @see org.eclipse.jface.text.IPainter#dispose()
- */
- public void dispose() {
- if (fMatcher != null) {
- fMatcher.clear();
- fMatcher= null;
- }
-
- fColor= null;
- fTextWidget= null;
- }
-
- /*
- * @see org.eclipse.jface.text.IPainter#deactivate(boolean)
- */
- public void deactivate(boolean redraw) {
- if (fIsActive) {
- fIsActive= false;
- fTextWidget.removePaintListener(this);
- if (fPaintPositionManager != null)
- fPaintPositionManager.unmanagePosition(fPairPosition);
- if (redraw)
- handleDrawRequest(null);
- }
- }
-
- /*
- * @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)
- */
- public void paintControl(PaintEvent event) {
- if (fTextWidget != null)
- handleDrawRequest(event.gc);
- }
-
- /**
- * Handles a redraw request.
- *
- * @param gc the gc to draw into.
- */
- private void handleDrawRequest(GC gc) {
-
- if (fPairPosition.isDeleted)
- return;
-
- int offset= fPairPosition.getOffset();
- int length= fPairPosition.getLength();
- if (length < 1)
- return;
-
- if (fSourceViewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) fSourceViewer;
- IRegion widgetRange= extension.modelRange2WidgetRange(new Region(offset, length));
- if (widgetRange == null)
- return;
-
- offset= widgetRange.getOffset();
- length= widgetRange.getLength();
-
- } else {
- IRegion region= fSourceViewer.getVisibleRegion();
- if (region.getOffset() > offset || region.getOffset() + region.getLength() < offset + length)
- return;
- offset -= region.getOffset();
- }
-
- if (ICharacterPairMatcher.RIGHT == fAnchor)
- draw(gc, offset, 1);
- else
- draw(gc, offset + length -1, 1);
- }
-
- /**
- * Highlights the given widget region.
- *
- * @param gc the gc to draw into
- * @param offset the offset of the widget region
- * @param length the length of the widget region
- */
- private void draw(GC gc, int offset, int length) {
- if (gc != null) {
- Point left= fTextWidget.getLocationAtOffset(offset);
- Point right= fTextWidget.getLocationAtOffset(offset + length);
-
- gc.setForeground(fColor);
- gc.drawRectangle(left.x, left.y, right.x - left.x - 1, gc.getFontMetrics().getHeight() - 1);
-
- } else {
- fTextWidget.redrawRange(offset, length, true);
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IPainter#paint(int)
- */
- public void paint(int reason) {
-
- IDocument document= fSourceViewer.getDocument();
- if (document == null) {
- deactivate(false);
- return;
- }
-
- Point selection= fSourceViewer.getSelectedRange();
- if (selection.y > 0) {
- deactivate(true);
- return;
- }
-
- IRegion pair= fMatcher.match(document, selection.x);
- if (pair == null) {
- deactivate(true);
- return;
- }
-
- if (fIsActive) {
-
- if (IPainter.CONFIGURATION == reason) {
-
- // redraw current highlighting
- handleDrawRequest(null);
-
- } else if (pair.getOffset() != fPairPosition.getOffset() ||
- pair.getLength() != fPairPosition.getLength() ||
- fMatcher.getAnchor() != fAnchor) {
-
- // otherwise only do something if position is different
-
- // remove old highlighting
- handleDrawRequest(null);
- // update position
- fPairPosition.isDeleted= false;
- fPairPosition.offset= pair.getOffset();
- fPairPosition.length= pair.getLength();
- fAnchor= fMatcher.getAnchor();
- // apply new highlighting
- handleDrawRequest(null);
-
- }
- } else {
-
- fIsActive= true;
-
- fPairPosition.isDeleted= false;
- fPairPosition.offset= pair.getOffset();
- fPairPosition.length= pair.getLength();
- fAnchor= fMatcher.getAnchor();
-
- fTextWidget.addPaintListener(this);
- fPaintPositionManager.managePosition(fPairPosition);
- handleDrawRequest(null);
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IPainter#setPositionManager(org.eclipse.jface.text.IPaintPositionManager)
- */
- public void setPositionManager(IPaintPositionManager manager) {
- fPaintPositionManager= manager;
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java
deleted file mode 100644
index 64c0a11..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java
+++ /dev/null
@@ -1,1008 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.source;
-
-import java.util.ArrayList;
-import java.util.Collections;
-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.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.ViewForm;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-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.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-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.ITextViewerExtension3;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextEvent;
-
-
-
-/**
- * Ruler presented next to a source viewer showing all annotations of the
- * viewer's annotation model in a compact format. The ruler has the same height
- * as the source viewer.<p>
- * Clients usually instantiate and configure objects of this class.
- *
- * @since 2.1
- */
-public class OverviewRuler implements IOverviewRuler {
-
- /**
- * Internal listener class.
- */
- class InternalListener implements ITextListener, IAnnotationModelListener {
-
- /*
- * @see ITextListener#textChanged
- */
- public void textChanged(TextEvent e) {
- if (fTextViewer != null && e.getDocumentEvent() == null && e.getViewerRedrawState()) {
- // handle only changes of visible document
- redraw();
- }
- }
-
- /*
- * @see IAnnotationModelListener#modelChanged(IAnnotationModel)
- */
- public void modelChanged(IAnnotationModel model) {
- update();
- }
- };
-
- /**
- * Enumerates the annotations of a specified type and characteristics
- * of the associated annotation model.
- */
- class FilterIterator implements Iterator {
-
- private final static int IGNORE= 0;
- private final static int TEMPORARY= 1;
- private final static int PERSISTENT= 2;
-
- private Iterator fIterator;
- private Object fType;
- private Annotation fNext;
- private int fTemporary;
-
- public FilterIterator() {
- this(null, IGNORE);
- }
-
- public FilterIterator(Object annotationType) {
- this(annotationType, IGNORE);
- }
-
- public FilterIterator(Object annotationType, boolean temporary) {
- this(annotationType, temporary ? TEMPORARY : PERSISTENT);
- }
-
- private FilterIterator(Object annotationType, int temporary) {
- fType= annotationType;
- fTemporary= temporary;
- if (fModel != null) {
- fIterator= fModel.getAnnotationIterator();
- skip();
- }
- }
-
- private void skip() {
- while (fIterator.hasNext()) {
- Annotation next= (Annotation) fIterator.next();
- Object annotationType= fAnnotationAccess.getType(next);
- if (annotationType == null)
- continue;
-
- fNext= next;
- if (fType == null || fType == annotationType) {
- if (fTemporary == IGNORE) return;
- boolean temporary= fAnnotationAccess.isTemporary(fNext);
- if (fTemporary == TEMPORARY && temporary) return;
- if (fTemporary == PERSISTENT && !temporary) return;
- }
- }
- fNext= null;
- }
-
- /*
- * @see Iterator#hasNext()
- */
- public boolean hasNext() {
- return fNext != null;
- }
- /*
- * @see Iterator#next()
- */
- public Object next() {
- try {
- return fNext;
- } finally {
- if (fModel != null)
- skip();
- }
- }
- /*
- * @see Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
-
- /**
- * The painter of the overview ruler's header.
- */
- class HeaderPainter implements PaintListener {
-
- private Color fIndicatorColor;
- private Color fSeparatorColor;
-
- public HeaderPainter() {
- fSeparatorColor= fSharedTextColors.getColor(ViewForm.borderInsideRGB);
- }
-
- public void setColor(Color color) {
- fIndicatorColor= color;
- }
-
- private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topLeft, Color bottomRight) {
- gc.setForeground(topLeft);
- gc.drawLine(x, y, x + w -1, y);
- gc.drawLine(x, y, x, y + h -1);
-
- gc.setForeground(bottomRight);
- gc.drawLine(x + w, y, x + w, y + h);
- gc.drawLine(x, y + h, x + w, y + h);
- }
-
- public void paintControl(PaintEvent e) {
-
- Point s= fHeader.getSize();
-
- if (fIndicatorColor != null) {
- e.gc.setBackground(fIndicatorColor);
- Rectangle r= new Rectangle(INSET, (s.y - (2*ANNOTATION_HEIGHT)) / 2, s.x - (2*INSET), 2*ANNOTATION_HEIGHT);
- e.gc.fillRectangle(r);
- Display d= fHeader.getDisplay();
- if (d != null)
- drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, d.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), d.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
- }
-
- e.gc.setForeground(fSeparatorColor);
- e.gc.setLineWidth(1);
- e.gc.drawLine(0, s.y -1, s.x -1, s.y -1);
- }
- };
-
- private static final int INSET= 2;
- private static final int ANNOTATION_HEIGHT= 4;
- private static boolean ANNOTATION_HEIGHT_SCALABLE= false;
-
-
- /** The model of the overview ruler */
- private IAnnotationModel fModel;
- /** The view to which this ruler is connected */
- private ITextViewer fTextViewer;
- /** The ruler's canvas */
- private Canvas fCanvas;
- /** The ruler's header */
- private Canvas fHeader;
- /** The drawable for double buffering */
- private Image fBuffer;
- /** The internal listener */
- private InternalListener fInternalListener= new InternalListener();
- /** The width of this vertical ruler */
- private int fWidth;
- /** The hit detection cursor */
- private Cursor fHitDetectionCursor;
- /** The last cursor */
- private Cursor fLastCursor;
- /** Cache for the actual scroll position in pixels */
- private int fScrollPos;
- /** The line of the last mouse button activity */
- private int fLastMouseButtonActivityLine= -1;
- /** The actual annotation height */
- private int fAnnotationHeight= -1;
- /** The annotation access */
- private IAnnotationAccess fAnnotationAccess;
- /** The header painter */
- private HeaderPainter fHeaderPainter;
- /** The list of annotation types to be shown in this ruler */
- private Set fAnnotationTypes= new HashSet();
- /** The list of annotation types to be shown in the header of this ruler */
- private Set fHeaderAnnotationTypes= new HashSet();
- /** The mapping between annotation types and drawing layers */
- private Map fAnnotationTypes2Layers= new HashMap();
- /** The mapping between annotation types and colors */
- private Map fAnnotationTypes2Colors= new HashMap();
- /** The color manager */
- private ISharedTextColors fSharedTextColors;
-
-
-
- /**
- * Constructs a overview ruler of the given width using the given annotation access and the given
- * color manager.
- *
- * @param annotationAccess the annotation access
- * @param width the width of the vertical ruler
- * @param sharedColors the color manager
- */
- public OverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors) {
- fAnnotationAccess= annotationAccess;
- fWidth= width;
- fSharedTextColors= sharedColors;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IVerticalRulerInfo#getControl()
- */
- public Control getControl() {
- return fCanvas;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IVerticalRulerInfo#getWidth()
- */
- public int getWidth() {
- return fWidth;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IVerticalRuler#setModel(org.eclipse.jface.text.source.IAnnotationModel)
- */
- public void setModel(IAnnotationModel model) {
- if (model != fModel || model != null) {
-
- if (fModel != null)
- fModel.removeAnnotationModelListener(fInternalListener);
-
- fModel= model;
-
- if (fModel != null)
- fModel.addAnnotationModelListener(fInternalListener);
-
- update();
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.IVerticalRuler#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.ITextViewer)
- */
- public Control createControl(Composite parent, ITextViewer textViewer) {
-
- fTextViewer= textViewer;
-
- fHitDetectionCursor= new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
- fCanvas= new Canvas(parent, SWT.NO_BACKGROUND);
- fHeader= new Canvas(parent, SWT.NONE);
-
- fCanvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- if (fTextViewer != null)
- doubleBufferPaint(event.gc);
- }
- });
-
- fCanvas.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- handleDispose();
- fTextViewer= null;
- }
- });
-
- fCanvas.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent event) {
- handleMouseDown(event);
- }
- });
-
- fCanvas.addMouseMoveListener(new MouseMoveListener() {
- public void mouseMove(MouseEvent event) {
- handleMouseMove(event);
- }
- });
-
- if (fTextViewer != null)
- fTextViewer.addTextListener(fInternalListener);
-
- return fCanvas;
- }
-
- /**
- * Disposes the ruler's resources.
- */
- private void handleDispose() {
-
- if (fTextViewer != null) {
- fTextViewer.removeTextListener(fInternalListener);
- fTextViewer= null;
- }
-
- if (fModel != null)
- fModel.removeAnnotationModelListener(fInternalListener);
-
- if (fBuffer != null) {
- fBuffer.dispose();
- fBuffer= null;
- }
-
- if (fHitDetectionCursor != null) {
- fHitDetectionCursor.dispose();
- fHitDetectionCursor= null;
- }
-
- fAnnotationTypes.clear();
- fHeaderAnnotationTypes.clear();
- fAnnotationTypes2Layers.clear();
- fAnnotationTypes2Colors.clear();
- }
-
- /**
- * Double buffer drawing.
- *
- * @param dest the gc to draw into
- */
- private void doubleBufferPaint(GC dest) {
-
- Point size= fCanvas.getSize();
-
- if (size.x <= 0 || size.y <= 0)
- return;
-
- if (fBuffer != null) {
- Rectangle r= fBuffer.getBounds();
- if (r.width != size.x || r.height != size.y) {
- fBuffer.dispose();
- fBuffer= null;
- }
- }
- if (fBuffer == null)
- fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
-
- GC gc= new GC(fBuffer);
- try {
- gc.setBackground(fCanvas.getBackground());
- gc.fillRectangle(0, 0, size.x, size.y);
-
- if (fTextViewer instanceof ITextViewerExtension3)
- doPaint1(gc);
- else
- doPaint(gc);
-
- } finally {
- gc.dispose();
- }
-
- dest.drawImage(fBuffer, 0, 0);
- }
-
- /**
- * Draws this overview ruler.
- *
- * @param gc the gc to draw into
- */
- private void doPaint(GC gc) {
-
- if (fTextViewer == null)
- return;
-
- Rectangle r= new Rectangle(0, 0, 0, 0);
- int yy, hh= ANNOTATION_HEIGHT;
-
-
- IDocument document= fTextViewer.getDocument();
- IRegion visible= fTextViewer.getVisibleRegion();
-
- StyledText textWidget= fTextViewer.getTextWidget();
- int maxLines= textWidget.getLineCount();
- fScrollPos= textWidget.getTopPixel();
-
- Point size= fCanvas.getSize();
- int writable= maxLines * textWidget.getLineHeight();
- if (size.y > writable)
- size.y= writable;
-
-
- List indices= new ArrayList(fAnnotationTypes2Layers.keySet());
- Collections.sort(indices);
-
- for (Iterator iterator= indices.iterator(); iterator.hasNext();) {
- Object layer= iterator.next();
- Object annotationType= fAnnotationTypes2Layers.get(layer);
-
- if (skip(annotationType))
- continue;
-
- boolean[] temporary= new boolean[] { false, true };
- for (int t=0; t < temporary.length; t++) {
-
- Iterator e= new FilterIterator(annotationType, temporary[t]);
- Color fill= getFillColor(annotationType, temporary[t]);
- Color stroke= getStrokeColor(annotationType, temporary[t]);
-
- for (int i= 0; e.hasNext(); i++) {
-
- Annotation a= (Annotation) e.next();
- Position p= fModel.getPosition(a);
-
- if (p == null || !p.overlapsWith(visible.getOffset(), visible.getLength()))
- continue;
-
- int annotationOffset= Math.max(p.getOffset(), visible.getOffset());
- int annotationEnd= Math.min(p.getOffset() + p.getLength(), visible.getOffset() + visible.getLength());
- int annotationLength= annotationEnd - annotationOffset;
-
- try {
- if (ANNOTATION_HEIGHT_SCALABLE) {
- int numbersOfLines= document.getNumberOfLines(annotationOffset, annotationLength);
- hh= (numbersOfLines * size.y) / maxLines;
- if (hh < ANNOTATION_HEIGHT)
- hh= ANNOTATION_HEIGHT;
- }
- fAnnotationHeight= hh;
-
- int startLine= textWidget.getLineAtOffset(annotationOffset - visible.getOffset());
- yy= Math.min((startLine * size.y) / maxLines, size.y - hh);
-
- if (fill != null) {
- gc.setBackground(fill);
- gc.fillRectangle(INSET, yy, size.x-(2*INSET), hh);
- }
-
- if (stroke != null) {
- gc.setForeground(stroke);
- r.x= INSET;
- r.y= yy;
- r.width= size.x - (2 * INSET) - 1;
- r.height= hh;
- gc.setLineWidth(1);
- gc.drawRectangle(r);
- }
- } catch (BadLocationException x) {
- }
- }
- }
- }
- }
-
- /**
- * Draws this overview ruler. Uses <code>ITextViewerExtension3</code> for
- * its implementation. Will replace <code>doPaint(GC)</code>.
- *
- * @param gc the gc to draw into
- */
- private void doPaint1(GC gc) {
-
- if (fTextViewer == null)
- return;
-
- Rectangle r= new Rectangle(0, 0, 0, 0);
- int yy, hh= ANNOTATION_HEIGHT;
-
- ITextViewerExtension3 extension= (ITextViewerExtension3) fTextViewer;
- IDocument document= fTextViewer.getDocument();
- StyledText textWidget= fTextViewer.getTextWidget();
- fScrollPos= textWidget.getTopPixel();
-
- int maxLines= textWidget.getLineCount();
- Point size= fCanvas.getSize();
- int writable= maxLines * textWidget.getLineHeight();
- if (size.y > writable)
- size.y= writable;
-
- List indices= new ArrayList(fAnnotationTypes2Layers.keySet());
- Collections.sort(indices);
-
- for (Iterator iterator= indices.iterator(); iterator.hasNext();) {
- Object layer= iterator.next();
- Object annotationType= fAnnotationTypes2Layers.get(layer);
-
- if (skip(annotationType))
- continue;
-
- boolean[] temporary= new boolean[] { false, true };
- for (int t=0; t < temporary.length; t++) {
-
- Iterator e= new FilterIterator(annotationType, temporary[t]);
- Color fill= getFillColor(annotationType, temporary[t]);
- Color stroke= getStrokeColor(annotationType, temporary[t]);
-
- for (int i= 0; e.hasNext(); i++) {
-
- Annotation a= (Annotation) e.next();
- Position p= fModel.getPosition(a);
-
- if (p == null)
- continue;
-
- IRegion widgetRegion= extension.modelRange2WidgetRange(new Region(p.getOffset(), p.getLength()));
- if (widgetRegion == null)
- continue;
-
- try {
- if (ANNOTATION_HEIGHT_SCALABLE) {
- int numbersOfLines= document.getNumberOfLines(p.getOffset(), p.getLength());
- hh= (numbersOfLines * size.y) / maxLines;
- if (hh < ANNOTATION_HEIGHT)
- hh= ANNOTATION_HEIGHT;
- }
- fAnnotationHeight= hh;
-
- int startLine= textWidget.getLineAtOffset(widgetRegion.getOffset());
- yy= Math.min((startLine * size.y) / maxLines, size.y - hh);
-
- if (fill != null) {
- gc.setBackground(fill);
- gc.fillRectangle(INSET, yy, size.x-(2*INSET), hh);
- }
-
- if (stroke != null) {
- gc.setForeground(stroke);
- r.x= INSET;
- r.y= yy;
- r.width= size.x - (2 * INSET) - 1;
- r.height= hh;
- gc.setLineWidth(1);
- gc.drawRectangle(r);
- }
- } catch (BadLocationException x) {
- }
- }
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.IVerticalRuler#update()
- */
- public void update() {
- if (fCanvas != null && !fCanvas.isDisposed()) {
- Display d= fCanvas.getDisplay();
- if (d != null) {
- d.asyncExec(new Runnable() {
- public void run() {
- redraw();
- updateHeader();
- }
- });
- }
- }
- }
-
- /**
- * Redraws the overview ruler.
- */
- private void redraw() {
- if (fCanvas != null && !fCanvas.isDisposed()) {
- GC gc= new GC(fCanvas);
- doubleBufferPaint(gc);
- gc.dispose();
- }
- }
-
- /**
- * Translates a given y-coordinate of this ruler into the corresponding
- * document lines. The number of lines depends on the concrete scaling
- * given as the ration between the height of this ruler and the length
- * of the document.
- *
- * @param y_coordinate the y-coordinate
- * @return the corresponding document lines
- */
- private int[] toLineNumbers(int y_coordinate) {
-
- StyledText textWidget= fTextViewer.getTextWidget();
- int maxLines= textWidget.getContent().getLineCount();
-
- int rulerLength= fCanvas.getSize().y;
- int writable= maxLines * textWidget.getLineHeight();
-
- if (rulerLength > writable)
- rulerLength= writable;
-
- if (y_coordinate >= writable)
- return new int[] {-1, -1};
-
- int[] lines= new int[2];
-
- int pixel= Math.max(y_coordinate - 1, 0);
- lines[0]= (pixel * maxLines) / rulerLength;
-
- pixel= Math.min(rulerLength, y_coordinate + 1);
- lines[1]= (pixel * maxLines) / rulerLength;
-
- if (fTextViewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) fTextViewer;
- lines[0]= extension.widgetlLine2ModelLine(lines[0]);
- lines[1]= extension.widgetlLine2ModelLine(lines[1]);
- } else {
- try {
- IRegion visible= fTextViewer.getVisibleRegion();
- int lineNumber= fTextViewer.getDocument().getLineOfOffset(visible.getOffset());
- lines[0] += lineNumber;
- lines[1] += lineNumber;
- } catch (BadLocationException x) {
- }
- }
-
- return lines;
- }
-
- /**
- * Returns the position of the first annotation found in the given line range.
- *
- * @param lineNumbers the line range
- * @return the position of the first found annotation
- */
- private Position getAnnotationPosition(int[] lineNumbers) {
- if (lineNumbers[0] == -1)
- return null;
-
- Position found= null;
-
- try {
- IDocument d= fTextViewer.getDocument();
- IRegion line= d.getLineInformation(lineNumbers[0]);
-
- int start= line.getOffset();
-
- line= d.getLineInformation(lineNumbers[lineNumbers.length - 1]);
- int end= line.getOffset() + line.getLength();
-
- Iterator e= new FilterIterator();
- while (e.hasNext()) {
- Annotation a= (Annotation) e.next();
- Position p= fModel.getPosition(a);
- if (start <= p.getOffset() && p.getOffset() < end) {
- if (found == null || p.getOffset() < found.getOffset())
- found= p;
- }
- }
-
- } catch (BadLocationException x) {
- }
-
- return found;
- }
-
- /**
- * Returns the line which corresponds best to one of
- * the underlying annotations at the given y-coordinate.
- *
- * @return the best matching line or <code>-1</code> if no such line can be found
- */
- private int findBestMatchingLineNumber(int[] lineNumbers) {
- if (lineNumbers == null || lineNumbers.length < 1)
- return -1;
-
- try {
- Position pos= getAnnotationPosition(lineNumbers);
- if (pos == null)
- return -1;
- return fTextViewer.getDocument().getLineOfOffset(pos.getOffset());
- } catch (BadLocationException ex) {
- return -1;
- }
- }
-
- /**
- * Handles mouse clicks.
- *
- * @param event the mouse button down event
- */
- private void handleMouseDown(MouseEvent event) {
- if (fTextViewer != null) {
- int[] lines= toLineNumbers(event.y);
- Position p= getAnnotationPosition(lines);
- if (p != null) {
- fTextViewer.revealRange(p.getOffset(), p.getLength());
- fTextViewer.setSelectedRange(p.getOffset(), p.getLength());
- }
- fTextViewer.getTextWidget().setFocus();
- }
- fLastMouseButtonActivityLine= toDocumentLineNumber(event.y);
- }
-
- /**
- * Handles mouse moves.
- *
- * @param event the mouse move event
- */
- private void handleMouseMove(MouseEvent event) {
- if (fTextViewer != null) {
- int[] lines= toLineNumbers(event.y);
- Position p= getAnnotationPosition(lines);
- Cursor cursor= (p != null ? fHitDetectionCursor : null);
- if (cursor != fLastCursor) {
- fCanvas.setCursor(cursor);
- fLastCursor= cursor;
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.IOverviewRuler#addAnnotationType(java.lang.Object)
- */
- public void addAnnotationType(Object annotationType) {
- fAnnotationTypes.add(annotationType);
- }
-
- /*
- * @see org.eclipse.jface.text.source.IOverviewRuler#removeAnnotationType(java.lang.Object)
- */
- public void removeAnnotationType(Object annotationType) {
- fAnnotationTypes.remove(annotationType);
- }
-
- /*
- * @see org.eclipse.jface.text.source.IOverviewRuler#setAnnotationTypeLayer(java.lang.Object, int)
- */
- public void setAnnotationTypeLayer(Object annotationType, int layer) {
- if (layer >= 0)
- fAnnotationTypes2Layers.put(new Integer(layer), annotationType);
- else {
- Iterator e= fAnnotationTypes2Layers.keySet().iterator();
- while (e.hasNext()) {
- Object key= e.next();
- if (annotationType.equals(fAnnotationTypes2Layers.get(key))) {
- fAnnotationTypes2Layers.remove(key);
- return;
- }
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.IOverviewRuler#setAnnotationTypeColor(java.lang.Object, org.eclipse.swt.graphics.Color)
- */
- public void setAnnotationTypeColor(Object annotationType, Color color) {
- if (color != null)
- fAnnotationTypes2Colors.put(annotationType, color);
- else
- fAnnotationTypes2Colors.remove(annotationType);
- }
-
- /**
- * Returns whether annotation of the given annotation type should be skipped by the drawing routine.
- *
- * @param annotationType the annotation type
- * @return <code>true</code> if annotation of the given type should be skipped
- */
- private boolean skip(Object annotationType) {
- return !fAnnotationTypes.contains(annotationType);
- }
-
- /**
- * Returns a specification of a color that lies between the given
- * foreground and background color using the given scale factor.
- *
- * @param fg the foreground color
- * @param bg the background color
- * @param scale the scale factor
- * @return the interpolated color
- */
- private static RGB interpolate(RGB fg, RGB bg, double scale) {
- return new RGB(
- (int) ((1.0-scale) * fg.red + scale * bg.red),
- (int) ((1.0-scale) * fg.green + scale * bg.green),
- (int) ((1.0-scale) * fg.blue + scale * bg.blue)
- );
- }
-
- /**
- * Returns the grey value in which the given color would be drawn in grey-scale.
- *
- * @param rgb the color
- * @return the grey-scale value
- */
- private static double greyLevel(RGB rgb) {
- if (rgb.red == rgb.green && rgb.green == rgb.blue)
- return rgb.red;
- return (0.299 * rgb.red + 0.587 * rgb.green + 0.114 * rgb.blue + 0.5);
- }
-
- /**
- * Returns whether the given color is dark or light depending on the colors grey-scale level.
- *
- * @param rgb the color
- * @return <code>true</code> if the color is dark, <code>false</code> if it is light
- */
- private static boolean isDark(RGB rgb) {
- return greyLevel(rgb) > 128;
- }
-
- /**
- * Returns a color based on the color configured for the given annotation type and the given scale factor.
- *
- * @param annotationType the annotation type
- * @param scale the scale factor
- * @return the computed color
- */
- private Color getColor(Object annotationType, double scale) {
- Color base= (Color) fAnnotationTypes2Colors.get(annotationType);
- if (base == null)
- return null;
-
- RGB baseRGB= base.getRGB();
- RGB background= fCanvas.getBackground().getRGB();
-
- boolean darkBase= isDark(baseRGB);
- boolean darkBackground= isDark(background);
- if (darkBase && darkBackground)
- background= new RGB(255, 255, 255);
- else if (!darkBase && !darkBackground)
- background= new RGB(0, 0, 0);
-
- return fSharedTextColors.getColor(interpolate(baseRGB, background, scale));
- }
-
- /**
- * Returns the stroke color for the given annotation type and characteristics.
- *
- * @param annotationType the annotation type
- * @param temporary <code>true</code> if for temporary annotations
- * @return the stroke color
- */
- private Color getStrokeColor(Object annotationType, boolean temporary) {
- return getColor(annotationType, temporary ? 0.5 : 0.2);
- }
-
- /**
- * Returns the fill color for the given annotation type and characteristics.
- *
- * @param annotationType the annotation type
- * @param temporary <code>true</code> if for temporary annotations
- * @return the fill color
- */
- private Color getFillColor(Object annotationType, boolean temporary) {
- return getColor(annotationType, temporary ? 0.9 : 0.6);
- }
-
- /*
- * @see IVerticalRulerInfo#getLineOfLastMouseButtonActivity()
- */
- public int getLineOfLastMouseButtonActivity() {
- return fLastMouseButtonActivityLine;
- }
-
- /*
- * @see IVerticalRulerInfo#toDocumentLineNumber(int)
- */
- public int toDocumentLineNumber(int y_coordinate) {
-
- if (fTextViewer == null || y_coordinate == -1)
- return -1;
-
- int[] lineNumbers= toLineNumbers(y_coordinate);
- int bestLine= findBestMatchingLineNumber(lineNumbers);
- if (bestLine == -1 && lineNumbers.length > 0)
- return lineNumbers[0];
- return bestLine;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IVerticalRuler#getModel()
- */
- public IAnnotationModel getModel() {
- return fModel;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IOverviewRuler#getAnnotationHeight()
- */
- public int getAnnotationHeight() {
- return fAnnotationHeight;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IOverviewRuler#hasAnnotation(int)
- */
- public boolean hasAnnotation(int y) {
- return findBestMatchingLineNumber(toLineNumbers(y)) != -1;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IOverviewRuler#getHeaderControl()
- */
- public Control getHeaderControl() {
- return fHeader;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IOverviewRuler#addHeaderAnnotationType(java.lang.Object)
- */
- public void addHeaderAnnotationType(Object annotationType) {
- fHeaderAnnotationTypes.add(annotationType);
- }
-
- /*
- * @see org.eclipse.jface.text.source.IOverviewRuler#removeHeaderAnnotationType(java.lang.Object)
- */
- public void removeHeaderAnnotationType(Object annotationType) {
- fHeaderAnnotationTypes.remove(annotationType);
- }
-
- /**
- * Updates the header of this ruler.
- */
- private void updateHeader() {
-
- if (fHeader == null || fHeader.isDisposed())
- return;
-
- List indices= new ArrayList(fAnnotationTypes2Layers.keySet());
- Collections.sort(indices);
-
- Object colorType= null;
- outer: for (int i= indices.size() -1; i >= 0; i--) {
-
- Object layer=indices.get(i);
- Object annotationType= fAnnotationTypes2Layers.get(layer);
-
- if (!fHeaderAnnotationTypes.contains(annotationType))
- continue;
-
- for (Iterator e= new FilterIterator(annotationType); e.hasNext();) {
- if (e.next() != null) {
- colorType= annotationType;
- break outer;
- }
- }
- }
-
- Color color= null;
- if (colorType != null)
- color= (Color) fAnnotationTypes2Colors.get(colorType);
-
- if (color == null) {
- if (fHeaderPainter != null)
- fHeaderPainter.setColor(null);
- } else {
- if (fHeaderPainter == null) {
- fHeaderPainter= new HeaderPainter();
- fHeader.addPaintListener(fHeaderPainter);
- }
- fHeaderPainter.setColor(color);
- }
-
- fHeader.redraw();
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java
deleted file mode 100644
index cab1f91..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRulerHoverManager.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.jface.text.source;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.source.AnnotationBarHoverManager;
-import org.eclipse.jface.text.source.IAnnotationHover;
-import org.eclipse.jface.text.source.ISourceViewer;
-
-/**
- * This manager controls the layout, content, and visibility of an information
- * control in reaction to mouse hover events issued by the overview ruler of a
- * source viewer.
- *
- * @since 2.1
- */
-class OverviewRulerHoverManager extends AnnotationBarHoverManager {
-
- /**
- * Creates an overview hover manager with the given parameters. In addition,
- * the hovers anchor is RIGHT and the margin is 5 points to the right.
- *
- * @param ruler the overview ruler this manager connects to
- * @param sourceViewer the source viewer this manager connects to
- * @param annotationHover the annotation hover providing the information to be displayed
- * @param creator the information control creator
- */
- public OverviewRulerHoverManager(IOverviewRuler ruler, ISourceViewer sourceViewer, IAnnotationHover annotationHover, IInformationControlCreator creator) {
- super(ruler, sourceViewer, annotationHover, creator);
- setAnchor(ANCHOR_LEFT);
- }
-
- /*
- * @see AbstractHoverInformationControlManager#computeInformation()
- */
- protected void computeInformation() {
- Point location= getHoverEventLocation();
- int line= getVerticalRulerInfo().toDocumentLineNumber(location.y);
- setInformation(getAnnotationHover().getHoverInfo(getSourceViewer(), line), computeArea(location.y));
- }
-
- /**
- * Determines graphical area covered for which the hover is valid.
- *
- * @param y-coordinate in the vertical ruler
- * @return the graphical extend where the hover is valid
- */
- private Rectangle computeArea(int y) {
- // This is ok (see constructor)
- IOverviewRuler overviewRuler= (IOverviewRuler) getVerticalRulerInfo();
-
- int hover_height= overviewRuler.getAnnotationHeight();
- int hover_width= getVerticalRulerInfo().getControl().getSize().x;
-
- // Calculate y-coordinate for hover
- int hover_y= y;
- boolean hasAnnotation= true;
- while (hasAnnotation && hover_y > y - hover_height) {
- hover_y--;
- hasAnnotation= overviewRuler.hasAnnotation(hover_y);
- }
- hover_y++;
-
- return new Rectangle(0, hover_y, hover_width, hover_height);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java
deleted file mode 100644
index 87f4d09..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java
+++ /dev/null
@@ -1,613 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.source;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
-
-import org.eclipse.jface.text.AbstractHoverInformationControlManager;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewerExtension2;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.formatter.IContentFormatter;
-import org.eclipse.jface.text.information.IInformationPresenter;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.reconciler.IReconciler;
-
-
-/**
- * SWT based implementation of <code>ISourceViewer</code>. The same rules apply
- * as for <code>TextViewer</code>. A source viewer uses an <code>IVerticalRuler</code>
- * as its annotation presentation area. The vertical ruler is a small strip shown left
- * of the viewer's text widget. A source viewer uses an <code>IOverviewRuler</code>
- * as its presentation area for the annotation overview. The overview ruler is a small strip
- * shown right of the viewer's text widget.<p>
- * Clients are supposed to instantiate a source viewer and subsequently to communicate
- * with it exclusively using the <code>ISourceViewer</code> interface. Clients should not
- * subclass this class as it is rather likely that subclasses will be broken by future releases.
- */
-public class SourceViewer extends TextViewer implements ISourceViewer, ISourceViewerExtension {
-
-
- /**
- * Layout of a source viewer. Vertical ruler, text widget, and overview ruler are shown side by side.
- */
- class RulerLayout extends Layout {
-
- /** The gap between the text viewer and the vertical ruler. */
- protected int fGap;
-
- /**
- * Creates a new ruler layout with the given gap between text viewer and vertical ruler.
- *
- * @param gap the gap between text viewer and vertical ruler
- */
- protected RulerLayout(int gap) {
- fGap= gap;
- }
-
- /*
- * @see Layout#computeSize(Composite, int, int, boolean)
- */
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- Control[] children= composite.getChildren();
- Point s= children[children.length - 1].computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- if (fVerticalRuler != null && fIsVerticalRulerVisible)
- s.x += fVerticalRuler.getWidth() + fGap;
- return s;
- }
-
- /*
- * @see Layout#layout(Composite, boolean)
- */
- protected void layout(Composite composite, boolean flushCache) {
- Rectangle clArea= composite.getClientArea();
- if (fVerticalRuler != null && fIsVerticalRulerVisible) {
-
- Rectangle trim= getTextWidget().computeTrim(0, 0, 0, 0);
- int scrollbarHeight= trim.height;
-
- int verticalRulerWidth= fVerticalRuler.getWidth();
- int overviewRulerWidth= 0;
- if (fOverviewRuler != null && fIsOverviewRulerVisible) {
- overviewRulerWidth= fOverviewRuler.getWidth();
- fOverviewRuler.getControl().setBounds(clArea.width - overviewRulerWidth -1, scrollbarHeight, overviewRulerWidth, clArea.height - 3*scrollbarHeight);
- fOverviewRuler.getHeaderControl().setBounds(clArea.width - overviewRulerWidth -1, 0, overviewRulerWidth, scrollbarHeight);
- }
-
- getTextWidget().setBounds(verticalRulerWidth + fGap, 0, clArea.width - verticalRulerWidth - overviewRulerWidth - 2*fGap, clArea.height);
- fVerticalRuler.getControl().setBounds(0, 0, verticalRulerWidth, clArea.height - scrollbarHeight);
-
- } else
- getTextWidget().setBounds(0, 0, clArea.width, clArea.height);
- }
- };
-
-
- /** The viewer's content assistant */
- protected IContentAssistant fContentAssistant;
- /**
- * Flag indicating whether the viewer's content assistant is installed
- * @since 2.0
- */
- protected boolean fContentAssistantInstalled;
- /** The viewer's content formatter */
- protected IContentFormatter fContentFormatter;
- /** The viewer's model reconciler */
- protected IReconciler fReconciler;
- /** The viewer's presentation reconciler */
- protected IPresentationReconciler fPresentationReconciler;
- /** The viewer's annotation hover */
- protected IAnnotationHover fAnnotationHover;
- /**
- * The viewer's information presenter
- * @since 2.0
- */
- protected IInformationPresenter fInformationPresenter;
-
- /** Visual vertical ruler */
- private IVerticalRuler fVerticalRuler;
- /** Visibility of vertical ruler */
- private boolean fIsVerticalRulerVisible;
- /** The SWT widget used when supporting a vertical ruler */
- private Composite fComposite;
- /** The vertical ruler's annotation model */
- private VisualAnnotationModel fVisualAnnotationModel;
- /** The viewer's range indicator to be shown in the vertical ruler */
- private Annotation fRangeIndicator;
- /** The viewer's vertical ruler hovering controller */
- private AbstractHoverInformationControlManager fVerticalRulerHoveringController;
- /**
- * The viewer's overview ruler hovering controller
- * @since 2.1
- */
- private AbstractHoverInformationControlManager fOverviewRulerHoveringController;
-
- /**
- * The overview ruler.
- * @since 2.1
- */
- private IOverviewRuler fOverviewRuler;
- /**
- * The visibility of the overview ruler
- * @since 2.1
- */
- private boolean fIsOverviewRulerVisible;
-
-
- /** The size of the gap between the vertical ruler and the text widget */
- protected final static int GAP_SIZE= 2;
-
-
- /**
- * Constructs a new source viewer. The vertical ruler is initially visible.
- * The viewer has not yet been initialized with a source viewer configuration.
- *
- * @param parent the parent of the viewer's control
- * @param ruler the vertical ruler used by this source viewer
- * @param styles the SWT style bits
- */
- public SourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
- this(parent, ruler, null, false, styles);
- }
-
- /**
- * Constructs a new source viewer. The vertical ruler is initially visible.
- * The overview ruler visibility is controlled by the value of <code>showAnnotationsOverview</code>.
- * The viewer has not yet been initialized with a source viewer configuration.
- *
- * @param parent the parent of the viewer's control
- * @param verticalRuler the vertical ruler used by this source viewer
- * @param overviewRuler the overview ruler
- * @param showAnnotationsOverview <code>true</code> if the overview ruler should be visible, <code>false</code> otherwise
- * @param styles the SWT style bits
- * @since 2.1
- */
- public SourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles) {
- super();
-
- fVerticalRuler= verticalRuler;
- fIsVerticalRulerVisible= (verticalRuler != null);
- fOverviewRuler= overviewRuler;
- fIsOverviewRulerVisible= (showAnnotationsOverview && overviewRuler != null);
-
- createControl(parent, styles);
- }
-
- /*
- * @see TextViewer#createControl(Composite, int)
- */
- protected void createControl(Composite parent, int styles) {
-
- if (fVerticalRuler != null || fOverviewRuler != null) {
- styles= (styles & ~SWT.BORDER);
- fComposite= new Canvas(parent, SWT.NONE);
- fComposite.setLayout(new RulerLayout(GAP_SIZE));
- parent= fComposite;
- }
-
- super.createControl(parent, styles);
-
- if (fVerticalRuler != null)
- fVerticalRuler.createControl(fComposite, this);
- if (fOverviewRuler != null)
- fOverviewRuler.createControl(fComposite, this);
- }
-
- /*
- * @see TextViewer#getControl()
- */
- public Control getControl() {
- if (fComposite != null)
- return fComposite;
- return super.getControl();
- }
-
- /*
- * @see ISourceViewer#setAnnotationHover(IAnnotationHover)
- */
- public void setAnnotationHover(IAnnotationHover annotationHover) {
- fAnnotationHover= annotationHover;
- }
-
- /*
- * @see ISourceViewer#configure(SourceViewerConfiguration)
- */
- public void configure(SourceViewerConfiguration configuration) {
-
- if (getTextWidget() == null)
- return;
-
- // install content type independent plugins
- fPresentationReconciler= configuration.getPresentationReconciler(this);
- if (fPresentationReconciler != null)
- fPresentationReconciler.install(this);
-
- fReconciler= configuration.getReconciler(this);
- if (fReconciler != null)
- fReconciler.install(this);
-
- fContentAssistant= configuration.getContentAssistant(this);
- if (fContentAssistant != null) {
- fContentAssistant.install(this);
- fContentAssistantInstalled= true;
- }
-
- fContentFormatter= configuration.getContentFormatter(this);
-
- fInformationPresenter= configuration.getInformationPresenter(this);
- if (fInformationPresenter != null)
- fInformationPresenter.install(this);
-
- setUndoManager(configuration.getUndoManager(this));
-
- getTextWidget().setTabs(configuration.getTabWidth(this));
-
- setAnnotationHover(configuration.getAnnotationHover(this));
-
- setHoverControlCreator(configuration.getInformationControlCreator(this));
-
- // install content type specific plugins
- String[] types= configuration.getConfiguredContentTypes(this);
- for (int i= 0; i < types.length; i++) {
-
- String t= types[i];
-
- setAutoIndentStrategy(configuration.getAutoIndentStrategy(this, t), t);
- setTextDoubleClickStrategy(configuration.getDoubleClickStrategy(this, t), t);
-
- int[] stateMasks= configuration.getConfiguredTextHoverStateMasks(this, t);
- if (stateMasks != null) {
- for (int j= 0; j < stateMasks.length; j++) {
- int stateMask= stateMasks[j];
- setTextHover(configuration.getTextHover(this, t, stateMask), t, stateMask);
- }
- } else {
- setTextHover(configuration.getTextHover(this, t), t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
- }
-
- String[] prefixes= configuration.getIndentPrefixes(this, t);
- if (prefixes != null && prefixes.length > 0)
- setIndentPrefixes(prefixes, t);
-
- prefixes= configuration.getDefaultPrefixes(this, t);
- if (prefixes != null && prefixes.length > 0)
- setDefaultPrefixes(prefixes, t);
- }
-
- activatePlugins();
- }
-
- /**
- * After this method has been executed the caller knows that any installed annotation hover has been installed.
- */
- protected void ensureAnnotationHoverManagerInstalled() {
- if (fVerticalRuler != null && fAnnotationHover != null && fVerticalRulerHoveringController == null && fHoverControlCreator != null) {
- fVerticalRulerHoveringController= new AnnotationBarHoverManager(fVerticalRuler, this, fAnnotationHover, fHoverControlCreator);
- fVerticalRulerHoveringController.install(fVerticalRuler.getControl());
- }
- }
-
- /**
- * After this method has been executed the caller knows that any installed overview hover has been installed.
- */
- protected void ensureOverviewHoverManagerInstalled() {
- if (fOverviewRuler != null && fAnnotationHover != null && fOverviewRulerHoveringController == null && fHoverControlCreator != null) {
- fOverviewRulerHoveringController= new OverviewRulerHoverManager(fOverviewRuler, this, fAnnotationHover, fHoverControlCreator);
- fOverviewRulerHoveringController.install(fOverviewRuler.getControl());
- }
- }
-
- /*
- * @see TextViewer#activatePlugins()
- */
- public void activatePlugins() {
- ensureAnnotationHoverManagerInstalled();
- ensureOverviewHoverManagerInstalled();
- super.activatePlugins();
- }
-
- /*
- * @see ISourceViewer#setDocument(IDocument, IAnnotationModel)
- */
- public void setDocument(IDocument document) {
- setDocument(document, null, -1, -1);
- }
-
- /*
- * @see ISourceViewer#setDocument(IDocument, IAnnotationModel, int, int)
- */
- public void setDocument(IDocument document, int visibleRegionOffset, int visibleRegionLength) {
- setDocument(document, null, visibleRegionOffset, visibleRegionLength);
- }
-
- /*
- * @see ISourceViewer#setDocument(IDocument, IAnnotationModel)
- */
- public void setDocument(IDocument document, IAnnotationModel annotationModel) {
- setDocument(document, annotationModel, -1, -1);
- }
-
- /*
- * @see ISourceViewer#setDocument(IDocument, IAnnotationModel, int, int)
- */
- public void setDocument(IDocument document, IAnnotationModel annotationModel, int visibleRegionOffset, int visibleRegionLength) {
-
- if (fVerticalRuler == null && fOverviewRuler == null) {
-
- if (visibleRegionOffset == -1 && visibleRegionLength == -1)
- super.setDocument(document);
- else
- super.setDocument(document, visibleRegionOffset, visibleRegionLength);
-
- } else {
-
- if (fVisualAnnotationModel != null && getDocument() != null)
- fVisualAnnotationModel.disconnect(getDocument());
-
- if (annotationModel != null && document != null) {
- fVisualAnnotationModel= new VisualAnnotationModel(annotationModel);
- fVisualAnnotationModel.connect(document);
- } else {
- fVisualAnnotationModel= null;
- }
-
- if (visibleRegionOffset == -1 && visibleRegionLength == -1)
- super.setDocument(document);
- else
- super.setDocument(document, visibleRegionOffset, visibleRegionLength);
-
- if (fVerticalRuler != null)
- fVerticalRuler.setModel(fVisualAnnotationModel);
-
- if (fOverviewRuler != null)
- fOverviewRuler.setModel(fVisualAnnotationModel);
- }
- }
-
- /*
- * @see ISourceViewer#getAnnotationModel()
- */
- public IAnnotationModel getAnnotationModel() {
- if (fVisualAnnotationModel != null)
- return fVisualAnnotationModel.getModelAnnotationModel();
- return null;
- }
-
- /*
- * @see TextViewer#handleDispose()
- */
- protected void handleDispose() {
-
- if (fPresentationReconciler != null) {
- fPresentationReconciler.uninstall();
- fPresentationReconciler= null;
- }
-
- if (fReconciler != null) {
- fReconciler.uninstall();
- fReconciler= null;
- }
-
- if (fContentAssistant != null) {
- fContentAssistant.uninstall();
- fContentAssistantInstalled= false;
- fContentAssistant= null;
- }
-
- fContentFormatter= null;
-
- if (fInformationPresenter != null) {
- fInformationPresenter.uninstall();
- fInformationPresenter= null;
- }
-
- if (fVisualAnnotationModel != null && getDocument() != null) {
- fVisualAnnotationModel.disconnect(getDocument());
- fVisualAnnotationModel= null;
- }
-
- fVerticalRuler= null;
-
- if (fVerticalRulerHoveringController != null) {
- fVerticalRulerHoveringController.dispose();
- fVerticalRulerHoveringController= null;
- }
-
- fOverviewRuler= null;
-
- if (fOverviewRulerHoveringController != null) {
- fOverviewRulerHoveringController.dispose();
- fOverviewRulerHoveringController= null;
- }
-
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=15300
- fComposite= null;
-
- super.handleDispose();
- }
-
- /*
- * @see ITextOperationTarget#canDoOperation(int)
- */
- public boolean canDoOperation(int operation) {
-
- if (getTextWidget() == null || !redraws())
- return false;
-
- if (operation == CONTENTASSIST_PROPOSALS)
- return fContentAssistant != null && fContentAssistantInstalled && isEditable();
-
- if (operation == CONTENTASSIST_CONTEXT_INFORMATION)
- return fContentAssistant != null && fContentAssistantInstalled && isEditable();
-
- if (operation == INFORMATION)
- return fInformationPresenter != null;
-
- if (operation == FORMAT) {
- Point p= getSelectedRange();
- int length= (p == null ? -1 : p.y);
- return (fContentFormatter != null && isEditable() && (length == 0 || isBlockSelected()));
- }
-
- return super.canDoOperation(operation);
- }
-
- /*
- * @see ITextOperationTarget#doOperation(int)
- */
- public void doOperation(int operation) {
-
- if (getTextWidget() == null || !redraws())
- return;
-
- switch (operation) {
- case CONTENTASSIST_PROPOSALS:
- fContentAssistant.showPossibleCompletions();
- return;
- case CONTENTASSIST_CONTEXT_INFORMATION:
- fContentAssistant.showContextInformation();
- return;
- case INFORMATION:
- fInformationPresenter.showInformation();
- return;
- case FORMAT: {
- Point s= getSelectedRange();
- IRegion r= (s.y == 0) ? getModelCoverage() : new Region(s.x, s.y);
- try {
- setRedraw(false);
- fContentFormatter.format(getDocument(), r);
- } finally {
- setRedraw(true);
- }
- return;
- }
- default:
- super.doOperation(operation);
- }
- }
-
- /*
- * @see ITextOperationTargetExtension#enableOperation(int, boolean)
- * @since 2.0
- */
- public void enableOperation(int operation, boolean enable) {
-
- switch (operation) {
- case CONTENTASSIST_PROPOSALS:
- case CONTENTASSIST_CONTEXT_INFORMATION: {
-
- if (fContentAssistant == null)
- return;
-
- if (enable) {
- if (!fContentAssistantInstalled) {
- fContentAssistant.install(this);
- fContentAssistantInstalled= true;
- }
- } else if (fContentAssistantInstalled) {
- fContentAssistant.uninstall();
- fContentAssistantInstalled= false;
- }
- }
- }
- }
-
- /*
- * @see ISourceViewer#setRangeIndicator(Annotation)
- */
- public void setRangeIndicator(Annotation rangeIndicator) {
- fRangeIndicator= rangeIndicator;
- }
-
- /*
- * @see ISourceViewer#setRangeIndication(int, int, boolean)
- */
- public void setRangeIndication(int start, int length, boolean moveCursor) {
-
- if (moveCursor) {
- setSelectedRange(start, 0);
- revealRange(start, length);
- }
-
- if (fRangeIndicator != null && fVisualAnnotationModel != null)
- fVisualAnnotationModel.modifyAnnotation(fRangeIndicator, new Position(start, length));
- }
-
- /*
- * @see ISourceViewer#getRangeIndication()
- */
- public IRegion getRangeIndication() {
- if (fRangeIndicator != null && fVisualAnnotationModel != null) {
- Position position= fVisualAnnotationModel.getPosition(fRangeIndicator);
- if (position != null)
- return new Region(position.getOffset(), position.getLength());
- }
-
- return null;
- }
-
- /*
- * @see ISourceViewer#removeRangeIndication()
- */
- public void removeRangeIndication() {
- if (fRangeIndicator != null && fVisualAnnotationModel != null)
- fVisualAnnotationModel.modifyAnnotation(fRangeIndicator, null);
- }
-
- /*
- * @see ISourceViewer#showAnnotations(boolean)
- */
- public void showAnnotations(boolean show) {
- boolean old= fIsVerticalRulerVisible;
- fIsVerticalRulerVisible= (show && fVerticalRuler != null);
- if (old != fIsVerticalRulerVisible) {
- if (fComposite != null && !fComposite.isDisposed())
- fComposite.layout();
- if (fIsVerticalRulerVisible) {
- ensureAnnotationHoverManagerInstalled();
- } else if (fVerticalRulerHoveringController != null) {
- fVerticalRulerHoveringController.dispose();
- fVerticalRulerHoveringController= null;
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.ISourceViewerExtension#showAnnotationsOverview(boolean)
- * @since 2.1
- */
- public void showAnnotationsOverview(boolean show) {
- boolean old= fIsOverviewRulerVisible;
- fIsOverviewRulerVisible= (show && fOverviewRuler != null);
- if (old != fIsOverviewRulerVisible) {
- if (fComposite != null && !fComposite.isDisposed())
- fComposite.layout();
- if (fIsOverviewRulerVisible) {
- ensureOverviewHoverManagerInstalled();
- } else if (fOverviewRulerHoveringController != null) {
- fOverviewRulerHoveringController.dispose();
- fOverviewRulerHoveringController= null;
- }
- }
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewerConfiguration.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewerConfiguration.java
deleted file mode 100644
index 6a9c3ba..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewerConfiguration.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text.source;
-
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.text.DefaultAutoIndentStrategy;
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.DefaultTextDoubleClickStrategy;
-import org.eclipse.jface.text.DefaultUndoManager;
-import org.eclipse.jface.text.IAutoIndentStrategy;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.ITextDoubleClickStrategy;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.IUndoManager;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.formatter.IContentFormatter;
-import org.eclipse.jface.text.information.IInformationPresenter;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.reconciler.IReconciler;
-
-
-/**
- * This class bundles the whole configuration space of a source viewer.
- * Instances of this class are passed to the <code>configure</code> method of
- * <code>ISourceViewer</code>.<p>
- * Each method in this class get as argument the source viewer for which it should
- * provide a particular configurational setting such as a presentation reconciler.
- * Based on its specific knowlegde about the returned object, the configuration
- * might share such objects or compute them according to some rules.<p>
- * Clients should subclass and override just those methods which must be specific to
- * their needs.
- *
- * @see ISourceViewer
- */
-public class SourceViewerConfiguration {
-
-
- /**
- * Creates a new source viewer configuration that behaves according to
- * specification of this class' methods.
- */
- public SourceViewerConfiguration() {
- super();
- }
-
- /**
- * Returns the visual width of the tab character. This implementation always
- * returns 4.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @return the tab width
- */
- public int getTabWidth(ISourceViewer sourceViewer) {
- return 4;
- }
-
- /**
- * Returns the undo manager for the given source viewer. This implementation
- * always returns a new instance of <code>DefaultUndoManager</code> whose
- * history length is set to 25.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @return an undo manager or <code>null</code< if no undo/redo should not be supported
- */
- public IUndoManager getUndoManager(ISourceViewer sourceViewer) {
- return new DefaultUndoManager(25);
- }
-
- /**
- * Returns the reconciler ready to be used with the given source viewer.
- * This implementation always returns <code>null</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @return a reconciler or <code>null</code> if reconciling should not be supported
- */
- public IReconciler getReconciler(ISourceViewer sourceViewer) {
- return null;
- }
-
- /**
- * Returns the presentation reconciler ready to be used with the given source viewer.
- * This implementation always returns <code>null</code>.
- *
- * @return the presentation reconciler or <code>null</code> if presentation reconciling should not be supported
- */
- public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
- return null;
- }
-
- /**
- * Returns the content formatter ready to be used with the given source viewer.
- * This implementation always returns <code>null</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @return a content formatter or <code>null</code> if formatting should not be supported
- */
- public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
- return null;
- }
-
- /**
- * Returns the content assistant ready to be used with the given source viewer.
- * This implementation always returns <code>null</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @return a content assistant or <code>null</code> if content assist should not be supported
- */
- public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- return null;
- }
-
- /**
- * Returns the auto indentation strategy ready to be used with the given source viewer
- * when manipulating text of the given content type. This implementation always
- * returns an new instance of <code>DefaultAutoIndentStrategy</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @param contentType the content type for which the strategy is applicable
- * @return the auto indent strategy or <code>null</code> if automatic indentation is not to be enabled
- */
- public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType) {
- return new DefaultAutoIndentStrategy();
- }
- /**
- * Returns the default prefixes to be used by the line-prefix operation
- * in the given source viewer for text of the given content type. This implementation always
- * returns <code>null</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @param contentType the content type for which the prefix is applicable
- * @return the default prefixes or <code>null</code> if the prefix operation should not be supported
- * @since 2.0
- */
- public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentType) {
- return null;
- }
-
- /**
- * Returns the double-click strategy ready to be used in this viewer when double clicking
- * onto text of the given content type. This implementation always returns a new instance of
- * <code>DefaultTextDoubleClickStrategy</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @param contentType the content type for which the strategy is applicable
- * @return a double-click strategy or <code>null</code> if double clicking should not be supported
- */
- public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) {
- return new DefaultTextDoubleClickStrategy();
- }
-
- /**
- * Returns the prefixes to be used by the line-shift operation. This implementation
- * always returns <code>new String[] { "\t", " " }</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @param contentType the content type for which the prefix is applicable
- * @return the prefixes or <code>null</code> if the prefix operation should not be supported
- */
- public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
- return new String[] { "\t", " ", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- /**
- * Returns the annotation hover which will provide the information to be
- * shown in a hover popup window when requested for the given
- * source viewer.This implementation always returns <code>null</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @return an annotation hover or <code>null</code> if no hover support should be installed
- */
- public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
- return null;
- }
-
- /**
- * Returns the SWT event state masks for which text hover are configured for
- * the given content type.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @param contentType the content type
- * @return an <code>int</code> array with the configured SWT event state masks
- * or <code>null</code> if text hovers are not supported for the given content type
- * @since 2.1
- */
- public int[] getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer, String contentType) {
- return null;
- }
-
- /**
- * Returns the text hover which will provide the information to be shown
- * in a text hover popup window when requested for the given source viewer and
- * the given content type. This implementation always returns <code>
- * null</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @param contentType the content type
- * @param stateMask the SWT event state mask
- * @return a text hover or <code>null</code> if no hover support should be installed
- * @since 2.1
- */
- public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
- return null;
- }
-
- /**
- * Returns the text hover which will provide the information to be shown
- * in a text hover popup window when requested for the given source viewer and
- * the given content type. This implementation always returns <code>
- * null</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @param contentType the content type
- * @return a text hover or <code>null</code> if no hover support should be installed
- */
- public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
- return null;
- }
-
- /**
- * Returns the information control creator. The creator is a factory creating information
- * controls for the given source viewer. This implementation always returns a creator for
- * <code>DefaultInformationControl</code> instances.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @return the information control creator or <code>null</code> if no information support should be installed
- * @since 2.0
- */
- public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
- return new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent);
- }
- };
- }
-
- /**
- * Returns the information presenter which will determine and shown
- * information requested for the current cursor position. This implementation
- * always returns <code>null</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @return an information presenter <code>null</code> if no information presenter should be installed
- * @since 2.0
- */
- public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer) {
- return null;
- }
-
- /**
- * Returns all configured content types for the given source viewer. This list
- * tells the caller which content types must be configured for the given source
- * viewer, i.e. for which content types the given source viewer's functionalities
- * must be specified. This implementation always returns <code>
- * new String[] { IDocument.DEFAULT_CONTENT_TYPE }</code>.
- *
- * @param sourceViewer the source viewer to be configured by this configuration
- * @return the configured content types for the given viewer
- */
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return new String[] { IDocument.DEFAULT_CONTENT_TYPE };
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java
deleted file mode 100644
index 1919b3c..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java
+++ /dev/null
@@ -1,541 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jface.text.source;
-
-
-
-
-import java.util.Iterator;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-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.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-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.ITextViewerExtension3;
-import org.eclipse.jface.text.IViewportListener;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextEvent;
-
-
-/**
- * A vertical ruler which is connected to a text viewer. Single column standard
- * implementation of <code>IVerticalRuler</code>. The same can be achieved by
- * using <code>CompositeRuler</code> configured with an <code>AnnotationRulerColumn</code>.
- * Clients may use this class as is.
- *
- * @see ITextViewer
- */
-public final class VerticalRuler implements IVerticalRuler, IVerticalRulerExtension {
-
- /**
- * Internal listener class.
- */
- class InternalListener implements IViewportListener, IAnnotationModelListener, ITextListener {
-
- /*
- * @see IViewportListener#viewportChanged(int)
- */
- public void viewportChanged(int verticalPosition) {
- if (verticalPosition != fScrollPos)
- redraw();
- }
-
- /*
- * @see IAnnotationModelListener#modelChanged(IAnnotationModel)
- */
- public void modelChanged(IAnnotationModel model) {
- update();
- }
-
- /*
- * @see ITextListener#textChanged(TextEvent)
- */
- public void textChanged(TextEvent e) {
- if (fTextViewer != null && e.getViewerRedrawState())
- redraw();
- }
- };
-
- /** The vertical ruler's text viewer */
- private ITextViewer fTextViewer;
- /** The ruler's canvas */
- private Canvas fCanvas;
- /** The vertical ruler's model */
- private IAnnotationModel fModel;
- /** Cache for the actual scroll position in pixels */
- private int fScrollPos;
- /** The drawable for double buffering */
- private Image fBuffer;
- /** The line of the last mouse button activity */
- private int fLastMouseButtonActivityLine= -1;
- /** The internal listener */
- private InternalListener fInternalListener= new InternalListener();
- /** The width of this vertical ruler */
- private int fWidth;
-
-
- /**
- * Constructs a vertical ruler with the given width.
- *
- * @param width the width of the vertical ruler
- */
- public VerticalRuler(int width) {
- fWidth= width;
- }
-
- /*
- * @see IVerticalRuler#getControl()
- */
- public Control getControl() {
- return fCanvas;
- }
-
- /*
- * @see IVerticalRuler#createControl(Composite, ITextViewer)
- */
- public Control createControl(Composite parent, ITextViewer textViewer) {
-
- fTextViewer= textViewer;
-
- fCanvas= new Canvas(parent, SWT.NO_BACKGROUND);
-
- fCanvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- if (fTextViewer != null)
- doubleBufferPaint(event.gc);
- }
- });
-
- fCanvas.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- handleDispose();
- fTextViewer= null;
- }
- });
-
- fCanvas.addMouseListener(new MouseListener() {
- public void mouseUp(MouseEvent event) {
- }
-
- public void mouseDown(MouseEvent event) {
- fLastMouseButtonActivityLine= toDocumentLineNumber(event.y);
- }
-
- public void mouseDoubleClick(MouseEvent event) {
- fLastMouseButtonActivityLine= toDocumentLineNumber(event.y);
- }
- });
-
- if (fTextViewer != null) {
- fTextViewer.addViewportListener(fInternalListener);
- fTextViewer.addTextListener(fInternalListener);
- }
-
- return fCanvas;
- }
-
- /**
- * Disposes the ruler's resources.
- */
- private void handleDispose() {
-
- if (fTextViewer != null) {
- fTextViewer.removeViewportListener(fInternalListener);
- fTextViewer.removeTextListener(fInternalListener);
- fTextViewer= null;
- }
-
- if (fModel != null)
- fModel.removeAnnotationModelListener(fInternalListener);
-
- if (fBuffer != null) {
- fBuffer.dispose();
- fBuffer= null;
- }
- }
-
-
- /**
- * Double buffer drawing.
- *
- * @param dest the gc to draw into
- */
- private void doubleBufferPaint(GC dest) {
-
- Point size= fCanvas.getSize();
-
- if (size.x <= 0 || size.y <= 0)
- return;
-
- if (fBuffer != null) {
- Rectangle r= fBuffer.getBounds();
- if (r.width != size.x || r.height != size.y) {
- fBuffer.dispose();
- fBuffer= null;
- }
- }
- if (fBuffer == null)
- fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
-
- GC gc= new GC(fBuffer);
- try {
- gc.setBackground(fCanvas.getBackground());
- gc.fillRectangle(0, 0, size.x, size.y);
-
- if (fTextViewer instanceof ITextViewerExtension3)
- doPaint1(gc);
- else
- doPaint(gc);
-
- } finally {
- gc.dispose();
- }
-
- dest.drawImage(fBuffer, 0, 0);
- }
-
- /**
- * Returns the document offset of the upper left corner of the
- * widgets viewport, possibly including partially visible lines.
- *
- * @return the document offset of the upper left corner including partially visible lines
- * @since 2.0
- */
- private int getInclusiveTopIndexStartOffset() {
-
- StyledText textWidget= fTextViewer.getTextWidget();
- if (textWidget != null && !textWidget.isDisposed()) {
- int top= fTextViewer.getTopIndex();
- if ((textWidget.getTopPixel() % textWidget.getLineHeight()) != 0)
- top--;
- try {
- IDocument document= fTextViewer.getDocument();
- return document.getLineOffset(top);
- } catch (BadLocationException ex) {
- }
- }
-
- return -1;
- }
-
- /**
- * Draws the vertical ruler w/o drawing the Canvas background.
- *
- * @param gc the gc to draw into
- */
- protected void doPaint(GC gc) {
-
- if (fModel == null || fTextViewer == null)
- return;
-
- StyledText styledText= fTextViewer.getTextWidget();
- IDocument doc= fTextViewer.getDocument();
-
- int topLeft= getInclusiveTopIndexStartOffset();
- int bottomRight= fTextViewer.getBottomIndexEndOffset();
- int viewPort= bottomRight - topLeft;
-
- Point d= fCanvas.getSize();
- fScrollPos= styledText.getTopPixel();
- int lineheight= styledText.getLineHeight();
-
- int shift= fTextViewer.getTopInset();
-
- int topLine= -1, bottomLine= -1;
- try {
- IRegion region= fTextViewer.getVisibleRegion();
- topLine= doc.getLineOfOffset(region.getOffset());
- bottomLine= doc.getLineOfOffset(region.getOffset() + region.getLength());
- } catch (BadLocationException x) {
- return;
- }
-
- // draw Annotations
- Rectangle r= new Rectangle(0, 0, 0, 0);
- int maxLayer= 1; // loop at least once thru layers.
-
- for (int layer= 0; layer < maxLayer; layer++) {
- Iterator iter= fModel.getAnnotationIterator();
- while (iter.hasNext()) {
- Annotation annotation= (Annotation) iter.next();
-
- int lay= annotation.getLayer();
- maxLayer= Math.max(maxLayer, lay+1); // dynamically update layer maximum
- if (lay != layer) // wrong layer: skip annotation
- continue;
-
- Position position= fModel.getPosition(annotation);
- if (position == null)
- continue;
-
- if (!position.overlapsWith(topLeft, viewPort))
- continue;
-
- try {
-
- int offset= position.getOffset();
- int length= position.getLength();
-
- int startLine= doc.getLineOfOffset(offset);
- if (startLine < topLine)
- startLine= topLine;
-
- int endLine= startLine;
- if (length > 0)
- endLine= doc.getLineOfOffset(offset + length - 1);
- if (endLine > bottomLine)
- endLine= bottomLine;
-
- startLine -= topLine;
- endLine -= topLine;
-
- r.x= 0;
- r.y= (startLine * lineheight) - fScrollPos + shift;
- r.width= d.x;
- int lines= endLine - startLine;
- if (lines < 0)
- lines= -lines;
- r.height= (lines+1) * lineheight;
-
- if (r.y < d.y) // annotation within visible area
- annotation.paint(gc, fCanvas, r);
-
- } catch (BadLocationException e) {
- }
- }
- }
- }
-
- /**
- * Draws the vertical ruler w/o drawing the Canvas background. Uses
- * <code>ITExtViewerExtension3</code> for its implementation. Will replace
- * <code>doPaint(GC)</code>.
- *
- * @param gc the gc to draw into
- */
- protected void doPaint1(GC gc) {
-
- if (fModel == null || fTextViewer == null)
- return;
-
- ITextViewerExtension3 extension= (ITextViewerExtension3) fTextViewer;
- StyledText textWidget= fTextViewer.getTextWidget();
-
- fScrollPos= textWidget.getTopPixel();
- int lineheight= textWidget.getLineHeight();
- Point dimension= fCanvas.getSize();
- int shift= fTextViewer.getTopInset();
-
- // draw Annotations
- Rectangle r= new Rectangle(0, 0, 0, 0);
- int maxLayer= 1; // loop at least once thru layers.
-
- for (int layer= 0; layer < maxLayer; layer++) {
- Iterator iter= fModel.getAnnotationIterator();
- while (iter.hasNext()) {
-
- Annotation annotation= (Annotation) iter.next();
-
- int lay= annotation.getLayer();
- maxLayer= Math.max(maxLayer, lay+1); // dynamically update layer maximum
- if (lay != layer) // wrong layer: skip annotation
- continue;
-
- Position position= fModel.getPosition(annotation);
- if (position == null)
- continue;
-
- IRegion widgetRegion= extension.modelRange2WidgetRange(new Region(position.getOffset(), position.getLength()));
- if (widgetRegion == null)
- continue;
-
- int startLine= extension.widgetLineOfWidgetOffset(widgetRegion.getOffset());
- if (startLine == -1)
- continue;
-
- int endLine= extension.widgetLineOfWidgetOffset(widgetRegion.getOffset() + Math.max(widgetRegion.getLength() -1, 0));
- if (endLine == -1)
- continue;
-
- r.x= 0;
- r.y= (startLine * lineheight) - fScrollPos + shift;
- r.width= dimension.x;
- int lines= endLine - startLine;
- if (lines < 0)
- lines= -lines;
- r.height= (lines+1) * lineheight;
-
- if (r.y < dimension.y) // annotation within visible area
- annotation.paint(gc, fCanvas, r);
- }
- }
- }
-
- /**
- * Thread-safe implementation.
- * Can be called from any thread.
- */
- /*
- * @see IVerticalRuler#update()
- */
- public void update() {
- if (fCanvas != null && !fCanvas.isDisposed()) {
- Display d= fCanvas.getDisplay();
- if (d != null) {
- d.asyncExec(new Runnable() {
- public void run() {
- redraw();
- }
- });
- }
- }
- }
-
- /**
- * Redraws the vertical ruler.
- */
- private void redraw() {
- if (fCanvas != null && !fCanvas.isDisposed()) {
- GC gc= new GC(fCanvas);
- doubleBufferPaint(gc);
- gc.dispose();
- }
- }
-
- /*
- * @see IVerticalRuler#setModel(IAnnotationModel)
- */
- public void setModel(IAnnotationModel model) {
- if (model != fModel) {
-
- if (fModel != null)
- fModel.removeAnnotationModelListener(fInternalListener);
-
- fModel= model;
-
- if (fModel != null)
- fModel.addAnnotationModelListener(fInternalListener);
-
- update();
- }
- }
-
- /*
- * @see IVerticalRuler#getModel()
- */
- public IAnnotationModel getModel() {
- return fModel;
- }
-
- /*
- * @see IVerticalRulerInfo#getWidth()
- */
- public int getWidth() {
- return fWidth;
- }
-
- /*
- * @see IVerticalRulerInfo#getLineOfLastMouseButtonActivity()
- */
- public int getLineOfLastMouseButtonActivity() {
- return fLastMouseButtonActivityLine;
- }
-
- /*
- * @see IVerticalRulerInfo#toDocumentLineNumber(int)
- */
- public int toDocumentLineNumber(int y_coordinate) {
-
- if (fTextViewer == null)
- return -1;
-
- StyledText text= fTextViewer.getTextWidget();
- int line= ((y_coordinate + fScrollPos) / text.getLineHeight());
- return widgetLine2ModelLine(fTextViewer, line);
- }
-
- /**
- * Returns the line of the viewer's document that corresponds to the given widget line.
- *
- * @param viewer the viewer
- * @param widgetLine the widget line
- * @return the corresponding line of the viewer's document
- * @since 2.1
- */
- protected final static int widgetLine2ModelLine(ITextViewer viewer, int widgetLine) {
-
- if (viewer instanceof ITextViewerExtension3) {
- ITextViewerExtension3 extension= (ITextViewerExtension3) viewer;
- return extension.widgetlLine2ModelLine(widgetLine);
- }
-
- try {
- IRegion r= viewer.getVisibleRegion();
- IDocument d= viewer.getDocument();
- return widgetLine += d.getLineOfOffset(r.getOffset());
- } catch (BadLocationException x) {
- }
- return widgetLine;
- }
-
- /*
- * @see IVerticalRulerExtension#setFont(Font)
- * @since 2.0
- */
- public void setFont(Font font) {
- }
-
- /*
- * @see IVerticalRulerExtension#setLocationOfLastMouseButtonActivity(int, int)
- * @since 2.0
- */
- public void setLocationOfLastMouseButtonActivity(int x, int y) {
- fLastMouseButtonActivityLine= toDocumentLineNumber(y);
- }
-
- /**
- * @deprecated will be removed
- * @since 2.0
- */
- public void addMouseListener(MouseListener listener) {
- if (fCanvas != null && !fCanvas.isDisposed())
- fCanvas.addMouseListener(listener);
- }
-
- /**
- * @deprecated will be removed
- * @since 2.0
- */
- public void removeMouseListener(MouseListener listener) {
- if (fCanvas != null && !fCanvas.isDisposed())
- fCanvas.removeMouseListener(listener);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VisualAnnotationModel.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VisualAnnotationModel.java
deleted file mode 100644
index 4010574..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VisualAnnotationModel.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.source;
-
-
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-
-
-
-/**
- * Annotation model for visual annotations. Assume a viewer's input element is annotated with
- * some semantic annotation such as a breakpoint and that it is simultanously shown in multiple
- * viewers. A source viewer, e.g., supports visual range indication for which it utilizes
- * annotations. The range indicating annotation is specific to the visual presentation
- * of the input element in this viewer and thus should only be visible in this viewer. The
- * breakpoints however are independent from the input element's presentation and thus should
- * be shown in all viewers in which the element is shown. As a viewer supports one vertical
- * ruler which is based on one annotation model, there must be a visual annotation model for
- * each viewer which all wrap the same element specific model annotation model.
- */
-class VisualAnnotationModel extends AnnotationModel implements IAnnotationModelListener {
-
- /** The wrapped model annotation model */
- private IAnnotationModel fModel;
-
- /**
- * Constructs a visual annotation model which wraps the given
- * model based annotation model
- *
- * @param modelAnnotationModel the model based annotation model
- */
- public VisualAnnotationModel(IAnnotationModel modelAnnotationModel) {
- fModel= modelAnnotationModel;
- }
-
- /**
- * Returns the visual annotation model's wrapped model based annotation model.
- *
- * @return the model based annotation model
- */
- public IAnnotationModel getModelAnnotationModel() {
- return fModel;
- }
-
- /*
- * @see IAnnotationModel#addAnnotationModelListener(IAnnotationModelListener)
- */
- public void addAnnotationModelListener(IAnnotationModelListener listener) {
-
- if (fModel != null && fAnnotationModelListeners.isEmpty())
- fModel.addAnnotationModelListener(this);
-
- super.addAnnotationModelListener(listener);
- }
-
- /*
- * @see IAnnotationModel#connect(IDocument)
- */
- public void connect(IDocument document) {
- super.connect(document);
- if (fModel != null)
- fModel.connect(document);
- }
-
- /*
- * @see IAnnotationModel#disconnect(IDocument)
- */
- public void disconnect(IDocument document) {
- super.disconnect(document);
- if (fModel != null)
- fModel.disconnect(document);
- }
-
- /*
- * @see IAnnotationModel#getAnnotationIterator()
- */
- public Iterator getAnnotationIterator() {
-
- if (fModel == null)
- return super.getAnnotationIterator();
-
- ArrayList a= new ArrayList(20);
-
- Iterator e= fModel.getAnnotationIterator();
- while (e.hasNext())
- a.add(e.next());
-
- e= super.getAnnotationIterator();
- while (e.hasNext())
- a.add(e.next());
-
- return a.iterator();
- }
-
- /*
- * @see IAnnotationModel#getPosition(Annotation)
- */
- public Position getPosition(Annotation annotation) {
-
- Position p= (Position) fAnnotations.get(annotation);
- if (p != null)
- return p;
-
- if (fModel != null)
- return fModel.getPosition(annotation);
-
- return null;
- }
-
- /*
- * @see IAnnotationModelListener#modelChanged(IAnnotationModel)
- */
- public void modelChanged(IAnnotationModel model) {
- if (model == fModel) {
- int size= fAnnotationModelListeners.size();
- for (int i= 0; i < size; i++) {
- IAnnotationModelListener l= (IAnnotationModelListener) fAnnotationModelListeners.get(i);
- l.modelChanged(this);
- }
- }
- }
-
-
- /**
- * Modifies associated position of the given annotation to the given position.
- * If the annotation is not yet managed by this annotation model, the annotation
- * is added. All annotation model change listeners will be informed about the change.
- *
- * @param annotation the annotation whose associated position should be modified
- * @param position the position to whose values the associated position should be changed
- */
- public void modifyAnnotation(Annotation annotation, Position position) {
- modifyAnnotation(annotation, position, true);
- }
-
- /**
- * Modifies the associated position of the given annotation to the given position.
- * If the annotation is not yet managed by this annotation model, the annotation
- * is added. If requested, all annotation model change listeners will be informed
- * about the change.
- *
- * @param annotation the annotation whose associated position should be modified
- * @param position the position to whose values the associated position should be changed
- * @param fireModelChanged indicates whether to notify all model listeners
- */
- private void modifyAnnotation(Annotation annotation, Position position, boolean fireModelChanged) {
- if (position == null) {
- removeAnnotation(annotation, fireModelChanged);
- } else {
- Position p= (Position) fAnnotations.get(annotation);
- if (p != null) {
- p.setOffset(position.getOffset());
- p.setLength(position.getLength());
- if (fireModelChanged)
- fireModelChanged();
- } else {
- addAnnotation(annotation, position, fireModelChanged);
- }
- }
- }
-
- /*
- * @see IAnnotationModel#removeAnnotationModelListener(IAnnotationModelListener)
- */
- public void removeAnnotationModelListener(IAnnotationModelListener listener) {
- super.removeAnnotationModelListener(listener);
-
- if (fModel != null && fAnnotationModelListeners.isEmpty())
- fModel.removeAnnotationModelListener(this);
- }
-}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/package.html b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/package.html
deleted file mode 100644
index e03b194..0000000
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/package.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.51 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a framework for connecting document regions
-with annotations and for displaying those annotations in combination with
-an <tt>ITextViewer</tt>. <tt>ISourceViewer</tt> combines annotation support
-and all text viewer add-ons.
-<h2>
-Package Specification</h2>
- <tt>ISourceViewer</tt> defines the concept of a document based, editable
-viewer supporting visual annotations. <tt>ISourceViewer</tt> supports document-specific
-and viewer-specific annotations attached to the viewer's input document.
-An <tt>ISourceViewer</tt> uses an <tt>IAnnotationModel</tt> to manage annotations
-and to inform implementers of <tt>IAnnotationModelListener</tt> about changes
-in respect to annotations. An <tt>IVerticalRuler</tt> represents an <tt>IAnnotationModel</tt>
-access adapter for an SWT widget capapble of display annotations.
-This package also provides default implementations for all defined interfaces.
-<br>
-</body>
-</html>
diff --git a/org.eclipse.search/.classpath b/org.eclipse.search/.classpath
deleted file mode 100644
index ca3a068..0000000
--- a/org.eclipse.search/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="search"/>
- <classpathentry kind="src" path="/org.eclipse.core.boot"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.apache.xerces"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.ui"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.search/.cvsignore b/org.eclipse.search/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- 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 f1aac35..0000000
--- a/org.eclipse.search/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.search</name>
- <comment></comment>
- <projects>
- <project>org.apache.xerces</project>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.swt</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.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 9db411a..0000000
--- 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 ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/org.eclipse.search/build.properties b/org.eclipse.search/build.properties
deleted file mode 100644
index b4d9c8e..0000000
--- 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 7822f77..0000000
--- a/org.eclipse.search/buildnotes_search.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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2003%2F02%2F20&chfieldto=2003%2F02%2F27&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2003%2F02%2F18&chfieldto=2003%2F02%2F20&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2003%2F02%2F13&chfieldto=2003%2F02%2F18&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2003%2F02%2F11&chfieldto=2003%2F02%2F13&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2003%2F02%2F07&chfieldto=2003%2F02%2F11&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2003%2F02%2F05&chfieldto=2003%2F02%2F06&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2003%2F01%2F28&chfieldto=2003%2F02%2F05&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2003%2F01%2F21&chfieldto=2003%2F01%2F28&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2003%2F01%2F14&chfieldto=2003%2F01%2F21&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2003%2F01%2F07&chfieldto=2003%2F01%2F14&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F12%2F16&chfieldto=2003%2F01%2F07&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F12%2F13&chfieldto=2002%2F12%2F16&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F12%2F10&chfieldto=2002%2F12%2F13&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F11%2F26&chfieldto=2002%2F12%2F10&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F11%2F19&chfieldto=2002%2F11%2F26&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F11%2F13&chfieldto=2002%2F11%2F19&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F11%2F12&chfieldto=2002%2F11%2F13&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F10%2F29&chfieldto=2002%2F11%2F12&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F10%2F15&chfieldto=2002%2F10%2F29&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F10%2F08&chfieldto=2002%2F10%2F15&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F10%2F01&chfieldto=2002%2F10%2F08&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F09%2F19&chfieldto=2002%2F10%2F01&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F09%2F10&chfieldto=2002%2F09%2F20&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F09%2F03&chfieldto=2002%2F09%2F10&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F08%2F27&chfieldto=2002%2F09%2F03&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F08%2F20&chfieldto=2002%2F08%2F27&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F08%2F13&chfieldto=2002%2F08%2F20&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F07%2F23&chfieldto=2002%2F08%2F13&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F06%2F29&chfieldto=2002%2F07%2F23&product=Platform&component=Search&cmdtype=doit&&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/hglegal2003.htm b/org.eclipse.search/hglegal2003.htm
deleted file mode 100644
index 47c8540..0000000
--- 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 8048478..0000000
--- 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 151fe13..0000000
--- 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 8392f33..0000000
--- 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 9b278e6..0000000
--- 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 12a9167..0000000
--- 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 2c069ab..0000000
--- 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 9ed470d..0000000
--- 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 4eb53ec..0000000
--- 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 6dc3ebe..0000000
--- 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 8b39ab3..0000000
--- 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 4d8cd04..0000000
--- 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 ee26f79..0000000
--- 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 6cbeced..0000000
--- 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 a3441a0..0000000
--- 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 7e0ad4a..0000000
--- 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 7ace43e..0000000
--- 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 8a47d61..0000000
--- 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 7f0f9b9..0000000
--- 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 5fe80f3..0000000
--- 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 d02e028..0000000
--- 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 d1e6b85..0000000
--- 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 1d0b40a..0000000
--- 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 1372957..0000000
--- 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 310510e..0000000
--- 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 33908b1..0000000
--- 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 336c0ec..0000000
--- 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 a519f44..0000000
--- 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 57ed3b4..0000000
--- 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 7425e60..0000000
--- 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 657b67e..0000000
--- 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 e6be562..0000000
--- 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 73ac91b..0000000
--- 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 c786e43..0000000
--- a/org.eclipse.search/ngibmcpy2003.gif
+++ /dev/null
Binary files differ
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 d36c4a7..0000000
--- 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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F06%2F06&chfieldto=2002%2F06%2F18&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F05%2F31&chfieldto=2002%2F06%2F06&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F05%2F28&chfieldto=2002%2F05%2F31&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F05%2F21&chfieldto=2002%2F05%2F28&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F05%2F18&chfieldto=2002%2F05%2F21&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F05%2F14&chfieldto=2002%2F05%2F18&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F05%2F08&chfieldto=2002%2F05%2F14&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F04%2F30&chfieldto=2002%2F05%2F08&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F04%2F23&chfieldto=2002%2F04%2F30&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F04%2F19&chfieldto=2002%2F04%2F23&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F04%2F16&chfieldto=2002%2F04%2F19&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F04%2F11&chfieldto=2002%2F04%2F17&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F04%2F09&chfieldto=2002%2F04%2F12&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F04%2F02&chfieldto=2002%2F04%2F09&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F03%2F19&chfieldto=2002%2F03%2F26&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F03%2F26&chfieldto=2002%2F04%2F02&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F02%2F14&chfieldto=2002%2F02%2F26&product=Platform&component=Search&cmdtype=doit&&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&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F02%2F05&chfieldto=2002%2F02%2F14&product=Platform&component=Search&cmdtype=doit&&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>
-
-</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 f8e4c8b..0000000
--- 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 e7a58b3..0000000
--- a/org.eclipse.search/plugin.xml
+++ /dev/null
@@ -1,194 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ======================================================================= -->
-<!-- Search Plugin -->
-<!-- ======================================================================= -->
-<plugin
- name="%pluginName"
-
- id="org.eclipse.search"
- version="2.1.0"
- provider-name="%providerName"
- class="org.eclipse.search.internal.ui.SearchPlugin">
-
- <requires>
- <import plugin="org.apache.xerces"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.ui"/>
- </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.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"
- 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.workbench.texteditor.markerAnnotationSpecification">
- <specification
- annotationType="org.eclipse.search.results"
- label="%SearchMarkerPreference.label"
- markerType="org.eclipse.search.searchmarker"
- textPreferenceKey="searchResultIndication"
- textPreferenceValue="true"
- overviewRulerPreferenceKey="searchResultIndicationInOverviewRuler"
- overviewRulerPreferenceValue="true"
- colorPreferenceKey="searchResultIndicationColor"
- colorPreferenceValue="192,192,192"
- presentationLayer="3">
- </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 04bc053..0000000
--- a/org.eclipse.search/schema/searchPages.exsd
+++ /dev/null
@@ -1,219 +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. We recommend subclassing
-<samp>org.eclipse.jface.dialogs.DialogPage</samp>.
- </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'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. "50, 60"). 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:
-<ol>
-<li>
-if neither page defines the tab position then they are
-ordered alphabetically according to their labels
-</li>
-<li>
-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.)
-</li>
-<li>
-if only one page has the value specified then this
-page comes first
-</ol>
- </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 "*" can be used.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="showScopeSection" type="boolean">
- <annotation>
- <documentation>
- If this attribute is missing or set to "false", then the scope section is not shown in the Search dialog.
-To see the scope section, this attribute has to be set to "true".
-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 "false", then the page is not initially shown in the Search dialog.
-The page can be activated by the user via the "Customize..." button on the Search dialog.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a search page extension
-definition:
-
-<p>
-<pre>
- <extension point="org.eclipse.search.searchPages">
- <page
- id="org.eclipse.search.ui.text.TextSearchPage"
- label="Text Search"
- icon="icons/full/obj16/tsearch_pref.gif"
- sizeHint="250,160"
- tabPosition="1"
- extensions="*:1"
- showScopeSection="true"
- class="org.eclipse.search.ui.text.TextSearchPage">
- </page>
- </extension>
-</pre>
-</p>
- </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>
- <p>
-<a href="hglegal.htm">
- <img SRC="ngibmcpy.gif"
- ALT="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved."
- BORDER=0 height=14 width=324></a>
-</p>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.search/schema/searchResultSorters.exsd b/org.eclipse.search/schema/searchResultSorters.exsd
deleted file mode 100644
index 724411f..0000000
--- 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'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. "*" 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's label.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="tooltip" type="string">
- <annotation>
- <documentation>
- a translatable text that will be used as the menu
-item'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 <samp>org.eclipse.jface.viewers.ViewerSorter</samp>
- </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:
-<p>
-<pre>
- <extension point="org.eclipse.search.searchResultSorters">
- <sorter
- id="org.eclipse.search.internal.ui.FileNameSorter"
- pageId="*"
- label="%FileNameSorter.label"
- tooltip="%FilenNameSorter.tooltip"
- icon="icons/full/ecl16/search_sort.gif"
- class="org.eclipse.search.internal.ui.FileNameSorter">
- </sorter>
- </extension>
-</pre>
-</p>
- </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>
- <p>
-<a href="hglegal.htm">
- <img SRC="ngibmcpy.gif"
- ALT="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved."
- BORDER=0 height=14 width=324></a>
-</p>
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.search/scripts/exportplugin.xml b/org.eclipse.search/scripts/exportplugin.xml
deleted file mode 100644
index fafcb59..0000000
--- 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="_2.1.0" />
- <property name="dest" value="${destdir}/${plugin}${version}" />
- </target>
-
- <target name="build" depends="init">
- <eclipse.incrementalBuild project="${plugin}" kind="incr"/>
- </target>
-
- <target name="export" depends="build">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/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 1400e4a..0000000
--- 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 c2ee4b6..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/SearchScope.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.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]);
- }
-
- /*
- * @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 5a20009..0000000
--- 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 e2caed1..0000000
--- 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/TextSearchEngine.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngine.java
deleted file mode 100644
index 93cc3a0..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngine.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.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, String pattern, String options, ISearchScope scope, ITextSearchResultCollector collector) {
- Assert.isNotNull(workspace);
- Assert.isNotNull(pattern);
- Assert.isNotNull(scope);
- Assert.isNotNull(collector);
-
- 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(pattern, options, 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 b39efca..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchScope.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.core.text;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-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;
-import org.eclipse.search.internal.ui.util.StringMatcher;
-
-/**
- * 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) {
- fExtensions.add(new StringMatcher(extension, true, false));
- }
- /**
- * 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 (((StringMatcher)iter.next()).match(proxy.getName()))
- 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 (((StringMatcher)iter.next()).match(file.getName()))
- 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 38805f4..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-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;
-
-import org.eclipse.search.ui.SearchUI;
-
-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.internal.ui.util.StringMatcher;
-
-/**
- * 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 String fPattern;
- private ISearchScope fScope;
- private ITextSearchResultCollector fCollector;
- private String fOptions;
- private IEditorPart[] fDirtyEditors;
-
- private IProgressMonitor fProgressMonitor;
- private StringMatcher fMatcher;
- private Integer[] fMessageFormatArgs;
-
- private int fNumberOfScannedFiles;
- private int fNumberOfFilesToScan;
- private long fLastUpdateTime;
-
- protected int fPushbackChar;
- protected boolean fPushback;
-
-
- public TextSearchVisitor(String pattern, String options, ISearchScope scope, ITextSearchResultCollector collector, MultiStatus status, int fileCount) {
- super(status);
- fPattern= pattern;
- fScope= scope;
- fCollector= collector;
- fPushback= false;
- if (options != null)
- fOptions= options;
- else
- fOptions= ""; //$NON-NLS-1$
-
- fProgressMonitor= collector.getProgressMonitor();
- fMatcher= new StringMatcher(pattern, options.indexOf('i') != -1, false);
- 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 dirty editor parts.
- */
- public static IEditorPart[] getDirtyEditors() {
- 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++) {
- IEditorPart[] editors= pages[x].getDirtyEditors();
- for (int z= 0; z < editors.length; z++) {
- IEditorPart ep= editors[z];
- 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 (fPattern.length() == 0) {
- fCollector.accept(proxy, "", -1, 0, -1); //$NON-NLS-1$
- updateProgressMonitor();
- return true;
- }
- IFile file= (IFile)proxy.requestResource();
- try {
- BufferedReader reader= null;
- ITextEditor editor= findDirtyEditorFor(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()));
- }
- 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();
- StringMatcher.Position match;
- while (start < lineLength) {
- if ((match= fMatcher.find(line, start, lineLength)) != null) {
- start= charCounter + match.getStart();
- int length= match.getEnd() - match.getStart();
- fCollector.accept(proxy, line.trim(), start, length, lineCounter);
- start= match.getEnd();
- }
- else // no match in this line
- start= lineLength;
- }
- charCounter+= lineLength + eolStrLength;
- lineCounter++;
- if (fProgressMonitor.isCanceled())
- throw new OperationCanceledException(SearchMessages.getString("TextSearchVisitor.canceled")); //$NON-NLS-1$
- }
- } finally {
- if (reader != null)
- reader.close();
- }
- } 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 findDirtyEditorFor(IFile file) {
- int i= 0;
- while (i < fDirtyEditors.length) {
- IEditorPart dirtyEditor= fDirtyEditors[i];
- IEditorInput input= dirtyEditor.getEditorInput();
- if (input instanceof IFileEditorInput && dirtyEditor instanceof ITextEditor)
- if (((IFileEditorInput)input).getFile().equals(file))
- return (ITextEditor)dirtyEditor;
- i++;
- }
- return null;
- }
-
- protected int readLine(BufferedReader 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;
- }
-
- /*
- * @see IResourceProxyVisitor#visit(IResourceProxy)
- */
- public boolean visit(IResourceProxy proxy) {
- fDirtyEditors= getDirtyEditors();
- 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 6188516..0000000
--- 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 b1b4770..0000000
--- 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 3050af6..0000000
--- 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 9fde0e9..0000000
--- 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 1c4f4ee..0000000
--- 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 ce38d4d..0000000
--- 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 08ffc5b..0000000
--- 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 178ccba..0000000
--- 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 98abd6a..0000000
--- 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 7ba3a08..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemovePotentialMatchesAction.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.ui;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-
-import org.eclipse.ui.IWorkbenchSite;
-
-import org.eclipse.search.ui.SearchUI;
-
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
-class RemovePotentialMatchesAction extends Action {
-
- IWorkbenchSite fSite;
-
- public RemovePotentialMatchesAction(IWorkbenchSite site) {
- super(SearchMessages.getString("RemovePotentialMatchesAction.removePotentialMatches.text")); //$NON-NLS-1$
- setToolTipText(SearchMessages.getString("RemovePotentialMatchesAction.removePotentialMatches.tooltip")); //$NON-NLS-1$
- fSite= site;
- }
-
- 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() {
- IMarker[] markers;
- try {
- markers= SearchPlugin.getWorkspace().getRoot().findMarkers(SearchUI.SEARCH_MARKER, true, IResource.DEPTH_INFINITE);
- } catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.findMarkers.title"), SearchMessages.getString("Search.Error.findMarkers.message")); //$NON-NLS-2$ //$NON-NLS-1$
- return null;
- }
-
- ArrayList potentialMatches= new ArrayList(markers.length);
- for (int i= 0; i < markers.length; i++) {
- if (markers[i].getAttribute(SearchUI.POTENTIAL_MATCH, false))
- potentialMatches.add(markers[i]);
- }
- if (potentialMatches.size() == 0)
- return null;
-
- return (IMarker[])potentialMatches.toArray(new IMarker[potentialMatches.size()]);
- }
-}
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 4922292..0000000
--- 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 3019eb3..0000000
--- 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 2cdd661..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-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.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.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-
-import org.eclipse.search.ui.ISearchPageContainer;
-
-import org.eclipse.search.internal.ui.util.SWTUtil;
-
-public class ScopePart {
-
- // The possible scopes
- public static final int WORKSPACE_SCOPE= 0;
- public static final int SELECTION_SCOPE= 1;
- public static final int WORKING_SET_SCOPE= 2;
-
- // 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 fUseWorkingSet;
-
-
- private int fScope;
- 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() {
- this(WORKSPACE_SCOPE);
- }
-
- /**
- * Returns a new scope part with workspace as initial scope.
- * The part is not yet created.
- */
- public ScopePart(ISearchPageContainer searchPageContainer) {
- this(getStoredScope());
- fSearchPageContainer= searchPageContainer;
- }
-
- private static int getStoredScope() {
- int scope;
- try {
- scope= fgSettingsStore.getInt(STORE_SCOPE);
- } catch (NumberFormatException ex) {
- scope= WORKSPACE_SCOPE;
- }
- if (scope != WORKING_SET_SCOPE && scope != SELECTION_SCOPE && scope != WORKSPACE_SCOPE)
- scope= WORKSPACE_SCOPE;
- return scope;
- }
-
- /**
- * Returns a new scope part with an initial scope.
- * The part is not yet created.
- *
- * @see #createPart(Composite)
- * @param initialScope the initial scope
- */
- public ScopePart(int initialScope) {
- Assert.isLegal(initialScope >= 0 && initialScope <= 3);
- fScope= initialScope;
- restoreState();
- }
-
- 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 a new scope part with an initial working set.
- * The part is not yet created.
- *
- * @see #createPart(Composite)
- * @param workingSet the initial working set
- */
- public ScopePart(IWorkingSet[] workingSets) {
- Assert.isNotNull(workingSets);
- fScope= WORKING_SET_SCOPE;
- fWorkingSets= workingSets;
- }
-
- /**
- * 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);
- fScope= scope;
- switch (fScope) {
- case WORKSPACE_SCOPE:
- fUseWorkspace.setSelection(true);
- fUseSelection.setSelection(false);
- fUseWorkingSet.setSelection(false);
- break;
- case SELECTION_SCOPE:
- fUseWorkspace.setSelection(false);
- fUseSelection.setSelection(true);
- fUseWorkingSet.setSelection(false);
- break;
- case WORKING_SET_SCOPE:
- fUseWorkspace.setSelection(false);
- fUseSelection.setSelection(false);
- fUseWorkingSet.setSelection(true);
- break;
- }
-
- updateSearchPageContainerActionPerformedEnablement();
- fgSettingsStore.put(STORE_SCOPE, fScope);
- }
-
- private void updateSearchPageContainerActionPerformedEnablement() {
- boolean newState= fScope != 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() == 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(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= 3;
- fPart.setLayout(layout);
- fPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- fUseWorkspace= new Button(fPart, SWT.RADIO);
- fUseWorkspace.setData(new Integer(WORKSPACE_SCOPE));
- fUseWorkspace.setText(SearchMessages.getString("ScopePart.workspaceScope.text")); //$NON-NLS-1$
-
- fUseSelection= new Button(fPart, SWT.RADIO);
- fUseSelection.setData(new Integer(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.horizontalSpan= 2;
- gd.horizontalIndent= 8;
- fUseSelection.setLayoutData(gd);
-
- fUseWorkingSet= new Button(fPart, SWT.RADIO);
- fUseWorkingSet.setData(new Integer(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(WORKING_SET_SCOPE);
- }
- }
- });
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalIndent= 8;
- gd.widthHint= SWTUtil.convertWidthInCharsToPixels(30, fWorkingSetText);
- fWorkingSetText.setLayoutData(gd);
-
- // Add scope change listeners
- SelectionAdapter scopeChangedLister= new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleScopeChanged(e);
- }
- };
- fUseWorkspace.addSelectionListener(scopeChangedLister);
- fUseSelection.addSelectionListener(scopeChangedLister);
- fUseWorkingSet.addSelectionListener(scopeChangedLister);
-
- // Set initial scope
- setSelectedScope(fScope);
-
- // Set initial working set
- if (fWorkingSets != null)
- fWorkingSetText.setText(toString(fWorkingSets));
-
- return fPart;
- }
-
- 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 == WORKING_SET_SCOPE)
- setSelectedScope(WORKSPACE_SCOPE);
- return false;
- } else {
- // test if selected working set has been removed
- if (!Arrays.asList(PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets()).contains(fWorkingSets)) {
- 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 9a78101..0000000
--- 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 304d838..0000000
--- 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 4f5dbaa..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.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.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.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.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-import org.eclipse.search.ui.ISearchPage;
-import org.eclipse.search.ui.ISearchPageContainer;
-import org.eclipse.search.ui.ISearchPageScoreComputer;
-
-import org.eclipse.search.internal.ui.util.ExtendedDialogWindow;
-import org.eclipse.search.internal.ui.util.ListContentProvider;
-import org.eclipse.search.internal.ui.util.SWTUtil;
-
-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 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;
- Button fCustomizeButton;
-
- public SearchDialog(Shell shell, IWorkspace workspace, ISelection selection, IEditorPart editor, String pageId) {
- super(shell);
- Assert.isNotNull(workspace);
- fWorkspace= workspace;
- setPerformActionLabel(SearchMessages.getString("SearchDialog.performAction")); //$NON-NLS-1$
- 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() == ListSelectionDialog.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);
- GridLayout layout= new GridLayout();
- layout.marginWidth= 7;
- layout.marginHeight= 7;
- border.setLayout(layout);
-
- TabFolder folder= new TabFolder(border, SWT.NONE);
- folder.setLayoutData(new GridData(GridData.FILL_BOTH));
- 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 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(IDialogConstants.FINISH_ID).setEnabled(fDescriptors.size() > 0);
- applyDialogFont(result);
- return result;
- }
-
- protected boolean performAction() {
- 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);
- return fCurrentPage.performAction();
- } 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;
- 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();
- fCurrentIndex= item.getParent().getSelectionIndex();
- resizeDialogIfNeeded(item.getControl());
- fCurrentPage.setVisible(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 ScopePart.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) {
- if (page.getControl() == null) {
- // Page wrapper
- Composite pageWrapper= new Composite(parent, SWT.NONE);
- GridLayout layout= new GridLayout();
- pageWrapper.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- layout.marginWidth= 0;
- layout.marginHeight= 0;
- pageWrapper.setLayout(layout);
-
- // The page itself
- page.createControl(pageWrapper);
-
- // Search scope
- boolean showScope= getDescriptorAt(index).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);
- Control part= fScopeParts[index].createPart(c);
- applyDialogFont(part);
- fScopeParts[index].setVisible(true);
- }
- }
- return page.getControl().getParent();
- }
-
- private void resizeDialogIfNeeded(Control newControl) {
- Point currentSize= fCurrentPage.getControl().getSize();
- Point newSize= newControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- if (mustResize(currentSize, newSize)) {
- Shell shell= getShell();
- shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, 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 584625e..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDropDownAction.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.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 SearchResultViewer fViewer;
- private Menu fMenu;
-
- public SearchDropDownAction(SearchResultViewer viewer) {
- fViewer= viewer;
- 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();
-
- fViewer= 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);
- }
-}
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 bd8160f..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchManager.java
+++ /dev/null
@@ -1,533 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.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 fIsNewSearch= false;
- 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() {
- 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();
- viewer.setContextMenuTarget(null);
- viewer.setActionGroupFactory(null);
- viewer.setInput(null);
- }
- }
-
- void setCurrentSearch(final Search search) {
- if (fCurrentSearch == search)
- return;
-
- SearchPlugin.getWorkspace().removeResourceChangeListener(this);
- WorkspaceModifyOperation op= new WorkspaceModifyOperation() {
- 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(Search newSearch) {
- // 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());
- viewer.handleRemoveAll();
- viewer.clearTitle();
-
- }
- });
- }
- }
-
- 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 setCurrentResults(ArrayList results) {
- Assert.isNotNull(results);
- ((Search)getCurrentSearch()).setResults(results);
- if (results.isEmpty()) {
- // directly update because there will be no delta
- Display display= getDisplay();
- if (display == null || display.isDisposed())
- return;
- display.syncExec(new Runnable() {
- public void run() {
- handleNewSearchResult();
- }
- });
- }
- else
- fIsNewSearch= true;
- }
-
- //--- Change event handling -------------------------------------------------
-
- void addSearchChangeListener(SearchResultViewer viewer) {
- fListeners.add(viewer);
- }
-
- void removeSearchChangeListener(SearchResultViewer viewer) {
- Assert.isNotNull(viewer);
- fListeners.remove(viewer);
- }
-
- private final void handleSearchMarkersChanged(final IResourceChangeEvent event, IMarkerDelta[] markerDeltas) {
- if (fIsNewSearch) {
- fIsNewSearch= false;
- handleNewSearchResult();
- return;
- }
- 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();
- if ((kind & IResourceDelta.ADDED) != 0)
- handleAddMatch(markerDelta.getMarker());
- else if (((kind & IResourceDelta.REMOVED) != 0))
- handleRemoveMatch(markerDelta.getMarker());
- else if ((kind & IResourceDelta.CHANGED) != 0)
- handleUpdateMatch(markerDelta.getMarker());
- }
-
- private void handleRemoveAll() {
- if (fCurrentSearch != null)
- ((Search)fCurrentSearch).removeResults();
- Iterator iter= fListeners.iterator();
- while (iter.hasNext())
- ((SearchResultViewer)iter.next()).handleRemoveAll();
- }
-
- private void handleAddMatch(IMarker marker) {
- Object groupByKey= getCurrentSearch().getGroupByKeyComputer().computeGroupByKey(marker);
- SearchResultViewEntry entry= findEntry(groupByKey);
- if (entry == null) {
- entry= new SearchResultViewEntry(groupByKey, marker.getResource());
- getCurrentResults().add(entry);
- entry.add(marker);
- Iterator iter= fListeners.iterator();
- while (iter.hasNext())
- ((SearchResultViewer)iter.next()).handleAddMatch(entry);
- }
- else {
- entry.add(marker);
- Iterator iter= fListeners.iterator();
- while (iter.hasNext())
- ((SearchResultViewer)iter.next()).handleUpdateMatch(entry, false);
- }
- }
-
- private void handleNewSearchResult() {
- Iterator iter= fListeners.iterator();
- final Search search= getCurrentSearch();
- while (iter.hasNext()) {
- SearchResultViewer viewer= (SearchResultViewer)iter.next();
- viewer.setPageId(search.getPageId());
- viewer.setGotoMarkerAction(search.getGotoMarkerAction());
- viewer.setContextMenuTarget(search.getContextMenuContributor());
- viewer.setActionGroupFactory(null);
- viewer.setInput(getCurrentResults());
- 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;
- }
-
- private SearchResultViewEntry findEntry(Object key) {
- if (key == null)
- return null;
- Iterator entries= getCurrentResults().iterator();
- while (entries.hasNext()) {
- SearchResultViewEntry entry= (SearchResultViewEntry)entries.next();
- if (key.equals(entry.getGroupByKey()))
- 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() {
- handleSearchMarkersChanged(event, 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 2f9d75e..0000000
--- 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 9cc3468..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties
+++ /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
-###############################################################################
-
-SearchDialog.title= Search
-SearchDialog.performAction= &Search
-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
-
-ScopePart.group.text=Scope
-ScopePart.selectedResourcesScope.text=Selecte&d Resources
-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.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.error.unable_to_perform= Replace operation can\'t be performed.
-ReplaceAction.error.changed_file= The content of the following file has changed. Please redo the search to ensure that all matches are correct.
-ReplaceAction.error.changed_files= The content of the following files have changed. Please redo the search to ensure that all matches are correct.
-ReplaceAction.error.opened_file= The following file is open in an editor that the replace operation cannot handle. Please close the editor.
-ReplaceAction.error.opened_files= The following files are open in editors that the replace operation cannot handle. Please close the editors.
-ReplaceAction.error.not_file= The following resource is not a file and cannot be handled. Please exclude it from the replace operation.
-ReplaceAction.error.not_files= The following resources are not files and cannot be handled. Please exclude them from the replace operation.
-ReplaceAction.dialog.title= Replace
-
-ReplaceDialog.replace_label= Replace:
-ReplaceDialog.with_label= &With:
-ReplaceDialog.replace_next= Re&place/Next
-ReplaceDialog.replace= &Replace
-ReplaceDialog.next= &Next
-ReplaceDialog.close= &Close
-ReplaceDialog.save_changes=Automatically &save changes
-ReplaceDialog.dialog.title= Replace
-ReplaceDialog.error.unexpected_exception=Unexpected exception during replace operation.
-ReplaceDialog.error.different_content= File content differs from search result.
-ReplaceDialog.error.reenable_auto_build_failed=Couldn\'t reactivate auto building.
-ReplaceDialog.error.auto_building= Couldn\'t disable auto building.
-ReplaceDialog.error.no_matches= Couldn\'t find first match.
-ReplaceDialog.error.no_file_for_marker=Current match is not associated with a file. It is not possible to open an editor.
-ReplaceDialog.error.unable_to_open_text_editor=It is not possible to open the built-in text editor for file ''{0}''.
-
-SelectAllAction.label= Select A&ll
-SelectAllAction.tooltip= Select All
-
-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
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 78fc557..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPageDescriptor.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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 ENABLED_ATTRIBUTE= "enabled"; //$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 IConfigurationElement fElement;
-
- private static class ExtensionScorePair {
- public String extension;
- public int score;
- public ExtensionScorePair(String extension, int score) {
- this.extension= extension;
- this.score= score;
- }
- }
- 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 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());
- }
-
- 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 8a0c618..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.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 {
- return (getActivePage().showView(SearchUI.SEARCH_RESULT_VIEW_ID) != null);
- } 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;
- }
-
- /**
- * 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 54331cc..0000000
--- 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 8df06ac..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.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.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$
-
- 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(DEFAULT_PERSPECTIVE, NO_DEFAULT_PERSPECTIVE);
- }
-
- public static boolean isEditorReused() {
- IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
- return store.getBoolean(REUSE_EDITOR);
- }
-
- 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);
-
- 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 86f69cf..0000000
--- 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 c55d2ef..0000000
--- 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 07f95b3..0000000
--- 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.IWorkbenchActionConstants;
-import org.eclipse.ui.PartInitException;
-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(), ISearchHelpContextIds.SEARCH_VIEW);
- }
-
- /**
- * 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(IWorkbenchActionConstants.SELECT_ALL, 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().setCurrentResults(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 9d536a3..0000000
--- 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 7acaaf1..0000000
--- 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 9218143..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java
+++ /dev/null
@@ -1,694 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.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.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.ActionGroup;
-
-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;
-
- 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(this);
- 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(IWorkbenchActionConstants.NEXT, fShowNextResultAction);
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, 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(getTable(), 0);
- }
-
- 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() {
- ISelection selection= getSelection();
- if (selection instanceof IStructuredSelection) {
- Object entry= ((IStructuredSelection)selection).getFirstElement();
- if (entry instanceof ISearchResultViewEntry) {
- IMarker marker= ((ISearchResultViewEntry)entry).getSelectedMarker();
- return marker != null && marker.getAttribute(SearchUI.POTENTIAL_MATCH, false);
- }
- }
- 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) {
- 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(table, 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(table, index);
- }
- entry.setSelectedMarkerIndex(fMarkerToShow);
- openCurrentSelection();
- updateStatusLine();
- }
-
- private boolean canDoShowResult(Table table) {
- if (table == null || getItemCount() == 0)
- return false;
- return true;
- }
-
- private void selectResult(Table table, 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 == null || !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();
- }
-}
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 6ee7c50..0000000
--- 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 4340824..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowNextResultAction.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 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;
- }
-
- 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 97e1578..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowPreviousResultAction.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 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$
- 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 969e085..0000000
--- 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 756fc19..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.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.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.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() == ListDialog.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 55ea5b7..0000000
--- 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 d1e572f..0000000
--- 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 f660f3c..0000000
--- 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 dabcb4b..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/GotoMarkerAction.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.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.IReusableEditor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-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= SearchPlugin.getDefault().getWorkbench().getEditorRegistry().getDefaultEditor((IFile)resource);
- if (desc == null)
- editorId= SearchPlugin.getDefault().getWorkbench().getEditorRegistry().getDefaultEditor().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) {
- editor.gotoMarker(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 {
- page.openEditor(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 61e207f..0000000
--- 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 b0855cd..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceAction.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.text;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-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.ListDialog;
-
-/* 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() {
- if (validateResources()) {
- Search search= SearchManager.getDefault().getCurrentSearch();
- IRunnableWithProgress operation= search.getOperation();
- if (operation instanceof TextSearchOperation) {
- ReplaceDialog dialog= new ReplaceDialog(fSite.getShell(), fElements, fSite.getWorkbenchWindow(), ((TextSearchOperation)operation).getPattern());
- dialog.open();
- } else {
- MessageDialog.openError(fSite.getShell(), getDialogTitle(), SearchMessages.getString("ReplaceAction.error.only_on_text_search")); //$NON-NLS-1$
- }
- }
- }
-
- private boolean validateResources() {
- List modifiedFiles= new ArrayList();
- List openedFilesInNonTextEditor= new ArrayList();
- List notFiles= new ArrayList();
- IWorkbenchPage activePage = fSite.getWorkbenchWindow().getActivePage();
-
- for (Iterator iter = fElements.iterator(); iter.hasNext();) {
- SearchResultViewEntry entry= (SearchResultViewEntry) iter.next();
- IResource resource= entry.getResource();
- if (resource instanceof IFile) {
- IFile file= (IFile)resource;
- if (file.getModificationStamp() != entry.getModificationStamp() || !file.isSynchronized(IResource.DEPTH_ZERO)) {
- modifiedFiles.add(resource);
- } else if (activePage != null) {
- IEditorPart part= activePage.findEditor(new FileEditorInput(file));
- if (part != null && !(part instanceof ITextEditor))
- openedFilesInNonTextEditor.add(file);
- }
- } else {
- if (resource != null)
- notFiles.add(resource);
- }
- }
- if (!modifiedFiles.isEmpty()) {
- showModifiedFileDialog(modifiedFiles);
- return false;
- }
- if (!openedFilesInNonTextEditor.isEmpty()) {
- showOpenedFileDialog(openedFilesInNonTextEditor);
- return false;
- }
- if (!notFiles.isEmpty()) {
- showNotFilesDialog(openedFilesInNonTextEditor);
- return false;
- }
- IFile[] readOnlyFiles= getReadOnlyFiles();
- if (readOnlyFiles.length == 0)
- return true;
- Map currentStamps= createModificationStampMap(readOnlyFiles);
- IStatus status= ResourcesPlugin.getWorkspace().validateEdit(readOnlyFiles, fSite.getShell());
- if (!status.isOK()) {
- ErrorDialog.openError(fSite.getShell(), getDialogTitle(), SearchMessages.getString("ReplaceAction.error.unable_to_perform"), status); //$NON-NLS-1$
- return false;
- }
- modifiedFiles= new ArrayList();
- Map newStamps= createModificationStampMap(readOnlyFiles);
- for (Iterator iter= currentStamps.keySet().iterator(); iter.hasNext();) {
- IFile file= (IFile) iter.next();
- if (! currentStamps.get(file).equals(newStamps.get(file))) {
- modifiedFiles.add(file);
- }
- }
- if (!modifiedFiles.isEmpty()) {
- showModifiedFileDialog(modifiedFiles);
- return false;
- }
- return true;
- }
-
- private void showModifiedFileDialog(List modifiedFiles) {
- String message= (modifiedFiles.size() == 1
- ? SearchMessages.getString("ReplaceAction.error.changed_file") //$NON-NLS-1$
- : SearchMessages.getString("ReplaceAction.error.changed_files")); //$NON-NLS-1$
- ListDialog dialog= new ListDialog(fSite.getShell(), modifiedFiles, getDialogTitle(),
- message,
- new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- return ((List)inputElement).toArray();
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- },
- new WorkbenchLabelProvider());
- dialog.setCreateCancelButton(false);
- dialog.open();
- }
-
- private IFile[] getReadOnlyFiles() {
- List result= new ArrayList();
- for (Iterator iter = fElements.iterator(); iter.hasNext();) {
- IResource resource= ((SearchResultViewEntry) iter.next()).getResource();
- if (resource instanceof IFile && resource.isReadOnly())
- result.add(resource);
- }
- return (IFile[]) result.toArray(new IFile[result.size()]);
- }
-
- private static Map createModificationStampMap(IFile[] files){
- Map map= new HashMap();
- for (int i= 0; i < files.length; i++) {
- IFile file= files[i];
- map.put(file, new Long(file.getModificationStamp()));
- }
- return map;
- }
-
- private String getDialogTitle() {
- return SearchMessages.getString("ReplaceAction.dialog.title"); //$NON-NLS-1$
- }
-
- private void showOpenedFileDialog(List openedFilesInNonTextEditor) {
- String message= (openedFilesInNonTextEditor.size() == 1
- ? SearchMessages.getString("ReplaceAction.error.opened_file") //$NON-NLS-1$
- : SearchMessages.getString("ReplaceAction.error.opened_files")); //$NON-NLS-1$
- ListDialog dialog= new ListDialog(fSite.getShell(), openedFilesInNonTextEditor, getDialogTitle(),
- message,
- new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- return ((List)inputElement).toArray();
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- },
- new WorkbenchLabelProvider());
- dialog.setCreateCancelButton(false);
- dialog.open();
- }
-
- private void showNotFilesDialog(List notFiles) {
- String message= (notFiles.size() == 1
- ? SearchMessages.getString("ReplaceAction.error.not_file") //$NON-NLS-1$
- : SearchMessages.getString("ReplaceAction.error.not_files")); //$NON-NLS-1$
- ListDialog dialog= new ListDialog(fSite.getShell(), notFiles, getDialogTitle(),
- message,
- new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- return ((List)inputElement).toArray();
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- },
- new WorkbenchLabelProvider());
- dialog.setCreateCancelButton(false);
- dialog.open();
- }
-}
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 b575bc2..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceDialog.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.core.resources.IMarker;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-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.Text;
-
-import org.eclipse.jface.dialogs.Dialog;
-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.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.GlobalBuildAction;
-import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-import org.eclipse.search.ui.ISearchResultView;
-
-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.util.ExceptionHandler;
-
-public class ReplaceDialog extends Dialog {
-
- private static final int REPLACE_NEXT= IDialogConstants.CLIENT_ID;
- private static final int REPLACE= IDialogConstants.CLIENT_ID + 1;
- private static final int NEXT= IDialogConstants.CLIENT_ID + 2;
-
- private String fSearchPattern;
-
- private IWorkbenchWindow fWindow;
- private boolean fAutobuild;
- private boolean fFatalError;
-
- // UI
- private Text fTextField;
- private Button fSaveButton;
- private Button fReplaceNextButton;
- private Button fReplaceButton;
- private Button fNextButton;
-
-
- private boolean fSaved;
- private ITextEditor fEditor;
- private boolean fCloseEditor;
- private IDocument fDocument;
- private AbstractMarkerAnnotationModel fAnnotationModel;
-
-
- private List fElements;
- private int fElementIndex;
- private SearchResultViewEntry fCurrentEntry;
- private List fCurrentMarkers;
- private int fMarkerIndex;
- private IMarker fCurrentMatch;
-
- private static class MarkerNotPresentableException extends Exception {
- private IFile fFile;
- MarkerNotPresentableException(IFile file) {
- fFile= file;
- }
- public IFile getFile() {
- return fFile;
- }
- }
-
- protected ReplaceDialog(Shell parentShell, List elements, IWorkbenchWindow window, String searchPattern) {
- super(parentShell);
- Assert.isNotNull(elements);
- Assert.isNotNull(searchPattern);
- fElements= new ArrayList(elements);
- Assert.isNotNull(window);
- fWindow= window;
- fSearchPattern= searchPattern;
- }
-
- public void create() {
- super.create();
- Shell shell= getShell();
- shell.setText(getDialogTitle());
- updateButtons();
- }
-
- public int open() {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- fAutobuild= workspace.isAutoBuilding();
- if (fAutobuild) {
- IWorkspaceDescription description= workspace.getDescription();
- description.setAutoBuilding(false);
- try {
- workspace.setDescription(description);
- } catch (CoreException e) {
- ExceptionHandler.handle(e, getShell(), getDialogTitle(), SearchMessages.getString("ReplaceDialog.error.auto_building")); //$NON-NLS-1$
- fFatalError= true;
- }
- }
- try {
- fCurrentMatch= getNextMatch(false);
- } catch (CoreException e) {
- ExceptionHandler.handle(e, getShell(), getDialogTitle(), SearchMessages.getString("ReplaceDialog.error.no_matches")); //$NON-NLS-1$
- fFatalError= true;
- } catch (MarkerNotPresentableException e) {
- handleMarkerNotPresentableException(e);
- fFatalError= true;
- }
- return super.open();
- }
-
- public boolean close() {
- boolean result= super.close();
- restoreAutoBuildState();
- return result;
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite result= (Composite)super.createDialogArea(parent);
- GridLayout layout= (GridLayout)result.getLayout();
- layout.numColumns= 2;
-
- initializeDialogUnits(result);
-
- Label label= new Label(result, SWT.NONE);
- label.setText(SearchMessages.getString("ReplaceDialog.replace_label")); //$NON-NLS-1$
-
- CLabel clabel= new CLabel(result, SWT.NONE);
- clabel.setText(fSearchPattern);
- 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();
-
- fSaveButton= new Button(result, SWT.CHECK);
- fSaveButton.setText(SearchMessages.getString("ReplaceDialog.save_changes")); //$NON-NLS-1$
- fSaveButton.setSelection(true);
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan= 2;
- fSaveButton.setLayoutData(gd);
-
- applyDialogFont(result);
- return result;
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- fReplaceNextButton= createButton(parent, REPLACE_NEXT, SearchMessages.getString("ReplaceDialog.replace_next"), false); //$NON-NLS-1$
- fReplaceButton= createButton(parent, REPLACE, SearchMessages.getString("ReplaceDialog.replace"), false); //$NON-NLS-1$
- fNextButton= createButton(parent, NEXT, SearchMessages.getString("ReplaceDialog.next"), false); //$NON-NLS-1$
- createButton(parent, IDialogConstants.CANCEL_ID, SearchMessages.getString("ReplaceDialog.close"), false); //$NON-NLS-1$
- }
-
- 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;
- }
-
- protected void buttonPressed(int buttonId) {
- try {
- boolean save= fSaveButton.getSelection();
- String text= fTextField.getText();
- switch(buttonId) {
- case REPLACE_NEXT:
- replace(fCurrentMatch, text, save);
- fCurrentMatch= getNextMatch(save);
- break;
- case REPLACE:
- replace(fCurrentMatch, text, save);
- fCurrentMatch= null;
- break;
- case NEXT:
- fCurrentMatch= getNextMatch(save);
- break;
- case IDialogConstants.CANCEL_ID:
- saveEditor(save);
- break;
- }
- } catch (CoreException e) {
- ExceptionHandler.handle(e, getShell(), getDialogTitle(), SearchMessages.getString("ReplaceDialog.error.unexpected_exception")); //$NON-NLS-1$
- fFatalError= true;
- } catch (BadLocationException e) {
- MessageDialog.openError(getShell(), getDialogTitle(), SearchMessages.getString("ReplaceDialog.error.different_content")); //$NON-NLS-1$
- fFatalError= true;
- } catch (MarkerNotPresentableException e) {
- handleMarkerNotPresentableException(e);
- fFatalError= true;
- }
- updateButtons();
- super.buttonPressed(buttonId);
- }
-
- private void replace(IMarker source, String text, boolean save) throws CoreException, BadLocationException {
- Position position= fAnnotationModel.getMarkerPosition(source);
- fDocument.replace(position.getOffset(), position.getLength(), text);
- SearchPlugin.getWorkspace().deleteMarkers(new IMarker[] {source});
- }
-
- private boolean hasNextMatch() {
- if (fCurrentMarkers != null)
- return true;
- return fElementIndex < fElements.size();
- }
-
- private IMarker getNextMatch(boolean save) throws CoreException, MarkerNotPresentableException {
- if (fCurrentMarkers == null) {
- if (fElementIndex >= fElements.size())
- return null;
- saveEditor(save);
- fCurrentEntry= (SearchResultViewEntry)fElements.get(fElementIndex++);
- fCurrentMarkers= new ArrayList(fCurrentEntry.getMarkers());
- fMarkerIndex= 0;
- }
- IMarker result= (IMarker)fCurrentMarkers.get(fMarkerIndex);
- if (fEditor == null) {
- IWorkbenchPage activePage = fWindow.getActivePage();
- int openEditors= activePage.getEditorReferences().length;
-
- fEditor= openFile(result, activePage);
- fEditor.gotoMarker(result);
- IDocumentProvider provider= fEditor.getDocumentProvider();
- IEditorInput input = fEditor.getEditorInput();
- fDocument= provider.getDocument(input);
- fAnnotationModel= (AbstractMarkerAnnotationModel)provider.getAnnotationModel(input);
- fCloseEditor= openEditors < activePage.getEditorReferences().length;
- } else {
- fEditor.gotoMarker(result);
- }
- if (fMarkerIndex == fCurrentMarkers.size() - 1) {
- fCurrentMarkers= null;
- } else {
- fMarkerIndex++;
- }
- return result;
- }
-
- private ITextEditor openFile(IMarker marker, IWorkbenchPage activePage) throws MarkerNotPresentableException, PartInitException {
- IFile markerFile= marker.getResource() instanceof IFile ? (IFile)marker.getResource() : null;
- if (markerFile == null)
- throw new MarkerNotPresentableException(null);
-
- String currentEditorId= null;
- IEditorRegistry editorRegistry= SearchPlugin.getDefault().getWorkbench().getEditorRegistry();
- IEditorDescriptor desc= editorRegistry.getDefaultEditor(markerFile);
- if (desc != null)
- currentEditorId= desc.getId();
- try {
- IEditorPart result= activePage.openEditor(markerFile, "org.eclipse.ui.DefaultTextEditor", false); //$NON-NLS-1$
- if (!(result instanceof ITextEditor))
- throw new MarkerNotPresentableException(markerFile);
- return (ITextEditor)result;
- } finally {
- if (currentEditorId != null)
- editorRegistry.setDefaultEditor(markerFile, currentEditorId);
- }
- }
-
- private void saveEditor(boolean save) throws CoreException {
- if (fEditor == null)
- return;
-
- save= save && fEditor.isDirty();
- if (save) {
- IDocumentProvider provider= fEditor.getDocumentProvider();
- IEditorInput input = fEditor.getEditorInput();
- try {
- provider.aboutToChange(input);
- provider.saveDocument(new NullProgressMonitor(), input, fDocument, true);
- fSaved= true;
- } finally {
- provider.changed(input);
- }
- }
- if (fCloseEditor && !fEditor.isDirty())
- fEditor.close(false);
- fEditor= null;
- fDocument= null;
- fAnnotationModel= null;
- fCloseEditor= false;
-
- }
-
- private void updateButtons() {
- boolean hasNext= hasNextMatch();
- fReplaceNextButton.setEnabled(!fFatalError && fCurrentMatch != null);
- fReplaceButton.setEnabled(!fFatalError && fCurrentMatch != null);
- fNextButton.setEnabled(!fFatalError && hasNext);
- }
-
- private void restoreAutoBuildState() {
- if (!fAutobuild)
- return;
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceDescription description= workspace.getDescription();
- description.setAutoBuilding(true);
- try {
- workspace.setDescription(description);
- } catch (CoreException e) {
- ExceptionHandler.handle(e, getShell(), getDialogTitle(), SearchMessages.getString("ReplaceDialog.error.reenable_auto_build_failed")); //$NON-NLS-1$
- return;
- }
-
- ISearchResultView view= SearchPlugin.getSearchResultView();
- if (fSaved && view != null) {
- new GlobalBuildAction(
- view.getSite().getWorkbenchWindow(),
- IncrementalProjectBuilder.INCREMENTAL_BUILD).run();
- }
- }
-
- private String getDialogTitle() {
- return SearchMessages.getString("ReplaceDialog.dialog.title"); //$NON-NLS-1$
- }
-
- private void handleMarkerNotPresentableException(MarkerNotPresentableException e) {
- IFile file= e.getFile();
- String message;
- if (file == null) {
- message= SearchMessages.getString("ReplaceDialog.error.no_file_for_marker"); //$NON-NLS-1$
- } else {
- message= SearchMessages.getFormattedString("ReplaceDialog.error.unable_to_open_text_editor", file.getName()); //$NON-NLS-1$
- }
- MessageDialog.openError(getParentShell(), getDialogTitle(), message);
- }
-}
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 591a085..0000000
--- 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 333f8c2..0000000
--- 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/TextSearchActionGroup.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchActionGroup.java
deleted file mode 100644
index dd8e89d..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchActionGroup.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.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.ui.IActionBars;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.actions.OpenWithMenu;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-
-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.SearchManager;
-import org.eclipse.search.internal.ui.SearchMessages;
-
-/**
- * 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(), (List)getContext().getInput());
- 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 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(IWorkbenchActionConstants.PROPERTIES, 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 a8a37b4..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchOperation.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.text;
-
-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.ui.actions.WorkspaceModifyOperation;
-
-import org.eclipse.search.internal.core.ISearchScope;
-import org.eclipse.search.internal.core.text.TextSearchEngine;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchPluginImages;
-
-/**
- * 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 String fPattern;
- private String fOptions;
- 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) {
- Assert.isNotNull(collector);
- fWorkspace= workspace;
- fPattern= pattern;
- fOptions= 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, fPattern, fOptions, fScope, fCollector);
- }
-
- String getSingularLabel() {
- if (fPattern == null || fPattern.length() < 1)
- return SearchMessages.getFormattedString("FileSearchOperation.singularLabelPostfix", new String[] {fScope.getDescription()}); //$NON-NLS-1$
- else
- return SearchMessages.getFormattedString("TextSearchOperation.singularLabelPostfix", new String[] {fPattern, fScope.getDescription()}); //$NON-NLS-1$
- }
-
- String getPluralLabelPattern() {
- if (fPattern == null || fPattern.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[] {fPattern, "{0}", fScope.getDescription()}); //$NON-NLS-2$ //$NON-NLS-1$
- }
-
- ImageDescriptor getImageDescriptor() {
- return SearchPluginImages.DESC_OBJ_TSEARCH_DPDN;
- }
-
- IStatus getStatus() {
- return fStatus;
- }
-
- String getPattern() {
- return fPattern;
- }
-}
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 d5fe936..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java
+++ /dev/null
@@ -1,585 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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 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.IAdaptable;
-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.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-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.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.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-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.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.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;
-
-public class TextSearchPage extends DialogPage implements ISearchPage {
-
- 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 static List fgPreviousSearchPatterns= new ArrayList(20);
-
- private IDialogSettings fDialogSettings;
- private boolean fFirstTime= true;
- private boolean fIsCaseSensitive;
-
- private Combo fPattern;
- private Button fIgnoreCase;
- private Combo fExtensions;
-
- private ISearchPageContainer fContainer;
- private FileTypeEditor fFileTypeEditor;
-
-
- private static class SearchPatternData {
- boolean ignoreCase;
- String textPattern;
- Set fileNamePatterns;
- int scope;
- IWorkingSet[] workingSets;
-
- public SearchPatternData(String textPattern, boolean ignoreCase, Set fileNamePatterns, int scope, IWorkingSet[] workingSets) {
- this.ignoreCase= ignoreCase;
- this.textPattern= textPattern;
- this.fileNamePatterns= fileNamePatterns;
- this.scope= scope;
- this.workingSets= workingSets;
- }
- }
- //---- Action Handling ------------------------------------------------
-
- public boolean performAction() {
-
- SearchUI.activateSearchResultView();
-
- 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();
- 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);
-
- TextSearchResultCollector collector= new TextSearchResultCollector();
-
- TextSearchOperation op= new TextSearchOperation(
- SearchPlugin.getWorkspace(),
- patternData.textPattern,
- getSearchOptions(),
- scope,
- collector);
-
- 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) {
- 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 true;
- }
-
- 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.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(),
- 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$
- 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_END);
- 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
- label= new Label(group, SWT.LEFT);
- label.setText(SearchMessages.getString("SearchPage.containingText.hint")); //$NON-NLS-1$
- gd= new GridData(GridData.BEGINNING);
- gd.horizontalSpan= 3;
- label.setLayoutData(gd);
-
- 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);
- 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= (IMarker)((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() {
- TextSearchScope scope= new TextSearchScope(SearchMessages.getString("SelectionScope")); //$NON-NLS-1$
- 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();
-
- if (selection instanceof IResource)
- scope.add((IResource)selection);
- else if (selection instanceof IAdaptable) {
- IResource resource= (IResource)((IAdaptable)selection).getAdapter(IResource.class);
- if (resource != null)
- scope.add(resource);
- }
- }
- }
- return scope;
- }
-
- //--------------- 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);
- }
-
- /**
- * Stores it current configuration in the dialog store.
- */
- private void writeConfiguration() {
- IDialogSettings s= getDialogSettings();
- s.put(STORE_CASE_SENSITIVE, fIsCaseSensitive);
- }
-}
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 cbb14eb..0000000
--- 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 877d9a3..0000000
--- 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 1cf4a32..0000000
--- 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 98f20d4..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExtendedDialogWindow.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.search.internal.ui.util;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-
-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;
-
-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.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.wizard.ProgressMonitorPart;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.search.internal.ui.SearchMessages;
-
-
-public abstract class ExtendedDialogWindow extends Dialog implements IRunnableContext {
-
- private Control fContents;
- private Button fCancelButton;
- private Button fSearchButton;
-
- private String fPerformActionLabel= JFaceResources.getString("finish"); //$NON-NLS-1$
-
- // The number of long running operation executed from the dialog.
- private long fActiveRunningOperations;
- private boolean fOperationCancelableState;
-
- // 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);
- }
-
- //---- 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() {
- 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) {
-
- fSearchButton= createButton(parent, IDialogConstants.FINISH_ID, fPerformActionLabel, true);
- fCancelButton= createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
-
- /**
- * 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);
-
- // 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.FINISH_ID:
- if (performAction())
- close();
- break;
- case IDialogConstants.CANCEL_ID:
- if (fActiveRunningOperations == 0)
- close();
- break;
- }
- }
-
- //---- Setters and Getters --------------------------------------------------
-
- /**
- * Sets the label text of the perform action button.
- */
- public void setPerformActionLabel(String label) {
- fPerformActionLabel= label;
- }
-
- /**
- * Set the enable state of the perform action button.
- */
- public void setPerformActionEnabled(boolean state) {
- if (fSearchButton != null)
- fSearchButton.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;
- fOperationCancelableState= enableCancelButton;
- 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, "cancel"); //$NON-NLS-1$
- restoreEnableState(fSearchButton, state, "search"); //$NON-NLS-1$
- 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, String key) {
- if (!w.isDisposed()) {
- Boolean b= (Boolean)h.get(key);
- if (b != null)
- w.setEnabled(b.booleanValue());
- }
- }
-
- private HashMap saveUIState(boolean keepCancelEnabled) {
- HashMap savedState= new HashMap(10);
- saveEnableStateAndSet(fCancelButton, savedState, "cancel", keepCancelEnabled); //$NON-NLS-1$
- saveEnableStateAndSet(fSearchButton, savedState, "search", false); //$NON-NLS-1$
- savedState.put("tabForm", ControlEnableState.disable(fContents)); //$NON-NLS-1$
-
- return savedState;
- }
-
- private void saveEnableStateAndSet(Control w, HashMap h, String key, boolean enabled) {
- if (!w.isDisposed()) {
- h.put(key, 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 771da15..0000000
--- 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 3409420..0000000
--- 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.ui.IEditorRegistry;
-
-import org.eclipse.search.internal.ui.SearchMessages;
-
-public class FileTypeEditor extends SelectionAdapter implements DisposeListener, SelectionListener {
-
- private Combo fTextField;
- private Button fBrowseButton;
- private IEditorRegistry fResourceEditorRegistry;
-
- final static String TYPE_DELIMITER= SearchMessages.getString("FileTypeEditor.typeDelimiter"); //$NON-NLS-1$
-
- public FileTypeEditor(IEditorRegistry registry, Combo textField, Button browseButton) {
- fResourceEditorRegistry= registry;
- 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() == TypeFilteringDialog.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 715c28c..0000000
--- 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 bbe8b4e..0000000
--- 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 8678516..0000000
--- 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/RowLayouter.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/RowLayouter.java
deleted file mode 100644
index a8540b9..0000000
--- 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 728292c..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/SWTUtil.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies 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.graphics.GC;
-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.Text;
-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;
- }
-
- private static double fgHorizontalDialogUnitSize= 0.0;
- private static double fgVerticalDialogUnitSize= 0.0;
-
- private static void initializeDialogUnits(Control control) {
- GC gc= new GC(control);
- gc.setFont(control.getFont());
- int averageWidth= gc.getFontMetrics().getAverageCharWidth();
- int height = gc.getFontMetrics().getHeight();
- gc.dispose();
-
- fgHorizontalDialogUnitSize = averageWidth * 0.25;
- fgVerticalDialogUnitSize = height * 0.125;
- }
-
- /**
- * @see DialogPage#convertHorizontalDLUsToPixels
- */
- private static int convertHorizontalDLUsToPixels(int dlus) {
- return (int)Math.round(dlus * fgHorizontalDialogUnitSize);
- }
-
- /**
- * @see DialogPage#convertVerticalDLUsToPixels
- */
- private static int convertVerticalDLUsToPixels(int dlus) {
- return (int)Math.round(dlus * fgVerticalDialogUnitSize);
- }
-
- /**
- * @see DialogPage#convertWidthInCharsToPixels
- */
- public static int convertWidthInCharsToPixels(int chars, Text text) {
- if (fgHorizontalDialogUnitSize == 0.0)
- initializeDialogUnits(text);
- return convertHorizontalDLUsToPixels(chars * 4);
- }
-
- /**
- * Returns a width hint for a button control.
- */
- public static int getButtonWidthHint(Button button) {
- if (button.getFont().equals(JFaceResources.getDefaultFont()))
- button.setFont(JFaceResources.getDialogFont());
- if (fgHorizontalDialogUnitSize == 0.0) {
- initializeDialogUnits(button);
- }
- int widthHint= 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 getButtonHeigthHint(Button button) {
- if (button.getFont().equals(JFaceResources.getDefaultFont()))
- button.setFont(JFaceResources.getDialogFont());
- if (fgHorizontalDialogUnitSize == 0.0) {
- initializeDialogUnits(button);
- }
- return 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= SWTUtil.getButtonHeigthHint(button);
- ((GridData)gd).widthHint= SWTUtil.getButtonWidthHint(button);
- }
- }
-}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/StringMatcher.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/StringMatcher.java
deleted file mode 100644
index ff6a56d..0000000
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/StringMatcher.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.search.internal.ui.util;
-
-import java.util.*;
-
-/**
- * A string pattern matcher, suppporting * and ? wildcards.
- */
-public class StringMatcher {
- protected String fPattern;
- protected int fLength; // pattern length
- protected boolean fIgnoreWildCards;
- protected boolean fIgnoreCase;
- protected boolean fHasLeadingStar;
- protected boolean fHasTrailingStar;
- protected String fSegments[]; //the given pattern is split into * separated segments
-
- /* boundary value beyond which we don't need to search in the text */
- protected int fBound= 0;
-
-
- protected static final char fSingleWildCard= '\u0000';
-
- public static class Position {
- int start; //inclusive
- int end; //exclusive
- public Position(int start, int end) {
- this.start= start;
- this.end= end;
- }
- public int getStart() {
- return start;
- }
- public int getEnd() {
- return end;
- }
- }
- /**
- * StringMatcher constructor takes in a String object that is a simple
- * pattern which may contain ‘*’ for 0 and many characters and
- * ‘?’ for exactly one character.
- *
- * Literal '*' and '?' characters must be escaped in the pattern
- * e.g., "\*" means literal "*", etc.
- *
- * Escaping any other character (including the escape character itself),
- * just results in that character in the pattern.
- * e.g., "\a" means "a" and "\\" means "\"
- *
- * If invoking the StringMatcher with string literals in Java, don't forget
- * escape characters are represented by "\\".
- *
- * @param pattern the pattern to match text against
- * @param ignoreCase if true, case is ignored
- * @param ignoreWildCards if true, wild cards and their escape sequences are ignored
- * (everything is taken literally).
- */
- public StringMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards) {
- if (pattern == null)
- throw new IllegalArgumentException();
- fIgnoreCase= ignoreCase;
- fIgnoreWildCards= ignoreWildCards;
- fPattern= pattern;
- fLength= pattern.length();
-
- if (fIgnoreWildCards) {
- parseNoWildCards();
- } else {
- parseWildCards();
- }
- }
- /**
- * Find the first occurrence of the pattern between <code>start</code)(inclusive)
- * and <code>end</code>(exclusive).
- * @param <code>text</code>, the String object to search in
- * @param <code>start</code>, the starting index of the search range, inclusive
- * @param <code>end</code>, the ending index of the search range, exclusive
- * @return an <code>StringMatcher.Position</code> object that keeps the starting
- * (inclusive) and ending positions (exclusive) of the first occurrence of the
- * pattern in the specified range of the text; return null if not found or subtext
- * is empty (start==end). A pair of zeros is returned if pattern is empty string
- * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc"
- * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned
- */
- public StringMatcher.Position find(String text, int start, int end) {
- if (text == null)
- throw new IllegalArgumentException();
-
- int tlen= text.length();
- if (start < 0)
- start= 0;
- if (end > tlen)
- end= tlen;
- if (end < 0 ||start >= end )
- return null;
- if (fLength == 0)
- return new Position(start, start);
- if (fIgnoreWildCards) {
- int x= posIn(text, start, end);
- if (x < 0)
- return null;
- return new Position(x, x+fLength);
- }
-
- int segCount= fSegments.length;
- if (segCount == 0)//pattern contains only '*'(s)
- return new Position (start, end);
-
- int curPos= start;
- int matchStart= -1;
- int i;
- for (i= 0; i < segCount && curPos < end; ++i) {
- String current= fSegments[i];
- int nextMatch= regExpPosIn(text, curPos, end, current);
- if (nextMatch < 0 )
- return null;
- if(i == 0)
- matchStart= nextMatch;
- curPos= nextMatch + current.length();
- }
- if (i < segCount)
- return null;
- return new Position(matchStart, curPos);
- }
- /**
- * match the given <code>text</code> with the pattern
- * @return true if matched eitherwise false
- * @param <code>text</code>, a String object
- */
- public boolean match(String text) {
- return match(text, 0, text.length());
- }
- /**
- * Given the starting (inclusive) and the ending (exclusive) positions in the
- * <code>text</code>, determine if the given substring matches with aPattern
- * @return true if the specified portion of the text matches the pattern
- * @param String <code>text</code>, a String object that contains the substring to match
- * @param int <code>start<code> marks the starting position (inclusive) of the substring
- * @param int <code>end<code> marks the ending index (exclusive) of the substring
- */
- public boolean match(String text, int start, int end) {
- if (null == text)
- throw new IllegalArgumentException();
-
- if (start > end)
- return false;
-
- if (fIgnoreWildCards)
- return (end - start == fLength) && fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength);
- int segCount= fSegments.length;
- if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) // pattern contains only '*'(s)
- return true;
- if (start == end)
- return fLength == 0;
- if (fLength == 0)
- return start == end;
-
- int tlen= text.length();
- if (start < 0)
- start= 0;
- if (end > tlen)
- end= tlen;
-
- int tCurPos= start;
- int bound= end - fBound;
- if ( bound < 0)
- return false;
- int i=0;
- String current= fSegments[i];
- int segLength= current.length();
-
- /* process first segment */
- if (!fHasLeadingStar){
- if(!regExpRegionMatches(text, start, current, 0, segLength)) {
- return false;
- } else {
- ++i;
- tCurPos= tCurPos + segLength;
- }
- }
- if ((fSegments.length == 1) && (!fHasLeadingStar) && (!fHasTrailingStar)) {
- // only one segment to match, no wildcards specified
- return tCurPos == end;
- }
- /* process middle segments */
- while (i < segCount) {
- current= fSegments[i];
- int currentMatch;
- int k= current.indexOf(fSingleWildCard);
- if (k < 0) {
- currentMatch= textPosIn(text, tCurPos, end, current);
- if (currentMatch < 0)
- return false;
- } else {
- currentMatch= regExpPosIn(text, tCurPos, end, current);
- if (currentMatch < 0)
- return false;
- }
- tCurPos= currentMatch + current.length();
- i++;
- }
-
- /* process final segment */
- if (!fHasTrailingStar && tCurPos != end) {
- int clen= current.length();
- return regExpRegionMatches(text, end - clen, current, 0, clen);
- }
- return i == segCount ;
- }
-
- /**
- * This method parses the given pattern into segments seperated by wildcard '*' characters.
- * Since wildcards are not being used in this case, the pattern consists of a single segment.
- */
- private void parseNoWildCards() {
- fSegments= new String[1];
- fSegments[0]= fPattern;
- fBound= fLength;
- }
- /**
- * Parses the given pattern into segments seperated by wildcard '*' characters.
- * @param p, a String object that is a simple regular expression with ‘*’ and/or ‘?’
- */
- private void parseWildCards() {
- if(fPattern.startsWith("*"))//$NON-NLS-1$
- fHasLeadingStar= true;
- if(fPattern.endsWith("*")) {//$NON-NLS-1$
- /* make sure it's not an escaped wildcard */
- if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') {
- fHasTrailingStar= true;
- }
- }
-
- Vector temp= new Vector();
-
- int pos= 0;
- StringBuffer buf= new StringBuffer();
- while (pos < fLength) {
- char c= fPattern.charAt(pos++);
- switch (c) {
- case '\\':
- if (pos >= fLength) {
- buf.append(c);
- } else {
- char next= fPattern.charAt(pos++);
- /* if it's an escape sequence */
- if (next == '*' || next == '?' || next == '\\') {
- buf.append(next);
- } else {
- /* not an escape sequence, just insert literally */
- buf.append(c);
- buf.append(next);
- }
- }
- break;
- case '*':
- if (buf.length() > 0) {
- /* new segment */
- temp.addElement(buf.toString());
- fBound += buf.length();
- buf.setLength(0);
- }
- break;
- case '?':
- /* append special character representing single match wildcard */
- buf.append(fSingleWildCard);
- break;
- default:
- buf.append(c);
- }
- }
-
- /* add last buffer to segment list */
- if (buf.length() > 0) {
- temp.addElement(buf.toString());
- fBound += buf.length();
- }
-
- fSegments= new String[temp.size()];
- temp.copyInto(fSegments);
- }
- /**
- * @param <code>text</code>, a string which contains no wildcard
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, the stopping point of search, exclusive
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int posIn(String text, int start, int end) {//no wild card in pattern
- int max= end - fLength;
-
- if (!fIgnoreCase) {
- int i= text.indexOf(fPattern, start);
- if (i == -1 || i > max)
- return -1;
- return i;
- }
-
- for (int i= start; i <= max; ++i) {
- if (text.regionMatches(true, i, fPattern, 0, fLength))
- return i;
- }
-
- return -1;
- }
- /**
- * @param <code>text</code>, a simple regular expression that may only contain '?'(s)
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, the stopping point of search, exclusive
- * @param <code>p</code>, a simple regular expression that may contains '?'
- * @param <code>caseIgnored</code>, wether the pattern is not casesensitive
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int regExpPosIn(String text, int start, int end, String p) {
- int plen= p.length();
-
- int max= end - plen;
- for (int i= start; i <= max; ++i) {
- if (regExpRegionMatches(text, i, p, 0, plen))
- return i;
- }
- return -1;
- }
- /**
- *
- * @return boolean
- * @param <code>text</code>, a String to match
- * @param <code>start</code>, int that indicates the starting index of match, inclusive
- * @param <code>end</code> int that indicates the ending index of match, exclusive
- * @param <code>p</code>, String, String, a simple regular expression that may contain '?'
- * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
- */
- protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) {
- while (plen-- > 0) {
- char tchar= text.charAt(tStart++);
- char pchar= p.charAt(pStart++);
-
- /* process wild cards */
- if (!fIgnoreWildCards) {
- /* skip single wild cards */
- if (pchar == fSingleWildCard) {
- continue;
- }
- }
- if (pchar == tchar)
- continue;
- if (fIgnoreCase) {
- if (Character.toUpperCase(tchar) == Character.toUpperCase(pchar))
- continue;
- // comparing after converting to upper case doesn't handle all cases;
- // also compare after converting to lower case
- if (Character.toLowerCase(tchar) == Character.toLowerCase(pchar))
- continue;
- }
- return false;
- }
- return true;
- }
- /**
- * @param <code>text</code>, the string to match
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, the stopping point of search, exclusive
- * @param code>p</code>, a string that has no wildcard
- * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int textPosIn(String text, int start, int end, String p) {
-
- int plen= p.length();
- int max= end - plen;
-
- if (!fIgnoreCase) {
- int i= text.indexOf(p, start);
- if (i == -1 || i > max)
- return -1;
- return i;
- }
-
- for (int i= start; i <= max; ++i) {
- if (text.regionMatches(true, i, p, 0, plen))
- return i;
- }
-
- return -1;
- }
-}
diff --git a/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 485d595..0000000
--- 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 f22876e..0000000
--- 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 ca20099..0000000
--- 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 96741e1..0000000
--- 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 776ff35..0000000
--- 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/ISearchPage.java b/org.eclipse.search/search/org/eclipse/search/ui/ISearchPage.java
deleted file mode 100644
index 76fea75..0000000
--- 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 fdfa200..0000000
--- a/org.eclipse.search/search/org/eclipse/search/ui/ISearchPageContainer.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.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;
-
- /**
- * 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, 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, 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 e0caced..0000000
--- 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><page></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 b8ae313..0000000
--- 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 08a4c40..0000000
--- 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 f89aaa5..0000000
--- 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 f929088..0000000
--- 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 529e141..0000000
--- a/org.eclipse.text/.classpath
+++ /dev/null
@@ -1,7 +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.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 c5e82d7..0000000
--- 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 1481146..0000000
--- a/org.eclipse.text/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.text</name>
- <comment></comment>
- <projects>
- </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 9db411a..0000000
--- 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 ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/org.eclipse.text/build.properties b/org.eclipse.text/build.properties
deleted file mode 100644
index 9eaa955..0000000
--- a/org.eclipse.text/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = plugin.properties,\
- plugin.xml,\
- *.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 af35084..0000000
--- 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 7ec9f66..0000000
--- a/org.eclipse.text/plugin.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.text"
- name="%pluginName"
- version="2.1.0"
- provider-name="%providerName">
-
- <runtime>
- <library name="text.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.jface.text"/>
- </library>
- </runtime>
-
-</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 d8ae620..0000000
--- 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 e33c40a..0000000
--- 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 e24c8ef..0000000
--- 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 5cd17f7..0000000
--- 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 51d825d..0000000
--- 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 0a0291c..0000000
--- 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 310e906..0000000
--- 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 288010c..0000000
--- 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 ba29a6d..0000000
--- 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="_2.1.0" />
- <property name="dest" value="${destdir}/${plugin}${version}" />
- </target>
-
- <target name="build" depends="init">
- <eclipse.incrementalBuild project="${plugin}" kind="incr"/>
- </target>
-
- <target name="export" depends="build">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/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 4b905f0..0000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
+++ /dev/null
@@ -1,1297 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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;
-
-
-/**
- * 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 {
-
- /** The document's text store */
- private ITextStore fStore;
- /** The document's line tracker */
- private ILineTracker fTracker;
- /** The document's partitioner */
- private IDocumentPartitioner fDocumentPartitioner;
- /**
- * The document's partitioner casted to <code>IDocumentPartitionerExtension</code>.
- * @since 2.0
- */
- private IDocumentPartitionerExtension fDocumentPartitionerExtension;
- /** 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;
- /**
- * Indicates whether listeners must be notified when listener notification will be resumed.
- * @since 2.1
- */
- private boolean fPartitionHasChanged;
- /**
- * The region of changed parititions to be sent when listener notification will be resumed.
- * @since 2.1
- */
- private IRegion fChangedPartition;
-
-
- /**
- * 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 fDocumentPartitioner;
- }
-
-
-
- //--- 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) {
- fDocumentPartitioner= partitioner;
- if (fDocumentPartitioner instanceof IDocumentPartitionerExtension)
- fDocumentPartitionerExtension= (IDocumentPartitionerExtension) fDocumentPartitioner;
-
- fireDocumentPartitioningChanged(new Region(0, getLength()));
- }
-
- /**
- * 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
- */
- 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 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 (fDocumentPartitioner != null)
- fDocumentPartitioner.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) {
- fPartitionHasChanged= false;
- fChangedPartition= null;
-
- if (fDocumentPartitioner != null) {
- if (fDocumentPartitionerExtension != null) {
- fChangedPartition= fDocumentPartitionerExtension.documentChanged2(event);
- fPartitionHasChanged= (fChangedPartition != null);
- } else
- fPartitionHasChanged= fDocumentPartitioner.documentChanged(event);
- }
-
- 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.
- * @see IDocumentExtension
- */
- protected void doFireDocumentChanged(DocumentEvent event) {
- boolean hasChanged= fPartitionHasChanged;
- IRegion changedRegion= fChangedPartition;
- fPartitionHasChanged= false;
- fChangedPartition= null;
- doFireDocumentChanged(event, hasChanged, changedRegion);
- }
-
- /**
- * 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
- * @see IDocumentExtension
- * @since 2.0
- */
- protected void doFireDocumentChanged(DocumentEvent event, boolean firePartitionChange, IRegion partitionChange) {
-
- if (firePartitionChange)
- fireDocumentPartitioningChanged(partitionChange);
-
- 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 {
- if ((0 > offset) || (offset > getLength()))
- throw new BadLocationException();
-
- if (fDocumentPartitioner == null)
- return DEFAULT_CONTENT_TYPE;
-
- return fDocumentPartitioner.getContentType(offset);
- }
-
- /*
- * @see IDocument#getLegalContentTypes()
- */
- public String[] getLegalContentTypes() {
- if (fDocumentPartitioner == null)
- return new String[] { DEFAULT_CONTENT_TYPE };
- return fDocumentPartitioner.getLegalContentTypes();
- }
-
- /*
- * @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 {
- if ((0 > offset) || (offset > getLength()))
- throw new BadLocationException();
-
- if (fDocumentPartitioner == null)
- return new TypedRegion(0, getLength(), DEFAULT_CONTENT_TYPE);
-
- return fDocumentPartitioner.getPartition(offset);
- }
-
- /*
- * @see IDocument#computePartitioning(int, int)
- */
- public ITypedRegion[] computePartitioning(int offset, int length) throws BadLocationException {
- if ((0 > offset) || (0 > length) || (offset + length > getLength()))
- throw new BadLocationException();
-
- if (fDocumentPartitioner == null)
- return new TypedRegion[] { new TypedRegion(offset, length, DEFAULT_CONTENT_TYPE) };
-
- return fDocumentPartitioner.computePartitioning(offset, length);
- }
-
- /*
- * @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 {
-
- if (findString == null || findString.length() == 0)
- return -1;
-
- ITextStore store= getStore();
-
- if (startPosition < -1 || startPosition > store.getLength())
- throw new BadLocationException();
-
- if (!caseSensitive)
- findString= findString.toLowerCase();
-
- char[] fs= new char[findString.length()];
- findString.getChars(0, fs.length, fs, 0);
-
-
- if (forwardSearch) {
- if (startPosition == -1)
- startPosition= 0;
- int end= getLength();
- while (startPosition < end) {
- int pos= indexOf(store, fs, startPosition, caseSensitive);
- if (!wholeWord || pos == -1 || isWholeWord(store, pos, pos + fs.length)) {
- return pos;
- }
- startPosition= pos + 1;
- }
- } else {
- if (startPosition == -1)
- startPosition= getLength();
- while (startPosition >= 0) {
- int pos= lastIndexOf(store, fs, startPosition, caseSensitive);
- if (!wholeWord || pos == -1 || isWholeWord(store, pos, pos + fs.length)) {
- return pos;
- }
- startPosition= pos - 1;
- }
- }
- return -1;
- }
-
- /**
- * Returns the first index greater than <code>fromIndex</code> at which <code>str</code>
- * can be found in the <code>store</code>.
- *
- * @param store the text store to search
- * @param str the string to search
- * @param fromIndex the start offset
- * @param caseSensitive <code>true</code> if capitalization should be honored, <code>false</code> otherwise
- * @return the offset greater than the start offset at which the search string has been found
- */
- static private int indexOf(ITextStore store, char[] str, int fromIndex, boolean caseSensitive) {
- int count= store.getLength();
-
- if (fromIndex >= count)
- return -1;
-
- if (fromIndex < 0)
- fromIndex= 0;
-
- int strLen= str.length;
- if (strLen == 0) // empty string always matches
- return fromIndex;
-
- char first= str[0];
- int i= fromIndex;
- int max= count - strLen;
-
- restart:
- while (true) {
-
- // Look for first character
- if (caseSensitive) {
- while (i <= max && store.get(i) != first)
- i++;
- } else {
- while (i <= max && Character.toLowerCase(store.get(i)) != first)
- i++;
- }
-
- if (i > max)
- return -1;
-
- // Found first character
- int j= i + 1;
- int end= j + strLen - 1;
- int k= 1;
- if (caseSensitive) {
- while (j < end) {
- if (store.get(j++) != str[k++]) {
- i++;
- continue restart;
- }
- }
- } else {
- while (j < end) {
- if (Character.toLowerCase(store.get(j++)) != str[k++]) {
- i++;
- continue restart;
- }
- }
- }
-
- return i; // Found
- }
- }
-
- /**
- * Returns the first index smaller than <code>fromIndex</code> at which <code>str</code>
- * can be found in the <code>store</code>.
- *
- * @param store the text store to search
- * @param str the string to search
- * @param fromIndex the start offset
- * @param caseSensitive <code>true</code> if capitalization should be honored, <code>false</code> otherwise
- * @return the offset smaller than the start offset at which the search string has been found
- */
- static private int lastIndexOf(ITextStore store, char[] str, int fromIndex, boolean caseSensitive) {
-
- if (fromIndex < 0)
- return -1;
-
- int count= store.getLength();
- int strLen= str.length;
- int rightIndex= count - strLen;
-
- if (fromIndex > rightIndex)
- fromIndex= rightIndex;
-
- if (strLen == 0) // empty string always matches
- return fromIndex;
-
- int strLastIndex= strLen - 1;
- char strLastChar= str[strLastIndex];
- int min= strLen - 1;
- int i= min + fromIndex;
-
- restart:
- while (true) {
-
- // Look for the last character
- if (caseSensitive) {
- while (i >= min && store.get(i) != strLastChar)
- i--;
- } else {
- while (i >= min && Character.toLowerCase(store.get(i)) != strLastChar)
- i--;
- }
-
- if (i < min)
- return -1;
-
- // Found last character
- int j= i - 1;
- int start= j - (strLen - 1);
- int k= strLastIndex - 1;
-
- if (caseSensitive) {
- while (j > start) {
- if (store.get(j--) != str[k--]) {
- i--;
- continue restart;
- }
- }
- } else {
- while (j > start) {
- if (Character.toLowerCase(store.get(j--)) != str[k--]) {
- i--;
- continue restart;
- }
- }
- }
-
- return start + 1; /* Found whole string. */
- }
- }
-
- /**
- * Tests if the substring is a whole word.
- *
- * @param store the store in which to find the string
- * @param from the substring start offset
- * @param to the substring endoffset
- * @return <code>true</code> if the string is a whole word, otherwise <code>false</code>
- */
- private static boolean isWholeWord(ITextStore store, int from, int to) {
-
- if (from > 0) {
- char ch= store.get(from-1);
- if (Character.isLetterOrDigit(ch) || ch == '_') {
- return false;
- }
- }
- if (to < store.getLength()) {
- char ch= store.get(to);
- if (Character.isLetterOrDigit(ch) || ch == '_' ) {
- return false;
- }
- }
- return true;
- }
-
-
- // ---------- implementation of IDocumentExtension --------------
-
- /**
- * Inner class to bundle a registered post notifcation 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;
- }
- };
-
- /**
- * Flushs 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 listern 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);
- }
- }
-}
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 aae1394..0000000
--- 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 40d65ab..0000000
--- 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 8348b1f..0000000
--- 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/BadPositionCategoryException.java b/org.eclipse.text/src/org/eclipse/jface/text/BadPositionCategoryException.java
deleted file mode 100644
index c838292..0000000
--- 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 7eb112f..0000000
--- 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 null;
- }
-
- /*
- * @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 d162bdc..0000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/ChildDocumentManager.java
+++ /dev/null
@@ -1,409 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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;
-
- /**
- * Creates a new child document partitioner.
- */
- protected ChildPartitioner() {
- }
-
- /*
- * @see IDocumentPartitioner#getPartition(int)
- */
- public ITypedRegion getPartition(int offset) {
- try {
- offset += fChildDocument.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 += fChildDocument.getParentDocumentRange().getOffset();
- return fParentDocument.computePartitioning(offset, length);
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
- /*
- * @see IDocumentPartitioner#getContentType(int)
- */
- public String getContentType(int offset) {
- try {
- offset += fChildDocument.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() {
- fChildDocument= null;
- fParentDocument= null;
- }
-
- /*
- * @see IDocumentPartitioner#connect(IDocument)
- */
- public void connect(IDocument childDocument) {
- Assert.isTrue(childDocument instanceof ChildDocument);
- fChildDocument= (ChildDocument) childDocument;
- fParentDocument= fChildDocument.getParentDocument();
- }
- };
-
-
-
- /** 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);
- 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;
-
- childDocument.getDocumentPartitioner().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 301b64c..0000000
--- 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 f7d68bb..0000000
--- 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 96bae42..0000000
--- 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 b3fa42b..0000000
--- 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 f63ed66..0000000
--- 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/GapTextStore.java b/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
deleted file mode 100644
index e0946cb..0000000
--- 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 < 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 5cad2a1..0000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java
+++ /dev/null
@@ -1,570 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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
- * @exception BadLocationException if startOffset is an invalid document offset
- */
- 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 3bce614..0000000
--- 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 c785a67..0000000
--- 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/IDocumentInformationMapping.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentInformationMapping.java
deleted file mode 100644
index 6332309..0000000
--- 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 6111bf7..0000000
--- 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 f0c8699..0000000
--- 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 a7d636c..0000000
--- 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/IDocumentPartitioningListener.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentPartitioningListener.java
deleted file mode 100644
index 320f499..0000000
--- 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 8f1b4e3..0000000
--- 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/ILineTracker.java b/org.eclipse.text/src/org/eclipse/jface/text/ILineTracker.java
deleted file mode 100644
index 837b845..0000000
--- 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 44e48f9..0000000
--- 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 3c80bbd..0000000
--- 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/ISlaveDocumentManager.java b/org.eclipse.text/src/org/eclipse/jface/text/ISlaveDocumentManager.java
deleted file mode 100644
index 98e9d48..0000000
--- 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 b11b23a..0000000
--- 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 2ea3162..0000000
--- 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 86dfd60..0000000
--- 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 4016f59..0000000
--- 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 b11a53e..0000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/Position.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.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) {
- 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) {
- 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 7ca94e0..0000000
--- 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 1848f1a..0000000
--- 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, 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 60fcd52..0000000
--- 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 46e838f..0000000
--- a/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.text;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-
-/**
- * Collection of text functions.
- */
-public class TextUtilities {
-
- /**
- * Default line delimiters used by these text functions.
- */
- public final static String[] fgDelimiters= new String[] { "\n", "\r", "\r\n" }; //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
-
-
- /**
- * 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(fgDelimiters, text, 0);
- return fgDelimiters[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);
- }
-
-}
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 328bc3d..0000000
--- 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 0a7b122..0000000
--- 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.ui.editors/.classpath b/org.eclipse.ui.editors/.classpath
deleted file mode 100644
index dc73243..0000000
--- a/org.eclipse.ui.editors/.classpath
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/"/>
- <classpathentry kind="src" path="extensions"/>
- <classpathentry kind="src" path="/org.eclipse.text"/>
- <classpathentry kind="src" path="/org.eclipse.jface"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.update.core"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.eclipse.core.boot"/>
- <classpathentry kind="src" path="/org.eclipse.jface.text"/>
- <classpathentry kind="src" path="/org.eclipse.ui.workbench"/>
- <classpathentry kind="src" path="/org.eclipse.ui.views"/>
- <classpathentry kind="src" path="/org.eclipse.ui.workbench.texteditor"/>
- <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 c5e82d7..0000000
--- 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 dbddebe..0000000
--- a/org.eclipse.ui.editors/.project
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.editors</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.jface</project>
- <project>org.eclipse.jface.text</project>
- <project>org.eclipse.text</project>
- <project>org.eclipse.ui.views</project>
- <project>org.eclipse.ui.workbench</project>
- <project>org.eclipse.ui.workbench.texteditor</project>
- <project>org.eclipse.update.core</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 f20e334..0000000
--- 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 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>
-<p>
-<hr WIDTH="100%">
-<br>
-<br>
-<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.
-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>
-<p>
-<hr WIDTH="100%">
-<br>
-<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 token range.
-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>
-<br>
-<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
-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>
-<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>
-<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> </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>
-<br>
-<p>
-<hr WIDTH="100%">
-<br>
-<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 nor P3 Syntax highlight and comments bug
-<br>#11047 nor P2 Index out of bounds on text hover
-<br>
-<p>
-<hr WIDTH="100%">
-<br>
-<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>
-<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>
-<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>
-<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>
-<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 Format option loses place in editor (1GHQFU6)
-<br>#6168 code assist preference (auto complete) does
-not work
-<br>#6087 NPE closing content assist from DisplayView
-on exit
-<br>#6013 Repeatable Java editor hang in 200111115
-<br>#4947 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 [JFace Text] Content assist list truncated (1GG1W9B)
-<br>#2904 [JFace Text] PropagatingFontFieldEditor has
-moved (1GKKL13)
-<br>#1824 [JFace Text] 50 reconciling threads for 4 editors
-opened (1GFXMV8)
-<br>
-<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 "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
-Code Assist: Thread created / not removed</a>
-<br><a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=5120">#5120
-Empty popup doc in java editor</a>
-<br><a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=3473">#3473
-mnemonics (1GF25DN)</a>
-<p>
-<hr WIDTH="100%">
-<br>
-<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>
-<p>Eclipse SDK Build 203
-<h2>
-Breaking API changes</h2>
- package: org.eclipse.jface.text
-<br> interface: IHoverInfoPresenter
-<br> change: removed interface
-<br> 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
-use it to create the text hover window and the annotation bar hover
-window respectively. DefaultInformationControl 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 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>
- package: org.eclipse.jface.text
-<br> interface: ITextViewer
-<br> change: added method public void invalidateTextPresentation(
-)
-<br> change type: breaking API change for implementers of ITextViewer
-<p> package: org.eclipse.jface.text
-<br> interface: ITextViewer
-<br> change: added method public void setDefaultPrefixes(String[]
-defaultPrefixes, String contentType)
-<br> change type: breaking API change for implementers of ITextViewer
-<p> package: org.eclipse.jface.text
-<br> interface: ITextViewer
-<br> change: removed method void setDefaultPrefix(String
-defaultPrefix, String contentType)
-<br> change type: breaking API change for implementers of ITextViewer
-<p> package: org.eclipse.jface.text.rules
-<br> class: RuleBasedDamagerRepairer
-<br> change: deprecated constructor public RuleBasedDamagerRepairer(RuleBasedScanner
-scanner, TextAttribute defaultTextAttribute)
-<br> 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 public void setDefaultReturnToken(IToken
-defaultReturnToken). This token is returned if no rule can fire.</li>
-
-<li>
-TextPresentation now supports 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 f4e50d3..0000000
--- 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 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 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 <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 9db411a..0000000
--- 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 ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/org.eclipse.ui.editors/build.properties b/org.eclipse.ui.editors/build.properties
deleted file mode 100644
index 6ea0874..0000000
--- a/org.eclipse.ui.editors/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.editors.jar = src/,\
- extensions/
-bin.includes = *.jar,\
- plugin.xml,\
- plugin.properties,\
- about.html
diff --git a/org.eclipse.ui.editors/buildnotes_text.html b/org.eclipse.ui.editors/buildnotes_text.html
deleted file mode 100644
index e69de29..0000000
--- a/org.eclipse.ui.editors/buildnotes_text.html
+++ /dev/null
diff --git a/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryDocumentProvider.java b/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryDocumentProvider.java
deleted file mode 100644
index dfccd05..0000000
--- a/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryDocumentProvider.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.internal;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.eclipse.core.boot.BootLoader;
-import org.eclipse.core.boot.IPlatformConfiguration;
-import org.eclipse.core.boot.IPlatformConfiguration.IFeatureEntry;
-import org.eclipse.core.internal.plugins.PluginDescriptor;
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.internal.runtime.PreferenceExporter;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.model.PluginFragmentModel;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.ui.texteditor.AbstractDocumentProvider;
-import org.eclipse.update.configuration.IActivity;
-import org.eclipse.update.configuration.IInstallConfiguration;
-import org.eclipse.update.configuration.ILocalSite;
-import org.eclipse.update.core.SiteManager;
-
-/**
- * The <code>SystemSummaryDocumentProvider</code> creates diagnostic
- * information about the Eclipse instance in which it is running.
- */
-class SystemSummaryDocumentProvider extends AbstractDocumentProvider {
- /**
- * @see AbstractDocumentProvider#isDeleted(Object)
- */
- public boolean isDeleted(Object element) {
- return false;
- }
-
- /**
- * @see AbstractDocumentProvider#getSynchronizationStamp(Object)
- */
- public long getSynchronizationStamp(Object element) {
- return 0;
- }
-
- /**
- * @see AbstractDocumentProvider#getModificationStamp(Object)
- */
- public long getModificationStamp(Object element) {
- return 0;
- }
-
- /**
- * @see AbstractDocumentProvider#doSaveDocument(IProgressMonitor, Object, IDocument, boolean)
- */
- protected void doSaveDocument(
- IProgressMonitor arg0,
- Object arg1,
- IDocument arg2,
- boolean arg3)
- throws CoreException {
- }
-
- /**
- * @see AbstractDocumentProvider#createDocument(Object)
- */
- protected IDocument createDocument(Object element) throws CoreException {
- Document doc= new Document();
- doc.set(createDiagnostics());
- return doc;
- }
-
- /**
- * @see AbstractDocumentProvider#createAnnotationModel(Object)
- */
- protected IAnnotationModel createAnnotationModel(Object element)
- throws CoreException {
- return null;
- }
-
- /*
- * Returns a <code>String</code> of diagnostics information.
- */
- private String createDiagnostics() {
- StringWriter out = new StringWriter();
- PrintWriter writer = new PrintWriter(out);
- appendTimestamp(writer);
- appendProperties(writer);
- appendFeatures(writer);
- appendRegistry(writer);
- appendUserPreferences(writer);
- appendUpdateManagerLog(writer);
- appendLog(writer);
- writer.close();
- return out.toString();
- }
-
- /*
- * Appends a timestamp.
- */
- private void appendTimestamp(PrintWriter writer) {
- writer.println(SystemSummaryMessages.getFormattedString("SystemSummary.timeStamp", new Date())); //$NON-NLS-1$
- }
-
- /*
- * Appends the <code>System</code> properties.
- */
- private void appendProperties(PrintWriter writer) {
- writer.println();
- writer.println(SystemSummaryMessages.getString("SystemSummary.systemProperties")); //$NON-NLS-1$
- Properties properties= System.getProperties();
- SortedSet set= new TreeSet(new Comparator() {
- public int compare(Object o1, Object o2) {
- String s1= (String)o1;
- String s2= (String)o2;
- return s1.compareTo(s2);
- }
- });
- set.addAll(properties.keySet());
- Iterator i= set.iterator();
- while(i.hasNext()) {
- Object key= i.next();
- writer.print(key);
- writer.print('=');
- writer.println(properties.get(key));
- }
- }
-
- /*
- * Appends the installed, configured features.
- */
- private void appendFeatures(PrintWriter writer) {
- writer.println();
- writer.println(SystemSummaryMessages.getString("SystemSummary.features")); //$NON-NLS-1$
-
- IPlatformConfiguration platformConfiguration = BootLoader.getCurrentPlatformConfiguration();
- IPlatformConfiguration.IFeatureEntry[] featuresArray = platformConfiguration.getConfiguredFeatureEntries();
-
- Arrays.sort(featuresArray, (new Comparator() {
- public int compare(Object o1, Object o2) {
- String s1= ((IFeatureEntry)o1).getFeatureIdentifier();
- String s2= ((IFeatureEntry)o2).getFeatureIdentifier();
- return s1.compareTo(s2);
- }
- }));
-
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- for (int i = 0; i < featuresArray.length; i++) {
- IFeatureEntry info = featuresArray[i];
- String pluginID = info.getFeaturePluginIdentifier();
- if (pluginID != null) {
- IPluginDescriptor descriptor= pluginRegistry.getPluginDescriptor(pluginID);
- pluginID = descriptor.getLabel();
- if ("".equals(pluginID)) {
- pluginID = SystemSummaryMessages.getString("SystemSummary.notSpecified"); //$NON-NLS-1$
- }
- } else {
- pluginID = SystemSummaryMessages.getString("SystemSummary.notSpecified"); //$NON-NLS-1$
- }
-
- String[] args= new String[] {info.getFeatureIdentifier(), info.getFeatureVersion(), pluginID};
- writer.println(SystemSummaryMessages.getFormattedString("SystemSummary.featureVersion", args)); //$NON-NLS-1$
- }
- }
-
- /*
- * Appends the contents of the Plugin Registry.
- */
- private void appendRegistry(PrintWriter writer) {
- writer.println();
- writer.println(SystemSummaryMessages.getString("SystemSummary.pluginRegistry")); //$NON-NLS-1$
- IPluginDescriptor[] descriptors= Platform.getPluginRegistry().getPluginDescriptors();
- SortedSet set= new TreeSet(new Comparator() {
- public int compare(Object o1, Object o2) {
- String s1= ((IPluginDescriptor)o1).getUniqueIdentifier();
- String s2= ((IPluginDescriptor)o2).getUniqueIdentifier();
- return s1.compareTo(s2);
- }
- });
- for(int i= 0, length= descriptors.length; i < length; i++) {
- set.add(descriptors[i]);
- }
- Iterator i= set.iterator();
- while(i.hasNext()) {
- PluginDescriptor descriptor= (PluginDescriptor)i.next();
- String[] args= new String[] {descriptor.getUniqueIdentifier(), descriptor.getVersionIdentifier().toString(), descriptor.getLabel()};
- writer.println(SystemSummaryMessages.getFormattedString("SystemSummary.descriptorIdVersion", args)); //$NON-NLS-1$
- PluginFragmentModel[] fragments= descriptor.getFragments();
- if (fragments != null) {
- for(int j= 0, length= fragments.length; j < length; j++) {
- PluginFragmentModel fragment= fragments[j];
- writer.print('\t');
- args= new String[] {fragment.getId(), fragment.getVersion(), fragment.getName()};
- writer.println(SystemSummaryMessages.getFormattedString("SystemSummary.fragmentIdVersion", args)); //$NON-NLS-1$
- }
- }
- }
- }
-
- /*
- * Appends the preferences
- */
- private void appendUserPreferences(PrintWriter writer) {
- String tmpFile = ".tmpPrefFile"; //$NON-NLS-1$
- IPath path = new Path(InternalPlatform.getMetaArea().getLocation().append(tmpFile).toOSString());
- File file = path.toFile();
- file.delete();
-
- try {
- PreferenceExporter.exportPreferences(path);
- } catch (CoreException e) {
- writer.println("Error exporting user preferences " + e.toString()); //$NON-NLS-1$
- }
- writer.println();
- writer.println(SystemSummaryMessages.getString("SystemSummary.userPreferences")); //$NON-NLS-1$
-
- BufferedReader reader = null;
- try {
- FileInputStream in = new FileInputStream(file);
- reader = new BufferedReader(new InputStreamReader(in, "8859_1")); //$NON-NLS-1$
- char[] chars= new char[8192];
- int read= reader.read(chars);
- while (read > 0) {
- writer.write(chars, 0, read);
- read= reader.read(chars);
- }
- reader.close();
- reader= null;
- } catch (IOException e) {
- writer.println("Error reading user preference file " + e.toString()) ;//$NON-NLS-1$
- }
-
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- writer.println("Error closing user preference file " + e.toString()); //$NON-NLS-1$
- }
- }
- file.delete();
- }
-
- /*
- * Appends the contents of the Plugin Registry.
- */
- private void appendUpdateManagerLog(PrintWriter writer) {
- writer.println();
- writer.println(SystemSummaryMessages.getString("SystemSummary.updateManagerLog")); //$NON-NLS-1$
- ILocalSite site;
- try {
- site = SiteManager.getLocalSite();
- } catch (CoreException e) {
- e.printStackTrace(writer);
- return;
- }
- IInstallConfiguration[] configurations = site.getConfigurationHistory();
- for (int i = 0; i < configurations.length; i++) {
- writer.println();
- if (i>0)
- writer.println("----------------------------------------------------"); //$NON-NLS-1$
-
- writer.println(SystemSummaryMessages.getFormattedString("SystemSummary.configuration", configurations[i].getLabel())); //$NON-NLS-1$
- writer.println(SystemSummaryMessages.getFormattedString("SystemSummary.isCurrentConfiguration", "" + configurations[i].isCurrent())); //$NON-NLS-1$ //$NON-NLS-2$
- IActivity[] activities = configurations[i].getActivities();
- for (int j = 0; j < activities.length; j++) {
- writer.println();
- writer.println(SystemSummaryMessages.getFormattedString("SystemSummary.date", activities[j].getDate())); //$NON-NLS-1$
- writer.println(SystemSummaryMessages.getFormattedString("SystemSummary.target", activities[j].getLabel())); //$NON-NLS-1$
- writer.println(SystemSummaryMessages.getFormattedString("SystemSummary.action", getActionLabel(activities[j]))); //$NON-NLS-1$
- writer.println(SystemSummaryMessages.getFormattedString("SystemSummary.status", getStatusLabel(activities[j]))); //$NON-NLS-1$
- }
- }
- }
-
- /*
- * Appends the contents of the .log file
- */
- private void appendLog(PrintWriter writer) {
- File log= new File(InternalPlatform.getMetaArea().getLogLocation().toOSString());
- if (log.exists()) {
- writer.println();
- writer.println(SystemSummaryMessages.getString("SystemSummary.errorLog")); //$NON-NLS-1$
-
- BufferedReader reader = null;
- try {
- FileInputStream in = new FileInputStream(log);
- reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); //$NON-NLS-1$
- char[] chars= new char[8192];
- int read= reader.read(chars);
- while (read > 0) {
- writer.write(chars, 0, read);
- read= reader.read(chars);
- }
- reader.close();
- reader= null;
- } catch (IOException e) {
- writer.println("Error reading .log file"); //$NON-NLS-1$
- }
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- writer.println("Error reading .log file"); //$NON-NLS-1$
- }
- }
- }
- }
-
- private String getActionLabel(IActivity activity) {
- int action = activity.getAction();
- switch (action) {
- case IActivity.ACTION_CONFIGURE:
- return SystemSummaryMessages.getString("SystemSummary.activity.enabled"); //$NON-NLS-1$
- case IActivity.ACTION_FEATURE_INSTALL:
- return SystemSummaryMessages.getString("SystemSummary.activity.featureInstalled"); //$NON-NLS-1$
- case IActivity.ACTION_FEATURE_REMOVE:
- return SystemSummaryMessages.getString("SystemSummary.activity.featureRemoved"); //$NON-NLS-1$
- case IActivity.ACTION_SITE_INSTALL:
- return SystemSummaryMessages.getString("SystemSummary.activity.siteInstalled"); //$NON-NLS-1$
- case IActivity.ACTION_SITE_REMOVE:
- return SystemSummaryMessages.getString("SystemSummary.activity.siteRemoved"); //$NON-NLS-1$
- case IActivity.ACTION_UNCONFIGURE:
- return SystemSummaryMessages.getString("SystemSummary.activity.disabled"); //$NON-NLS-1$
- case IActivity.ACTION_REVERT:
- return SystemSummaryMessages.getString("SystemSummary.activity.revert"); //$NON-NLS-1$
- case IActivity.ACTION_RECONCILIATION:
- return SystemSummaryMessages.getString("SystemSummary.activity.reconcile"); //$NON-NLS-1$
- case IActivity.ACTION_ADD_PRESERVED:
- return SystemSummaryMessages.getString("SystemSummary.activity.preserved"); //$NON-NLS-1$
- default:
- return SystemSummaryMessages.getString("SystemSummary.activity.unknown"); //$NON-NLS-1$
- }
- }
-
- private String getStatusLabel(IActivity activity) {
- switch (activity.getStatus()) {
- case IActivity.STATUS_OK:
- return SystemSummaryMessages.getString("SystemSummary.activity.status.success"); //$NON-NLS-1$
- case IActivity.STATUS_NOK:
- return SystemSummaryMessages.getString("SystemSummary.activity.status.failure"); //$NON-NLS-1$
- }
- return SystemSummaryMessages.getString("SystemSummary.activity.status.unknown"); //$NON-NLS-1$
- }
-}
-
diff --git a/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryEditor.java b/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryEditor.java
deleted file mode 100644
index fdbd937..0000000
--- a/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryEditor.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal;
-
-
-import java.io.BufferedWriter;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.AbstractTextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-
-/**
- * The <code>SystemSummaryEditor</code> displays diagnostics information
- * about the Eclipse platform in which it is running.
- */
-public class SystemSummaryEditor extends AbstractTextEditor {
- /*
- * The Editor ID
- */
- static final String ID= WorkbenchPlugin.getDefault().getDescriptor().getUniqueIdentifier() + ".SystemSummaryEditor"; //$NON-NLS-1$
-
- /*
- * The name of the dialog setting property used to store
- * the last file the user selected to write to.
- */
- public static final String LAST_FILE="last_file"; //$NON-NLS-1$
-
- /*
- * The string with which all other defined ids are prefixed to construct help context ids.
- * Value: <code>"org.eclipse.ui."</code>
- */
- private static final String PREFIX= PlatformUI.PLUGIN_ID + "."; //$NON-NLS-1$
-
- /*
- * Id for the system summary editor.
- * Default value: <code>"system_summary_editor_context"</code>.
- */
- private static final String SYSTEM_SUMMARY_TEXT_EDITOR= PREFIX + "system_summary_editor_context"; //$NON-NLS-1$
-
- /**
- * Creates a new text editor.
- */
- public SystemSummaryEditor() {
- super();
- setHelpContextId(SYSTEM_SUMMARY_TEXT_EDITOR);
- setDocumentProvider(new SystemSummaryDocumentProvider());
- }
-
- /**
- * Allow save so that "save as" is enabled.
- *
- * @see AbstractTextEditor#isSaveAsAllowed()
- */
- public boolean isSaveAsAllowed() {
- return true;
- }
-
- /**
- * Disallow editing.
- *
- * @see AbstractTextEditor#isEditable()
- */
- public boolean isEditable() {
- return false;
- }
-
- /**
- * Saves the contents of the editor to a file system file.
- *
- * @see AbstractTextEditor#performSaveAs(IProgressMonitor)
- */
- protected void performSaveAs(IProgressMonitor progressMonitor) {
- String filename= getFilename();
- if (filename == null)
- return;
- String contents= getDocumentProvider().getDocument(getEditorInput()).get();
-
- Writer writer = null;
- try {
- writer =
- new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename, false), "UTF-8"));//$NON-NLS-1$
- writer.write(contents);
- writer.close();
- writer = null;
- } catch (IOException ioe) {
- MessageDialog.openError(
- getSite().getShell(),
- SystemSummaryMessages.getString("SystemSummary.saveErrorTitle"), //$NON-NLS-1$
- SystemSummaryMessages.getFormattedString("SystemSummary.saveErrorMessage", new Object[]{filename, ioe.getMessage() == null ? "" : ioe.getMessage()})); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (writer != null) {
- try {
- writer.close();
- } catch (IOException e) {
- // silent
- }
- }
-
- }
-
- /*
- * Prompts the user to select a file
- */
- private String getFilename() {
- String lastUsedPath= getDialogSettings().get(LAST_FILE);
- if (lastUsedPath == null) {
- lastUsedPath= ""; //$NON-NLS-1$
- }
- FileDialog dialog= new FileDialog(getEditorSite().getShell(), SWT.SINGLE);
- dialog.setText(SystemSummaryMessages.getString("SystemSummary.dialogTitle")); //$NON-NLS-1$
- dialog.setFilterPath(lastUsedPath);
- String filename= dialog.open();
- if (filename != null)
- getDialogSettings().put(LAST_FILE, filename);
- return filename;
- }
-
- /*
- * Answers the dialog settings for the DiagnosticsPrinterPlugin plugin
- */
- private IDialogSettings getDialogSettings() {
- return WorkbenchPlugin.getDefault().getDialogSettings();
- }
-
- /**
- * Override the default implementation to only show
- * copy, select all, print, find and goto line.
- *
- * @see AbstractTextEditor#editorContextMenuAboutToShow(IMenuManager)
- */
- protected void editorContextMenuAboutToShow(IMenuManager menu) {
- menu.add(new Separator(ITextEditorActionConstants.GROUP_COPY));
- addAction(menu, ITextEditorActionConstants.COPY);
- addAction(menu, ITextEditorActionConstants.SELECT_ALL);
-
- menu.add(new Separator(ITextEditorActionConstants.GROUP_PRINT));
- addAction(menu, ITextEditorActionConstants.PRINT);
-
- menu.add(new Separator(ITextEditorActionConstants.GROUP_FIND));
- addAction(menu, ITextEditorActionConstants.FIND);
- addAction(menu, ITextEditorActionConstants.GOTO_LINE);
-
- menu.add(new Separator(ITextEditorActionConstants.MB_ADDITIONS));
- }
-
-
-
-
-}
diff --git a/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryMessages.java b/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryMessages.java
deleted file mode 100644
index 2d16be2..0000000
--- a/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryMessages.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.internal;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class SystemSummaryMessages {
-
- private static final String RESOURCE_BUNDLE= SystemSummaryMessages.class.getName();
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private SystemSummaryMessages() {
- }
-
- 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[] 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);
- }
-
- /**
- * 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 });
- }
-}
diff --git a/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryMessages.properties b/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryMessages.properties
deleted file mode 100644
index df5f504..0000000
--- a/org.eclipse.ui.editors/extensions/org/eclipse/ui/internal/SystemSummaryMessages.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
-###############################################################################
-
-# System Summary Editor
-SystemSummary.dialogTitle= Save As
-SystemSummary.saveErrorTitle= Error
-SystemSummary.saveErrorMessage= An error occurred saving to file {0}\n\n{1}.
-
-# paramter 0 is the feature name, parameter 1 is the version and parameter 2 is the Id
-SystemSummary.featureVersion= {0} ({1}) "{2}"
-
-# parameter 0 is the fragment name, parameter 1 is the version and parameter 2 is the Id
-SystemSummary.fragmentIdVersion= {0} ({1}) "{2}"
-
-# parameter 0 is the description name, parameter 1 is the version and parameter 2 is the Id
-SystemSummary.descriptorIdVersion= {0} ({1}) "{2}"
-
-SystemSummary.configuration= Configuration={0}
-SystemSummary.isCurrentConfiguration= Is current configuration={0}
-
-SystemSummary.date= Date={0}
-SystemSummary.target= Activities={0}
-SystemSummary.status= Status={0}
-SystemSummary.action= Action={0}
-
-SystemSummary.activity.enabled= Enabled
-SystemSummary.activity.disabled= Disabled
-SystemSummary.activity.revert= Revert
-SystemSummary.activity.reconcile= Reconcile
-SystemSummary.activity.preserved= Preserved
-SystemSummary.activity.unknown= Unknown
-SystemSummary.activity.featureInstalled= Feature installed
-SystemSummary.activity.featureRemoved= Feature removed
-SystemSummary.activity.siteInstalled= Site installed
-SystemSummary.activity.siteRemoved= Site removed
-
-SystemSummary.activity.status.unknown= Unknown
-SystemSummary.activity.status.success= Success
-SystemSummary.activity.status.failure= Failure
-
-SystemSummary.timeStamp= *** Date: {0}
-SystemSummary.systemProperties= *** System properties:
-SystemSummary.features= *** Features:
-SystemSummary.pluginRegistry= *** Plug-in Registry:
-SystemSummary.userPreferences= *** User Preferences:
-SystemSummary.updateManagerLog= *** Update Manager Log:
-SystemSummary.errorLog= *** Error Log:
-SystemSummary.notSpecified= Not Specified
diff --git a/org.eclipse.ui.editors/migration_guidelines.html b/org.eclipse.ui.editors/migration_guidelines.html
deleted file mode 100644
index e69de29..0000000
--- a/org.eclipse.ui.editors/migration_guidelines.html
+++ /dev/null
diff --git a/org.eclipse.ui.editors/plugin.properties b/org.eclipse.ui.editors/plugin.properties
deleted file mode 100644
index 7a5373b..0000000
--- a/org.eclipse.ui.editors/plugin.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName= Default Text Editor
-providerName= Eclipse.org
-
-PreferencePages.TextEditor= Text Editor
diff --git a/org.eclipse.ui.editors/plugin.xml b/org.eclipse.ui.editors/plugin.xml
deleted file mode 100644
index 94b1499..0000000
--- a/org.eclipse.ui.editors/plugin.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.ui.editors"
- name="%pluginName"
- version="2.1.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"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.text"/>
- <import plugin="org.eclipse.ui.views"/>
- <import plugin="org.eclipse.ui.workbench"/>
- <import plugin="org.eclipse.ui.workbench.texteditor"/>
- <import plugin="org.eclipse.jface"/>
- <import plugin="org.eclipse.jface.text"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.update.core"/>
- </requires>
-
- <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>
-
-</plugin>
diff --git a/org.eclipse.ui.editors/scripts/exportplugin.xml b/org.eclipse.ui.editors/scripts/exportplugin.xml
deleted file mode 100644
index 6106df0..0000000
--- a/org.eclipse.ui.editors/scripts/exportplugin.xml
+++ /dev/null
@@ -1,29 +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="_2.1.0" />
- <property name="dest" value="${destdir}/${plugin}${version}" />
- </target>
-
- <target name="build" depends="init">
- <eclipse.incrementalBuild project="${plugin}" kind="incr"/>
- </target>
-
- <target name="export" depends="build">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/editors.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <zip zipfile="${dest}/editorssrc.zip">
- <fileset dir="src" />
- <fileset dir="extensions" />
- </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 f30cc55..0000000
--- 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 2a80dcf..0000000
--- 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.Dialog;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-
-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() == Dialog.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 db2f64a..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
+++ /dev/null
@@ -1,753 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.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.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$
-
- /**
- * 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.IDocumentProviderExtension#synchronize(Object)
- * @since 2.0
- */
- public void synchronize(Object element) 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());
- info.fFileSynchronizer.install();
- } else {
- refreshFile(input.getFile());
- }
-
- handleElementContentChanged((IFileEditorInput) element);
- }
- return;
-
- }
- super.synchronize(element);
- }
-
- /*
- * @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) {
- IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, x.getMessage(), 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 IDocumentProvider#resetDocument(Object)
- * @since 2.0
- */
- public void resetDocument(Object element) throws CoreException {
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=19014
- if (element instanceof IFileEditorInput) {
- IFileEditorInput input= (IFileEditorInput) element;
- try {
- refreshFile(input.getFile());
- } catch (CoreException x) {
- handleCoreException(x,TextEditorMessages.getString("FileDocumentProvider.resetDocument")); //$NON-NLS-1$
- }
- }
- super.resetDocument(element);
- }
-
- /**
- * Refreshes the given file resource.
- *
- * @param file
- * @throws a CoreException if the refresh fails
- * @since 2.1
- */
- protected void refreshFile(IFile file) throws CoreException {
- try {
- file.refreshLocal(IResource.DEPTH_INFINITE, getProgressMonitor());
- } catch (OperationCanceledException x) {
- }
- }
-
- // --------------- 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);
- }
- }
-}
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 9f8b0df..0000000
--- 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 644a131..0000000
--- 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 58cf76e..0000000
--- 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 741e0da..0000000
--- 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/IStorageDocumentProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IStorageDocumentProvider.java
deleted file mode 100644
index 0c03039..0000000
--- 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 1b7a5db..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ITextEditorHelpContextIds.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.editors.text;
-
-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$
-}
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 f797d39..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/StorageDocumentProvider.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.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 msg= x.getMessage() == null ? "" : x.getMessage(); //$NON-NLS-1$
- IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, msg, 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)))
- return document;
- }
-
- return null;
- }
-
- /*
- * @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
- }
-}
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 a784aa5..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditor.java
+++ /dev/null
@@ -1,751 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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 java.text.MessageFormat;
-import java.util.Iterator;
-
-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.graphics.RGB;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-import org.eclipse.jface.text.source.AnnotationRulerColumn;
-import org.eclipse.jface.text.source.CompositeRuler;
-import org.eclipse.jface.text.source.IAnnotationAccess;
-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.LineNumberRulerColumn;
-import org.eclipse.jface.text.source.OverviewRuler;
-import org.eclipse.jface.text.source.SourceViewer;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.SaveAsDialog;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.AddTaskAction;
-import org.eclipse.ui.texteditor.AnnotationPreference;
-import org.eclipse.ui.texteditor.ConvertLineDelimitersAction;
-import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
-import org.eclipse.ui.texteditor.DefaultRangeIndicator;
-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.MarkerAnnotationPreferences;
-import org.eclipse.ui.texteditor.ResourceAction;
-import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
-import org.eclipse.ui.texteditor.StatusTextEditor;
-
-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 StatusTextEditor {
-
- /**
- * Preference key for showing the line number ruler.
- * @since 2.1
- */
- private final static String LINE_NUMBER_RULER= TextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER;
- /**
- * Preference key for the foreground color of the line numbers.
- * @since 2.1
- */
- private final static String LINE_NUMBER_COLOR= TextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR;
- /**
- * Preference key for showing the overview ruler.
- * @since 2.1
- */
- private final static String OVERVIEW_RULER= TextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER;
- /**
- * Preference key for unknown annotation indication in overview ruler.
- * @since 2.1
- **/
- private final static String UNKNOWN_INDICATION_IN_OVERVIEW_RULER= TextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER;
- /**
- * Preference key for unknown annotation indication.
- * @since 2.1
- **/
- private final static String UNKNOWN_INDICATION= TextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION;
- /**
- * Preference key for unknown annotation color.
- * @since 2.1
- **/
- private final static String UNKNOWN_INDICATION_COLOR= TextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR;
- /**
- * Preference key for highlighting current line.
- * @since 2.1
- */
- private final static String CURRENT_LINE= TextEditorPreferenceConstants.EDITOR_CURRENT_LINE;
- /**
- * Preference key for highlight color of current line.
- * @since 2.1
- */
- private final static String CURRENT_LINE_COLOR= TextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR;
- /**
- * Preference key for showing print marging ruler.
- * @since 2.1
- */
- private final static String PRINT_MARGIN= TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN;
- /**
- * Preference key for print margin ruler color.
- * @since 2.1
- */
- private final static String PRINT_MARGIN_COLOR= TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR;
- /**
- * Preference key for print margin ruler column.
- * @since 2.1
- **/
- private final static String PRINT_MARGIN_COLUMN= TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN;
-
- /**
- * The overview ruler of this editor.
- * @since 2.1
- */
- protected IOverviewRuler fOverviewRuler;
- /**
- * Helper for accessing annotation from the perspective of this editor.
- * @since 2.1
- */
- protected IAnnotationAccess fAnnotationAccess;
- /**
- * Helper for managing the decoration support of this editor's viewer.
- * @since 2.1
- */
- protected SourceViewerDecorationSupport fSourceViewerDecorationSupport;
- /**
- * The line number column.
- * @since 2.1
- */
- protected LineNumberRulerColumn fLineNumberRulerColumn;
- /**
- * The encoding support for the editor.
- * @since 2.0
- */
- protected DefaultEncodingSupport fEncodingSupport;
- /**
- * The annotation preferences.
- * @since 2.1
- */
- private MarkerAnnotationPreferences fAnnotationPreferences;
-
-
- /**
- * Creates a new text editor.
- */
- public TextEditor() {
- super();
- initializeKeyBindingScopes();
- initializeEditor();
- fAnnotationPreferences= new MarkerAnnotationPreferences();
- }
-
- /**
- * Initializes this editor.
- */
- protected void initializeEditor() {
- setRangeIndicator(new DefaultRangeIndicator());
- setEditorContextMenuId("#TextEditorContext"); //$NON-NLS-1$
- setRulerContextMenuId("#TextRulerContext"); //$NON-NLS-1$
- setHelpContextId(ITextEditorHelpContextIds.TEXT_EDITOR);
- setPreferenceStore(EditorsPlugin.getDefault().getPreferenceStore());
- }
-
- /**
- * 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;
- }
-
- if (fSourceViewerDecorationSupport != null) {
- fSourceViewerDecorationSupport.dispose();
- fSourceViewerDecorationSupport= null;
- }
-
- fAnnotationPreferences= null;
- fAnnotationAccess= 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() == Dialog.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);
-
- WorkspaceModifyOperation op= new WorkspaceModifyOperation() {
- public void execute(final IProgressMonitor monitor) throws CoreException {
- getDocumentProvider().saveDocument(monitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true);
- }
- };
-
- boolean success= false;
- try {
-
- provider.aboutToChange(newInput);
- new ProgressMonitorDialog(shell).run(false, true, op);
- success= true;
-
- } catch (InterruptedException x) {
- } catch (InvocationTargetException x) {
-
- Throwable targetException= x.getTargetException();
-
- String title= TextEditorMessages.getString("Editor.error.save.title"); //$NON-NLS-1$
- String msg= MessageFormat.format(TextEditorMessages.getString("Editor.error.save.message"), new Object[] { targetException.getMessage() }); //$NON-NLS-1$
-
- if (targetException instanceof CoreException) {
- CoreException coreException= (CoreException) targetException;
- IStatus status= coreException.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 AddTaskAction(TextEditorMessages.getResourceBundle(), "Editor.AddTask.", this); //$NON-NLS-1$
- action.setHelpContextId(IAbstractTextEditorHelpContextIds.ADD_TASK_ACTION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.ADD_TASK);
- setAction(ITextEditorActionConstants.ADD_TASK, action);
-
- 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 AbstractTextEditor#editorContextMenuAboutToShow(IMenuManager)
- * @since 2.0
- */
- 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#updatePropertyDependentActions()
- * @since 2.0
- */
- protected void updatePropertyDependentActions() {
- super.updatePropertyDependentActions();
- if (fEncodingSupport != null)
- fEncodingSupport.reset();
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler, int)
- * @since 2.1
- */
- protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
-
- fAnnotationAccess= createAnnotationAccess();
- ISharedTextColors sharedColors= EditorsPlugin.getDefault().getSharedTextColors();
-
- fOverviewRuler= new OverviewRuler(fAnnotationAccess, VERTICAL_RULER_WIDTH, sharedColors);
- Iterator e= fAnnotationPreferences.getAnnotationPreferences().iterator();
- while (e.hasNext()) {
- AnnotationPreference preference= (AnnotationPreference) e.next();
- if (preference.contributesToHeader())
- fOverviewRuler.addHeaderAnnotationType(preference.getAnnotationType());
- }
-
- ISourceViewer sourceViewer= new SourceViewer(parent, ruler, fOverviewRuler, isOverviewRulerVisible(), styles);
- fSourceViewerDecorationSupport= new SourceViewerDecorationSupport(sourceViewer, fOverviewRuler, fAnnotationAccess, sharedColors);
- configureSourceViewerDecorationSupport();
-
- return sourceViewer;
- }
-
- /**
- * Creates the annotation access for this editor.
- *
- * @return the created annotation access
- * @since 2.1
- */
- protected IAnnotationAccess createAnnotationAccess() {
- return new DefaultMarkerAnnotationAccess(fAnnotationPreferences);
- }
-
- /**
- * Configures the decoration support for this editor's the source viewer.
- *
- * @since 2.1
- */
- protected void configureSourceViewerDecorationSupport() {
-
- Iterator e= fAnnotationPreferences.getAnnotationPreferences().iterator();
- while (e.hasNext())
- fSourceViewerDecorationSupport.setAnnotationPreference((AnnotationPreference) e.next());
- fSourceViewerDecorationSupport.setAnnotationPainterPreferenceKeys(DefaultMarkerAnnotationAccess.UNKNOWN, UNKNOWN_INDICATION_COLOR, UNKNOWN_INDICATION, UNKNOWN_INDICATION_IN_OVERVIEW_RULER, 0);
-
- fSourceViewerDecorationSupport.setCursorLinePainterPreferenceKeys(CURRENT_LINE, CURRENT_LINE_COLOR);
- fSourceViewerDecorationSupport.setMarginPainterPreferenceKeys(PRINT_MARGIN, PRINT_MARGIN_COLOR, PRINT_MARGIN_COLUMN);
- fSourceViewerDecorationSupport.setSymbolicFontName(getFontPropertyPreferenceKey());
- }
-
- /**
- * @since 2.1
- */
- private void showOverviewRuler() {
- if (getSourceViewer() instanceof ISourceViewerExtension) {
- ((ISourceViewerExtension) getSourceViewer()).showAnnotationsOverview(true);
- fSourceViewerDecorationSupport.updateOverviewDecorations();
- }
- }
-
- /**
- * Hides the overview ruler.
- *
- * @since 2.1
- */
- private void hideOverviewRuler() {
- if (getSourceViewer() instanceof ISourceViewerExtension) {
- fSourceViewerDecorationSupport.hideAnnotationOverview();
- ((ISourceViewerExtension) getSourceViewer()).showAnnotationsOverview(false);
- }
- }
-
- /**
- * Tells whether the overview ruler is visible.
- *
- * @since 2.1
- */
- protected boolean isOverviewRulerVisible() {
- IPreferenceStore store= getPreferenceStore();
- return store != null ? store.getBoolean(OVERVIEW_RULER) : false;
- }
-
- /**
- * Shows the line number ruler column.
- *
- * @since 2.1
- */
- private void showLineNumberRuler() {
- if (fLineNumberRulerColumn == null) {
- IVerticalRuler v= getVerticalRuler();
- if (v instanceof CompositeRuler) {
- CompositeRuler c= (CompositeRuler) v;
- c.addDecorator(1, createLineNumberRulerColumn());
- }
- }
- }
-
- /**
- * Hides the line number ruler column.
- *
- * @since 2.1
- */
- private void hideLineNumberRuler() {
- if (fLineNumberRulerColumn != null) {
- IVerticalRuler v= getVerticalRuler();
- if (v instanceof CompositeRuler) {
- CompositeRuler c= (CompositeRuler) v;
- c.removeDecorator(1);
- }
- fLineNumberRulerColumn = null;
- }
- }
-
- /**
- * Returns whether the line number ruler column should be
- * visible according to the preference store settings.
- *
- * @return <code>true</code> if the line numbers should be visible
- * @since 2.1
- */
- private boolean isLineNumberRulerVisible() {
- IPreferenceStore store= getPreferenceStore();
- return store != null ? store.getBoolean(LINE_NUMBER_RULER) : false;
- }
-
- /**
- * Initializes the given line number ruler column from the preference store.
- *
- * @param rulerColumn the ruler column to be initialized
- * @since 2.1
- */
- protected void initializeLineNumberRulerColumn(LineNumberRulerColumn rulerColumn) {
- ISharedTextColors sharedColors= EditorsPlugin.getDefault().getSharedTextColors();
- 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);
- }
- rulerColumn.setForeground(sharedColors.getColor(rgb));
-
-
- rgb= null;
- // background color
- 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();
- }
- }
-
- /**
- * Creates a new line number ruler column that is appropriately initialized.
- *
- * @since 2.1
- */
- protected IVerticalRulerColumn createLineNumberRulerColumn() {
- fLineNumberRulerColumn= new LineNumberRulerColumn();
- initializeLineNumberRulerColumn(fLineNumberRulerColumn);
- return fLineNumberRulerColumn;
- }
-
- /*
- * @see AbstractTextEditor#createVerticalRuler()
- * @since 2.1
- */
- protected IVerticalRuler createVerticalRuler() {
- CompositeRuler ruler= new CompositeRuler();
- ruler.addDecorator(0, new AnnotationRulerColumn(VERTICAL_RULER_WIDTH));
- if (isLineNumberRulerVisible())
- ruler.addDecorator(1, createLineNumberRulerColumn());
- return ruler;
- }
-
- /*
- * @see AbstractTextEditor#handlePreferenceStoreChanged(PropertyChangeEvent)
- * @since 2.1
- */
- 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);
- }
-
- } finally {
- super.handlePreferenceStoreChanged(event);
- }
- }
-
- /*
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- * @since 2.1
- */
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- if (fSourceViewerDecorationSupport != null)
- fSourceViewerDecorationSupport.install(getPreferenceStore());
- }
-
-}
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 f693315..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorActionContributor.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.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.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;
-
- // 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 d339bde..0000000
--- 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 095932e..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorMessages.properties
+++ /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
-###############################################################################
-
-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
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 bca5b8b..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferenceConstants.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.Iterator;
-
-import org.eclipse.swt.graphics.RGB;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-
-import org.eclipse.ui.texteditor.AnnotationPreference;
-import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
-
-
-/**
- * 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>
- */
- 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
- */
- 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
- */
- 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
- */
- 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$
-
-
- /**
- * @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) {
-
- store.setDefault(TextEditorPreferenceConstants.EDITOR_CURRENT_LINE, true);
- PreferenceConverter.setDefault(store, TextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR, new RGB(225, 235, 224));
-
- store.setDefault(TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, false);
- store.setDefault(TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 80);
- PreferenceConverter.setDefault(store, TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR, new RGB(176, 180 , 185));
-
- store.setDefault(TextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, false);
- PreferenceConverter.setDefault(store, TextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR, new RGB(0, 0, 0));
-
- store.setDefault(TextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER, true);
-
- store.setDefault(TextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION, false);
- store.setDefault(TextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER, false);
- PreferenceConverter.setDefault(store, TextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR, new RGB(0, 0, 0));
-
- 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());
- PreferenceConverter.setDefault(store, info.getColorPreferenceKey(), info.getColorPreferenceValue());
- }
- }
-}
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 54b63dd..0000000
--- 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/package.html b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/package.html
deleted file mode 100644
index 7e26e13..0000000
--- 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/text/ColorEditor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ColorEditor.java
deleted file mode 100644
index f9ab947..0000000
--- 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 65486ef..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.editors.text;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.text.source.ISharedTextColors;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-
-import org.eclipse.ui.editors.text.TextEditorPreferenceConstants;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * 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 fgInst;
-
- private ISharedTextColors fSharedTextColors;
-
- public EditorsPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- fgInst= this;
- }
-
- public static EditorsPlugin getDefault() {
- return fgInst;
- }
-
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- public static String getPluginId() {
- return getDefault().getDescriptor().getUniqueIdentifier();
- }
-
- public static void logErrorMessage(String message) {
- 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$
- }
-
- public ISharedTextColors getSharedTextColors() {
- if (fSharedTextColors == null)
- fSharedTextColors= new SharedTextColors();
- return fSharedTextColors;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeDefaultPreferences(org.eclipse.jface.preference.IPreferenceStore)
- */
- protected void initializeDefaultPreferences(IPreferenceStore store) {
- TextEditorPreferenceConstants.initializeDefaultValues(store);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.editors.text.EditorsPlugin#shutdown()
- */
- public void shutdown() throws CoreException {
- if (fSharedTextColors != null) {
- fSharedTextColors.dispose();
- fSharedTextColors= null;
- }
- super.shutdown();
- }
-}
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 39442e9..0000000
--- 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/OverlayPreferenceStore.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OverlayPreferenceStore.java
deleted file mode 100644
index 6ab8704..0000000
--- 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/SharedTextColors.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.java
deleted file mode 100644
index 5047227..0000000
--- 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 291a467..0000000
--- 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 c85d179..0000000
--- 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 8f879cb..0000000
--- 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 90b6c29..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties
+++ /dev/null
@@ -1,42 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-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.showInOverviewRuler= Show in overview &ruler
-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.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.
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 4341cd6..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorPreferencePage2.java
+++ /dev/null
@@ -1,614 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.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.core.runtime.IStatus;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.DialogPage;
-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.editors.text.ITextEditorHelpContextIds;
-import org.eclipse.ui.editors.text.TextEditorPreferenceConstants;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.texteditor.AnnotationPreference;
-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"), TextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR}, //$NON-NLS-1$
- {TextEditorMessages.getString("TextEditorPreferencePage.currentLineHighlighColor"), TextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR}, //$NON-NLS-1$
- {TextEditorMessages.getString("TextEditorPreferencePage.printMarginColor"), TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR}, //$NON-NLS-1$
- };
-
- 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 ColorEditor fAppearanceColorEditor;
- private ColorEditor fAnnotationForegroundColorEditor;
- private Button fShowInTextCheckBox;
- private Button fShowInOverviewRulerCheckBox;
-
- public TextEditorPreferencePage2() {
- setDescription(TextEditorMessages.getString("TextEditorPreferencePage.description")); //$NON-NLS-1$
- setPreferenceStore(EditorsPlugin.getDefault().getPreferenceStore());
-
- MarkerAnnotationPreferences preferences= new MarkerAnnotationPreferences();
- fOverlayStore= createOverlayStore(preferences);
- fAnnotationColorListModel= createAnnotationTypeListModel(preferences);
- }
-
- 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()));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getOverviewRulerPreferenceKey()));
- }
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, TextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, TextEditorPreferenceConstants.EDITOR_CURRENT_LINE));
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN));
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, TextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, TextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, TextEditorPreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER));
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, TextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER));
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, TextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, TextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER));
-
- 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()});
- }
- 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));
- }
-
- // sets enabled flag for a control and all its sub-tree
- private static void setEnabled(Control control, boolean enable) {
- control.setEnabled(enable);
- if (control instanceof Composite) {
- Composite composite= (Composite) control;
- Control[] children= composite.getChildren();
- for (int i= 0; i < children.length; i++)
- setEnabled(children[i], enable);
- }
- }
-
- 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, TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 3, 0, true);
-
- label= TextEditorMessages.getString("TextEditorPreferencePage.showOverviewRuler"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, TextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER, 0);
-
- label= TextEditorMessages.getString("TextEditorPreferencePage.showLineNumbers"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, TextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, 0);
-
- label= TextEditorMessages.getString("TextEditorPreferencePage.highlightCurrentLine"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, TextEditorPreferenceConstants.EDITOR_CURRENT_LINE, 0);
-
- label= TextEditorMessages.getString("TextEditorPreferencePage.showPrintMargin"); //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, TextEditorPreferenceConstants.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(8);
- 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 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(8);
- 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);
-
- 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);
-
- 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());
- }
- });
-
- 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());
- }
- });
-
- 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));
-
- 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();
- }
- }
- });
-
- }
-
- 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();
-
- 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, DialogPage.NONE);
- page.setErrorMessage(null);
- break;
- case IStatus.WARNING:
- page.setMessage(message, DialogPage.WARNING);
- page.setErrorMessage(null);
- break;
- case IStatus.INFO:
- page.setMessage(message, DialogPage.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/AddTaskAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddTaskAction.java
deleted file mode 100644
index eb48e00..0000000
--- 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/SelectMarkerRulerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerAction.java
deleted file mode 100644
index 59e95f8..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerAction.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this 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.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.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.jface.dialogs.ErrorDialog;
-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.IAnnotationModel;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-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();
-
- IMarker marker= null;
- int maxLayer= 0;
-
- Iterator iter= markers.iterator();
- while (iter.hasNext()) {
- IMarker m= (IMarker) iter.next();
- Annotation a= model.getMarkerAnnotation(m);
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=18960
- if (a != null) {
- int l= a.getLayer();
- 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, null));
-
- 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 c2ac69f..0000000
--- 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 fe51694..0000000
--- 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 2a624ac..0000000
--- 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 673b6e9..0000000
--- 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 f41bc03..0000000
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.properties
+++ /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
-###############################################################################
-
-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.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
diff --git a/org.eclipse.ui.examples.javaeditor/.classpath b/org.eclipse.ui.examples.javaeditor/.classpath
deleted file mode 100644
index 958effb..0000000
--- a/org.eclipse.ui.examples.javaeditor/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="Eclipse Java Editor Example/"/>
- <classpathentry kind="src" path="/org.eclipse.ui"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.eclipse.core.boot"/>
- <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 c5e82d7..0000000
--- 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 4f62126..0000000
--- a/org.eclipse.ui.examples.javaeditor/.project
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.examples.javaeditor</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.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.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 6c9f577..0000000
--- 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 3ef3d17..0000000
--- 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 366ed82..0000000
--- 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((float) (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/JavaDocumentProvider.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentProvider.java
deleted file mode 100644
index 8ff64a9..0000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentProvider.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.javaeditor;
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.rules.DefaultPartitioner;
-import org.eclipse.ui.editors.text.FileDocumentProvider;
-import org.eclipse.ui.examples.javaeditor.java.JavaPartitionScanner;
-
-/**
- * The JavaDocumentProvider provides the IDocuments used by java editors.
- */
-
-public class JavaDocumentProvider extends FileDocumentProvider {
-
- private final static String[] TYPES= new String[] { JavaPartitionScanner.JAVA_DOC, JavaPartitionScanner.JAVA_MULTILINE_COMMENT };
-
- private static JavaPartitionScanner fgScanner= null;
-
- public JavaDocumentProvider() {
- super();
- }
-
- /* (non-Javadoc)
- * Method declared on AbstractDocumentProvider
- */
- protected IDocument createDocument(Object element) throws CoreException {
- IDocument document= super.createDocument(element);
- if (document != null) {
- IDocumentPartitioner partitioner= createJavaPartitioner();
- document.setDocumentPartitioner(partitioner);
- partitioner.connect(document);
- }
- return document;
- }
-
- /**
- * Return a partitioner for .java files.
- */
- private IDocumentPartitioner createJavaPartitioner() {
- return new DefaultPartitioner(getJavaPartitionScanner(), TYPES);
- }
-
- /**
- * Return a scanner for creating java partitions.
- */
- private JavaPartitionScanner getJavaPartitionScanner() {
- if (fgScanner == null)
- fgScanner= new JavaPartitionScanner();
- return fgScanner;
- }
-}
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 7b59f2a..0000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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() {
- JavaEditorEnvironment.disconnect(this);
- 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();
- JavaEditorEnvironment.connect(this);
- 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/JavaEditorEnvironment.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorEnvironment.java
deleted file mode 100644
index 7366991..0000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorEnvironment.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.examples.javaeditor;
-
-
-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;
-
-/** The JavaEditorEnvironment maintains singletons used by the java editor
- * examples.
- */
-public class JavaEditorEnvironment {
-
- private static JavaColorProvider fgColorProvider;
- private static JavaCodeScanner fgCodeScanner;
- private static JavaDocScanner fgDocScanner;
-
- private static int fgRefCount= 0;
-
- /**
- * A connection has occured - initialize the receiver if it is the first activation.
- */
- public static void connect(Object client) {
- if (++fgRefCount == 1) {
- fgColorProvider= new JavaColorProvider();
- fgCodeScanner= new JavaCodeScanner(fgColorProvider);
- fgDocScanner= new JavaDocScanner(fgColorProvider);
- }
- }
-
- /**
- * A disconnection has occured - clear the receiver if it is the last deactivation.
- */
- public static void disconnect(Object client) {
- if (--fgRefCount == 0) {
- fgCodeScanner= null;
- fgDocScanner= null;
- fgColorProvider.dispose();
- fgColorProvider= null;
- }
- }
-
- /**
- * Returns the singleton scanner.
- */
- public static RuleBasedScanner getJavaCodeScanner() {
- return fgCodeScanner;
- }
-
- /**
- * Returns the singleton color provider.
- */
- public static JavaColorProvider getJavaColorProvider() {
- return fgColorProvider;
- }
-
- /**
- * Returns the singleton document scanner.
- */
- public static RuleBasedScanner getJavaDocScanner() {
- return fgDocScanner;
- }
-}
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 c037d22..0000000
--- 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 441a4a4..0000000
--- 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/JavaSourceViewerConfiguration.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.java
deleted file mode 100644
index fddaf6a..0000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.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.examples.javaeditor;
-
-
-import org.eclipse.jface.text.*;
-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.*;
-import org.eclipse.jface.text.source.*;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.examples.javaeditor.java.*;
-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());
- }
-
- /* (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.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(JavaEditorEnvironment.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= JavaEditorEnvironment.getJavaColorProvider();
- PresentationReconciler reconciler= new PresentationReconciler();
-
- DefaultDamagerRepairer dr= new DefaultDamagerRepairer(JavaEditorEnvironment.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 f4f55e8..0000000
--- 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 fcdb150..0000000
--- 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 76132bf..0000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaAutoIndentStrategy.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.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();
-
- for (int i= 0; i < delimiters.length; i++) {
- if (txt.endsWith(delimiters[i]))
- return true;
- }
-
- 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 3b9535e..0000000
--- 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 89c9f63..0000000
--- 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 d3ba02c..0000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaDoubleClickSelector.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.java;
-
-
-import org.eclipse.jface.text.*;
-
-/**
- * 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 3b1937f..0000000
--- 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/java/JavaPartitionScanner.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaPartitionScanner.java
deleted file mode 100644
index 42f604f..0000000
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaPartitionScanner.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.javaeditor.java;
-
-
-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$
-
- /**
- * 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/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 ffd4d21..0000000
--- 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 67405b5..0000000
--- 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 a0831f0..0000000
--- 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 d96551b..0000000
--- 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 1b5bc95..0000000
--- 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 e79a1b9..0000000
--- 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 9db411a..0000000
--- 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 ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/org.eclipse.ui.examples.javaeditor/build.properties b/org.eclipse.ui.examples.javaeditor/build.properties
deleted file mode 100644
index deb4a69..0000000
--- 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 c598113..0000000
--- 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 3c86467..0000000
--- 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 f5871b7..0000000
--- 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 360f8e9..0000000
--- 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 61cef48..0000000
--- 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 c786e43..0000000
--- 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 3302957..0000000
--- 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. It also shows how 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 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>
- 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".
-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>
-<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 83de817..0000000
--- 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 f5e7bb1..0000000
--- a/org.eclipse.ui.examples.javaeditor/plugin.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
-###############################################################################
-#
-# Resource strings for Java Example Editor
-#
-pluginName=JFace Text Example
-providerName = Eclipse.org
-
-#
-# Extension point names
-#
-javaEditorName=Example Java Editor
-javaFileExtension=jav
diff --git a/org.eclipse.ui.examples.javaeditor/plugin.xml b/org.eclipse.ui.examples.javaeditor/plugin.xml
deleted file mode 100644
index 57af6f1..0000000
--- a/org.eclipse.ui.examples.javaeditor/plugin.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.ui.examples.javaeditor"
- name="%pluginName"
- version="2.1.0"
- provider-name="%providerName">
-<requires>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.core.resources"/>
-</requires>
-
-<runtime>
- <library name="javaeditorexample.jar">
- <export name="*"/>
- </library>
-</runtime>
-
-<extension
- point="org.eclipse.ui.editors">
- <editor
- name="%javaEditorName"
- icon="icons/obj16/java.gif"
- extensions="jav"
- contributorClass="org.eclipse.ui.examples.javaeditor.JavaActionContributor"
- class="org.eclipse.ui.examples.javaeditor.JavaEditor"
- id="org.eclipse.ui.JavaEditor">
- </editor>
-</extension>
-
-<extension
- point="org.eclipse.ui.documentProviders">
- <provider
- extensions="%javaFileExtension"
- class="org.eclipse.ui.examples.javaeditor.JavaDocumentProvider"
- id="org.eclipse.ui.examples.javaeditor.JavaDocumentProvider">
- </provider>
-</extension>
-
-</plugin>