Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2008-09-11 12:01:34 +0000
committerDani Megert2008-09-11 12:01:34 +0000
commit632fd1ce2f0a9ab9359727ceae521e223ae22973 (patch)
treeb584161996bfb35f9dd2e5dd5ebf1ca5b15493d3
parentecd77176ea6b00c6d7f9f6d751105808d9309158 (diff)
downloadeclipse.platform.text-20080909-ascu.tar.gz
eclipse.platform.text-20080909-ascu.tar.xz
eclipse.platform.text-20080909-ascu.zip
Removed trailing whitespace and organized the importsv20080909-ascu
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java48
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java26
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java354
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferListener.java2
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java8
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java20
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java28
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java12
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java6
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java6
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java6
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestPlugin.java4
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java6
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java350
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java8
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java6
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java6
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java6
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java34
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/MockDocumentSetupParticipants.java14
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceHelper.java38
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceTextFileManagerDocCreationTests.java6
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/TextFileManagerDocCreationTests.java6
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java8
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentSetupParticipantExtension.java8
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBuffer.java4
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferManager.java18
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferStatusCodes.java12
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java12
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/LocationKind.java18
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/ConvertLineDelimitersOperation.java1
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/RemoveTrailingWhitespaceOperation.java1
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/TextFileBufferOperation.java1
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java14
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreFileBuffer.java12
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreTextFileBuffer.java8
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceExtensionRegistry.java14
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java12
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java10
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java20
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/SynchronizableDocument.java30
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java96
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractPairMatcherTest.java80
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java134
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest.java10
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultUndoManagerTest.java8
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTester.java18
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java4
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TestTextEvent.java4
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TestTextViewer.java39
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java22
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextPresentationTest.java128
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java6
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/AbstractReconcilerTest.java68
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/ReconcilerTestSuite.java2
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerTest.java2
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerZeroLengthTest.java22
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java44
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/ScannerColumnTest.java8
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/WordRuleTest.java64
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotation.java6
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationHover.java6
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java4
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSummary.java8
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSupport.java2
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionViewer.java46
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/contentassist/AbstractControlContentAssistSubjectAdapter.java23
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/contentassist/SubjectControlContentAssistant.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/DelayedInputChangeListener.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InformationControlReplacer.java54
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InternalAccessor.java34
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/StickyHoverManager.java35
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/TableOwnerDrawSupport.java44
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java106
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControlInput.java12
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInput.java16
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTML2TextReader.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLMessages.java3
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java14
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/CompletionProposalPopup2.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.java3
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/ChangeRegion.java46
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Colors.java34
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Hunk.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/HunkComputer.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/LineIndexOutOfBoundsException.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Range.java78
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java136
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java28
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java58
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractHoverInformationControlManager.java109
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java112
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java94
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractReusableInformationControlCreator.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/CursorLinePainter.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java46
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java3
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextHover.java20
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java64
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapterContentProposalProvider.java66
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/IDelayedInputChangeProvider.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/IEditingSupportRegistry.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension4.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension5.java18
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/IInputChangedListener.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/IPaintPositionManager.java1
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/ISelectionValidator.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHoverExtension2.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewer.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension7.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension8.java20
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java70
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/RegExMessages.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/TabsToSpacesConverter.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/TextAttribute.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/TextPresentation.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java74
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerUndoManager.java24
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java20
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java91
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java126
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistEvent.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistSubjectControlAdapter.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java110
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContextInformationPopup.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposal.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension4.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension5.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension6.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension2.java16
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension3.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension4.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformation.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContextInformationExtension.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/PopupCloser.java24
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatterExtension.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingContext.java24
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategyExtension.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/AbstractHyperlinkDetector.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/DefaultHyperlinkPresenter.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkManager.java34
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkMessages.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension2.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkPresenterExtension.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/MultipleHyperlinkPresenter.java220
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlink.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenterExtension.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/information/InformationPresenter.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedModeUI.java12
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedPositionAnnotations.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/link/TabStopIterator.java1
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/presentation/PresentationReconciler.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistant.java28
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistantExtension.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistInvocationContext.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistProcessor.java12
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickFixableAnnotation.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java34
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconcileStep.java1
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java12
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcileStep.java1
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionListener.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumn.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumnExtension.java30
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/Revision.java20
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionEvent.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionInformation.java22
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionRange.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/rules/DefaultDamagerRepairer.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/rules/IRule.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/rules/PatternRule.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedPartitionScanner.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/rules/RuleBasedScanner.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/rules/WordRule.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/AbstractRulerColumn.java36
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationBarHoverManager.java44
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationColumn.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java120
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationRulerColumn.java18
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java48
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/CompositeRuler.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/ContentAssistantFacade.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultAnnotationHover.java70
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java56
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccessExtension2.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationHover.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineDifferExtension2.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineRange.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewer.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension3.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension4.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/IVerticalRulerInfo.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/JFaceTextMessages.java3
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberChangeRulerColumn.java36
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java28
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java36
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java22
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewerConfiguration.java4
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/TextInvocationContext.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/VerticalRuler.java12
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/templates/JFaceTextTemplateMessages.java3
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/templates/PositionBasedCompletionProposal.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/templates/TemplateProposal.java11
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceMessages.java3
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateReaderWriter.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateStore.java22
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchEngine.java10
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchMatchAccess.java28
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchRequestor.java14
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchScope.java26
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/IContextMenuConstants.java38
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/IQueryListener.java14
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/IReplacePage.java4
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/ISearchPage.java2
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/ISearchPageContainer.java40
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/ISearchPageScoreComputer.java2
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/ISearchQuery.java16
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/ISearchResult.java14
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultListener.java12
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultPage.java24
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultViewPart.java12
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/NewSearchUI.java66
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/SearchResultEvent.java16
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/actions/TextSearchGroup.java29
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchResult.java102
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchViewPage.java182
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/FileTextSearchScope.java56
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/FilterUpdateEvent.java12
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/IEditorMatchAdapter.java14
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/IFileMatchAdapter.java10
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/ISearchEditorAccess.java14
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/Match.java36
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/MatchEvent.java26
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/MatchFilter.java12
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/RemoveAllEvent.java4
-rw-r--r--org.eclipse.search/new search/org/eclipse/search/ui/text/TextSearchQueryProvider.java51
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/CancelSearchAction.java9
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/InternalSearchUI.java85
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterAction.java8
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionAction.java21
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java47
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/Messages.java2
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/OpenSearchPreferencesAction.java4
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/PinSearchViewAction.java10
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/QueryManager.java22
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/RemoveAllSearchesAction.java9
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchAgainAction.java17
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistoryDropDownAction.java29
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java129
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.java2
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchPageRegistry.java19
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java153
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchViewManager.java55
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/ShowSearchHistoryDialogAction.java13
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/CollapseAllAction.java8
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ExpandAllAction.java8
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveAllMatchesAction.java13
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveMatchAction.java13
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveSelectedMatchesAction.java8
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/SetLayoutAction.java5
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ShowNextResultAction.java11
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ShowPreviousResultAction.java11
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/TreeViewerNavigator.java14
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationHighlighter.java33
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationManagers.java9
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java29
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAnnotationManager.java47
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/Highlighter.java20
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java19
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/PositionTracker.java59
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/WindowAnnotationManager.java18
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/DefaultTextSearchQueryProvider.java23
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInFileActionDelegate.java20
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInProjectActionDelegate.java16
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInRecentScopeActionDelegate.java14
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInWorkingSetActionDelegate.java16
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInWorkspaceActionDelegate.java14
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/RetrieverAction.java38
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/TextSearchQueryProviderRegistry.java17
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java132
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/FileNamePatternSearchScope.java37
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/FilesOfScopeCalculator.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/PatternConstructor.java88
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngineRegistry.java15
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java56
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java30
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/GotoMarkerAction.java8
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java8
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/Messages.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/OpenFileSearchPageAction.java5
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogAction.java4
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogPageAction.java34
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllResultsAction.java8
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllSearchesAction.java8
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveMatchAction.java18
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/RemovePotentialMatchesAction.java26
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveResultAction.java26
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ResourceToItemsMapper.java26
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java65
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java29
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchAgainAction.java6
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java201
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDropDownAction.java10
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchManager.java93
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPageDescriptor.java81
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java89
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java30
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferenceInitializer.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.java40
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java10
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java48
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntry.java39
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntryAdapterFactory.java17
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java99
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.java12
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ShowNextResultAction.java8
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ShowPreviousResultAction.java8
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchAction.java4
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java28
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SortDropDownAction.java20
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SorterDescriptor.java24
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/WorkingSetComparator.java7
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/BasicElementLabels.java38
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/DecoratingFileSearchLabelProvider.java22
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java20
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileLabelProvider.java55
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileMatch.java20
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java83
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java76
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchResult.java11
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileTableContentProvider.java14
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileTreeContentProvider.java30
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/LineElement.java14
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/NewTextSearchActionGroup.java39
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceAction.java8
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceConfigurationPage.java47
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java131
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/SearchResultUpdater.java5
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/SortAction.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java162
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExceptionHandler.java39
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/ExtendedDialogWindow.java110
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileLabelProvider.java26
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/FileTypeEditor.java10
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/ListDialog.java22
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/PixelConverter.java10
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/util/SWTUtil.java30
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/IActionGroupFactory.java13
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/IContextMenuContributor.java10
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/IGroupByKeyComputer.java8
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java18
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/ISearchResultViewEntry.java8
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/SearchUI.java34
-rw-r--r--org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionDocumentTest.java758
-rw-r--r--org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionMappingTest.java280
-rw-r--r--org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionTestSuite.java2
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/AbstractGapTextTest.java16
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/AbstractLineTrackerTest.java12
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java72
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/AdaptiveGapTextTest.java58
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/AnnotationModelExtension2Test.java94
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/AnnotationModelStressTest.java148
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/ChildDocumentTest.java246
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/CopyOnWriteTextStoreTest.java48
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/DefaultLineTrackerTest.java16
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentExtensionTest.java120
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentTest.java246
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/EclipseTextTestSuite.java4
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/ExclusivePositionUpdaterTest.java8
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java154
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/GapTextStoreTest.java4
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/GapTextTest.java58
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/LineTrackerTest3.java96
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/LineTrackerTest4.java2
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/TextEditTests.java248
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/TextStoreTest.java18
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/TextUtilitiesTest.java70
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/link/InclusivePositionUpdaterTest.java10
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkTestSuite.java2
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedModeModelTest.java266
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedPositionGroupTest.java154
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedPositionTest.java226
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/templates/TemplateTranslatorTest.java12
-rwxr-xr-xorg.eclipse.text.tests/src/org/eclipse/text/tests/templates/TemplatesTestSuite.java4
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/FragmentUpdater.java2
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocument.java10
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java74
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/AbstractLineTracker.java20
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/Assert.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/CopyOnWriteTextStore.java6
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/Document.java10
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java6
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/DocumentRewriteSessionType.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java54
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java22
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocument.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension4.java10
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocument.java4
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocumentExtension.java4
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/ListLineTracker.java12
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/Region.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/RewriteSessionEditProcessor.java8
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/TextMessages.java6
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java10
-rwxr-xr-xorg.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.java258
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/link/LinkedModeManager.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/link/LinkedModeModel.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/link/LinkedPositionGroup.java4
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/source/AnnotationModel.java52
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/source/AnnotationModelEvent.java4
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/source/IAnnotationModelExtension2.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/templates/Template.java4
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateContextType.java4
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java32
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateVariable.java24
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateVariableType.java6
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/templates/TextTemplateMessages.java3
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java14
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/TextEditGroup.java4
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/TextEditMessages.java3
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/TextEditProcessor.java2
-rw-r--r--org.eclipse.text/src/org/eclipse/text/edits/UndoCollector.java4
-rw-r--r--org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoEvent.java18
-rw-r--r--org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java62
-rw-r--r--org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManagerRegistry.java12
-rw-r--r--org.eclipse.text/src/org/eclipse/text/undo/IDocumentUndoListener.java8
-rw-r--r--org.eclipse.text/src/org/eclipse/text/undo/IDocumentUndoManager.java30
-rw-r--r--org.eclipse.text/src/org/eclipse/text/undo/UndoMessages.java3
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/ChainedPreferenceStoreTest.java28
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EditorsTestSuite.java2
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EncodingChangeTests.java24
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/GotoLineTest.java25
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/SegmentedModeTest.java25
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/DefaultEncodingSupport.java5
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EditorsUI.java19
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationAction.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationHandler.java16
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java12
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IFoldingCommandIds.java8
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ITextEditorHelpContextIds.java3
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/StorageDocumentProvider.java7
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditor.java11
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorActionContributor.java21
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextEditorPreferencePage.java1
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java26
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java30
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionContextTypeRegistry.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/CompositeRevertAction.java6
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/QuickDiffRestoreAction.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/RestoreAction.java1
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java8
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java9
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ConvertLineDelimitersAction.java12
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPlugin.java31
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPluginPreferenceInitializer.java21
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/FileEditorInputAdapterFactory.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java68
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IPreferenceConfigurationBlock.java2
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IURIEditorInputAdapterFactory.java10
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LanguageEditorPreferencePage.java4
-rwxr-xr-xorg.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java110
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModePreferencePage.java12
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPreviousPulldownActionDelegate.java6
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NonExistingFileEditorInput.java5
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/OverlayPreferenceStore.java2
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java10
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RefreshEditorAction.java2
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RemoveTrailingWhitespaceHandler.java15
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java2
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SharedTextColors.java14
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingConfigurationBlock.java10
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingPreferencePage.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/StatusInfo.java1
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java95
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UISynchronizationContext.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/URLHyperlink.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/URLHyperlinkDetector.java6
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UntitledTextFileWizard.java6
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationColumn.java15
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationType.java1
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/BooleanPreferenceToggleAction.java7
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/DelegatingAnnotationPreference.java3
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/ITextEditorThemeConstants.java2
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/LineNumberColumn.java91
-rwxr-xr-xorg.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/RulerMessages.java2
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java18
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/TextChangeHover.java2
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java152
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java47
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java12
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationPreferenceLookup.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java3
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BasicMarkerUpdater.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChangeEncodingAction.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultMarkerAnnotationAccess.java20
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DocumentProviderRegistry.java5
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/IMarkerUpdater.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java8
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java26
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java10
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerInfoAction.java1
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java11
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MessageRegion.java8
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ReadOnlyAnnotationPreference.java6
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java12
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/RevisionHoverInformationControlCreator.java14
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerAction.java28
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SimpleMarkerAnnotation.java2
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TaskRulerAction.java1
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.java6
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java32
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaAnnotationHover.java8
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaContentOutlinePage.java33
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentSetupParticipant.java4
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java100
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java26
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorMessages.java2
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaPartitionScanner.java21
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.java32
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaTextHover.java9
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/PresentationAction.java4
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaAutoIndentStrategy.java36
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCodeScanner.java16
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCompletionProcessor.java20
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaDoubleClickSelector.java28
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocCompletionProcessor.java16
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/javadoc/JavaDocScanner.java12
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaColorProvider.java10
-rw-r--r--org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/util/JavaWordDetector.java2
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/NonRuleBasedDamagerRepairer.java15
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TagRule.java4
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditor.java4
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditorUI.java17
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateMessages.java2
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLConfiguration.java3
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLDocumentProvider.java2
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLDoubleClickStrategy.java5
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLPartitionScanner.java6
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLScanner.java9
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLTagScanner.java9
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/preferences/TemplatesPreferencePage.java11
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/AntVariableResolver.java6
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLCompletionProcessor.java14
-rw-r--r--org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLContextType.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/LevenshteinTest.java89
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/LevenshteinTestHelper.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/OptimizedLevenshteinTest.java44
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java30
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java270
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/WorkbenchTextEditorTestSuite.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java134
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java78
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java106
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java20
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistHandler.java3
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/CompoundEditExitStrategy.java32
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/GotoLastEditPositionAction.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/HippieCompletionEngine.java28
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/ICompoundEditListener.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/PixelConverter.java10
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/SWTUtil.java14
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/TextEditorPlugin.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DiffRegion.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DocumentLineDiffer.java61
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffExtensionsRegistry.java3
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffRestoreAction.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/ReferenceSelectionAction.java5
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RestoreAction.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DJBHashFunction.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DocEquivalenceComparator.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DocumentEquivalenceClass.java24
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/Hash.java8
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/IntHash.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/Levenshtein.java6
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/LinkedRangeFactory.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifference.java6
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifferencer.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/DAG.java24
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/ExtensionPointHelper.java16
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnPlacement.java10
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnPlacementConstraint.java8
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnTarget.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/StringSetSerializer.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/EmptySpellingPreferenceBlock.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/NoCompletionsProposal.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/SpellingEngineRegistry.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/SpellingMessages.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractDocumentProvider.java8
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java302
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java8
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConfigurationElementSorter.java5
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConvertLineDelimitersAction.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorStatusLine.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java8
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceAction.java34
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java36
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoAnnotationAction.java8
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java6
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieCompleteAction.java19
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieProposalProcessor.java24
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorDescriptor.java42
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorRegistry.java40
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorTargetDescriptor.java22
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAbstractTextEditorHelpContextIds.java10
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDeleteLineTarget.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProvider.java6
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension2.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension5.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IReadOnlyDependent.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditor.java3
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java14
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java16
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension4.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IWorkbenchActionDefinitionIds.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindAction.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindTarget.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/JoinLinesAction.java28
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/KeyBindingSupportForAssistant.java16
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkRegionTarget.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MoveLinesAction.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RecenterAction.java5
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SaveAction.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SelectAnnotationRulerAction.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ShowWhitespaceCharactersAction.java24
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java20
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusLineContributionItem.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextOperationAction.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextSelectionNavigationLocation.java5
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextViewerDeleteLineTarget.java10
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ValidateStateException.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/WorkbenchChainedTextFontFieldEditor.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiff.java5
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiffToggleAction.java10
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/AbstractContributedRulerColumn.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/IColumnSupport.java8
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/IContributedRulerColumn.java12
-rwxr-xr-xorg.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnDescriptor.java23
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnPreferenceAdapter.java17
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnRegistry.java45
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingAnnotation.java12
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingCorrectionProcessor.java6
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingEngineDescriptor.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingProblem.java31
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingReconcileStrategy.java34
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/AbstractTemplatesPage.java112
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/ColumnLayout.java28
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/ITemplatesPage.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/MessageLine.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/StatusInfo.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java46
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesPageImages.java16
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesTransfer.java4
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesView.java6
680 files changed, 9225 insertions, 9072 deletions
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java
index 4bed6a6efbd..51d86213dde 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/AbstractFileBufferDocCreationTests.java
@@ -16,6 +16,8 @@ import java.util.Set;
import junit.framework.TestCase;
+import org.eclipse.core.runtime.Path;
+
import org.eclipse.core.filebuffers.IDocumentSetupParticipantExtension;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.filebuffers.LocationKind;
@@ -25,7 +27,7 @@ import org.eclipse.core.filebuffers.tests.MockDocumentSetupParticipants.TestDSP3
import org.eclipse.core.filebuffers.tests.MockDocumentSetupParticipants.TestDSP4;
import org.eclipse.core.filebuffers.tests.MockDocumentSetupParticipants.TestDSP5;
import org.eclipse.core.filebuffers.tests.MockDocumentSetupParticipants.TestDSP6;
-import org.eclipse.core.runtime.Path;
+
import org.eclipse.jface.text.IDocument;
@@ -34,93 +36,93 @@ import org.eclipse.jface.text.IDocument;
*/
public abstract class AbstractFileBufferDocCreationTests extends TestCase {
protected ITextFileBufferManager fManager;
-
-
+
+
public void testCreateDocumentPartipants_FileExt() {
assertParticipantsInvoked("anything.111foo", new Class[] {TestDSP1.class, TestDSP3.class});
}
-
+
public void testCreateDocumentPartipants_Name() {
assertParticipantsInvoked("111fooname", new Class[] {TestDSP2.class, TestDSP3.class});
}
-
+
public void testCreateDocumentPartipants_FileExt_Name() {
assertParticipantsInvoked("111fooname.111foo", new Class[] {TestDSP1.class, TestDSP2.class, TestDSP3.class});
}
-
+
public void testCreateDocumentPartipants_FileExt_Extension() {
assertParticipantsInvoked("anything.222foo", new Class[] {TestDSP4.class, TestDSP6.class});
}
-
+
public void testCreateDocumentPartipants_Name_Extension() {
assertParticipantsInvoked("222fooname", new Class[] {TestDSP5.class, TestDSP6.class});
}
-
+
public void testCreateDocumentPartipants_FileExt_Name_Extension() {
assertParticipantsInvoked("222fooname.222foo", new Class[] {TestDSP4.class, TestDSP5.class, TestDSP6.class});
}
-
+
public void testDocumentSetupParticipantExtension_1() {
assertDocumentContent("emanoof333/p/", "/p/333fooname", LocationKind.IFILE);
assertDocumentContent("oof333.emanoof333/p/", "/p/333fooname.333foo", LocationKind.IFILE);
assertDocumentContent("oof333.gnihtyna/p/", "/p/anything.333foo", LocationKind.IFILE);
-
+
assertDocumentContent("", "333fooname", LocationKind.LOCATION);
assertDocumentContent("", "333fooname.333foo", LocationKind.LOCATION);
assertDocumentContent("", "anything.333foo", LocationKind.LOCATION);
-
+
assertDocumentContent("", "333fooname", LocationKind.NORMALIZE);
assertDocumentContent("", "333fooname.333foo", LocationKind.NORMALIZE);
assertDocumentContent("", "anything.333foo", LocationKind.NORMALIZE);
}
-
+
public void testDocumentSetupParticipantExtension_2() {
assertDocumentContent("", "/p/444fooname", LocationKind.IFILE);
assertDocumentContent("", "/p/444fooname.444foo", LocationKind.IFILE);
assertDocumentContent("", "/p/anything.444foo", LocationKind.IFILE);
-
+
assertDocumentContent("emanoof444", "444fooname", LocationKind.LOCATION);
assertDocumentContent("oof444.emanoof444", "444fooname.444foo", LocationKind.LOCATION);
assertDocumentContent("oof444.gnihtyna", "anything.444foo", LocationKind.LOCATION);
-
+
assertDocumentContent("", "444fooname", LocationKind.NORMALIZE);
assertDocumentContent("", "444fooname.444foo", LocationKind.NORMALIZE);
assertDocumentContent("", "anything.444foo", LocationKind.NORMALIZE);
}
-
+
public void testDocumentSetupParticipantExtension_3() {
assertDocumentContent("", "/p/555fooname", LocationKind.IFILE);
assertDocumentContent("", "/p/555fooname.555foo", LocationKind.IFILE);
assertDocumentContent("", "/p/anything.555foo", LocationKind.IFILE);
-
+
assertDocumentContent("", "555fooname", LocationKind.LOCATION);
assertDocumentContent("", "555fooname.555foo", LocationKind.LOCATION);
assertDocumentContent("", "anything.555foo", LocationKind.LOCATION);
-
+
assertDocumentContent("emanoof555", "555fooname", LocationKind.NORMALIZE);
assertDocumentContent("oof555.emanoof555", "555fooname.555foo", LocationKind.NORMALIZE);
assertDocumentContent("oof555.gnihtyna", "anything.555foo", LocationKind.NORMALIZE);
}
-
+
/* Utilities */
-
+
private void assertParticipantsInvoked(String path, Class[] expectedDSPsArray) {
LocationKind[] lks= getSupportLocationKinds();
for(int i=0; i<lks.length; i++) {
- IDocument document= fManager.createEmptyDocument(new Path(path), lks[i]);
+ IDocument document= fManager.createEmptyDocument(new Path(path), lks[i]);
String content= document.get();
Set expectedDSPs= new HashSet(Arrays.asList(toString(expectedDSPsArray)));
Set actualDSPs= new HashSet(Arrays.asList(content.split("\n")));
assertEquals(expectedDSPs, actualDSPs);
}
}
-
+
abstract protected LocationKind[] getSupportLocationKinds();
-
+
protected void assertDocumentContent(String expectedContent, String path, LocationKind locKind) {
assertEquals(expectedContent, fManager.createEmptyDocument(new Path(path), locKind).get());
}
-
+
private static String[] toString(Class[] clss) {
String[] result= new String[clss.length];
for(int i=0; i<result.length; i++) {
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java
index cf77cae4aab..11b162d0af8 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java
@@ -93,7 +93,7 @@ public class FileBufferCreation extends TestCase {
manager.disconnect(path, LocationKind.NORMALIZE, null);
assertNull(manager.getTextFileBuffer(path, LocationKind.NORMALIZE));
}
-
+
/*
* Tests the creation of file buffer for an existing file.
*/
@@ -103,18 +103,18 @@ public class FileBufferCreation extends TestCase {
IPath path= file.getFullPath();
assertNotNull(path);
IFileStore fileStore= EFS.getLocalFileSystem().getStore(file.getLocation());
-
+
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connectFileStore(fileStore, null);
ITextFileBuffer buffer= manager.getFileStoreTextFileBuffer(fileStore);
assertNotNull(buffer);
-
+
IDocument document= buffer.getDocument();
assertNotNull(document);
assertEquals(CONTENT1, document.get());
-
+
assertSame(buffer, manager.getTextFileBuffer(document));
-
+
manager.disconnectFileStore(fileStore, null);
assertNull(manager.getFileStoreTextFileBuffer(fileStore));
}
@@ -132,7 +132,7 @@ public class FileBufferCreation extends TestCase {
IPath path2= ResourcesPlugin.getWorkspace().getRoot().getLocation();
path2= path2.append(path1.makeAbsolute());
-
+
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connect(path1, LocationKind.NORMALIZE, null);
ITextFileBuffer buffer1= manager.getTextFileBuffer(path1, LocationKind.NORMALIZE);
@@ -329,7 +329,7 @@ public class FileBufferCreation extends TestCase {
}
/*
- * Tests the creation of a file buffer for a non-existing file.
+ * Tests the creation of a file buffer for a non-existing file.
*/
public void test7() throws Exception {
IPath path= FileBuffersTestPlugin.getDefault().getStateLocation();
@@ -537,7 +537,7 @@ public class FileBufferCreation extends TestCase {
}
/*
- * Tests the creation of a file buffer for a non-existing file.
+ * Tests the creation of a file buffer for a non-existing file.
*/
public void test7_location() throws Exception {
IPath path= FileBuffersTestPlugin.getDefault().getStateLocation();
@@ -556,25 +556,25 @@ public class FileBufferCreation extends TestCase {
manager.disconnect(path, LocationKind.LOCATION, null);
assertNull(manager.getTextFileBuffer(path, LocationKind.LOCATION));
}
-
+
/*
- * Tests the creation of a file buffer for a non-existing file.
+ * Tests the creation of a file buffer for a non-existing file.
*/
public void test7_IFileStore() throws Exception {
IPath path= FileBuffersTestPlugin.getDefault().getStateLocation();
path= path.append("NonExistingFile");
IFileStore fileStore= EFS.getLocalFileSystem().getStore(path);
-
+
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connectFileStore(fileStore, null);
ITextFileBuffer buffer= manager.getFileStoreTextFileBuffer(fileStore);
Assert.assertNotNull(buffer);
-
+
IDocument document= buffer.getDocument();
Assert.assertNotNull(document);
Assert.assertTrue("".equals(document.get()));
assertSame(buffer, manager.getTextFileBuffer(document));
-
+
manager.disconnectFileStore(fileStore, null);
assertNull(manager.getFileStoreTextFileBuffer(fileStore));
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java
index 2bb1ff09e0e..56f6c915942 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java
@@ -38,26 +38,26 @@ import org.eclipse.jface.text.source.IAnnotationModel;
* FileBufferFunctions
*/
public abstract class FileBufferFunctions extends TestCase {
-
+
private IProject fProject;
protected ITextFileBufferManager fManager;
private IPath fPath;
-
-
+
+
protected abstract IPath createPath(IProject project) throws Exception;
-
+
protected abstract void setReadOnly(boolean state) throws Exception;
-
+
protected abstract boolean modifyUnderlyingFile() throws Exception;
-
+
protected abstract boolean deleteUnderlyingFile() throws Exception;
-
+
protected abstract IPath moveUnderlyingFile() throws Exception;
-
+
protected abstract boolean isStateValidationSupported();
-
+
protected abstract Class getAnnotationModelClass() throws Exception;
-
+
protected void setUp() throws Exception {
fManager= FileBuffers.getTextFileBufferManager();
@@ -66,21 +66,21 @@ public abstract class FileBufferFunctions extends TestCase {
ITextFileBuffer buffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertTrue(buffer == null);
}
-
+
protected IProject getProject() {
return fProject;
}
-
+
protected void tearDown() throws Exception {
ITextFileBuffer buffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertTrue(buffer == null);
ResourceHelper.deleteProject("project");
}
-
+
protected IPath getPath() {
return fPath;
}
-
+
/*
* Tests getLocation.
*/
@@ -89,12 +89,12 @@ public abstract class FileBufferFunctions extends TestCase {
try {
ITextFileBuffer buffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertEquals(fPath, buffer.getLocation());
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Tests isSynchronized.
*/
@@ -110,12 +110,12 @@ public abstract class FileBufferFunctions extends TestCase {
fileStore.putInfo(fileInfo, EFS.SET_LAST_MODIFIED, null);
long lastModified= fileStore.fetchInfo().getLastModified();
assertTrue(lastModified == EFS.NONE || !fileBuffer.isSynchronized());
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Tests isDirty.
*/
@@ -127,12 +127,12 @@ public abstract class FileBufferFunctions extends TestCase {
IDocument document= fileBuffer.getDocument();
document.replace(document.getLength(), 0, "appendix");
assertTrue(fileBuffer.isDirty());
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Tests isShared.
*/
@@ -141,7 +141,7 @@ public abstract class FileBufferFunctions extends TestCase {
try {
ITextFileBuffer fileBuffer1= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertFalse(fileBuffer1.isShared());
-
+
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
ITextFileBuffer fileBuffer2= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
@@ -150,14 +150,14 @@ public abstract class FileBufferFunctions extends TestCase {
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
assertFalse(fileBuffer1.isShared());
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Tests getModificationStamp.
*/
@@ -185,7 +185,7 @@ public abstract class FileBufferFunctions extends TestCase {
public void test6() throws Exception {
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
-
+
ITextFileBuffer fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
// set dirty bit
IDocument document= fileBuffer.getDocument();
@@ -208,14 +208,14 @@ public abstract class FileBufferFunctions extends TestCase {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Test commit.
*/
public void test7() throws Exception {
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
-
+
ITextFileBuffer fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
// set dirty bit
IDocument document= fileBuffer.getDocument();
@@ -247,119 +247,119 @@ public abstract class FileBufferFunctions extends TestCase {
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Test validateState.
*/
public void test8_1() throws Exception {
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
-
+
ITextFileBuffer fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
fileBuffer.validateState(null, null);
assertTrue(fileBuffer.isStateValidated());
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Test validateState.
*/
public void test8_2() throws Exception {
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
-
+
setReadOnly(true);
ITextFileBuffer fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
fileBuffer.validateState(null, null);
assertTrue(fileBuffer.isStateValidated());
-
+
} finally {
setReadOnly(false);
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Test resetStateValidation.
*/
public void test9_1() throws Exception {
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
-
+
ITextFileBuffer fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
fileBuffer.validateState(null, null);
fileBuffer.resetStateValidation();
if (isStateValidationSupported())
assertFalse(fileBuffer.isStateValidated());
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Test resetStateValidation.
*/
public void test9_2() throws Exception {
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
-
+
setReadOnly(true);
ITextFileBuffer fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
fileBuffer.validateState(null, null);
fileBuffer.resetStateValidation();
if (isStateValidationSupported())
assertFalse(fileBuffer.isStateValidated());
-
+
} finally {
setReadOnly(false);
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Test IFileBufferListener#bufferCreated and IFileBufferListener#bufferDisposed
*/
public void test10() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void bufferCreated(IFileBuffer buf) {
++count;
this.buffer= buf;
}
-
+
public void bufferDisposed(IFileBuffer buf) {
--count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
-
+
fManager.connect(fPath, LocationKind.NORMALIZE, null);
-
+
assertTrue(listener.count == 1);
assertNotNull(listener.buffer);
IFileBuffer fileBuffer= fManager.getFileBuffer(fPath, LocationKind.NORMALIZE);
assertTrue(listener.buffer == fileBuffer);
-
+
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
assertTrue(listener.count == 0);
assertTrue(listener.buffer == fileBuffer);
-
+
} finally {
try {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
@@ -368,263 +368,263 @@ public abstract class FileBufferFunctions extends TestCase {
}
}
}
-
+
/*
* Test IFileBufferListener#dirtyStateChanged
*/
public void test11_1() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isDirty;
-
+
public void dirtyStateChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isDirty= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
-
+
ITextFileBuffer fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertTrue(listener.count == 0 && listener.buffer == null);
-
+
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
-
+
fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
IDocument document= fileBuffer.getDocument();
document.replace(0, 0, "prefix");
-
+
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
assertTrue(listener.isDirty);
-
+
fileBuffer.commit(null, true);
-
+
assertTrue(listener.count == 2);
assertTrue(listener.buffer == fileBuffer);
assertFalse(listener.isDirty);
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#dirtyStateChanged
*/
public void test11_2() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isDirty;
-
+
public void dirtyStateChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isDirty= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
ITextFileBuffer fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertTrue(listener.count == 0 && listener.buffer == null);
-
+
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
-
+
fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
IDocument document= fileBuffer.getDocument();
document.replace(0, 0, "prefix");
-
+
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
assertTrue(listener.isDirty);
-
+
fileBuffer.revert(null);
-
+
assertTrue(listener.count == 2);
assertTrue(listener.buffer == fileBuffer);
assertFalse(listener.isDirty);
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#bufferContentAboutToBeReplaced/replaced
*/
public void test12_1() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer preBuffer, postBuffer;
public int preCount, postCount;
-
+
public void bufferContentAboutToBeReplaced(IFileBuffer buffer) {
++preCount;
preBuffer= buffer;
}
-
+
public void bufferContentReplaced(IFileBuffer buffer) {
++postCount;
postBuffer= buffer;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
ITextFileBuffer fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertTrue(listener.preCount == 0 && listener.postCount == 0 && listener.preBuffer == null && listener.postBuffer == null);
-
+
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
-
+
fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
IDocument document= fileBuffer.getDocument();
document.replace(0, 0, "prefix");
-
+
fileBuffer.revert(null);
-
+
assertTrue(listener.preCount == 1);
assertTrue(listener.preBuffer == fileBuffer);
assertTrue(listener.postCount == 1);
assertTrue(listener.postBuffer == fileBuffer);
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#bufferContentAboutToBeReplaced/replaced
*/
public void test12_2() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer preBuffer, postBuffer;
public int preCount, postCount;
-
+
public void bufferContentAboutToBeReplaced(IFileBuffer buffer) {
++preCount;
preBuffer= buffer;
}
-
+
public void bufferContentReplaced(IFileBuffer buffer) {
++postCount;
postBuffer= buffer;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
ITextFileBuffer fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertTrue(listener.preCount == 0 && listener.postCount == 0 && listener.preBuffer == null && listener.postBuffer == null);
-
+
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
-
+
fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
-
+
if (modifyUnderlyingFile()) {
assertTrue(listener.preCount == 1);
assertTrue(listener.preBuffer == fileBuffer);
assertTrue(listener.postCount == 1);
assertTrue(listener.postBuffer == fileBuffer);
}
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateValidationChanged
*/
public void test13_1() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isStateValidated;
-
+
public void stateValidationChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isStateValidated= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
ITextFileBuffer fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertTrue(listener.count == 0 && listener.buffer == null);
-
+
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
-
+
fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
fileBuffer.validateState(null, null);
-
+
if (isStateValidationSupported()) {
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
assertTrue(listener.isStateValidated);
}
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateValidationChanged
*/
public void test13_2() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isStateValidated;
-
+
public void stateValidationChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isStateValidated= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -648,7 +648,7 @@ public abstract class FileBufferFunctions extends TestCase {
setReadOnly(false);
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
@@ -658,18 +658,18 @@ public abstract class FileBufferFunctions extends TestCase {
*/
public void test13_3() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isStateValidated;
-
+
public void stateValidationChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isStateValidated= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -682,7 +682,7 @@ public abstract class FileBufferFunctions extends TestCase {
fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
fileBuffer.validateState(null, null);
fileBuffer.resetStateValidation();
-
+
if (isStateValidationSupported()) {
assertTrue(listener.count == 2);
assertTrue(listener.buffer == fileBuffer);
@@ -692,29 +692,29 @@ public abstract class FileBufferFunctions extends TestCase {
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateValidationChanged
*/
public void test13_4() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isStateValidated;
-
+
public void stateValidationChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isStateValidated= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -739,27 +739,27 @@ public abstract class FileBufferFunctions extends TestCase {
setReadOnly(false);
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#underlyingFileDeleted
*/
public void test14() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void underlyingFileDeleted(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -778,29 +778,29 @@ public abstract class FileBufferFunctions extends TestCase {
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#underlyingFileMoved
*/
public void test15() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public IPath newLocation;
-
+
public void underlyingFileMoved(IFileBuffer buf, IPath location) {
++count;
this.buffer= buf;
this.newLocation= location;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -821,7 +821,7 @@ public abstract class FileBufferFunctions extends TestCase {
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
@@ -832,16 +832,16 @@ public abstract class FileBufferFunctions extends TestCase {
*/
public void test16_1() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -860,27 +860,27 @@ public abstract class FileBufferFunctions extends TestCase {
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateChanging for external changes
*/
public void test16_2() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -899,7 +899,7 @@ public abstract class FileBufferFunctions extends TestCase {
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
@@ -910,16 +910,16 @@ public abstract class FileBufferFunctions extends TestCase {
*/
public void test16_3() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -938,27 +938,27 @@ public abstract class FileBufferFunctions extends TestCase {
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateChanging for internal changes
*/
public void test17_1() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -970,7 +970,7 @@ public abstract class FileBufferFunctions extends TestCase {
fileBuffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
fileBuffer.validateState(null, null);
-
+
if (isStateValidationSupported()) {
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
@@ -979,7 +979,7 @@ public abstract class FileBufferFunctions extends TestCase {
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
@@ -989,16 +989,16 @@ public abstract class FileBufferFunctions extends TestCase {
*/
public void test17_2() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -1012,34 +1012,34 @@ public abstract class FileBufferFunctions extends TestCase {
IDocument document= fileBuffer.getDocument();
document.replace(0, 0, "prefix");
fileBuffer.revert(null);
-
+
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateChanging for internal changes
*/
public void test17_3() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -1053,19 +1053,19 @@ public abstract class FileBufferFunctions extends TestCase {
IDocument document= fileBuffer.getDocument();
document.replace(0, 0, "prefix");
fileBuffer.commit(null, true);
-
+
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test annotation model existence.
* ATTENTION: This test is only effective in a workspace that contains the "org.eclipse.ui.editors" bundle.
@@ -1075,27 +1075,27 @@ public abstract class FileBufferFunctions extends TestCase {
try {
ITextFileBuffer buffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertNotNull(buffer);
-
+
Class clazz= getAnnotationModelClass();
if (clazz != null) {
IAnnotationModel model= buffer.getAnnotationModel();
assertTrue(clazz.isInstance(model));
}
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Test notification in case of failing listener.
*/
public void test19() throws Exception {
-
+
class NotifiedListener extends FileBufferListener {
-
+
int notifyCount= 0;
-
+
public void bufferCreated(IFileBuffer buffer) {
notifyCount++;
}
@@ -1103,22 +1103,22 @@ public abstract class FileBufferFunctions extends TestCase {
notifyCount++;
}
}
-
+
class ForcedException extends RuntimeException {
private static final long serialVersionUID= 1L;
public void printStackTrace(PrintStream s) {
s.println("!FORCED BY TEST: this entry is intentional");
}
-
+
public void printStackTrace(PrintWriter s) {
s.println("!FORCED BY TEST: this entry is intentional");
}
}
-
+
NotifiedListener notifyCounter1= new NotifiedListener();
NotifiedListener notifyCounter2= new NotifiedListener();
-
+
FileBufferListener failingListener= new FileBufferListener() {
public void bufferCreated(IFileBuffer buffer) {
throw new ForcedException();
@@ -1127,33 +1127,33 @@ public abstract class FileBufferFunctions extends TestCase {
throw new ForcedException();
}
};
-
+
fManager.addFileBufferListener(notifyCounter1);
fManager.addFileBufferListener(failingListener);
fManager.addFileBufferListener(notifyCounter2);
-
+
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
ITextFileBuffer buffer= fManager.getTextFileBuffer(fPath, LocationKind.NORMALIZE);
assertNotNull(buffer);
-
+
Class clazz= getAnnotationModelClass();
if (clazz != null) {
IAnnotationModel model= buffer.getAnnotationModel();
assertTrue(clazz.isInstance(model));
}
-
+
} finally {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
fManager.removeFileBufferListener(notifyCounter1);
fManager.removeFileBufferListener(failingListener);
fManager.removeFileBufferListener(notifyCounter2);
}
-
+
assertEquals(2, notifyCounter1.notifyCount);
assertEquals(2, notifyCounter2.notifyCount);
}
-
+
public void testGetBufferForDocument() throws Exception {
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
@@ -1166,7 +1166,7 @@ public abstract class FileBufferFunctions extends TestCase {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
/*
* Tests isSynchronized.
*/
@@ -1186,7 +1186,7 @@ public abstract class FileBufferFunctions extends TestCase {
fManager.disconnectFileStore(fileStore, null);
}
}
-
+
public void testGetFileBuffers() throws Exception {
fManager.connect(fPath, LocationKind.NORMALIZE, null);
try {
@@ -1203,5 +1203,5 @@ public abstract class FileBufferFunctions extends TestCase {
fManager.disconnect(fPath, LocationKind.NORMALIZE, null);
}
}
-
+
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferListener.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferListener.java
index 8585f39d39d..01090433d60 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferListener.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferListener.java
@@ -19,7 +19,7 @@ import org.eclipse.core.filebuffers.IFileBufferListener;
* FileBufferListener
*/
public class FileBufferListener implements IFileBufferListener {
-
+
/*
* @see org.eclipse.core.filebuffers.IFileBufferListener#bufferCreated(org.eclipse.core.filebuffers.IFileBuffer)
*/
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java
index ba0b5e57a17..cc6824c9afa 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java
@@ -26,7 +26,7 @@ import org.eclipse.core.filebuffers.FileBuffers;
* FileBuffersForExternalFiles
*/
public class FileBuffersForExternalFiles extends FileBufferFunctions {
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#tearDown()
*/
@@ -35,7 +35,7 @@ public class FileBuffersForExternalFiles extends FileBufferFunctions {
FileTool.delete(FileBuffers.getSystemFileAtLocation(getPath()).getParentFile());
super.tearDown();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#createPath(org.eclipse.core.resources.IProject)
*/
@@ -45,7 +45,7 @@ public class FileBuffersForExternalFiles extends FileBufferFunctions {
FileTool.copy(sourceFile, externalFile);
return new Path(externalFile.getAbsolutePath());
}
-
+
protected void setReadOnly(boolean state) throws Exception {
IFileStore fileStore= FileBuffers.getFileStoreAtLocation(getPath());
assertNotNull(fileStore);
@@ -79,7 +79,7 @@ public class FileBuffersForExternalFiles extends FileBufferFunctions {
protected boolean modifyUnderlyingFile() throws Exception {
return false;
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#getAnnotationModelClass()
*/
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java
index c1d3f9e2db7..7162cbd5f96 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java
@@ -38,9 +38,9 @@ import org.eclipse.jface.text.source.IAnnotationModel;
* FileBuffersForLinkedFiles
*/
public class FileBuffersForFilesInLinkedFolders extends FileBufferFunctions {
-
+
private File fExternalFile;
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#tearDown()
*/
@@ -54,7 +54,7 @@ public class FileBuffersForFilesInLinkedFolders extends FileBufferFunctions {
FileTool.delete(file); // externalResources/
super.tearDown();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#createPath(org.eclipse.core.resources.IProject)
*/
@@ -62,12 +62,12 @@ public class FileBuffersForFilesInLinkedFolders extends FileBufferFunctions {
File sourceFile= FileTool.getFileInPlugin(FileBuffersTestPlugin.getDefault(), new Path("testResources/linkedFolderTarget/FileInLinkedFolder"));
fExternalFile= FileTool.createTempFileInPlugin(FileBuffersTestPlugin.getDefault(), new Path("externalResources/linkedFolderTarget/FileInLinkedFolder"));
FileTool.copy(sourceFile, fExternalFile);
-
+
IFolder folder= ResourceHelper.createLinkedFolder(project, new Path("LinkedFolder"), fExternalFile.getParentFile());
IFile file= folder.getFile(new Path("FileInLinkedFolder"));
return file.getFullPath();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#markReadOnly()
*/
@@ -84,7 +84,7 @@ public class FileBuffersForFilesInLinkedFolders extends FileBufferFunctions {
protected boolean isStateValidationSupported() {
return true;
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#deleteUnderlyingFile()
*/
@@ -93,7 +93,7 @@ public class FileBuffersForFilesInLinkedFolders extends FileBufferFunctions {
file.delete(true, false, null);
return file.exists();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#moveUnderlyingFile()
*/
@@ -102,11 +102,11 @@ public class FileBuffersForFilesInLinkedFolders extends FileBufferFunctions {
ResourceHelper.createFolder("project/folderA");
IPath path= new Path("/project/folderA/MovedLinkedFile");
file.move(path, true, false, null);
-
+
file= FileBuffers.getWorkspaceFileAtLocation(path);
if (file != null && file.exists())
return path;
-
+
return null;
}
@@ -129,7 +129,7 @@ public class FileBuffersForFilesInLinkedFolders extends FileBufferFunctions {
fileInfo.setLastModified(1000);
fileStore.putInfo(fileInfo, EFS.SET_LAST_MODIFIED, null);
-
+
IFile iFile= FileBuffers.getWorkspaceFileAtLocation(getPath());
iFile.refreshLocal(IResource.DEPTH_INFINITE, null);
return true;
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java
index 55b1d284b6c..874080daaba 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java
@@ -12,28 +12,28 @@ package org.eclipse.core.filebuffers.tests;
import java.io.File;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourceAttributes;
+import org.osgi.framework.Bundle;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourceAttributes;
+
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.jface.text.source.IAnnotationModel;
-import org.osgi.framework.Bundle;
-
/**
* FileBuffersForLinkedFiles
*/
public class FileBuffersForLinkedFiles extends FileBufferFunctions {
-
+
private File fExternalFile;
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#tearDown()
*/
@@ -42,7 +42,7 @@ public class FileBuffersForLinkedFiles extends FileBufferFunctions {
FileTool.delete(fExternalFile.getParentFile());
super.tearDown();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#createPath(org.eclipse.core.resources.IProject)
*/
@@ -53,7 +53,7 @@ public class FileBuffersForLinkedFiles extends FileBufferFunctions {
IFile file= ResourceHelper.createLinkedFile(project, new Path("LinkedFile"), fExternalFile);
return file.getFullPath();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#markReadOnly()
*/
@@ -70,7 +70,7 @@ public class FileBuffersForLinkedFiles extends FileBufferFunctions {
protected boolean isStateValidationSupported() {
return true;
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#deleteUnderlyingFile()
*/
@@ -79,7 +79,7 @@ public class FileBuffersForLinkedFiles extends FileBufferFunctions {
file.delete(true, false, null);
return file.exists();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#moveUnderlyingFile()
*/
@@ -88,11 +88,11 @@ public class FileBuffersForLinkedFiles extends FileBufferFunctions {
ResourceHelper.createFolder("project/folderA");
IPath path= new Path("/project/folderA/MovedLinkedFile");
file.move(path, true, false, null);
-
+
file= FileBuffers.getWorkspaceFileAtLocation(path);
if (file != null && file.exists())
return path;
-
+
return null;
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java
index 49272d4ed67..68b309ca638 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonAccessibleWorkspaceFiles.java
@@ -25,19 +25,19 @@ import org.eclipse.core.filebuffers.FileBuffers;
* FileBuffersForWorkspaceFiles
*/
public class FileBuffersForNonAccessibleWorkspaceFiles extends FileBufferFunctions {
-
+
protected void setUp() throws Exception {
super.setUp();
getProject().close(null);
}
-
+
protected IPath createPath(IProject project) throws Exception {
IFolder folder= ResourceHelper.createFolder("project/folderA/folderB/");
IFile file= ResourceHelper.createFile(folder, "WorkspaceFile", "content");
return file.getFullPath();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#tearDown()
*/
@@ -45,7 +45,7 @@ public class FileBuffersForNonAccessibleWorkspaceFiles extends FileBufferFunctio
FileTool.delete(getPath());
super.tearDown();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#markReadOnly()
*/
@@ -89,11 +89,11 @@ public class FileBuffersForNonAccessibleWorkspaceFiles extends FileBufferFunctio
protected Class getAnnotationModelClass() throws Exception {
return null;
}
-
+
public void test7() throws Exception {
// disable because it might create a file outside the closed project
}
-
+
public void test11_1() throws Exception {
// disable because it might create a file outside the closed project
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java
index 8a75059d578..5644bd3a330 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java
@@ -24,7 +24,7 @@ import org.eclipse.core.filebuffers.FileBuffers;
* FileBuffersForNonExistingExternalFiles
*/
public class FileBuffersForNonExistingExternalFiles extends FileBufferFunctions {
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#tearDown()
*/
@@ -32,13 +32,13 @@ public class FileBuffersForNonExistingExternalFiles extends FileBufferFunctions
FileTool.delete(getPath());
super.tearDown();
}
-
+
protected IPath createPath(IProject project) throws Exception {
IPath path= FileBuffersTestPlugin.getDefault().getStateLocation();
path= path.append("NonExistingExternalFile");
return new Path(path.toFile().getAbsolutePath());
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#markReadOnly()
*/
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java
index 2ab753d1e0a..e621183e98e 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java
@@ -27,7 +27,7 @@ import org.eclipse.core.filebuffers.LocationKind;
* FileBuffersForNonExistingWorkspaceFiles
*/
public class FileBuffersForNonExistingWorkspaceFiles extends FileBufferFunctions {
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#tearDown()
*/
@@ -35,7 +35,7 @@ public class FileBuffersForNonExistingWorkspaceFiles extends FileBufferFunctions
FileTool.delete(getPath());
super.tearDown();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#createPath(org.eclipse.core.resources.IProject)
*/
@@ -44,7 +44,7 @@ public class FileBuffersForNonExistingWorkspaceFiles extends FileBufferFunctions
IPath filePath= folder.getLocation().append("NonExistingWorkspaceFile");
return filePath.makeAbsolute();
}
-
+
public void testBug118199() throws Exception {
IFile file= getProject().getWorkspace().getRoot().getFile(getPath());
assertFalse(file.exists());
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java
index 4c36f557afa..497041b2f0b 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java
@@ -37,7 +37,7 @@ import org.eclipse.jface.text.source.IAnnotationModel;
* FileBuffersForWorkspaceFiles
*/
public class FileBuffersForWorkspaceFiles extends FileBufferFunctions {
-
+
protected IPath createPath(IProject project) throws Exception {
IFolder folder= ResourceHelper.createFolder("project/folderA/folderB/");
IFile file= ResourceHelper.createFile(folder, "WorkspaceFile", "content");
@@ -78,11 +78,11 @@ public class FileBuffersForWorkspaceFiles extends FileBufferFunctions {
ResourceHelper.createFolder("project/folderA/folderB/folderC");
IPath path= new Path("/project/folderA/folderB/folderC/MovedWorkspaceFile");
file.move(path, true, false, null);
-
+
file= FileBuffers.getWorkspaceFileAtLocation(path);
if (file != null && file.exists())
return path;
-
+
return null;
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestPlugin.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestPlugin.java
index 2ca63ae4b36..5674af1b29b 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestPlugin.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestPlugin.java
@@ -14,12 +14,12 @@ import org.eclipse.core.runtime.Plugin;
/**
* The main plug-in class to be used in the desktop.
- *
+ *
* @since 3.0
*/
public class FileBuffersTestPlugin extends Plugin {
private static FileBuffersTestPlugin fgPlugin;
-
+
public FileBuffersTestPlugin() {
fgPlugin= this;
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java
index d39561559b8..00a0c6c9242 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java
@@ -18,7 +18,7 @@ import junit.framework.TestSuite;
/**
* Test Suite for org.eclipse.core.filebuffers.
- *
+ *
* @since 3.0
*/
public class FileBuffersTestSuite {
@@ -34,12 +34,12 @@ public class FileBuffersTestSuite {
suite.addTestSuite(FileBuffersForNonExistingExternalFiles.class);
suite.addTestSuite(FileBuffersForNonExistingWorkspaceFiles.class);
suite.addTestSuite(FileBuffersForNonAccessibleWorkspaceFiles.class);
-
+
suite.addTestSuite(FileStoreFileBuffersForWorkspaceFiles.class);
suite.addTestSuite(FileStoreFileBuffersForExternalFiles.class);
suite.addTestSuite(FileStoreFileBuffersForNonExistingExternalFiles.class);
suite.addTestSuite(FileStoreFileBuffersForNonExistingWorkspaceFiles.class);
-
+
suite.addTestSuite(TextFileManagerDocCreationTests.class);
suite.addTestSuite(ResourceTextFileManagerDocCreationTests.class);
//$JUnit-END$
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java
index dff5619d8b3..559c8631532 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBufferFunctions.java
@@ -37,26 +37,26 @@ import org.eclipse.jface.text.source.IAnnotationModel;
* FileBufferFunctions
*/
public abstract class FileStoreFileBufferFunctions extends TestCase {
-
+
private IProject fProject;
protected ITextFileBufferManager fManager;
private IFileStore fFileStore;
-
-
+
+
protected abstract IPath createPath(IProject project) throws Exception;
-
+
protected abstract void setReadOnly(boolean state) throws Exception;
-
+
protected abstract boolean modifyUnderlyingFile() throws Exception;
-
+
protected abstract boolean deleteUnderlyingFile() throws Exception;
-
+
protected abstract IPath moveUnderlyingFile() throws Exception;
-
+
protected abstract boolean isStateValidationSupported();
-
+
protected abstract Class getAnnotationModelClass() throws Exception;
-
+
protected void setUp() throws Exception {
fManager= FileBuffers.getTextFileBufferManager();
@@ -65,21 +65,21 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
ITextFileBuffer buffer= fManager.getFileStoreTextFileBuffer(fFileStore);
assertTrue(buffer == null);
}
-
+
protected IProject getProject() {
return fProject;
}
-
+
protected void tearDown() throws Exception {
ITextFileBuffer buffer= fManager.getFileStoreTextFileBuffer(fFileStore);
assertTrue(buffer == null);
ResourceHelper.deleteProject("project");
}
-
+
protected IPath getPath() {
return URIUtil.toPath(fFileStore.toURI());
}
-
+
/*
* Tests getLocation.
*/
@@ -88,12 +88,12 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
try {
ITextFileBuffer buffer= fManager.getFileStoreTextFileBuffer(fFileStore);
assertEquals(fFileStore, buffer.getFileStore());
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
/*
* Tests isSynchronized.
*/
@@ -109,12 +109,12 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
fileStore.putInfo(fileInfo, EFS.SET_LAST_MODIFIED, null);
long lastModified= fileStore.fetchInfo().getLastModified();
assertTrue(lastModified == EFS.NONE || !fileBuffer.isSynchronized());
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
/*
* Tests isDirty.
*/
@@ -126,12 +126,12 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
IDocument document= fileBuffer.getDocument();
document.replace(document.getLength(), 0, "appendix");
assertTrue(fileBuffer.isDirty());
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
/*
* Tests isShared.
*/
@@ -140,7 +140,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
try {
ITextFileBuffer fileBuffer1= fManager.getFileStoreTextFileBuffer(fFileStore);
assertFalse(fileBuffer1.isShared());
-
+
fManager.connectFileStore(fFileStore, null);
try {
ITextFileBuffer fileBuffer2= fManager.getFileStoreTextFileBuffer(fFileStore);
@@ -149,14 +149,14 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
assertFalse(fileBuffer1.isShared());
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
/*
* Tests getModificationStamp.
*/
@@ -183,7 +183,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
public void test6() throws Exception {
fManager.connectFileStore(fFileStore, null);
try {
-
+
ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
// set dirty bit
IDocument document= fileBuffer.getDocument();
@@ -205,14 +205,14 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
/*
* Test commit.
*/
public void test7() throws Exception {
fManager.connectFileStore(fFileStore, null);
try {
-
+
ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
// set dirty bit
IDocument document= fileBuffer.getDocument();
@@ -244,119 +244,119 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
/*
* Test validateState.
*/
public void test8_1() throws Exception {
fManager.connectFileStore(fFileStore, null);
try {
-
+
ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
fileBuffer.validateState(null, null);
assertTrue(fileBuffer.isStateValidated());
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
/*
* Test validateState.
*/
public void test8_2() throws Exception {
fManager.connectFileStore(fFileStore, null);
try {
-
+
setReadOnly(true);
ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
fileBuffer.validateState(null, null);
assertTrue(fileBuffer.isStateValidated());
-
+
} finally {
setReadOnly(false);
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
/*
* Test resetStateValidation.
*/
public void test9_1() throws Exception {
fManager.connectFileStore(fFileStore, null);
try {
-
+
ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
fileBuffer.validateState(null, null);
fileBuffer.resetStateValidation();
if (isStateValidationSupported())
assertFalse(fileBuffer.isStateValidated());
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
/*
* Test resetStateValidation.
*/
public void test9_2() throws Exception {
fManager.connectFileStore(fFileStore, null);
try {
-
+
setReadOnly(true);
ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
fileBuffer.validateState(null, null);
fileBuffer.resetStateValidation();
if (isStateValidationSupported())
assertFalse(fileBuffer.isStateValidated());
-
+
} finally {
setReadOnly(false);
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
/*
* Test IFileBufferListener#bufferCreated and IFileBufferListener#bufferDisposed
*/
public void test10() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void bufferCreated(IFileBuffer buf) {
++count;
this.buffer= buf;
}
-
+
public void bufferDisposed(IFileBuffer buf) {
--count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
-
+
fManager.connectFileStore(fFileStore, null);
-
+
assertTrue(listener.count == 1);
assertNotNull(listener.buffer);
IFileBuffer fileBuffer= fManager.getFileStoreFileBuffer(fFileStore);
assertTrue(listener.buffer == fileBuffer);
-
+
fManager.disconnectFileStore(fFileStore, null);
assertTrue(listener.count == 0);
assertTrue(listener.buffer == fileBuffer);
-
+
} finally {
try {
fManager.disconnectFileStore(fFileStore, null);
@@ -365,263 +365,263 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
}
}
}
-
+
/*
* Test IFileBufferListener#dirtyStateChanged
*/
public void test11_1() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isDirty;
-
+
public void dirtyStateChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isDirty= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
-
+
ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
assertTrue(listener.count == 0 && listener.buffer == null);
-
+
fManager.connectFileStore(fFileStore, null);
try {
-
+
fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
IDocument document= fileBuffer.getDocument();
document.replace(0, 0, "prefix");
-
+
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
assertTrue(listener.isDirty);
-
+
fileBuffer.commit(null, true);
-
+
assertTrue(listener.count == 2);
assertTrue(listener.buffer == fileBuffer);
assertFalse(listener.isDirty);
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#dirtyStateChanged
*/
public void test11_2() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isDirty;
-
+
public void dirtyStateChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isDirty= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
assertTrue(listener.count == 0 && listener.buffer == null);
-
+
fManager.connectFileStore(fFileStore, null);
try {
-
+
fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
IDocument document= fileBuffer.getDocument();
document.replace(0, 0, "prefix");
-
+
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
assertTrue(listener.isDirty);
-
+
fileBuffer.revert(null);
-
+
assertTrue(listener.count == 2);
assertTrue(listener.buffer == fileBuffer);
assertFalse(listener.isDirty);
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#bufferContentAboutToBeReplaced/replaced
*/
public void test12_1() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer preBuffer, postBuffer;
public int preCount, postCount;
-
+
public void bufferContentAboutToBeReplaced(IFileBuffer buffer) {
++preCount;
preBuffer= buffer;
}
-
+
public void bufferContentReplaced(IFileBuffer buffer) {
++postCount;
postBuffer= buffer;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
assertTrue(listener.preCount == 0 && listener.postCount == 0 && listener.preBuffer == null && listener.postBuffer == null);
-
+
fManager.connectFileStore(fFileStore, null);
try {
-
+
fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
IDocument document= fileBuffer.getDocument();
document.replace(0, 0, "prefix");
-
+
fileBuffer.revert(null);
-
+
assertTrue(listener.preCount == 1);
assertTrue(listener.preBuffer == fileBuffer);
assertTrue(listener.postCount == 1);
assertTrue(listener.postBuffer == fileBuffer);
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#bufferContentAboutToBeReplaced/replaced
*/
public void test12_2() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer preBuffer, postBuffer;
public int preCount, postCount;
-
+
public void bufferContentAboutToBeReplaced(IFileBuffer buffer) {
++preCount;
preBuffer= buffer;
}
-
+
public void bufferContentReplaced(IFileBuffer buffer) {
++postCount;
postBuffer= buffer;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
assertTrue(listener.preCount == 0 && listener.postCount == 0 && listener.preBuffer == null && listener.postBuffer == null);
-
+
fManager.connectFileStore(fFileStore, null);
try {
-
+
fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
-
+
if (modifyUnderlyingFile()) {
assertTrue(listener.preCount == 1);
assertTrue(listener.preBuffer == fileBuffer);
assertTrue(listener.postCount == 1);
assertTrue(listener.postBuffer == fileBuffer);
}
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateValidationChanged
*/
public void test13_1() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isStateValidated;
-
+
public void stateValidationChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isStateValidated= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
ITextFileBuffer fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
assertTrue(listener.count == 0 && listener.buffer == null);
-
+
fManager.connectFileStore(fFileStore, null);
try {
-
+
fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
fileBuffer.validateState(null, null);
-
+
if (isStateValidationSupported()) {
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
assertTrue(listener.isStateValidated);
}
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateValidationChanged
*/
public void test13_2() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isStateValidated;
-
+
public void stateValidationChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isStateValidated= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -645,7 +645,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
setReadOnly(false);
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
@@ -655,18 +655,18 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
*/
public void test13_3() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isStateValidated;
-
+
public void stateValidationChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isStateValidated= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -679,7 +679,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
fileBuffer.validateState(null, null);
fileBuffer.resetStateValidation();
-
+
if (isStateValidationSupported()) {
assertTrue(listener.count == 2);
assertTrue(listener.buffer == fileBuffer);
@@ -689,29 +689,29 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateValidationChanged
*/
public void test13_4() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public boolean isStateValidated;
-
+
public void stateValidationChanged(IFileBuffer buf, boolean state) {
++count;
this.buffer= buf;
this.isStateValidated= state;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -736,27 +736,27 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
setReadOnly(false);
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#underlyingFileDeleted
*/
public void test14() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void underlyingFileDeleted(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -775,29 +775,29 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#underlyingFileMoved
*/
public void test15() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
public IPath newLocation;
-
+
public void underlyingFileMoved(IFileBuffer buf, IPath location) {
++count;
this.buffer= buf;
this.newLocation= location;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -818,7 +818,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
@@ -829,16 +829,16 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
*/
public void test16_1() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -857,27 +857,27 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateChanging for external changes
*/
public void test16_2() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -896,7 +896,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
@@ -907,16 +907,16 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
*/
public void test16_3() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -935,27 +935,27 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateChanging for internal changes
*/
public void test17_1() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -967,7 +967,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
fileBuffer= fManager.getFileStoreTextFileBuffer(fFileStore);
fileBuffer.validateState(null, null);
-
+
if (isStateValidationSupported()) {
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
@@ -976,7 +976,7 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
@@ -986,16 +986,16 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
*/
public void test17_2() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -1009,34 +1009,34 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
IDocument document= fileBuffer.getDocument();
document.replace(0, 0, "prefix");
fileBuffer.revert(null);
-
+
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test IFileBufferListener#stateChanging for internal changes
*/
public void test17_3() throws Exception {
class Listener extends FileBufferListener {
-
+
public IFileBuffer buffer;
public int count;
-
+
public void stateChanging(IFileBuffer buf) {
++count;
this.buffer= buf;
}
}
-
+
Listener listener= new Listener();
fManager.addFileBufferListener(listener);
try {
@@ -1050,19 +1050,19 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
IDocument document= fileBuffer.getDocument();
document.replace(0, 0, "prefix");
fileBuffer.commit(null, true);
-
+
assertTrue(listener.count == 1);
assertTrue(listener.buffer == fileBuffer);
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
-
+
} finally {
fManager.removeFileBufferListener(listener);
}
}
-
+
/*
* Test annotation model existence.
* ATTENTION: This test is only effective in a workspace that contains the "org.eclipse.ui.editors" bundle.
@@ -1072,27 +1072,27 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
try {
ITextFileBuffer buffer= fManager.getFileStoreTextFileBuffer(fFileStore);
assertNotNull(buffer);
-
+
Class clazz= getAnnotationModelClass();
if (clazz != null) {
IAnnotationModel model= buffer.getAnnotationModel();
assertTrue(clazz.isInstance(model));
}
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
/*
* Test notification in case of failing listener.
*/
public void test19() throws Exception {
-
+
class NotifiedListener extends FileBufferListener {
-
+
int notifyCount= 0;
-
+
public void bufferCreated(IFileBuffer buffer) {
notifyCount++;
}
@@ -1100,22 +1100,22 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
notifyCount++;
}
}
-
+
class ForcedException extends RuntimeException {
private static final long serialVersionUID= 1L;
public void printStackTrace(PrintStream s) {
s.println("!FORCED BY TEST: this entry is intentional");
}
-
+
public void printStackTrace(PrintWriter s) {
s.println("!FORCED BY TEST: this entry is intentional");
}
}
-
+
NotifiedListener notifyCounter1= new NotifiedListener();
NotifiedListener notifyCounter2= new NotifiedListener();
-
+
FileBufferListener failingListener= new FileBufferListener() {
public void bufferCreated(IFileBuffer buffer) {
throw new ForcedException();
@@ -1124,33 +1124,33 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
throw new ForcedException();
}
};
-
+
fManager.addFileBufferListener(notifyCounter1);
fManager.addFileBufferListener(failingListener);
fManager.addFileBufferListener(notifyCounter2);
-
+
fManager.connectFileStore(fFileStore, null);
try {
ITextFileBuffer buffer= fManager.getFileStoreTextFileBuffer(fFileStore);
assertNotNull(buffer);
-
+
Class clazz= getAnnotationModelClass();
if (clazz != null) {
IAnnotationModel model= buffer.getAnnotationModel();
assertTrue(clazz.isInstance(model));
}
-
+
} finally {
fManager.disconnectFileStore(fFileStore, null);
fManager.removeFileBufferListener(notifyCounter1);
fManager.removeFileBufferListener(failingListener);
fManager.removeFileBufferListener(notifyCounter2);
}
-
+
assertEquals(2, notifyCounter1.notifyCount);
assertEquals(2, notifyCounter2.notifyCount);
}
-
+
public void testGetBufferForDocument() throws Exception {
fManager.connectFileStore(fFileStore, null);
try {
@@ -1180,5 +1180,5 @@ public abstract class FileStoreFileBufferFunctions extends TestCase {
fManager.disconnectFileStore(fFileStore, null);
}
}
-
+
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java
index 97a6846eedd..7514e6a03be 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForExternalFiles.java
@@ -26,7 +26,7 @@ import org.eclipse.core.filebuffers.FileBuffers;
* FileBuffersForExternalFiles
*/
public class FileStoreFileBuffersForExternalFiles extends FileStoreFileBufferFunctions {
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#tearDown()
*/
@@ -35,7 +35,7 @@ public class FileStoreFileBuffersForExternalFiles extends FileStoreFileBufferFun
FileTool.delete(FileBuffers.getSystemFileAtLocation(getPath()).getParentFile());
super.tearDown();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#createPath(org.eclipse.core.resources.IProject)
*/
@@ -45,7 +45,7 @@ public class FileStoreFileBuffersForExternalFiles extends FileStoreFileBufferFun
FileTool.copy(sourceFile, externalFile);
return new Path(externalFile.getAbsolutePath());
}
-
+
protected void setReadOnly(boolean state) throws Exception {
IFileStore fileStore= FileBuffers.getFileStoreAtLocation(getPath());
assertNotNull(fileStore);
@@ -79,7 +79,7 @@ public class FileStoreFileBuffersForExternalFiles extends FileStoreFileBufferFun
protected boolean modifyUnderlyingFile() throws Exception {
return false;
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#getAnnotationModelClass()
*/
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java
index 815309c0287..5b713b107eb 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingExternalFiles.java
@@ -24,7 +24,7 @@ import org.eclipse.core.filebuffers.FileBuffers;
* FileBuffersForNonExistingExternalFiles
*/
public class FileStoreFileBuffersForNonExistingExternalFiles extends FileStoreFileBufferFunctions {
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#tearDown()
*/
@@ -32,13 +32,13 @@ public class FileStoreFileBuffersForNonExistingExternalFiles extends FileStoreFi
FileTool.delete(getPath());
super.tearDown();
}
-
+
protected IPath createPath(IProject project) throws Exception {
IPath path= FileBuffersTestPlugin.getDefault().getStateLocation();
path= path.append("NonExistingExternalFile");
return new Path(path.toFile().getAbsolutePath());
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#markReadOnly()
*/
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java
index 0650d8bc686..222a20f8df5 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForNonExistingWorkspaceFiles.java
@@ -27,7 +27,7 @@ import org.eclipse.core.filebuffers.LocationKind;
* FileBuffersForNonExistingWorkspaceFiles
*/
public class FileStoreFileBuffersForNonExistingWorkspaceFiles extends FileStoreFileBufferFunctions {
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#tearDown()
*/
@@ -35,7 +35,7 @@ public class FileStoreFileBuffersForNonExistingWorkspaceFiles extends FileStoreF
FileTool.delete(getPath());
super.tearDown();
}
-
+
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#createPath(org.eclipse.core.resources.IProject)
*/
@@ -44,7 +44,7 @@ public class FileStoreFileBuffersForNonExistingWorkspaceFiles extends FileStoreF
IPath filePath= folder.getLocation().append("NonExistingWorkspaceFile");
return filePath.makeAbsolute();
}
-
+
public void testBug118199() throws Exception {
IFile file= getProject().getWorkspace().getRoot().getFile(getPath());
assertFalse(file.exists());
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java
index ed8557b3375..17ffdebf2b0 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileStoreFileBuffersForWorkspaceFiles.java
@@ -37,7 +37,7 @@ import org.eclipse.jface.text.source.IAnnotationModel;
* FileBuffersForWorkspaceFiles
*/
public class FileStoreFileBuffersForWorkspaceFiles extends FileBufferFunctions {
-
+
protected IPath createPath(IProject project) throws Exception {
IFolder folder= ResourceHelper.createFolder("project/folderA/folderB/");
IFile file= ResourceHelper.createFile(folder, "WorkspaceFile", "content");
@@ -78,11 +78,11 @@ public class FileStoreFileBuffersForWorkspaceFiles extends FileBufferFunctions {
ResourceHelper.createFolder("project/folderA/folderB/folderC");
IPath path= new Path("/project/folderA/folderB/folderC/MovedWorkspaceFile");
file.move(path, true, false, null);
-
+
file= FileBuffers.getWorkspaceFileAtLocation(path);
if (file != null && file.exists())
return path;
-
+
return null;
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java
index ffc7daaa339..7d88be8dd12 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileTool.java
@@ -34,27 +34,27 @@ import org.eclipse.core.filebuffers.FileBuffers;
public class FileTool {
-
+
private final static int MAX_RETRY= 5;
-
+
/**
* A buffer.
*/
private static byte[] buffer= new byte[8192];
-
+
/**
* Unzips the given zip file to the given destination directory
* extracting only those entries the pass through the given
* filter.
- *
+ *
* @param zipFile the zip file to unzip
* @param dstDir the destination directory
* @throws IOException in case of problem
*/
public static void unzip(ZipFile zipFile, File dstDir) throws IOException {
-
+
Enumeration entries = zipFile.entries();
-
+
try {
while(entries.hasMoreElements()){
ZipEntry entry = (ZipEntry)entries.nextElement();
@@ -92,12 +92,12 @@ public class FileTool {
}
}
}
-
+
/**
* Returns the given file path with its separator
* character changed from the given old separator to the
* given new separator.
- *
+ *
* @param path a file path
* @param oldSeparator a path separator character
* @param newSeparator a path separator character
@@ -108,11 +108,11 @@ public class FileTool {
public static String changeSeparator(String path, char oldSeparator, char newSeparator){
return path.replace(oldSeparator, newSeparator);
}
-
+
/**
* Copies all bytes in the given source file to
* the given destination file.
- *
+ *
* @param source the given source file
* @param destination the given destination file
* @throws IOException in case of error
@@ -132,12 +132,12 @@ public class FileTool {
is.close();
}
}
-
+
/**
* Copies all bytes in the given source stream to
* the given destination stream. Neither streams
* are closed.
- *
+ *
* @param source the given source stream
* @param destination the given destination stream
* @throws IOException in case of error
@@ -154,7 +154,7 @@ public class FileTool {
/**
* Copies the given source file to the given destination file.
- *
+ *
* @param src the given source file
* @param dst the given destination file
* @throws IOException in case of error
@@ -180,13 +180,13 @@ public class FileTool {
return null;
}
}
-
+
public static File createTempFileInPlugin(Plugin plugin, IPath path) {
IPath stateLocation= plugin.getStateLocation();
stateLocation= stateLocation.append(path);
return stateLocation.toFile();
}
-
+
public static StringBuffer read(String fileName) throws IOException {
return read(new FileReader(fileName));
}
@@ -220,12 +220,12 @@ public class FileTool {
}
}
}
-
+
public static void delete(IPath path) {
File file= FileBuffers.getSystemFileAtLocation(path);
delete(file);
}
-
+
public static void delete(File file) {
if (file.exists()) {
for (int i= 0; i < MAX_RETRY; i++) {
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/MockDocumentSetupParticipants.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/MockDocumentSetupParticipants.java
index fa3eb16cbc2..fd0ba7655ed 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/MockDocumentSetupParticipants.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/MockDocumentSetupParticipants.java
@@ -40,7 +40,7 @@ public class MockDocumentSetupParticipants {
append(document, getClass()+"\n");
}
}
-
+
static abstract class AbstractTestDSPExtension extends AbstractTestDSP implements IDocumentSetupParticipantExtension {
/*
* @see org.eclipse.core.filebuffers.IDocumentSetupParticipantExtension#setup(org.eclipse.jface.text.IDocument, org.eclipse.core.runtime.IPath, org.eclipse.core.filebuffers.LocationKind)
@@ -49,36 +49,36 @@ public class MockDocumentSetupParticipants {
append(document, getClass()+"%%EXTENSION\n");
}
}
-
+
public static class TestDSP1 extends AbstractTestDSP {}
public static class TestDSP2 extends AbstractTestDSP {}
public static class TestDSP3 extends AbstractTestDSP {}
-
+
public static class TestDSP4 extends AbstractTestDSPExtension {}
public static class TestDSP5 extends AbstractTestDSPExtension {}
public static class TestDSP6 extends AbstractTestDSPExtension {}
-
+
public static class TestDSP7 extends AbstractTestDSPExtension {
public void setup(IDocument document, IPath location, LocationKind locationKind) {
if (locationKind == LocationKind.IFILE)
append(document, new StringBuffer(location.toPortableString()).reverse().toString());
}
}
-
+
public static class TestDSP8 extends AbstractTestDSPExtension {
public void setup(IDocument document, IPath location, LocationKind locationKind) {
if (locationKind == LocationKind.LOCATION)
append(document, new StringBuffer(location.toPortableString()).reverse().toString());
}
}
-
+
public static class TestDSP9 extends AbstractTestDSPExtension {
public void setup(IDocument document, IPath location, LocationKind locationKind) {
if (locationKind == LocationKind.NORMALIZE)
append(document, new StringBuffer(location.toPortableString()).reverse().toString());
}
}
-
+
private static void append(IDocument document, String string) {
try {
document.replace(document.getLength(), 0, string);
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceHelper.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceHelper.java
index 6abec6e5fce..2fc23f6b59e 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceHelper.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceHelper.java
@@ -37,36 +37,36 @@ import org.eclipse.core.filebuffers.manipulation.ContainerCreator;
* @since 3.0
*/
public class ResourceHelper {
-
+
private final static IProgressMonitor NULL_MONITOR= new NullProgressMonitor();
private static final int MAX_RETRY= 5;
-
+
public static IProject createProject(String projectName) throws CoreException {
-
+
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
IProject project= root.getProject(projectName);
if (!project.exists())
project.create(NULL_MONITOR);
else
project.refreshLocal(IResource.DEPTH_INFINITE, null);
-
+
if (!project.isOpen())
project.open(NULL_MONITOR);
-
+
return project;
}
-
+
public static void deleteProject(String projectName) {
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
IProject project= root.getProject(projectName);
if (project.exists())
delete(project);
}
-
+
public static void delete(final IProject project) {
delete(project, true);
}
-
+
public static void delete(final IProject project, boolean deleteContent) {
for (int i= 0; i < MAX_RETRY; i++) {
try {
@@ -84,7 +84,7 @@ public class ResourceHelper {
}
}
}
-
+
public static IFolder createFolder(String portableFolderPath) throws CoreException {
ContainerCreator creator= new ContainerCreator(ResourcesPlugin.getWorkspace(), new Path(portableFolderPath));
IContainer container= creator.createContainer(NULL_MONITOR);
@@ -96,11 +96,11 @@ public class ResourceHelper {
public static IFile createFile(IFolder folder, String name, String contents) throws CoreException {
return createFile(folder.getFile(name), contents);
}
-
+
public static IFile createFile(IProject project, String name, String contents) throws CoreException {
return createFile(project.getFile(name), contents);
}
-
+
private static IFile createFile(IFile file, String contents) throws CoreException {
if (contents == null)
contents= "";
@@ -108,48 +108,48 @@ public class ResourceHelper {
file.create(inputStream, true, NULL_MONITOR);
return file;
}
-
+
public static IFile createLinkedFile(IContainer container, IPath linkPath, File linkedFileTarget) throws CoreException {
IFile iFile= container.getFile(linkPath);
iFile.createLink(new Path(linkedFileTarget.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
return iFile;
}
-
+
public static IFile createLinkedFile(IContainer container, IPath linkPath, Plugin plugin, IPath linkedFileTargetPath) throws CoreException {
File file= FileTool.getFileInPlugin(plugin, linkedFileTargetPath);
IFile iFile= container.getFile(linkPath);
iFile.createLink(new Path(file.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
return iFile;
}
-
+
public static IFolder createLinkedFolder(IContainer container, IPath linkPath, File linkedFolderTarget) throws CoreException {
IFolder folder= container.getFolder(linkPath);
folder.createLink(new Path(linkedFolderTarget.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
return folder;
}
-
+
public static IFolder createLinkedFolder(IContainer container, IPath linkPath, Plugin plugin, IPath linkedFolderTargetPath) throws CoreException {
File file= FileTool.getFileInPlugin(plugin, linkedFolderTargetPath);
IFolder iFolder= container.getFolder(linkPath);
iFolder.createLink(new Path(file.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
return iFolder;
}
-
+
public static IProject createLinkedProject(String projectName, Plugin plugin, IPath linkPath) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
IProject project= workspace.getRoot().getProject(projectName);
-
+
IProjectDescription desc= workspace.newProjectDescription(projectName);
File file= FileTool.getFileInPlugin(plugin, linkPath);
IPath projectLocation= new Path(file.getAbsolutePath());
if (Platform.getLocation().equals(projectLocation))
projectLocation= null;
desc.setLocation(projectLocation);
-
+
project.create(desc, NULL_MONITOR);
if (!project.isOpen())
project.open(NULL_MONITOR);
-
+
return project;
}
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceTextFileManagerDocCreationTests.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceTextFileManagerDocCreationTests.java
index a1936b81e4e..adb3c35793e 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceTextFileManagerDocCreationTests.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceTextFileManagerDocCreationTests.java
@@ -24,11 +24,11 @@ import org.eclipse.core.filebuffers.LocationKind;
* @since 3.4
*/
public class ResourceTextFileManagerDocCreationTests extends AbstractFileBufferDocCreationTests {
-
+
protected void setUp() throws Exception {
fManager= new ResourceTextFileBufferManager();
}
-
+
protected void assertDocumentContent(String expectedContent, String fullPath, LocationKind locKind) {
assertEquals(expectedContent, fManager.createEmptyDocument(new Path(fullPath), locKind).get());
if (locKind == LocationKind.IFILE) {
@@ -36,7 +36,7 @@ public class ResourceTextFileManagerDocCreationTests extends AbstractFileBufferD
assertEquals(expectedContent, ((ResourceTextFileBufferManager)fManager).createEmptyDocument(file).get());
}
}
-
+
protected LocationKind[] getSupportLocationKinds() {
return new LocationKind[] {LocationKind.IFILE, LocationKind.LOCATION, LocationKind.NORMALIZE};
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/TextFileManagerDocCreationTests.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/TextFileManagerDocCreationTests.java
index be35088d2db..f8d37fc06a4 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/TextFileManagerDocCreationTests.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/TextFileManagerDocCreationTests.java
@@ -19,18 +19,18 @@ import org.eclipse.core.filebuffers.LocationKind;
* @since 3.4
*/
public class TextFileManagerDocCreationTests extends AbstractFileBufferDocCreationTests {
-
+
protected void setUp() throws Exception {
fManager= new TextFileBufferManager();
}
-
+
protected void assertDocumentContent(String expectedContent, String path, LocationKind locKind) {
if (locKind != LocationKind.IFILE) {
/** {@link TextFileBufferManager} does not deal with {@link LocationKind#IFILE} */
super.assertDocumentContent(expectedContent, path, locKind);
}
}
-
+
protected LocationKind[] getSupportLocationKinds() {
return new LocationKind[] {LocationKind.LOCATION, LocationKind.NORMALIZE};
}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
index 4094c7bf9ab..dfbfbe47411 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
@@ -60,7 +60,7 @@ public final class FileBuffers {
/**
* File buffer plug-in ID
* (value <code>"org.eclipse.core.filebuffers"</code>).
- *
+ *
* @since 3.3.
*/
public static final String PLUGIN_ID= FileBuffersPlugin.PLUGIN_ID;
@@ -122,7 +122,7 @@ public final class FileBuffers {
normalized= location;
else
normalized= normalizeLocation(location);
-
+
if (normalized.segmentCount() >= 2) {
// @see IContainer#getFile for the required number of segments
IFile file= WORKSPACE_ROOT.getFile(normalized);
@@ -151,7 +151,7 @@ public final class FileBuffers {
* exists no workspace file, the normalized form is the
* {@link IPath#makeAbsolute() absolute} form of the location.</li>
* </ul>
- *
+ *
* @param pathOrLocation the path or location to be normalized
* @return the normalized form of <code>pathOrLocation</code>
*/
@@ -198,7 +198,7 @@ public final class FileBuffers {
}
return EFS.getLocalFileSystem().getStore(location);
}
-
+
/**
* Returns the file in the local file system for the given location.
* <p>
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentSetupParticipantExtension.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentSetupParticipantExtension.java
index b977fe0fe80..ca715841fc1 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentSetupParticipantExtension.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IDocumentSetupParticipantExtension.java
@@ -18,18 +18,18 @@ import org.eclipse.jface.text.IDocument;
/**
* Extension interface for
* {@link org.eclipse.core.filebuffers.IDocumentSetupParticipant}.
- *
+ *
* <p>
* This interface is additionally implemented by
* {@link IDocumentSetupParticipant}'s which would like to alter their behavior
* based on the location of the file being opened.
* </p>
- *
+ *
* <p>
* Note that when participants implement this interface, the original method
* from {@link IDocumentSetupParticipant} will never be called.
* </p>
- *
+ *
* @see org.eclipse.core.filebuffers.IDocumentSetupParticipant
* @since 3.4
*/
@@ -37,7 +37,7 @@ public interface IDocumentSetupParticipantExtension {
/**
* Sets up the document to be ready for use by a text file buffer.
- *
+ *
* @param document the document to be set up
* @param location a path of the resource backing the new document
* @param locationKind the kind of the given location
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBuffer.java
index 9ebabcf9cbe..91563c3b0f7 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBuffer.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBuffer.java
@@ -87,11 +87,11 @@ public interface IFileBuffer {
* Returns the modification stamp of the file underlying this file buffer.
* <p>
* {@link IDocumentExtension4#UNKNOWN_MODIFICATION_STAMP} is returned if the
- * buffer cannot get the modification stamp from the underlying file.
+ * buffer cannot get the modification stamp from the underlying file.
* </p>
* <p>
* <strong>Note:</strong> The value of the modification stamp returned for
- * non-existing files can differ depending on the underlying file system.
+ * non-existing files can differ depending on the underlying file system.
* </p>
*
* @return the modification stamp of the file underlying this file buffer
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferManager.java
index 95224058943..394282d3e3d 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferManager.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferManager.java
@@ -34,8 +34,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IFileBufferManager {
-
-
+
+
/**
* Connects the file at the given location to this manager. After that call
* successfully completed it is guaranteed that each call to <code>getFileBuffer</code>
@@ -53,7 +53,7 @@ public interface IFileBufferManager {
* @deprecated As of 3.3, replaced by {@link #connect(IPath, LocationKind, IProgressMonitor)}
*/
void connect(IPath location, IProgressMonitor monitor) throws CoreException;
-
+
/**
* Connects the file at the given location to this manager. After that call
* successfully completed it is guaranteed that each call to <code>getFileBuffer</code>
@@ -110,7 +110,7 @@ public interface IFileBufferManager {
* @deprecated As of 3.3, replaced by {@link #disconnect(IPath, LocationKind, IProgressMonitor)}
*/
void disconnect(IPath location, IProgressMonitor monitor) throws CoreException;
-
+
/**
* Disconnects the file at the given location from this manager. After that
* call successfully completed there is no guarantee that <code>getFileBuffer</code>
@@ -128,7 +128,7 @@ public interface IFileBufferManager {
* @since 3.3
*/
void disconnect(IPath location, LocationKind locationKind, IProgressMonitor monitor) throws CoreException;
-
+
/**
* Disconnects the given file store from this manager. After that
* call successfully completed there is no guarantee that <code>getFileBuffer</code>
@@ -142,7 +142,7 @@ public interface IFileBufferManager {
* We had to use a different name than <code>disconnect</code> for this method
* due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=148844
* </p>
- *
+ *
* @param fileStore the file store to be disconnected
* @param monitor the progress monitor
* @throws CoreException if the file could not successfully be disconnected
@@ -181,7 +181,7 @@ public interface IFileBufferManager {
* @since 3.3
*/
IFileBuffer getFileBuffer(IPath location, LocationKind locationKind);
-
+
/**
* Returns the file buffer managed for the given file store or
* <code>null</code> if there is no such file buffer.
@@ -208,7 +208,7 @@ public interface IFileBufferManager {
* disconnected file buffers as buffers can be disconnected after calling
* this method.
* </p>
- *
+ *
* @return the file buffers managed by this file buffer manager
* @see #getFileStoreFileBuffers()
* @since 3.4
@@ -222,7 +222,7 @@ public interface IFileBufferManager {
* disconnected file buffers as buffers can be disconnected after calling
* this method.
* </p>
- *
+ *
* @return the file buffers managed by this file buffer manager
* @see #getFileBuffers()
* @since 3.4
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferStatusCodes.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferStatusCodes.java
index 9f9ef726420..541896ab6f7 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferStatusCodes.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/IFileBufferStatusCodes.java
@@ -33,36 +33,36 @@ public interface IFileBufferStatusCodes {
* Creation of file buffer failed.
*/
int CREATION_FAILED= 2;
-
+
/**
* File buffer status code indicating that an operation failed
* because a character could not be mapped using the given
* charset.
* <p>
* Value: {@value}</p>
- *
+ *
* @see UnmappableCharacterException
* @since 3.2
*/
int CHARSET_MAPPING_FAILED= 3;
-
+
/**
* File buffer status code indicating that state
* validation failed.
* <p>
* Value: {@value}</p>
- *
+ *
* @see IFileBuffer#validateState(org.eclipse.core.runtime.IProgressMonitor, Object)
* @since 3.3
*/
int STATE_VALIDATION_FAILED= 4;
-
+
/**
* File buffer status code indicating that
* a resource is marked derived.
* <p>
* Value: {@value}</p>
- *
+ *
* @see org.eclipse.core.resources.IResource#isDerived()
* @since 3.3
*/
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java
index af374af8b51..30a121ef733 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/ITextFileBufferManager.java
@@ -31,7 +31,7 @@ import org.eclipse.jface.text.source.IAnnotationModel;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ITextFileBufferManager extends IFileBufferManager {
-
+
/**
* The default text file buffer manager.
* @since 3.3
@@ -53,7 +53,7 @@ public interface ITextFileBufferManager extends IFileBufferManager {
* @deprecated As of 3.3, replaced by {@link #getTextFileBuffer(IPath, LocationKind)}
*/
ITextFileBuffer getTextFileBuffer(IPath location);
-
+
/**
* Returns the text file buffer managed for the file at the given location
* or <code>null</code> if there is no such text file buffer.
@@ -69,7 +69,7 @@ public interface ITextFileBufferManager extends IFileBufferManager {
* @since 3.3
*/
ITextFileBuffer getTextFileBuffer(IPath location, LocationKind locationKind);
-
+
/**
* Returns the text file buffer managed for the given file store
* or <code>null</code> if there is no such text file buffer.
@@ -98,7 +98,7 @@ public interface ITextFileBufferManager extends IFileBufferManager {
* the given one. Therefore this method should not be used in
* performance critical code.
* </p>
- *
+ *
* @param document the document for which to find the text file buffer
* @return the text file buffer managed for that document or <code>null</code>
* @since 3.3
@@ -128,7 +128,7 @@ public interface ITextFileBufferManager extends IFileBufferManager {
* @deprecated As of 3.3, replaced by {@link #createEmptyDocument(IPath, LocationKind)}
*/
IDocument createEmptyDocument(IPath location);
-
+
/**
* Creates a new empty document. The document is set up in the same way as
* it would be used in a text file buffer for a file at the given location.
@@ -158,7 +158,7 @@ public interface ITextFileBufferManager extends IFileBufferManager {
* @deprecated As of 3.3, replaced by {@link #createAnnotationModel(IPath, LocationKind)}
*/
IAnnotationModel createAnnotationModel(IPath location);
-
+
/**
* Creates a new annotation for the given location.
* <p>
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/LocationKind.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/LocationKind.java
index f16adb781dd..c24e3cf3844 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/LocationKind.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/LocationKind.java
@@ -15,12 +15,12 @@ import org.eclipse.core.runtime.IPath;
/**
* Type-safe enum of the available location kinds.
- *
+ *
* @since 3.3
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public final class LocationKind {
-
+
/**
* The corresponding argument is a location
* in a file system.
@@ -32,15 +32,15 @@ public final class LocationKind {
* @see IFileBufferManager#connectFileStore(org.eclipse.core.filesystem.IFileStore, org.eclipse.core.runtime.IProgressMonitor)
*/
public static final LocationKind LOCATION= new LocationKind("location"); //$NON-NLS-1$
-
+
/**
* The corresponding argument is the full path
* of an {@link org.eclipse.core.resources.IFile}.
- *
+ *
* @see org.eclipse.core.resources.IFile#getFullPath()
*/
public static final LocationKind IFILE= new LocationKind("IFile"); //$NON-NLS-1$
-
+
/**
* Tells to normalize the corresponding argument according
* to {@link FileBuffers#normalizeLocation(IPath)}.
@@ -49,18 +49,18 @@ public final class LocationKind {
* workspace then a file buffer that might be connected using
* a file store will not be found.
* </p>
- *
+ *
* @see IFileBufferManager#connectFileStore(org.eclipse.core.filesystem.IFileStore, org.eclipse.core.runtime.IProgressMonitor)
*/
public static final LocationKind NORMALIZE= new LocationKind("normalize"); //$NON-NLS-1$
-
+
private final String fName;
-
+
LocationKind(String name) {
fName= name;
}
-
+
/*
* @see java.lang.Object#toString()
*/
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/ConvertLineDelimitersOperation.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/ConvertLineDelimitersOperation.java
index b691e0810a7..b83135c01ca 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/ConvertLineDelimitersOperation.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/ConvertLineDelimitersOperation.java
@@ -12,6 +12,7 @@ package org.eclipse.core.filebuffers.manipulation;
import org.eclipse.core.internal.filebuffers.FileBuffersPlugin;
import org.eclipse.core.internal.filebuffers.Progress;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/RemoveTrailingWhitespaceOperation.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/RemoveTrailingWhitespaceOperation.java
index b42a32e0f2f..3af0276640f 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/RemoveTrailingWhitespaceOperation.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/RemoveTrailingWhitespaceOperation.java
@@ -12,6 +12,7 @@ package org.eclipse.core.filebuffers.manipulation;
import org.eclipse.core.internal.filebuffers.FileBuffersPlugin;
import org.eclipse.core.internal.filebuffers.Progress;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/TextFileBufferOperation.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/TextFileBufferOperation.java
index cd5729e651a..c9234b0ffec 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/TextFileBufferOperation.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/manipulation/TextFileBufferOperation.java
@@ -14,6 +14,7 @@ import java.util.Map;
import org.eclipse.core.internal.filebuffers.FileBuffersPlugin;
import org.eclipse.core.internal.filebuffers.Progress;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java
index 17d82720362..58bd8977cae 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ExtensionsRegistry.java
@@ -74,7 +74,7 @@ public class ExtensionsRegistry {
/**
* Return the id of the adapted content type.
- *
+ *
* @return the id
*/
public String getId() {
@@ -263,7 +263,7 @@ public class ExtensionsRegistry {
/**
* Returns a sharable document factory for the given file name or file extension.
- *
+ *
* @param nameOrExtension the name or extension to be used for lookup
* @return the sharable document factory or <code>null</code>
* @deprecated As of 3.5
@@ -279,7 +279,7 @@ public class ExtensionsRegistry {
/**
* Returns a sharable document factory for the given content types.
- *
+ *
* @param contentTypes the content types used to find the factory
* @return the sharable document factory or <code>null</code>
* @deprecated As of 3.5
@@ -301,7 +301,7 @@ public class ExtensionsRegistry {
/**
* Returns a sharable document factory for the given content types. This method considers the
* base content types of the given set of content types.
- *
+ *
* @param contentTypes the content types used to find the factory
* @return the sharable document factory or <code>null</code>
* @deprecated As of 3.5
@@ -480,7 +480,7 @@ public class ExtensionsRegistry {
/**
* Returns the sharable document factory for the given location.
- *
+ *
* @param location the location for which to looked up the factory
* @param locationKind the kind of the given location
* @return the sharable document factory
@@ -529,7 +529,7 @@ public class ExtensionsRegistry {
participants.toArray(result);
return result;
}
-
+
/**
* Returns the sharable annotation model factory for the given location.
*
@@ -548,5 +548,5 @@ public class ExtensionsRegistry {
factory= getAnnotationModelFactory(WILDCARD);
return factory;
}
-
+
}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreFileBuffer.java
index 201f40bffcf..2b325cbb6e3 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreFileBuffer.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreFileBuffer.java
@@ -40,8 +40,8 @@ public abstract class FileStoreFileBuffer extends AbstractFileBuffer {
protected long fSynchronizationStamp= IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
/** How often the synchronization context has been requested */
protected int fSynchronizationContextCount;
-
-
+
+
public FileStoreFileBuffer(TextFileBufferManager manager) {
super(manager);
}
@@ -59,14 +59,14 @@ public abstract class FileStoreFileBuffer extends AbstractFileBuffer {
fFileStore= fileStore;
if (fLocation == null)
fLocation= URIUtil.toPath(fileStore.toURI());
-
+
initializeFileBufferContent(monitor);
if (info.exists())
fSynchronizationStamp= info.getLastModified();
-
+
addFileBufferContentListeners();
}
-
+
public void create(IPath location, IProgressMonitor monitor) throws CoreException {
fLocation= location;
create(EFS.getStore(URIUtil.toURI(getLocation())), monitor);
@@ -116,7 +116,7 @@ public abstract class FileStoreFileBuffer extends AbstractFileBuffer {
public IPath getLocation() {
return fLocation;
}
-
+
/*
* @see org.eclipse.core.filebuffers.IFileBuffer#commit(org.eclipse.core.runtime.IProgressMonitor, boolean)
*/
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreTextFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreTextFileBuffer.java
index 157ddf9d9c1..66aa2aacb20 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreTextFileBuffer.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/FileStoreTextFileBuffer.java
@@ -192,7 +192,7 @@ public class FileStoreTextFileBuffer extends FileStoreFileBuffer implements ITex
private InputStream getFileContents(IFileStore fileStore) throws CoreException {
if (!fFileStore.fetchInfo().exists())
return null;
-
+
return fileStore.openInputStream(EFS.NONE, null);
}
@@ -388,7 +388,7 @@ public class FileStoreTextFileBuffer extends FileStoreFileBuffer implements ITex
stream= getFileContents(fFileStore);
if (stream == null)
return;
-
+
QualifiedName[] options= new QualifiedName[] { IContentDescription.CHARSET, IContentDescription.BYTE_ORDER_MARK };
IContentDescription description= Platform.getContentTypeManager().getDescriptionFor(stream, fFileStore.getName(), options);
if (description != null) {
@@ -514,7 +514,7 @@ public class FileStoreTextFileBuffer extends FileStoreFileBuffer implements ITex
// Make sure cache is up to date
if (!fIsCacheUpdated)
cacheEncodingState();
-
+
// User-defined encoding has first priority
if (fExplicitEncoding != null)
return fExplicitEncoding;
@@ -624,7 +624,7 @@ public class FileStoreTextFileBuffer extends FileStoreFileBuffer implements ITex
/**
* Returns the location if it is <code>null</code> or
* the name as <code>IPath</code> otherwise.
- *
+ *
* @return a non-null <code>IPath</code>
* @since 3.3.1
*/
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceExtensionRegistry.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceExtensionRegistry.java
index 7a1b14054b4..531c6b9e329 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceExtensionRegistry.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceExtensionRegistry.java
@@ -53,7 +53,7 @@ public class ResourceExtensionRegistry extends ExtensionsRegistry {
/**
* Returns the sharable document factory for the given file.
- *
+ *
* @param file the file for which to looked up the factory
* @return the sharable document factory
* @deprecated As of 3.5
@@ -69,7 +69,7 @@ public class ResourceExtensionRegistry extends ExtensionsRegistry {
factory= getDocumentFactory(WILDCARD);
return factory;
}
-
+
/**
* Returns the sharable annotation model factory for the given file.
*
@@ -115,23 +115,23 @@ public class ResourceExtensionRegistry extends ExtensionsRegistry {
*/
IDocumentSetupParticipant[] getDocumentSetupParticipants(IFile file) {
Set participants= new HashSet();
-
+
List p= getDocumentSetupParticipants(findContentTypes(file));
if (p != null)
participants.addAll(p);
-
+
p= getDocumentSetupParticipants(file.getFullPath().lastSegment());
if (p != null)
participants.addAll(p);
-
+
p= getDocumentSetupParticipants(file.getFileExtension());
if (p != null)
participants.addAll(p);
-
+
p= getDocumentSetupParticipants(WILDCARD);
if (p != null)
participants.addAll(p);
-
+
IDocumentSetupParticipant[] result= new IDocumentSetupParticipant[participants.size()];
participants.toArray(result);
return result;
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java
index 75bdae9f710..f2e39aea0e2 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceFileBuffer.java
@@ -202,8 +202,8 @@ public abstract class ResourceFileBuffer extends AbstractFileBuffer {
protected long fSynchronizationStamp= IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
/** How often the synchronization context has been requested */
protected int fSynchronizationContextCount;
-
-
+
+
public ResourceFileBuffer(TextFileBufferManager manager) {
super(manager);
}
@@ -300,7 +300,7 @@ public abstract class ResourceFileBuffer extends AbstractFileBuffer {
public IPath getLocation() {
return fLocation;
}
-
+
/*
* @see org.eclipse.core.filebuffers.IFileBuffer#computeCommitRule()
*/
@@ -400,7 +400,7 @@ public abstract class ResourceFileBuffer extends AbstractFileBuffer {
if (fStatus.isOK())
handleFileContentChanged(false, false);
}
-
+
if (isDerived(fFile)) {
IStatus status= new Status(IStatus.WARNING, FileBuffersPlugin.PLUGIN_ID, IFileBufferStatusCodes.DERIVED_FILE, FileBuffersMessages.ResourceFileBuffer_warning_fileIsDerived, null);
if (fStatus == null || fStatus.isOK())
@@ -408,7 +408,7 @@ public abstract class ResourceFileBuffer extends AbstractFileBuffer {
else
fStatus= new MultiStatus(FileBuffersPlugin.PLUGIN_ID, IFileBufferStatusCodes.STATE_VALIDATION_FAILED, new IStatus[] {fStatus, status}, FileBuffersMessages.ResourceFileBuffer_stateValidationFailed, null);
}
-
+
} catch (RuntimeException x) {
fManager.fireStateChangeFailed(this);
throw x;
@@ -497,7 +497,7 @@ public abstract class ResourceFileBuffer extends AbstractFileBuffer {
public boolean isSynchronized() {
if (fSynchronizationStamp == fFile.getModificationStamp() && fFile.isSynchronized(IResource.DEPTH_ZERO))
return true;
-
+
fSynchronizationStamp= IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
return false;
}
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java
index 123a299120c..a2eb2264470 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.java
@@ -167,7 +167,7 @@ public class ResourceTextFileBuffer extends ResourceFileBuffer implements ITextF
/**
* Returns the file buffer manager.
- *
+ *
* @return the file buffer manager
* @since 3.4
*/
@@ -302,7 +302,7 @@ public class ResourceTextFileBuffer extends ResourceFileBuffer implements ITextF
*/
protected void cacheBOM() throws CoreException {
fBOM= null;
-
+
IContentDescription description= fFile.getContentDescription();
if (description != null)
fBOM= (byte[])description.getProperty(IContentDescription.BYTE_ORDER_MARK);
@@ -337,7 +337,7 @@ public class ResourceTextFileBuffer extends ResourceFileBuffer implements ITextF
*/
protected void commitFileBufferContent(IProgressMonitor monitor, boolean overwrite) throws CoreException {
String encoding= computeEncoding();
-
+
if (fBOM == IContentDescription.BOM_UTF_16LE && CHARSET_UTF_16.equals(encoding))
encoding= CHARSET_UTF_16LE;
@@ -357,9 +357,9 @@ public class ResourceTextFileBuffer extends ResourceFileBuffer implements ITextF
CharsetEncoder encoder= charset.newEncoder();
encoder.onMalformedInput(CodingErrorAction.REPLACE);
encoder.onUnmappableCharacter(CodingErrorAction.REPORT);
-
+
InputStream stream;
-
+
try {
byte[] bytes;
ByteBuffer byteBuffer= encoder.encode(CharBuffer.wrap(fDocument.get()));
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java
index 0e8bcb4bf68..a990493406a 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/ResourceTextFileBufferManager.java
@@ -54,9 +54,9 @@ import org.eclipse.jface.text.source.IAnnotationModel;
* @since 3.3
*/
public class ResourceTextFileBufferManager extends TextFileBufferManager {
-
-
-
+
+
+
public ResourceTextFileBufferManager() {
fRegistry= new ResourceExtensionRegistry();
}
@@ -104,7 +104,7 @@ public class ResourceTextFileBufferManager extends TextFileBufferManager {
public String getDefaultEncoding() {
return ResourcesPlugin.getEncoding();
}
-
+
/*
* @see org.eclipse.core.internal.filebuffers.TextFileBufferManager#normalizeLocation(org.eclipse.core.runtime.IPath)
*/
@@ -117,7 +117,7 @@ public class ResourceTextFileBufferManager extends TextFileBufferManager {
return new ResourceTextFileBuffer(this);
return new FileStoreTextFileBuffer(this);
}
-
+
IAnnotationModel createAnnotationModel(IFile file) {
Assert.isNotNull(file);
IAnnotationModelFactory factory= ((ResourceExtensionRegistry)fRegistry).getAnnotationModelFactory(file);
@@ -133,14 +133,14 @@ public class ResourceTextFileBufferManager extends TextFileBufferManager {
document= documentFromFactory;
else
document= new SynchronizableDocument();
-
+
// Set the initial line delimiter
if (document instanceof IDocumentExtension4) {
String initalLineDelimiter= getLineDelimiterPreference(file);
if (initalLineDelimiter != null)
((IDocumentExtension4)document).setInitialLineDelimiter(initalLineDelimiter);
}
-
+
final IDocumentSetupParticipant[] participants= ((ResourceExtensionRegistry)fRegistry).getDocumentSetupParticipants(file);
if (participants != null) {
for (int i= 0; i < participants.length; i++) {
@@ -168,13 +168,13 @@ public class ResourceTextFileBufferManager extends TextFileBufferManager {
SafeRunner.run(runnable);
}
}
-
+
return document;
}
/**
* Helper to get rid of deprecation warnings.
- *
+ *
* @param file the file
* @return the created empty document or <code>null</code> if none got created
* @since 3.5
@@ -199,7 +199,7 @@ public class ResourceTextFileBufferManager extends TextFileBufferManager {
}
return runnableResult[0];
}
-
+
private String getLineDelimiterPreference(IFile file) {
IScopeContext[] scopeContext;
if (file != null && file.getProject() != null) {
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/SynchronizableDocument.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/SynchronizableDocument.java
index 76ca7966a93..2519bdfd64a 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/SynchronizableDocument.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/SynchronizableDocument.java
@@ -28,7 +28,7 @@ import org.eclipse.jface.text.Position;
* <p>
* Initially no locking takes place.
* </p>
- *
+ *
* @since 3.2
*/
public class SynchronizableDocument extends Document implements ISynchronizable {
@@ -51,7 +51,7 @@ public class SynchronizableDocument extends Document implements ISynchronizable
/**
* {@inheritDoc}
- *
+ *
* @deprecated since 3.1. Use
* {@link IDocumentExtension4#startRewriteSession(DocumentRewriteSessionType)}
* instead.
@@ -69,7 +69,7 @@ public class SynchronizableDocument extends Document implements ISynchronizable
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.1, replaced by
* {@link IDocumentExtension4#stopRewriteSession(DocumentRewriteSession)}
*/
@@ -83,10 +83,10 @@ public class SynchronizableDocument extends Document implements ISynchronizable
super.stopSequentialRewrite();
}
}
-
+
/*
* @see org.eclipse.jface.text.AbstractDocument#startRewriteSession(org.eclipse.jface.text.DocumentRewriteSessionType)
- *
+ *
* @since 3.5
*/
public DocumentRewriteSession startRewriteSession(DocumentRewriteSessionType sessionType) {
@@ -101,7 +101,7 @@ public class SynchronizableDocument extends Document implements ISynchronizable
/*
* @see org.eclipse.jface.text.AbstractDocument#stopRewriteSession(org.eclipse.jface.text.DocumentRewriteSession)
- *
+ *
* @since 3.5
*/
public void stopRewriteSession(DocumentRewriteSession session) {
@@ -281,7 +281,7 @@ public class SynchronizableDocument extends Document implements ISynchronizable
/*
* @see org.eclipse.jface.text.AbstractDocument#computePartitioning(java.lang.String, int, int, boolean)
- *
+ *
* @since 3.5
*/
public ITypedRegion[] computePartitioning(String partitioning, int offset, int length, boolean includeZeroLengthPartitions) throws BadLocationException, BadPartitioningException {
@@ -296,7 +296,7 @@ public class SynchronizableDocument extends Document implements ISynchronizable
/*
* @see org.eclipse.jface.text.AbstractDocument#getLineDelimiter(int)
- *
+ *
* @since 3.5
*/
public String getLineDelimiter(int line) throws BadLocationException {
@@ -311,7 +311,7 @@ public class SynchronizableDocument extends Document implements ISynchronizable
/*
* @see org.eclipse.jface.text.AbstractDocument#getDefaultLineDelimiter()
- *
+ *
* @since 3.5
*/
public String getDefaultLineDelimiter() {
@@ -323,10 +323,10 @@ public class SynchronizableDocument extends Document implements ISynchronizable
return super.getDefaultLineDelimiter();
}
}
-
+
/*
* @see org.eclipse.jface.text.AbstractDocument#getLineInformation(int)
- *
+ *
* @since 3.5
*/
public IRegion getLineInformation(int line) throws BadLocationException {
@@ -341,7 +341,7 @@ public class SynchronizableDocument extends Document implements ISynchronizable
/*
* @see org.eclipse.jface.text.AbstractDocument#getLineInformationOfOffset(int)
- *
+ *
* @since 3.5
*/
public IRegion getLineInformationOfOffset(int offset) throws BadLocationException {
@@ -356,7 +356,7 @@ public class SynchronizableDocument extends Document implements ISynchronizable
/*
* @see org.eclipse.jface.text.AbstractDocument#getLineLength(int)
- *
+ *
* @since 3.5
*/
public int getLineLength(int line) throws BadLocationException {
@@ -371,7 +371,7 @@ public class SynchronizableDocument extends Document implements ISynchronizable
/*
* @see org.eclipse.jface.text.AbstractDocument#getLineOffset(int)
- *
+ *
* @since 3.5
*/
public int getLineOffset(int line) throws BadLocationException {
@@ -386,7 +386,7 @@ public class SynchronizableDocument extends Document implements ISynchronizable
/*
* @see org.eclipse.jface.text.AbstractDocument#getLineOfOffset(int)
- *
+ *
* @since 3.5
*/
public int getLineOfOffset(int pos) throws BadLocationException {
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java
index 99d5ca38cd3..405f0f95025 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/internal/filebuffers/TextFileBufferManager.java
@@ -65,7 +65,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
FileBuffersPlugin.getDefault().getLog().log(status);
}
}
-
+
protected static final IContentType TEXT_CONTENT_TYPE= Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
private Map fFilesBuffers= new HashMap();
@@ -81,7 +81,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.3, replaced by {@link #connect(IPath, LocationKind, IProgressMonitor)}
*/
public void connect(IPath location, IProgressMonitor monitor) throws CoreException {
@@ -96,7 +96,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
Assert.isNotNull(location);
if (locationKind == LocationKind.NORMALIZE)
location= normalizeLocation(location);
-
+
AbstractFileBuffer fileBuffer= null;
synchronized (fFilesBuffers) {
fileBuffer= internalGetFileBuffer(location);
@@ -105,13 +105,13 @@ public class TextFileBufferManager implements ITextFileBufferManager {
return;
}
}
-
+
fileBuffer= createFileBuffer(location, locationKind);
if (fileBuffer == null)
throw new CoreException(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IFileBufferStatusCodes.CREATION_FAILED, FileBuffersMessages.FileBufferManager_error_canNotCreateFilebuffer, null));
-
+
fileBuffer.create(location, monitor);
-
+
synchronized (fFilesBuffers) {
AbstractFileBuffer oldFileBuffer= internalGetFileBuffer(location);
if (oldFileBuffer != null) {
@@ -123,18 +123,18 @@ public class TextFileBufferManager implements ITextFileBufferManager {
fileBuffer.connect();
fFilesBuffers.put(location, fileBuffer);
}
-
+
// Do notification outside synchronized block
fireBufferCreated(fileBuffer);
}
-
+
/*
* @see org.eclipse.core.filebuffers.IFileBufferManager#connectFileStore(org.eclipse.core.filesystem.IFileStore, org.eclipse.core.runtime.IProgressMonitor)
* @since 3.3
*/
public void connectFileStore(IFileStore fileStore, IProgressMonitor monitor) throws CoreException {
Assert.isLegal(fileStore != null);
-
+
FileStoreFileBuffer fileBuffer= null;
synchronized (fFileStoreFileBuffers) {
fileBuffer= internalGetFileBuffer(fileStore);
@@ -143,13 +143,13 @@ public class TextFileBufferManager implements ITextFileBufferManager {
return;
}
}
-
+
fileBuffer= createFileBuffer(fileStore);
if (fileBuffer == null)
throw new CoreException(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IFileBufferStatusCodes.CREATION_FAILED, FileBuffersMessages.FileBufferManager_error_canNotCreateFilebuffer, null));
-
+
fileBuffer.create(fileStore, monitor);
-
+
synchronized (fFileStoreFileBuffers) {
AbstractFileBuffer oldFileBuffer= internalGetFileBuffer(fileStore);
if (oldFileBuffer != null) {
@@ -161,20 +161,20 @@ public class TextFileBufferManager implements ITextFileBufferManager {
fileBuffer.connect();
fFileStoreFileBuffers.put(fileStore, fileBuffer);
}
-
+
// Do notification outside synchronized block
fireBufferCreated(fileBuffer);
}
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.3, replaced by {@link #disconnect(IPath, LocationKind, IProgressMonitor)}
*/
public void disconnect(IPath location, IProgressMonitor monitor) throws CoreException {
disconnect(location, LocationKind.NORMALIZE, monitor);
}
-
+
/*
* @since 3.3
*/
@@ -196,39 +196,39 @@ public class TextFileBufferManager implements ITextFileBufferManager {
fileBuffer= internalGetFileBuffer(location);
if (fileBuffer == null)
return;
-
+
fileBuffer.disconnect();
if (!fileBuffer.isDisconnected())
return;
-
+
fFilesBuffers.remove(location);
}
-
+
// Do notification outside synchronized block
fireBufferDisposed(fileBuffer);
fileBuffer.dispose();
}
-
+
/*
* @see org.eclipse.core.filebuffers.IFileBufferManager#disconnectFileStore(org.eclipse.core.filesystem.IFileStore, org.eclipse.core.runtime.IProgressMonitor)
* @since 3.3
*/
public void disconnectFileStore(IFileStore fileStore, IProgressMonitor monitor) throws CoreException {
Assert.isLegal(fileStore != null);
-
+
AbstractFileBuffer fileBuffer;
synchronized (fFileStoreFileBuffers) {
fileBuffer= internalGetFileBuffer(fileStore);
if (fileBuffer == null)
return;
-
+
fileBuffer.disconnect();
if (!fileBuffer.isDisconnected())
return;
fFileStoreFileBuffers.remove(fileStore);
}
-
+
// Do notification outside synchronized block
fireBufferDisposed(fileBuffer);
fileBuffer.dispose();
@@ -236,7 +236,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.2, replaced by {@link #isTextFileLocation(IPath, boolean)}
*/
public boolean isTextFileLocation(IPath location) {
@@ -267,7 +267,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
protected boolean isTextFileLocation(IFileStore fileStore, boolean strict) {
if (fileStore == null)
return false;
-
+
IContentTypeManager manager= Platform.getContentTypeManager();
IFileInfo fileInfo= fileStore.fetchInfo();
if (fileInfo.exists()) {
@@ -324,7 +324,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.3, replaced by {@link #getFileBuffer(IPath, LocationKind)}
*/
public IFileBuffer getFileBuffer(IPath location) {
@@ -349,13 +349,13 @@ public class TextFileBufferManager implements ITextFileBufferManager {
Assert.isLegal(fileStore != null);
return internalGetFileBuffer(fileStore);
}
-
+
private AbstractFileBuffer internalGetFileBuffer(IPath location) {
synchronized (fFilesBuffers) {
return (AbstractFileBuffer)fFilesBuffers.get(location);
}
}
-
+
private FileStoreFileBuffer internalGetFileBuffer(IFileStore fileStore) {
synchronized (fFileStoreFileBuffers) {
return (FileStoreFileBuffer)fFileStoreFileBuffers.get(fileStore);
@@ -364,13 +364,13 @@ public class TextFileBufferManager implements ITextFileBufferManager {
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.3, replaced by {@link #getTextFileBuffer(IPath, LocationKind)}
*/
public ITextFileBuffer getTextFileBuffer(IPath location) {
return getTextFileBuffer(location, LocationKind.NORMALIZE);
}
-
+
/*
* @see org.eclipse.core.filebuffers.ITextFileBufferManager#getTextFileBuffer(org.eclipse.core.runtime.IPath, org.eclipse.core.filebuffers.IFileBufferManager.LocationKind)
* @since 3.3
@@ -378,7 +378,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
public ITextFileBuffer getTextFileBuffer(IPath location, LocationKind locationKind) {
return (ITextFileBuffer)getFileBuffer(location, locationKind);
}
-
+
/*
* @see org.eclipse.core.filebuffers.ITextFileBufferManager#getFileStoreTextFileBuffer(org.eclipse.core.filesystem.IFileStore)
* @since 3.3
@@ -398,7 +398,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
synchronized (fFilesBuffers) {
iter= new ArrayList(fFilesBuffers.values()).iterator();
}
-
+
while (iter.hasNext()) {
Object buffer= iter.next();
if (buffer instanceof ITextFileBuffer) {
@@ -457,7 +457,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.3, replaced by {@link #createEmptyDocument(IPath, LocationKind)}
*/
public IDocument createEmptyDocument(IPath location) {
@@ -475,10 +475,10 @@ public class TextFileBufferManager implements ITextFileBufferManager {
document= documentFromFactory;
else
document= new SynchronizableDocument();
-
+
if (location == null)
return document;
-
+
// Set the initial line delimiter
if (document instanceof IDocumentExtension4) {
String initalLineDelimiter= getLineDelimiterPreference(location, locationKind);
@@ -496,7 +496,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
((IDocumentSetupParticipantExtension)participant).setup(document, location, locationKind);
else
participant.setup(document);
-
+
if (document.getDocumentPartitioner() != null) {
String message= NLSUtility.format(FileBuffersMessages.TextFileBufferManager_warning_documentSetupInstallsDefaultPartitioner, participant.getClass());
IStatus status= new Status(IStatus.WARNING, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, message, null);
@@ -519,7 +519,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
/**
* Helper to get rid of deprecation warnings.
- *
+ *
* @param location the location of the file to be connected
* @param locationKind the kind of the given location
* @return the created empty document or <code>null</code> if none got created
@@ -550,13 +550,13 @@ public class TextFileBufferManager implements ITextFileBufferManager {
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.3, replaced by {@link #createAnnotationModel(IPath, LocationKind)}
*/
public IAnnotationModel createAnnotationModel(IPath location) {
return createAnnotationModel(location, LocationKind.NORMALIZE);
}
-
+
/*
* @see org.eclipse.core.filebuffers.ITextFileBufferManager#createAnnotationModel(org.eclipse.core.runtime.IPath, org.eclipse.core.filebuffers.LocationKind)
* @since 3.3
@@ -599,7 +599,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.1, replaced by
* {@link org.eclipse.core.filebuffers.IFileBuffer#requestSynchronizationContext()}
*/
@@ -614,7 +614,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.1, replaced by {@link IFileBuffer#releaseSynchronizationContext()}
*/
public void releaseSynchronizationContext(IPath location) {
@@ -653,10 +653,10 @@ public class TextFileBufferManager implements ITextFileBufferManager {
// return createBinaryFileBuffer(location, locationKind);
return createTextFileBuffer(location, locationKind);
}
-
+
/**
* Creates a text file buffer for the given path.
- *
+ *
* @param location the location of the file to be connected
* @param locationKind the kind of the given location
* @return the text file buffer
@@ -671,7 +671,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
// // XXX: should return a binary file buffer - using text file buffer for now
// return createTextFileBuffer(location, locationKind);
// }
-
+
private FileStoreFileBuffer createFileBuffer(IFileStore location) {
/*
* XXX: the following code is commented out for performance
@@ -682,12 +682,12 @@ public class TextFileBufferManager implements ITextFileBufferManager {
// return createTextFileBuffer(location);
// return createBinaryFileBuffer(location);
return createTextFileBuffer(location);
-
+
}
/**
* Creates a text file buffer for the given file store.
- *
+ *
* @param location the file store
* @return the text file buffer
* @since 3.3
@@ -833,10 +833,10 @@ public class TextFileBufferManager implements ITextFileBufferManager {
*/
public void validateState(final IFileBuffer[] fileBuffers, IProgressMonitor monitor, final Object computationContext) throws CoreException {
}
-
+
/**
* Returns the line delimiter to be used by the given location.
- *
+ *
* @param location the location of the file to be connected
* @param locationKind the kind of the given location
* @return the line delimiter
@@ -845,5 +845,5 @@ public class TextFileBufferManager implements ITextFileBufferManager {
protected String getLineDelimiterPreference(IPath location, LocationKind locationKind) {
return System.getProperty("line.separator"); //$NON-NLS-1$
}
-
+
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractPairMatcherTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractPairMatcherTest.java
index f2671d7cf83..dcb9be2a86b 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractPairMatcherTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractPairMatcherTest.java
@@ -30,27 +30,27 @@ import org.eclipse.jface.text.source.ICharacterPairMatcher;
/**
* Generic test of simple character pair matchers
- *
+ *
* @since 3.3
*/
public abstract class AbstractPairMatcherTest extends TestCase {
/** Constructs a new character pair matcher */
protected abstract ICharacterPairMatcher createMatcher(final String chars);
-
+
/** Returns the partitioning treated by the matcher */
protected abstract String getDocumentPartitioning();
-
+
public AbstractPairMatcherTest(String name) {
super(name);
}
-
+
public AbstractPairMatcherTest() {
super();
}
/* --- T e s t s --- */
-
+
/** Tests that the test case reader works */
public void testTestCaseReader() {
performReaderTest("#( )%", 3, 0, "( )");
@@ -58,7 +58,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
performReaderTest("( )%", 3, -1, "( )");
performReaderTest("#%", 0, 0, "");
}
-
+
/** Very simple checks */
public void testSimpleMatchSameMatcher() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
@@ -70,7 +70,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
performMatch(matcher, "{% }#");
matcher.dispose();
}
-
+
/** Very simple checks */
public void testSimpleMatchDifferentMatchers() throws BadLocationException {
performMatch("()[]{}", "#( )%");
@@ -80,7 +80,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
performMatch("()[]{}", "[% ]#");
performMatch("()[]{}", "{% }#");
}
-
+
/** Close matches */
public void testCloseMatches() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
@@ -92,8 +92,8 @@ public abstract class AbstractPairMatcherTest extends TestCase {
performMatch(matcher, "(#()%)");
matcher.dispose();
}
-
-
+
+
/** Checks of simple situations where no matches should be found */
public void testIncompleteMatch() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
@@ -104,7 +104,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
performMatch(matcher, "%");
matcher.dispose();
}
-
+
/** Test that it doesn't match across different partitions */
public void testPartitioned() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
@@ -120,10 +120,10 @@ public abstract class AbstractPairMatcherTest extends TestCase {
performMatch(matcher, "(% |a ) a| |b ) b| |c ) c| )#");
matcher.dispose();
}
-
+
/** Test that it works properly next to partition boundaries */
public void testTightPartitioned() throws BadLocationException {
- final ICharacterPairMatcher matcher= createMatcher("()[]{}");
+ final ICharacterPairMatcher matcher= createMatcher("()[]{}");
performMatch(matcher, "(|b)%b|");
performMatch(matcher, "(%|b)b|");
performMatch(matcher, "|a(a|)%");
@@ -133,7 +133,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
performMatch(matcher, "(%|a)a||b)b||c)c|)#");
matcher.dispose();
}
-
+
/** Test that nesting works properly */
public void testNesting() {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
@@ -151,7 +151,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
performMatch(matcher, "a(b(c{%d(e)f}#g[h]i)j)k");
matcher.dispose();
}
-
+
/** Test a few boundary conditions */
public void testBoundaries() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
@@ -161,7 +161,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
assertNull(matcher.match(doc, doc.getLength() + 1));
matcher.dispose();
}
-
+
public void testBug156426() {
final ICharacterPairMatcher matcher= createMatcher("()[]{}<>");
performMatch(matcher, " #( a < b )% ");
@@ -170,7 +170,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
performMatch(matcher, " (% a > b )# ");
matcher.dispose();
}
-
+
/* --- U t i l i t i e s --- */
/**
@@ -184,7 +184,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
assertEquals(expectedMatch, t0.fMatch);
assertEquals(expectedString, t0.fString);
}
-
+
/**
* Checks that the given matcher matches the input as specified.
*/
@@ -210,13 +210,13 @@ public abstract class AbstractPairMatcherTest extends TestCase {
assertEquals(offset, region.getOffset());
}
}
-
+
private void performMatch(final String delims, final String testCase) {
final ICharacterPairMatcher matcher= createMatcher(delims);
performMatch(matcher, testCase);
matcher.dispose();
}
-
+
/**
* Creates a text case from a string. In the given string a '%'
* represents the position of the cursor and a '#' represents the
@@ -233,35 +233,35 @@ public abstract class AbstractPairMatcherTest extends TestCase {
final String stripped= str.replaceAll("%", "").replaceAll("#", "");
return new TestCase(stripped, pos, match);
}
-
+
private class TestCase {
-
+
public final String fString;
public final int fPos, fMatch;
-
+
public TestCase(String string, int pos, int match) {
fString= string;
fPos= pos;
fMatch= match;
}
-
+
public IDocument getDocument() {
return new StringDocument(fString);
}
-
+
public int getLength() {
return Math.abs(fPos - fMatch);
}
-
+
public int getOffset() {
if (fPos > fMatch) return fMatch;
return fPos;
}
-
+
}
-
+
private class StringDocument extends Document {
-
+
public StringDocument(String str) {
this.setTextStore(new StringTextStore(str));
this.set(str);
@@ -269,41 +269,41 @@ public abstract class AbstractPairMatcherTest extends TestCase {
this.setDocumentPartitioner(getDocumentPartitioning(), part);
part.connect(this);
}
-
+
}
-
+
private static class StringTextStore implements ITextStore {
-
+
private String fString;
-
+
public StringTextStore(final String str) {
fString= str;
}
-
+
public char get(int offset) {
return fString.charAt(offset);
}
-
+
public String get(int offset, int length) {
return fString.substring(offset, offset + length);
}
-
+
public int getLength() {
return fString.length();
}
-
+
public void replace(int offset, int length, String text) {
throw new UnsupportedOperationException();
}
-
+
public void set(String text) {
fString= text;
}
-
+
}
private static String DEFAULT_PARTITION= IDocument.DEFAULT_CONTENT_TYPE;
-
+
private static IDocumentPartitioner createPartitioner() {
final RuleBasedPartitionScanner scan= new RuleBasedPartitionScanner();
final List/*<IPredicateRule>*/ rules= new ArrayList/*<IPredicateRule>*/();
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java
index db850adcec1..60aa52d3f82 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java
@@ -30,7 +30,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
/** The maximum undo level. */
private static final int MAX_UNDO_LEVEL= 256;
-
+
/** The shell. */
private Shell fShell;
/** The text viewer. */
@@ -39,7 +39,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
private IUndoManager fUndoManager;
private static final int LOOP_COUNT= 20;
-
+
//--- Static data sets for comparing scenarios - obtained from capturing random data ---
/** Original document */
private static final String INITIAL_DOCUMENT_CONTENT= "+7cyg:/F!T4KnW;0+au$t1G%(`Z|u'7'_!-k?<c\"2Y.]CwsO.r";
@@ -50,14 +50,14 @@ public abstract class AbstractUndoManagerTest extends TestCase {
private static final boolean DEBUG= false;
-
+
/*
* @see TestCase#TestCase(String)
*/
public AbstractUndoManagerTest(final String name) {
super(name);
}
-
+
/*
* @see TestCase#setUp()
*/
@@ -68,7 +68,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
fTextViewer.setUndoManager(fUndoManager);
fUndoManager.connect(fTextViewer);
}
-
+
abstract protected IUndoManager createUndoManager(int maxUndoLevel);
/*
@@ -89,21 +89,21 @@ public abstract class AbstractUndoManagerTest extends TestCase {
final String original= "a\r\nb\r\n";
final IDocument document= new Document(original);
fTextViewer.setDocument(document);
-
+
try {
document.replace(1, 2, "\n");
document.replace(3, 2, "\n");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertTrue(fUndoManager.undoable());
fUndoManager.undo();
assertTrue(fUndoManager.undoable());
fUndoManager.undo();
final String reverted= document.get();
-
+
assertEquals(original, reverted);
}
@@ -113,31 +113,31 @@ public abstract class AbstractUndoManagerTest extends TestCase {
public void testRandomAccess() {
final int RANDOM_STRING_LENGTH= 50;
final int RANDOM_REPLACE_COUNT= 100;
-
+
assertTrue(RANDOM_REPLACE_COUNT >= 1);
assertTrue(RANDOM_REPLACE_COUNT <= MAX_UNDO_LEVEL);
-
+
String original= createRandomString(RANDOM_STRING_LENGTH);
final IDocument document= new Document(original);
fTextViewer.setDocument(document);
-
+
doChange(document, RANDOM_REPLACE_COUNT);
-
+
assertTrue(fUndoManager.undoable());
while (fUndoManager.undoable())
fUndoManager.undo();
-
+
final String reverted= document.get();
assertEquals(original, reverted);
}
-
+
private void doChange(IDocument document, int count) {
try {
String before= document.get();
-
+
if (DEBUG)
System.out.println(before);
-
+
Position [] positions= new Position[count];
String [] strings= new String[count];
for (int i= 0; i < count; i++) {
@@ -147,7 +147,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
positions[i]= position;
strings[i]= string;
}
-
+
if (DEBUG) {
System.out.print("{ ");
for (int i=0; i<count; i++) {
@@ -169,7 +169,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
assertTrue(false);
}
}
-
+
// repeatable test case for comparing success/failure among different tests
private void doRepeatableChange(IDocument document) {
assertTrue(POSITIONS.length >= (2 * REPLACEMENTS.length));
@@ -186,7 +186,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
assertTrue(false);
}
}
-
+
public void testLoopRandomAccessAsCompound() {
int i= 0;
while (i < LOOP_COUNT) {
@@ -195,7 +195,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
i++;
}
}
-
+
public void testLoopRandomAccess() {
int i= 0;
while (i < LOOP_COUNT) {
@@ -204,7 +204,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
i++;
}
}
-
+
public void testLoopRandomAccessAsUnclosedCompound() {
int i= 0;
while (i < LOOP_COUNT) {
@@ -213,7 +213,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
i++;
}
}
-
+
public void testLoopConvertLineDelimiters() {
int i= 0;
while (i < LOOP_COUNT) {
@@ -222,7 +222,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
i++;
}
}
-
+
public void testLoopRandomAccessWithMixedCompound() {
int i= 0;
while (i < LOOP_COUNT) {
@@ -231,14 +231,14 @@ public abstract class AbstractUndoManagerTest extends TestCase {
i++;
}
}
-
+
public void testRandomAccessAsCompound() {
final int RANDOM_STRING_LENGTH= 50;
final int RANDOM_REPLACE_COUNT= 100;
-
+
assertTrue(RANDOM_REPLACE_COUNT >= 1);
assertTrue(RANDOM_REPLACE_COUNT <= MAX_UNDO_LEVEL);
-
+
String original= createRandomString(RANDOM_STRING_LENGTH);
final IDocument document= new Document(original);
fTextViewer.setDocument(document);
@@ -251,23 +251,23 @@ public abstract class AbstractUndoManagerTest extends TestCase {
while (fUndoManager.undoable())
fUndoManager.undo();
assertTrue(!fUndoManager.undoable());
-
+
final String reverted= document.get();
assertEquals(original, reverted);
}
-
+
/**
* Test case for https://bugs.eclipse.org/bugs/show_bug.cgi?id=88172
*/
public void testRandomAccessAsUnclosedCompound() {
-
+
final int RANDOM_STRING_LENGTH= 50;
final int RANDOM_REPLACE_COUNT= 100;
-
+
assertTrue(RANDOM_REPLACE_COUNT >= 1);
assertTrue(RANDOM_REPLACE_COUNT <= MAX_UNDO_LEVEL);
-
+
String original= createRandomString(RANDOM_STRING_LENGTH);
final IDocument document= new Document(original);
fTextViewer.setDocument(document);
@@ -281,22 +281,22 @@ public abstract class AbstractUndoManagerTest extends TestCase {
while (fUndoManager.undoable())
fUndoManager.undo();
assertTrue(!fUndoManager.undoable());
-
+
final String reverted= document.get();
assertEquals(original, reverted);
}
-
+
public void testRandomAccessWithMixedCompound() {
final int RANDOM_STRING_LENGTH= 50;
final int RANDOM_REPLACE_COUNT= 10;
final int NUMBER_COMPOUNDS= 5;
final int NUMBER_ATOMIC_PER_COMPOUND= 3;
-
+
assertTrue(RANDOM_REPLACE_COUNT >= 1);
assertTrue(NUMBER_COMPOUNDS * (1 + NUMBER_ATOMIC_PER_COMPOUND) * RANDOM_REPLACE_COUNT <= MAX_UNDO_LEVEL);
-
+
String original= createRandomString(RANDOM_STRING_LENGTH);
final IDocument document= new Document(original);
fTextViewer.setDocument(document);
@@ -316,7 +316,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
while (fUndoManager.undoable())
fUndoManager.undo();
assertTrue(!fUndoManager.undoable());
-
+
final String reverted= document.get();
assertEquals(original, reverted);
@@ -324,59 +324,59 @@ public abstract class AbstractUndoManagerTest extends TestCase {
public void testRepeatableAccess() {
assertTrue(REPLACEMENTS.length <= MAX_UNDO_LEVEL);
-
+
final IDocument document= new Document(INITIAL_DOCUMENT_CONTENT);
fTextViewer.setDocument(document);
-
+
doRepeatableChange(document);
-
+
assertTrue(fUndoManager.undoable());
while (fUndoManager.undoable())
fUndoManager.undo();
-
+
final String reverted= document.get();
assertEquals(INITIAL_DOCUMENT_CONTENT, reverted);
}
-
+
public void testRepeatableAccessAsCompound() {
assertTrue(REPLACEMENTS.length <= MAX_UNDO_LEVEL);
final IDocument document= new Document(INITIAL_DOCUMENT_CONTENT);
fTextViewer.setDocument(document);
-
+
fUndoManager.beginCompoundChange();
doRepeatableChange(document);
fUndoManager.endCompoundChange();
-
+
assertTrue(fUndoManager.undoable());
fUndoManager.undo();
// with a single compound, there should be only one undo
assertFalse(fUndoManager.undoable());
-
+
final String reverted= document.get();
assertEquals(INITIAL_DOCUMENT_CONTENT, reverted);
}
-
+
public void testRepeatableAccessAsUnclosedCompound() {
assertTrue(REPLACEMENTS.length <= MAX_UNDO_LEVEL);
-
+
final IDocument document= new Document(INITIAL_DOCUMENT_CONTENT);
fTextViewer.setDocument(document);
-
+
fUndoManager.beginCompoundChange();
doRepeatableChange(document);
-
+
assertTrue(fUndoManager.undoable());
while (fUndoManager.undoable())
fUndoManager.undo();
-
+
final String reverted= document.get();
assertEquals(INITIAL_DOCUMENT_CONTENT, reverted);
}
-
+
public void testRepeatableAccessWithMixedAndEmptyCompound() {
assertTrue(REPLACEMENTS.length + 2 <= MAX_UNDO_LEVEL);
@@ -387,11 +387,11 @@ public abstract class AbstractUndoManagerTest extends TestCase {
doRepeatableChange(document);
fUndoManager.endCompoundChange();
assertTrue(fUndoManager.undoable());
-
+
// insert an empty compound
fUndoManager.beginCompoundChange();
fUndoManager.endCompoundChange();
-
+
// insert the atomic changes
doRepeatableChange(document);
@@ -399,12 +399,12 @@ public abstract class AbstractUndoManagerTest extends TestCase {
while (fUndoManager.undoable())
fUndoManager.undo();
assertTrue(!fUndoManager.undoable());
-
+
final String reverted= document.get();
assertEquals(INITIAL_DOCUMENT_CONTENT, reverted);
}
-
+
public void testDocumentStamp() {
final Document document= new Document(INITIAL_DOCUMENT_CONTENT);
fTextViewer.setDocument(document);
@@ -414,7 +414,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
assertEquals(stamp, document.getModificationStamp());
}
-
+
// see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=109104
public void testDocumentStamp2() throws BadLocationException {
final Document document= new Document("");
@@ -425,33 +425,33 @@ public abstract class AbstractUndoManagerTest extends TestCase {
fUndoManager.undo();
document.replace(0, 0, createRandomString(stringLength));
assertFalse(stamp == document.getModificationStamp());
-
+
}
-
+
private static String createRandomString(int length) {
final StringBuffer buffer= new StringBuffer();
-
+
for (int i= 0; i < length; i++)
buffer.append(getRandomCharacter());
return buffer.toString();
}
-
+
private static final char getRandomCharacter() {
// XXX should include \t
return (char) (32 + 95 * Math.random());
}
-
+
private static String createRandomStringPoisson(int mean) {
final int length= getRandomPoissonValue(2);
return createRandomString(length);
}
-
+
private static Position createRandomPositionPoisson(int documentLength) {
float random= (float) Math.random();
int offset= (int) (random * (documentLength + 1));
-
+
// Catch potential rounding issue
if (offset == documentLength + 1)
offset= documentLength;
@@ -459,10 +459,10 @@ public abstract class AbstractUndoManagerTest extends TestCase {
int length= getRandomPoissonValue(2);
if (offset + length > documentLength)
length= documentLength - offset;
-
+
return new Position(offset, length);
}
-
+
private static int getRandomPoissonValue(int mean) {
final int MAX_VALUE= 10;
@@ -481,10 +481,10 @@ public abstract class AbstractUndoManagerTest extends TestCase {
private static float getPoissonDistribution(float lambda, int k) {
return (float) (Math.exp(-lambda) * Math.pow(lambda, k) / faculty(k));
}
-
+
/**
* Returns the faculty of k.
- *
+ *
* @param k the <code>int</code> for which to get the faculty
* @return the faculty
*/
@@ -493,5 +493,5 @@ public abstract class AbstractUndoManagerTest extends TestCase {
? 1
: k * faculty(k - 1);
}
-
+
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest.java
index 90d014834fb..deafc45d656 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest.java
@@ -14,20 +14,20 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.jface.text.IDocumentExtension3;
-import org.eclipse.jface.text.source.ICharacterPairMatcher;
import org.eclipse.jface.text.source.DefaultCharacterPairMatcher;
+import org.eclipse.jface.text.source.ICharacterPairMatcher;
/**
* Tests for the default pair matcher.
- *
+ *
* @since 3.3
*/
public class DefaultPairMatcherTest extends AbstractPairMatcherTest {
public static Test suite() {
- return new TestSuite(DefaultPairMatcherTest.class);
+ return new TestSuite(DefaultPairMatcherTest.class);
}
-
+
protected ICharacterPairMatcher createMatcher(String chars) {
return new DefaultCharacterPairMatcher(chars.toCharArray(),
getDocumentPartitioning());
@@ -40,5 +40,5 @@ public class DefaultPairMatcherTest extends AbstractPairMatcherTest {
protected String getDocumentPartitioning() {
return IDocumentExtension3.DEFAULT_PARTITIONING;
}
-
+
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultUndoManagerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultUndoManagerTest.java
index 3bc0c98d151..ada6b8c3995 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultUndoManagerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultUndoManagerTest.java
@@ -26,14 +26,14 @@ public class DefaultUndoManagerTest extends AbstractUndoManagerTest {
public static Test suite() {
return new TestSuite(DefaultUndoManagerTest.class);
}
-
+
/*
* @see TestCase#TestCase(String)
*/
public DefaultUndoManagerTest(final String name) {
- super(name);
+ super(name);
}
-
+
/*
* @see org.eclipse.jface.text.tests.AbstractUndoManagerTest#createUndoManager(int)
* @since 3.2
@@ -41,5 +41,5 @@ public class DefaultUndoManagerTest extends AbstractUndoManagerTest {
protected IUndoManager createUndoManager(int maxUndoLevel) {
return new DefaultUndoManager(maxUndoLevel);
}
-
+
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTester.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTester.java
index 858f0de5be4..4fa4c4a55e6 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTester.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTester.java
@@ -14,17 +14,17 @@ import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
-import org.eclipse.jface.internal.text.html.HTML2TextReader;
-
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.eclipse.jface.internal.text.html.HTML2TextReader;
+
public class HTML2TextReaderTester extends TestCase {
private static final boolean DEBUG= false;
-
+
private static final String LD= System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
public HTML2TextReaderTester(String name) {
@@ -41,15 +41,15 @@ public class HTML2TextReaderTester extends TestCase {
String result= htmlReader.getString();
if (DEBUG)
System.out.println("<"+ result +"/>");
- assertEquals(expectedOutput, result);
+ assertEquals(expectedOutput, result);
}
-
+
public void test0() throws IOException{
String string= "<code>3<5<code>";
String expected= "3<5";
verify(string, expected);
}
-
+
public void test1() throws IOException{
String string= "<dl><dt>@author</dt><dd>Foo Bar</dd></dl>";
String expected= LD+ "@author"+LD+"\tFoo Bar"+LD;
@@ -67,7 +67,7 @@ public class HTML2TextReaderTester extends TestCase {
String expected= "text";
verify(string, expected);
}
-
+
public void test4() throws IOException{
String string= "<html><body text=\"#000000\" bgcolor=\"#FFFF88\"><font size=-1><h5>void p.Bb.fes()</h5><p><dl><dt>Parameters:</dt><dd><b>i</b> fred or <code>null</code></dd></dl></font></body></html>";
String expected= "void p.Bb.fes()"+ LD + LD + LD+ "Parameters:"+ LD + "\ti fred or null"+LD;
@@ -86,12 +86,12 @@ public class HTML2TextReaderTester extends TestCase {
String expected= LD + "Something." + LD + "Something more.";
verify(string, expected);
}
-
+
public void testComments() throws Exception {
String string= "<!-- begin-user-doc -->no comment<!-- end-user-doc -->";
String expected= "no comment";
verify(string,expected);
}
-
+
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
index a5dace1f4b0..ea87895762c 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
@@ -19,7 +19,7 @@ import org.eclipse.jface.text.tests.rules.RulesTestSuite;
/**
* Test Suite for org.eclipse.jface.text.
- *
+ *
* @since 3.0
*/
public class JFaceTextTestSuite extends TestSuite {
@@ -34,7 +34,7 @@ public class JFaceTextTestSuite extends TestSuite {
suite.addTest(RulesTestSuite.suite());
suite.addTest(ReconcilerTestSuite.suite());
suite.addTest(DefaultPairMatcherTest.suite());
-
+
return suite;
}
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TestTextEvent.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TestTextEvent.java
index 214b1233b10..584d5bb0b9d 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TestTextEvent.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TestTextEvent.java
@@ -15,11 +15,11 @@ import org.eclipse.jface.text.TextEvent;
public class TestTextEvent extends TextEvent {
-
+
TestTextEvent(DocumentEvent event, String replacedText) {
super(event.getOffset(), event.getLength(), event.getText(), replacedText, event, true);
}
-
+
TestTextEvent(String text) {
super(0, 0, text, (String) null, (DocumentEvent) null, true);
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TestTextViewer.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TestTextViewer.java
index c20012feaea..10575a78970 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TestTextViewer.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TestTextViewer.java
@@ -18,6 +18,8 @@ import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.jface.viewers.ISelectionProvider;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IAutoIndentStrategy;
@@ -31,6 +33,7 @@ import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.ITextInputListener;
import org.eclipse.jface.text.ITextListener;
import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.IUndoManager;
import org.eclipse.jface.text.IViewportListener;
import org.eclipse.jface.text.TextEvent;
@@ -41,21 +44,19 @@ import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
public class TestTextViewer implements ISourceViewer, IDocumentListener {
-
+
protected IDocument fDocument;
protected List fInputListeners= new ArrayList();
protected List fTextListeners= new ArrayList();
protected TextPresentation fTextPresentation;
protected Point fSelection= new Point(-1, -1);
protected String fDeletion;
-
+
/**
* @see ITextViewer#setDocument(IDocument, int, int)
*/
@@ -76,17 +77,17 @@ public class TestTextViewer implements ISourceViewer, IDocumentListener {
public void setDocument(IDocument document) {
IDocument oldDoc= fDocument;
fireTextInputChanged(oldDoc, document, true);
-
+
if (oldDoc != null)
oldDoc.removeDocumentListener(this);
-
+
fDocument= document;
-
+
if (fDocument != null) {
fireTextChanged(new TestTextEvent(fDocument.get()));
fDocument.addDocumentListener(this);
}
-
+
fireTextInputChanged(oldDoc, document, false);
}
@@ -101,10 +102,10 @@ public class TestTextViewer implements ISourceViewer, IDocumentListener {
* @see ITextViewer#addTextInputListener(ITextInputListener)
*/
public void addTextInputListener(ITextInputListener listener) {
- if (!fInputListeners.contains(listener))
+ if (!fInputListeners.contains(listener))
fInputListeners.add(listener);
}
-
+
protected void fireTextInputChanged(IDocument oldDoc, IDocument newDoc, boolean about) {
Iterator e= new ArrayList(fInputListeners).iterator();
while (e.hasNext()) {
@@ -115,35 +116,35 @@ public class TestTextViewer implements ISourceViewer, IDocumentListener {
l.inputDocumentChanged(oldDoc, newDoc);
}
}
-
+
/**
* @see ITextViewer#changeTextPresentation(TextPresentation, boolean)
*/
public void changeTextPresentation(TextPresentation presentation, boolean p1) {
fTextPresentation= presentation;
}
-
+
/**
* @see ITextViewer#invalidateTextPresentation()
*/
public void invalidateTextPresentation() {
}
-
+
public TextPresentation getTextPresentation() {
return fTextPresentation;
}
-
+
public void documentAboutToBeChanged(DocumentEvent event) {
try {
fDeletion= fDocument.get(event.getOffset(), event.getLength());
} catch (BadLocationException x) {
}
}
-
+
public void documentChanged(DocumentEvent event) {
fireTextChanged(new TestTextEvent(event, fDeletion));
- }
-
+ }
+
/**
* @see ITextViewer#getFindReplaceTarget()
*/
@@ -247,7 +248,7 @@ public class TestTextViewer implements ISourceViewer, IDocumentListener {
*/
public void activatePlugins() {
}
-
+
/**
* @see ITextViewer#resetPlugins()
*/
@@ -341,7 +342,7 @@ public class TestTextViewer implements ISourceViewer, IDocumentListener {
public void removeTextListener(ITextListener listener) {
fTextListeners.remove(listener);
}
-
+
protected void fireTextChanged(TextEvent event) {
Iterator e= new ArrayList(fTextListeners).iterator();
while (e.hasNext()) {
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java
index be232f1ecbe..abfa697f696 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java
@@ -16,27 +16,27 @@ import junit.framework.TestSuite;
public class TextHoverPopupTest extends TestCase {
-
-
+
+
public TextHoverPopupTest(String name) {
super(name);
}
-
+
protected void setUp() {
}
-
+
public static Test suite() {
- return new TestSuite(TextHoverPopupTest.class);
+ return new TestSuite(TextHoverPopupTest.class);
}
-
+
protected void tearDown() {
}
-
-
+
+
protected int search(int[] array, int x) {
int low= 0;
int high= array.length -1;
-
+
while (high > low) {
int offset= (low + high) / 2;
int lookup= array[offset];
@@ -47,10 +47,10 @@ public class TextHoverPopupTest extends TestCase {
else
low= high= offset;
}
-
+
return high;
}
-
+
public void testSearch() {
int[] values= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
for (int i= 0; i < 10; i++) {
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextPresentationTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextPresentationTest.java
index a20c4adb2a0..eabccf64169 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextPresentationTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextPresentationTest.java
@@ -25,24 +25,24 @@ import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextPresentation;
public class TextPresentationTest extends TestCase {
-
+
private static final int NORMAL= SWT.NORMAL;
private static final int BOLD= SWT.BOLD;
// private static final int ITALIC= SWT.ITALIC;
-
+
private TextPresentation fTextPresentation;
private StyleRange[] fAllRanges;
private StyleRange[] fNonDefaultRanges;
-
+
public static Test suite() {
return new TestSuite(TextPresentationTest.class);
}
-
+
protected void setUp() {
setUpStyleRanges();
setUpTextPresentation();
}
-
+
private void setUpStyleRanges() {
fAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
@@ -53,21 +53,21 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL)
};
-
+
fNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange( 47, 54, BOLD),
createStyleRange( 96, 102, BOLD)
};
}
-
- private void setUpTextPresentation() {
+
+ private void setUpTextPresentation() {
fTextPresentation= new TextPresentation();
fTextPresentation.setDefaultStyleRange(createStyleRange(0, 140, NORMAL));
for (int i= 0; i < fAllRanges.length; i++)
fTextPresentation.addStyleRange(fAllRanges[i]);
}
-
+
/**
* @param end is exclusive
*/
@@ -90,9 +90,9 @@ public class TextPresentationTest extends TestCase {
}
private Display fDisplay= Display.getDefault();
-
+
/**
- * @return <code>null</code> if any of the parameters is smaller than 0 or greater than 255
+ * @return <code>null</code> if any of the parameters is smaller than 0 or greater than 255
*/
private Color createColor(int red, int green, int blue) {
if (red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255)
@@ -107,7 +107,7 @@ public class TextPresentationTest extends TestCase {
assertEquals(expectedAllRanges[i], e.next());
}
assertTrue(!e.hasNext());
-
+
e= fTextPresentation.getNonDefaultStyleRangeIterator();
for (int i= 0; i < expectedNonDefaultRanges.length; i++) {
assertTrue(e.hasNext());
@@ -119,38 +119,38 @@ public class TextPresentationTest extends TestCase {
public void testUnclippedRegions() {
checkRegions(fAllRanges, fNonDefaultRanges);
}
-
+
public void testClippedRegions1() {
fTextPresentation.setResultWindow(new Region(0, 140));
checkRegions(fAllRanges, fNonDefaultRanges);
}
-
+
public void testClippedRegions2() {
-
+
fTextPresentation.setResultWindow(new Region(30, 70));
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 17, NORMAL),
createStyleRange( 17, 24, BOLD),
createStyleRange( 24, 66, NORMAL),
createStyleRange( 66, 70, BOLD)
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 17, 24, BOLD),
createStyleRange( 66, 70, BOLD)
};
-
+
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range at start of first existing range.
*/
public void testMergeStyleRange1() {
StyleRange range= createStyleRange(0, 2, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange(0, 2, 1, -1, NORMAL),
createStyleRange( 2, 4, NORMAL),
@@ -161,7 +161,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange(0, 2, 1, -1, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -171,14 +171,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range at end of last existing range.
*/
public void testMergeStyleRange2() {
StyleRange range= createStyleRange(138, 140, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -189,7 +189,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange(102, 138, NORMAL),
createStyleRange(138, 140, 1, -1, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange( 47, 54, BOLD),
@@ -206,7 +206,7 @@ public class TextPresentationTest extends TestCase {
public void testMergeStyleRange3() {
StyleRange range= createStyleRange(20, 22, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -217,7 +217,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange(20, 22, 1, -1, NORMAL),
@@ -227,14 +227,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range within existing default range.
*/
public void testMergeStyleRange4() {
StyleRange range= createStyleRange(22, 24, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -246,7 +246,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange(22, 24, 1, -1, NORMAL),
@@ -256,14 +256,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range at end of existing default range.
*/
public void testMergeStyleRange5() {
StyleRange range= createStyleRange(45, 47, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -274,7 +274,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange(45, 47, 1, -1, NORMAL),
@@ -284,14 +284,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range at start of existing non-default range.
*/
public void testMergeStyleRange6() {
StyleRange range= createStyleRange(47, 49, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -302,7 +302,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange(47, 49, 1, -1, BOLD),
@@ -312,14 +312,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range within existing non-default range.
*/
public void testMergeStyleRange7() {
StyleRange range= createStyleRange(49, 51, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -331,7 +331,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange( 47, 49, BOLD),
@@ -342,14 +342,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range at end of existing non-default range.
*/
public void testMergeStyleRange8() {
StyleRange range= createStyleRange(52, 54, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -360,7 +360,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange( 47, 52, BOLD),
@@ -370,14 +370,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range from existing default to non-default range.
*/
public void testMergeStyleRange9() {
StyleRange range= createStyleRange(45, 49, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -389,7 +389,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange(45, 47, 1, -1, NORMAL),
@@ -400,14 +400,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range from existing non-default to default range.
*/
public void testMergeStyleRange10() {
StyleRange range= createStyleRange(52, 56, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -419,7 +419,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange( 47, 52, BOLD),
@@ -430,14 +430,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range from existing default over non-default to default range.
*/
public void testMergeStyleRange11() {
StyleRange range= createStyleRange(45, 56, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -449,7 +449,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange(45, 47, 1, -1, NORMAL),
@@ -460,14 +460,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range from existing non-default over default to non-default range.
*/
public void testMergeStyleRange12() {
StyleRange range= createStyleRange(52, 98, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -479,7 +479,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 98, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange( 47, 52, BOLD),
@@ -491,14 +491,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range over existing default range.
*/
public void testMergeStyleRange13() {
StyleRange range= createStyleRange(20, 47, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -508,7 +508,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange(20, 47, 1, -1, NORMAL),
@@ -518,14 +518,14 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-
+
/**
* Merge range over existing non-default range.
*/
public void testMergeStyleRange14() {
StyleRange range= createStyleRange(47, 54, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange( 0, 4, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -535,7 +535,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange( 96, 102, BOLD),
createStyleRange(102, 140, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange( 4, 20, BOLD),
createStyleRange(47, 54, 1, -1, BOLD),
@@ -557,7 +557,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange(138, 140, 1, -1, NORMAL), // at end of last existing
};
fTextPresentation.mergeStyleRanges(ranges);
-
+
StyleRange[] expectedAllRanges= new StyleRange[] {
createStyleRange(0, 2, 1, -1, NORMAL),
createStyleRange( 2, 4, NORMAL),
@@ -577,7 +577,7 @@ public class TextPresentationTest extends TestCase {
createStyleRange(102, 138, NORMAL),
createStyleRange(138, 140, 1, -1, NORMAL),
};
-
+
StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
createStyleRange(0, 2, 1, -1, NORMAL),
createStyleRange( 4, 20, BOLD),
@@ -601,12 +601,12 @@ public class TextPresentationTest extends TestCase {
// public void testMergeStyleRange0() {
//// StyleRange range= createStyleRange(0, 2, 1, -1, NORMAL);
//// fTextPresentation.mergeStyleRange(range);
-//
+//
//// StyleRange[] ranges= new StyleRange[] {
//// createStyleRange(0, 2, 1, -1, NORMAL),
//// };
//// fTextPresentation.mergeStyleRanges(ranges);
-//
+//
// StyleRange[] expectedAllRanges= new StyleRange[] {
// createStyleRange( 0, 4, NORMAL),
// createStyleRange( 4, 20, BOLD),
@@ -616,7 +616,7 @@ public class TextPresentationTest extends TestCase {
// createStyleRange( 96, 102, BOLD),
// createStyleRange(102, 140, NORMAL),
// };
-//
+//
// StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
// createStyleRange( 4, 20, BOLD),
// createStyleRange( 47, 54, BOLD),
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
index 6e11d0a23ca..effd2878d8b 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
@@ -42,7 +42,7 @@ public class TextViewerUndoManagerTest extends AbstractUndoManagerTest {
public static Test suite() {
return new TestSuite(TextViewerUndoManagerTest.class);
}
-
+
/*
* @see TestCase#TestCase(String)
*/
@@ -59,12 +59,12 @@ public class TextViewerUndoManagerTest extends AbstractUndoManagerTest {
}
//--- DocumentUndoManager only ---
-
+
public void internalTestTransferNonTextOp(final boolean isUndoable) throws Exception {
Object context= new Object();
DocumentUndoManager tempUndoManager= new DocumentUndoManager(new Document());
tempUndoManager.connect(context);
-
+
IUndoableOperation operation= new AbstractOperation("") {
public boolean canUndo() {
return isUndoable;
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/AbstractReconcilerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/AbstractReconcilerTest.java
index 5151b5ba7a3..251306c86f7 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/AbstractReconcilerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/AbstractReconcilerTest.java
@@ -31,14 +31,14 @@ import org.eclipse.jface.text.tests.TestTextViewer;
/**
* Reconciler tests. Uses barrier synchronization and a call log to assert
* correct order of reconciling events.
- *
+ *
* TODO test reconciler arguments (delay > 0 etc.)
* TODO incremental reconciler tests
- *
+ *
* @since 3.1
*/
public class AbstractReconcilerTest extends TestCase {
-
+
/**
* Modified barrier: there are two threads: the main (testing) thread
* creating the barrier, and the reconciler thread. When both threads have
@@ -55,32 +55,32 @@ public class AbstractReconcilerTest extends TestCase {
private int fWaiting= 0;
private boolean fMainThreadArrived= false;
private boolean fIsInactive= false;
-
+
Barrier() {
fParticipants= 2;
fMainThread= Thread.currentThread();
}
-
+
public void await() {
synchronized (fMutex) {
if (fIsInactive)
return;
-
+
fWaiting++;
-
+
boolean isMainThread= Thread.currentThread() == fMainThread;
if (isMainThread)
fMainThreadArrived= true;
-
+
if (allArrived()) {
if (!fMainThreadArrived) {
fWaiting--;
throw new RuntimeException(getClass() + " can't join barrier if only the main thread is missing!");
}
-
+
if (!isMainThread)
notifyMainThread();
- }
+ }
if (!allArrived() || !isMainThread) {
try {
if (!isMainThread)
@@ -121,14 +121,14 @@ public class AbstractReconcilerTest extends TestCase {
}
}
}
-
+
private Accessor fAccessor;
private Barrier fBarrier;
private List fCallLog;
private ITextViewer fViewer;
protected AbstractReconciler fReconciler;
private Document fDocument;
-
+
protected void setUp() {
fBarrier= new Barrier();
fCallLog= Collections.synchronizedList(new ArrayList());
@@ -156,16 +156,16 @@ public class AbstractReconcilerTest extends TestCase {
};
fReconciler.setIsIncrementalReconciler(false);
fReconciler.setDelay(50); // make tests run faster
-
+
fViewer= new TestTextViewer();
fReconciler.install(fViewer);
-
+
fAccessor= new Accessor(fReconciler, AbstractReconciler.class);
Object object= fAccessor.get("fThread");
fAccessor= new Accessor(object, object.getClass());
}
-
-
+
+
protected void tearDown() throws Exception {
fBarrier.shutdown();
fReconciler.uninstall();
@@ -176,20 +176,20 @@ public class AbstractReconcilerTest extends TestCase {
// XXX shouldn't it be dirty?
assertFalse(isActive());
assertFalse(isDirty());
-
+
// set up initial document
fDocument= new Document("foo");
fViewer.setDocument(fDocument);
assertEquals("reconcilerDocumentChanged", fCallLog.remove(0));
assertEquals("aboutToBeReconciled", fCallLog.remove(0));
-
+
fBarrier.await();
assertEquals("initialProcess", fCallLog.remove(0));
// XXX shouldn't it be dirty and active during initialProcess?
assertFalse(isActive());
assertFalse(isDirty());
fBarrier.wakeAll();
-
+
// wait until clean
pollUntilClean();
assertFalse(isActive());
@@ -202,13 +202,13 @@ public class AbstractReconcilerTest extends TestCase {
dirty();
assertEquals("aboutToBeReconciled", fCallLog.remove(0));
assertEquals("reconcilerReset", fCallLog.remove(0));
-
+
fBarrier.await();
assertEquals("process", fCallLog.remove(0));
assertTrue(isActive());
assertTrue(isDirty());
fBarrier.wakeAll();
-
+
// wait until clean
pollUntilClean();
assertFalse(isActive());
@@ -223,7 +223,7 @@ public class AbstractReconcilerTest extends TestCase {
public void testDirtyingWhenRunning() throws InterruptedException, BadLocationException {
installDocument();
-
+
dirty();
fBarrier.await();
assertTrue(isActive());
@@ -234,7 +234,7 @@ public class AbstractReconcilerTest extends TestCase {
// when the second edition comes in
assertEquals("reconcilerReset", fCallLog.remove(0));
fBarrier.wakeAll();
-
+
fBarrier.await();
assertEquals("process", fCallLog.remove(0));
fBarrier.wakeAll();
@@ -245,12 +245,12 @@ public class AbstractReconcilerTest extends TestCase {
public void testCancellingWhenClean() throws InterruptedException, BadLocationException {
installDocument();
-
+
// dirty again
dirty();
fBarrier.await();
fBarrier.wakeAll();
-
+
// cancel
fCallLog.clear();
fReconciler.uninstall();
@@ -263,7 +263,7 @@ public class AbstractReconcilerTest extends TestCase {
public void testCancellingWhenRunning() throws InterruptedException, BadLocationException {
installDocument();
-
+
// dirty and cancel
dirty();
fBarrier.await();
@@ -279,7 +279,7 @@ public class AbstractReconcilerTest extends TestCase {
public void testReplacingDocumentWhenClean() throws InterruptedException, BadLocationException {
installDocument();
-
+
// replace
fCallLog.clear();
fViewer.setDocument(new Document("bar"));
@@ -289,7 +289,7 @@ public class AbstractReconcilerTest extends TestCase {
fBarrier.await();
assertEquals("process", fCallLog.remove(0));
fBarrier.wakeAll();
-
+
pollUntilClean();
assertFalse(isActive());
assertFalse(isDirty());
@@ -297,7 +297,7 @@ public class AbstractReconcilerTest extends TestCase {
public void testReplacingDocumentWhenRunning() throws InterruptedException, BadLocationException {
installDocument();
-
+
// dirty and replace
dirty();
fBarrier.await();
@@ -307,8 +307,8 @@ public class AbstractReconcilerTest extends TestCase {
assertEquals("reconcilerReset", fCallLog.remove(0));
assertTrue(fCallLog.isEmpty());
fBarrier.wakeAll();
-
- // XXX this fails, which is a bug - replacing the document should
+
+ // XXX this fails, which is a bug - replacing the document should
// cancel the progress monitor
// fBarrier.await();
// assertEquals("process", fCallLog.remove(0));
@@ -322,7 +322,7 @@ public class AbstractReconcilerTest extends TestCase {
// initial process
fBarrier.await();
fBarrier.wakeAll();
-
+
pollUntilClean();
fCallLog.clear();
}
@@ -362,6 +362,6 @@ public class AbstractReconcilerTest extends TestCase {
Object bool= fAccessor.invoke("isDirty", null);
return ((Boolean) bool).booleanValue();
}
-
-
+
+
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/ReconcilerTestSuite.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/ReconcilerTestSuite.java
index 7da50132a75..32dfe189e52 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/ReconcilerTestSuite.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/ReconcilerTestSuite.java
@@ -16,7 +16,7 @@ import junit.framework.TestSuite;
/**
- *
+ *
* @since 3.0
*/
public class ReconcilerTestSuite {
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerTest.java
index 1c1108e593c..4dc114b07ff 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerTest.java
@@ -18,7 +18,7 @@ public class DefaultPartitionerTest extends FastPartitionerTest {
protected IDocumentPartitioner createPartitioner(IPartitionTokenScanner scanner) {
return new DefaultPartitioner(scanner, new String[] { DEFAULT, COMMENT });
}
-
+
/*
* @see org.eclipse.jface.text.tests.rules.FastPartitionerTest#testPR130900()
*/
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerZeroLengthTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerZeroLengthTest.java
index 1b426daddf8..9e1792aa2e7 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerZeroLengthTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerZeroLengthTest.java
@@ -32,7 +32,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
private static final String COMMENT= "comment";
private static final String DEFAULT= IDocument.DEFAULT_CONTENT_TYPE;
-
+
private IDocument fDoc;
private FastPartitioner fPartitioner;
@@ -106,7 +106,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
int[] offsets= new int[] { 13, 26 };
assertGetZeroLengthContentType_InterleavingPartitions(offsets);
}
-
+
public void testComputeZeroLengthPartitioning() {
fDoc.set("docu ment/* comment */docu ment");
@@ -155,7 +155,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
int[] offsets= new int[] { 13, 26 };
assertComputeZeroLengthPartitioning_InterleavingPartitions(13, 26, offsets, DEFAULT);
}
-
+
public void testComputePartitioningSubrangeAfterBoundaries() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -169,31 +169,31 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
int[] offsets= new int[] { };
assertComputeZeroLengthPartitioning_InterleavingPartitions(1, 12, offsets, COMMENT);
}
-
+
public void testComputePartitioningSubrangeInBoundaries2() {
fDoc.set("docu ment");
int[] offsets= new int[] { };
assertComputeZeroLengthPartitioning_InterleavingPartitions(1, 12, offsets, DEFAULT);
}
-
+
private void assertComputeZeroLengthPartitioning_InterleavingPartitions(int[] offsets) {
assertComputeZeroLengthPartitioning_InterleavingPartitions(0, fDoc.getLength(), offsets, DEFAULT);
}
private void assertComputeZeroLengthPartitioning_InterleavingPartitions(int startOffset, int endOffset, int[] offsets, String startType) {
ITypedRegion[] regions= fPartitioner.computePartitioning(startOffset, endOffset - startOffset, true);
-
+
String type= startType;
int previousOffset= startOffset;
-
+
assertEquals(offsets.length + 1, regions.length);
for (int i= 0; i <= offsets.length; i++) {
int currentOffset= (i == offsets.length) ? endOffset : offsets[i];
ITypedRegion region= regions[i];
-
+
assertTypedRegion(region, previousOffset, currentOffset, type);
-
+
// advance
if (type == DEFAULT)
type= COMMENT;
@@ -209,7 +209,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
for (int i= 0; i <= offsets.length; i++) {
int offset= (i == offsets.length) ? fDoc.getLength() : offsets[i];
assertEqualPartitionType(previousOffset, offset, type);
-
+
// advance
if (type == DEFAULT)
type= COMMENT;
@@ -225,7 +225,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
for (int i= 0; i <= offsets.length; i++) {
int offset= (i == offsets.length) ? fDoc.getLength() : offsets[i];
assertEqualPartition(previousOffset, offset, type);
-
+
// advance
if (type == DEFAULT)
type= COMMENT;
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java
index 0617764370b..f6701616565 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java
@@ -35,7 +35,7 @@ public class FastPartitionerTest extends TestCase {
protected static final String COMMENT= "comment";
protected static final String DEFAULT= IDocument.DEFAULT_CONTENT_TYPE;
-
+
private IDocument fDoc;
private IDocumentPartitioner fPartitioner;
@@ -113,7 +113,7 @@ public class FastPartitionerTest extends TestCase {
int[] offsets= new int[] { 13, 26 };
assertGetContentType_InterleavingPartitions(offsets);
}
-
+
public void testComputePartitioning() {
fDoc.set("docu ment/* comment */docu ment");
@@ -162,7 +162,7 @@ public class FastPartitionerTest extends TestCase {
int[] offsets= new int[] { 13, 26 };
assertComputePartitioning_InterleavingPartitions(13, 26, offsets, DEFAULT);
}
-
+
public void testComputePartitioningSubrangeAfterBoundaries() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -176,30 +176,30 @@ public class FastPartitionerTest extends TestCase {
int[] offsets= new int[] { };
assertComputePartitioning_InterleavingPartitions(1, 12, offsets, COMMENT);
}
-
+
public void testComputePartitioningSubrangeInBoundaries2() {
fDoc.set("docu ment");
int[] offsets= new int[] { };
assertComputePartitioning_InterleavingPartitions(1, 12, offsets, DEFAULT);
}
-
+
public void testPR101014() throws BadLocationException {
fDoc.set(
- "package pr101014;\n" +
- "\n" +
- "class X {\n" +
- "String s= \n" +
- " /*foo*/;\n" +
+ "package pr101014;\n" +
+ "\n" +
+ "class X {\n" +
+ "String s= \n" +
+ " /*foo*/;\n" +
"}\n");
-
+
int[] offsets= {41, 48};
assertComputePartitioning_InterleavingPartitions(offsets);
-
+
fDoc.replace(40, 8, " /*foo*/");
assertComputePartitioning_InterleavingPartitions(offsets);
}
-
+
public void testPR130900() throws Exception {
fPartitioner.disconnect();
IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() {
@@ -212,32 +212,32 @@ public class FastPartitionerTest extends TestCase {
fPartitioner= createPartitioner(scanner);
fDoc.setDocumentPartitioner(fPartitioner);
fPartitioner.connect(fDoc);
-
+
fDoc.set("#");
int[] offsets= new int[] { 0, 1 };
assertComputePartitioning_InterleavingPartitions(offsets);
}
-
+
private void assertComputePartitioning_InterleavingPartitions(int[] offsets) {
assertComputePartitioning_InterleavingPartitions(0, fDoc.getLength(), offsets, DEFAULT);
}
-
+
private void assertComputePartitioning_InterleavingPartitions(int startOffset, int endOffset, int[] offsets, String startType) {
ITypedRegion[] regions= fPartitioner.computePartitioning(startOffset, endOffset - startOffset);
-
+
String type= startType;
int previousOffset= startOffset;
-
+
int j= 0;
for (int i= 0; i <= offsets.length; i++) {
int currentOffset= (i == offsets.length) ? endOffset : offsets[i];
if (currentOffset - previousOffset != 0) { // don't do empty partitions
ITypedRegion region= regions[j++];
-
+
assertTypedRegion(region, previousOffset, currentOffset, type);
}
-
+
// advance
if (type == DEFAULT)
type= COMMENT;
@@ -253,7 +253,7 @@ public class FastPartitionerTest extends TestCase {
for (int i= 0; i <= offsets.length; i++) {
int offset= (i == offsets.length) ? fDoc.getLength() : offsets[i];
assertEqualPartitionType(previousOffset, offset, type);
-
+
// advance
if (type == DEFAULT)
type= COMMENT;
@@ -269,7 +269,7 @@ public class FastPartitionerTest extends TestCase {
for (int i= 0; i <= offsets.length; i++) {
int offset= (i == offsets.length) ? fDoc.getLength() : offsets[i];
assertEqualPartition(previousOffset, offset, type);
-
+
// advance
if (type == DEFAULT)
type= COMMENT;
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/ScannerColumnTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/ScannerColumnTest.java
index 985029c11f3..1b0c8b67029 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/ScannerColumnTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/ScannerColumnTest.java
@@ -24,7 +24,7 @@ import org.eclipse.jface.text.rules.RuleBasedScanner;
public class ScannerColumnTest extends TestCase {
private IDocument fDocument;
-
+
protected void setUp() throws Exception {
fDocument= new Document("scanner test");
}
@@ -36,15 +36,15 @@ public class ScannerColumnTest extends TestCase {
public void testRuleBasedScannerColumnRead() {
_testScannerColumnRead(new RuleBasedScanner());
}
-
+
public void testRuleBasedScannerColumnUnread() {
_testScannerColumnUnread(new RuleBasedScanner());
}
-
+
public void testBufferedRuleBasedScannerColumnRead() {
_testScannerColumnRead(new BufferedRuleBasedScanner(100));
}
-
+
public void testBufferedRuleBasedScannerColumnUnread() {
_testScannerColumnUnread(new BufferedRuleBasedScanner(100));
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/WordRuleTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/WordRuleTest.java
index 618f541798d..6f5ecfd117f 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/WordRuleTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/WordRuleTest.java
@@ -29,19 +29,19 @@ import org.eclipse.jface.text.rules.WordRule;
* @since 3.3
*/
public class WordRuleTest extends TestCase {
-
-
+
+
private static class SimpleWordDetector implements IWordDetector {
public boolean isWordStart(char c) {
return !Character.isWhitespace(c);
}
-
+
public boolean isWordPart(char c) {
return !Character.isWhitespace(c);
}
}
-
+
/*
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=163116
*/
@@ -72,24 +72,24 @@ public class WordRuleTest extends TestCase {
assertTrue(i < 1000);
}
-
+
/*
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=144355
*/
public void testBug144355() throws Exception {
IWordDetector detector= new SimpleWordDetector();
-
+
String defaultTokenString= "defaultToken";
Token defaultToken= new Token(defaultTokenString);
-
+
String testTokenStringNormal= "TestTokenString";
String testTokenStringDifferentCapitalization= "TestTOKENString";
String testTokenStringCompletelyDifferent= "XXX";
Token normalToken= new Token(testTokenStringNormal);
-
+
WordRule rule= new WordRule(detector, defaultToken, true);
rule.addWord(testTokenStringNormal, normalToken);
-
+
// scenario 1
// pre: pass in a normal string ("TestTokenString")
// post: expect the normal token to be returned
@@ -97,7 +97,7 @@ public class WordRuleTest extends TestCase {
scanner.setRules(new IRule[] {rule});
scanner.setRange(new Document(testTokenStringNormal), 0, testTokenStringNormal.length());
assertTrue(scanner.nextToken().getData().equals(testTokenStringNormal));
-
+
// scenario 2
// pre: pass in a normal string but different capitalization ("TestTOKENString")
// post: expect the normal token to be returned
@@ -105,7 +105,7 @@ public class WordRuleTest extends TestCase {
scanner.setRules(new IRule[] {rule});
scanner.setRange(new Document(testTokenStringDifferentCapitalization), 0, testTokenStringDifferentCapitalization.length());
assertTrue(scanner.nextToken().getData().equals(testTokenStringNormal));
-
+
// scenario 3
// pre: pass in a completely different string ("XXX")
// post: expect the default token to be returned because the string can't be matched
@@ -113,10 +113,10 @@ public class WordRuleTest extends TestCase {
scanner.setRules(new IRule[] {rule});
scanner.setRange(new Document(testTokenStringCompletelyDifferent), 0, testTokenStringCompletelyDifferent.length());
assertTrue(scanner.nextToken().getData().equals(defaultTokenString));
-
+
WordRule ruleWithoutIgnoreCase= new WordRule(detector, defaultToken);
ruleWithoutIgnoreCase.addWord(testTokenStringNormal, normalToken);
-
+
// scenario 4
// pre: pass in a normal string ("TestTokenString")
// post: expect the normal token to be returned
@@ -124,7 +124,7 @@ public class WordRuleTest extends TestCase {
scanner.setRules(new IRule[] {ruleWithoutIgnoreCase});
scanner.setRange(new Document(testTokenStringNormal), 0, testTokenStringNormal.length());
assertTrue(scanner.nextToken().getData().equals(testTokenStringNormal));
-
+
// scenario 5
// pre: pass in a normal string but different capitalization ("TestTOKENString")
// post: expect the default token to be returned
@@ -133,69 +133,69 @@ public class WordRuleTest extends TestCase {
scanner.setRange(new Document(testTokenStringDifferentCapitalization), 0, testTokenStringDifferentCapitalization.length());
assertTrue(scanner.nextToken().getData().equals(defaultTokenString));
}
-
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=175712
public void testBug175712_1() throws Exception {
IRule[] rules= new IRule[2];
-
+
IToken stepToken= new Token(new TextAttribute(null, null, SWT.BOLD));
PatternRule stepRule= new PatternRule("(((", ")", stepToken, (char) 0,false);
stepRule.setColumnConstraint(-1);
rules[1]= stepRule;
-
+
IToken titleToken= new Token(new TextAttribute(null, null, SWT.BOLD));
WordRule wordRule= new WordRule(new SimpleWordDetector());
wordRule.addWord("((", titleToken);
rules[0]= wordRule;
-
+
IDocument document= new Document("((( \n((\n- Cheese\n- Wine");
RuleBasedScanner scanner= new RuleBasedScanner();
scanner.setRules(rules);
scanner.setRange(document, 0, document.getLength());
-
+
IToken defaultToken= new Token(this);
scanner.setDefaultReturnToken(defaultToken);
IToken token= scanner.nextToken();
assertSame(defaultToken, token);
-
+
token= scanner.nextToken();
assertSame(defaultToken, token);
-
+
token= scanner.nextToken();
assertSame(defaultToken, token);
-
+
token= scanner.nextToken();
assertSame(titleToken, token);
-
+
}
-
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=175712
public void testBug175712_2() throws Exception {
IRule[] rules= new IRule[2];
-
+
IToken stepToken= new Token(new TextAttribute(null, null, SWT.BOLD));
PatternRule stepRule= new PatternRule("(((", ")", stepToken, (char) 0,false);
stepRule.setColumnConstraint(-1);
rules[1]= stepRule;
-
+
IToken titleToken= new Token(new TextAttribute(null, null, SWT.BOLD));
WordRule wordRule= new WordRule(new SimpleWordDetector());
wordRule.addWord("((", titleToken);
rules[0]= wordRule;
-
+
IDocument document= new Document("((\n((\n- Cheese\n- Wine");
RuleBasedScanner scanner= new RuleBasedScanner();
scanner.setRules(rules);
scanner.setRange(document, 0, document.getLength());
-
+
IToken defaultToken= new Token(this);
scanner.setDefaultReturnToken(defaultToken);
-
+
IToken token= scanner.nextToken();
assertSame(titleToken, token);
-
+
}
-
-
+
+
}
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotation.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotation.java
index d3666b724f2..c7934c3090f 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotation.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotation.java
@@ -98,11 +98,11 @@ public class ProjectionAnnotation extends Annotation implements IAnnotationPrese
private void drawRangeIndication(GC gc, Canvas canvas, Rectangle r) {
final int MARGIN= 3;
-
+
/* cap the height - at least on GTK, large numbers are converted to
* negatives at some point */
int height= Math.min(r.y + r.height - MARGIN, canvas.getSize().y);
-
+
gc.setForeground(canvas.getDisplay().getSystemColor(COLOR));
gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance
gc.drawLine(r.x + 4, r.y + 12, r.x + 4, height);
@@ -120,7 +120,7 @@ public class ProjectionAnnotation extends Annotation implements IAnnotationPrese
FontMetrics fontMetrics= gc.getFontMetrics();
int delta= (fontMetrics.getHeight() - image.getBounds().height)/2;
rectangle.y += delta;
- rectangle.height -= delta;
+ rectangle.height -= delta;
drawRangeIndication(gc, canvas, rectangle);
}
}
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationHover.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationHover.java
index 4345a5f9859..a65d06a9c40 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationHover.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationHover.java
@@ -38,8 +38,8 @@ import org.eclipse.jface.text.source.LineRange;
* @since 3.0
*/
class ProjectionAnnotationHover implements IAnnotationHover, IAnnotationHoverExtension, IInformationProviderExtension2 {
-
-
+
+
private IInformationControlCreator fInformationControlCreator;
private IInformationControlCreator fInformationPresenterControlCreator;
@@ -51,7 +51,7 @@ class ProjectionAnnotationHover implements IAnnotationHover, IAnnotationHoverExt
public void setHoverControlCreator(IInformationControlCreator creator) {
fInformationControlCreator= creator;
}
-
+
/**
* Sets the information presenter control creator for this projection annotation hover.
*
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java
index e335412e4c3..a40bedb601e 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java
@@ -102,7 +102,7 @@ public class ProjectionAnnotationModel extends AnnotationModel {
/**
* Collapses all annotations that overlap with the given range and are collapsed.
- *
+ *
* @param offset the range offset
* @param length the range length
* @return <code>true</code> if any annotation has been collapse, <code>false</code>
@@ -131,7 +131,7 @@ public class ProjectionAnnotationModel extends AnnotationModel {
return collapsing;
}
-
+
/**
* Expands all annotations that overlap with the given range and are collapsed. Fires a model change event if
* requested.
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSummary.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSummary.java
index b7fb7ef7457..7dea0cd6d7e 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSummary.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSummary.java
@@ -10,15 +10,15 @@
*******************************************************************************/
package org.eclipse.jface.text.source.projection;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ISynchronizable;
@@ -166,7 +166,7 @@ class ProjectionSummary {
removeSummaries(monitor);
-
+
if (isCanceled(monitor))
return;
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSupport.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSupport.java
index 00a40f2a80b..c322099d947 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSupport.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSupport.java
@@ -228,7 +228,7 @@ public class ProjectionSupport {
public void setHoverControlCreator(IInformationControlCreator creator) {
fInformationControlCreator= creator;
}
-
+
/**
* Sets the information presenter control creator that is used for the annotation
* hovers that are shown in the projection viewer's projection ruler column.
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionViewer.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionViewer.java
index dbd223f8d93..44cf75420e5 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionViewer.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionViewer.java
@@ -76,7 +76,7 @@ import org.eclipse.jface.text.source.SourceViewer;
* @noextend This class is not intended to be subclassed by clients.
*/
public class ProjectionViewer extends SourceViewer implements ITextViewerExtension5 {
-
+
private static final int BASE= INFORMATION; // see ISourceViewer.INFORMATION
@@ -91,7 +91,7 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
public static final int EXPAND_ALL= BASE + 4;
/**
* Operation constant for the collapse all operation.
- *
+ *
* @since 3.2
*/
public static final int COLLAPSE_ALL= BASE + 5;
@@ -305,10 +305,10 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
* @since 3.1
*/
private int fDeletedLines;
-
+
/**
* The listener for document rewrite sessions.
- *
+ *
* @since 3.5
*/
private final IDocumentRewriteSessionListener fSessionListener= new ProjectionDocumentRewriteSessionListener();
@@ -406,10 +406,10 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
IDocumentExtension4 ext= (IDocumentExtension4)document;
ext.addDocumentRewriteSessionListener(fSessionListener);
}
-
+
if (wasProjectionEnabled && document != null)
enableProjection();
-
+
}
@@ -705,11 +705,11 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
}
}
}
-
+
/**
* Returns the first line offset &lt;= <code>offset</code>. If <code>testLastLine</code>
* is <code>true</code> and the offset is on last line then <code>offset</code> is returned.
- *
+ *
* @param document the document
* @param offset the master document offset
* @param testLastLine <code>true</code> if the test for the last line should be performed
@@ -720,10 +720,10 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
private int toLineStart(IDocument document, int offset, boolean testLastLine) throws BadLocationException {
if (document == null)
return offset;
-
+
if (testLastLine && offset >= document.getLineInformationOfOffset(document.getLength() - 1).getOffset())
return offset;
-
+
return document.getLineInformationOfOffset(offset).getOffset();
}
@@ -861,7 +861,7 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
/**
* Makes the given range visible again while not changing the folding state of any contained
* ranges. If requested, a redraw request is issued.
- *
+ *
* @param offset the offset of the range to be expanded
* @param length the length of the range to be expanded
* @param fireRedraw <code>true</code> if a redraw request should be issued,
@@ -963,11 +963,11 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
}
}
}
-
+
/**
* Tests whether the visible document's master document
* is identical to this viewer's document.
- *
+ *
* @return <code>true</code> if the visible document's master is
* identical to this viewer's document
* @since 3.1
@@ -986,7 +986,7 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
* @exception BadLocationException in case the annotation model event is no longer in synchronization with the document
*/
private void catchupWithProjectionAnnotationModel(AnnotationModelEvent event) throws BadLocationException {
-
+
if (event == null || !isVisibleMasterDocumentSameAsDocument()) {
fPendingAnnotationWorldChange= false;
@@ -1006,24 +1006,24 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
reinitializeProjection();
}
} else {
-
+
Annotation[] addedAnnotations= event.getAddedAnnotations();
Annotation[] changedAnnotation= event.getChangedAnnotations();
Annotation[] removedAnnotations= event.getRemovedAnnotations();
-
+
fCommandQueue= new ProjectionCommandQueue();
-
+
boolean isRedrawing= redraws();
int topIndex= isRedrawing ? getTopIndex() : -1;
-
+
processDeletions(event, removedAnnotations, true);
List coverage= new ArrayList();
processChanges(addedAnnotations, true, coverage);
processChanges(changedAnnotation, true, coverage);
-
+
ProjectionCommandQueue commandQueue= fCommandQueue;
fCommandQueue= null;
-
+
if (commandQueue.passedRedrawCostsThreshold()) {
setRedraw(false);
try {
@@ -1133,7 +1133,7 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
IDocument document= getDocument();
if (document == null)
return null;
-
+
int line= document.getLineOfOffset(position.getOffset());
int offset= document.getLineOffset(line + 1);
@@ -1478,7 +1478,7 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
selection= getSelectedRange();
if (exposeModelRange(new Region(selection.x, selection.y)))
return;
-
+
if (selection.y == 0)
copyMarkedRegion(true);
else
@@ -1536,7 +1536,7 @@ public class ProjectionViewer extends SourceViewer implements ITextViewerExtensi
if (redraws())
collapseAll();
break;
-
+
case COLLAPSE:
if (redraws()) {
collapse();
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java
index 8d13f88fc77..92882fccd13 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java
@@ -78,7 +78,7 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
* styles are applied to the created shell. The given styles are applied to the created styled
* text widget. The text widget will be initialized with the given font. The status field will
* contain the given text or be hidden.
- *
+ *
* @param parent the parent shell
* @param isResizable <code>true</code> if resizable
* @param symbolicFontName the symbolic font name
@@ -336,7 +336,7 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
public boolean hasContents() {
return fText.getCharCount() > 0;
}
-
+
/*
* @see org.eclipse.jface.text.IInformationControlExtension3#computeTrim()
* @since 3.4
@@ -349,7 +349,7 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
/**
* Adds the internal trimmings to the given trim of the shell.
- *
+ *
* @param trim the shell's trim, will be updated
* @since 3.4
*/
@@ -418,7 +418,7 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
public boolean isVisible() {
return fShell != null && !fShell.isDisposed() && fShell.isVisible();
}
-
+
/*
* @see org.eclipse.jface.text.IInformationControlExtension5#computeSizeConstraints(int, int)
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/AbstractControlContentAssistSubjectAdapter.java b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/AbstractControlContentAssistSubjectAdapter.java
index 3b603a3c23f..ac1b30add70 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/AbstractControlContentAssistSubjectAdapter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/AbstractControlContentAssistSubjectAdapter.java
@@ -16,9 +16,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.Platform;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.events.DisposeEvent;
@@ -31,13 +28,17 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.Platform;
+
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.IEventConsumer;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.text.IEventConsumer;
+
/**
* An <code>AbstractControlContentAssistSubjectAdapter</code> delegates assistance requests from a
@@ -81,7 +82,7 @@ public abstract class AbstractControlContentAssistSubjectAdapter implements ICon
* @since 3.3
*/
private Image fCachedDefaultCueImage;
-
+
/**
* Creates a new {@link AbstractControlContentAssistSubjectAdapter}.
*/
@@ -331,15 +332,15 @@ public abstract class AbstractControlContentAssistSubjectAdapter implements ICon
if (fCueLabelProvider != null) {
fCueLabelProvider.dispose();
}
-
+
fCueLabelProvider= labelProvider;
-
+
if (labelProvider == null) {
if (fControlDecoration != null) {
fControlDecoration.dispose();
fControlDecoration= null;
}
-
+
} else {
if (fControlDecoration == null) {
fControlDecoration= new ControlDecoration(getControl(), (SWT.TOP | SWT.LEFT));
@@ -362,7 +363,7 @@ public abstract class AbstractControlContentAssistSubjectAdapter implements ICon
fControlDecoration.setShowHover(true);
fControlDecoration.setShowOnlyOnFocus(true);
}
-
+
ILabelProviderListener listener= new ILabelProviderListener() {
public void labelProviderChanged(LabelProviderChangedEvent event) {
fControlDecoration.setDescriptionText(labelProvider.getText(getControl()));
@@ -377,10 +378,10 @@ public abstract class AbstractControlContentAssistSubjectAdapter implements ICon
listener.labelProviderChanged(new LabelProviderChangedEvent(labelProvider));
}
}
-
+
/**
* Returns the default cue image.
- *
+ *
* @return the default cue image
* @since 3.3
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/SubjectControlContentAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/SubjectControlContentAssistant.java
index 302f0de76cb..d4fd629b23b 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/SubjectControlContentAssistant.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/contentassist/SubjectControlContentAssistant.java
@@ -18,7 +18,7 @@ import org.eclipse.core.runtime.Assert;
* Usually, clients instantiate this class and configure it before using it.
*
* @since 3.0
- * @deprecated As of 3.2, replaced by Platform UI's field assist support *
+ * @deprecated As of 3.2, replaced by Platform UI's field assist support *
*/
public class SubjectControlContentAssistant extends org.eclipse.jface.text.contentassist.ContentAssistant implements ISubjectControlContentAssistant {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/DelayedInputChangeListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/DelayedInputChangeListener.java
index 496e5ce3ec2..09092a459b6 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/DelayedInputChangeListener.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/DelayedInputChangeListener.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -16,17 +16,17 @@ import org.eclipse.jface.text.IInputChangedListener;
/**
* A delayed input change listener that forwards delayed input changes to an information control replacer.
- *
+ *
* @since 3.4
*/
public final class DelayedInputChangeListener implements IInputChangedListener {
-
+
private final IDelayedInputChangeProvider fChangeProvider;
private final InformationControlReplacer fInformationControlReplacer;
/**
* Creates a new listener.
- *
+ *
* @param changeProvider the information control with delayed input changes
* @param informationControlReplacer the information control replacer, whose information control should get the new input
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InformationControlReplacer.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InformationControlReplacer.java
index 3615cb5c36b..2284a6581d2 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InformationControlReplacer.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InformationControlReplacer.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -32,11 +32,11 @@ import org.eclipse.jface.text.IInformationControlExtension3;
* The {@link AbstractInformationControlManager} can be configured with such a replacer by calling
* <code>setInformationControlReplacer</code>.
* </p>
- *
+ *
* @since 3.4
*/
public class InformationControlReplacer extends AbstractInformationControlManager {
-
+
/**
* Minimal width in pixels.
*/
@@ -45,7 +45,7 @@ public class InformationControlReplacer extends AbstractInformationControlManage
* Minimal height in pixels.
*/
private static final int MIN_HEIGHT= 50;
-
+
/**
* Default control creator.
*/
@@ -60,11 +60,11 @@ public class InformationControlReplacer extends AbstractInformationControlManage
private boolean fDelayedInformationSet;
private Rectangle fReplaceableArea;
private Rectangle fContentBounds;
-
-
+
+
/**
* Creates a new information control replacer.
- *
+ *
* @param creator the default information control creator
*/
public InformationControlReplacer(IInformationControlCreator creator) {
@@ -74,7 +74,7 @@ public class InformationControlReplacer extends AbstractInformationControlManage
/**
* Replace the information control.
- *
+ *
* @param informationPresenterControlCreator the information presenter control creator
* @param contentBounds the bounds of the content area of the information control
* @param information the information to show
@@ -82,7 +82,7 @@ public class InformationControlReplacer extends AbstractInformationControlManage
* @param takeFocus <code>true</code> iff the replacing information control should take focus
*/
public void replaceInformationControl(IInformationControlCreator informationPresenterControlCreator, Rectangle contentBounds, Object information, final Rectangle subjectArea, boolean takeFocus) {
-
+
try {
fIsReplacing= true;
if (! fDelayedInformationSet)
@@ -91,11 +91,11 @@ public class InformationControlReplacer extends AbstractInformationControlManage
takeFocus= true; // delayed input has been set, so the original info control must have been focused
fContentBounds= contentBounds;
fReplaceableArea= subjectArea;
-
+
setCustomInformationControlCreator(informationPresenterControlCreator);
-
+
takesFocusWhenVisible(takeFocus);
-
+
showInformation();
} finally {
fIsReplacing= false;
@@ -105,7 +105,7 @@ public class InformationControlReplacer extends AbstractInformationControlManage
setCustomInformationControlCreator(null);
}
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#computeInformation()
*/
@@ -114,7 +114,7 @@ public class InformationControlReplacer extends AbstractInformationControlManage
setInformation(fReplacableInformation, fReplaceableArea);
return;
}
-
+
if (DEBUG)
System.out.println("InformationControlReplacer: no active replaceable"); //$NON-NLS-1$
}
@@ -128,40 +128,40 @@ public class InformationControlReplacer extends AbstractInformationControlManage
*/
public void showInformationControl(Rectangle subjectArea, Object information) {
IInformationControl informationControl= getInformationControl();
-
+
Rectangle controlBounds= fContentBounds;
if (informationControl instanceof IInformationControlExtension3) {
IInformationControlExtension3 iControl3= (IInformationControlExtension3) informationControl;
Rectangle trim= iControl3.computeTrim();
controlBounds= Geometry.add(controlBounds, trim);
-
+
/*
* Ensure minimal size. Interacting with a tiny information control
* (resizing, selecting text) would be a pain.
*/
controlBounds.width= Math.max(controlBounds.width, MIN_WIDTH);
controlBounds.height= Math.max(controlBounds.height, MIN_HEIGHT);
-
+
getInternalAccessor().cropToClosestMonitor(controlBounds);
}
-
+
Point location= Geometry.getLocation(controlBounds);
Point size= Geometry.getSize(controlBounds);
-
+
// Caveat: some IInformationControls fail unless setSizeConstraints(..) is called with concrete values
informationControl.setSizeConstraints(size.x, size.y);
-
+
if (informationControl instanceof IInformationControlExtension2)
((IInformationControlExtension2) informationControl).setInput(information);
else
informationControl.setInformation(information.toString());
-
+
informationControl.setLocation(location);
informationControl.setSize(size.x, size.y);
-
+
showInformationControl(subjectArea);
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#hideInformationControl()
*/
@@ -185,23 +185,23 @@ public class InformationControlReplacer extends AbstractInformationControlManage
/**
* Tells whether the replacer is currently replacing another information control.
- *
+ *
* @return <code>true</code> while code from {@link #replaceInformationControl(IInformationControlCreator, Rectangle, Object, Rectangle, boolean)} is run
*/
public boolean isReplacing() {
return fIsReplacing;
}
-
+
/**
* @return the current information control, or <code>null</code> if none available
*/
public IInformationControl getCurrentInformationControl2() {
return getInternalAccessor().getCurrentInformationControl();
}
-
+
/**
* The number of pixels to blow up the keep-up zone.
- *
+ *
* @return the margin in pixels
*/
public int getKeepUpMargin() {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InternalAccessor.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InternalAccessor.java
index 6e56d90e813..6fcb946e472 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InternalAccessor.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/InternalAccessor.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -22,14 +22,14 @@ import org.eclipse.jface.text.ITextViewerExtension8.EnrichMode;
/**
* An internal class that gives access to internal methods of {@link
* AbstractInformationControlManager} and subclasses.
- *
+ *
* @since 3.4
*/
public abstract class InternalAccessor {
/**
* Returns the current information control, or <code>null</code> if none.
- *
+ *
* @return the current information control, or <code>null</code> if none
*/
public abstract IInformationControl getCurrentInformationControl();
@@ -37,7 +37,7 @@ public abstract class InternalAccessor {
/**
* Sets the information control replacer for this manager and disposes the
* old one if set.
- *
+ *
* @param replacer the information control replacer for this manager, or
* <code>null</code> if no information control replacing should
* take place
@@ -46,38 +46,38 @@ public abstract class InternalAccessor {
/**
* Returns the current information control replacer or <code>null</code> if none has been installed.
- *
+ *
* @return the current information control replacer or <code>null</code> if none has been installed
*/
public abstract InformationControlReplacer getInformationControlReplacer();
-
+
/**
* Tests whether the given information control is replaceable.
- *
+ *
* @param iControl information control or <code>null</code> if none
* @return <code>true</code> if information control is replaceable, <code>false</code> otherwise
*/
public abstract boolean canReplace(IInformationControl iControl);
-
+
/**
* Tells whether this manager's information control is currently being replaced.
- *
+ *
* @return <code>true</code> if a replace is in progress
*/
public abstract boolean isReplaceInProgress();
-
+
/**
* Crops the given bounds such that they lie completely on the closest monitor.
- *
+ *
* @param bounds shell bounds to crop
*/
public abstract void cropToClosestMonitor(Rectangle bounds);
-
+
/**
* Sets the hover enrich mode. Only applicable when an information
* control replacer has been set with
* {@link #setInformationControlReplacer(InformationControlReplacer)} .
- *
+ *
* @param mode the enrich mode
* @see ITextViewerExtension8#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode)
*/
@@ -85,18 +85,18 @@ public abstract class InternalAccessor {
/**
* Indicates whether the mouse cursor is allowed to leave the subject area without closing the hover.
- *
+ *
* @return whether the mouse cursor is allowed to leave the subject area without closing the hover
*/
public abstract boolean getAllowMouseExit();
-
+
/**
* Replaces this manager's information control as defined by
* the information control replacer.
* <strong>Must only be called when the information control is instanceof {@link IInformationControlExtension3}!</strong>
- *
+ *
* @param takeFocus <code>true</code> iff the replacing information control should take focus
*/
public abstract void replaceInformationControl(boolean takeFocus);
-
+
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/StickyHoverManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/StickyHoverManager.java
index c183999f603..c8b2a9ded0c 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/StickyHoverManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/StickyHoverManager.java
@@ -26,6 +26,8 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.jface.util.Geometry;
+
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlExtension3;
import org.eclipse.jface.text.IInformationControlExtension5;
@@ -34,7 +36,6 @@ import org.eclipse.jface.text.IWidgetTokenKeeper;
import org.eclipse.jface.text.IWidgetTokenKeeperExtension;
import org.eclipse.jface.text.IWidgetTokenOwner;
import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.util.Geometry;
/**
@@ -72,7 +73,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW
class Closer implements IInformationControlCloser, ControlListener, MouseListener, IViewportListener, KeyListener, FocusListener, Listener {
//TODO: Catch 'Esc' key in fInformationControlToClose: Don't dispose, just hideInformationControl().
// This would allow to reuse the information control also when the user explicitly closes it.
-
+
//TODO: if subject control is a Scrollable, should add selection listeners to both scroll bars
// (and remove the ViewPortListener, which only listens to vertical scrolling)
@@ -113,7 +114,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW
}
fTextViewer.addViewportListener(this);
-
+
IInformationControl fInformationControlToClose= getCurrentInformationControl2();
if (fInformationControlToClose != null)
fInformationControlToClose.addFocusListener(this);
@@ -141,11 +142,11 @@ public class StickyHoverManager extends InformationControlReplacer implements IW
fSubjectControl.removeMouseListener(this);
fSubjectControl.removeKeyListener(this);
}
-
+
IInformationControl fInformationControlToClose= getCurrentInformationControl2();
if (fInformationControlToClose != null)
fInformationControlToClose.removeFocusListener(this);
-
+
if (fDisplay != null && !fDisplay.isDisposed()) {
fDisplay.removeFilter(SWT.MouseMove, this);
fDisplay.removeFilter(SWT.FocusOut, this);
@@ -207,13 +208,13 @@ public class StickyHoverManager extends InformationControlReplacer implements IW
*/
public void keyReleased(KeyEvent e) {
}
-
+
/*
* @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)
*/
@@ -227,7 +228,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW
}
});
}
-
+
/*
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
*/
@@ -235,7 +236,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW
if (event.type == SWT.MouseMove) {
if (!(event.widget instanceof Control) || event.widget.isDisposed())
return;
-
+
IInformationControl infoControl= getCurrentInformationControl2();
if (infoControl != null && !infoControl.isFocusControl() && infoControl instanceof IInformationControlExtension3) {
// if (DEBUG) System.out.println("StickyHoverManager.Closer.handleEvent(): activeShell= " + fDisplay.getActiveShell()); //$NON-NLS-1$
@@ -249,7 +250,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW
hideInformationControl();
}
}
-
+
} else {
/*
* TODO: need better understanding of why/if this is needed.
@@ -258,7 +259,7 @@ public class StickyHoverManager extends InformationControlReplacer implements IW
if (fDisplay != null && !fDisplay.isDisposed())
fDisplay.removeFilter(SWT.MouseMove, this);
}
-
+
} else if (event.type == SWT.FocusOut) {
if (DEBUG) System.out.println("StickyHoverManager.Closer.handleEvent(): focusOut: " + event); //$NON-NLS-1$
IInformationControl iControl= getCurrentInformationControl2();
@@ -268,21 +269,21 @@ public class StickyHoverManager extends InformationControlReplacer implements IW
}
}
-
+
private final TextViewer fTextViewer;
-
+
/**
* Creates a new sticky hover manager.
- *
+ *
* @param textViewer the text viewer
*/
public StickyHoverManager(TextViewer textViewer) {
super(new DefaultInformationControlCreator());
-
+
fTextViewer= textViewer;
setCloser(new Closer());
-
+
install(fTextViewer.getTextWidget());
}
@@ -372,5 +373,5 @@ public class StickyHoverManager extends InformationControlReplacer implements IW
iControl.setFocus();
return iControl.isFocusControl();
}
-
+
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/TableOwnerDrawSupport.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/TableOwnerDrawSupport.java
index b0d4b041ccc..114fff28f80 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/TableOwnerDrawSupport.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/TableOwnerDrawSupport.java
@@ -25,13 +25,13 @@ import org.eclipse.swt.widgets.TableItem;
/**
* Adds owner draw support for tables.
- *
+ *
* @since 3.4
*/
public class TableOwnerDrawSupport implements Listener {
-
+
private static final String STYLED_RANGES_KEY= "styled_ranges"; //$NON-NLS-1$
-
+
private TextLayout fLayout;
public static void install(Table table) {
@@ -41,10 +41,10 @@ public class TableOwnerDrawSupport implements Listener {
table.addListener(SWT.EraseItem, listener);
table.addListener(SWT.PaintItem, listener);
}
-
+
/**
* Stores the styled ranges in the given table item.
- *
+ *
* @param item table item
* @param column the column index
* @param ranges the styled ranges or <code>null</code> to remove them
@@ -52,10 +52,10 @@ public class TableOwnerDrawSupport implements Listener {
public static void storeStyleRanges(TableItem item, int column, StyleRange[] ranges) {
item.setData(STYLED_RANGES_KEY + column, ranges);
}
-
+
/**
* Returns the styled ranges which are stored in the given table item.
- *
+ *
* @param item table item
* @param column the column index
* @return the styled ranges
@@ -91,28 +91,28 @@ public class TableOwnerDrawSupport implements Listener {
/**
* Performs the paint operation.
- *
+ *
* @param event the event
*/
private void performPaint(Event event) {
TableItem item= (TableItem) event.item;
GC gc= event.gc;
int index= event.index;
-
+
boolean isSelected= (event.detail & SWT.SELECTED) != 0;
-
+
// Remember colors to restore the GC later
Color oldForeground= gc.getForeground();
Color oldBackground= gc.getBackground();
-
+
if (!isSelected) {
Color foreground= item.getForeground(index);
gc.setForeground(foreground);
-
+
Color background= item.getBackground(index);
gc.setBackground(background);
}
-
+
Image image=item.getImage(index);
if (image != null) {
Rectangle imageBounds=item.getImageBounds(index);
@@ -121,14 +121,14 @@ public class TableOwnerDrawSupport implements Listener {
int y=imageBounds.y + Math.max(0, (imageBounds.height - bounds.height) / 2);
gc.drawImage(image, x, y);
}
-
+
fLayout.setFont(item.getFont(index));
-
+
// XXX: needed to clear the style info, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=226090
fLayout.setText(""); //$NON-NLS-1$
-
+
fLayout.setText(item.getText(index));
-
+
StyleRange[] ranges= getStyledRanges(item, index);
if (ranges != null) {
for (int i= 0; i < ranges.length; i++) {
@@ -141,7 +141,7 @@ public class TableOwnerDrawSupport implements Listener {
fLayout.setStyle(curr, curr.start, curr.start + curr.length - 1);
}
}
-
+
Rectangle textBounds=item.getTextBounds(index);
if (textBounds != null) {
Rectangle layoutBounds=fLayout.getBounds();
@@ -149,20 +149,20 @@ public class TableOwnerDrawSupport implements Listener {
int y=textBounds.y + Math.max(0, (textBounds.height - layoutBounds.height) / 2);
fLayout.draw(gc, x, y);
}
-
+
if ((event.detail & SWT.FOCUSED) != 0) {
Rectangle focusBounds=item.getBounds();
gc.drawFocus(focusBounds.x, focusBounds.y, focusBounds.width, focusBounds.height);
}
-
+
if (!isSelected) {
gc.setForeground(oldForeground);
gc.setBackground(oldBackground);
}
}
-
+
private void widgetDisposed() {
fLayout.dispose();
}
}
-
+
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java
index 75a3b044940..9266039ec03 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java
@@ -69,7 +69,7 @@ import org.eclipse.jface.text.TextPresentation;
* <li>focusLost event is not sent - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=84532</li>
* </ul>
* </p>
- *
+ *
* @since 3.2
*/
public class BrowserInformationControl extends AbstractInformationControl implements IInformationControlExtension2, IDelayedInputChangeProvider {
@@ -88,7 +88,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
Browser browser= new Browser(parent, SWT.NONE);
browser.dispose();
fgIsAvailable= true;
-
+
Slider sliderV= new Slider(parent, SWT.VERTICAL);
Slider sliderH= new Slider(parent, SWT.HORIZONTAL);
int width= sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
@@ -114,7 +114,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
private static final int MIN_WIDTH= 80;
private static final int MIN_HEIGHT= 50;
-
+
/**
* Availability checking cache.
*/
@@ -126,7 +126,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
* @since 3.4
*/
private static Point fgScrollBarSize;
-
+
/** The control's browser widget */
private Browser fBrowser;
/** Tells whether the browser has content */
@@ -166,7 +166,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
/**
* Creates a browser information control with the given shell as parent.
- *
+ *
* @param parent the parent shell
* @param symbolicFontName the symbolic name of the font used for size computations
* @param resizable <code>true</code> if the control should be resizable
@@ -177,10 +177,10 @@ public class BrowserInformationControl extends AbstractInformationControl implem
fSymbolicFontName= symbolicFontName;
create();
}
-
+
/**
* Creates a browser information control with the given shell as parent.
- *
+ *
* @param parent the parent shell
* @param symbolicFontName the symbolic name of the font used for size computations
* @param statusFieldText the text to be used in the optional status field
@@ -192,10 +192,10 @@ public class BrowserInformationControl extends AbstractInformationControl implem
fSymbolicFontName= symbolicFontName;
create();
}
-
+
/**
* Creates a browser information control with the given shell as parent.
- *
+ *
* @param parent the parent shell
* @param symbolicFontName the symbolic name of the font used for size computations
* @param toolBarManager the manager or <code>null</code> if toolbar is not desired
@@ -206,13 +206,13 @@ public class BrowserInformationControl extends AbstractInformationControl implem
fSymbolicFontName= symbolicFontName;
create();
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControl#createContent(org.eclipse.swt.widgets.Composite)
*/
protected void createContent(Composite parent) {
fBrowser= new Browser(parent, SWT.NONE);
-
+
Display display= getShell().getDisplay();
fBrowser.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
fBrowser.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
@@ -231,16 +231,16 @@ public class BrowserInformationControl extends AbstractInformationControl implem
fCompleted= true;
}
});
-
+
fBrowser.addOpenWindowListener(new OpenWindowListener() {
public void open(WindowEvent event) {
event.required= true; // Cancel opening of new windows
}
});
-
+
// Replace browser's built-in context menu with none
fBrowser.setMenu(new Menu(getShell(), SWT.NONE));
-
+
createTextLayout();
}
@@ -263,7 +263,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
}
});
}
-
+
/**
* {@inheritDoc} This control can handle {@link String} and
* {@link BrowserInformationControlInput}.
@@ -277,11 +277,11 @@ public class BrowserInformationControl extends AbstractInformationControl implem
}
fInput= (BrowserInformationControlInput)input;
-
+
String content= null;
if (fInput != null)
content= fInput.getHtml();
-
+
fBrowserHasContent= content != null && content.length() > 0;
if (!fBrowserHasContent)
@@ -303,20 +303,20 @@ public class BrowserInformationControl extends AbstractInformationControl implem
styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ }; //$NON-NLS-1$
else
styles= new String[] { "overflow:scroll;" }; //$NON-NLS-1$
-
+
StringBuffer buffer= new StringBuffer(content);
HTMLPrinter.insertStyles(buffer, styles);
content= buffer.toString();
-
+
/*
* XXX: Should add some JavaScript here that shows something like
* "(continued...)" or "..." at the end of the visible area when the page overflowed
* with "overflow:hidden;".
*/
-
+
fCompleted= false;
fBrowser.setText(content);
-
+
Object[] listeners= fInputChangeListeners.getListeners();
for (int i= 0; i < listeners.length; i++)
((IInputChangedListener)listeners[i]).inputChanged(fInput);
@@ -329,45 +329,45 @@ public class BrowserInformationControl extends AbstractInformationControl implem
Shell shell= getShell();
if (shell.isVisible() == visible)
return;
-
+
if (!visible) {
super.setVisible(false);
setInput(null);
return;
}
-
+
/*
* The Browser widget flickers when made visible while it is not completely loaded.
* The fix is to delay the call to setVisible until either loading is completed
* (see ProgressListener in constructor), or a timeout has been reached.
*/
final Display display= shell.getDisplay();
-
+
// Make sure the display wakes from sleep after timeout:
display.timerExec(100, new Runnable() {
public void run() {
fCompleted= true;
}
});
-
+
while (!fCompleted) {
// Drive the event loop to process the events required to load the browser widget's contents:
if (!display.readAndDispatch()) {
display.sleep();
}
}
-
+
shell= getShell();
if (shell == null || shell.isDisposed())
return;
-
+
/*
* Avoids flickering when replacing hovers, especially on Vista in ON_CLICK mode.
* Causes flickering on GTK. Carbon does not care.
*/
if ("win32".equals(SWT.getPlatform())) //$NON-NLS-1$
shell.moveAbove(null);
-
+
super.setVisible(true);
}
@@ -386,12 +386,12 @@ public class BrowserInformationControl extends AbstractInformationControl implem
/**
* Creates and initializes the text layout used
* to compute the size hint.
- *
+ *
* @since 3.2
*/
private void createTextLayout() {
fTextLayout= new TextLayout(fBrowser.getDisplay());
-
+
// Initialize fonts
Font font= fSymbolicFontName == null ? JFaceResources.getDialogFont() : JFaceResources.getFont(fSymbolicFontName);
fTextLayout.setFont(font);
@@ -401,7 +401,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
fontData[i].setStyle(SWT.BOLD);
font= new Font(getShell().getDisplay(), fontData);
fBoldStyle= new TextStyle(font, null, null);
-
+
// Compute and set tab width
fTextLayout.setText(" "); //$NON-NLS-1$
int tabWidth = fTextLayout.getBounds().width;
@@ -423,7 +423,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
fBoldStyle= null;
}
fBrowser= null;
-
+
super.dispose();
}
@@ -434,7 +434,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
Point sizeConstraints= getSizeConstraints();
Rectangle trim= computeTrim();
int height= trim.height;
-
+
//FIXME: The HTML2TextReader does not render <p> like a browser.
// Instead of inserting an empty line, it just adds a single line break.
// Furthermore, the indentation of <dl><dd> elements is too small (e.g with a long @see line)
@@ -455,7 +455,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
if (sr.fontStyle == SWT.BOLD)
fTextLayout.setStyle(fBoldStyle, sr.start, sr.start + sr.length - 1);
}
-
+
Rectangle bounds= fTextLayout.getBounds(); // does not return minimum width, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=217446
int lineCount= fTextLayout.getLineCount();
int textWidth= 0;
@@ -468,15 +468,15 @@ public class BrowserInformationControl extends AbstractInformationControl implem
}
bounds.width= textWidth;
fTextLayout.setText(""); //$NON-NLS-1$
-
+
int minWidth= bounds.width;
height= height + bounds.height;
-
+
// Add some air to accommodate for different browser renderings
minWidth+= 15;
height+= 15;
-
+
// Apply max size constraints
if (sizeConstraints != null) {
if (sizeConstraints.x != SWT.DEFAULT)
@@ -488,7 +488,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
// Ensure minimal size
int width= Math.max(MIN_WIDTH, minWidth);
height= Math.max(MIN_HEIGHT, height);
-
+
return new Point(width, height);
}
@@ -507,11 +507,11 @@ public class BrowserInformationControl extends AbstractInformationControl implem
}
return trim;
}
-
+
/**
* Adds the listener to the collection of listeners who will be
* notified when the current location has changed or is about to change.
- *
+ *
* @param listener the location listener
* @since 3.4
*/
@@ -541,11 +541,11 @@ public class BrowserInformationControl extends AbstractInformationControl implem
public boolean hasContents() {
return fBrowserHasContent;
}
-
+
/**
* Adds a listener for input changes to this input change provider.
* Has no effect if an identical listener is already registered.
- *
+ *
* @param inputChangeListener the listener to add
* @since 3.4
*/
@@ -553,18 +553,18 @@ public class BrowserInformationControl extends AbstractInformationControl implem
Assert.isNotNull(inputChangeListener);
fInputChangeListeners.add(inputChangeListener);
}
-
+
/**
* Removes the given input change listener from this input change provider.
* Has no effect if an identical listener is not registered.
- *
+ *
* @param inputChangeListener the listener to remove
* @since 3.4
*/
public void removeInputChangeListener(IInputChangedListener inputChangeListener) {
fInputChangeListeners.remove(inputChangeListener);
}
-
+
/*
* @see org.eclipse.jface.text.IDelayedInputChangeProvider#setDelayedInputChangeListener(org.eclipse.jface.text.IInputChangedListener)
* @since 3.4
@@ -572,10 +572,10 @@ public class BrowserInformationControl extends AbstractInformationControl implem
public void setDelayedInputChangeListener(IInputChangedListener inputChangeListener) {
fDelayedInputChangeListener= inputChangeListener;
}
-
+
/**
* Tells whether a delayed input change listener is registered.
- *
+ *
* @return <code>true</code> iff a delayed input change
* listener is currently registered
* @since 3.4
@@ -583,10 +583,10 @@ public class BrowserInformationControl extends AbstractInformationControl implem
public boolean hasDelayedInputChangeListener() {
return fDelayedInputChangeListener != null;
}
-
+
/**
* Notifies listeners of a delayed input change.
- *
+ *
* @param newInput the new input, or <code>null</code> to request cancellation
* @since 3.4
*/
@@ -594,7 +594,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
if (fDelayedInputChangeListener != null)
fDelayedInputChangeListener.inputChanged(newInput);
}
-
+
/*
* @see java.lang.Object#toString()
* @since 3.4
@@ -610,21 +610,21 @@ public class BrowserInformationControl extends AbstractInformationControl implem
public BrowserInformationControlInput getInput() {
return fInput;
}
-
+
/*
* @see org.eclipse.jface.text.IInformationControlExtension5#computeSizeConstraints(int, int)
*/
public Point computeSizeConstraints(int widthInChars, int heightInChars) {
if (fSymbolicFontName == null)
return null;
-
+
GC gc= new GC(fBrowser);
Font font= fSymbolicFontName == null ? JFaceResources.getDialogFont() : JFaceResources.getFont(fSymbolicFontName);
gc.setFont(font);
int width= gc.getFontMetrics().getAverageCharWidth();
int height= gc.getFontMetrics().getHeight();
gc.dispose();
-
+
return new Point(widthInChars * width, heightInChars * height);
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControlInput.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControlInput.java
index 004208a5527..25da7836c42 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControlInput.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControlInput.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -19,10 +19,10 @@ import org.eclipse.jface.text.DefaultInformationControl;
* @since 3.4
*/
public abstract class BrowserInformationControlInput extends BrowserInput {
-
+
/**
* Returns the leading image width.
- *
+ *
* @return the size of the leading image, by default <code>0</code> is returned
* @since 3.4
*/
@@ -32,7 +32,7 @@ public abstract class BrowserInformationControlInput extends BrowserInput {
/**
* Creates the next browser input with the given input as previous one.
- *
+ *
* @param previous the previous input or <code>null</code> if none
*/
public BrowserInformationControlInput(BrowserInformationControlInput previous) {
@@ -43,12 +43,12 @@ public abstract class BrowserInformationControlInput extends BrowserInput {
* @return the HTML contents
*/
public abstract String getHtml();
-
+
/**
* Returns the HTML from {@link #getHtml()}.
* This is a fallback mode for platforms where the {@link BrowserInformationControl}
* is not available and this input is passed to a {@link DefaultInformationControl}.
- *
+ *
* @return {@link #getHtml()}
*/
public String toString() {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInput.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInput.java
index 751188d7fb4..a4e06275519 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInput.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInput.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -14,10 +14,10 @@ package org.eclipse.jface.internal.text.html;
/**
* A browser input contains an input element and
* a previous and a next input, if available.
- *
+ *
* The browser input also provides a human readable
* name of its input element.
- *
+ *
* @since 3.4
*/
public abstract class BrowserInput {
@@ -27,7 +27,7 @@ public abstract class BrowserInput {
/**
* Create a new Browser input.
- *
+ *
* @param previous the input previous to this or <code>null</code> if this is the first
*/
public BrowserInput(BrowserInput previous) {
@@ -39,7 +39,7 @@ public abstract class BrowserInput {
/**
* The previous input or <code>null</code> if this
* is the first.
- *
+ *
* @return the previous input or <code>null</code>
*/
public BrowserInput getPrevious() {
@@ -49,7 +49,7 @@ public abstract class BrowserInput {
/**
* The next input or <code>null</code> if this
* is the last.
- *
+ *
* @return the next input or <code>null</code>
*/
public BrowserInput getNext() {
@@ -58,14 +58,14 @@ public abstract class BrowserInput {
/**
* The element to use to set the browsers input.
- *
+ *
* @return the input element
*/
public abstract Object getInputElement();
/**
* A human readable name for the input.
- *
+ *
* @return the input name
*/
public abstract String getInputName();
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTML2TextReader.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTML2TextReader.java
index d23f7e033b1..50d29cb2d94 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTML2TextReader.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTML2TextReader.java
@@ -144,7 +144,7 @@ public class HTML2TextReader extends SubstitutionTextReader {
return EMPTY_STRING;
html= html.toLowerCase();
-
+
String tag= html;
if ('/' == tag.charAt(0))
tag= tag.substring(1);
@@ -212,13 +212,13 @@ public class HTML2TextReader extends SubstitutionTextReader {
if ("/dd".equals(html)) //$NON-NLS-1$
return LINE_DELIM;
-
+
if ("head".equals(html) && !fHeaderDetected) { //$NON-NLS-1$
fHeaderDetected= true;
fIgnore= true;
return EMPTY_STRING;
}
-
+
if ("/head".equals(html) && fHeaderDetected && fIgnore) { //$NON-NLS-1$
fIgnore= false;
return EMPTY_STRING;
@@ -267,11 +267,11 @@ public class HTML2TextReader extends SubstitutionTextReader {
return html2Text(buf.toString());
}
-
+
private static boolean isInComment(StringBuffer buf) {
return buf.length() >= 3 && "!--".equals(buf.substring(0, 3)); //$NON-NLS-1$
}
-
+
private static boolean isCommentEnd(StringBuffer buf) {
int tagLen= buf.length();
return tagLen >= 5 && "--".equals(buf.substring(tagLen - 2)); //$NON-NLS-1$
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLMessages.java
index 69679ccf543..388f41e29cb 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLMessages.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLMessages.java
@@ -10,10 +10,11 @@
*******************************************************************************/
package org.eclipse.jface.internal.text.html;
-import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import com.ibm.icu.text.MessageFormat;
+
/**
* Helper class to get NLSed messages.
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java
index 230d7d1dcb4..089513ae8fa 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLPrinter.java
@@ -171,12 +171,12 @@ public class HTMLPrinter {
private static void appendStyleSheetURL(StringBuffer buffer, String styleSheet) {
if (styleSheet == null)
return;
-
+
buffer.append("<head><style CHARSET=\"ISO-8859-1\" TYPE=\"text/css\">"); //$NON-NLS-1$
buffer.append(styleSheet);
buffer.append("</style></head>"); //$NON-NLS-1$
}
-
+
private static void appendStyleSheetURL(StringBuffer buffer, URL styleSheetURL) {
if (styleSheetURL == null)
return;
@@ -204,7 +204,7 @@ public class HTMLPrinter {
appendColors(pageProlog, FG_COLOR_RGB, BG_COLOR_RGB);
buffer.insert(position, pageProlog.toString());
}
-
+
public static void insertPageProlog(StringBuffer buffer, int position, String styleSheet) {
insertPageProlog(buffer, position, null, null, styleSheet);
}
@@ -252,7 +252,7 @@ public class HTMLPrinter {
if (paragraphReader != null)
addParagraph(buffer, read(paragraphReader));
}
-
+
/**
* Replaces the following style attributes of the font definition of the <code>html</code>
* element:
@@ -267,7 +267,7 @@ public class HTMLPrinter {
* <p>
* If the listed font attributes are not contained in the passed style list, nothing happens.
* </p>
- *
+ *
* @param styles CSS style definitions
* @param fontData the font information to use
* @return the modified style definitions
@@ -276,10 +276,10 @@ public class HTMLPrinter {
public static String convertTopLevelFont(String styles, FontData fontData) {
boolean bold= (fontData.getStyle() & SWT.BOLD) != 0;
boolean italic= (fontData.getStyle() & SWT.ITALIC) != 0;
-
+
// See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=155993
String size= Integer.toString(fontData.getHeight()) + ("carbon".equals(SWT.getPlatform()) ? "px" : "pt"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
String family= "'" + fontData.getName() + "',sans-serif"; //$NON-NLS-1$ //$NON-NLS-2$
styles= styles.replaceFirst("(html\\s*\\{.*(?:\\s|;)font-size:\\s*)\\d+pt(\\;?.*\\})", "$1" + size + "$2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
styles= styles.replaceFirst("(html\\s*\\{.*(?:\\s|;)font-weight:\\s*)\\w+(\\;?.*\\})", "$1" + (bold ? "bold" : "normal") + "$2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java
index d28c5b055f0..3216f8e2afe 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/HTMLTextPresenter.java
@@ -98,7 +98,7 @@ public class HTMLTextPresenter implements DefaultInformationControl.IInformation
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.jface.text.DefaultInformationControl.IInformationPresenter#updatePresentation(org.eclipse.swt.widgets.Display,
* java.lang.String, org.eclipse.jface.text.TextPresentation, int, int)
* @deprecated Use {@link #updatePresentation(Drawable, String, TextPresentation, int, int)}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/CompletionProposalPopup2.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/CompletionProposalPopup2.java
index c5c46cffce2..8e5165cb8dc 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/CompletionProposalPopup2.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/CompletionProposalPopup2.java
@@ -107,11 +107,11 @@ class CompletionProposalPopup2 implements IContentAssistListener2 {
/**
* Tells whether colored labels support is enabled.
* Only valid while the popup is active.
- *
+ *
* @since 3.4
*/
private boolean fIsColoredLabelsSupportEnabled= false;
-
+
private final IEditingSupport fFocusEditingSupport= new IEditingSupport() {
public boolean isOriginator(DocumentEvent event, IRegion focus) {
@@ -265,7 +265,7 @@ class CompletionProposalPopup2 implements IContentAssistListener2 {
// fProposalShell= new Shell(control.getShell(), SWT.ON_TOP | SWT.RESIZE );
fProposalTable= new Table(fProposalShell, SWT.H_SCROLL | SWT.V_SCROLL);
// fProposalTable= new Table(fProposalShell, SWT.H_SCROLL | SWT.V_SCROLL);
-
+
fIsColoredLabelsSupportEnabled= fContentAssistant.isColoredLabelsSupportEnabled();
if (fIsColoredLabelsSupportEnabled)
@@ -543,7 +543,7 @@ class CompletionProposalPopup2 implements IContentAssistListener2 {
item= new TableItem(fProposalTable, SWT.NULL);
if (p.getImage() != null)
item.setImage(p.getImage());
-
+
String displayString;
StyleRange[] styleRanges= null;
if (fIsColoredLabelsSupportEnabled && p instanceof ICompletionProposalExtension6) {
@@ -556,7 +556,7 @@ class CompletionProposalPopup2 implements IContentAssistListener2 {
item.setText(displayString);
if (fIsColoredLabelsSupportEnabled)
TableOwnerDrawSupport.storeStyleRanges(item, 0, styleRanges);
-
+
item.setData(p);
if (validate && validateProposal(document, p, endOffset, null)) {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.java
index d00721d23bc..7bedef7a79d 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistMessages.java
@@ -11,10 +11,11 @@
package org.eclipse.jface.internal.text.link.contentassist;
-import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import com.ibm.icu.text.MessageFormat;
+
/**
* Helper class to get NLSed messages.
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java
index a767e6dd57f..d6a6cd25ef5 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/ContentAssistant2.java
@@ -697,13 +697,13 @@ public class ContentAssistant2 implements IContentAssistant, IContentAssistantEx
private String[] fProposalStrings;
private ICompletionProposal[] fProposals;
private final List fProposalListeners= new ArrayList();
-
+
/**
* Tells whether colored label support is enabled.
* @since 3.4
*/
private boolean fIsColoredLabelsSupportEnabled= false;
-
+
/**
* Creates a new content assistant. The content assistant is not automatically activated,
@@ -1560,10 +1560,10 @@ public class ContentAssistant2 implements IContentAssistant, IContentAssistantEx
public void addProposalListener(IProposalListener listener) {
fProposalListeners.add(listener);
}
-
+
/**
* Tells whether the support for colored labels is enabled.
- *
+ *
* @return <code>true</code> if the support for colored labels is enabled, <code>false</code> otherwise
* @since 3.4
*/
@@ -1575,7 +1575,7 @@ public class ContentAssistant2 implements IContentAssistant, IContentAssistantEx
* Enables the support for colored labels in the proposal popup.
* <p>Completion proposals can implement {@link ICompletionProposalExtension6}
* to provide colored proposal labels.</p>
- *
+ *
* @param isEnabled if <code>true</code> the support for colored labels is enabled in the proposal popup
* @since 3.4
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java
index 4c9eabdf4bf..ce1f8e13af0 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/link/contentassist/LineBreakingReader.java
@@ -36,7 +36,7 @@ public class LineBreakingReader {
/**
* Creates a reader that breaks an input text to fit in a given width.
- *
+ *
* @param reader Reader of the input text
* @param gc The graphic context that defines the currently used font sizes
* @param maxLineWidth The max width (pixels) where the text has to fit in
@@ -57,7 +57,7 @@ public class LineBreakingReader {
/**
* Reads the next line. The lengths of the line will not exceed the given maximum width.
- *
+ *
* @return the next line
* @throws IOException if an I/O error occurs
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/ChangeRegion.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/ChangeRegion.java
index 04fe63c7c94..553215e3322 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/ChangeRegion.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/ChangeRegion.java
@@ -24,17 +24,17 @@ import org.eclipse.jface.text.source.LineRange;
* A change region describes a contiguous range of lines that was changed in the same revision of a
* document. Once it is adjusted to diff information, the originally contiguous range may be split
* into several ranges or even be empty.
- *
+ *
* @since 3.2
*/
public final class ChangeRegion {
private final Revision fRevision;
private final ILineRange fLines;
private final List fAdjusted= new LinkedList();
-
+
/**
* Creates a new change region for the given revision and line range.
- *
+ *
* @param revision the revision of the new region
* @param lines the line range of the new region
* @throws IndexOutOfBoundsException if the line range is not well-formed
@@ -46,10 +46,10 @@ public final class ChangeRegion {
fRevision=revision;
clearDiff();
}
-
+
/**
* Returns the revision that this region belongs to.
- *
+ *
* @return the revision that this region belongs to
*/
public Revision getRevision() {
@@ -58,7 +58,7 @@ public final class ChangeRegion {
/**
* Returns the original (before applying diff information) line range of this change region.
- *
+ *
* @return the original (before applying diff information) line range of this change region
*/
public ILineRange getOriginalRange() {
@@ -68,28 +68,28 @@ public final class ChangeRegion {
/**
* Returns the list of {@link ILineRange}s of this change region for which the revision
* information is still valid.
- *
+ *
* @return the list of adjusted line ranges
*/
public List getAdjustedRanges() {
return fAdjusted;
}
-
+
/**
* Returns the line coverage of the adjusted ranges, an empty range if the coverage is empty.
- *
+ *
* @return the line coverage of the adjusted ranges
*/
public ILineRange getAdjustedCoverage() {
if (fAdjusted.isEmpty())
return new LineRange(fLines.getStartLine(), 0);
-
+
Range first= (Range) fAdjusted.get(0);
Range last= (Range) fAdjusted.get(fAdjusted.size() - 1);
-
+
return Range.createAbsolute(first.start(), last.end());
}
-
+
/**
* Clears any adjusted ranges, restoring the original range.
*/
@@ -97,16 +97,16 @@ public final class ChangeRegion {
fAdjusted.clear();
fAdjusted.add(Range.copy(fLines));
}
-
+
/**
* Adjusts this change region to a diff hunk. This will change the adjusted ranges.
- *
+ *
* @param hunk the diff hunk to adjust to
*/
public void adjustTo(Hunk hunk) {
for (ListIterator it= fAdjusted.listIterator(); it.hasNext();) {
Range range= (Range) it.next();
-
+
// do we need a split?
int unchanged= getUnchanged(hunk, range.start());
if (unchanged > 0) {
@@ -116,40 +116,40 @@ public final class ChangeRegion {
it.add(range);
it.previous(); it.next(); // needed so we can remove below
}
-
+
int line= range.start();
Assert.isTrue(hunk.line <= line);
-
+
// by how much do we shrink?
int overlap= getOverlap(hunk, line);
if (overlap >= range.length()) {
it.remove();
continue;
}
-
+
// by how much do we move?
range.moveBy(hunk.delta + overlap);
range.resizeBy(-overlap);
}
-
+
}
-
+
private int getUnchanged(Hunk hunk, int line) {
return Math.max(0, hunk.line - line);
}
/*
- * Returns the number of lines after line that the hunk reports as changed.
+ * Returns the number of lines after line that the hunk reports as changed.
*/
private int getOverlap(Hunk hunk, int line) {
-
+
int deltaLine= hunk.line + hunk.changed;
if (hunk.delta >= 0) {
if (deltaLine <= line)
return 0;
return deltaLine - line;
}
-
+
// hunk.delta < 0
int hunkEnd= deltaLine - hunk.delta;
int cutCount= hunkEnd - line;
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Colors.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Colors.java
index 713e70f09c5..73fe458ca25 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Colors.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Colors.java
@@ -10,14 +10,14 @@
*******************************************************************************/
package org.eclipse.jface.internal.text.revisions;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
+import org.eclipse.core.runtime.Assert;
+
/**
* Utility for color operations.
- *
+ *
* @since 3.3
*/
public final class Colors {
@@ -30,7 +30,7 @@ public final class Colors {
/**
* Returns the human-perceived brightness of a color as float in [0.0, 1.0]. The used RGB
* weights come from http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC9.
- *
+ *
* @param rgb the color
* @return the gray-scale value
*/
@@ -43,7 +43,7 @@ public final class Colors {
* are lightened. Depending on the hue, the brightness range within the RGB gamut may be
* different, outside values are clipped. Note that this is an approximation; the returned RGB
* is not guaranteed to have the requested {@link #brightness(RGB) brightness}.
- *
+ *
* @param color the color to normalize
* @param brightness the requested brightness, in [0,&nbsp;1]
* @return a normalized version of <code>color</code>
@@ -61,7 +61,7 @@ public final class Colors {
/**
* Converts an {@link RGB} to an <a href="http://en.wikipedia.org/wiki/HSL_color_space">HSI</a>
* triplet.
- *
+ *
* @param color the color to convert
* @return the HSI float array of length 3
*/
@@ -82,7 +82,7 @@ public final class Colors {
hue = (g - b) / delta;
} else {
if (g == max) {
- hue = 2 + (b - r) / delta;
+ hue = 2 + (b - r) / delta;
} else {
hue = 4 + (r - g) / delta;
}
@@ -95,7 +95,7 @@ public final class Colors {
/**
* Converts a <a href="http://en.wikipedia.org/wiki/HSL_color_space">HSI</a> triplet to an RGB.
- *
+ *
* @param hsi the HSI values
* @return the RGB corresponding to the HSI spec
*/
@@ -105,7 +105,7 @@ public final class Colors {
float saturation= hsi[1];
float intensity= hsi[2];
if (saturation == 0) {
- r = g = b = intensity;
+ r = g = b = intensity;
} else {
float temp2= intensity < 0.5f ? intensity * (1.0f + saturation) : (intensity + saturation) - (intensity * saturation);
float temp1= 2f * intensity - temp2;
@@ -119,7 +119,7 @@ public final class Colors {
int red = (int)(r * 255 + 0.5);
int green = (int)(g * 255 + 0.5);
- int blue = (int)(b * 255 + 0.5);
+ int blue = (int)(b * 255 + 0.5);
return new RGB(red, green, blue);
}
@@ -145,7 +145,7 @@ public final class Colors {
* @param bg the background color
* @param fg the foreground color
* @param factor the mixing factor, must be in [0,&nbsp;1]
- *
+ *
* @return the interpolated color
*/
public static RGB blend(RGB bg, RGB fg, float factor) {
@@ -166,7 +166,7 @@ public final class Colors {
* <p>
* The returned array has size <code>steps</code>, and the color at index 0 is <code>start</code>, the color
* at index <code>steps&nbsp;-&nbsp;1</code> is <code>end</code>.
- *
+ *
* @param start the start color of the palette
* @param end the end color of the palette
* @param steps the requested size, must be &gt; 0
@@ -176,14 +176,14 @@ public final class Colors {
Assert.isLegal(start != null);
Assert.isLegal(end != null);
Assert.isLegal(steps > 0);
-
+
if (steps == 1)
return new RGB[] { start };
float step= 1.0f / (steps - 1);
RGB[] gradient= new RGB[steps];
for (int i= 0; i < steps; i++)
- gradient[i]= blend(start, end, step * i);
+ gradient[i]= blend(start, end, step * i);
return gradient;
}
@@ -204,7 +204,7 @@ public final class Colors {
* {@link SWT#COLOR_YELLOW yellow}, {@link SWT#COLOR_CYAN cyan},
* {@link SWT#COLOR_MAGENTA magenta}.
* </p>
- *
+ *
* @param steps the requested size, must be &gt;= 2
* @return an array of <code>steps</code> colors evenly distributed on the color wheel
*/
@@ -228,7 +228,7 @@ public final class Colors {
* {@link SWT#COLOR_YELLOW yellow}, {@link SWT#COLOR_CYAN cyan},
* {@link SWT#COLOR_MAGENTA magenta}.
* </p>
- *
+ *
* @param index the index of the color, must be &gt;= 0
* @return a color hue in [0&#176;,&nbsp;360&#176;)
* @see RGB#RGB(float, float, float)
@@ -239,7 +239,7 @@ public final class Colors {
* Base 3 gives a nice partitioning for RGB colors with red, green, blue being the colors
* 0,1,2, and yellow, cyan, magenta colors 3,4,5.
*/
- final int base= 3;
+ final int base= 3;
final float range= 360f;
// partition the baseRange by using the least significant bit to select one half of the
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Hunk.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Hunk.java
index 20208bfd5dd..07f32e2f04f 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Hunk.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Hunk.java
@@ -15,7 +15,7 @@ import org.eclipse.core.runtime.Assert;
/**
* A hunk describes a contiguous range of changed, added or deleted lines. <code>Hunk</code>s are separated by
* one or more unchanged lines.
- *
+ *
* @since 3.3
*/
public final class Hunk {
@@ -35,7 +35,7 @@ public final class Hunk {
/**
* Creates a new hunk.
- *
+ *
* @param line the line at which the hunk starts, must be &gt;= 0
* @param delta the difference in lines compared to the original
* @param changed the number of changed lines in this hunk, must be &gt;= 0
@@ -54,7 +54,7 @@ public final class Hunk {
public String toString() {
return "Hunk [" + line + ">" + changed + (delta < 0 ? "-" : "+") + Math.abs(delta) + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
-
+
/*
* @see java.lang.Object#hashCode()
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/HunkComputer.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/HunkComputer.java
index 122b749ab2a..2cf259da26a 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/HunkComputer.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/HunkComputer.java
@@ -19,14 +19,14 @@ import org.eclipse.jface.text.source.ILineDiffer;
/**
* Computes the diff hunks from an {@link ILineDiffer}.
- *
+ *
* @since 3.3
*/
public final class HunkComputer {
/**
* Converts the line-based information of {@link ILineDiffer} into {@link Hunk}s, grouping
* contiguous blocks of lines that are changed (added, deleted).
- *
+ *
* @param differ the line differ to query
* @param lines the number of lines to query
* @return the corresponding {@link Hunk} information
@@ -69,7 +69,7 @@ public final class HunkComputer {
changed= 0;
}
}
-
+
return (Hunk[]) hunks.toArray(new Hunk[hunks.size()]);
}
private HunkComputer() {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/LineIndexOutOfBoundsException.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/LineIndexOutOfBoundsException.java
index d346f1e4547..89886a3daf1 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/LineIndexOutOfBoundsException.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/LineIndexOutOfBoundsException.java
@@ -14,7 +14,7 @@ package org.eclipse.jface.internal.text.revisions;
* Thrown to indicate that an attempt to create or modify a {@link Range} failed because it would
* have resulted in an illegal range. A range is illegal if its length is &lt;= 0 or if its start
* line is &lt; 0.
- *
+ *
* @since 3.2
*/
public final class LineIndexOutOfBoundsException extends IndexOutOfBoundsException {
@@ -29,16 +29,16 @@ public final class LineIndexOutOfBoundsException extends IndexOutOfBoundsExcepti
/**
* Constructs an <code>LineIndexOutOfBoundsException</code> with the specified detail message.
- *
+ *
* @param s the detail message.
*/
public LineIndexOutOfBoundsException(String s) {
super(s);
}
-
+
/**
- * Constructs a new <code>LineIndexOutOfBoundsException</code>
- * object with an argument indicating the illegal index.
+ * Constructs a new <code>LineIndexOutOfBoundsException</code>
+ * object with an argument indicating the illegal index.
*
* @param index the illegal index.
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Range.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Range.java
index 2d8d723db0b..430595ca07c 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Range.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/Range.java
@@ -23,13 +23,13 @@ import org.eclipse.jface.text.source.ILineRange;
* result in a {@link LineIndexOutOfBoundsException} being
* thrown.
* </p>
- *
+ *
* @since 3.2
*/
public final class Range implements ILineRange, Cloneable {
/**
* Creates a new range with the same start and length as the passed line range.
- *
+ *
* @param range the range to copy
* @return a <code>Range</code> with the same start and length as <code>range</code>
* @throws LineIndexOutOfBoundsException if the passed {@link ILineRange} does not adhere to the
@@ -38,20 +38,20 @@ public final class Range implements ILineRange, Cloneable {
public static Range copy(ILineRange range) throws LineIndexOutOfBoundsException {
return createRelative(range.getStartLine(), range.getNumberOfLines());
}
-
+
/**
* Creates a new range equal to the passed line range.
- *
+ *
* @param range the range to copy
* @return a <code>Range</code> equal to <code>range</code>
*/
public static Range copy(Range range) {
return createRelative(range.start(), range.length());
}
-
+
/**
* Creates a new range with the given start offset and length.
- *
+ *
* @param start the first line of the new range, must be &gt;= 0
* @param length the number of lines included in the new range, must be &gt; 0
* @return a <code>Range</code> with the given start and length
@@ -64,7 +64,7 @@ public final class Range implements ILineRange, Cloneable {
/**
* Creates a new range with the given start and end offsets.
- *
+ *
* @param start the first line of the new range, must be &gt;= 0
* @param end the first line not in the range any more (exclusive), must be &gt; <code>start</code>
* @return a <code>Range</code> with the given start and end offsets
@@ -85,7 +85,7 @@ public final class Range implements ILineRange, Cloneable {
moveTo(start);
setLength(length);
}
-
+
/*
* @see org.eclipse.jface.text.source.ILineRange#getStartLine()
*/
@@ -99,37 +99,37 @@ public final class Range implements ILineRange, Cloneable {
public int getNumberOfLines() {
return length();
}
-
+
/**
* Returns the first line contained in this range. Short equivalent of {@link #getStartLine()}.
- *
+ *
* @return the first line contained in this range
*/
public int start() {
return fStart;
}
-
+
/**
* Returns the number of lines contained in this range. Short equivalent of {@link #getNumberOfLines()}.
- *
+ *
* @return the number of lines contained in this range
*/
public int length() {
return fLength;
}
-
+
/**
* Returns the first line after this range. Equivalent to {@linkplain #start() start} + {@linkplain #length() length}.
- *
+ *
* @return the first line after this range
*/
public int end() {
return start() + length();
}
-
+
/**
* Moves the receiver to <code>start</code>, keeping {@link #length()} constant.
- *
+ *
* @param start the new start, must be &gt;= 0
* @throws LineIndexOutOfBoundsException if <code>start</code> &lt; 0
*/
@@ -138,32 +138,32 @@ public final class Range implements ILineRange, Cloneable {
throw new LineIndexOutOfBoundsException("Cannot set a negative start: " + start); //$NON-NLS-1$
fStart= start;
}
-
+
/**
* Moves this range such that the {@link #end()} is at <code>end</code>, keeping
* {@link #length()} constant.
- *
+ *
* @param end the new end
* @throws LineIndexOutOfBoundsException if <code>end</code> &lt;= {@link #start()}
*/
public void moveEndTo(int end) throws LineIndexOutOfBoundsException {
moveTo(end - length());
}
-
+
/**
* Moves the range by <code>delta</code> lines, keeping {@link #length()} constant. The
* resulting start line must be &gt;= 0.
- *
+ *
* @param delta the number of lines to shift the range
* @throws LineIndexOutOfBoundsException if <code>-delta</code> &gt; {@link #start()}
*/
public void moveBy(int delta) throws LineIndexOutOfBoundsException {
moveTo(start() + delta);
}
-
+
/**
* Moves the start offset to <code>start</code>, keeping {@link #end()} constant.
- *
+ *
* @param start the new start, must be &gt;= 0 and &lt; {@link #end()}
* @throws LineIndexOutOfBoundsException if <code>start</code> &lt; 0 or &gt;= {@link #end()}
*/
@@ -174,20 +174,20 @@ public final class Range implements ILineRange, Cloneable {
moveTo(start);
setEnd(end);
}
-
+
/**
* Sets the end of this range, keeping {@link #start()} constant.
- *
+ *
* @param end the new end, must be &gt; {@link #start()}
* @throws LineIndexOutOfBoundsException if <code>end</code> &lt;= {@link #start()}
*/
public void setEnd(int end) throws LineIndexOutOfBoundsException {
setLength(end - start());
}
-
+
/**
* Sets the length of this range, keeping {@link #start()} constant.
- *
+ *
* @param length the new length, must be &gt; 0
* @throws LineIndexOutOfBoundsException if <code>length</code> &lt;= 0
*/
@@ -196,41 +196,41 @@ public final class Range implements ILineRange, Cloneable {
throw new LineIndexOutOfBoundsException("Cannot set length <= 0: " + length); //$NON-NLS-1$
fLength= length;
}
-
+
/**
* Sets the length of this range, keeping {@link #end()} constant.
- *
+ *
* @param length the new length, must be &gt; 0 and &lt;= {@link #end()}
* @throws LineIndexOutOfBoundsException if <code>length</code> &lt;= 0
*/
public void setLengthAndMove(int length) throws LineIndexOutOfBoundsException {
setStart(end() - length);
}
-
+
/**
* Resizes the range by <code>delta</code> lines, keeping {@link #start()} constant.
- *
+ *
* @param delta the number of lines to resize the range
- * @throws LineIndexOutOfBoundsException if <code>-delta</code> &gt;= {@link #length()}
+ * @throws LineIndexOutOfBoundsException if <code>-delta</code> &gt;= {@link #length()}
*/
public void resizeBy(int delta) throws LineIndexOutOfBoundsException {
setLength(length() + delta);
}
-
+
/**
* Resizes the range by <code>delta</code> lines by moving the start offset, {@link #end()} remains unchanged.
- *
+ *
* @param delta the number of lines to resize the range
- * @throws LineIndexOutOfBoundsException if <code>-delta</code> &gt;= {@link #length()}
+ * @throws LineIndexOutOfBoundsException if <code>-delta</code> &gt;= {@link #length()}
*/
public void resizeAndMoveBy(int delta) throws LineIndexOutOfBoundsException {
setStart(start() + delta);
}
-
+
/**
* Splits a range off the end of the receiver. The receiver is shortened to only include
* <code>remaining</code> lines after the split.
- *
+ *
* @param remaining the number of lines to remain in the receiver, must be in [1, {@link #length() length})
* @return the split off range
* @throws LineIndexOutOfBoundsException if <code>remaining</code>&gt;= {@link #length()} or <code>remaining</code>&ltt;= 0
@@ -243,10 +243,10 @@ public final class Range implements ILineRange, Cloneable {
setLength(remaining);
return new Range(end(), splitLength);
}
-
+
/**
* Returns <code>true</code> if the passed range has the same offset and length as the receiver.
- *
+ *
* @param range another line range to compare the receiver to
* @return <code>true</code> if <code>range</code> has the same offset and length as the receiver
*/
@@ -257,7 +257,7 @@ public final class Range implements ILineRange, Cloneable {
return false;
return range.getStartLine() == start() && range.getNumberOfLines() == length();
}
-
+
/*
* @see java.lang.Object#clone()
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java
index b4be180da27..6335210f740 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java
@@ -88,7 +88,7 @@ import org.eclipse.jface.text.source.LineRange;
/**
* A strategy for painting the live annotate colors onto the vertical ruler column. It also manages
* the revision hover.
- *
+ *
* @since 3.2
*/
public final class RevisionPainter {
@@ -99,7 +99,7 @@ public final class RevisionPainter {
private static final RGB BY_DATE_START_COLOR= new RGB(199, 134, 57);
private static final RGB BY_DATE_END_COLOR= new RGB(241, 225, 206);
-
+
/**
* The annotations created to show a revision in the overview ruler.
*/
@@ -150,14 +150,14 @@ public final class RevisionPainter {
/**
* Sets the revision information, which is needed to compute the relative age of a revision.
- *
+ *
* @param info the new revision info, <code>null</code> for none.
*/
public void setInfo(RevisionInformation info) {
fRevisions= null;
fColors.clear();
fFocusColors.clear();
-
+
if (info == null)
return;
List revisions= new ArrayList();
@@ -210,7 +210,7 @@ public final class RevisionPainter {
int index= fRevisions.indexOf(new Long(age));
return index;
}
-
+
private RGB getShadedColor(RGB color, float scale, boolean focus) {
Assert.isLegal(scale >= 0.0);
Assert.isLegal(scale <= 1.0);
@@ -242,7 +242,7 @@ public final class RevisionPainter {
/**
* Returns the color for a revision based on relative age and author.
- *
+ *
* @param revision the revision
* @param focus <code>true</code> to return the focus color
* @return the color for a revision
@@ -252,7 +252,7 @@ public final class RevisionPainter {
RGB color= (RGB) map.get(revision);
if (color != null)
return color;
-
+
color= adaptColor(revision, focus);
map.put(revision, color);
return color;
@@ -265,7 +265,7 @@ public final class RevisionPainter {
private class MouseHandler implements MouseMoveListener, MouseTrackListener, Listener {
private RevisionRange fMouseDownRegion;
-
+
private void handleMouseUp(Event e) {
if (e.button == 1) {
RevisionRange upRegion= fFocusRange;
@@ -356,7 +356,7 @@ public final class RevisionPainter {
*/
private static final class HoverInformationControlCreator extends AbstractReusableInformationControlCreator {
private boolean fIsFocusable;
-
+
public HoverInformationControlCreator(boolean isFocusable) {
fIsFocusable= isFocusable;
}
@@ -369,18 +369,18 @@ public final class RevisionPainter {
return new BrowserInformationControl(parent, JFaceResources.DIALOG_FONT, fIsFocusable) {
/**
* {@inheritDoc}
- *
+ *
* @deprecated use {@link #setInput(Object)}
*/
public void setInformation(String content) {
content= addCSSToHTMLFragment(content);
super.setInformation(content);
}
-
+
/**
* Adds a HTML header and CSS info if <code>html</code> is only an HTML fragment (has no
* &lt;html&gt; section).
- *
+ *
* @param html the html / text produced by a revision
* @return modified html
*/
@@ -389,14 +389,14 @@ public final class RevisionPainter {
if (html.substring(0, max).indexOf("<html>") != -1) //$NON-NLS-1$
// there is already a header
return html;
-
+
StringBuffer info= new StringBuffer(512 + html.length());
HTMLPrinter.insertPageProlog(info, 0, fgStyleSheet);
info.append(html);
HTMLPrinter.addPageEpilog(info);
return info.toString();
}
-
+
};
}
return new DefaultInformationControl(parent, fIsFocusable);
@@ -442,12 +442,12 @@ public final class RevisionPainter {
"var { font-style: italic }\n" + //$NON-NLS-1$
"th { font-weight: bold }\n" + //$NON-NLS-1$
""; //$NON-NLS-1$
-
+
/**
* The revision hover displays information about the currently selected revision.
*/
private final class RevisionHover implements IAnnotationHover, IAnnotationHoverExtension, IAnnotationHoverExtension2, IInformationProviderExtension2 {
-
+
/*
* @see org.eclipse.jface.text.source.IAnnotationHover#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer,
* int)
@@ -624,7 +624,7 @@ public final class RevisionPainter {
/**
* Creates a new revision painter for a vertical ruler column.
- *
+ *
* @param column the column that will delegate{@link #paint(GC, ILineRange) painting} to the
* newly created painter.
* @param sharedColors a shared colors object to store shaded colors in
@@ -638,7 +638,7 @@ public final class RevisionPainter {
/**
* Sets the revision information to be drawn and triggers a redraw.
- *
+ *
* @param info the revision information to show, <code>null</code> to draw none
*/
public void setRevisionInformation(RevisionInformation info) {
@@ -657,7 +657,7 @@ public final class RevisionPainter {
/**
* Changes the rendering mode and triggers redrawing if needed.
- *
+ *
* @param renderingMode the rendering mode
* @since 3.3
*/
@@ -672,7 +672,7 @@ public final class RevisionPainter {
/**
* Sets the background color.
- *
+ *
* @param background the background color, <code>null</code> for the platform's list
* background
*/
@@ -683,7 +683,7 @@ public final class RevisionPainter {
/**
* Sets the parent ruler - the delegating column must call this method as soon as it creates its
* control.
- *
+ *
* @param parentRuler the parent ruler
*/
public void setParentRuler(CompositeRuler parentRuler) {
@@ -694,7 +694,7 @@ public final class RevisionPainter {
* Delegates the painting of the quick diff colors to this painter. The painter will draw the
* color boxes onto the passed {@link GC} for all model (document) lines in
* <code>visibleModelLines</code>.
- *
+ *
* @param gc the {@link GC} to draw onto
* @param visibleLines the lines (in document offsets) that are currently (perhaps only
* partially) visible
@@ -715,14 +715,14 @@ public final class RevisionPainter {
}
fAuthorInset= gc.stringExtent(new String(string)).x;
}
-
+
// recompute colors (show intense colors if ruler is narrow)
int width= getWidth();
if (width != fLastWidth) {
fColorTool.setInfo(fRevisionInfo);
fLastWidth= width;
}
-
+
// draw change regions
List/* <RevisionRange> */ranges= getRanges(visibleLines);
for (Iterator it= ranges.iterator(); it.hasNext();) {
@@ -763,13 +763,13 @@ public final class RevisionPainter {
handleDispose();
}
});
-
+
fRevisionSelectionProvider.install(fViewer);
}
/**
* Returns <code>true</code> if the column is fully connected.
- *
+ *
* @return <code>true</code> if the column is fully connected, false otherwise
*/
private boolean isConnected() {
@@ -778,7 +778,7 @@ public final class RevisionPainter {
/**
* Sets the annotation model.
- *
+ *
* @param model the annotation model, possibly <code>null</code>
* @see IVerticalRulerColumn#setModel(IAnnotationModel)
*/
@@ -795,7 +795,7 @@ public final class RevisionPainter {
/**
* Sets the annotation model.
- *
+ *
* @param model the annotation model.
*/
private void setAnnotationModel(IAnnotationModel model) {
@@ -805,7 +805,7 @@ public final class RevisionPainter {
/**
* Sets the line differ.
- *
+ *
* @param differ the line differ or <code>null</code> if none
*/
private void setDiffer(IAnnotationModel differ) {
@@ -830,13 +830,13 @@ public final class RevisionPainter {
((IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener);
fLineDiffer= null;
}
-
+
fRevisionSelectionProvider.uninstall();
}
/**
* Paints a single change region onto <code>gc</code>.
- *
+ *
* @param range the range to paint
* @param gc the {@link GC} to paint on
*/
@@ -906,16 +906,16 @@ public final class RevisionPainter {
*/
int offset= fWidget.getOffsetAtLine(widgetLine);
int widgetBaseline= fWidget.getBaseline(offset);
-
+
FontMetrics fm = gc.getFontMetrics();
int fontBaseline = fm.getAscent() + fm.getLeading();
int baselineBias= widgetBaseline - fontBaseline;
return Math.max(0, baselineBias);
}
-
+
/**
* Looks up the color for a certain revision.
- *
+ *
* @param revision the revision to get the color for
* @param focus <code>true</code> if it is the focus revision
* @return the color for the revision
@@ -927,7 +927,7 @@ public final class RevisionPainter {
/**
* Returns the revision range that contains the given line, or
* <code>null</code> if there is none.
- *
+ *
* @param line the line of interest
* @return the corresponding <code>RevisionRange</code> or <code>null</code>
*/
@@ -952,7 +952,7 @@ public final class RevisionPainter {
/**
* Returns the sublist of all <code>RevisionRange</code>s that intersect with the given lines.
- *
+ *
* @param lines the model based lines of interest
* @return elementType: RevisionRange
*/
@@ -983,7 +983,7 @@ public final class RevisionPainter {
/**
* Gets all change ranges of the revisions in the revision model and adapts them to the current
* quick diff information. The list is cached.
- *
+ *
* @return the list of all change regions, with diff information applied
*/
private List getRangeCache() {
@@ -1010,11 +1010,11 @@ public final class RevisionPainter {
private void clearRangeCache() {
fRevisionRanges= null;
}
-
+
/**
* Returns <code>true</code> if <code>range</code> contains <code>line</code>. A line is
* not contained in a range if it is the range's exclusive end line.
- *
+ *
* @param range the range to check whether it contains <code>line</code>
* @param line the line the line
* @return <code>true</code> if <code>range</code> contains <code>line</code>,
@@ -1026,7 +1026,7 @@ public final class RevisionPainter {
/**
* Computes the end index of a line range.
- *
+ *
* @param range a line range
* @return the last line (exclusive) of <code>range</code>
*/
@@ -1036,7 +1036,7 @@ public final class RevisionPainter {
/**
* Returns the visible extent of a document line range in widget lines.
- *
+ *
* @param range the document line range
* @return the visible extent of <code>range</code> in widget lines
*/
@@ -1074,7 +1074,7 @@ public final class RevisionPainter {
/**
* Returns the revision hover.
- *
+ *
* @return the revision hover
*/
public IAnnotationHover getHover() {
@@ -1085,7 +1085,7 @@ public final class RevisionPainter {
* Computes and returns the bounds of the rectangle corresponding to a widget line range. The
* rectangle is in pixel coordinates relative to the text widget's
* {@link StyledText#getClientArea() client area} and has the width of the ruler.
- *
+ *
* @param range the widget line range
* @return the box bounds corresponding to <code>range</code>
*/
@@ -1102,7 +1102,7 @@ public final class RevisionPainter {
private void updateOverviewAnnotations() {
if (fAnnotationModel == null)
return;
-
+
Revision revision= fFocusRevision != null ? fFocusRevision : fSelectedRevision;
Map added= null;
@@ -1144,7 +1144,7 @@ public final class RevisionPainter {
/**
* Returns the character offset based region of a line range.
- *
+ *
* @param lines the line range to convert
* @return the character offset range corresponding to <code>range</code>
* @throws BadLocationException if the line range is not within the document bounds
@@ -1163,7 +1163,7 @@ public final class RevisionPainter {
/**
* Handles the selection of a revision and informs listeners.
- *
+ *
* @param revision the selected revision, <code>null</code> for none
*/
void handleRevisionSelected(Revision revision) {
@@ -1175,7 +1175,7 @@ public final class RevisionPainter {
/**
* Handles the selection of a revision id and informs listeners
- *
+ *
* @param id the selected revision id
*/
void handleRevisionSelected(String id) {
@@ -1197,7 +1197,7 @@ public final class RevisionPainter {
/**
* Returns the selection provider.
- *
+ *
* @return the selection provider
*/
public RevisionSelectionProvider getRevisionSelectionProvider() {
@@ -1206,7 +1206,7 @@ public final class RevisionPainter {
/**
* Updates the focus line with a new line.
- *
+ *
* @param line the new focus line, -1 for no focus
*/
private void updateFocusLine(int line) {
@@ -1216,7 +1216,7 @@ public final class RevisionPainter {
/**
* Handles a changing focus line.
- *
+ *
* @param previousLine the old focus line (-1 for no focus)
* @param nextLine the new focus line (-1 for no focus)
*/
@@ -1230,7 +1230,7 @@ public final class RevisionPainter {
/**
* Updates the focus range.
- *
+ *
* @param range the new focus range, <code>null</code> for no focus
*/
private void updateFocusRange(RevisionRange range) {
@@ -1240,7 +1240,7 @@ public final class RevisionPainter {
/**
* Handles a changing focus range.
- *
+ *
* @param previousRange the old focus range (<code>null</code> for no focus)
* @param nextRange the new focus range (<code>null</code> for no focus)
*/
@@ -1259,7 +1259,7 @@ public final class RevisionPainter {
/**
* Handles a changing focus revision.
- *
+ *
* @param previousRevision the old focus revision (<code>null</code> for no focus)
* @param nextRevision the new focus revision (<code>null</code> for no focus)
*/
@@ -1296,7 +1296,7 @@ public final class RevisionPainter {
/**
* Handles a mouse wheel event.
- *
+ *
* @param event the mouse wheel event
*/
private void handleMouseWheel(Event event) {
@@ -1372,7 +1372,7 @@ public final class RevisionPainter {
/**
* Translates a y coordinate in the pixel coordinates of the column's control to a document line
* number.
- *
+ *
* @param y the y coordinate
* @return the corresponding document line, -1 for no line
* @see CompositeRuler#toDocumentLineNumber(int)
@@ -1397,7 +1397,7 @@ public final class RevisionPainter {
/**
* Returns the width of the column.
- *
+ *
* @return the width of the column
*/
private int getWidth() {
@@ -1406,7 +1406,7 @@ public final class RevisionPainter {
/**
* Returns the System background color for list widgets.
- *
+ *
* @return the System background color for list widgets
*/
private Color getBackground() {
@@ -1417,7 +1417,7 @@ public final class RevisionPainter {
/**
* Sets the hover later returned by {@link #getHover()}.
- *
+ *
* @param hover the hover
*/
public void setHover(IAnnotationHover hover) {
@@ -1426,7 +1426,7 @@ public final class RevisionPainter {
/**
* Returns <code>true</code> if the receiver can provide a hover for a certain document line.
- *
+ *
* @param activeLine the document line of interest
* @return <code>true</code> if the receiver can provide a hover
*/
@@ -1436,7 +1436,7 @@ public final class RevisionPainter {
/**
* Returns the revision at a certain document offset, or <code>null</code> for none.
- *
+ *
* @param offset the document offset
* @return the revision at offset, or <code>null</code> for none
*/
@@ -1458,7 +1458,7 @@ public final class RevisionPainter {
/**
* Returns <code>true</code> if a revision model has been set, <code>false</code> otherwise.
- *
+ *
* @return <code>true</code> if a revision model has been set, <code>false</code> otherwise
*/
public boolean hasInformation() {
@@ -1467,7 +1467,7 @@ public final class RevisionPainter {
/**
* Returns the width in chars required to display information.
- *
+ *
* @return the width in chars required to display information
* @since 3.3
*/
@@ -1497,7 +1497,7 @@ public final class RevisionPainter {
/**
* Enables showing the revision id.
- *
+ *
* @param show <code>true</code> to show the revision, <code>false</code> to hide it
*/
public void showRevisionId(boolean show) {
@@ -1508,10 +1508,10 @@ public final class RevisionPainter {
postRedraw();
}
}
-
+
/**
* Enables showing the revision author.
- *
+ *
* @param show <code>true</code> to show the author, <code>false</code> to hide it
*/
public void showRevisionAuthor(boolean show) {
@@ -1525,7 +1525,7 @@ public final class RevisionPainter {
/**
* Adds a revision listener.
- *
+ *
* @param listener the listener
* @since 3.3
*/
@@ -1535,7 +1535,7 @@ public final class RevisionPainter {
/**
* Removes a revision listener.
- *
+ *
* @param listener the listener
* @since 3.3
*/
@@ -1545,7 +1545,7 @@ public final class RevisionPainter {
/**
* Informs the revision listeners about a change.
- *
+ *
* @since 3.3
*/
private void informListeners() {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java
index a8539a6cfe6..b1021e349a7 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java
@@ -12,10 +12,6 @@ package org.eclipse.jface.internal.text.revisions;
import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.revisions.Revision;
-
import org.eclipse.jface.viewers.IPostSelectionProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -24,6 +20,10 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.revisions.Revision;
+
/**
* A selection provider for annotate revisions. Selections of a revision can currently happen in
* following ways - note that this list may be changed in the future:
@@ -34,7 +34,7 @@ import org.eclipse.jface.viewers.StructuredSelection;
* <p>
* Calling {@link #setSelection(ISelection)} will set the current sticky revision on the ruler.
* </p>
- *
+ *
* @since 3.2
*/
public final class RevisionSelectionProvider implements ISelectionProvider {
@@ -58,9 +58,9 @@ public final class RevisionSelectionProvider implements ISelectionProvider {
int offset= ts.getOffset();
setSelectedRevision(fPainter.getRevision(offset));
}
-
+
}
-
+
public void dispose() {
fPostProvider.removePostSelectionChangedListener(this);
}
@@ -68,7 +68,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider {
private final RevisionPainter fPainter;
private final ListenerList fListeners= new ListenerList();
-
+
/**
* The text viewer once we are installed, <code>null</code> if not installed.
*/
@@ -90,7 +90,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider {
/**
* Creates a new selection provider.
- *
+ *
* @param painter the painter that the created provider interacts with
*/
RevisionSelectionProvider(RevisionPainter painter) {
@@ -110,7 +110,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider {
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
fListeners.remove(listener);
}
-
+
/*
* @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
*/
@@ -139,7 +139,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider {
/**
* Installs the selection provider on the viewer.
- *
+ *
* @param viewer the viewer on which we listen to for post selection events
*/
void install(ITextViewer viewer) {
@@ -153,7 +153,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider {
}
}
}
-
+
/**
* Uninstalls the selection provider.
*/
@@ -167,7 +167,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider {
/**
* Private protocol used by {@link RevisionPainter} to signal selection of a revision.
- *
+ *
* @param revision the selected revision, or <code>null</code> for none
*/
void revisionSelected(Revision revision) {
@@ -176,7 +176,7 @@ public final class RevisionSelectionProvider implements ISelectionProvider {
/**
* Updates the currently selected revision and sends out an event if it changed.
- *
+ *
* @param revision the newly selected revision or <code>null</code> for none
*/
private void setSelectedRevision(Revision revision) {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java
index c3d462ea20f..aafea2e6bab 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java
@@ -42,7 +42,7 @@ import org.eclipse.jface.text.source.IVerticalRulerColumn;
/**
* A strategy for painting the quick diff colors onto the vertical ruler column. It also manages the
* quick diff hover.
- *
+ *
* @since 3.2
*/
public final class DiffPainter {
@@ -87,7 +87,7 @@ public final class DiffPainter {
/**
* Creates a new diff painter for a vertical ruler column.
- *
+ *
* @param column the column that will delegate{@link #paint(GC, ILineRange) painting} to the
* newly created painter.
* @param sharedColors a shared colors object to store shaded colors in, may be
@@ -102,7 +102,7 @@ public final class DiffPainter {
/**
* Sets the parent ruler - the delegating column must call this method as soon as it creates its
* control.
- *
+ *
* @param parentRuler the parent ruler
*/
public void setParentRuler(CompositeRuler parentRuler) {
@@ -111,7 +111,7 @@ public final class DiffPainter {
/**
* Sets the quick diff hover later returned by {@link #getHover()}.
- *
+ *
* @param hover the hover
*/
public void setHover(IAnnotationHover hover) {
@@ -120,7 +120,7 @@ public final class DiffPainter {
/**
* Returns the quick diff hover set by {@link #setHover(IAnnotationHover)}.
- *
+ *
* @return the quick diff hover set by {@link #setHover(IAnnotationHover)}
*/
public IAnnotationHover getHover() {
@@ -129,7 +129,7 @@ public final class DiffPainter {
/**
* Sets the background color.
- *
+ *
* @param background the background color, <code>null</code> to use the platform's list background
*/
public void setBackground(Color background) {
@@ -140,7 +140,7 @@ public final class DiffPainter {
* Delegates the painting of the quick diff colors to this painter. The painter will draw the
* color boxes onto the passed {@link GC} for all model (document) lines in
* <code>visibleModelLines</code>.
- *
+ *
* @param gc the {@link GC} to draw onto
* @param visibleModelLines the lines (in document offsets) that are currently (perhaps only
* partially) visible
@@ -191,7 +191,7 @@ public final class DiffPainter {
/**
* Returns <code>true</code> if the column is fully connected.
- *
+ *
* @return <code>true</code> if the column is fully connected, false otherwise
*/
private boolean isConnected() {
@@ -210,7 +210,7 @@ public final class DiffPainter {
/**
* Paints a single model line onto <code>gc</code>.
- *
+ *
* @param line the model line to paint
* @param gc the {@link GC} to paint onto
* @param width the width of the column
@@ -248,7 +248,7 @@ public final class DiffPainter {
/**
* Returns whether the line background differs from the default.
- *
+ *
* @param info the info being queried
* @return <code>true</code> if <code>info</code> describes either a changed or an added
* line.
@@ -260,7 +260,7 @@ public final class DiffPainter {
/**
* Retrieves the <code>ILineDiffInfo</code> for <code>line</code> from the model. There are
* optimizations for direct access and sequential access patterns.
- *
+ *
* @param line the line we want the info for.
* @return the <code>ILineDiffInfo</code> for <code>line</code>, or <code>null</code>.
*/
@@ -273,7 +273,7 @@ public final class DiffPainter {
/**
* Returns the color for deleted lines.
- *
+ *
* @return the color to be used for the deletion indicator
*/
private Color getDeletionColor() {
@@ -282,7 +282,7 @@ public final class DiffPainter {
/**
* Returns the color for the given line diff info.
- *
+ *
* @param info the <code>ILineDiffInfo</code> being queried
* @return the correct background color for the line type being described by <code>info</code>
*/
@@ -302,7 +302,7 @@ public final class DiffPainter {
/**
* Sets the background color for changed lines.
- *
+ *
* @param color the new color to be used for the changed lines background
* @return the shaded color
*/
@@ -328,7 +328,7 @@ public final class DiffPainter {
/**
* Sets the annotation model.
- *
+ *
* @param model the annotation model, possibly <code>null</code>
* @see IVerticalRulerColumn#setModel(IAnnotationModel)
*/
@@ -344,7 +344,7 @@ public final class DiffPainter {
/**
* Sets the line differ.
- *
+ *
* @param differ the line differ
*/
private void setDiffer(IAnnotationModel differ) {
@@ -384,7 +384,7 @@ public final class DiffPainter {
/**
* Returns the width of the column.
- *
+ *
* @return the width of the column
*/
private int getWidth() {
@@ -393,7 +393,7 @@ public final class DiffPainter {
/**
* Computes the end index of a line range.
- *
+ *
* @param range a line range
* @return the last line (exclusive) of <code>range</code>
*/
@@ -403,7 +403,7 @@ public final class DiffPainter {
/**
* Returns the System background color for list widgets or the set background.
- *
+ *
* @return the System background color for list widgets
*/
private Color getBackground() {
@@ -414,7 +414,7 @@ public final class DiffPainter {
/**
* Sets the color for added lines.
- *
+ *
* @param addedColor the color for added lines
* @see org.eclipse.jface.text.source.IChangeRulerColumn#setAddedColor(org.eclipse.swt.graphics.Color)
*/
@@ -424,7 +424,7 @@ public final class DiffPainter {
/**
* Sets the color for changed lines.
- *
+ *
* @param changedColor the color for changed lines
* @see org.eclipse.jface.text.source.IChangeRulerColumn#setChangedColor(org.eclipse.swt.graphics.Color)
*/
@@ -434,7 +434,7 @@ public final class DiffPainter {
/**
* Sets the color for deleted lines.
- *
+ *
* @param deletedColor the color for deleted lines
* @see org.eclipse.jface.text.source.IChangeRulerColumn#setDeletedColor(org.eclipse.swt.graphics.Color)
*/
@@ -444,7 +444,7 @@ public final class DiffPainter {
/**
* Returns <code>true</code> if the receiver can provide a hover for a certain document line.
- *
+ *
* @param activeLine the document line of interest
* @return <code>true</code> if the receiver can provide a hover
*/
@@ -454,7 +454,7 @@ public final class DiffPainter {
/**
* Returns the display character for the accessibility mode for a certain model line.
- *
+ *
* @param line the document line of interest
* @return the display character for <code>line</code>
*/
@@ -465,7 +465,7 @@ public final class DiffPainter {
/**
* Returns the character to display in character display mode for the given
* <code>ILineDiffInfo</code>
- *
+ *
* @param info the <code>ILineDiffInfo</code> being queried
* @return the character indication for <code>info</code>
*/
@@ -484,7 +484,7 @@ public final class DiffPainter {
/**
* 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
@@ -496,7 +496,7 @@ public final class DiffPainter {
/**
* Returns the grey value in which the given color would be drawn in grey-scale.
- *
+ *
* @param rgb the color
* @return the grey-scale value
*/
@@ -508,7 +508,7 @@ public final class DiffPainter {
/**
* 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
*/
@@ -518,7 +518,7 @@ public final class DiffPainter {
/**
* Returns <code>true</code> if diff information is being displayed, <code>false</code> otherwise.
- *
+ *
* @return <code>true</code> if diff information is being displayed, <code>false</code> otherwise
* @since 3.3
*/
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
index ca66688219a..5a0b52d4bf9 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractHoverInformationControlManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractHoverInformationControlManager.java
@@ -10,12 +10,6 @@
*******************************************************************************/
package org.eclipse.jface.text;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
@@ -38,12 +32,19 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Scrollable;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+
import org.eclipse.jface.internal.text.DelayedInputChangeListener;
import org.eclipse.jface.internal.text.InformationControlReplacer;
import org.eclipse.jface.internal.text.InternalAccessor;
+import org.eclipse.jface.util.Geometry;
+
import org.eclipse.jface.text.ITextViewerExtension8.EnrichMode;
import org.eclipse.jface.text.source.AnnotationBarHoverManager;
-import org.eclipse.jface.util.Geometry;
/**
@@ -63,14 +64,14 @@ import org.eclipse.jface.util.Geometry;
* @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 (unless "move into hover" is enabled),
* a mouse button is pressed, the user presses a key, or the subject control is resized, moved, or loses focus.
*/
class Closer implements IInformationControlCloser, MouseListener, MouseMoveListener, ControlListener, KeyListener, SelectionListener, Listener {
-
+
/** The closer's subject control */
private Control fSubjectControl;
/** The subject area */
@@ -130,17 +131,17 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
if (hBar != null)
hBar.addSelectionListener(this);
}
-
+
fDisplay= fSubjectControl.getDisplay();
if (!fDisplay.isDisposed()) {
fDisplay.addFilter(SWT.Activate, this);
fDisplay.addFilter(SWT.MouseWheel, this);
-
+
fDisplay.addFilter(SWT.FocusOut, this);
-
+
fDisplay.addFilter(SWT.MouseDown, this);
fDisplay.addFilter(SWT.MouseUp, this);
-
+
fDisplay.addFilter(SWT.MouseMove, this);
fDisplay.addFilter(SWT.MouseEnter, this);
fDisplay.addFilter(SWT.MouseExit, this);
@@ -179,12 +180,12 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
if (fDisplay != null && !fDisplay.isDisposed()) {
fDisplay.removeFilter(SWT.Activate, this);
fDisplay.removeFilter(SWT.MouseWheel, this);
-
+
fDisplay.removeFilter(SWT.FocusOut, this);
-
+
fDisplay.removeFilter(SWT.MouseDown, this);
fDisplay.removeFilter(SWT.MouseUp, this);
-
+
fDisplay.removeFilter(SWT.MouseMove, this);
fDisplay.removeFilter(SWT.MouseEnter, this);
fDisplay.removeFilter(SWT.MouseExit, this);
@@ -261,13 +262,13 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
public void widgetSelected(SelectionEvent e) {
hideInformationControl();
}
-
+
/*
* @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
*/
public void widgetDefaultSelected(SelectionEvent e) {
}
-
+
/*
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
* @since 3.1
@@ -293,7 +294,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
}
}
break;
-
+
case SWT.MouseUp:
case SWT.MouseDown:
if (!hasInformationControlReplacer())
@@ -319,7 +320,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
}
});
}
-
+
// XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=212392 :
control.getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
@@ -341,7 +342,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
if (iControl != null && ! iControl.isFocusControl())
hideInformationControl();
break;
-
+
case SWT.MouseMove:
case SWT.MouseEnter:
case SWT.MouseExit:
@@ -352,24 +353,24 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
/**
* Handle mouse movement events.
- *
+ *
* @param event the event
* @since 3.4
*/
private void handleMouseMove(Event event) {
// if (DEBUG)
// System.out.println("AbstractHoverInformationControl.Closer.handleMouseMove():" + event); //$NON-NLS-1$
-
+
if (!(event.widget instanceof Control))
return;
Control eventControl= (Control) event.widget;
-
+
//transform coordinates to subject control:
Point mouseLoc= event.display.map(eventControl, fSubjectControl, event.x, event.y);
-
+
if (fSubjectArea.contains(mouseLoc))
return;
-
+
IInformationControl iControl= getCurrentInformationControl();
if (!hasInformationControlReplacer() || !canMoveIntoInformationControl(iControl)) {
if (AbstractHoverInformationControlManager.this instanceof AnnotationBarHoverManager) {
@@ -379,7 +380,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
hideInformationControl();
return;
}
-
+
IInformationControlExtension3 iControl3= (IInformationControlExtension3) iControl;
Rectangle controlBounds= iControl3.getBounds();
if (controlBounds != null) {
@@ -496,7 +497,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
System.out.println("AbstractHoverInformationControlManager...mouseHover: @ " + event.x + "/" + event.y + " : hover cancelled: fIsComputing= " + fIsComputing + ", fIsInRestartMode= " + fIsInRestartMode); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
return;
}
-
+
fIsInRestartMode= true;
fIsComputing= true;
fMouseLostWhileComputing= false;
@@ -526,7 +527,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
protected void deactivate() {
if (fIsComputing)
return;
-
+
fIsInRestartMode= false;
if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
fSubjectControl.removeMouseMoveListener(this);
@@ -632,24 +633,24 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
/**
* The thread that delays replacing of the hover information control.
* To be accessed in the UI thread only!
- *
+ *
* @since 3.4
*/
private Job fReplacingDelayJob;
-
+
/**
* The {@link ITextViewerExtension8.EnrichMode}, may be <code>null</code>.
* @since 3.4
*/
private EnrichMode fEnrichMode;
-
+
/**
* Indicates whether we have received a MouseDown event and are waiting for a MouseUp
* (and don't replace the information control until that happened).
* @since 3.4
*/
private boolean fWaitForMouseUp= false;
-
+
/**
* 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.
@@ -665,21 +666,21 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
/**
* Tests whether a given mouse location is within the keep-up zone.
* The hover should not be hidden as long as the mouse stays inside this zone.
- *
+ *
* @param x the x coordinate, relative to the <em>subject control</em>
* @param y the y coordinate, relative to the <em>subject control</em>
* @param subjectControl the subject control
* @param subjectArea the area for which the presented information is valid
* @param blowUp If <code>true</code>, then calculate for the closer, i.e. blow up the keepUp area.
* If <code>false</code>, then use tight bounds for hover detection.
- *
+ *
* @return <code>true</code> iff the mouse event occurred in the keep-up zone
* @since 3.4
*/
private boolean inKeepUpZone(int x, int y, Control subjectControl, Rectangle subjectArea, boolean blowUp) {
if (subjectArea.contains(x, y))
return true;
-
+
IInformationControl iControl= getCurrentInformationControl();
if ((iControl instanceof IInformationControlExtension5 && !((IInformationControlExtension5) iControl).isVisible())) {
iControl= null;
@@ -692,7 +693,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
}
if (iControl instanceof IInformationControlExtension3) {
IInformationControlExtension3 iControl3= (IInformationControlExtension3) iControl;
-
+
Rectangle iControlBounds= subjectControl.getDisplay().map(null, subjectControl, iControl3.getBounds());
Rectangle totalBounds= Geometry.copy(iControlBounds);
if (blowUp && isReplaceInProgress()) {
@@ -701,11 +702,11 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
int margin= getInformationControlReplacer().getKeepUpMargin();
Geometry.expand(totalBounds, margin, margin, margin, margin);
}
-
+
if (!blowUp) {
if (iControlBounds.contains(x, y))
return true;
-
+
if (subjectArea.y + subjectArea.height < iControlBounds.y) {
// special case for hover events: subjectArea totally above iControl:
// +-----------+
@@ -724,7 +725,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
// FIXME: cases when subjectArea extends to left or right of iControl?
}
return false;
-
+
} else if (iControlBounds.x + iControlBounds.width < subjectArea.x) {
// special case for hover events (e.g. in overview ruler): iControl totally left of subjectArea
// +--------------------+-----------+
@@ -740,7 +741,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
}
}
return false;
-
+
} else if (subjectArea.x + subjectArea.width < iControlBounds.x) {
// special case for hover events (e.g. in annotation ruler): subjectArea totally left of iControl
// +-----------+--------------------+
@@ -758,7 +759,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
return false;
}
}
-
+
// FIXME: should maybe use convex hull, not bounding box
totalBounds.add(subjectArea);
if (totalBounds.contains(x, y))
@@ -766,11 +767,11 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
}
return false;
}
-
+
/**
* Tests whether the given information control allows the mouse to be moved
* into it.
- *
+ *
* @param iControl information control or <code>null</code> if none
* @return <code>true</code> if information control allows mouse move into
* control, <code>false</code> otherwise
@@ -778,7 +779,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
boolean canMoveIntoInformationControl(IInformationControl iControl) {
return fEnrichMode != null && canReplace(iControl);
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#hideInformationControl()
*/
@@ -791,7 +792,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
* Sets the hover enrich mode. Only applicable when an information
* control replacer has been set with
* {@link #setInformationControlReplacer(InformationControlReplacer)} .
- *
+ *
* @param mode the enrich mode
* @since 3.4
* @see ITextViewerExtension8#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode)
@@ -799,7 +800,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
void setHoverEnrichMode(EnrichMode mode) {
fEnrichMode= mode;
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#replaceInformationControl(boolean)
*/
@@ -807,7 +808,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
fWaitForMouseUp= false;
super.replaceInformationControl(takeFocus);
}
-
+
/**
* Cancels the replacing delay job.
* @return <code>true</code> iff canceling was successful, <code>false</code> if replacing has already started
@@ -825,20 +826,20 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
// System.out.println("AbstractHoverInformationControlManager.cancelReplacingDelay(): not delayed"); //$NON-NLS-1$
return true;
}
-
+
/**
* Starts replacing the information control, considering the current
* {@link ITextViewerExtension8.EnrichMode}.
* If set to {@link ITextViewerExtension8.EnrichMode#AFTER_DELAY}, this
* method cancels previous requests and restarts the delay timer.
- *
+ *
* @param display the display to be used for the call to
* {@link #replaceInformationControl(boolean)} in the UI thread
*/
private void startReplaceInformationControl(final Display display) {
if (fEnrichMode == EnrichMode.ON_CLICK)
return;
-
+
if (fReplacingDelayJob != null) {
if (fReplacingDelayJob.getState() != Job.RUNNING) {
if (fReplacingDelayJob.cancel()) {
@@ -855,7 +856,7 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
}
return;
}
-
+
fReplacingDelayJob= new Job("AbstractHoverInformationControlManager Replace Delayer") { //$NON-NLS-1$
public IStatus run(final IProgressMonitor monitor) {
if (monitor.isCanceled() || display.isDisposed()) {
@@ -960,12 +961,12 @@ abstract public class AbstractHoverInformationControlManager extends AbstractInf
protected int getHoverEventStateMask() {
return fHoverEventStateMask;
}
-
+
/**
* Returns an adapter that gives access to internal methods.
* <p>
* <strong>Note:</strong> This method is not intended to be referenced or overridden by clients.</p>
- *
+ *
* @return the replaceable information control accessor
* @since 3.4
* @noreference This method is not intended to be referenced by clients.
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java
index b0ea42e4478..974a479cf2c 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java
@@ -63,7 +63,7 @@ import org.eclipse.jface.util.Geometry;
* They should also extend {@link #computeTrim()} if they create a content area
* with additional trim (e.g. scrollbars) and override {@link #getInformationPresenterControlCreator()}.
* </p>
- *
+ *
* @since 3.4
*/
public abstract class AbstractInformationControl implements IInformationControl, IInformationControlExtension, IInformationControlExtension3, IInformationControlExtension4, IInformationControlExtension5 {
@@ -74,7 +74,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
private final Composite fContentComposite;
/** Whether the information control is resizable. */
private final boolean fResizable;
-
+
/** Composite containing the status line content or <code>null</code> if none. */
private Composite fStatusComposite;
/** Separator between content and status line or <code>null</code> if none. */
@@ -85,17 +85,17 @@ public abstract class AbstractInformationControl implements IInformationControl,
private final ToolBarManager fToolBarManager;
/** Status line toolbar or <code>null</code> if none. */
private ToolBar fToolBar;
-
+
/** Listener for shell activation and deactivation. */
private Listener fShellListener;
/** All focus listeners registered to this information control. */
private ListenerList fFocusListeners= new ListenerList(ListenerList.IDENTITY);
-
+
/** Size constraints, x is the maxWidth and y is the maxHeight, or <code>null</code> if not set. */
private Point fSizeConstraints;
/** The size of the resize handle if already set, -1 otherwise */
private int fResizeHandleSize;
-
+
/**
* Creates an abstract information control with the given shell as parent.
* The control will not be resizable and optionally show a status line with
@@ -103,7 +103,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
* <p>
* <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em>
* </p>
- *
+ *
* @param parentShell the parent of this control's shell
* @param statusFieldText the text to be used in the status field or <code>null</code> to hide the status field
*/
@@ -118,7 +118,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
* <p>
* <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em>
* </p>
- *
+ *
* @param parentShell the parent of this control's shell
* @param toolBarManager the manager or <code>null</code> if toolbar is not desired
*/
@@ -131,7 +131,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
* <p>
* <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em>
* </p>
- *
+ *
* @param parentShell the parent of this control's shell
* @param isResizable <code>true</code> if the control should be resizable
*/
@@ -149,47 +149,47 @@ public abstract class AbstractInformationControl implements IInformationControl,
* <p>
* <strong>Important:</strong>: Subclasses are required to call {@link #create()} at the end of their constructor.
* </p>
- *
+ *
* @param parentShell the parent of this control's shell
* @param shellStyle style of this control's shell
* @param statusFieldText the text to be used in the status field or <code>null</code> to hide the status field
* @param toolBarManager the manager or <code>null</code> if toolbar is not desired
- *
+ *
* @deprecated clients should use one of the public constructors
*/
AbstractInformationControl(Shell parentShell, int shellStyle, final String statusFieldText, final ToolBarManager toolBarManager) {
Assert.isTrue(statusFieldText == null || toolBarManager == null);
fResizeHandleSize= -1;
fToolBarManager= toolBarManager;
-
+
if ((shellStyle & SWT.NO_TRIM) != 0)
shellStyle&= ~(SWT.NO_TRIM | SWT.SHELL_TRIM); // make sure we get the OS border but no other trims
-
+
fResizable= (shellStyle & SWT.RESIZE) != 0; // on GTK, Shell removes SWT.RESIZE if SWT.ON_TOP is set
fShell= new Shell(parentShell, shellStyle);
Display display= fShell.getDisplay();
Color foreground= display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
Color background= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
setColor(fShell, foreground, background);
-
+
GridLayout layout= new GridLayout(1, false);
layout.marginHeight= 0;
layout.marginWidth= 0;
layout.verticalSpacing= 0;
fShell.setLayout(layout);
-
+
fContentComposite= new Composite(fShell, SWT.NONE);
fContentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
fContentComposite.setLayout(new FillLayout());
setColor(fContentComposite, foreground, background);
-
+
createStatusComposite(statusFieldText, toolBarManager, foreground, background);
}
private void createStatusComposite(final String statusFieldText, final ToolBarManager toolBarManager, Color foreground, Color background) {
if (toolBarManager == null && statusFieldText == null)
return;
-
+
fStatusComposite= new Composite(fShell, SWT.NONE);
GridData gridData= new GridData(SWT.FILL, SWT.BOTTOM, true, false);
fStatusComposite.setLayoutData(gridData);
@@ -198,10 +198,10 @@ public abstract class AbstractInformationControl implements IInformationControl,
statusLayout.marginWidth= 0;
statusLayout.verticalSpacing= 1;
fStatusComposite.setLayout(statusLayout);
-
+
fSeparator= new Label(fStatusComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
fSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
if (statusFieldText != null) {
createStatusLabel(statusFieldText, foreground, background);
} else {
@@ -213,39 +213,39 @@ public abstract class AbstractInformationControl implements IInformationControl,
fStatusLabel= new Label(fStatusComposite, SWT.RIGHT);
fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
fStatusLabel.setText(statusFieldText);
-
+
FontData[] fontDatas= JFaceResources.getDialogFont().getFontData();
for (int i= 0; i < fontDatas.length; i++) {
fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
}
fStatusLabel.setFont(new Font(fStatusLabel.getDisplay(), fontDatas));
-
+
fStatusLabel.setForeground(fStatusLabel.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
fStatusLabel.setBackground(background);
setColor(fStatusComposite, foreground, background);
}
-
+
private void createToolBar(ToolBarManager toolBarManager) {
final Composite bars= new Composite(fStatusComposite, SWT.NONE);
bars.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
-
+
GridLayout layout= new GridLayout(3, false);
layout.marginHeight= 0;
layout.marginWidth= 0;
layout.horizontalSpacing= 0;
layout.verticalSpacing= 0;
bars.setLayout(layout);
-
+
fToolBar= toolBarManager.createControl(bars);
GridData gd= new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
fToolBar.setLayoutData(gd);
-
+
Composite spacer= new Composite(bars, SWT.NONE);
gd= new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint= 0;
gd.heightHint= 0;
spacer.setLayoutData(gd);
-
+
addMoveSupport(spacer);
addResizeSupportIfNecessary(bars);
}
@@ -258,11 +258,11 @@ public abstract class AbstractInformationControl implements IInformationControl,
final boolean isWin= platform.equals("win32"); //$NON-NLS-1$
if (!isWin && !platform.equals("gtk")) //$NON-NLS-1$
return;
-
+
final Canvas resizer= new Canvas(bars, SWT.NONE);
-
+
int size= getResizeHandleSize(bars);
-
+
GridData data= new GridData(SWT.END, SWT.END, false, true);
data.widthHint= size;
data.heightHint= size;
@@ -285,7 +285,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
for (int i= 0; i <= 2; i++)
for (int j= 0; j <= 2 - i; j++)
e.gc.fillRectangle(end - 4 * i, end - 4 * j, 2, 2);
-
+
} else {
// draw diagonal lines
e.gc.setForeground(resizer.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
@@ -299,12 +299,12 @@ public abstract class AbstractInformationControl implements IInformationControl,
}
}
});
-
- final boolean isRTL= (resizer.getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0;
+
+ final boolean isRTL= (resizer.getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0;
resizer.setCursor(new Cursor(resizer.getDisplay(), isRTL ? SWT.CURSOR_SIZESW : SWT.CURSOR_SIZESE));
MouseAdapter resizeSupport= new MouseAdapter() {
private MouseMoveListener fResizeListener;
-
+
public void mouseDown(MouseEvent e) {
Rectangle shellBounds= fShell.getBounds();
final int shellX= shellBounds.x;
@@ -329,7 +329,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
};
resizer.addMouseMoveListener(fResizeListener);
}
-
+
public void mouseUp(MouseEvent e) {
resizer.removeMouseMoveListener(fResizeListener);
fResizeListener= null;
@@ -348,13 +348,13 @@ public abstract class AbstractInformationControl implements IInformationControl,
sliderH.dispose();
fResizeHandleSize= Math.min(width, height);
}
-
+
return fResizeHandleSize;
}
/**
* Adds support to move the shell by dragging the given control.
- *
+ *
* @param control the control that can be used to move the shell
*/
private void addMoveSupport(final Control control) {
@@ -390,7 +390,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
/**
* Utility to set the foreground and the background color of the given
* control
- *
+ *
* @param control the control to modify
* @param foreground the color to use for the foreground
* @param background the color to use for the background
@@ -402,17 +402,17 @@ public abstract class AbstractInformationControl implements IInformationControl,
/**
* The shell of the popup window.
- *
+ *
* @return the shell used for the popup window
*/
protected final Shell getShell() {
return fShell;
}
-
+
/**
* The toolbar manager used to manage the toolbar, or <code>null</code> if
* no toolbar is shown.
- *
+ *
* @return the tool bar manager or <code>null</code>
*/
protected final ToolBarManager getToolBarManager() {
@@ -443,11 +443,11 @@ public abstract class AbstractInformationControl implements IInformationControl,
* The given <code>parent</code> comes with a {@link FillLayout}.
* Subclasses may set a different layout.
* </p>
- *
+ *
* @param parent the container of the content
*/
protected abstract void createContent(Composite parent);
-
+
/**
* Sets the information to be presented by this information control.
* <p>
@@ -455,16 +455,16 @@ public abstract class AbstractInformationControl implements IInformationControl,
* or implement {@link IInformationControlExtension2}.
*
* @param information the information to be presented
- *
+ *
* @see org.eclipse.jface.text.IInformationControl#setInformation(java.lang.String)
*/
public void setInformation(String information) {
-
+
}
-
+
/**
* Returns whether the information control is resizable.
- *
+ *
* @return <code>true</code> if the information control is resizable,
* <code>false</code> if it is not resizable.
*/
@@ -478,7 +478,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
public void setVisible(boolean visible) {
if (fShell.isVisible() == visible)
return;
-
+
fShell.setVisible(visible);
}
@@ -510,10 +510,10 @@ public abstract class AbstractInformationControl implements IInformationControl,
public void setSizeConstraints(int maxWidth, int maxHeight) {
fSizeConstraints= new Point(maxWidth, maxHeight);
}
-
+
/**
* Returns the size constraints.
- *
+ *
* @return the size constraints or <code>null</code> if not set
* @see #setSizeConstraints(int, int)
*/
@@ -529,7 +529,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
Point constrains= getSizeConstraints();
if (constrains == null)
return fShell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
-
+
return fShell.computeSize(constrains.x, constrains.y, true);
}
@@ -537,7 +537,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
* Computes the trim (status text and tool bar are considered as trim).
* Subclasses can extend this method to add additional trim (e.g. scroll
* bars for resizable information controls).
- *
+ *
* @see org.eclipse.jface.text.IInformationControlExtension3#computeTrim()
*/
public Rectangle computeTrim() {
@@ -617,7 +617,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
/**
* This default implementation sets the focus on the popup shell.
* Subclasses can override or extend.
- *
+ *
* @see IInformationControl#setFocus()
*/
public void setFocus() {
@@ -673,10 +673,10 @@ public abstract class AbstractInformationControl implements IInformationControl,
* shown if the information control has been created with a non-null status
* field text.
* </p>
- *
+ *
* @param statusFieldText the text to be used in the optional status field
* or <code>null</code> if the status field should be hidden
- *
+ *
* @see org.eclipse.jface.text.IInformationControlExtension4#setStatusText(java.lang.String)
*/
public void setStatusText(String statusFieldText) {
@@ -689,7 +689,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
}
}
}
-
+
/*
* @see org.eclipse.jface.text.IInformationControlExtension5#containsControl(org.eclipse.swt.widgets.Control)
*/
@@ -723,7 +723,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
* Computes the size constraints based on the
* {@link JFaceResources#getDialogFont() dialog font}. Subclasses can
* override or extend.
- *
+ *
* @see org.eclipse.jface.text.IInformationControlExtension5#computeSizeConstraints(int, int)
*/
public Point computeSizeConstraints(int widthInChars, int heightInChars) {
@@ -735,5 +735,5 @@ public abstract class AbstractInformationControl implements IInformationControl,
return new Point(widthInChars * width, heightInChars * height);
}
-
+
}
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
index 1dd6b6cfe59..b8894e766c9 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java
@@ -54,30 +54,30 @@ abstract public class AbstractInformationControlManager {
/**
* An internal class that gives access to internal methods.
- *
+ *
* @since 3.4
*/
class MyInternalAccessor extends InternalAccessor {
public IInformationControl getCurrentInformationControl() {
return AbstractInformationControlManager.this.getCurrentInformationControl();
}
-
+
public void setInformationControlReplacer(InformationControlReplacer replacer) {
AbstractInformationControlManager.this.setInformationControlReplacer(replacer);
}
-
+
public InformationControlReplacer getInformationControlReplacer() {
return AbstractInformationControlManager.this.getInformationControlReplacer();
}
-
+
public boolean canReplace(IInformationControl control) {
return AbstractInformationControlManager.this.canReplace(control);
}
-
+
public boolean isReplaceInProgress() {
return AbstractInformationControlManager.this.isReplaceInProgress();
}
-
+
public void replaceInformationControl(boolean takeFocus) {
AbstractInformationControlManager.this.replaceInformationControl(takeFocus);
}
@@ -85,11 +85,11 @@ abstract public class AbstractInformationControlManager {
public void cropToClosestMonitor(Rectangle bounds) {
AbstractInformationControlManager.this.cropToClosestMonitor(bounds);
}
-
+
public void setHoverEnrichMode(EnrichMode mode) {
throw new UnsupportedOperationException("only implemented in AbstractHoverInformationControlManager"); //$NON-NLS-1$
}
-
+
public boolean getAllowMouseExit() {
throw new UnsupportedOperationException("only implemented in AnnotationBarHoverManager"); //$NON-NLS-1$
}
@@ -153,14 +153,14 @@ abstract public class AbstractInformationControlManager {
/**
* Returns the SWT direction flag. One of {@link SWT#BOTTOM}, {@link SWT#TOP},
* {@link SWT#LEFT}, {@link SWT#RIGHT}, {@link SWT#CENTER},
- *
+ *
* @return the SWT direction flag
* @since 3.3
*/
int getSWTFlag() {
return fFlag;
}
-
+
public String toString() {
switch (fFlag) {
case SWT.BOTTOM: return "BOTTOM"; //$NON-NLS-1$
@@ -210,7 +210,7 @@ abstract public class AbstractInformationControlManager {
* @since 3.0
*/
public static final String STORE_SIZE_HEIGHT= "size.height"; //$NON-NLS-1$
-
+
/**
* Tells whether this class and its subclasses are in debug mode.
* <p>
@@ -235,7 +235,7 @@ abstract public class AbstractInformationControlManager {
/**
* The information control.
- *
+ *
* <p>This field should not be referenced by subclasses. It is <code>protected</code> for API
* compatibility reasons.
*/
@@ -243,7 +243,7 @@ abstract public class AbstractInformationControlManager {
/**
* The information control creator.
- *
+ *
* <p>This field should not be referenced by subclasses. It is <code>protected</code> for API
* compatibility reasons.
*/
@@ -251,7 +251,7 @@ abstract public class AbstractInformationControlManager {
/**
* The information control closer.
- *
+ *
* <p>This field should not be referenced by subclasses. It is <code>protected</code> for API
* compatibility reasons.
*/
@@ -259,7 +259,7 @@ abstract public class AbstractInformationControlManager {
/**
* Indicates that the information control has been disposed.
- *
+ *
* <p>This field should not be referenced by subclasses. It is <code>protected</code> for API
* compatibility reasons.
*/
@@ -268,7 +268,7 @@ abstract public class AbstractInformationControlManager {
/**
* The information control replacer to be used when this information control
* needs to be replaced with another information control.
- *
+ *
* @since 3.4
*/
private InformationControlReplacer fInformationControlReplacer;
@@ -353,7 +353,7 @@ abstract public class AbstractInformationControlManager {
/**
* The dispose listener on the subject control.
- *
+ *
* @since 3.1
*/
private DisposeListener fSubjectControlDisposeListener;
@@ -426,11 +426,11 @@ abstract public class AbstractInformationControlManager {
protected void setCloser(IInformationControlCloser closer) {
fInformationControlCloser= closer;
}
-
+
/**
* Sets the information control replacer for this manager and disposes the
* old one if set.
- *
+ *
* @param replacer the information control replacer for this manager, or
* <code>null</code> if no information control replacing should
* take place
@@ -444,7 +444,7 @@ abstract public class AbstractInformationControlManager {
/**
* Returns the current information control replacer or <code>null</code> if none has been installed.
- *
+ *
* @return the current information control replacer or <code>null</code> if none has been installed
* @since 3.4
*/
@@ -454,17 +454,17 @@ abstract public class AbstractInformationControlManager {
/**
* Returns whether an information control replacer has been installed.
- *
+ *
* @return whether an information control replacer has been installed
* @since 3.4
*/
boolean hasInformationControlReplacer() {
return fInformationControlReplacer != null;
}
-
+
/**
* Tests whether the given information control is replaceable.
- *
+ *
* @param iControl information control or <code>null</code> if none
* @return <code>true</code> if information control is replaceable, <code>false</code> otherwise
* @since 3.4
@@ -474,10 +474,10 @@ abstract public class AbstractInformationControlManager {
&& iControl instanceof IInformationControlExtension5
&& ((IInformationControlExtension5) iControl).getInformationPresenterControlCreator() != null;
}
-
+
/**
* Returns the current information control, or <code>null</code> if none.
- *
+ *
* @return the current information control, or <code>null</code> if none
* @since 3.4
*/
@@ -487,7 +487,7 @@ abstract public class AbstractInformationControlManager {
/**
* Tells whether this manager's information control is currently being replaced.
- *
+ *
* @return <code>true</code> if a replace is in progress
* @since 3.4
*/
@@ -498,7 +498,7 @@ abstract public class AbstractInformationControlManager {
/**
* Sets the horizontal and vertical 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
*/
@@ -542,7 +542,7 @@ abstract public class AbstractInformationControlManager {
* <li>{@link AbstractInformationControlManager#STORE_SIZE_HEIGHT}</li>
* </ul>
* </p>
- *
+ *
* @param dialogSettings the dialog settings
* @param restoreLocation <code>true</code> iff the location is must be (re-)stored
* @param restoreSize <code>true</code>iff the size is (re-)stored
@@ -645,11 +645,11 @@ abstract public class AbstractInformationControlManager {
setEnabled(true);
fDisposed= false;
}
-
+
/**
* Returns the dispose listener which gets added
* to the subject control.
- *
+ *
* @return the dispose listener
* @since 3.1
*/
@@ -861,11 +861,11 @@ abstract public class AbstractInformationControlManager {
return fSubjectControl.toDisplay(new Point(subjectArea.x + xShift, subjectArea.y + yShift));
}
-
+
/**
* Computes the area available for an information control given an anchor and the subject area
* within <code>bounds</code>.
- *
+ *
* @param subjectArea the subject area
* @param bounds the bounds
* @param anchor the anchor at the subject area
@@ -902,7 +902,7 @@ abstract public class AbstractInformationControlManager {
area.intersect(bounds);
return area;
}
-
+
/**
* 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
@@ -1024,7 +1024,7 @@ abstract public class AbstractInformationControlManager {
Monitor monitor= getClosestMonitor(subjectAreaDisplayRelative, testAnchor);
if (updateLocation(upperLeft, controlSize, monitor.getClientArea(), testAnchor))
return upperLeft;
-
+
// compute available area for this anchor and update if better than best
Rectangle available= computeAvailableArea(subjectAreaDisplayRelative, monitor.getClientArea(), testAnchor);
Rectangle proposed= new Rectangle(upperLeft.x, upperLeft.y, controlSize.x, controlSize.y);
@@ -1035,20 +1035,20 @@ abstract public class AbstractInformationControlManager {
bestBounds= available;
bestAnchor= testAnchor;
}
-
+
testAnchor= getNextFallbackAnchor(testAnchor);
} while (testAnchor != fAnchor && testAnchor != null);
-
+
// no anchor is perfect - select the one with larges area and set the size to not overlap with the subjectArea
if (bestAnchor != ANCHOR_GLOBAL)
Geometry.set(controlSize, Geometry.getSize(bestBounds));
return Geometry.getLocation(bestBounds);
}
-
+
/**
* Gets the closest monitor given an anchor and the subject area.
- *
+ *
* @param area the subject area
* @param anchor the anchor
* @return the monitor closest to the edge of <code>area</code> defined by
@@ -1068,7 +1068,7 @@ abstract public class AbstractInformationControlManager {
* Copied from org.eclipse.jface.window.Window. Returns the monitor whose client area contains
* the given point. If no monitor contains the point, returns the monitor that is closest to the
* point. If this is ever made public, it should be moved into a separate utility class.
- *
+ *
* @param display the display to search for monitors
* @param rectangle the rectangle to find the closest monitor for (display coordinates)
* @return the monitor closest to the given point
@@ -1150,7 +1150,7 @@ abstract public class AbstractInformationControlManager {
((InformationControlReplacer) this).showInformationControl(subjectArea, information);
return;
}
-
+
IInformationControl informationControl= getInformationControl();
if (informationControl != null) {
@@ -1203,14 +1203,14 @@ abstract public class AbstractInformationControlManager {
size= Geometry.getSize(controlBounds);
informationControl.setLocation(location);
informationControl.setSize(size.x, size.y);
-
+
showInformationControl(subjectArea);
}
}
/**
* Crops the given bounds such that they lie completely on the closest monitor.
- *
+ *
* @param bounds shell bounds to crop
* @since 3.4
*/
@@ -1251,7 +1251,7 @@ abstract public class AbstractInformationControlManager {
* Replaces this manager's information control as defined by
* the information control replacer.
* <strong>Must only be called when {@link #fInformationControl} instanceof {@link IInformationControlExtension3}!</strong>
- *
+ *
* @param takeFocus <code>true</code> iff the replacing information control should take focus
*
* @since 3.4
@@ -1267,7 +1267,7 @@ abstract public class AbstractInformationControlManager {
}
hideInformationControl();
}
-
+
/**
* Disposes this manager's information control.
*/
@@ -1289,12 +1289,12 @@ abstract public class AbstractInformationControlManager {
setEnabled(false);
disposeInformationControl();
-
+
if (fInformationControlReplacer != null) {
fInformationControlReplacer.dispose();
fInformationControlReplacer= null;
}
-
+
if (fSubjectControl != null && !fSubjectControl.isDisposed() && fSubjectControlDisposeListener != null)
fSubjectControl.removeDisposeListener(fSubjectControlDisposeListener);
fSubjectControl= null;
@@ -1420,7 +1420,7 @@ abstract public class AbstractInformationControlManager {
* Returns an adapter that gives access to internal methods.
* <p>
* <strong>Note:</strong> This method is not intended to be referenced or overridden by clients.</p>
- *
+ *
* @return the replaceable information control accessor
* @since 3.4
* @noreference This method is not intended to be referenced by clients.
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractReusableInformationControlCreator.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractReusableInformationControlCreator.java
index c5a0ac3647d..435cb6f54de 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractReusableInformationControlCreator.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractReusableInformationControlCreator.java
@@ -21,7 +21,7 @@ import org.eclipse.swt.widgets.Shell;
/**
* Abstract class for a reusable information control creators.
- *
+ *
* @since 3.3
*/
public abstract class AbstractReusableInformationControlCreator implements IInformationControlCreator, IInformationControlCreatorExtension, DisposeListener {
@@ -30,7 +30,7 @@ public abstract class AbstractReusableInformationControlCreator implements IInfo
/**
* Creates the control.
- *
+ *
* @param parent the parent shell
* @return the created information control
*/
@@ -45,10 +45,10 @@ public abstract class AbstractReusableInformationControlCreator implements IInfo
control= doCreateInformationControl(parent);
control.addDisposeListener(this);
fInformationControls.put(parent, control);
- }
+ }
return control;
}
-
+
/*
* @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
*/
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
index 7e45271e24b..14242aa61b0 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/CursorLinePainter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/CursorLinePainter.java
@@ -18,12 +18,6 @@ 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.ITextViewerExtension5;
-import org.eclipse.jface.text.Position;
-
/**
* A painter the draws the background of the caret line in a configured color.
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
index 5807e5b86c8..90ea2835287 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java
@@ -66,17 +66,17 @@ public class DefaultInformationControl extends AbstractInformationControl implem
*/
String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight);
}
-
-
+
+
/**
* An information presenter determines the style presentation
* of information displayed in the default information control.
* The interface can be implemented by clients.
- *
+ *
* @since 3.2
*/
public interface IInformationPresenterExtension {
-
+
/**
* Updates the given presentation of the given information and
* thereby may manipulate the information to be displayed. The manipulation
@@ -98,7 +98,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
*/
String updatePresentation(Drawable drawable, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight);
}
-
+
/**
* Inner border thickness in pixels.
@@ -112,7 +112,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
private final IInformationPresenter fPresenter;
/** A cached text presentation */
private final TextPresentation fPresentation= new TextPresentation();
-
+
/**
* Additional styles to use for the text control.
* @since 3.4, previously called <code>fTextStyle</code>
@@ -122,7 +122,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
/**
* Creates a default information control with the given shell as parent. An information
* presenter that can handle simple HTML is used to process the information to be displayed.
- *
+ *
* @param parent the parent shell
* @param isResizeable <code>true</code> if the control should be resizable
* @since 3.4
@@ -137,7 +137,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
/**
* Creates a default information control with the given shell as parent. An information
* presenter that can handle simple HTML is used to process the information to be displayed.
- *
+ *
* @param parent the parent shell
* @param statusFieldText the text to be used in the status field or <code>null</code> to hide the status field
* @since 3.4
@@ -150,7 +150,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
* Creates a default information control with the given shell as parent. The
* given information presenter is used to process the information to be
* displayed.
- *
+ *
* @param parent the parent shell
* @param statusFieldText the text to be used in the status field or <code>null</code> to hide the status field
* @param presenter the presenter to be used, or <code>null</code> if no presenter should be used
@@ -167,7 +167,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
* Creates a resizable default information control with the given shell as parent. An
* information presenter that can handle simple HTML is used to process the information to be
* displayed.
- *
+ *
* @param parent the parent shell
* @param toolBarManager the manager or <code>null</code> if toolbar is not desired
* @since 3.4
@@ -180,7 +180,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
* Creates a resizable default information control with the given shell as
* parent. The given information presenter is used to process the
* information to be displayed.
- *
+ *
* @param parent the parent shell
* @param toolBarManager the manager or <code>null</code> if toolbar is not desired
* @param presenter the presenter to be used, or <code>null</code> if no presenter should be used
@@ -220,7 +220,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
* 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
@@ -236,7 +236,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
* given information presenter is used to process the information to be
* displayed. The given styles are applied to the created styled text
* widget.
- *
+ *
* @param parentShell the parent shell
* @param shellStyle the additional styles for the shell
* @param style the additional styles for the styled text widget
@@ -256,7 +256,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
* Creates a default information control with the given shell as parent. The
* given information presenter is used to process the information to be
* displayed.
- *
+ *
* @param parent the parent shell
* @param textStyles the additional styles for the styled text widget
* @param presenter the presenter to be used
@@ -270,7 +270,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
* Creates a default information control with the given shell as parent. The
* given information presenter is used to process the information to be
* displayed.
- *
+ *
* @param parent the parent shell
* @param textStyles the additional styles for the styled text widget
* @param presenter the presenter to be used
@@ -295,14 +295,14 @@ public class DefaultInformationControl extends AbstractInformationControl implem
fText.setFont(JFaceResources.getDialogFont());
FillLayout layout= (FillLayout)parent.getLayout();
if (fText.getWordWrap()) {
- // indent does not work for wrapping StyledText, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56342 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=115432
+ // indent does not work for wrapping StyledText, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56342 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=115432
layout.marginHeight= INNER_BORDER;
layout.marginWidth= INNER_BORDER;
} else {
fText.setIndent(INNER_BORDER);
}
}
-
+
/*
* @see IInformationControl#setInformation(String)
*/
@@ -311,7 +311,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
fText.setText(content);
} else {
fPresentation.clear();
-
+
int maxWidth= -1;
int maxHeight= -1;
Point constraints= getSizeConstraints();
@@ -331,7 +331,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
}
if (isResizable())
maxHeight= Integer.MAX_VALUE;
-
+
if (fPresenter instanceof IInformationPresenterExtension)
content= ((IInformationPresenterExtension)fPresenter).updatePresentation(fText, content, fPresentation, maxWidth, maxHeight);
else
@@ -359,7 +359,7 @@ public class DefaultInformationControl extends AbstractInformationControl implem
setSize(currentSize.x, currentSize.y); // restore previous size
}
}
-
+
super.setVisible(visible);
}
@@ -372,10 +372,10 @@ public class DefaultInformationControl extends AbstractInformationControl implem
Point constraints= getSizeConstraints();
if (constraints != null && fText.getWordWrap())
widthHint= constraints.x;
-
+
return getShell().computeSize(widthHint, SWT.DEFAULT, true);
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControl#computeTrim()
*/
@@ -428,5 +428,5 @@ public class DefaultInformationControl extends AbstractInformationControl implem
}
};
}
-
+
}
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
index 41344e9489a..d5ba81db325 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java
@@ -11,9 +11,10 @@
package org.eclipse.jface.text;
-import com.ibm.icu.text.BreakIterator;
import java.text.CharacterIterator;
+import com.ibm.icu.text.BreakIterator;
+
/**
* Standard implementation of
* {@link org.eclipse.jface.text.ITextDoubleClickStrategy}.
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextHover.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextHover.java
index 9996154d2cd..612fd20fbff 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextHover.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextHover.java
@@ -21,7 +21,7 @@ import org.eclipse.jface.text.source.ISourceViewerExtension2;
/**
* Standard implementation of {@link org.eclipse.jface.text.ITextHover}.
- *
+ *
* @since 3.2
*/
public class DefaultTextHover implements ITextHover {
@@ -31,24 +31,24 @@ public class DefaultTextHover implements ITextHover {
/**
* Creates a new annotation hover.
- *
+ *
* @param sourceViewer this hover's annotation model
*/
public DefaultTextHover(ISourceViewer sourceViewer) {
Assert.isNotNull(sourceViewer);
fSourceViewer= sourceViewer;
}
-
+
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.4, replaced by {@link ITextHoverExtension2#getHoverInfo2(ITextViewer, IRegion)}
*/
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
IAnnotationModel model= getAnnotationModel(fSourceViewer);
if (model == null)
return null;
-
+
Iterator e= model.getAnnotationIterator();
while (e.hasNext()) {
Annotation a= (Annotation) e.next();
@@ -61,7 +61,7 @@ public class DefaultTextHover implements ITextHover {
}
}
}
-
+
return null;
}
@@ -71,18 +71,18 @@ public class DefaultTextHover implements ITextHover {
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
return findWord(textViewer.getDocument(), offset);
}
-
+
/**
* Tells whether the annotation should be included in
* the computation.
- *
+ *
* @param annotation the annotation to test
* @return <code>true</code> if the annotation is included in the computation
*/
protected boolean isIncluded(Annotation annotation) {
return true;
}
-
+
private IAnnotationModel getAnnotationModel(ISourceViewer viewer) {
if (viewer instanceof ISourceViewerExtension2) {
ISourceViewerExtension2 extension= (ISourceViewerExtension2) viewer;
@@ -90,7 +90,7 @@ public class DefaultTextHover implements ITextHover {
}
return viewer.getAnnotationModel();
}
-
+
private IRegion findWord(IDocument document, int offset) {
int start= -2;
int end= -1;
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
index 8109f796772..bd24a6cefa7 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java
@@ -158,24 +158,24 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
* @since 3.1
*/
public boolean canUndo() {
-
+
if (isConnected() && isValid()) {
IDocument doc= fTextViewer.getDocument();
if (doc instanceof IDocumentExtension4) {
long docStamp= ((IDocumentExtension4)doc).getModificationStamp();
-
+
// Normal case: an undo is valid if its redo will restore document
// to its current modification stamp
- boolean canUndo= docStamp == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP ||
+ boolean canUndo= docStamp == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP ||
docStamp == getRedoModificationStamp();
-
- /* Special case to check if the answer is false.
+
+ /* Special case to check if the answer is false.
* If the last document change was empty, then the document's
- * modification stamp was incremented but nothing was committed.
+ * modification stamp was incremented but nothing was committed.
* The operation being queried has an older stamp. In this case only,
* the comparison is different. A sequence of document changes that
* include an empty change is handled correctly when a valid commit
- * follows the empty change, but when #canUndo() is queried just after
+ * follows the empty change, but when #canUndo() is queried just after
* an empty change, we must special case the check. The check is very
* specific to prevent false positives.
* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=98245
@@ -186,14 +186,14 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
!fCurrent.isValid() && // the current operation is not a valid document modification
fCurrent.fUndoModificationStamp != // the invalid current operation has a document stamp
IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP) {
- canUndo= fCurrent.fRedoModificationStamp == docStamp;
+ canUndo= fCurrent.fRedoModificationStamp == docStamp;
}
/*
- * When the composite is the current command, it may hold the timestamp
- * of a no-op change. We check this here rather than in an override of
+ * When the composite is the current command, it may hold the timestamp
+ * of a no-op change. We check this here rather than in an override of
* canUndo() in CompoundTextCommand simply to keep all the special case checks
* in one place.
- */
+ */
if (!canUndo &&
this == fHistory.getUndoOperation(fUndoContext) && // this is the latest operation
this instanceof CompoundTextCommand &&
@@ -219,7 +219,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
IDocument doc= fTextViewer.getDocument();
if (doc instanceof IDocumentExtension4) {
long docStamp= ((IDocumentExtension4)doc).getModificationStamp();
- return docStamp == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP ||
+ return docStamp == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP ||
docStamp == getUndoModificationStamp();
}
// if there is no timestamp to check, simply return true per the 3.0.1 behavior
@@ -267,7 +267,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
}
return IOperationHistory.OPERATION_INVALID_STATUS;
}
-
+
/**
* Re-applies the change described by this command.
*
@@ -354,11 +354,11 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
fPreservedText= fPreservedTextBuffer.toString();
}
}
-
+
/**
* Attempt a commit of this command and answer true if a new
* fCurrent was created as a result of the commit.
- *
+ *
* @return true if the command was committed and created a
* new fCurrent, false if not.
* @since 3.1
@@ -412,20 +412,20 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
text.append('\'');
return text.toString();
}
-
+
/**
* Return the undo modification stamp
- *
+ *
* @return the undo modification stamp for this command
* @since 3.1
*/
protected long getUndoModificationStamp() {
return fUndoModificationStamp;
}
-
+
/**
* Return the redo modification stamp
- *
+ *
* @return the redo modification stamp for this command
* @since 3.1
*/
@@ -467,7 +467,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
*/
public IStatus undo(IProgressMonitor monitor, IAdaptable uiInfo) {
resetProcessChangeSate();
-
+
int size= fCommands.size();
if (size > 0) {
@@ -564,10 +564,10 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
return (fStart > -1 || fCommands.size() > 0);
return false;
}
-
+
/**
* Returns the undo modification stamp.
- *
+ *
* @return the undo modification stamp
* @since 3.1
*/
@@ -579,10 +579,10 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
return fUndoModificationStamp;
}
-
+
/**
* Returns the redo modification stamp.
- *
+ *
* @return the redo modification stamp
* @since 3.1
*/
@@ -747,7 +747,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
if (fTextViewer instanceof TextViewer)
((TextViewer)fTextViewer).ignoreAutoEditStrategies(true);
listenToTextChanges(false);
-
+
// in the undo case only, make sure compounds are closed
if (type == OperationHistoryEvent.ABOUT_TO_UNDO) {
if (fFoldingIntoCompoundChange) {
@@ -755,9 +755,9 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
}
}
} else {
- // the undo or redo has our context, but it is not one of
+ // the undo or redo has our context, but it is not one of
// our commands. We will listen to the changes, but will
- // reset the state that tracks the undo/redo history.
+ // reset the state that tracks the undo/redo history.
commit();
fLastAddedCommand= null;
}
@@ -986,10 +986,10 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
}
fCurrent.commit();
}
-
+
/**
* Reset processChange state.
- *
+ *
* @since 3.2
*/
private void resetProcessChangeSate() {
@@ -1036,7 +1036,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
int length= insertedText.length();
int diff= modelEnd - modelStart;
-
+
if (fCurrent.fUndoModificationStamp == IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP)
fCurrent.fUndoModificationStamp= beforeChangeModificationStamp;
@@ -1055,7 +1055,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
fCurrent.fRedoModificationStamp= beforeChangeModificationStamp;
if (fCurrent.attemptCommit())
fCurrent.fUndoModificationStamp= beforeChangeModificationStamp;
-
+
fInserting= true;
}
if (fCurrent.fStart < 0)
@@ -1159,7 +1159,7 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
// because of typing or pasting whereby selection is not empty
fCurrent.fRedoModificationStamp= beforeChangeModificationStamp;
if (fCurrent.attemptCommit())
- fCurrent.fUndoModificationStamp= beforeChangeModificationStamp;
+ fCurrent.fUndoModificationStamp= beforeChangeModificationStamp;
fCurrent.fStart= modelStart;
fCurrent.fEnd= modelEnd;
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapterContentProposalProvider.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapterContentProposalProvider.java
index bfe8f9bb3c4..e0dff953c5c 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapterContentProposalProvider.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapterContentProposalProvider.java
@@ -33,43 +33,43 @@ import org.eclipse.jface.fieldassist.IContentProposalProvider;
*/
public class FindReplaceDocumentAdapterContentProposalProvider implements IContentProposalProvider {
-
+
/**
* Proposal computer.
*/
private static class ProposalComputer {
private static class Proposal implements IContentProposal {
-
+
private String fContent;
private String fLabel;
private String fDescription;
private int fCursorPosition;
-
+
Proposal(String content, String label, String description, int cursorPosition) {
fContent= content;
fLabel= label;
fDescription= description;
fCursorPosition= cursorPosition;
}
-
+
public String getContent() {
return fContent;
}
-
+
public String getLabel() {
return fLabel;
}
-
+
public String getDescription() {
return fDescription;
}
-
+
public int getCursorPosition() {
return fCursorPosition;
}
}
-
+
/**
* The whole regular expression.
@@ -102,7 +102,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
fDocumentOffset= position;
fPriorityProposals= new ArrayList();
fProposals= new ArrayList();
-
+
boolean isEscape= false;
esc: for (int i= position - 1; i >= 0; i--) {
if (fExpression.charAt(i) == '\\')
@@ -131,7 +131,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
addBsProposal("\\a", RegExMessages.getString("displayString_bs_a"), RegExMessages.getString("additionalInfo_bs_a")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBsProposal("\\e", RegExMessages.getString("displayString_bs_e"), RegExMessages.getString("additionalInfo_bs_e")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("\\c", 2, RegExMessages.getString("displayString_bs_c"), RegExMessages.getString("additionalInfo_bs_c")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
if (! fIsEscape)
addBracketProposal(".", 1, RegExMessages.getString("displayString_dot"), RegExMessages.getString("additionalInfo_dot")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBsProposal("\\d", RegExMessages.getString("displayString_bs_d"), RegExMessages.getString("additionalInfo_bs_d")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -140,15 +140,15 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
addBsProposal("\\S", RegExMessages.getString("displayString_bs_S"), RegExMessages.getString("additionalInfo_bs_S")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBsProposal("\\w", RegExMessages.getString("displayString_bs_w"), RegExMessages.getString("additionalInfo_bs_w")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBsProposal("\\W", RegExMessages.getString("displayString_bs_W"), RegExMessages.getString("additionalInfo_bs_W")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
// back reference
addBsProposal("\\", RegExMessages.getString("displayString_bs_i"), RegExMessages.getString("additionalInfo_bs_i")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
//quoting
addBsProposal("\\", RegExMessages.getString("displayString_bs"), RegExMessages.getString("additionalInfo_bs")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBsProposal("\\Q", RegExMessages.getString("displayString_bs_Q"), RegExMessages.getString("additionalInfo_bs_Q")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBsProposal("\\E", RegExMessages.getString("displayString_bs_E"), RegExMessages.getString("additionalInfo_bs_E")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
//character sets
if (! fIsEscape) {
addBracketProposal("[]", 1, RegExMessages.getString("displayString_set"), RegExMessages.getString("additionalInfo_set")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -163,7 +163,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
addBracketProposal("\\p{}", 3, RegExMessages.getString("displayString_posix"), RegExMessages.getString("additionalInfo_posix")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("\\P{}", 3, RegExMessages.getString("displayString_posixNot"), RegExMessages.getString("additionalInfo_posixNot")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
-
+
//boundary matchers
if (fDocumentOffset == 0) {
addPriorityProposal("^", RegExMessages.getString("displayString_start"), RegExMessages.getString("additionalInfo_start")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -179,25 +179,25 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
addBsProposal("\\G", RegExMessages.getString("displayString_bs_G"), RegExMessages.getString("additionalInfo_bs_G")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBsProposal("\\Z", RegExMessages.getString("displayString_bs_Z"), RegExMessages.getString("additionalInfo_bs_Z")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBsProposal("\\z", RegExMessages.getString("displayString_bs_z"), RegExMessages.getString("additionalInfo_bs_z")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
if (! fIsEscape) {
//capturing groups
addBracketProposal("()", 1, RegExMessages.getString("displayString_group"), RegExMessages.getString("additionalInfo_group")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
//flags
addBracketProposal("(?)", 2, RegExMessages.getString("displayString_flag"), RegExMessages.getString("additionalInfo_flag")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("(?:)", 3, RegExMessages.getString("displayString_flagExpr"), RegExMessages.getString("additionalInfo_flagExpr")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
//non-capturing group
addBracketProposal("(?:)", 3, RegExMessages.getString("displayString_nonCap"), RegExMessages.getString("additionalInfo_nonCap")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("(?>)", 3, RegExMessages.getString("displayString_atomicCap"), RegExMessages.getString("additionalInfo_atomicCap")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
//look around
addBracketProposal("(?=)", 3, RegExMessages.getString("displayString_posLookahead"), RegExMessages.getString("additionalInfo_posLookahead")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("(?!)", 3, RegExMessages.getString("displayString_negLookahead"), RegExMessages.getString("additionalInfo_negLookahead")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("(?<=)", 4, RegExMessages.getString("displayString_posLookbehind"), RegExMessages.getString("additionalInfo_posLookbehind")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("(?<!)", 4, RegExMessages.getString("displayString_negLookbehind"), RegExMessages.getString("additionalInfo_negLookbehind")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
//greedy quantifiers
addBracketProposal("?", 1, RegExMessages.getString("displayString_quest"), RegExMessages.getString("additionalInfo_quest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("*", 1, RegExMessages.getString("displayString_star"), RegExMessages.getString("additionalInfo_star")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -205,7 +205,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
addBracketProposal("{}", 1, RegExMessages.getString("displayString_exact"), RegExMessages.getString("additionalInfo_exact")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("{,}", 1, RegExMessages.getString("displayString_least"), RegExMessages.getString("additionalInfo_least")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("{,}", 1, RegExMessages.getString("displayString_count"), RegExMessages.getString("additionalInfo_count")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
//lazy quantifiers
addBracketProposal("??", 1, RegExMessages.getString("displayString_questLazy"), RegExMessages.getString("additionalInfo_questLazy")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("*?", 1, RegExMessages.getString("displayString_starLazy"), RegExMessages.getString("additionalInfo_starLazy")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -213,7 +213,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
addBracketProposal("{}?", 1, RegExMessages.getString("displayString_exactLazy"), RegExMessages.getString("additionalInfo_exactLazy")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("{,}?", 1, RegExMessages.getString("displayString_leastLazy"), RegExMessages.getString("additionalInfo_leastLazy")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("{,}?", 1, RegExMessages.getString("displayString_countLazy"), RegExMessages.getString("additionalInfo_countLazy")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
//possessive quantifiers
addBracketProposal("?+", 1, RegExMessages.getString("displayString_questPoss"), RegExMessages.getString("additionalInfo_questPoss")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("*+", 1, RegExMessages.getString("displayString_starPoss"), RegExMessages.getString("additionalInfo_starPoss")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -221,11 +221,11 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
addBracketProposal("{}+", 1, RegExMessages.getString("displayString_exactPoss"), RegExMessages.getString("additionalInfo_exactPoss")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("{,}+", 1, RegExMessages.getString("displayString_leastPoss"), RegExMessages.getString("additionalInfo_leastPoss")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addBracketProposal("{,}+", 1, RegExMessages.getString("displayString_countPoss"), RegExMessages.getString("additionalInfo_countPoss")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
//alternative
addBracketProposal("|", 1, RegExMessages.getString("displayString_alt"), RegExMessages.getString("additionalInfo_alt")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
-
+
fPriorityProposals.addAll(fProposals);
return (IContentProposal[]) fPriorityProposals.toArray(new IContentProposal[fProposals.size()]);
}
@@ -257,10 +257,10 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
fPriorityProposals.addAll(fProposals);
return (IContentProposal[]) fPriorityProposals.toArray(new IContentProposal[fPriorityProposals.size()]);
}
-
+
/**
* Adds a proposal.
- *
+ *
* @param proposal the string to be inserted
* @param displayString the proposal's label
* @param additionalInfo the additional information
@@ -271,7 +271,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
/**
* Adds a proposal.
- *
+ *
* @param proposal the string to be inserted
* @param cursorPosition the cursor position after insertion,
* relative to the start of the proposal
@@ -284,7 +284,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
/**
* Adds a proposal to the priority proposals list.
- *
+ *
* @param proposal the string to be inserted
* @param displayString the proposal's label
* @param additionalInfo the additional information
@@ -292,10 +292,10 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
private void addPriorityProposal(String proposal, String displayString, String additionalInfo) {
fPriorityProposals.add(new Proposal(proposal, displayString, additionalInfo, proposal.length()));
}
-
+
/**
* Adds a proposal. Ensures that existing pre- and postfixes are not duplicated.
- *
+ *
* @param proposal the string to be inserted
* @param cursorPosition the cursor position after insertion,
* relative to the start of the proposal
@@ -327,7 +327,7 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
/**
* Adds a proposal that starts with a backslash.
* Ensures that the backslash is not repeated if already typed.
- *
+ *
* @param proposal the string to be inserted
* @param displayString the proposal's label
* @param additionalInfo the additional information
@@ -348,17 +348,17 @@ public class FindReplaceDocumentAdapterContentProposalProvider implements IConte
}
}
}
-
+
/**
* <code>true</code> iff the processor is for the find field.
* <code>false</code> iff the processor is for the replace field.
*/
private final boolean fIsFind;
-
+
/**
* Creates a new completion proposal provider.
- *
+ *
* @param isFind <code>true</code> if the provider is used for the 'find' field
* <code>false</code> if the provider is used for the 'replace' field
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IDelayedInputChangeProvider.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IDelayedInputChangeProvider.java
index 8856338b19e..d1a62c08897 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IDelayedInputChangeProvider.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IDelayedInputChangeProvider.java
@@ -17,14 +17,14 @@ package org.eclipse.jface.text;
* operation of the provider.
* <p>
* Clients can implement that interface and its extension interfaces.</p>
- *
+ *
* @since 3.4
*/
public interface IDelayedInputChangeProvider {
/**
* Sets or clears the delayed input change listener.
- *
+ *
* @param inputChangeListener the new delayed input change listener, or
* <code>null</code> if none
* @since 3.4
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IEditingSupportRegistry.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IEditingSupportRegistry.java
index 5dd6b3ecee4..fd12e991e81 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IEditingSupportRegistry.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IEditingSupportRegistry.java
@@ -15,7 +15,7 @@ package org.eclipse.jface.text;
* <p>
* This interface is not meant to be implemented outside the JFace text
* framework.</p>
- *
+ *
* @see IEditingSupport
* @since 3.1
* @noimplement This interface is not intended to be implemented by clients.
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
index 432856bff44..999aefa0821 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControl.java
@@ -106,7 +106,7 @@ public interface IInformationControl {
* <strong>Note:</strong> The information control must not grab focus when
* made visible.
* </p>
- *
+ *
* @param visible <code>true</code> if the control should be visible
*/
void setVisible(boolean visible);
@@ -184,7 +184,7 @@ public interface IInformationControl {
* encouraged to subclass {@link AbstractInformationControl}, which does this
* for free.
* </p>
- *
+ *
* @param listener the listener to be added
*/
void addFocusListener(FocusListener listener);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java
index 61207ea6392..502284a07f5 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java
@@ -47,7 +47,7 @@ public interface IInformationControlExtension3 {
* information control's actual content area. It includes all borders of the
* control and other static content placed around the content area (e.g. a
* toolbar).
- *
+ *
* @return The receiver's trim. <code>x</code> and <code>y</code> denote
* the upper left corner of the trimming relative to this control's
* location i.e. this will most likely be negative values.
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension4.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension4.java
index 1100a226ba1..196fd8574af 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension4.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension4.java
@@ -26,7 +26,7 @@ public interface IInformationControlExtension4 {
* The implementor can specify whether the new text affects an
* already visible information control.
* </p>
- *
+ *
* @param statusFieldText the text to be used in the optional status field
* or <code>null</code> if the status field should be hidden
* @since 3.2
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension5.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension5.java
index 708a5491ba1..515098d94a9 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension5.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension5.java
@@ -26,12 +26,12 @@ import org.eclipse.jface.resource.JFaceResources;
* <li>to compute size constraints based on the information control's main font and</li>
* <li>to return a control creator for an enriched version of this information control.</li>
* </ul>
- *
+ *
* <p>
* <b>Important:</b> Enriching this information control only works properly if
* {@link IInformationControl#isFocusControl()} is implemented like this (<code>fShell</code>
* is the control's shell):
- *
+ *
* <pre>
* return fShell.getDisplay().getActiveShell() == fShell
* </pre>
@@ -42,7 +42,7 @@ import org.eclipse.jface.resource.JFaceResources;
* encouraged to subclass {@link AbstractInformationControl}, which does this
* for free.
* </p>
- *
+ *
* @see org.eclipse.jface.text.IInformationControl
* @since 3.4
*/
@@ -51,32 +51,32 @@ public interface IInformationControlExtension5 {
/**
* Tests whether the given control is this information control
* or a child of this information control.
- *
+ *
* @param control the control to test
* @return <code>true</code> iff the given control is this information control
* or a child of this information control
*/
public boolean containsControl(Control control);
-
+
/**
* @return <code>true</code> iff the information control is currently visible
*/
public abstract boolean isVisible();
-
+
/**
* Computes the width- and height constraints of the information control in
* pixels, based on the given width and height in characters. Implementors
* should use the main font of the information control to do the
* characters-to-pixels conversion. This is typically the
* {@link JFaceResources#getDialogFont() dialog font}.
- *
+ *
* @param widthInChars the width constraint in number of characters
* @param heightInChars the height constraint in number of characters
* @return a point with width and height in pixels, or <code>null</code>
* to use the subject control's font to calculate the size
*/
public Point computeSizeConstraints(int widthInChars, int heightInChars);
-
+
/**
* Returns the rich information control creator for this information control.
* <p>
@@ -103,5 +103,5 @@ public interface IInformationControlExtension5 {
* @return the information presenter control creator or <code>null</code> to disable enriching
*/
IInformationControlCreator getInformationPresenterControlCreator();
-
+
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInputChangedListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInputChangedListener.java
index 371cf0f9e96..472910b9a03 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInputChangedListener.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInputChangedListener.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -22,7 +22,7 @@ public interface IInputChangedListener {
/**
* Called when a the input has changed.
- *
+ *
* @param newInput the new input, or <code>null</code> iff the listener should not show any new input
*/
void inputChanged(Object newInput);
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
index e11989e4d0c..314c381a878 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IPaintPositionManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IPaintPositionManager.java
@@ -11,7 +11,6 @@
package org.eclipse.jface.text;
-import org.eclipse.jface.text.Position;
/**
* Manages and updates positions used by {@link IPainter}s.
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ISelectionValidator.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ISelectionValidator.java
index 18fc413d98e..267c7d23b9b 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ISelectionValidator.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/ISelectionValidator.java
@@ -31,7 +31,7 @@ public interface ISelectionValidator {
/**
* Tests whether the given post selection is still valid.
- *
+ *
* @param selection the selection
* @return <code>true</code> if the selection is still valid
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHoverExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHoverExtension2.java
index 3c864943e7a..148ffc41238 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHoverExtension2.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextHoverExtension2.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -16,7 +16,7 @@ package org.eclipse.jface.text;
* <p>
* Provides a way for hovers to return hover-specific information objects.
* </p>
- *
+ *
* @see org.eclipse.jface.text.ITextHover
* @since 3.4
*/
@@ -42,5 +42,5 @@ public interface ITextHoverExtension2 {
* @return the hover popup display information, or <code>null</code> if none available
*/
Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion);
-
+
}
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
index 34287137c49..2d45db112be 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewer.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewer.java
@@ -464,7 +464,7 @@ public interface ITextViewer {
/**
* Sets the selection to the specified range.
- *
+ *
* @param offset the offset of the selection range
* @param length the length of the selection range. A negative length places
* the caret at the visual start of the selection.
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension7.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension7.java
index e8dda3a87d8..8edd2f1d510 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension7.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension7.java
@@ -21,7 +21,7 @@ public interface ITextViewerExtension7 {
/**
* Sets an auto edit strategy can converts tabs to spaces.
- *
+ *
* @param converter the converter or <code>null</code> if none should be used
*/
void setTabsToSpacesConverter(IAutoEditStrategy converter);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension8.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension8.java
index 782f349dc37..9288ac9919f 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension8.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension8.java
@@ -16,14 +16,14 @@ import org.eclipse.swt.custom.StyledTextPrintOptions;
/**
* Extension interface for {@link org.eclipse.jface.text.ITextViewer}. Adds the
* ability to print and set how hovers should be enriched when the mouse is moved into them.
- *
+ *
* @since 3.4
*/
public interface ITextViewerExtension8 {
-
+
/**
* Print the text viewer contents using the given options.
- *
+ *
* @param options the print options
*/
void print(StyledTextPrintOptions options);
@@ -38,12 +38,12 @@ public interface ITextViewerExtension8 {
* Note that a hover can only be enriched if its {@link IInformationControlExtension5#getInformationPresenterControlCreator()}
* is not <code>null</code>.
* </p>
- *
+ *
* @param mode the enrich mode, or <code>null</code>
*/
void setHoverEnrichMode(EnrichMode mode);
-
-
+
+
/**
* Type-safe enum of the available enrich modes.
*/
@@ -52,26 +52,26 @@ public interface ITextViewerExtension8 {
/**
* Enrich the hover shortly after the mouse has been moved into it and
* stopped moving.
- *
+ *
* @see ITextViewerExtension8#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode)
*/
public static final EnrichMode AFTER_DELAY= new EnrichMode("after delay"); //$NON-NLS-1$
/**
* Enrich the hover immediately when the mouse is moved into it.
- *
+ *
* @see ITextViewerExtension8#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode)
*/
public static final EnrichMode IMMEDIATELY= new EnrichMode("immediately"); //$NON-NLS-1$
/**
* Enrich the hover on explicit mouse click.
- *
+ *
* @see ITextViewerExtension8#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode)
*/
public static final EnrichMode ON_CLICK= new EnrichMode("on click"); //$NON-NLS-1$;
-
+
private String fName;
private EnrichMode(String name) {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java
index 517922726a6..ac76cba97aa 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java
@@ -24,19 +24,19 @@ import org.eclipse.jface.text.source.LineRange;
* <p>
* This class is neither intended to be instantiated nor subclassed.
* </p>
- *
+ *
* @since 3.3
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public final class JFaceTextUtil {
-
+
private JFaceTextUtil() {
// Do not instantiate
}
/**
* Computes the line height for the given line range.
- *
+ *
* @param textWidget the <code>StyledText</code> widget
* @param startLine the start line
* @param endLine the end line (exclusive)
@@ -46,7 +46,7 @@ public final class JFaceTextUtil {
public static int computeLineHeight(StyledText textWidget, int startLine, int endLine, int lineCount) {
return getLinePixel(textWidget, endLine) - getLinePixel(textWidget, startLine);
}
-
+
/**
* Returns the last fully visible line of the widget. The exact semantics of "last fully visible
* line" are:
@@ -54,39 +54,39 @@ public final class JFaceTextUtil {
* <li>the last line of which the last pixel is visible, if any
* <li>otherwise, the only line that is partially visible
* </ul>
- *
+ *
* @param widget the widget
* @return the last fully visible line
*/
public static int getBottomIndex(StyledText widget) {
int lastPixel= computeLastVisiblePixel(widget);
-
+
// bottom is in [0 .. lineCount - 1]
int bottom= widget.getLineIndex(lastPixel);
// bottom is the first line - no more checking
if (bottom == 0)
return bottom;
-
+
int pixel= widget.getLinePixel(bottom);
// bottom starts on or before the client area start - bottom is the only visible line
if (pixel <= 0)
return bottom;
-
+
int offset= widget.getOffsetAtLine(bottom);
int height= widget.getLineHeight(offset);
-
+
// bottom is not showing entirely - use the previous line
if (pixel + height - 1 > lastPixel)
return bottom - 1;
-
+
// bottom is fully visible and its last line is exactly the last pixel
return bottom;
}
/**
* Returns the index of the first (possibly only partially) visible line of the widget
- *
+ *
* @param widget the widget
* @return the index of the first line of which a pixel is visible
*/
@@ -94,7 +94,7 @@ public final class JFaceTextUtil {
// see StyledText#getPartialTopIndex()
int top= widget.getTopIndex();
int pixels= widget.getLinePixel(top);
-
+
// FIXME remove when https://bugs.eclipse.org/bugs/show_bug.cgi?id=123770 is fixed
if (pixels == -widget.getLineHeight(widget.getOffsetAtLine(top))) {
top++;
@@ -103,13 +103,13 @@ public final class JFaceTextUtil {
if (pixels > 0)
top--;
-
+
return top;
}
/**
* Returns the index of the last (possibly only partially) visible line of the widget
- *
+ *
* @param widget the text widget
* @return the index of the last line of which a pixel is visible
*/
@@ -122,7 +122,7 @@ public final class JFaceTextUtil {
/**
* Returns the last visible pixel in the widget's client area.
- *
+ *
* @param widget the widget
* @return the last visible pixel in the widget's client area
*/
@@ -134,11 +134,11 @@ public final class JFaceTextUtil {
// lastPixel -= 4;
return lastPixel;
}
-
+
/**
* Returns the line index of the first visible model line in the viewer. The line may be only
* partially visible.
- *
+ *
* @param viewer the text viewer
* @return the first line of which a pixel is visible, or -1 for no line
*/
@@ -147,7 +147,7 @@ public final class JFaceTextUtil {
int widgetTop= getPartialTopIndex(widget);
return widgetLine2ModelLine(viewer, widgetTop);
}
-
+
/**
* Returns the last, possibly partially, visible line in the view port.
*
@@ -163,7 +163,7 @@ public final class JFaceTextUtil {
/**
* Returns the range of lines that is visible in the viewer, including any partially visible
* lines.
- *
+ *
* @param viewer the viewer
* @return the range of lines that is visible in the viewer, <code>null</code> if no lines are
* visible
@@ -180,7 +180,7 @@ public final class JFaceTextUtil {
* Converts a widget line into a model (i.e. {@link IDocument}) line using the
* {@link ITextViewerExtension5} if available, otherwise by adapting the widget line to the
* viewer's {@link ITextViewer#getVisibleRegion() visible region}.
- *
+ *
* @param viewer the viewer
* @param widgetLine the widget line to convert.
* @return the model line corresponding to <code>widgetLine</code> or -1 to signal that there
@@ -202,12 +202,12 @@ public final class JFaceTextUtil {
}
return modelLine;
}
-
+
/**
* Converts a model (i.e. {@link IDocument}) line into a widget line using the
* {@link ITextViewerExtension5} if available, otherwise by adapting the model line to the
* viewer's {@link ITextViewer#getVisibleRegion() visible region}.
- *
+ *
* @param viewer the viewer
* @param modelLine the model line to convert.
* @return the widget line corresponding to <code>modelLine</code> or -1 to signal that there
@@ -240,7 +240,7 @@ public final class JFaceTextUtil {
/**
* Returns the number of hidden pixels of the first partially visible line. If there is no
* partially visible line, zero is returned.
- *
+ *
* @param textWidget the widget
* @return the number of hidden pixels of the first partial line, always &gt;= 0
*/
@@ -248,14 +248,14 @@ public final class JFaceTextUtil {
int top= getPartialTopIndex(textWidget);
return -textWidget.getLinePixel(top);
}
-
+
/*
* @see StyledText#getLinePixel(int)
*/
public static int getLinePixel(StyledText textWidget, int line) {
return textWidget.getLinePixel(line);
}
-
+
/*
* @see StyledText#getLineIndex(int)
*/
@@ -267,7 +267,7 @@ public final class JFaceTextUtil {
/**
* Returns <code>true</code> if the widget displays the entire contents, i.e. it cannot
* be vertically scrolled.
- *
+ *
* @param widget the widget
* @return <code>true</code> if the widget displays the entire contents, i.e. it cannot
* be vertically scrolled, <code>false</code> otherwise
@@ -275,7 +275,7 @@ public final class JFaceTextUtil {
public static boolean isShowingEntireContents(StyledText widget) {
if (widget.getTopPixel() != 0) // more efficient shortcut
return false;
-
+
int lastVisiblePixel= computeLastVisiblePixel(widget);
int lastPossiblePixel= widget.getLinePixel(widget.getLineCount());
return lastPossiblePixel <= lastVisiblePixel;
@@ -288,7 +288,7 @@ public final class JFaceTextUtil {
* @param region the region whose graphical extend must be computed
* @param textViewer the text viewer containing the region
* @return the graphical extend of the given region in the given viewer
- *
+ *
* @since 3.4
*/
public static Rectangle computeArea(IRegion region, ITextViewer textViewer) {
@@ -299,7 +299,7 @@ public final class JFaceTextUtil {
start= widgetRegion.getOffset();
end= start + widgetRegion.getLength();
}
-
+
StyledText styledText= textViewer.getTextWidget();
Rectangle bounds;
if (end > 0 && start < end)
@@ -308,7 +308,7 @@ public final class JFaceTextUtil {
Point loc= styledText.getLocationAtOffset(start);
bounds= new Rectangle(loc.x, loc.y, getAverageCharWidth(textViewer.getTextWidget()), styledText.getLineHeight(start));
}
-
+
return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height);
}
@@ -319,7 +319,7 @@ public final class JFaceTextUtil {
* @param region the document region
* @param textViewer the viewer containing the region
* @return the corresponding widget region
- *
+ *
* @since 3.4
*/
private static IRegion modelRange2WidgetRange(IRegion region, ITextViewer textViewer) {
@@ -327,22 +327,22 @@ public final class JFaceTextUtil {
ITextViewerExtension5 extension= (ITextViewerExtension5) textViewer;
return extension.modelRange2WidgetRange(region);
}
-
+
IRegion visibleRegion= textViewer.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);
}
/**
* Returns the average character width of the given control's font.
- *
+ *
* @param control the control to calculate the average char width for
* @return the average character width of the controls font
- *
+ *
* @since 3.4
*/
public static int getAverageCharWidth(Control control) {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/RegExMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/RegExMessages.java
index bac5641ddd6..36fc2d08da0 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/RegExMessages.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/RegExMessages.java
@@ -17,11 +17,11 @@ import java.util.ResourceBundle;
/**
* RegEx messages. Helper class to get NLSed messages.
- *
+ *
* @since 3.4
*/
final class RegExMessages {
-
+
private static final String RESOURCE_BUNDLE= RegExMessages.class.getName();
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TabsToSpacesConverter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TabsToSpacesConverter.java
index 7c9ceda8f3a..ea97c64108f 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TabsToSpacesConverter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TabsToSpacesConverter.java
@@ -17,7 +17,7 @@ package org.eclipse.jface.text;
* Clients usually instantiate and configure this class but
* can also extend it in their own subclass.
* </p>
- *
+ *
* @since 3.3
*/
public class TabsToSpacesConverter implements IAutoEditStrategy {
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
index 8d08448a21c..a4a255fce11 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextAttribute.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextAttribute.java
@@ -47,7 +47,7 @@ public class TextAttribute {
/** The text style */
private int style;
-
+
/**
* The text font.
* @since 3.3
@@ -72,7 +72,7 @@ public class TextAttribute {
this.background= background;
this.style= style;
}
-
+
/**
* Creates a text attribute with the given colors and style.
*
@@ -110,7 +110,7 @@ public class TextAttribute {
if (!(object instanceof TextAttribute))
return false;
TextAttribute a= (TextAttribute)object;
-
+
return (a.style == style && equals(a.foreground, foreground) && equals(a.background, background) && equals(a.font, font));
}
@@ -169,7 +169,7 @@ public class TextAttribute {
public int getStyle() {
return style;
}
-
+
/**
* Returns the attribute's font.
*
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
index 7c4dab62ae9..b219368c44c 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextPresentation.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextPresentation.java
@@ -439,19 +439,19 @@ public class TextPresentation {
if (template.font != null)
target.font= template.font;
target.fontStyle|= template.fontStyle;
-
+
if (template.metrics != null)
target.metrics= template.metrics;
-
+
if (template.foreground != null)
target.foreground= template.foreground;
if (template.background != null)
target.background= template.background;
-
+
target.strikeout|= template.strikeout;
if (template.strikeoutColor != null)
target.strikeoutColor= template.strikeoutColor;
-
+
target.underline|= template.underline;
if (template.underlineStyle != SWT.NONE)
target.underlineStyle= template.underlineStyle;
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
index ebceff9a145..a4ee096e71d 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
@@ -120,7 +120,7 @@ public class TextViewer extends Viewer implements
* @since 3.4
*/
private static final int TEXT_HOVER_HEIGHT_CHARS= 12; //used to be 10 (text font)
-
+
/**
* Represents a replace command that brings the text viewer's text widget
* back in synchronization with text viewer's document after the document
@@ -200,12 +200,12 @@ public class TextViewer extends Viewer implements
public void getNextOffset(MovementEvent event) {
if (event.movement != SWT.MOVEMENT_WORD_END)
return;
-
+
if (TRACE_DOUBLE_CLICK) {
System.out.println("\n+++"); //$NON-NLS-1$
print(event);
}
-
+
if (fDoubleClickSelection != null) {
if (fDoubleClickSelection.x <= event.offset && event.offset <= fDoubleClickSelection.y)
event.newOffset= fDoubleClickSelection.y;
@@ -219,7 +219,7 @@ public class TextViewer extends Viewer implements
public void getPreviousOffset(MovementEvent event) {
if (event.movement != SWT.MOVEMENT_WORD_START)
return;
-
+
if (TRACE_DOUBLE_CLICK) {
System.out.println("\n---"); //$NON-NLS-1$
print(event);
@@ -243,7 +243,7 @@ public class TextViewer extends Viewer implements
/**
* Print trace info about <code>MovementEvent</code>.
- *
+ *
* @param e the event to print
* @since 3.3
*/
@@ -1104,7 +1104,7 @@ public class TextViewer extends Viewer implements
fStateMask= stateMask;
}
}
-
+
/**
* Captures and remembers the viewer state (selection and visual position). {@link TextViewer.ViewerState}
* instances are normally used once and then discarded, similar to the following snippet:
@@ -1113,7 +1113,7 @@ public class TextViewer extends Viewer implements
* doStuff(); // operation that may call setRedraw() and perform complex document modifications
* state.restore(true); // restore the remembered state
* </pre>
- *
+ *
* @since 3.3
*/
private final class ViewerState {
@@ -1146,7 +1146,7 @@ public class TextViewer extends Viewer implements
/**
* Returns the normalized selection, i.e. the the selection length is always non-negative.
- *
+ *
* @return the normalized selection
*/
public Point getSelection() {
@@ -1157,7 +1157,7 @@ public class TextViewer extends Viewer implements
/**
* Updates the selection.
- *
+ *
* @param offset the new selection offset
* @param length the new selection length
*/
@@ -1172,7 +1172,7 @@ public class TextViewer extends Viewer implements
/**
* Restores the state and disconnects it from the document. The selection is no longer
* tracked after this call.
- *
+ *
* @param restoreViewport <code>true</code> to restore both selection and viewport,
* <code>false</code> to only restore the selection
*/
@@ -1220,7 +1220,7 @@ public class TextViewer extends Viewer implements
/**
* Remembers the viewer state.
- *
+ *
* @param document the document to remember the state of
*/
private void connect(IDocument document) {
@@ -1266,7 +1266,7 @@ public class TextViewer extends Viewer implements
/**
* Updates a position with the given information and clears its deletion state.
- *
+ *
* @param position the position to update
* @param offset the new selection offset
* @param length the new selection length
@@ -1281,7 +1281,7 @@ public class TextViewer extends Viewer implements
/**
* Returns the document line to keep visually stable. If the caret line is (partially)
* visible, it is returned, otherwise the topmost (partially) visible line is returned.
- *
+ *
* @return the visually stable line of this viewer state
*/
private int getStableLine() {
@@ -1298,7 +1298,7 @@ public class TextViewer extends Viewer implements
/**
* Returns <code>true</code> if the viewer state is being tracked, <code>false</code>
* otherwise.
- *
+ *
* @return the tracking state
*/
private boolean isConnected() {
@@ -1326,7 +1326,7 @@ public class TextViewer extends Viewer implements
/**
* Internal cursor listener i.e. aggregation of mouse and key listener.
- *
+ *
* @since 3.0
*/
private class CursorListener implements KeyListener, MouseListener {
@@ -1420,8 +1420,8 @@ public class TextViewer extends Viewer implements
}
}
}
-
-
+
+
/**
* Identifies the scrollbars as originators of a view port change.
*/
@@ -1700,7 +1700,7 @@ public class TextViewer extends Viewer implements
protected void createControl(Composite parent, int styles) {
fTextWidget= createTextWidget(parent, styles);
-
+
// Support scroll page upon MOD1+MouseWheel
fTextWidget.addListener(SWT.MouseWheel, new Listener() {
@@ -1719,7 +1719,7 @@ public class TextViewer extends Viewer implements
updateViewportListeners(INTERNAL);
}
});
-
+
fTextWidget.addDisposeListener(
new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
@@ -1815,7 +1815,7 @@ public class TextViewer extends Viewer implements
* control has been disposed.
*/
protected void handleDispose() {
-
+
setDocument(null);
if (fPaintManager != null) {
@@ -1904,7 +1904,7 @@ public class TextViewer extends Viewer implements
fVisibleDocument= null;
fDocument= null;
fScroller= null;
-
+
fTextWidget= null;
}
@@ -2204,7 +2204,7 @@ public class TextViewer extends Viewer implements
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public void setHoverEnrichMode(ITextViewerExtension8.EnrichMode mode) {
@@ -2985,7 +2985,7 @@ public class TextViewer extends Viewer implements
* accurate if the widget does not use variable line heights - for that reason, clients should
* not use this method any longer and use the client area height of the text widget to find out
* how much content fits into it.
- *
+ *
* @return the view port height in lines
* @deprecated as of 3.2
*/
@@ -3005,7 +3005,7 @@ public class TextViewer extends Viewer implements
if (fTextWidget == null)
return -1;
-
+
int widgetBottom= JFaceTextUtil.getBottomIndex(fTextWidget);
return widgetLine2ModelLine(widgetBottom);
}
@@ -3098,7 +3098,7 @@ public class TextViewer extends Viewer implements
// scroll vertically
int bottom= JFaceTextUtil.getBottomIndex(fTextWidget);
int lines= bottom - top;
-
+
// if the widget is not scrollable as it is displaying the entire content
// setTopIndex won't have any effect.
@@ -3199,7 +3199,7 @@ public class TextViewer extends Viewer implements
Rectangle bounds= fTextWidget.getTextBounds(start, end - 1);
return new Region(bounds.x, bounds.width);
}
-
+
return new Region(fTextWidget.getLocationAtOffset(start).x, 0);
}
@@ -3549,9 +3549,9 @@ public class TextViewer extends Viewer implements
protected void customizeDocumentCommand(DocumentCommand command) {
if (isIgnoringAutoEditStrategies())
return;
-
+
IDocument document= getDocument();
-
+
if (fTabsToSpacesConverter != null)
fTabsToSpacesConverter.customizeDocumentCommand(document, command);
@@ -3990,7 +3990,7 @@ public class TextViewer extends Viewer implements
protected void shift(boolean useDefaultPrefixes, boolean right, boolean ignoreWhitespace) {
if (fUndoManager != null)
fUndoManager.beginCompoundChange();
-
+
IDocument d= getDocument();
Map partitioners= null;
DocumentRewriteSession rewriteSession= null;
@@ -4043,7 +4043,7 @@ public class TextViewer extends Viewer implements
if (partitioners != null)
TextUtilities.addDocumentPartitioners(d, partitioners);
-
+
if (d instanceof IDocumentExtension4) {
IDocumentExtension4 extension= (IDocumentExtension4) d;
extension.stopRewriteSession(rewriteSession);
@@ -4163,7 +4163,7 @@ public class TextViewer extends Viewer implements
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public void print(StyledTextPrintOptions options) {
@@ -4409,7 +4409,7 @@ public class TextViewer extends Viewer implements
range= modelStyleRange2WidgetStyleRange(range);
if (range != null)
fTextWidget.setStyleRange(range);
-
+
ArrayList ranges= new ArrayList(presentation.getDenumerableRanges());
Iterator e= presentation.getNonDefaultStyleRangeIterator();
while (e.hasNext()) {
@@ -4418,10 +4418,10 @@ public class TextViewer extends Viewer implements
if (range != null)
ranges.add(range);
}
-
+
if (!ranges.isEmpty())
fTextWidget.replaceStyleRanges(0, 0, (StyleRange[])ranges.toArray(new StyleRange[ranges.size()]));
-
+
} else {
IRegion region= modelRange2WidgetRange(presentation.getCoverage());
if (region == null)
@@ -4760,9 +4760,9 @@ public class TextViewer extends Viewer implements
* way for subclasses to pass in a desired top index that should be used when
* <code>redraw</code> is <code>true</code>. If <code>topIndex</code> is -1, this method is
* identical to <code>ITextViewerExtension.setRedraw(boolean)</code>.
- *
+ *
* @see ITextViewerExtension#setRedraw(boolean)
- *
+ *
* @param redraw <code>true</code> if redraw is enabled
* @param topIndex the top index
* @since 3.0
@@ -5310,7 +5310,7 @@ public class TextViewer extends Viewer implements
((IHyperlinkDetectorExtension)fHyperlinkDetectors[i]).dispose();
}
}
-
+
boolean enable= hyperlinkDetectors != null && hyperlinkDetectors.length > 0;
fHyperlinkStateMask= eventStateMask;
fHyperlinkDetectors= hyperlinkDetectors;
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
index 31dd488d7a2..784671f950b 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerHoverManager.java
@@ -298,7 +298,7 @@ class TextViewerHoverManager extends AbstractHoverInformationControlManager impl
fTextViewer.releaseWidgetToken(this);
}
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#replaceInformationControl(boolean)
* @since 3.4
@@ -350,15 +350,15 @@ class TextViewerHoverManager extends AbstractHoverInformationControlManager impl
public boolean setFocus(IWidgetTokenOwner owner) {
if (! hasInformationControlReplacer())
return false;
-
+
IInformationControl iControl= getCurrentInformationControl();
if (canReplace(iControl)) {
if (cancelReplacingDelay())
replaceInformationControl(true);
-
+
return true;
}
-
+
return false;
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerUndoManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerUndoManager.java
index 6075efee0cb..827a523430f 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerUndoManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewerUndoManager.java
@@ -43,20 +43,20 @@ import org.eclipse.jface.dialogs.MessageDialog;
* <p>
* This class is not intended to be subclassed.
* </p>
- *
+ *
* @see ITextViewer
* @see ITextInputListener
* @see IDocumentUndoManager
* @see MouseListener
* @see KeyListener
* @see DocumentUndoManager
- *
+ *
* @since 3.2
* @noextend This class is not intended to be subclassed by clients.
*/
public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtension {
-
+
/**
* Internal listener to mouse and key events.
*/
@@ -140,7 +140,7 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio
*/
public void documentUndoNotification(DocumentUndoEvent event ){
if (!isConnected()) return;
-
+
int eventType= event.getEventType();
if (((eventType & DocumentUndoEvent.ABOUT_TO_UNDO) != 0) || ((eventType & DocumentUndoEvent.ABOUT_TO_REDO) != 0)) {
if (event.isCompound()) {
@@ -157,7 +157,7 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio
((TextViewer)fTextViewer).ignoreAutoEditStrategies(true);
}
});
-
+
} else if (((eventType & DocumentUndoEvent.UNDONE) != 0) || ((eventType & DocumentUndoEvent.REDONE) != 0)) {
fTextViewer.getTextWidget().getDisplay().syncExec(new Runnable() {
public void run() {
@@ -173,7 +173,7 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio
if (extension != null)
extension.setRedraw(true);
}
-
+
// Reveal the change if this manager's viewer has the focus.
if (fTextViewer != null) {
StyledText widget= fTextViewer.getTextWidget();
@@ -193,16 +193,16 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio
/** The text viewer the undo manager is connected to */
private ITextViewer fTextViewer;
-
+
/** The undo level */
private int fUndoLevel;
-
+
/** The document undo manager that is active. */
private IDocumentUndoManager fDocumentUndoManager;
-
+
/** The document that is active. */
private IDocument fDocument;
-
+
/** The document undo listener */
private IDocumentUndoListener fDocumentUndoListener;
@@ -344,7 +344,7 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio
public void reset() {
if (isConnected())
fDocumentUndoManager.reset();
-
+
}
/*
@@ -417,7 +417,7 @@ public class TextViewerUndoManager implements IUndoManager, IUndoManagerExtensio
}
return null;
}
-
+
private void connectDocumentUndoManager(IDocument document) {
disconnectDocumentUndoManager();
if (document != null) {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java
index 2356e62c295..27399db3980 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java
@@ -26,7 +26,7 @@ import org.eclipse.swt.graphics.Point;
/**
* A painter for drawing visible characters for (invisible) whitespace
* characters.
- *
+ *
* @since 3.3
*/
public class WhitespaceCharacterPainter implements IPainter, PaintListener {
@@ -36,7 +36,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
private static final char TAB_SIGN= '\u00bb';
private static final char CARRIAGE_RETURN_SIGN= '\u00a4';
private static final char LINE_FEED_SIGN= '\u00b6';
-
+
/** Indicates whether this painter is active. */
private boolean fIsActive= false;
/** The source viewer this painter is attached to. */
@@ -48,7 +48,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
/**
* Creates a new painter for the given text viewer.
- *
+ *
* @param textViewer the text viewer the painter should be attached to
*/
public WhitespaceCharacterPainter(ITextViewer textViewer) {
@@ -149,7 +149,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
/**
* Draw the given line range.
- *
+ *
* @param gc the GC
* @param startLine first line number
* @param endLine last line number (inclusive)
@@ -218,7 +218,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
/**
* Draw characters of content range.
- *
+ *
* @param gc the GC
* @param startOffset inclusive start index
* @param endOffset exclusive end index
@@ -289,7 +289,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
/**
* Check if the given widget line is a folded line.
- *
+ *
* @param widgetLine the widget line number
* @return <code>true</code> if the line is folded
*/
@@ -312,7 +312,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
/**
* Draw string at widget offset.
- *
+ *
* @param gc the GC
* @param offset the widget offset
* @param s the string to be drawn
@@ -324,7 +324,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
FontMetrics fontMetrics= gc.getFontMetrics();
int fontBaseline= fontMetrics.getAscent() + fontMetrics.getLeading();
int baslineDelta= baseline - fontBaseline;
-
+
Point pos= fTextWidget.getLocationAtOffset(offset);
gc.setForeground(fg);
gc.drawString(s, pos.x, pos.y + baslineDelta, true);
@@ -332,7 +332,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
/**
* Convert a document offset to the corresponding widget offset.
- *
+ *
* @param documentOffset the document offset
* @return widget offset
*/
@@ -351,7 +351,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
/**
* Convert a widget offset to the corresponding document offset.
- *
+ *
* @param widgetOffset the widget offset
* @return document offset
*/
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
index f71c9dc69b6..6e4f7f23b4b 100644
--- 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
@@ -10,12 +10,6 @@
*******************************************************************************/
package org.eclipse.jface.text.contentassist;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
@@ -26,7 +20,14 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+
import org.eclipse.jface.internal.text.InformationControlReplacer;
+
import org.eclipse.jface.text.AbstractInformationControlManager;
import org.eclipse.jface.text.AbstractReusableInformationControlCreator;
import org.eclipse.jface.text.DefaultInformationControl;
@@ -41,15 +42,15 @@ import org.eclipse.jface.text.IInformationControlExtension3;
* @since 2.0
*/
class AdditionalInfoController extends AbstractInformationControlManager {
-
+
/**
* A timer thread.
- *
+ *
* @since 3.2
*/
private static abstract class Timer {
private static final int DELAY_UNTIL_JOB_IS_SCHEDULED= 50;
-
+
/**
* A <code>Task</code> is {@link Task#run() run} when {@link #delay()} milliseconds have
* elapsed after it was scheduled without a {@link #reset(ICompletionProposal) reset}
@@ -69,7 +70,7 @@ class AdditionalInfoController extends AbstractInformationControlManager {
*/
public abstract Task nextTask();
}
-
+
/**
* IDLE: the initial task, and active whenever the info has been shown. It cannot be run,
* but specifies an infinite delay.
@@ -78,16 +79,16 @@ class AdditionalInfoController extends AbstractInformationControlManager {
public void run() {
Assert.isTrue(false);
}
-
+
public Task nextTask() {
Assert.isTrue(false);
return null;
}
-
+
public long delay() {
return Long.MAX_VALUE;
}
-
+
public String toString() {
return "IDLE"; //$NON-NLS-1$
}
@@ -116,15 +117,15 @@ class AdditionalInfoController extends AbstractInformationControlManager {
};
job.schedule();
}
-
+
public Task nextTask() {
return SECOND_WAIT;
}
-
+
public long delay() {
return DELAY_UNTIL_JOB_IS_SCHEDULED;
}
-
+
public String toString() {
return "FIRST_WAIT"; //$NON-NLS-1$
}
@@ -138,15 +139,15 @@ class AdditionalInfoController extends AbstractInformationControlManager {
// show the info
allowShowing();
}
-
+
public Task nextTask() {
return IDLE;
}
-
+
public long delay() {
return fDelay - DELAY_UNTIL_JOB_IS_SCHEDULED;
}
-
+
public String toString() {
return "SECOND_WAIT"; //$NON-NLS-1$
}
@@ -170,15 +171,15 @@ class AdditionalInfoController extends AbstractInformationControlManager {
});
}
}
-
+
public Task nextTask() {
return IDLE;
}
-
+
public long delay() {
return fDelay;
}
-
+
public String toString() {
return "LEGACY_WAIT"; //$NON-NLS-1$
}
@@ -199,12 +200,12 @@ class AdditionalInfoController extends AbstractInformationControlManager {
public void run() {
Assert.isTrue(false);
}
-
+
public String toString() {
return "EXIT"; //$NON-NLS-1$
}
};
-
+
/** The timer thread. */
private final Thread fThread;
@@ -212,17 +213,17 @@ class AdditionalInfoController extends AbstractInformationControlManager {
private Task fTask;
/** The next wake up time. */
private long fNextWakeup;
-
+
private ICompletionProposal fCurrentProposal= null;
private Object fCurrentInfo= null;
private boolean fAllowShowing= false;
private final Display fDisplay;
private final int fDelay;
-
+
/**
* Creates a new timer.
- *
+ *
* @param display the display to use for display thread posting.
* @param delay the delay until to show additional info
*/
@@ -242,7 +243,7 @@ class AdditionalInfoController extends AbstractInformationControlManager {
}, JFaceTextMessages.getString("InfoPopup.info_delay_timer_name")); //$NON-NLS-1$
fThread.start();
}
-
+
/**
* Terminates the timer thread.
*/
@@ -250,10 +251,10 @@ class AdditionalInfoController extends AbstractInformationControlManager {
schedule(EXIT, System.currentTimeMillis());
notifyAll();
}
-
+
/**
* Resets the timer thread as the selection has changed to a new proposal.
- *
+ *
* @param p the new proposal
*/
public final synchronized void reset(ICompletionProposal p) {
@@ -269,7 +270,7 @@ class AdditionalInfoController extends AbstractInformationControlManager {
notifyAll();
}
}
-
+
private Task taskOnReset(ICompletionProposal p) {
if (p == null)
return IDLE;
@@ -295,11 +296,11 @@ class AdditionalInfoController extends AbstractInformationControlManager {
}
}
}
-
+
private Task currentTask() {
return fTask;
}
-
+
private void schedule(Task task, long current) {
fTask= task;
long nextWakeup= current + task.delay();
@@ -316,7 +317,7 @@ class AdditionalInfoController extends AbstractInformationControlManager {
ICompletionProposal getCurrentProposal() {
return fCurrentProposal;
}
-
+
ICompletionProposalExtension5 getCurrentProposalEx() {
Assert.isTrue(fCurrentProposal instanceof ICompletionProposalExtension5);
return (ICompletionProposalExtension5) fCurrentProposal;
@@ -345,10 +346,10 @@ class AdditionalInfoController extends AbstractInformationControlManager {
});
}
}
-
+
/**
* Called in the display thread to show additional info.
- *
+ *
* @param proposal the proposal to show information about
* @param info the information about <code>proposal</code>
*/
@@ -377,7 +378,7 @@ class AdditionalInfoController extends AbstractInformationControlManager {
public void widgetDefaultSelected(SelectionEvent e) {
}
}
-
+
/**
* Default control creator for the information control replacer.
* @since 3.4
@@ -423,7 +424,7 @@ class AdditionalInfoController extends AbstractInformationControlManager {
fDelay= delay;
setAnchor(ANCHOR_RIGHT);
setFallbackAnchors(new Anchor[] { ANCHOR_RIGHT, ANCHOR_LEFT, ANCHOR_BOTTOM });
-
+
/*
* Adjust the location by one pixel towards the proposal popup, so that the single pixel
* border of the additional info popup overlays with the border of the popup. This avoids
@@ -431,7 +432,7 @@ class AdditionalInfoController extends AbstractInformationControlManager {
*/
int spacing= -1;
setMargins(spacing, spacing); // see also adjustment in #computeLocation
-
+
InformationControlReplacer replacer= new InformationControlReplacer(new DefaultPresenterControlCreator());
getInternalAccessor().setInformationControlReplacer(replacer);
}
@@ -452,7 +453,7 @@ class AdditionalInfoController extends AbstractInformationControlManager {
fProposalTable= (Table) control;
fProposalTable.addSelectionListener(fSelectionListener);
getInternalAccessor().getInformationControlReplacer().install(fProposalTable);
-
+
fTimer= new Timer(fProposalTable.getDisplay(), fDelay) {
protected void showInformation(ICompletionProposal proposal, Object info) {
InformationControlReplacer replacer= getInternalAccessor().getInformationControlReplacer();
@@ -507,10 +508,10 @@ class AdditionalInfoController extends AbstractInformationControlManager {
void showInformation(ICompletionProposal proposal, Object info) {
if (fProposalTable == null || fProposalTable.isDisposed())
return;
-
+
if (fProposal == proposal && ((info == null && fInformation == null) || (info != null && info.equals(fInformation))))
return;
-
+
fInformation= info;
fProposal= proposal;
showInformation();
@@ -537,7 +538,7 @@ class AdditionalInfoController extends AbstractInformationControlManager {
*/
protected Point computeLocation(Rectangle subjectArea, Point controlSize, Anchor anchor) {
Point location= super.computeLocation(subjectArea, controlSize, anchor);
-
+
/*
* The location is computed using subjectControl.toDisplay(), which does not include the
* trim of the subject control. As we want the additional info popup aligned with the outer
@@ -557,7 +558,7 @@ class AdditionalInfoController extends AbstractInformationControlManager {
// at least as big as the proposal table
Point sizeConstraint= super.computeSizeConstraints(subjectControl, informationControl);
Point size= subjectControl.getShell().getSize();
-
+
// AbstractInformationControlManager#internalShowInformationControl(Rectangle, Object) adds trims
// to the computed constraints. Need to remove them here, to make the outer bounds of the additional
// info shell fit the bounds of the proposal shell:
@@ -573,7 +574,7 @@ class AdditionalInfoController extends AbstractInformationControlManager {
sizeConstraint.y= size.y;
return sizeConstraint;
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#hideInformationControl()
*/
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
index b186776fc24..b5a5ae9b2cf 100644
--- 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
@@ -104,23 +104,23 @@ class CompletionProposalPopup implements IContentAssistListener {
/**
* Completion proposal selection handler.
- *
+ *
* @since 3.4
*/
final class ProposalSelectionHandler extends AbstractHandler {
-
+
/**
* Selection operation codes.
*/
static final int SELECT_NEXT= 1;
static final int SELECT_PREVIOUS= 2;
-
+
private int fOperationCode;
/**
* Creates a new selection handler.
- *
+ *
* @param operationCode the operation code
* @since 3.4
*/
@@ -153,11 +153,11 @@ class CompletionProposalPopup implements IContentAssistListener {
}
}
-
+
/**
* The empty proposal displayed if there is nothing else to show.
- *
+ *
* @since 3.2
*/
private static final class EmptyProposal implements ICompletionProposal, ICompletionProposalExtension {
@@ -261,15 +261,15 @@ class CompletionProposalPopup implements IContentAssistListener {
private final class CommandKeyListener extends KeyAdapter {
private KeySequence fCommandSequence;
-
+
private CommandKeyListener(KeySequence keySequence) {
fCommandSequence= keySequence;
}
-
+
public void keyPressed(KeyEvent e) {
if (!Helper.okToUse(fProposalShell))
return;
-
+
int accelerator= SWTKeySupport.convertEventToUnmodifiedAccelerator(e);
KeySequence sequence= KeySequence.getInstance(SWTKeySupport.convertAcceleratorToKeyStroke(accelerator));
if (sequence.equals(fCommandSequence))
@@ -277,11 +277,11 @@ class CompletionProposalPopup implements IContentAssistListener {
incrementalComplete();
else
showProposals(false);
-
+
}
}
-
-
+
+
/** The associated text viewer. */
private ITextViewer fViewer;
/** The associated content assistant. */
@@ -349,14 +349,14 @@ class CompletionProposalPopup implements IContentAssistListener {
private boolean fIsFilteredSubset;
/**
* The filter runnable.
- *
+ *
* @since 3.1.1
*/
private final Runnable fFilterRunnable= new Runnable() {
public void run() {
if (!fIsFilterPending)
return;
-
+
fIsFilterPending= false;
if (!Helper.okToUse(fContentAssistSubjectControlAdapter.getControl()))
@@ -384,50 +384,50 @@ class CompletionProposalPopup implements IContentAssistListener {
/**
* <code>true</code> if <code>fFilterRunnable</code> has been
* posted, <code>false</code> if not.
- *
+ *
* @since 3.1.1
*/
private boolean fIsFilterPending= false;
/**
* The info message at the bottom of the popup, or <code>null</code> for no popup (if
* ContentAssistant does not provide one).
- *
+ *
* @since 3.2
*/
private Label fMessageText;
/**
* The font used for <code>fMessageText</code> or null; dispose when done.
- *
+ *
* @since 3.2
*/
private Font fMessageTextFont;
/**
* The most recent completion offset (used to determine repeated invocation)
- *
+ *
* @since 3.2
*/
private int fLastCompletionOffset;
/**
* The (reusable) empty proposal.
- *
+ *
* @since 3.2
*/
private final EmptyProposal fEmptyProposal= new EmptyProposal();
/**
* The text for the empty proposal, or <code>null</code> to use the default text.
- *
+ *
* @since 3.2
*/
private String fEmptyMessage= null;
/**
* Tells whether colored labels support is enabled.
* Only valid while the popup is active.
- *
+ *
* @since 3.4
*/
private boolean fIsColoredLabelsSupportEnabled= false;
-
+
/**
* Creates a new completion proposal popup for the given elements.
*
@@ -488,7 +488,7 @@ class CompletionProposalPopup implements IContentAssistListener {
int count= (fComputedProposals == null ? 0 : fComputedProposals.length);
if (count == 0 && hideWhenNoProposals(autoActivated))
return;
-
+
if (count == 1 && !autoActivated && canAutoInsert(fComputedProposals[0])) {
insertProposal(fComputedProposals[0], (char) 0, 0, fInvocationOffset);
hide();
@@ -506,11 +506,11 @@ class CompletionProposalPopup implements IContentAssistListener {
return getErrorMessage();
}
-
+
/**
* Hides the popup and returns <code>true</code> if the popup is configured
* to never display an empty list. Returns <code>false</code> otherwise.
- *
+ *
* @param autoActivated whether the invocation was auto-activated
* @return <code>false</code> if an empty list should be displayed, <code>true</code> otherwise
* @since 3.2
@@ -531,7 +531,7 @@ class CompletionProposalPopup implements IContentAssistListener {
/**
* If content assist is set up to handle cycling, then the proposals are recomputed. Otherwise,
* nothing happens.
- *
+ *
* @since 3.2
*/
private void handleRepeatedInvocation() {
@@ -585,7 +585,7 @@ class CompletionProposalPopup implements IContentAssistListener {
} else {
fProposalTable= new Table(fProposalShell, SWT.H_SCROLL | SWT.V_SCROLL);
}
-
+
fIsColoredLabelsSupportEnabled= fContentAssistant.isColoredLabelsSupportEnabled();
if (fIsColoredLabelsSupportEnabled)
TableOwnerDrawSupport.install(fProposalTable);
@@ -599,7 +599,7 @@ class CompletionProposalPopup implements IContentAssistListener {
layout.marginHeight= 0;
layout.verticalSpacing= 1;
fProposalShell.setLayout(layout);
-
+
if (fContentAssistant.isStatusLineVisible()) {
createMessageText();
}
@@ -636,7 +636,7 @@ class CompletionProposalPopup implements IContentAssistListener {
fSize= fProposalShell.getSize();
}
});
-
+
fProposalShell.setBackground(control.getDisplay().getSystemColor(SWT.COLOR_GRAY));
Color c= getBackgroundColor(control);
@@ -663,14 +663,14 @@ class CompletionProposalPopup implements IContentAssistListener {
});
fProposalTable.setHeaderVisible(false);
-
+
addCommandSupport(fProposalTable);
}
/**
* Returns the minimal required height for the proposal, may return 0 if the popup has not been
* created yet.
- *
+ *
* @return the minimal height
* @since 3.3
*/
@@ -688,7 +688,7 @@ class CompletionProposalPopup implements IContentAssistListener {
/**
* Adds command support to the given control.
- *
+ *
* @param control the control to watch for focus
* @since 3.2
*/
@@ -744,7 +744,7 @@ class CompletionProposalPopup implements IContentAssistListener {
/**
* Returns the background color to use.
- *
+ *
* @param control the control to get the display from
* @return the background color
* @since 3.2
@@ -758,7 +758,7 @@ class CompletionProposalPopup implements IContentAssistListener {
/**
* Returns the foreground color to use.
- *
+ *
* @param control the control to get the display from
* @return the foreground color
* @since 3.2
@@ -769,10 +769,10 @@ class CompletionProposalPopup implements IContentAssistListener {
c= JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
return c;
}
-
+
/**
* Creates the caption line under the proposal table.
- *
+ *
* @since 3.2
*/
private void createMessageText() {
@@ -831,7 +831,7 @@ class CompletionProposalPopup implements IContentAssistListener {
item.setText(displayString);
if (fIsColoredLabelsSupportEnabled)
TableOwnerDrawSupport.storeStyleRanges(item, 0, styleRanges);
-
+
item.setImage(current.getImage());
item.setData(current);
} else {
@@ -851,11 +851,11 @@ class CompletionProposalPopup implements IContentAssistListener {
*/
if (fIsFilterPending)
fFilterRunnable.run();
-
+
// filter runnable may have hidden the proposals
if (!Helper.okToUse(fProposalTable))
return null;
-
+
int i= fProposalTable.getSelectionIndex();
if (fFilteredProposals == null || i < 0 || i >= fFilteredProposals.length)
return null;
@@ -1017,20 +1017,20 @@ class CompletionProposalPopup implements IContentAssistListener {
fProposalShell.dispose();
fProposalShell= null;
}
-
+
if (fMessageTextFont != null) {
fMessageTextFont.dispose();
fMessageTextFont= null;
}
-
+
if (fMessageText != null) {
fMessageText= null;
}
-
+
fEmptyMessage= null;
-
+
fLastCompletionOffset= -1;
-
+
fContentAssistant.fireSessionEndEvent();
}
@@ -1092,7 +1092,7 @@ class CompletionProposalPopup implements IContentAssistListener {
if (Helper.okToUse(fProposalTable)) {
if (oldProposal instanceof ICompletionProposalExtension2 && fViewer != null)
((ICompletionProposalExtension2) oldProposal).unselected(fViewer);
-
+
if (proposals == null || proposals.length == 0) {
fEmptyProposal.fOffset= fFilterOffset;
fEmptyProposal.fDisplayString= fEmptyMessage != null ? fEmptyMessage : JFaceTextMessages.getString("CompletionProposalPopup.no_proposals"); //$NON-NLS-1$
@@ -1160,7 +1160,7 @@ class CompletionProposalPopup implements IContentAssistListener {
if (fContentAssistant.addContentAssistListener(this, ContentAssistant.PROPOSAL_SELECTOR)) {
ensureDocumentListenerInstalled();
-
+
if (fFocusHelper == null) {
fFocusHelper= new IEditingSupport() {
@@ -1341,11 +1341,11 @@ class CompletionProposalPopup implements IContentAssistListener {
fireSelectionEvent(null, smartToggle);
return;
}
-
+
ICompletionProposal proposal= fFilteredProposals[index];
if (proposal instanceof ICompletionProposalExtension2 && fViewer != null)
((ICompletionProposalExtension2) proposal).selected(fViewer, smartToggle);
-
+
fireSelectionEvent(proposal, smartToggle);
fLastProposal= proposal;
@@ -1358,7 +1358,7 @@ class CompletionProposalPopup implements IContentAssistListener {
/**
* Fires a selection event, see {@link ICompletionListener}.
- *
+ *
* @param proposal the selected proposal, possibly <code>null</code>
* @param smartToggle true if the smart toggle is on
* @since 3.2
@@ -1485,11 +1485,11 @@ class CompletionProposalPopup implements IContentAssistListener {
fProposalShell.setFocus();
}
}
-
+
/**
* Returns <code>true</code> if <code>proposal</code> should be auto-inserted,
* <code>false</code> otherwise.
- *
+ *
* @param proposal the single proposal that might be automatically inserted
* @return <code>true</code> if <code>proposal</code> can be inserted automatically,
* <code>false</code> otherwise
@@ -1541,7 +1541,7 @@ class CompletionProposalPopup implements IContentAssistListener {
int count= (fFilteredProposals == null ? 0 : fFilteredProposals.length);
if (count == 0 && hideWhenNoProposals(false))
return;
-
+
if (count == 1 && canAutoInsert(fFilteredProposals[0])) {
insertProposal(fFilteredProposals[0], (char) 0, 0, fInvocationOffset);
hide();
@@ -1567,7 +1567,7 @@ class CompletionProposalPopup implements IContentAssistListener {
* proposal, it is inserted, otherwise, the common prefix of all proposals
* is inserted into the document. If there is no common prefix, nothing
* happens and <code>false</code> is returned.
- *
+ *
* @return <code>true</code> if a single proposal was inserted and the
* selector can be closed, <code>false</code> otherwise
* @since 3.0
@@ -1592,7 +1592,7 @@ class CompletionProposalPopup implements IContentAssistListener {
List rightCase= new ArrayList();
boolean isWrongCaseMatch= false;
-
+
// the prefix of all case insensitive matches. This differs from the document
// contents and will be replaced.
CharSequence wrongCasePrefix= null;
@@ -1603,10 +1603,10 @@ class CompletionProposalPopup implements IContentAssistListener {
for (int i= 0; i < fFilteredProposals.length; i++) {
ICompletionProposal proposal= fFilteredProposals[i];
-
+
if (!(proposal instanceof ICompletionProposalExtension3))
return false;
-
+
int start= ((ICompletionProposalExtension3)proposal).getPrefixCompletionStart(fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset);
CharSequence insertion= ((ICompletionProposalExtension3)proposal).getPrefixCompletionText(fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset);
if (insertion == null)
@@ -1744,11 +1744,11 @@ class CompletionProposalPopup implements IContentAssistListener {
// all equal up to minimum
buffer.delete(min, buffer.length());
}
-
+
/**
* Sets the message for the repetition affordance text at the bottom of the proposal. Only has
* an effect if {@link ContentAssistant#isRepeatedInvocationMode()} returns <code>true</code>.
- *
+ *
* @param message the new caption
* @since 3.2
*/
@@ -1761,7 +1761,7 @@ class CompletionProposalPopup implements IContentAssistListener {
/**
* Sets the text to be displayed if no proposals are available. Only has an effect if
* {@link ContentAssistant#isShowEmptyList()} returns <code>true</code>.
- *
+ *
* @param message the empty message
* @since 3.2
*/
@@ -1772,14 +1772,14 @@ class CompletionProposalPopup implements IContentAssistListener {
/**
* Enables or disables showing of the caption line. See also {@link #setMessage(String)}.
- *
+ *
* @param show <code>true</code> if the status line is visible
* @since 3.2
*/
public void setStatusLineVisible(boolean show) {
if (!isActive() || show == (fMessageText != null))
return; // nothing to do
-
+
if (show) {
createMessageText();
} else {
@@ -1791,7 +1791,7 @@ class CompletionProposalPopup implements IContentAssistListener {
/**
* Informs the popup that it is being placed above the caret line instead of below.
- *
+ *
* @param above <code>true</code> if the location of the popup is above the caret line, <code>false</code> if it is below
* @since 3.3
*/
@@ -1807,7 +1807,7 @@ class CompletionProposalPopup implements IContentAssistListener {
/**
* Returns a new proposal selection handler.
- *
+ *
* @param operationCode the operation code
* @return the handler
* @since 3.4
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistEvent.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistEvent.java
index 61adff9e7fc..749c471631e 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistEvent.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistEvent.java
@@ -17,7 +17,7 @@ package org.eclipse.jface.text.contentassist;
* <p>
* Clients may use this class.
* </p>
- *
+ *
* @since 3.2
* @see ICompletionListener
* @noinstantiate This class is not intended to be instantiated by clients.
@@ -25,7 +25,7 @@ package org.eclipse.jface.text.contentassist;
public final class ContentAssistEvent {
/**
* Creates a new event.
- *
+ *
* @param ca the assistant
* @param proc the processor
* @param isAutoActivated whether content assist was triggered by auto activation
@@ -39,7 +39,7 @@ public final class ContentAssistEvent {
/**
* Creates a new event.
- *
+ *
* @param ca the assistant
* @param proc the processor
*/
@@ -60,7 +60,7 @@ public final class ContentAssistEvent {
* <p>
* <strong>Note:</strong> This flag is only valid in {@link ICompletionListener#assistSessionStarted(ContentAssistEvent)}.
* </p>
- *
+ *
* @since 3.4
*/
public final boolean isAutoActivated;
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistSubjectControlAdapter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistSubjectControlAdapter.java
index 7fe385055c7..09486febc2a 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistSubjectControlAdapter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistSubjectControlAdapter.java
@@ -19,7 +19,9 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.contentassist.*;
+import org.eclipse.jface.contentassist.IContentAssistSubjectControl;
+import org.eclipse.jface.contentassist.ISubjectControlContextInformationPresenter;
+import org.eclipse.jface.contentassist.ISubjectControlContextInformationValidator;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IEventConsumer;
@@ -73,7 +75,7 @@ final class ContentAssistSubjectControlAdapter implements IContentAssistSubjectC
public int getLineHeight() {
if (fContentAssistSubjectControl != null)
return fContentAssistSubjectControl.getLineHeight();
-
+
return fViewer.getTextWidget().getLineHeight(getCaretOffset());
}
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
index 4b694dada4b..54312240a47 100644
--- 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
@@ -75,22 +75,22 @@ import org.eclipse.jface.text.TextUtilities;
* instantiate this class and configure it before using it.
*/
public class ContentAssistant implements IContentAssistant, IContentAssistantExtension, IContentAssistantExtension2, IContentAssistantExtension3, IContentAssistantExtension4, IWidgetTokenKeeper, IWidgetTokenKeeperExtension {
-
-
-
+
+
+
/**
* Content assist command identifier for 'select next proposal'.
- *
+ *
* @since 3.4
*/
public static final String SELECT_NEXT_PROPOSAL_COMMAND_ID= "org.eclipse.ui.edit.text.contentAssist.selectNextProposal"; //$NON-NLS-1$
/**
* Content assist command identifier for 'select previous proposal'.
- *
+ *
* @since 3.4
*/
public static final String SELECT_PREVIOUS_PROPOSAL_COMMAND_ID= "org.eclipse.ui.edit.text.contentAssist.selectPreviousProposal"; //$NON-NLS-1$
-
+
/**
* A generic closer class used to monitor various interface events in order to determine whether
@@ -241,7 +241,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
* 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.
- *
+ *
* @since 3.4 protected, was added in 2.1 as private class
*/
protected class AutoAssistListener extends KeyAdapter implements Runnable, VerifyKeyListener {
@@ -310,10 +310,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
// Only act on typed characters and ignore modifier-only events
if (e.character == 0 && (e.keyCode & SWT.KEYCODE_BIT) == 0)
return;
-
+
if (e.character != 0 && (e.stateMask == SWT.ALT))
return;
-
+
// Only act on characters that are trigger candidates. This
// avoids computing the model selection on every keystroke
if (computeAllAutoActivationTriggers().indexOf(e.character) < 0) {
@@ -356,20 +356,20 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
final Control control= fContentAssistSubjectControlAdapter.getControl();
if (control == null)
return;
-
+
final Display d= control.getDisplay();
if (d == null)
return;
-
+
try {
d.syncExec(new Runnable() {
public void run() {
if (isProposalPopupActive())
return;
-
+
if (control.isDisposed() || !control.isFocusControl())
return;
-
+
if (showStyle == SHOW_PROPOSALS) {
if (!prepareToShowCompletions(true))
return;
@@ -476,7 +476,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
/**
* Layouts the popup defined by <code>type</code> at the given widget offset.
- *
+ *
* @param type the kind of popup to layout
* @param offset the widget offset
*/
@@ -589,7 +589,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
/**
* Moves <code>point</code> such that <code>rectangle</code> does not bleed outside of
* <code>bounds</code>. All coordinates must have the same reference.
- *
+ *
* @param point the point to move if needed
* @param shellSize the size of the shell that may be moved
* @param bounds the bounds
@@ -601,10 +601,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
if (point.x < bounds.x)
point.x= bounds.x;
-
+
if (point.y + shellSize.y > bounds.y + bounds.height)
point.y= bounds.y + bounds.height - shellSize.y;
-
+
if (point.y < bounds.y)
point.y= bounds.y;
}
@@ -613,20 +613,20 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
// clip width
if (rect.width > bounds.width)
rect.width= bounds.width;
-
+
if (rect.x + rect.width > bounds.x + bounds.width)
rect.x= bounds.x + bounds.width - rect.width;
if (rect.x < bounds.x)
rect.x= bounds.x;
-
+
return rect;
}
-
+
/**
* Returns the display bounds for <code>shell</code> such that it appears right above
* <code>offset</code>, or below it if above is not suitable. The returned bounds lie
* within the monitor at the caret location and never overlap with the caret line.
- *
+ *
* @param shell the shell to compute the placement for
* @param preferred the preferred size for <code>shell</code>
* @param offset the caret offset in the subject control
@@ -640,7 +640,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
Monitor monitor= getClosestMonitor(display, caret);
Rectangle bounds= monitor.getClientArea();
Geometry.moveInside(caret, bounds);
-
+
int spaceAbove= caret.y - bounds.y;
int caretLowerY= caret.y + caret.height;
int spaceBelow= bounds.y + bounds.height - caretLowerY;
@@ -654,7 +654,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
rect= new Rectangle(caret.x, bounds.y, preferred.x, spaceAbove);
else
rect= new Rectangle(caret.x, caretLowerY, preferred.x, spaceBelow);
-
+
return constrainHorizontally(rect, bounds);
}
@@ -662,7 +662,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
* Returns the display bounds for <code>shell</code> such that it appears right below
* <code>offset</code>, or above it if below is not suitable. The returned bounds lie
* within the monitor at the caret location and never overlap with the caret line.
- *
+ *
* @param shell the shell to compute the placement for
* @param preferred the preferred size for <code>shell</code>
* @param offset the caret offset in the subject control
@@ -698,10 +698,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
rect= new Rectangle(caret.x, bounds.y, preferred.x, spaceAbove);
switched= true;
}
-
+
if (popup != null)
popup.switchedPositionToAbove(switched);
-
+
return constrainHorizontally(rect, bounds);
}
@@ -714,7 +714,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
Rectangle subjectRectangle= new Rectangle(location.x, location.y, 1, fContentAssistSubjectControlAdapter.getLineHeight());
return subjectRectangle;
}
-
+
protected Point getStackedLocation(Shell shell, Shell parent) {
Point p= parent.getLocation();
Point size= parent.getSize();
@@ -754,7 +754,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
* contains the given point. If no monitor contains the point, returns the monitor that is
* closest to the point. If this is ever made public, it should be moved into a separate
* utility class.
- *
+ *
* @param toSearch point to find (display coordinates)
* @param rectangle rectangle to find (display coordinates)
* @return the monitor closest to the given point
@@ -959,7 +959,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
private boolean fIsStatusLineVisible;
/**
* The last system time when auto activation performed.
- *
+ *
* @since 3.2
*/
private long fLastAutoActivation= Long.MIN_VALUE;
@@ -969,17 +969,17 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
* @since 3.2
*/
private KeySequence fRepeatedInvocationKeySequence;
-
+
/**
* Maps handler to command identifiers.
- *
+ *
* @since 3.4
*/
private Map fHandlers;
-
+
/**
* Tells whether colored labels support is enabled.
- *
+ *
* @since 3.4
*/
private boolean fIsColoredLabelsSupportEnabled= false;
@@ -1134,7 +1134,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
/**
* This method allows subclasses to provide their own {@link AutoAssistListener}.
- *
+ *
* @return a new auto assist listener
* @since 3.4
*/
@@ -1155,7 +1155,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
/**
* Gets the delay after which the content assistant is automatically invoked if the cursor is
* behind an auto activation character.
- *
+ *
* @return the auto activation delay
* @since 3.4
*/
@@ -1235,7 +1235,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
/**
* Returns the foreground of the context information popup.
- *
+ *
*
* @return the foreground of the context information popup
* @since 2.0
@@ -1402,7 +1402,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
public void uninstall() {
hide();
manageAutoActivation(false);
-
+
if (fHandlers != null) {
fHandlers.clear();
fHandlers= null;
@@ -1451,10 +1451,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
void layout(int type, int visibleOffset) {
fLayoutManager.layout(type, visibleOffset);
}
-
+
/**
* Returns the layout manager.
- *
+ *
* @return the layout manager
* @since 3.3
*/
@@ -1673,7 +1673,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
/**
* Prepares to show content assist proposals. It returns false if auto activation has kicked in
* recently.
- *
+ *
* @param isAutoActivated whether completion was triggered by auto activation
* @return <code>true</code> if the caller should continue and show the proposals,
* <code>false</code> otherwise.
@@ -1684,7 +1684,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
int gracePeriod= Math.max(fAutoActivationDelay, 200);
if (current < fLastAutoActivation + gracePeriod)
return false;
-
+
promoteKeyListener();
fireSessionBeginEvent(isAutoActivated);
return true;
@@ -2076,7 +2076,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
* <li>{@link ContentAssistant#STORE_SIZE_Y}</li>
* </ul>
* </p>
- *
+ *
* @param dialogSettings the dialog settings
* @since 3.0
*/
@@ -2160,10 +2160,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
public void enablePrefixCompletion(boolean enabled) {
fIsPrefixCompletionEnabled= enabled;
}
-
+
/**
* Returns the prefix completion state.
- *
+ *
* @return <code>true</code> if prefix completion is enabled, <code>false</code> otherwise
* @since 3.2
*/
@@ -2200,7 +2200,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
/**
* Fires a session begin event to all registered {@link ICompletionListener}s.
- *
+ *
* @param isAutoActivated <code>true</code> if this session was triggered by auto activation
* @since 3.2
*/
@@ -2215,7 +2215,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
}
}
}
-
+
/**
* Fires a session restart event to all registered {@link ICompletionListener}s.
*
@@ -2369,17 +2369,17 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
/**
* Returns the repeated invocation key sequence.
- *
+ *
* @return the repeated invocation key sequence or <code>null</code>, if none
* @since 3.2
*/
KeySequence getRepeatedInvocationKeySequence() {
return fRepeatedInvocationKeySequence;
}
-
+
/**
* Returns whether proposal popup is active.
- *
+ *
* @return <code>true</code> if the proposal popup is active, <code>false</code> otherwise
* @since 3.4
*/
@@ -2389,7 +2389,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
/**
* Returns whether the context information popup is active.
- *
+ *
* @return <code>true</code> if the context information popup is active, <code>false</code> otherwise
* @since 3.4
*/
@@ -2399,7 +2399,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public final IHandler getHandler(String commandId) {
@@ -2409,14 +2409,14 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
IHandler handler= (IHandler)fHandlers.get(commandId);
if (handler != null)
return handler;
-
+
Assert.isLegal(false);
return null;
}
/**
* Registers the given handler under the given command identifier.
- *
+ *
* @param commandId the command identifier
* @param handler the handler
* @since 3.4
@@ -2429,7 +2429,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
/**
* Tells whether the support for colored labels is enabled.
- *
+ *
* @return <code>true</code> if the support for colored labels is enabled, <code>false</code> otherwise
* @since 3.4
*/
@@ -2441,7 +2441,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
* Enables the support for colored labels in the proposal popup.
* <p>Completion proposals can implement {@link ICompletionProposalExtension6}
* to provide colored proposal labels.</p>
- *
+ *
* @param isEnabled if <code>true</code> the support for colored labels is enabled in the proposal popup
* @since 3.4
*/
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
index e01820034c1..d3354ecc319 100644
--- 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
@@ -441,7 +441,7 @@ class ContextInformationPopup implements IContentAssistListener {
if (bounds.width < size.x)
// we don't fit on the screen - try again and wrap
size= fContextInfoText.computeSize(bounds.width - PAD, SWT.DEFAULT, true);
-
+
size.x += TEXT_PAD;
fContextInfoText.setSize(size);
fContextInfoText.setLocation(1,1);
@@ -544,7 +544,7 @@ class ContextInformationPopup implements IContentAssistListener {
/**
* Returns the minimal required height for the popup, may return 0 if the popup has not been
* created yet.
- *
+ *
* @return the minimal height
* @since 3.3
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java
index 82615134961..1dda37e2bc0 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListener.java
@@ -29,27 +29,27 @@ package org.eclipse.jface.text.contentassist;
* <p>
* Clients may implement this interface.
* </p>
- *
+ *
* @since 3.2
*/
public interface ICompletionListener {
/**
* Called when code assist is invoked when there is no current code assist session.
- *
+ *
* @param event the content assist event
*/
void assistSessionStarted(ContentAssistEvent event);
/**
* Called when a code assist session ends (for example, the proposal popup is closed).
- *
+ *
* @param event the content assist event
*/
void assistSessionEnded(ContentAssistEvent event);
/**
* Called when the selection in the proposal popup is changed or if the insert-mode changed.
- *
+ *
* @param proposal the newly selected proposal, possibly <code>null</code>
* @param smartToggle <code>true</code> if the insert-mode toggle is being pressed,
* <code>false</code> otherwise
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension.java
index 587714cd103..60473b1d3f2 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionListenerExtension.java
@@ -16,13 +16,13 @@ package org.eclipse.jface.text.contentassist;
* <p>
* Clients may implement this interface.
* </p>
- *
+ *
* @since 3.4
*/
public interface ICompletionListenerExtension {
/**
* Called when code assist is invoked when there is already a current code assist session.
- *
+ *
* @param event the content assist event
*/
void assistSessionRestarted(ContentAssistEvent event);
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
index 66ff95d720c..b12f981241f 100644
--- 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
@@ -106,7 +106,7 @@ public interface ICompletionProposal {
* If {@link ICompletionProposalExtension5} is implemented, this method should not be called any
* longer. This method may be deprecated in a future release.
* </p>
- *
+ *
* @return the additional information or <code>null</code>
*/
String getAdditionalProposalInfo();
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension4.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension4.java
index 77634d78311..94a50a56a81 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension4.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension4.java
@@ -17,7 +17,7 @@ package org.eclipse.jface.text.contentassist;
* <ul>
* <li>specify whether a proposal is automatically insertable</li>
* </ul>
- *
+ *
* @since 3.1
*/
public interface ICompletionProposalExtension4 {
@@ -30,7 +30,7 @@ public interface ICompletionProposalExtension4 {
* a list of proposals, but simply insert the single proposal. A
* proposal may veto this behavior by returning <code>false</code>
* to a call to this method.
- *
+ *
* @return <code>true</code> if the proposal may be inserted
* automatically, <code>false</code> if not
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension5.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension5.java
index 3182415d0a7..6ec7cb4505b 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension5.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension5.java
@@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
* <ul>
* <li>Allow background computation of the additional info.</li>
* </ul>
- *
+ *
* @since 3.2
*/
public interface ICompletionProposalExtension5 {
@@ -33,7 +33,7 @@ public interface ICompletionProposalExtension5 {
* {@link ICompletionProposalExtension3#getInformationControlCreator()} is implemented, the
* information will be passed to a custom information control for display.
* </p>
- *
+ *
* @param monitor a monitor to report progress and to watch for
* {@link IProgressMonitor#isCanceled() cancelation}.
* @return the additional information, <code>null</code> for no information
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension6.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension6.java
index 5434dbcea55..a98bb719da9 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension6.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ICompletionProposalExtension6.java
@@ -19,11 +19,11 @@ import org.eclipse.jface.viewers.StyledString;
* <ul>
* <li>Allow styled ranges in the display string.</li>
* </ul>
- *
+ *
* @since 3.4
*/
public interface ICompletionProposalExtension6 {
-
+
/**
* Returns the styled string used to display this proposal in the list of completion proposals.
* This can for example be used to draw mixed colored labels.
@@ -32,7 +32,7 @@ public interface ICompletionProposalExtension6 {
* correctly implemented as this method might be ignored in case of uninstalled owner draw
* support.
* </p>
- *
+ *
* @return the string builder used to display this proposal
*/
StyledString getStyledDisplayString();
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension2.java
index 923f1fced6b..dfa5d247733 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension2.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension2.java
@@ -19,21 +19,21 @@ package org.eclipse.jface.text.contentassist;
* <li>a local status line for the completion popup</li>
* <li>control over the behavior when no proposals are available</li>
* </ul>
- *
+ *
* @since 3.2
*/
public interface IContentAssistantExtension2 {
/**
* Adds a completion listener that will be informed before proposals are computed.
- *
+ *
* @param listener the listener
*/
public void addCompletionListener(ICompletionListener listener);
/**
* Removes a completion listener.
- *
+ *
* @param listener the listener to remove
*/
public void removeCompletionListener(ICompletionListener listener);
@@ -41,7 +41,7 @@ public interface IContentAssistantExtension2 {
/**
* Enables repeated invocation mode, which will trigger re-computation of the proposals when
* code assist is executed repeatedly. The default is no <code>false</code>.
- *
+ *
* @param cycling <code>true</code> to enable repetition mode, <code>false</code> to disable
*/
public void setRepeatedInvocationMode(boolean cycling);
@@ -49,7 +49,7 @@ public interface IContentAssistantExtension2 {
/**
* Enables displaying an empty completion proposal pop-up. The default is not to show an empty
* list.
- *
+ *
* @param showEmpty <code>true</code> to show empty lists
*/
public void setShowEmptyList(boolean showEmpty);
@@ -57,14 +57,14 @@ public interface IContentAssistantExtension2 {
/**
* Enables displaying a status line below the proposal popup. The default is not to show the
* status line. The contents of the status line may be set via {@link #setStatusMessage(String)}.
- *
+ *
* @param show <code>true</code> to show a message line, <code>false</code> to not show one.
*/
public void setStatusLineVisible(boolean show);
/**
* Sets the caption message displayed at the bottom of the completion proposal popup.
- *
+ *
* @param message the message
*/
public void setStatusMessage(String message);
@@ -72,7 +72,7 @@ public interface IContentAssistantExtension2 {
/**
* Sets the text to be shown if no proposals are available and
* {@link #setShowEmptyList(boolean) empty lists} are displayed.
- *
+ *
* @param message the text for the empty list
*/
public void setEmptyMessage(String message);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension3.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension3.java
index 22cef8bd879..90a850f90f8 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension3.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension3.java
@@ -26,7 +26,7 @@ public interface IContentAssistantExtension3 {
/**
* Sets the key sequence to listen for in repeated invocation mode. If the key sequence is
* encountered, a step in the repetition iteration is triggered.
- *
+ *
* @param sequence the key sequence used for the repeated invocation mode or <code>null</code> if none
*/
public void setRepeatedInvocationTrigger(KeySequence sequence);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension4.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension4.java
index 07c8e0817d6..ad310fec8f0 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension4.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/IContentAssistantExtension4.java
@@ -19,7 +19,7 @@ import org.eclipse.core.commands.IHandler;
* <ul>
* <li>allows to get a handler for the given command identifier</li>
* </ul>
- *
+ *
* @since 3.4
*/
public interface IContentAssistantExtension4 {
@@ -30,7 +30,7 @@ public interface IContentAssistantExtension4 {
* The same handler instance will be returned when called a more than once
* with the same command identifier.
* </p>
- *
+ *
* @param commandId the command identifier
* @return the handler for the given command identifier
* @throws IllegalArgumentException if the command is not supported by this
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
index 88652234fba..6b85ce24402 100644
--- 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
@@ -32,7 +32,7 @@ import org.eclipse.swt.graphics.Image;
* {@link org.eclipse.jface.text.contentassist.ContextInformation} as
* the standard implementer of this interface.
* </p>
- *
+ *
* @see IContentAssistProcessor
*/
public interface IContextInformation {
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
index 417529b9910..d5a36479994 100644
--- 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
@@ -22,7 +22,7 @@ public interface IContextInformationExtension {
/**
* Returns the start offset of the range for which this context
* information is valid or <code>-1</code> if unknown.
- *
+ *
* @return the start offset of the range for which this context
* information is valid
*/
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
index 5c3abab0a01..821e257029b 100644
--- 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
@@ -75,7 +75,7 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen
public void install(ContentAssistant contentAssistant, Table table) {
install(contentAssistant, table, null);
}
-
+
/**
* Installs this closer on the given table opened by the given content assistant.
*
@@ -88,22 +88,22 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen
fContentAssistant= contentAssistant;
fTable= table;
fAdditionalInfoController= additionalInfoController;
-
+
if (Helper.okToUse(fTable)) {
fShell= fTable.getShell();
fDisplay= fShell.getDisplay();
-
+
fShell.addShellListener(this);
fTable.addFocusListener(this);
fScrollbar= fTable.getVerticalBar();
if (fScrollbar != null)
fScrollbar.addSelectionListener(this);
-
+
fDisplay.addFilter(SWT.Activate, this);
fDisplay.addFilter(SWT.MouseWheel, this);
-
+
fDisplay.addFilter(SWT.Deactivate, this);
-
+
fDisplay.addFilter(SWT.MouseUp, this);
}
}
@@ -123,9 +123,9 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen
if (fDisplay != null && ! fDisplay.isDisposed()) {
fDisplay.removeFilter(SWT.Activate, this);
fDisplay.removeFilter(SWT.MouseWheel, this);
-
+
fDisplay.removeFilter(SWT.Deactivate, this);
-
+
fDisplay.removeFilter(SWT.MouseUp, this);
}
}
@@ -205,7 +205,7 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen
return;
if (event.widget == fShell || event.widget == fTable || event.widget == fScrollbar)
return;
-
+
if (fAdditionalInfoController.getInternalAccessor().getInformationControlReplacer() == null)
fAdditionalInfoController.hideInformationControl();
else if (!fAdditionalInfoController.getInternalAccessor().isReplaceInProgress()) {
@@ -223,7 +223,7 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen
}
}
break;
-
+
case SWT.MouseUp:
if (fAdditionalInfoController == null || fAdditionalInfoController.getInternalAccessor().isReplaceInProgress())
break;
@@ -244,7 +244,7 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen
}
});
}
-
+
// XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=212392 :
control.getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
@@ -255,7 +255,7 @@ class PopupCloser extends ShellAdapter implements FocusListener, SelectionListen
}
}
break;
-
+
case SWT.Deactivate:
if (fAdditionalInfoController == null)
break;
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatterExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatterExtension.java
index 6199c3e1852..51ddb6cd037 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatterExtension.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IContentFormatterExtension.java
@@ -62,7 +62,7 @@ public interface IContentFormatterExtension {
* formatting strategies. For each partition contained in the range to be formatted, the content
* formatter determines its content type and formats the partition with the correct formatting
* strategy.</li>
- *
+ *
* @param document the document to be formatted
* @param context the formatting context to pass to the formatting strategies. This argument
* must not be <code>null</code>.
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingContext.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingContext.java
index 2b35dce5b7e..fa92119d1c7 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingContext.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingContext.java
@@ -18,7 +18,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
/**
* Formatting context used in formatting strategies implementing interface
* <code>IFormattingStrategyExtension</code>.
- *
+ *
* @see IFormattingStrategyExtension
* @since 3.0
*/
@@ -33,14 +33,14 @@ public interface IFormattingContext {
/**
* Returns the preference keys used for the retrieval of formatting preferences.
- *
+ *
* @return The preference keys for formatting
*/
String[] getPreferenceKeys();
/**
* Retrieves the property <code>key</code> from the formatting context
- *
+ *
* @param key the key of the property to store in the context
* @return the property <code>key</code> if available, <code>null</code> otherwise
*/
@@ -48,7 +48,7 @@ public interface IFormattingContext {
/**
* Is this preference key for a boolean preference?
- *
+ *
* @param key the preference key to query its type
* @return <code>true</code> iff this key is for a boolean preference, <code>false</code>
* otherwise.
@@ -57,7 +57,7 @@ public interface IFormattingContext {
/**
* Is this preference key for a double preference?
- *
+ *
* @param key the preference key to query its type
* @return <code>true</code> iff this key is for a double preference, <code>false</code>
* otherwise.
@@ -66,7 +66,7 @@ public interface IFormattingContext {
/**
* Is this preference key for a float preference?
- *
+ *
* @param key The preference key to query its type
* @return <code>true</code> iff this key is for a float preference, <code>false</code>
* otherwise.
@@ -75,7 +75,7 @@ public interface IFormattingContext {
/**
* Is this preference key for an integer preference?
- *
+ *
* @param key The preference key to query its type
* @return <code>true</code> iff this key is for an integer preference, <code>false</code>
* otherwise.
@@ -84,7 +84,7 @@ public interface IFormattingContext {
/**
* Is this preference key for a long preference?
- *
+ *
* @param key The preference key to query its type
* @return <code>true</code> iff this key is for a long preference, <code>false</code>
* otherwise.
@@ -93,7 +93,7 @@ public interface IFormattingContext {
/**
* Is this preference key for a string preference?
- *
+ *
* @param key The preference key to query its type
* @return <code>true</code> iff this key is for a string preference, <code>false</code>
* otherwise.
@@ -106,7 +106,7 @@ public interface IFormattingContext {
* Note that the preference keys returned by {@link #getPreferenceKeys()} must not be used in
* the preference store. Otherwise the preferences are overwritten.
* </p>
- *
+ *
* @param map Map to retrieve the preferences from
* @param store Preference store to store the preferences in
*/
@@ -114,7 +114,7 @@ public interface IFormattingContext {
/**
* Stores the property <code>key</code> in the formatting context.
- *
+ *
* @param key Key of the property to store in the context
* @param property Property to store in the context. If already present, the new property
* overwrites the present one.
@@ -127,7 +127,7 @@ public interface IFormattingContext {
* Note that the preference keys returned by {@link #getPreferenceKeys()} must not be used in
* the map. Otherwise the preferences are overwritten.
* </p>
- *
+ *
* @param store Preference store to retrieve the preferences from
* @param map Map to store the preferences in
* @param useDefault <code>true</code> if the default preferences should be used,
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategyExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategyExtension.java
index 06f97a5dbbf..3f8136252f1 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategyExtension.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/formatter/IFormattingStrategyExtension.java
@@ -45,7 +45,7 @@ public interface IFormattingStrategyExtension {
/**
* Informs the strategy about the start of a formatting process in which it will participate.
- *
+ *
* @param context the formatting context used in the corresponding formatting process.
*/
void formatterStarts(IFormattingContext context);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/AbstractHyperlinkDetector.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/AbstractHyperlinkDetector.java
index 6b0e46fec05..ef4392b1ec1 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/AbstractHyperlinkDetector.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/AbstractHyperlinkDetector.java
@@ -21,7 +21,7 @@ import org.eclipse.core.runtime.IAdaptable;
* <p>
* Clients may subclass.
* </p>
- *
+ *
* @since 3.3
*/
public abstract class AbstractHyperlinkDetector implements IHyperlinkDetector, IHyperlinkDetectorExtension {
@@ -34,7 +34,7 @@ public abstract class AbstractHyperlinkDetector implements IHyperlinkDetector, I
/**
* Sets this hyperlink detector's context which
* is responsible to provide the adapters.
- *
+ *
* @param context the context for this hyperlink detector
* @throws IllegalArgumentException if the context is <code>null</code>
* @throws IllegalStateException if this method is called more than once
@@ -58,7 +58,7 @@ public abstract class AbstractHyperlinkDetector implements IHyperlinkDetector, I
* and provides additional context for this hyperlink detector.
*
* @param adapterClass the adapter class to look up
- * @return an instance that can be cast to the given class,
+ * @return an instance that can be cast to the given class,
* or <code>null</code> if this object does not
* have an adapter for the given class
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/DefaultHyperlinkPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/DefaultHyperlinkPresenter.java
index b56f31ba950..820a5678419 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/DefaultHyperlinkPresenter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/DefaultHyperlinkPresenter.java
@@ -48,7 +48,7 @@ import org.eclipse.jface.text.TextPresentation;
* It can only be used together with the {@link HyperlinkManager#FIRST}
* or the {@link HyperlinkManager#LONGEST_REGION_FIRST} hyperlink strategy.
* </p>
- *
+ *
* @since 3.1
*/
public class DefaultHyperlinkPresenter implements IHyperlinkPresenter, IHyperlinkPresenterExtension, ITextPresentationListener, ITextInputListener, IDocumentListener, IPropertyChangeListener {
@@ -133,7 +133,7 @@ public class DefaultHyperlinkPresenter implements IHyperlinkPresenter, IHyperlin
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public boolean canHideHyperlinks() {
@@ -302,7 +302,7 @@ public class DefaultHyperlinkPresenter implements IHyperlinkPresenter, IHyperlin
fActiveRegion= new Region(event.getOffset(), event.getLength());
}
fRememberedPosition= null;
-
+
StyledText widget= fTextViewer.getTextWidget();
if (widget != null && !widget.isDisposed()) {
widget.getDisplay().asyncExec(new Runnable() {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkManager.java
index 69cc889de8d..7daac7b77e0 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkManager.java
@@ -164,7 +164,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
text.addMouseTrackListener(this);
fTextViewer.addTextListener(this);
-
+
fHyperlinkPresenter.install(fTextViewer);
}
@@ -218,7 +218,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
text.removeMouseTrackListener(this);
}
fTextViewer.removeTextListener(this);
-
+
fHyperlinkPresenter.uninstall();
fHyperlinkPresenter= null;
@@ -236,7 +236,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
/**
* Finds hyperlinks at the current offset.
- *
+ *
* @return the hyperlinks or <code>null</code> if none.
*/
protected IHyperlink[] findHyperlinks() {
@@ -252,7 +252,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
IHyperlinkDetector detector= fHyperlinkDetectors[i];
if (detector == null)
continue;
-
+
if (detector instanceof IHyperlinkDetectorExtension2) {
int stateMask= ((IHyperlinkDetectorExtension2)detector).getStateMask();
if (stateMask != -1 && stateMask != fActiveHyperlinkStateMask)
@@ -299,7 +299,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
/**
* Computes the length of the longest detected hyperlink.
- *
+ *
* @param hyperlinks the list of hyperlinks
* @return the length of the longest detected
*/
@@ -318,7 +318,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
/**
* Returns the current text offset.
- *
+ *
* @return the current text offset
*/
protected int getCurrentTextOffset() {
@@ -336,7 +336,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
Point p= text.getLocationAtOffset(widgetOffset);
if (p.x > relativePosition.x)
widgetOffset--;
-
+
if (fTextViewer instanceof ITextViewerExtension5) {
ITextViewerExtension5 extension= (ITextViewerExtension5)fTextViewer;
return extension.widgetOffset2ModelOffset(widgetOffset);
@@ -440,14 +440,14 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
if (!((IHyperlinkPresenterExtension)fHyperlinkPresenter).canHideHyperlinks())
return;
}
-
+
if (!isRegisteredStateMask(event.stateMask)) {
if (fActive)
deactivate();
-
+
return;
}
-
+
fActive= true;
fActiveHyperlinkStateMask= event.stateMask;
@@ -474,7 +474,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
/**
* Checks whether the given state mask is registered.
- *
+ *
* @param stateMask the state mask
* @return <code>true</code> if a detector is registered for the given state mask
* @since 3.3
@@ -482,7 +482,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
private boolean isRegisteredStateMask(int stateMask) {
if (stateMask == fHyperlinkStateMask)
return true;
-
+
synchronized (fHyperlinkDetectors) {
for (int i= 0; i < fHyperlinkDetectors.length; i++) {
if (fHyperlinkDetectors[i] instanceof IHyperlinkDetectorExtension2) {
@@ -493,7 +493,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
}
return false;
}
-
+
/*
* @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
*/
@@ -514,7 +514,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
//key up
deactivate();
}
-
+
/*
* @see org.eclipse.jface.text.ITextListener#textChanged(TextEvent)
* @since 3.2
@@ -526,7 +526,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public void mouseExit(MouseEvent e) {
@@ -539,7 +539,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public void mouseEnter(MouseEvent e) {
@@ -547,7 +547,7 @@ public class HyperlinkManager implements ITextListener, Listener, KeyListener, M
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public void mouseHover(MouseEvent e) {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkMessages.java
index 137ee8d6982..f957f410dd6 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkMessages.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/HyperlinkMessages.java
@@ -16,20 +16,20 @@ import java.util.ResourceBundle;
/**
* Helper class to get NLSed messages.
- *
+ *
* @since 3.4
*/
class HyperlinkMessages {
private static final String BUNDLE_NAME= HyperlinkMessages.class.getName();
-
+
private static final ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME);
-
+
private HyperlinkMessages() {
}
/**
* Gets a string from the resource bundle.
- *
+ *
* @param key the string used to get the bundle value, must not be
* <code>null</code>
* @return the string from the resource bundle
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension.java
index 8c995db0df8..e4b408eacfd 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension.java
@@ -17,7 +17,7 @@ package org.eclipse.jface.text.hyperlink;
* <p>
* Clients may implement this interface.
* </p>
- *
+ *
* @since 3.3
*/
public interface IHyperlinkDetectorExtension {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension2.java
index 55bbab80d0b..1a7816cc4b0 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension2.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkDetectorExtension2.java
@@ -18,7 +18,7 @@ package org.eclipse.jface.text.hyperlink;
* <p>
* Clients may implement this interface.
* </p>
- *
+ *
* @since 3.3
*/
public interface IHyperlinkDetectorExtension2 {
@@ -26,7 +26,7 @@ public interface IHyperlinkDetectorExtension2 {
/**
* Returns the state mask of the modifier keys that
* need to be pressed for this hyperlink detector.
- *
+ *
* @return the state mask
*/
int getStateMask();
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkPresenterExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkPresenterExtension.java
index cad1dd4c955..a655107846e 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkPresenterExtension.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/IHyperlinkPresenterExtension.java
@@ -18,7 +18,7 @@ package org.eclipse.jface.text.hyperlink;
* <p>
* Clients may implement this interface.
* </p>
- *
+ *
* @since 3.4
*/
public interface IHyperlinkPresenterExtension {
@@ -26,7 +26,7 @@ public interface IHyperlinkPresenterExtension {
/**
* Tells whether the currently shown hyperlinks
* can be hidden.
- *
+ *
* @return <code>true</code> if the hyperlink manager can hide the current hyperlinks
*/
boolean canHideHyperlinks();
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/MultipleHyperlinkPresenter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/MultipleHyperlinkPresenter.java
index 53d1d62839e..742c15322af 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/MultipleHyperlinkPresenter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/MultipleHyperlinkPresenter.java
@@ -64,40 +64,40 @@ import org.eclipse.jface.text.Region;
/**
* A hyperlink presenter capable of showing multiple hyperlinks in a hover.
- *
+ *
* @since 3.4
*/
public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
-
+
private static final boolean IS_WIN32= "win32".equals(SWT.getPlatform()); //$NON-NLS-1$
-
+
/**
* An information control capable of showing a list of hyperlinks. The hyperlinks can be opened.
*/
private static class LinkListInformationControl extends AbstractInformationControl implements IInformationControlExtension2 {
-
+
private static final class LinkContentProvider implements IStructuredContentProvider {
-
+
/*
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
public Object[] getElements(Object inputElement) {
return (Object[]) inputElement;
}
-
+
/*
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
public void dispose() {
}
-
+
/*
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}
-
+
private static final class LinkLabelProvider extends ColumnLabelProvider {
/*
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
@@ -110,17 +110,17 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
return HyperlinkMessages.getString("LinkListInformationControl.unknownLink"); //$NON-NLS-1$
}
}
-
+
private final MultipleHyperlinkHoverManager fManager;
-
+
private IHyperlink[] fInput;
private Composite fParent;
private Table fTable;
private Color fForegroundColor;
private Color fBackgroundColor;
-
-
+
+
/**
* Creates a link list information control with the given shell as parent.
*
@@ -136,14 +136,14 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
fBackgroundColor= backgroundColor;
create();
}
-
+
/*
* @see org.eclipse.jface.text.IInformationControl#setInformation(java.lang.String)
*/
public void setInformation(String information) {
//replaced by IInformationControlExtension2#setInput(java.lang.Object)
}
-
+
/*
* @see org.eclipse.jface.text.IInformationControlExtension2#setInput(java.lang.Object)
*/
@@ -151,7 +151,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
fInput= (IHyperlink[]) input;
deferredCreateContent(fParent);
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControl#createContent(org.eclipse.swt.widgets.Composite)
*/
@@ -166,40 +166,40 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
fParent.setForeground(fForegroundColor);
fParent.setBackground(fBackgroundColor);
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControl#computeSizeHint()
*/
public Point computeSizeHint() {
Point preferedSize= getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
-
+
Point constraints= getSizeConstraints();
if (constraints == null)
return preferedSize;
-
+
if (fTable.getVerticalBar() == null || fTable.getHorizontalBar() == null)
return Geometry.min(constraints, preferedSize);
-
+
int scrollBarWidth= fTable.getVerticalBar().getSize().x;
int scrollBarHeight= fTable.getHorizontalBar().getSize().y;
-
+
int width;
if (preferedSize.y - scrollBarHeight <= constraints.y) {
width= preferedSize.x - scrollBarWidth;
} else {
width= Math.min(preferedSize.x, constraints.x);
}
-
+
int height;
if (preferedSize.x - scrollBarWidth <= constraints.x) {
height= preferedSize.y - scrollBarHeight;
} else {
height= Math.min(preferedSize.y, constraints.y);
}
-
+
return new Point(width, height);
}
-
+
private void deferredCreateContent(Composite parent) {
fTable= new Table(parent, SWT.SINGLE | SWT.FULL_SELECTION);
fTable.setLinesVisible(false);
@@ -217,11 +217,11 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
viewer.setLabelProvider(new LinkLabelProvider());
viewer.setInput(fInput);
fTable.setSelection(0);
-
+
registerTableListeners();
-
+
getShell().addShellListener(new ShellAdapter() {
-
+
/*
* @see org.eclipse.swt.events.ShellAdapter#shellActivated(org.eclipse.swt.events.ShellEvent)
*/
@@ -229,17 +229,17 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
if (viewer.getTable().getSelectionCount() == 0) {
viewer.getTable().setSelection(0);
}
-
+
viewer.getTable().setFocus();
}
});
}
-
+
private void registerTableListeners() {
-
+
fTable.addMouseMoveListener(new MouseMoveListener() {
TableItem fLastItem= null;
-
+
public void mouseMove(MouseEvent e) {
if (fTable.equals(e.getSource())) {
Object o= fTable.getItem(new Point(e.x, e.y));
@@ -267,21 +267,21 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
}
}
});
-
+
fTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
openSelectedLink();
}
});
-
+
fTable.addMouseListener(new MouseAdapter() {
public void mouseUp(MouseEvent e) {
if (fTable.getSelectionCount() < 1)
return;
-
+
if (e.button != 1)
return;
-
+
if (fTable.equals(e.getSource())) {
Object o= fTable.getItem(new Point(e.x, e.y));
TableItem selection= fTable.getSelection()[0];
@@ -290,7 +290,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
}
}
});
-
+
fTable.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.keyCode == 0x0D) // return
@@ -298,7 +298,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
}
});
}
-
+
/*
* @see org.eclipse.jface.text.IInformationControlExtension#hasContents()
*/
@@ -316,7 +316,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
link.open();
}
}
-
+
private class MultipleHyperlinkHover implements ITextHover, ITextHoverExtension, ITextHoverExtension2 {
/**
@@ -334,14 +334,14 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
return fSubjectRegion;
}
-
+
/*
* @see org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
*/
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
return fHyperlinks;
}
-
+
/*
* @see org.eclipse.jface.text.ITextHoverExtension#getHoverControlCreator()
*/
@@ -355,36 +355,36 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
};
}
}
-
+
private static class MultipleHyperlinkHoverManager extends AbstractInformationControlManager implements IWidgetTokenKeeper, IWidgetTokenKeeperExtension {
-
+
private class Closer implements IInformationControlCloser, Listener, KeyListener {
-
+
private Control fSubjectControl;
private Display fDisplay;
private IInformationControl fControl;
private Rectangle fSubjectArea;
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#setInformationControl(org.eclipse.jface.text.IInformationControl)
*/
public void setInformationControl(IInformationControl control) {
fControl= control;
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#setSubjectControl(org.eclipse.swt.widgets.Control)
*/
public void setSubjectControl(Control subject) {
fSubjectControl= subject;
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#start(org.eclipse.swt.graphics.Rectangle)
*/
public void start(Rectangle subjectArea) {
fSubjectArea= subjectArea;
-
+
fDisplay= fSubjectControl.getDisplay();
if (!fDisplay.isDisposed()) {
fDisplay.addFilter(SWT.FocusOut, this);
@@ -392,7 +392,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
fTextViewer.getTextWidget().addKeyListener(this);
}
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager.IInformationControlCloser#stop()
*/
@@ -402,10 +402,10 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
fDisplay.removeFilter(SWT.MouseMove, this);
fTextViewer.getTextWidget().removeKeyListener(this);
}
-
+
fSubjectArea= null;
}
-
+
/*
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
*/
@@ -420,41 +420,41 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
break;
}
}
-
+
/**
* Handle mouse movement events.
- *
+ *
* @param event the event
*/
private void handleMouseMove(Event event) {
if (!(event.widget instanceof Control))
return;
-
+
if (fControl.isFocusControl())
return;
-
+
Control eventControl= (Control) event.widget;
-
+
//transform coordinates to subject control:
Point mouseLoc= event.display.map(eventControl, fSubjectControl, event.x, event.y);
-
+
if (fSubjectArea.contains(mouseLoc))
return;
-
+
if (inKeepUpZone(mouseLoc.x, mouseLoc.y, ((IInformationControlExtension3) fControl).getBounds()))
return;
-
+
hideInformationControl();
}
-
+
/**
* Tests whether a given mouse location is within the keep-up zone.
* The hover should not be hidden as long as the mouse stays inside this zone.
- *
+ *
* @param x the x coordinate, relative to the <em>subject control</em>
* @param y the y coordinate, relative to the <em>subject control</em>
* @param controlBounds the bounds of the current control
- *
+ *
* @return <code>true</code> iff the mouse event occurred in the keep-up zone
*/
private boolean inKeepUpZone(int x, int y, Rectangle controlBounds) {
@@ -467,23 +467,23 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
// +--------------------+
if (fSubjectArea.contains(x, y))
return true;
-
+
Rectangle iControlBounds= fSubjectControl.getDisplay().map(null, fSubjectControl, controlBounds);
Rectangle totalBounds= Geometry.copy(iControlBounds);
if (totalBounds.contains(x, y))
return true;
-
+
int keepUpY= fSubjectArea.y + fSubjectArea.height;
Rectangle alsoKeepUp= new Rectangle(fSubjectArea.x, keepUpY, fSubjectArea.width, totalBounds.y - keepUpY);
return alsoKeepUp.contains(x, y);
}
-
+
/*
* @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
*/
public void keyPressed(KeyEvent e) {
}
-
+
/*
* @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
*/
@@ -492,41 +492,41 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
}
}
-
+
/**
* Priority of the hover managed by this manager.
* Default value: One higher then for the hovers
* managed by TextViewerHoverManager.
*/
private static final int WIDGET_TOKEN_PRIORITY= 1;
-
+
private final MultipleHyperlinkHover fHover;
private final ITextViewer fTextViewer;
private final MultipleHyperlinkPresenter fHyperlinkPresenter;
private Closer fCloser;
private boolean fIsControlVisible;
-
+
/**
* Create a new MultipleHyperlinkHoverManager. The MHHM can show and hide
* the given MultipleHyperlinkHover inside the given ITextViewer.
- *
+ *
* @param hover the hover to manage
* @param viewer the viewer to show the hover in
* @param hyperlinkPresenter the hyperlink presenter using this manager to present hyperlinks
*/
public MultipleHyperlinkHoverManager(MultipleHyperlinkHover hover, ITextViewer viewer, MultipleHyperlinkPresenter hyperlinkPresenter) {
super(hover.getHoverControlCreator());
-
+
fHover= hover;
fTextViewer= viewer;
fHyperlinkPresenter= hyperlinkPresenter;
-
+
fCloser= new Closer();
setCloser(fCloser);
fIsControlVisible= false;
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#computeInformation()
*/
@@ -536,32 +536,32 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
setInformation(null, null);
return;
}
-
+
Rectangle area= JFaceTextUtil.computeArea(region, fTextViewer);
if (area == null || area.isEmpty()) {
setInformation(null, null);
return;
}
-
+
Object information= fHover.getHoverInfo2(fTextViewer, region);
setCustomInformationControlCreator(fHover.getHoverControlCreator());
setInformation(information, area);
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#computeInformationControlLocation(org.eclipse.swt.graphics.Rectangle, org.eclipse.swt.graphics.Point)
*/
protected Point computeInformationControlLocation(Rectangle subjectArea, Point controlSize) {
Point result= super.computeInformationControlLocation(subjectArea, controlSize);
-
+
Point cursorLocation= fTextViewer.getTextWidget().getDisplay().getCursorLocation();
if (cursorLocation.x <= result.x + controlSize.x)
return result;
-
+
result.x= cursorLocation.x + 20 - controlSize.x;
return result;
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#showInformationControl(org.eclipse.swt.graphics.Rectangle)
*/
@@ -575,38 +575,38 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
} else {
super.showInformationControl(subjectArea);
}
-
+
fIsControlVisible= true;
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#hideInformationControl()
*/
protected void hideInformationControl() {
super.hideInformationControl();
-
+
if (fTextViewer instanceof IWidgetTokenOwner) {
((IWidgetTokenOwner) fTextViewer).releaseWidgetToken(this);
}
-
+
fIsControlVisible= false;
fHyperlinkPresenter.hideHyperlinks();
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#disposeInformationControl()
*/
public void disposeInformationControl() {
super.disposeInformationControl();
-
+
if (fTextViewer instanceof IWidgetTokenOwner) {
((IWidgetTokenOwner) fTextViewer).releaseWidgetToken(this);
}
-
+
fIsControlVisible= false;
fHyperlinkPresenter.hideHyperlinks();
}
-
+
/*
* @see org.eclipse.jface.text.IWidgetTokenKeeper#requestWidgetToken(org.eclipse.jface.text.IWidgetTokenOwner)
*/
@@ -614,42 +614,42 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
hideInformationControl();
return true;
}
-
+
/*
* @see org.eclipse.jface.text.IWidgetTokenKeeperExtension#requestWidgetToken(org.eclipse.jface.text.IWidgetTokenOwner, int)
*/
public boolean requestWidgetToken(IWidgetTokenOwner owner, int priority) {
if (priority < WIDGET_TOKEN_PRIORITY)
return false;
-
+
hideInformationControl();
return true;
}
-
+
/*
* @see org.eclipse.jface.text.IWidgetTokenKeeperExtension#setFocus(org.eclipse.jface.text.IWidgetTokenOwner)
*/
public boolean setFocus(IWidgetTokenOwner owner) {
return false;
}
-
+
/**
* Returns <code>true</code> if the information control managed by
* this manager is visible, <code>false</code> otherwise.
- *
+ *
* @return <code>true</code> if information control is visible
*/
public boolean isInformationControlVisible() {
return fIsControlVisible;
}
}
-
+
private ITextViewer fTextViewer;
-
+
private IHyperlink[] fHyperlinks;
private Region fSubjectRegion;
private MultipleHyperlinkHoverManager fManager;
-
+
/**
* Creates a new multiple hyperlink presenter which uses
* {@link #HYPERLINK_COLOR} to read the color from the given preference store.
@@ -659,7 +659,7 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
public MultipleHyperlinkPresenter(IPreferenceStore store) {
super(store);
}
-
+
/**
* Creates a new multiple hyperlink presenter.
*
@@ -668,55 +668,55 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
public MultipleHyperlinkPresenter(RGB color) {
super(color);
}
-
+
/*
* @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#install(org.eclipse.jface.text.ITextViewer)
*/
public void install(ITextViewer viewer) {
super.install(viewer);
fTextViewer= viewer;
-
+
fManager= new MultipleHyperlinkHoverManager(new MultipleHyperlinkHover(), fTextViewer, this);
fManager.install(viewer.getTextWidget());
fManager.setSizeConstraints(100, 12, false, true);
}
-
+
/*
* @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#uninstall()
*/
public void uninstall() {
super.uninstall();
-
+
if (fTextViewer != null) {
fManager.dispose();
-
+
fTextViewer= null;
}
}
-
+
/*
* @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#canShowMultipleHyperlinks()
*/
public boolean canShowMultipleHyperlinks() {
return true;
}
-
+
/*
* @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#canHideHyperlinks()
*/
public boolean canHideHyperlinks() {
return !fManager.isInformationControlVisible();
}
-
+
/*
* @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#hideHyperlinks()
*/
public void hideHyperlinks() {
super.hideHyperlinks();
-
+
fHyperlinks= null;
}
-
+
/*
* @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter#showHyperlinks(org.eclipse.jface.text.hyperlink.IHyperlink[])
*/
@@ -725,23 +725,23 @@ public class MultipleHyperlinkPresenter extends DefaultHyperlinkPresenter {
fSubjectRegion= null;
fHyperlinks= hyperlinks;
-
+
if (hyperlinks.length == 1)
return;
-
+
int start= hyperlinks[0].getHyperlinkRegion().getOffset();
int end= start + hyperlinks[0].getHyperlinkRegion().getLength();
-
+
for (int i= 1; i < hyperlinks.length; i++) {
int hstart= hyperlinks[i].getHyperlinkRegion().getOffset();
int hend= hstart + hyperlinks[i].getHyperlinkRegion().getLength();
-
+
start= Math.min(start, hstart);
end= Math.max(end, hend);
}
-
+
fSubjectRegion= new Region(start, end - start);
-
+
fManager.showInformation();
}
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlink.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlink.java
index 063e8e11384..8b032893fb2 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlink.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlink.java
@@ -31,7 +31,7 @@ public class URLHyperlink implements IHyperlink {
/**
* Creates a new URL hyperlink.
- *
+ *
* @param region the region
* @param urlString the URL string
*/
@@ -76,7 +76,7 @@ public class URLHyperlink implements IHyperlink {
/**
* Returns the URL string of this hyperlink.
- *
+ *
* @return the URL string
* @since 3.2
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java
index ce6a231304a..17da07900e5 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java
@@ -37,7 +37,7 @@ public class URLHyperlinkDetector extends AbstractHyperlinkDetector {
*/
public URLHyperlinkDetector() {
}
-
+
/**
* Creates a new URL hyperlink detector.
*
@@ -76,7 +76,7 @@ public class URLHyperlinkDetector extends AbstractHyperlinkDetector {
boolean startDoubleQuote= false;
int urlOffsetInLine= 0;
int urlLength= 0;
-
+
int urlSeparatorOffset= line.indexOf("://"); //$NON-NLS-1$
while (urlSeparatorOffset >= 0) {
@@ -100,10 +100,10 @@ public class URLHyperlinkDetector extends AbstractHyperlinkDetector {
urlLength= tokenizer.nextToken().length() + 3 + urlSeparatorOffset - urlOffsetInLine;
if (offsetInLine >= urlOffsetInLine && offsetInLine <= urlOffsetInLine + urlLength)
break;
-
+
urlSeparatorOffset= line.indexOf("://", urlSeparatorOffset + 1); //$NON-NLS-1$
}
-
+
if (urlSeparatorOffset < 0)
return null;
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenterExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenterExtension.java
index 43765bb6ddd..a78229ade78 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenterExtension.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/information/IInformationPresenterExtension.java
@@ -15,7 +15,7 @@ package org.eclipse.jface.text.information;
* the ability to handle documents with multiple partitions.
*
* @see org.eclipse.jface.text.information.IInformationPresenter
- *
+ *
* @since 3.0
*/
public interface IInformationPresenterExtension {
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
index 09ad827f4e4..2030138ddff 100644
--- 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
@@ -13,8 +13,6 @@ package org.eclipse.jface.text.information;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
@@ -29,6 +27,8 @@ import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.core.runtime.Assert;
+
import org.eclipse.jface.text.AbstractInformationControlManager;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocumentExtension3;
@@ -344,7 +344,7 @@ public class InformationPresenter extends AbstractInformationControlManager impl
// backward compatibility code
info= provider.getInformation(fTextViewer, subject);
}
-
+
if (provider instanceof IInformationProviderExtension2)
setCustomInformationControlCreator(((IInformationProviderExtension2) provider).getInformationPresenterControlCreator());
else
@@ -369,7 +369,7 @@ public class InformationPresenter extends AbstractInformationControlManager impl
start= widgetRegion.getOffset();
end= widgetRegion.getOffset() + widgetRegion.getLength();
}
-
+
StyledText styledText= fTextViewer.getTextWidget();
Rectangle bounds;
if (end > 0 && start < end)
@@ -378,7 +378,7 @@ public class InformationPresenter extends AbstractInformationControlManager impl
Point loc= styledText.getLocationAtOffset(start);
bounds= new Rectangle(loc.x, loc.y, 0, styledText.getLineHeight(start));
}
-
+
return bounds;
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedModeUI.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedModeUI.java
index 42897d7943e..64533a67572 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedModeUI.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedModeUI.java
@@ -624,8 +624,8 @@ public class LinkedModeUI {
}
};
-
-
+
+
/** Whether this UI is in simple highlighting mode or not. */
private boolean fSimple;
@@ -985,7 +985,7 @@ public class LinkedModeUI {
final StyledText widget= fCurrentTarget.fWidget;
if (widget == null || widget.isDisposed())
return;
-
+
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=132263
widget.getDisplay().asyncExec(new Runnable() {
public void run() {
@@ -1048,7 +1048,7 @@ public class LinkedModeUI {
/**
* Returns all possible content types of <code>document</code>.
- *
+ *
* @param document the document
* @return all possible content types of <code>document</code>
* @throws BadPartitioningException if partitioning is invalid for this document
@@ -1067,7 +1067,7 @@ public class LinkedModeUI {
}
return document.getLegalContentTypes();
}
-
+
private void createAnnotationModel() {
if (fCurrentTarget.fAnnotationModel == null) {
LinkedPositionAnnotations lpa= new LinkedPositionAnnotations();
@@ -1286,7 +1286,7 @@ public class LinkedModeUI {
* Enables the support for colored labels in the proposal popup.
* <p>Completion proposals can implement {@link ICompletionProposalExtension6}
* to provide colored proposal labels.</p>
- *
+ *
* @param isEnabled if <code>true</code> the support for colored labels is enabled in the proposal popup
* @since 3.4
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedPositionAnnotations.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedPositionAnnotations.java
index 6a6d9d8de2f..32609cd84e2 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedPositionAnnotations.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/LinkedPositionAnnotations.java
@@ -161,7 +161,7 @@ final class LinkedPositionAnnotations extends AnnotationModel {
* Switches the focus position to <code>position</code> given the
* <code>LinkedModeModel env</code>. The slave positions for <code>position</code> is extracted
* from the environment and set accordingly, the target positions are updated as well.
- *
+ *
* @param env the linked mode model
* @param position the linked position
*/
@@ -235,7 +235,7 @@ final class LinkedPositionAnnotations extends AnnotationModel {
/**
* Sets the target positions.
- *
+ *
* @param positions an array of positions
*/
public void setTargets(Position[] positions) {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/TabStopIterator.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/TabStopIterator.java
index 7031fe36f6e..bdf20e7a7c5 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/link/TabStopIterator.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/link/TabStopIterator.java
@@ -20,7 +20,6 @@ import java.util.NoSuchElementException;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.link.LinkedPosition;
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
index 3db127c051b..aa409fe65e7 100644
--- 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
@@ -356,7 +356,7 @@ public class PresentationReconciler implements IPresentationReconciler, IPresent
fViewer= viewer;
fViewer.addTextInputListener(fInternalListener);
-
+
IDocument document= viewer.getDocument();
if (document != null)
fInternalListener.inputDocumentChanged(null, document);
@@ -476,7 +476,7 @@ public class PresentationReconciler implements IPresentationReconciler, IPresent
*/
private IRegion getDamage(DocumentEvent e, boolean optimize) {
int length= e.getText() == null ? 0 : e.getText().length();
-
+
if (fDamagers == null || fDamagers.isEmpty()) {
length= Math.max(e.getLength(), length);
length= Math.min(e.getDocument().getLength() - e.getOffset(), length);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistant.java
index 041a89a3301..f566c353a4c 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistant.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistant.java
@@ -86,7 +86,7 @@ import org.eclipse.jface.text.source.ISourceViewerExtension3;
* @return an optional error message if no proposals can be computed
*/
String showPossibleQuickAssists();
-
+
/**
* Registers a given quick assist processor for a particular content type. If there is already
* a processor registered, the new processor is registered instead of the old one.
@@ -95,34 +95,34 @@ import org.eclipse.jface.text.source.ISourceViewerExtension3;
* an existing one
*/
void setQuickAssistProcessor(IQuickAssistProcessor processor);
-
+
/**
* Returns the quick assist processor to be used for the given content type.
*
* @return the quick assist processor or <code>null</code> if none exists
*/
IQuickAssistProcessor getQuickAssistProcessor();
-
+
/**
* Tells whether this assistant has a fix for the given annotation.
* <p>
* <strong>Note:</strong> This test must be fast and optimistic i.e. it is OK to return
* <code>true</code> even though there might be no quick fix.
* </p>
- *
+ *
* @param annotation the annotation
* @return <code>true</code> if the assistant has a fix for the given annotation
*/
boolean canFix(Annotation annotation);
-
+
/**
* Tells whether this assistant has assists for the given invocation context.
- *
+ *
* @param invocationContext the invocation context
* @return <code>true</code> if the assistant has a fix for the given annotation
*/
boolean canAssist(IQuickAssistInvocationContext invocationContext);
-
+
/**
* Sets the proposal selector's background color.
* <p>
@@ -144,34 +144,34 @@ import org.eclipse.jface.text.source.ISourceViewerExtension3;
* @param foreground the foreground color
*/
void setProposalSelectorForeground(Color foreground);
-
+
/**
* Adds a completion listener that will be informed before proposals are computed.
- *
+ *
* @param listener the listener
*/
void addCompletionListener(ICompletionListener listener);
/**
* Removes a completion listener.
- *
+ *
* @param listener the listener to remove
*/
void removeCompletionListener(ICompletionListener listener);
-
+
/**
* Enables displaying a status line below the proposal popup. The default is not to show the
* status line. The contents of the status line may be set via {@link #setStatusMessage(String)}.
- *
+ *
* @param show <code>true</code> to show a message line, <code>false</code> to not show one.
*/
public void setStatusLineVisible(boolean show);
/**
* Sets the caption message displayed at the bottom of the completion proposal popup.
- *
+ *
* @param message the message
*/
public void setStatusMessage(String message);
-
+
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistantExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistantExtension.java
index ac4acfeac7a..53cb7bd5332 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistantExtension.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistAssistantExtension.java
@@ -21,7 +21,7 @@ import org.eclipse.jface.text.contentassist.ICompletionProposalExtension6;
* <li>allows to get a handler for the given command identifier</li>
* <li>allows to enable support for colored labels in the proposal popup</li>
* </ul>
- *
+ *
* @since 3.4
*/
public interface IQuickAssistAssistantExtension {
@@ -32,7 +32,7 @@ public interface IQuickAssistAssistantExtension {
* The same handler instance will be returned when called a more than once
* with the same command identifier.
* </p>
- *
+ *
* @param commandId the command identifier
* @return the handler for the given command identifier
* @throws IllegalArgumentException if the command is not supported by this
@@ -46,7 +46,7 @@ public interface IQuickAssistAssistantExtension {
* Enables the support for colored labels in the proposal popup.
* <p>Completion proposals can implement {@link ICompletionProposalExtension6}
* to provide colored proposal labels.</p>
- *
+ *
* @param isEnabled if <code>true</code> the support for colored labels is enabled in the proposal popup
* @since 3.4
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistInvocationContext.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistInvocationContext.java
index f830d5ece20..bd7ab4f623b 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistInvocationContext.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistInvocationContext.java
@@ -17,28 +17,28 @@ import org.eclipse.jface.text.source.ISourceViewer;
* Context information for quick fix and quick assist processors.
* <p>
* This interface can be implemented by clients.</p>
- *
+ *
* @since 3.2
*/
public interface IQuickAssistInvocationContext {
/**
* Returns the offset where quick assist was invoked.
- *
+ *
* @return the invocation offset or <code>-1</code> if unknown
*/
int getOffset();
/**
* Returns the length of the selection at the invocation offset.
- *
+ *
* @return the length of the current selection or <code>-1</code> if none or unknown
*/
int getLength();
-
+
/**
* Returns the viewer for this context.
- *
+ *
* @return the viewer or <code>null</code> if not available
*/
ISourceViewer getSourceViewer();
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistProcessor.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistProcessor.java
index 2ed8679588d..bef2c582577 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistProcessor.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickAssistProcessor.java
@@ -22,7 +22,7 @@ import org.eclipse.jface.text.source.Annotation;
* </p>
* <p>
* This interface can be implemented by clients.</p>
- *
+ *
* @since 3.2
*/
public interface IQuickAssistProcessor {
@@ -41,20 +41,20 @@ public interface IQuickAssistProcessor {
* <strong>Note:</strong> This test must be fast and optimistic i.e. it is OK to return
* <code>true</code> even though there might be no quick fix.
* </p>
- *
+ *
* @param annotation the annotation
* @return <code>true</code> if the assistant has a fix for the given annotation
*/
boolean canFix(Annotation annotation);
-
+
/**
* Tells whether this assistant has assists for the given invocation context.
- *
+ *
* @param invocationContext the invocation context
* @return <code>true</code> if the assistant has a fix for the given annotation
*/
boolean canAssist(IQuickAssistInvocationContext invocationContext);
-
+
/**
* Returns a list of quick assist and quick fix proposals for the
* given invocation context.
@@ -63,5 +63,5 @@ public interface IQuickAssistProcessor {
* @return an array of completion proposals or <code>null</code> if no proposals are available
*/
ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext);
-
+
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickFixableAnnotation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickFixableAnnotation.java
index dfecd8fc484..a2ade54c122 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickFixableAnnotation.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/IQuickFixableAnnotation.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.text.source.Annotation;
* </p>
* <p>
* This interface can be implemented by clients.</p>
- *
+ *
* @since 3.2
*/
public interface IQuickFixableAnnotation {
@@ -33,7 +33,7 @@ public interface IQuickFixableAnnotation {
/**
* Sets whether there are quick fixes available for
* this annotation.
- *
+ *
* @param state <code>true</code> if there are quick fixes available, false otherwise
*/
void setQuickFixable(boolean state);
@@ -45,7 +45,7 @@ public interface IQuickFixableAnnotation {
* called at least once but it can also be hard-coded, e.g. always
* return <code>true</code>.
* </p>
- *
+ *
* @return <code>true</code> if the state has been set
*/
boolean isQuickFixableStateSet();
@@ -55,7 +55,7 @@ public interface IQuickFixableAnnotation {
* <p>
* <strong>Note:</strong> This method must only be called
* if {@link #isQuickFixableStateSet()} returns <code>true</code>.</p>
- *
+ *
* @return <code>true</code> if this annotation offers quick fixes
* @throws AssertionFailedException if called when {@link #isQuickFixableStateSet()} is <code>false</code>
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java
index fafcf76e677..7f81993b8cf 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/quickassist/QuickAssistAssistant.java
@@ -30,12 +30,12 @@ import org.eclipse.jface.text.source.TextInvocationContext;
/**
* Default implementation of <code>IQuickAssistAssistant</code>.
- *
+ *
* @since 3.2
*/
public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssistAssistantExtension {
-
-
+
+
private static final class QuickAssistAssistantImpl extends ContentAssistant {
/*
* @see org.eclipse.jface.text.contentassist.ContentAssistant#possibleCompletionsClosed()
@@ -43,7 +43,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist
public void possibleCompletionsClosed() {
super.possibleCompletionsClosed();
}
-
+
/*
* @see org.eclipse.jface.text.contentassist.ContentAssistant#hide()
* @since 3.4
@@ -53,7 +53,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist
}
}
-
+
private static final class ContentAssistProcessor implements IContentAssistProcessor {
private IQuickAssistProcessor fQuickAssistProcessor;
@@ -61,7 +61,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist
ContentAssistProcessor(IQuickAssistProcessor processor) {
fQuickAssistProcessor= processor;
}
-
+
/*
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
*/
@@ -69,7 +69,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist
// panic code - should not happen
if (!(viewer instanceof ISourceViewer))
return null;
-
+
return fQuickAssistProcessor.computeQuickAssistProposals(new TextInvocationContext((ISourceViewer)viewer, offset, -1));
}
@@ -107,12 +107,12 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist
public IContextInformationValidator getContextInformationValidator() {
return null;
}
-
+
}
-
+
private QuickAssistAssistantImpl fQuickAssistAssistantImpl;
private IQuickAssistProcessor fQuickAssistProcessor;
-
+
public QuickAssistAssistant() {
fQuickAssistAssistantImpl= new QuickAssistAssistantImpl();
fQuickAssistAssistantImpl.enableAutoActivation(false);
@@ -169,21 +169,21 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist
public void setInformationControlCreator(IInformationControlCreator creator) {
fQuickAssistAssistantImpl.setInformationControlCreator(creator);
}
-
+
/*
* @see org.eclipse.jface.text.quickassist.IQuickAssistAssistant#uninstall()
*/
public void uninstall() {
fQuickAssistAssistantImpl.uninstall();
}
-
+
/*
* @see org.eclipse.jface.text.quickassist.IQuickAssistAssistant#setProposalSelectorBackground(org.eclipse.swt.graphics.Color)
*/
public void setProposalSelectorBackground(Color background) {
fQuickAssistAssistantImpl.setProposalSelectorBackground(background);
}
-
+
/*
* @see org.eclipse.jface.text.quickassist.IQuickAssistAssistant#setProposalSelectorForeground(org.eclipse.swt.graphics.Color)
*/
@@ -218,7 +218,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist
*/
public void setStatusLineVisible(boolean show) {
fQuickAssistAssistantImpl.setStatusLineVisible(show);
-
+
}
/*
@@ -227,10 +227,10 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist
public void setStatusMessage(String message) {
fQuickAssistAssistantImpl.setStatusMessage(message);
}
-
+
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public final IHandler getHandler(String commandId) {
@@ -248,7 +248,7 @@ public class QuickAssistAssistant implements IQuickAssistAssistant, IQuickAssist
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public void enableColoredLabels(boolean isEnabled) {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconcileStep.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconcileStep.java
index 6e74f3d4198..fd082423f95 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconcileStep.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconcileStep.java
@@ -18,7 +18,6 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
/**
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
index 8df31cc937b..bfdb539656c 100644
--- 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
@@ -380,7 +380,7 @@ abstract public class AbstractReconciler implements IReconciler {
public void setIsIncrementalReconciler(boolean isIncremental) {
fIsIncrementalReconciler= isIncremental;
}
-
+
/**
* Tells the reconciler whether it is allowed to change the document
* inside its reconciler thread.
@@ -509,11 +509,11 @@ abstract public class AbstractReconciler implements IReconciler {
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));
@@ -554,7 +554,7 @@ abstract public class AbstractReconciler implements IReconciler {
if (fThread.isActive())
fProgressMonitor.setCanceled(true);
-
+
if (fIsIncrementalReconciler) {
DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), fDocument.get());
createDirtyRegion(e);
@@ -591,11 +591,11 @@ abstract public class AbstractReconciler implements IReconciler {
*/
protected void reconcilerReset() {
}
-
+
/**
* Tells whether the code is running in this reconciler's
* background thread.
- *
+ *
* @return <code>true</code> if running in this reconciler's background thread
* @since 3.4
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcileStep.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcileStep.java
index 681da8cc37b..c22cbcca508 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcileStep.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/IReconcileStep.java
@@ -13,7 +13,6 @@ package org.eclipse.jface.text.reconciler;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
/**
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionListener.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionListener.java
index 9350d002191..480800d6c3f 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionListener.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionListener.java
@@ -11,7 +11,7 @@
package org.eclipse.jface.text.revisions;
-/**
+/**
* A listener which is notified when revision information changes.
*
* @see RevisionInformation
@@ -23,7 +23,7 @@ public interface IRevisionListener {
* Notifies the receiver that the revision information has been updated. This typically occurs
* when revision information is being displayed in an editor and the annotated document is
* modified.
- *
+ *
* @param e the revision event describing the change
*/
void revisionInformationChanged(RevisionEvent e);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumn.java
index be09f12631b..e06088cc96b 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumn.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumn.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.text.source.IVerticalRulerInfoExtension;
* version 3.3 allowing to register a selection listener on revisions and a configurable rendering mode.
* </li>
* </ul>
- *
+ *
* @since 3.2
* @see RevisionInformation
* @see IRevisionRulerColumnExtension
@@ -33,7 +33,7 @@ import org.eclipse.jface.text.source.IVerticalRulerInfoExtension;
public interface IRevisionRulerColumn extends IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {
/**
* Sets the revision information.
- *
+ *
* @param info the new revision information, or <code>null</code> to reset the ruler
*/
void setRevisionInformation(RevisionInformation info);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumnExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumnExtension.java
index 23322a5be21..23c969b1beb 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumnExtension.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/IRevisionRulerColumnExtension.java
@@ -21,12 +21,12 @@ import org.eclipse.jface.viewers.ISelectionProvider;
* Introduces the ability to register a selection listener on revisions and configurable rendering
* modes.
* </p>
- *
+ *
* @see IRevisionRulerColumn
* @since 3.3
*/
public interface IRevisionRulerColumnExtension {
-
+
/**
* Rendering mode type-safe enum.
*/
@@ -44,7 +44,7 @@ public interface IRevisionRulerColumnExtension {
return fName;
}
}
-
+
/**
* Rendering mode that assigns a unique color to each revision author.
*/
@@ -59,7 +59,7 @@ public interface IRevisionRulerColumnExtension {
RenderingMode AGE= new RenderingMode("Age"); //$NON-NLS-1$
/**
* Rendering mode that assigns unique colors per revision author and
- * uses different color intensity depending on the age.
+ * uses different color intensity depending on the age.
* <p>
* Currently it selects lighter colors for older revisions and more intense
* colors for more recent revisions.
@@ -70,44 +70,44 @@ public interface IRevisionRulerColumnExtension {
/**
* Changes the rendering mode and triggers redrawing if needed.
- *
+ *
* @param mode the rendering mode
*/
void setRevisionRenderingMode(RenderingMode mode);
-
+
/**
* Enables showing the revision id.
- *
+ *
* @param show <code>true</code> to show the revision, <code>false</code> to hide it
*/
void showRevisionId(boolean show);
-
+
/**
* Enables showing the revision author.
- *
+ *
* @param show <code>true</code> to show the author, <code>false</code> to hide it
*/
void showRevisionAuthor(boolean show);
-
+
/**
* Returns the revision selection provider.
- *
+ *
* @return the revision selection provider
*/
ISelectionProvider getRevisionSelectionProvider();
-
+
/**
* Adds a revision listener that will be notified when the displayed revision information
* changes.
- *
+ *
* @param listener the listener to add
*/
void addRevisionListener(IRevisionListener listener);
-
+
/**
* Removes a previously registered revision listener; nothing happens if <code>listener</code>
* was not registered with the receiver.
- *
+ *
* @param listener the listener to remove
*/
void removeRevisionListener(IRevisionListener listener);
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/Revision.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/Revision.java
index 6801d8f35ba..af0cc44dc88 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/Revision.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/Revision.java
@@ -29,7 +29,7 @@ import org.eclipse.jface.text.source.ILineRange;
* <p>
* Clients may subclass.
* </p>
- *
+ *
* @since 3.2
*/
public abstract class Revision {
@@ -38,7 +38,7 @@ public abstract class Revision {
/**
* The cached list of adjusted ranges, element type: {@link RevisionRange}. <code>null</code>
* if the list must be re-computed. Unmodifiable.
- *
+ *
* @since 3.3
*/
private List fRanges= null;
@@ -52,7 +52,7 @@ public abstract class Revision {
/**
* Adds a line range to this revision. The range must be non-empty and have a legal start line
* (not -1).
- *
+ *
* @param range a line range that was changed with this revision
* @throws IndexOutOfBoundsException if the line range is empty or has a negative start line
*/
@@ -64,7 +64,7 @@ public abstract class Revision {
* Returns the contained {@link RevisionRange}s adapted to the current diff state. The returned
* information is only valid at the moment it is returned, and may change as the annotated
* document is modified.
- *
+ *
* @return an unmodifiable view of the contained ranges (element type: {@link RevisionRange})
*/
public final List getRegions() {
@@ -85,7 +85,7 @@ public abstract class Revision {
/**
* Adjusts the revision information to the given diff information. Any previous diff information
* is discarded.
- *
+ *
* @param hunks the diff hunks to adjust the revision information to
* @since 3.3
*/
@@ -109,7 +109,7 @@ public abstract class Revision {
* must be able process the given object. If the default information control creator is used
* the supported format is simple text, full HTML or an HTML fragment.
* </p>
- *
+ *
* @return the hover information for this revision or <code>null</code> for no hover
* @see RevisionInformation#setHoverControlCreator(IInformationControlCreator)
*/
@@ -121,7 +121,7 @@ public abstract class Revision {
* <p>
* Revisions from the same author must return the same color and revisions from different authors
* must return distinct colors.</p>
- *
+ *
* @return the RGB color for this revision's author
*/
public abstract RGB getColor();
@@ -129,14 +129,14 @@ public abstract class Revision {
/**
* Returns the unique (within the document) id of this revision. This may be the version string
* or a different identifier.
- *
+ *
* @return the id of this revision
*/
public abstract String getId();
/**
* Returns the modification date of this revision.
- *
+ *
* @return the modification date of this revision
*/
public abstract Date getDate();
@@ -153,7 +153,7 @@ public abstract class Revision {
* <p>
* Subclasses should replace - the default implementation returns the empty string.
* </p>
- *
+ *
* @return the author name
* @since 3.3
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionEvent.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionEvent.java
index 18bda6b9a42..5b55f900a64 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionEvent.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionEvent.java
@@ -18,17 +18,17 @@ import org.eclipse.core.runtime.Assert;
* <p>
* Clients may use but not instantiate this class.
* </p>
- *
+ *
* @since 3.3
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public final class RevisionEvent {
-
+
private final RevisionInformation fInformation;
/**
* Creates a new event.
- *
+ *
* @param information the revision info
*/
public RevisionEvent(RevisionInformation information) {
@@ -38,7 +38,7 @@ public final class RevisionEvent {
/**
* Returns the revision information that has changed.
- *
+ *
* @return the revision information that has changed
*/
public RevisionInformation getRevisionInformation() {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionInformation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionInformation.java
index 62f5b7873b7..07b6e76dc18 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionInformation.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionInformation.java
@@ -29,7 +29,7 @@ import org.eclipse.jface.text.information.IInformationProviderExtension2;
* <p>
* Clients may instantiate.
* </p>
- *
+ *
* @since 3.2
* @see Revision
*/
@@ -41,18 +41,18 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat
/**
* The flattened list of {@link RevisionRange}s, unmodifiable. <code>null</code> if the list
* must be re-computed.
- *
+ *
* @since 3.3
*/
private List fRanges= null;
-
+
/**
* The hover control creator. Can be <code>null</code>.
*
* @since 3.3
*/
private IInformationControlCreator fHoverControlCreator;
-
+
/**
* The information presenter control creator. Can be <code>null</code>.
*
@@ -68,7 +68,7 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat
/**
* Adds a revision.
- *
+ *
* @param revision a revision
*/
public void addRevision(Revision revision) {
@@ -78,7 +78,7 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat
/**
* Returns the contained revisions.
- *
+ *
* @return an unmodifiable view of the contained revisions (element type: {@link Revision})
*/
public List getRevisions() {
@@ -90,7 +90,7 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat
* at the moment it is returned, and may change as the annotated document is modified. See
* {@link IRevisionListener} for a way to be informed when the revision information changes. The
* returned list is sorted by document offset.
- *
+ *
* @return an unmodifiable view of the line ranges (element type: {@link RevisionRange})
* @see IRevisionListener
* @since 3.3
@@ -120,7 +120,7 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat
/**
* Adjusts the revision information to the given diff information. Any previous diff information is discarded. <strong>Note</strong>: This is an internal framework method and must not be called by clients.
- *
+ *
* @param hunks the diff hunks to adjust the revision information to
* @since 3.3
* @noreference This method is not intended to be referenced by clients.
@@ -147,14 +147,14 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat
public IInformationControlCreator getInformationPresenterControlCreator() {
return fInformationPresenterControlCreator;
}
-
+
/**
* Sets the hover control creator.
* <p>
* <strong>Note:</strong> The created information control must be able to display the object
* returned by the concrete implementation of {@link Revision#getHoverInfo()}.
* </p>
- *
+ *
* @param creator the control creator
* @since 3.3
*/
@@ -164,7 +164,7 @@ public final class RevisionInformation implements ITextHoverExtension, IInformat
/**
* Sets the information presenter control creator.
- *
+ *
* @param creator the control creator
* @since 3.3
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionRange.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionRange.java
index 65e998affe3..c2a05a24ce6 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionRange.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/RevisionRange.java
@@ -17,7 +17,7 @@ import org.eclipse.jface.text.source.ILineRange;
/**
* An unmodifiable line range that belongs to a {@link Revision}.
- *
+ *
* @since 3.3
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@@ -35,7 +35,7 @@ public final class RevisionRange implements ILineRange {
/**
* Returns the revision that this range belongs to.
- *
+ *
* @return the revision that this range belongs to
*/
public Revision getRevision() {
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
index 4eceeab16fd..a47ea6a4835 100644
--- 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
@@ -12,8 +12,8 @@
package org.eclipse.jface.text.rules;
-import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
import org.eclipse.core.runtime.Assert;
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
index 8277d8e024c..667de4689d4 100644
--- 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
@@ -14,7 +14,7 @@ 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 {
@@ -24,7 +24,7 @@ public interface IRule {
* The token returned by this rule returns <code>true</code> when calling
* <code>isUndefined</code>, if the text that 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
*/
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
index 9858fbb9708..f7bb1a65ba4 100644
--- 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
@@ -264,7 +264,7 @@ public class PatternRule implements IPredicateRule {
}
readCount++;
}
-
+
if (fBreaksOnEOF)
return true;
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
index 8e8535703e3..85ccb3ca650 100644
--- 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
@@ -30,7 +30,7 @@ public class RuleBasedPartitionScanner extends BufferedRuleBasedScanner implemen
/**
* Disallow setting the rules since this scanner
* exclusively uses predicate rules.
- *
+ *
* @param rules the sequence of rules controlling this scanner
*/
public void setRules(IRule[] rules) {
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
index 0638d8796a1..dc2777672bf 100644
--- 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
@@ -108,7 +108,7 @@ public class RuleBasedScanner implements ICharacterScanner, ITokenScanner {
/**
* Checks that the given range is valid.
* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=69292
- *
+ *
* @param offset the offset of the document range to scan
* @param length the length of the document range to scan
* @param documentLength the document's length
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
index 02ca1f1be57..6e864a18796 100644
--- 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
@@ -24,7 +24,7 @@ import org.eclipse.core.runtime.Assert;
* associate a token to a word. 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
* rule uses a word detector to determine what a word is.
- *
+ *
* @see IWordDetector
*/
public class WordRule implements IRule {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AbstractRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AbstractRulerColumn.java
index f3e010565bd..9d56786d104 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AbstractRulerColumn.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AbstractRulerColumn.java
@@ -228,7 +228,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
* <p>
* Clients may reimplement this method to create a canvas with their
* desired style bits.</p>
- *
+ *
* @return the SWT style bits, or <code>SWT.NONE</code> if none
*/
protected int getCanvasStyle() {
@@ -268,7 +268,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
/**
* Returns the parent ruler, <code>null</code> before
* {@link #createControl(CompositeRuler, Composite)} has been called.
- *
+ *
* @return the parent ruler or <code>null</code>
*/
protected final CompositeRuler getParentRuler() {
@@ -277,7 +277,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
/**
* {@inheritDoc}
- *
+ *
* @param font the font or <code>null</code> to use the default font
*/
public final void setFont(Font font) {
@@ -290,7 +290,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
/**
* Returns the current font. If a font has not been explicitly set, the widget's font is
* returned.
- *
+ *
* @return the font used to render text on the ruler.
*/
protected final Font getFont() {
@@ -303,7 +303,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
/**
* Sets the text inset (padding) used to draw text in {@link #paintLine(GC, int, int, int, int)}.
- *
+ *
* @param textInset the new text inset
*/
protected final void setTextInset(int textInset) {
@@ -316,7 +316,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
/**
* Returns the text inset for text drawn by {@link #paintLine(GC, int, int, int, int)}. The
* <code>DEFAULT_TEXT_INSET</code> constant specifies the default inset in pixels.
- *
+ *
* @return the text inset for text
*/
protected final int getTextInset() {
@@ -344,7 +344,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
* Sets the default background color for this column. The default background is used as default
* implementation of {@link #computeBackground(int)} and also to paint the area of the ruler
* that does not correspond to any lines (when the viewport is not entirely filled with lines).
- *
+ *
* @param background the default background color, <code>null</code> to use the text widget's
* background
*/
@@ -359,7 +359,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
/**
* Returns the background color. May return <code>null</code> if the system is shutting down.
- *
+ *
* @return the background color
*/
protected final Color getDefaultBackground() {
@@ -379,7 +379,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
/**
* Sets the annotation hover.
- *
+ *
* @param hover the annotation hover, <code>null</code> for no hover
*/
protected final void setHover(IAnnotationHover hover) {
@@ -428,7 +428,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
/**
* Marks the region covered by <code>lines</code> as needing to be redrawn.
- *
+ *
* @param lines the lines to be redrawn in document coordinates
*/
protected final void redraw(ILineRange lines) {
@@ -447,7 +447,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
/**
* Paints the ruler column.
- *
+ *
* @param event the paint event
*/
private void paintControl(PaintEvent event) {
@@ -473,7 +473,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
/**
* Computes the widget lines that need repainting given the clipping region of a paint event.
- *
+ *
* @param event the paint event
* @return the lines in widget coordinates that need repainting
*/
@@ -491,7 +491,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
* Subclasses may replace or extend. The default implementation calls
* {@link #paintLine(GC, int, int, int, int)} for every visible line.
* </p>
- *
+ *
* @param gc the graphics context to paint on
* @param lines the lines to paint in widget coordinates
*/
@@ -516,7 +516,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
* the entire width using the {@link #computeBackground(int) background color}. The text is
* drawn {@link #getTextInset()} pixels to the right of the left border.
* </p>
- *
+ *
* @param gc the graphics context to paint on
* @param modelLine the model line (based on document coordinates)
* @param widgetLine the line in the text widget corresponding to <code>modelLine</code>
@@ -539,7 +539,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
* <p>
* Subclasses may replace or extend.
* </p>
- *
+ *
* @param line the document line number
* @return the text to be drawn for the given line, <code>null</code> for no text
*/
@@ -554,7 +554,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
* <p>
* Subclasses may replace or extend.
* </p>
- *
+ *
* @param line the document line number
* @return the background color for drawn for the given line
*/
@@ -569,7 +569,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
* <p>
* Subclasses may replace or extend.
* </p>
- *
+ *
* @param line the document line number
* @return the foreground color for drawn for the given line
*/
@@ -608,7 +608,7 @@ public abstract class AbstractRulerColumn implements IVerticalRulerColumn, IVert
/**
* Scrolls the canvas vertically (adapted from
* {@linkplain StyledText StyledText.scrollVertical()}).
- *
+ *
* @param pixels the number of pixels to scroll (negative to scroll upwards)
* @return <code>true</code> if the widget was scrolled, <code>false</code> if the widget
* was not scrolled
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
index daadea9074e..24f2bd417a7 100644
--- 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
@@ -62,7 +62,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa
/**
* 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.
- *
+ *
* @since 3.0
* @deprecated As of 3.4, no longer used as closer from super class is used
*/
@@ -126,7 +126,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa
fSubjectControl.getShell().addShellListener(this);
fSubjectControl.addControlListener(this);
fSubjectControl.addKeyListener(this);
-
+
fDisplay= fSubjectControl.getDisplay();
if (!fDisplay.isDisposed() && fHideOnMouseWheel) {
fHasWheelFilter= true;
@@ -152,18 +152,18 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa
fSubjectControl.removeControlListener(this);
fSubjectControl.removeKeyListener(this);
}
-
+
if (fDisplay != null && !fDisplay.isDisposed() && fHasWheelFilter)
fDisplay.removeFilter(SWT.MouseWheel, this);
fHasWheelFilter= false;
-
+
fDisplay= null;
-
+
}
/**
* 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
* @deprecated As of 3.4, replaced by {@link #stop()}. Note that <code>delayRestart</code> was never honored.
*/
@@ -198,7 +198,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa
public void mouseDoubleClick(MouseEvent event) {
hideInformationControl();
}
-
+
/*
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
* @since 3.2
@@ -300,11 +300,11 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa
protected boolean fAllowMouseExit= false;
/**
* Whether we should hide the over on mouse wheel action.
- *
+ *
* @since 3.2
*/
private boolean fHideOnMouseWheel= true;
-
+
/**
* The current annotation hover.
* @since 3.2
@@ -379,7 +379,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa
}
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#showInformationControl(org.eclipse.swt.graphics.Rectangle)
* @since 3.2
@@ -388,7 +388,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa
super.showInformationControl(subjectArea);
fCurrentHover= getHover(getHoverEvent());
}
-
+
/*
* @see org.eclipse.jface.text.AbstractInformationControlManager#hideInformationControl()
* @since 3.2
@@ -469,11 +469,11 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa
Rectangle size= text.getClientArea();
Rectangle trim= text.computeTrim(0, 0, 0, 0);
int height= size.height - trim.height;
-
+
int lines= JFaceTextUtil.getLineIndex(text, height) - text.getTopIndex();
-
+
int bottomLine= topLine + lines;
-
+
int rangeBottomLine= getWidgetLineNumber(lineRange.getStartLine() + lineRange.getNumberOfLines() - 1);
int bottomDelta= Math.max(rangeBottomLine - bottomLine, 0);
@@ -744,7 +744,7 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa
* <p>
* <strong>Note:</strong> This method is not intended to be referenced or overridden by clients.
* </p>
- *
+ *
* @return the replaceable information control accessor
* @since 3.4
* @noreference This method is not intended to be referenced by clients.
@@ -755,23 +755,23 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa
public IInformationControl getCurrentInformationControl() {
return AnnotationBarHoverManager.super.getInternalAccessor().getCurrentInformationControl();
}
-
+
public void setInformationControlReplacer(InformationControlReplacer replacer) {
AnnotationBarHoverManager.super.getInternalAccessor().setInformationControlReplacer(replacer);
}
-
+
public InformationControlReplacer getInformationControlReplacer() {
return AnnotationBarHoverManager.super.getInternalAccessor().getInformationControlReplacer();
}
-
+
public boolean canReplace(IInformationControl control) {
return AnnotationBarHoverManager.super.getInternalAccessor().canReplace(control);
}
-
+
public boolean isReplaceInProgress() {
return AnnotationBarHoverManager.super.getInternalAccessor().isReplaceInProgress();
}
-
+
public void replaceInformationControl(boolean takeFocus) {
AnnotationBarHoverManager.super.getInternalAccessor().replaceInformationControl(takeFocus);
}
@@ -779,11 +779,11 @@ public class AnnotationBarHoverManager extends AbstractHoverInformationControlMa
public void cropToClosestMonitor(Rectangle bounds) {
AnnotationBarHoverManager.super.getInternalAccessor().cropToClosestMonitor(bounds);
}
-
+
public void setHoverEnrichMode(EnrichMode mode) {
AnnotationBarHoverManager.super.getInternalAccessor().setHoverEnrichMode(mode);
}
-
+
public boolean getAllowMouseExit() {
return fAllowMouseExit;
}
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
index 17306ae2459..e456454427d 100644
--- 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
@@ -22,7 +22,7 @@ public final class AnnotationColumn extends AnnotationRulerColumn {
/**
* Creates a new <code>AnnotationColumn</code> of the given width.
- *
+ *
* @param width the width of this column
* @deprecated Use
* {@link org.eclipse.jface.text.source.AnnotationRulerColumn#AnnotationRulerColumn(int)}
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
index c4623edf480..002480bdc08 100644
--- 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
@@ -87,7 +87,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
* decoration drawn in drawing mode. This can usually be accomplished by calling
* {@linkplain StyledText#redrawRange(int, int, boolean) textWidget.redrawRange(offset, length, true)}.</li>
* </ul>
- *
+ *
* @param annotation the annotation to be drawn
* @param gc the graphics context, <code>null</code> when in clearing mode
* @param textWidget the text widget to draw on
@@ -100,7 +100,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
/**
* Squiggles drawing strategy.
- *
+ *
* @since 3.0
* @deprecated As of 3.4, replaced by {@link AnnotationPainter.UnderlineStrategy}
*/
@@ -123,7 +123,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
right.x= rect.x + rect.width;
int[] polyline= computePolyline(left, right, textWidget.getBaseline(offset), textWidget.getLineHeight(offset));
-
+
gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance
gc.setLineStyle(SWT.LINE_SOLID);
gc.setForeground(color);
@@ -198,26 +198,26 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
// do nothing
}
}
-
-
+
+
/**
* A text style painting strategy draws the decoration for an annotation
* onto the text widget by applying a {@link TextStyle} on a given
* {@link StyleRange}.
- *
+ *
* @since 3.4
*/
public interface ITextStyleStrategy {
/**
* Applies a text style on the given <code>StyleRange</code>.
- *
+ *
* @param styleRange the style range on which to apply the text style
* @param annotationColor the color of the annotation
*/
void applyTextStyle(StyleRange styleRange, Color annotationColor);
}
-
+
/**
* @since 3.4
@@ -228,14 +228,14 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
}
}
-
+
/**
* Underline text style strategy.
- *
+ *
* @since 3.4
*/
public static final class UnderlineStrategy implements ITextStyleStrategy {
-
+
int fUnderlineStyle;
public UnderlineStrategy(int style) {
@@ -250,27 +250,27 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
}
}
-
+
/**
* Box text style strategy.
- *
+ *
* @since 3.4
*/
public static final class BoxStrategy implements ITextStyleStrategy {
-
+
int fBorderStyle;
public BoxStrategy(int style) {
Assert.isLegal(style == SWT.BORDER_DASH || style == SWT.BORDER_DASH || style == SWT.BORDER_SOLID);
fBorderStyle= style;
}
-
+
public void applyTextStyle(StyleRange styleRange, Color annotationColor) {
styleRange.borderStyle= fBorderStyle;
styleRange.borderColor= annotationColor;
}
}
-
+
/**
* Implementation of <code>IRegion</code> that can be reused
@@ -292,7 +292,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
/**
* This strategy is used to mark the <code>null</code> value in the chache
* maps.
- *
+ *
* @since 3.4
*/
private static final IDrawingStrategy NULL_STRATEGY= new NullStrategy();
@@ -303,14 +303,14 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
private static final Object SQUIGGLES= new Object();
/**
* The squiggly painter strategy.
- *
+ *
* @since 3.4
*/
private static final ITextStyleStrategy HIGHLIGHTING_STRATEGY= new HighlightingStrategy();
/**
* The highlighting text style strategy id.
- *
+ *
* @since 3.4
*/
private static final Object HIGHLIGHTING= new Object();
@@ -374,7 +374,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
private Object fHighlightedDecorationsMapLock= new Object();
/**
* Maps an annotation type to its registered color.
- *
+ *
* @see #setAnnotationTypeColor(Object, Color)
*/
private Map fAnnotationType2Color= new HashMap();
@@ -418,7 +418,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
private boolean fInputDocumentAboutToBeChanged;
/**
* Maps annotation types to painting strategy identifiers.
- *
+ *
* @see #addAnnotationType(Object, Object)
* @since 3.0
*/
@@ -431,7 +431,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
/**
* Maps painting strategy identifiers to painting strategies.
- *
+ *
* @since 3.0
*/
private Map fPaintingStrategyId2PaintingStrategy= new HashMap();
@@ -441,7 +441,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
* @since 3.3
*/
private ReusableRegion fReusableRegion= new ReusableRegion();
-
+
/**
* Creates a new annotation painter for the given source viewer and with the
* given annotation access. The painter is not initialized, i.e. no
@@ -538,7 +538,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
int highlightAnnotationRangeStart= Integer.MAX_VALUE;
int highlightAnnotationRangeEnd= -1;
-
+
int drawRangeStart= Integer.MAX_VALUE;
int drawRangeEnd= -1;
@@ -571,9 +571,9 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
Decoration decoration= (Decoration)entry.getValue();
drawDecoration(decoration, null, annotation, clippingRegion, document);
}
-
+
decorationsMap.clear();
-
+
highlightedDecorationsMap.clear();
e= fModel.getAnnotationIterator();
@@ -602,7 +602,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
drawRangeEnd= Math.max(drawRangeEnd, position.offset + position.length);
}
}
-
+
}
// Update existing annotations
@@ -611,7 +611,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
Annotation annotation= changedAnnotations[i];
boolean isHighlighting= false;
-
+
Decoration decoration= (Decoration)highlightedDecorationsMap.get(annotation);
if (decoration != null) {
@@ -678,7 +678,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
highlightAnnotationRangeStart= Math.min(highlightAnnotationRangeStart, pp.fPosition.offset);
highlightAnnotationRangeEnd= Math.max(highlightAnnotationRangeEnd, pp.fPosition.offset + pp.fPosition.length);
}
-
+
}
}
@@ -749,7 +749,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
adaptToDocumentLength(fCurrentHighlightAnnotationRange);
adaptToDocumentLength(fTotalHighlightAnnotationRange);
}
-
+
/**
* Updates the remembered decoration ranges.
*
@@ -760,20 +760,20 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
*/
private void updateDrawRanges(int drawRangeStart, int drawRangeEnd, boolean isWorldChange) {
if (drawRangeStart != Integer.MAX_VALUE) {
-
+
int maxRangeStart= drawRangeStart;
int maxRangeEnd= drawRangeEnd;
-
+
if (fTotalDrawRange != null) {
maxRangeStart= Math.min(maxRangeStart, fTotalDrawRange.offset);
maxRangeEnd= Math.max(maxRangeEnd, fTotalDrawRange.offset + fTotalDrawRange.length);
}
-
+
if (fTotalDrawRange == null)
fTotalDrawRange= new Position(0);
if (fCurrentDrawRange == null)
fCurrentDrawRange= new Position(0);
-
+
if (isWorldChange) {
fTotalDrawRange.offset= drawRangeStart;
fTotalDrawRange.length= drawRangeEnd - drawRangeStart;
@@ -793,7 +793,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
fCurrentDrawRange= null;
}
}
-
+
adaptToDocumentLength(fCurrentDrawRange);
adaptToDocumentLength(fTotalDrawRange);
}
@@ -840,7 +840,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
Position position= fModel.getPosition(annotation);
if (position == null || position.isDeleted())
return null;
-
+
if (decoration == null)
decoration= new Decoration();
@@ -852,15 +852,15 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
} else {
decoration.fLayer= IAnnotationAccessExtension.DEFAULT_LAYER;
}
-
+
decoration.fPaintingStrategy= paintingStrategy;
-
+
return decoration;
}
/**
* Returns the painting strategy for the given annotation.
- *
+ *
* @param type the annotation type
* @return the annotation painter
* @since 3.0
@@ -1136,7 +1136,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
};
fSourceViewer.addTextInputListener(fTextInputListener);
}
-
+
}
/**
@@ -1166,7 +1166,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
* The given id can be referenced when adding annotation types, see
* {@link #addAnnotationType(Object, Object)}.
* </p>
- *
+ *
* @param id the identifier under which the strategy can be referenced, not <code>null</code>
* @param strategy the new strategy
* @since 3.4
@@ -1263,12 +1263,12 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
fCachedAnnotationType2PaintingStrategy.clear();
fCachedAnnotationType2PaintingStrategy= null;
}
-
+
if (fAnnotationType2PaintingStrategyId != null) {
fAnnotationType2PaintingStrategyId.clear();
fAnnotationType2PaintingStrategyId= null;
}
-
+
fTextWidget= null;
fSourceViewer= null;
fAnnotationAccess= null;
@@ -1348,10 +1348,10 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
IRegion clippingRegion= computeClippingRegion(event, false);
if (clippingRegion == null)
return;
-
+
int vOffset= clippingRegion.getOffset();
int vLength= clippingRegion.getLength();
-
+
final GC gc= event != null ? event.gc : null;
// Clone decorations
@@ -1368,7 +1368,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
ArrayList toBeDrawn= new ArrayList(10);
for (Iterator e = decorations.iterator(); e.hasNext();) {
Map.Entry entry= (Map.Entry)e.next();
-
+
Annotation a= (Annotation)entry.getKey();
Decoration pp = (Decoration)entry.getValue();
// prune any annotation that is not drawable or does not need drawing
@@ -1390,7 +1390,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
}
}
}
-
+
private void drawDecoration(Decoration pp, GC gc, Annotation annotation, IRegion clippingRegion, IDocument document) {
if (clippingRegion == null)
return;
@@ -1428,12 +1428,12 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
} catch (BadLocationException x) {
}
}
-
+
/**
* Computes the model (document) region that is covered by the paint event's clipping region. If
* <code>event</code> is <code>null</code>, the model range covered by the visible editor
* area (viewport) is returned.
- *
+ *
* @param event the paint event or <code>null</code> to use the entire viewport
* @param isClearing tells whether the clipping is need for clearing an annotation
* @return the model region comprised by either the paint event's clipping region or the
@@ -1442,21 +1442,21 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
*/
private IRegion computeClippingRegion(PaintEvent event, boolean isClearing) {
if (event == null) {
-
+
if (!isClearing && fCurrentDrawRange != null)
return new Region(fCurrentDrawRange.offset, fCurrentDrawRange.length);
-
+
// trigger a repaint of the entire viewport
int vOffset= getInclusiveTopIndexStartOffset();
if (vOffset == -1)
return null;
-
+
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=17147
int vLength= getExclusiveBottomIndexEndOffset() - vOffset;
-
+
return new Region(vOffset, vLength);
}
-
+
int widgetOffset;
try {
int widgetClippingStartOffset= fTextWidget.getOffsetAtLocation(new Point(0, event.y));
@@ -1470,7 +1470,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
widgetOffset= 0;
}
}
-
+
int widgetEndOffset;
try {
int widgetClippingEndOffset= fTextWidget.getOffsetAtLocation(new Point(0, event.y + event.height));
@@ -1489,9 +1489,9 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
widgetEndOffset= fTextWidget.getCharCount();
}
}
-
+
IRegion clippingRegion= getModelRange(widgetOffset, widgetEndOffset - widgetOffset);
-
+
return clippingRegion;
}
@@ -1510,7 +1510,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
/**
* Returns the widget region that corresponds to the
* given offset and length in the viewer's document.
- *
+ *
* @param modelOffset the model offset
* @param modelLength the model length
* @return the corresponding widget region
@@ -1556,11 +1556,11 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
ITextViewerExtension5 extension= (ITextViewerExtension5) fSourceViewer;
return extension.widgetRange2ModelRange(new Region(offset, length));
}
-
+
IRegion region= fSourceViewer.getVisibleRegion();
return new Region(region.getOffset() + offset, length);
}
-
+
/**
* Checks whether the intersection of the given text ranges
* is empty or not.
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
index 94c7bf5a6fd..dd58e939d05 100644
--- 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
@@ -423,7 +423,7 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul
IDocument d= fCachedTextViewer.getDocument();
if (d == null)
return false;
-
+
line= d.getLineInformation(lineNumber);
} catch (BadLocationException ex) {
return false;
@@ -534,11 +534,11 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul
protected int getInclusiveTopIndexStartOffset() {
if (fCachedTextWidget == null || fCachedTextWidget.isDisposed())
return -1;
-
+
IDocument document= fCachedTextViewer.getDocument();
if (document == null)
return -1;
-
+
int top= JFaceTextUtil.getPartialTopIndex(fCachedTextViewer);
try {
return document.getLineOffset(top);
@@ -556,11 +556,11 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul
private int getExclusiveBottomIndexEndOffset() {
if (fCachedTextWidget == null || fCachedTextWidget.isDisposed())
return -1;
-
+
IDocument document= fCachedTextViewer.getDocument();
if (document == null)
return -1;
-
+
int bottom= JFaceTextUtil.getPartialBottomIndex(fCachedTextViewer);
try {
if (bottom >= document.getNumberOfLines())
@@ -659,10 +659,10 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul
r.x= 0;
r.y= JFaceTextUtil.computeLineHeight(fCachedTextWidget, 0, startLine, startLine) - fScrollPos;
-
+
r.width= dimension.x;
int lines= endLine - startLine;
-
+
r.height= JFaceTextUtil.computeLineHeight(fCachedTextWidget, startLine, endLine + 1, lines + 1);
if (r.y < dimension.y && fAnnotationAccessExtension != null) // annotation within visible area
@@ -758,7 +758,7 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul
r.x= 0;
r.y= JFaceTextUtil.computeLineHeight(fCachedTextWidget, 0, startLine, startLine) - fScrollPos;
-
+
r.width= dimension.x;
int lines= endLine - startLine;
r.height= JFaceTextUtil.computeLineHeight(fCachedTextWidget, startLine, endLine + 1, lines + 1);
@@ -867,7 +867,7 @@ public class AnnotationRulerColumn implements IVerticalRulerColumn, IVerticalRul
public int toDocumentLineNumber(int y_coordinate) {
return fParentRuler.toDocumentLineNumber(y_coordinate);
}
-
+
/**
* Removes the given annotation type from this annotation ruler column.
* Annotations of the given type are no longer shown in this annotation
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java
index ad8277f0a56..d599bef0a88 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ChangeRulerColumn.java
@@ -114,9 +114,9 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR
}
}
-
+
/**
- * The view(port) listener.
+ * The view(port) listener.
*/
private final InternalListener fInternalListener= new InternalListener();
/**
@@ -149,7 +149,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR
private IAnnotationModel fAnnotationModel;
/** The width of the change ruler column. */
private final int fWidth= 5;
-
+
/** Cache for the actual scroll position in pixels */
private int fScrollPos;
/** The buffer for double buffering */
@@ -159,17 +159,17 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR
/**
* Creates a new ruler column.
- *
+ *
* @deprecated since 3.2 use {@link #ChangeRulerColumn(ISharedTextColors)} instead
*/
public ChangeRulerColumn() {
fRevisionPainter= null;
fDiffPainter= new DiffPainter(this, null);
}
-
+
/**
* Creates a new revision ruler column.
- *
+ *
* @param sharedColors the colors to look up RGBs
* @since 3.2
*/
@@ -178,7 +178,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR
fRevisionPainter= new RevisionPainter(this, sharedColors);
fDiffPainter= new DiffPainter(this, null); // no shading
}
-
+
/**
* Returns the System background color for list widgets.
*
@@ -225,7 +225,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR
fCachedTextViewer.addViewportListener(fInternalListener);
fCachedTextViewer.addTextListener(fInternalListener);
}
-
+
fRevisionPainter.setParentRuler(parentRuler);
fDiffPainter.setParentRuler(parentRuler);
@@ -287,7 +287,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR
/**
* Returns the view port height in lines.
- *
+ *
* @return the view port height in lines
* @deprecated as of 3.2 the number of lines in the viewport cannot be computed because
* StyledText supports variable line heights
@@ -300,7 +300,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR
/**
* Returns <code>true</code> if the viewport displays the entire viewer contents, i.e. the
* viewer is not vertically scrollable.
- *
+ *
* @return <code>true</code> if the viewport displays the entire contents, <code>false</code> otherwise
* @since 3.2
*/
@@ -485,10 +485,10 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR
public void removeVerticalRulerListener(IVerticalRulerListener listener) {
throw new UnsupportedOperationException();
}
-
+
/**
* Computes the document based line range visible in the text widget.
- *
+ *
* @return the document based line range visible in the text widget
* @since 3.2
*/
@@ -496,35 +496,35 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR
IDocument doc= fCachedTextViewer.getDocument();
if (doc == null)
return null;
-
+
int topLine;
IRegion coverage;
-
+
if (fCachedTextViewer instanceof ITextViewerExtension5) {
ITextViewerExtension5 extension= (ITextViewerExtension5) fCachedTextViewer;
-
+
// ITextViewer.getTopIndex returns the fully visible line, but we want the partially
// visible one
int widgetTopLine= JFaceTextUtil.getPartialTopIndex(fCachedTextWidget);
topLine= extension.widgetLine2ModelLine(widgetTopLine);
-
+
coverage= extension.getModelCoverage();
-
+
} else {
- topLine= JFaceTextUtil.getPartialTopIndex(fCachedTextViewer);
+ topLine= JFaceTextUtil.getPartialTopIndex(fCachedTextViewer);
coverage= fCachedTextViewer.getVisibleRegion();
}
-
+
int bottomLine= fCachedTextViewer.getBottomIndex();
if (bottomLine != -1)
++ bottomLine;
-
+
// clip by coverage window
try {
int firstLine= doc.getLineOfOffset(coverage.getOffset());
if (firstLine > topLine)
topLine= firstLine;
-
+
int lastLine= doc.getLineOfOffset(coverage.getOffset() + coverage.getLength());
if (lastLine < bottomLine || bottomLine == -1)
bottomLine= lastLine;
@@ -532,11 +532,11 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR
x.printStackTrace();
return null;
}
-
+
ILineRange visibleModelLines= new LineRange(topLine, bottomLine - topLine + 1);
return visibleModelLines;
}
-
+
/*
* @see org.eclipse.jface.text.revisions.IRevisionRulerColumn#setRevisionInformation(org.eclipse.jface.text.revisions.RevisionInformation)
*/
@@ -547,7 +547,7 @@ public final class ChangeRulerColumn implements IVerticalRulerColumn, IVerticalR
/**
* Returns the revision selection provider.
- *
+ *
* @return the revision selection provider
* @since 3.2
*/
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
index 59acd9ac45f..37f6b274994 100644
--- 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
@@ -535,7 +535,7 @@ public class CompositeRuler implements IVerticalRuler, IVerticalRulerExtension,
/**
* Constructs a new composite ruler with the given gap between its columns.
- *
+ *
* @param gap the gap
*/
public CompositeRuler(int gap) {
@@ -672,10 +672,10 @@ public class CompositeRuler implements IVerticalRuler, IVerticalRulerExtension,
}
}
}
-
+
/**
* Immediately redraws the entire ruler (without asynchronous posting).
- *
+ *
* @since 3.2
*/
public void immediateUpdate() {
@@ -730,13 +730,13 @@ public class CompositeRuler implements IVerticalRuler, IVerticalRulerExtension,
StyledText text= fTextViewer.getTextWidget();
int line= text.getLineIndex(y_coordinate);
-
+
if (line == text.getLineCount() - 1) {
// check whether y_coordinate exceeds last line
if (y_coordinate > text.getLinePixel(line + 1))
return -1;
}
-
+
return widgetLine2ModelLine(fTextViewer, line);
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ContentAssistantFacade.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ContentAssistantFacade.java
index b1c9dcb4356..61ce50cbd6a 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ContentAssistantFacade.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ContentAssistantFacade.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.text.contentassist.IContentAssistantExtension4;
* <p>
* The offered API access can grow over time.
* </p>
- *
+ *
* @since 3.4
*/
public final class ContentAssistantFacade {
@@ -34,7 +34,7 @@ public final class ContentAssistantFacade {
/**
* Creates a new facade.
- *
+ *
* @param contentAssistant the content assistant which implements {@link IContentAssistantExtension2} and {@link IContentAssistantExtension4}
*/
public ContentAssistantFacade(IContentAssistant contentAssistant) {
@@ -48,7 +48,7 @@ public final class ContentAssistantFacade {
* The same handler instance will be returned when called a more than once
* with the same command identifier.
* </p>
- *
+ *
* @param commandId the command identifier
* @return the handler for the given command identifier
* @throws IllegalArgumentException if the command is not supported by this
@@ -65,7 +65,7 @@ public final class ContentAssistantFacade {
/**
* Adds a completion listener that will be informed before proposals are
* computed.
- *
+ *
* @param listener the listener
* @throws IllegalStateException if called when the content assistant is
* uninstalled
@@ -78,7 +78,7 @@ public final class ContentAssistantFacade {
/**
* Removes a completion listener.
- *
+ *
* @param listener the listener to remove
* @throws IllegalStateException if called when the content assistant is
* uninstalled
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultAnnotationHover.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultAnnotationHover.java
index c6be5bbfe0e..1449145454a 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultAnnotationHover.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultAnnotationHover.java
@@ -23,23 +23,23 @@ import org.eclipse.jface.text.source.projection.AnnotationBag;
/**
* Standard implementation of {@link org.eclipse.jface.text.source.IAnnotationHover}.
- *
+ *
* @since 3.2
*/
public class DefaultAnnotationHover implements IAnnotationHover {
-
-
+
+
/**
* Tells whether the line number should be shown when no annotation is found
* under the cursor.
- *
+ *
* @since 3.4
*/
private boolean fShowLineNumber;
/**
* Creates a new default annotation hover.
- *
+ *
* @since 3.4
*/
public DefaultAnnotationHover() {
@@ -48,33 +48,33 @@ public class DefaultAnnotationHover implements IAnnotationHover {
/**
* Creates a new default annotation hover.
- *
+ *
* @param showLineNumber <code>true</code> if the line number should be shown when no annotation is found
* @since 3.4
*/
public DefaultAnnotationHover(boolean showLineNumber) {
fShowLineNumber= showLineNumber;
}
-
+
/*
* @see org.eclipse.jface.text.source.IAnnotationHover#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer, int)
*/
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
List javaAnnotations= getAnnotationsForLine(sourceViewer, lineNumber);
if (javaAnnotations != null) {
-
+
if (javaAnnotations.size() == 1) {
-
+
// optimization
Annotation annotation= (Annotation) javaAnnotations.get(0);
String message= annotation.getText();
if (message != null && message.trim().length() > 0)
return formatSingleMessage(message);
-
+
} else {
-
+
List messages= new ArrayList();
-
+
Iterator e= javaAnnotations.iterator();
while (e.hasNext()) {
Annotation annotation= (Annotation) e.next();
@@ -82,10 +82,10 @@ public class DefaultAnnotationHover implements IAnnotationHover {
if (message != null && message.trim().length() > 0)
messages.add(message.trim());
}
-
+
if (messages.size() == 1)
return formatSingleMessage((String)messages.get(0));
-
+
if (messages.size() > 1)
return formatMultipleMessages(messages);
}
@@ -96,46 +96,46 @@ public class DefaultAnnotationHover implements IAnnotationHover {
return null;
}
-
+
/**
* Tells whether the annotation should be included in
* the computation.
- *
+ *
* @param annotation the annotation to test
* @return <code>true</code> if the annotation is included in the computation
*/
protected boolean isIncluded(Annotation annotation) {
return true;
}
-
+
/**
* Hook method to format the given single message.
* <p>
* Subclasses can change this to create a different
* format like HTML.
* </p>
- *
+ *
* @param message the message to format
* @return the formatted message
*/
protected String formatSingleMessage(String message) {
return message;
}
-
+
/**
* Hook method to formats the given messages.
* <p>
* Subclasses can change this to create a different
* format like HTML.
* </p>
- *
+ *
* @param messages the messages to format
* @return the formatted message
*/
protected String formatMultipleMessages(List messages) {
StringBuffer buffer= new StringBuffer();
buffer.append(JFaceTextMessages.getString("DefaultAnnotationHover.multipleMarkers")); //$NON-NLS-1$
-
+
Iterator e= messages.iterator();
while (e.hasNext()) {
buffer.append('\n');
@@ -144,7 +144,7 @@ public class DefaultAnnotationHover implements IAnnotationHover {
}
return buffer.toString();
}
-
+
private boolean isRulerLine(Position position, IDocument document, int line) {
if (position.getOffset() > -1 && position.getLength() > -1) {
try {
@@ -154,7 +154,7 @@ public class DefaultAnnotationHover implements IAnnotationHover {
}
return false;
}
-
+
private IAnnotationModel getAnnotationModel(ISourceViewer viewer) {
if (viewer instanceof ISourceViewerExtension2) {
ISourceViewerExtension2 extension= (ISourceViewerExtension2) viewer;
@@ -162,13 +162,13 @@ public class DefaultAnnotationHover implements IAnnotationHover {
}
return viewer.getAnnotationModel();
}
-
+
private boolean isDuplicateAnnotation(Map messagesAtPosition, Position position, String message) {
if (messagesAtPosition.containsKey(position)) {
Object value= messagesAtPosition.get(position);
if (message.equals(value))
return true;
-
+
if (value instanceof List) {
List messages= (List)value;
if (messages.contains(message))
@@ -185,35 +185,35 @@ public class DefaultAnnotationHover implements IAnnotationHover {
messagesAtPosition.put(position, message);
return false;
}
-
+
private boolean includeAnnotation(Annotation annotation, Position position, HashMap messagesAtPosition) {
if (!isIncluded(annotation))
return false;
-
+
String text= annotation.getText();
return (text != null && !isDuplicateAnnotation(messagesAtPosition, position, text));
}
-
+
private List getAnnotationsForLine(ISourceViewer viewer, int line) {
IAnnotationModel model= getAnnotationModel(viewer);
if (model == null)
return null;
-
+
IDocument document= viewer.getDocument();
List javaAnnotations= new ArrayList();
HashMap messagesAtPosition= new HashMap();
Iterator iterator= model.getAnnotationIterator();
-
+
while (iterator.hasNext()) {
Annotation annotation= (Annotation) iterator.next();
-
+
Position position= model.getPosition(annotation);
if (position == null)
continue;
-
+
if (!isRulerLine(position, document, line))
continue;
-
+
if (annotation instanceof AnnotationBag) {
AnnotationBag bag= (AnnotationBag) annotation;
Iterator e= bag.iterator();
@@ -225,11 +225,11 @@ public class DefaultAnnotationHover implements IAnnotationHover {
}
continue;
}
-
+
if (includeAnnotation(annotation, position, messagesAtPosition))
javaAnnotations.add(annotation);
}
-
+
return javaAnnotations;
}
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java
index 4d6c2e33c8c..0afbc881cd0 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java
@@ -45,7 +45,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
* char[] chars = new char[] {'(', ')', '{', '}', '[', ']'};
* new SimpleCharacterPairMatcher(chars, ...);
* </pre>
- *
+ *
* @param chars a list of characters
* @param partitioning the partitioning to match within
*/
@@ -55,7 +55,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
fPairs= new CharPairs(chars);
fPartitioning= partitioning;
}
-
+
/**
* Creates a new character pair matcher that matches characters
* within the default partitioning. The specified list of
@@ -66,13 +66,13 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
* char[] chars = new char[] {'(', ')', '{', '}', '[', ']'};
* new SimpleCharacterPairMatcher(chars);
* </pre>
- *
+ *
* @param chars a list of characters
*/
public DefaultCharacterPairMatcher(char[] chars) {
this(chars, IDocumentExtension3.DEFAULT_PARTITIONING);
}
-
+
/* @see ICharacterPairMatcher#match(IDocument, int) */
public IRegion match(IDocument doc, int offset) {
if (doc == null || offset < 0 || offset > doc.getLength()) return null;
@@ -82,7 +82,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
return null;
}
}
-
+
/*
* Performs the actual work of matching for #match(IDocument, int).
*/
@@ -108,7 +108,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
/**
* Searches <code>doc</code> for the specified end character, <code>end</code>.
- *
+ *
* @param doc the document to search
* @param start the opening matching character
* @param end the end character to search for
@@ -138,7 +138,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
public int getAnchor() {
return fAnchor;
}
-
+
/* @see ICharacterPairMatcher#dispose() */
public void dispose() { }
@@ -154,14 +154,14 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
* valid match, only considers position within its partition.
*/
private static class DocumentPartitionAccessor {
-
+
private final IDocument fDocument;
private final String fPartitioning, fPartition;
private ITypedRegion fCachedPartition;
-
+
/**
* Creates a new partitioned document for the specified document.
- *
+ *
* @param doc the document to wrap
* @param partitioning the partitioning used
* @param partition the partition managed by this document
@@ -175,7 +175,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
/**
* Returns the character at the specified position in this document.
- *
+ *
* @param pos an offset within this document
* @return the character at the offset
* @throws BadLocationException if the offset is invalid in this document
@@ -188,7 +188,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
* Returns true if the character at the specified position is a valid match for the
* specified end character. To be a valid match, it must be in the appropriate partition and
* equal to the end character.
- *
+ *
* @param pos an offset within this document
* @param end the end character to match against
* @return true exactly if the position represents a valid match
@@ -197,11 +197,11 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
public boolean isMatch(int pos, char end) throws BadLocationException {
return getChar(pos) == end && inPartition(pos);
}
-
+
/**
* Returns true if the specified offset is within the partition
* managed by this document.
- *
+ *
* @param pos an offset within this document
* @return true if the offset is within this document's partition
*/
@@ -209,11 +209,11 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
final ITypedRegion partition= getPartition(pos);
return partition != null && partition.getType().equals(fPartition);
}
-
+
/**
* Returns the next position to query in the search. The position
* is not guaranteed to be in this document's partition.
- *
+ *
* @param pos an offset within the document
* @param searchForward the direction of the search
* @return the next position to query
@@ -234,15 +234,15 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
}
return simpleIncrement(pos, searchForward);
}
-
+
private int simpleIncrement(int pos, boolean searchForward) {
return pos + (searchForward ? 1 : -1);
}
-
+
/**
* Returns partition information about the region containing the
* specified position.
- *
+ *
* @param pos a position within this document.
* @return positioning information about the region containing the
* position
@@ -258,12 +258,12 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
}
return fCachedPartition;
}
-
+
private static boolean contains(IRegion region, int pos) {
int offset= region.getOffset();
return offset <= pos && pos < offset + region.getLength();
}
-
+
}
/**
@@ -280,7 +280,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
/**
* Returns true if the specified character pair occurs in one
* of the character pairs.
- *
+ *
* @param c a character
* @return true exactly if the character occurs in one of the pairs
*/
@@ -320,17 +320,17 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
/**
* Returns true of the specified character is a start character.
- *
+ *
* @param c a character
* @return true exactly if the character is a start character
*/
public boolean isStartCharacter(char c) {
return this.isOpeningCharacter(c, true);
}
-
+
/**
* Returns the matching character for the specified character.
- *
+ *
* @param c a character occurring in a character pair
* @return the matching character
*/
@@ -342,15 +342,15 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher {
Assert.isTrue(false);
return '\0';
}
-
+
private char getStartChar(int i) {
return fPairs[i];
}
-
+
private char getEndChar(int i) {
return fPairs[i + 1];
}
-
+
}
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccessExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccessExtension2.java
index 314552cb090..3d0e5bcae3e 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccessExtension2.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/IAnnotationAccessExtension2.java
@@ -21,13 +21,13 @@ import org.eclipse.jface.text.quickassist.IQuickAssistAssistant;
* @since 3.2
*/
public interface IAnnotationAccessExtension2 {
-
+
/**
* Provides this annotation access with a quick assist assistant that
* is used to decide whether the quick fix image should be shown.
- *
+ *
* @param assistant the quick assist assistant
*/
void setQuickAssistAssistant(IQuickAssistAssistant assistant);
-
+
}
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
index 7a3be26eb53..808a98df3a2 100644
--- 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
@@ -25,7 +25,7 @@ package org.eclipse.jface.text.source;
* This allows for sophisticated hovers in a way that information computed by
* the hover can be displayed in the best possible form.</li>
* <li>{@link org.eclipse.jface.text.source.IAnnotationHoverExtension2} since
- * version 3.2 allowing a text hover to specify whether it handles mouse-wheel
+ * version 3.2 allowing a text hover to specify whether it handles mouse-wheel
* events itself.</li>
* </ul></p>
* <p>
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineDifferExtension2.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineDifferExtension2.java
index ecc4721dcd1..7acc7a86e68 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineDifferExtension2.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineDifferExtension2.java
@@ -21,7 +21,7 @@ package org.eclipse.jface.text.source;
public interface ILineDifferExtension2 {
/**
* Returns <code>true</code> if the receiver is suspended, <code>false</code> otherwise.
- *
+ *
* @return <code>true</code> if the receiver is suspended, <code>false</code> otherwise
*/
boolean isSuspended();
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineRange.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineRange.java
index f304799d4e9..1b21dfa7b0d 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineRange.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ILineRange.java
@@ -17,7 +17,7 @@ package org.eclipse.jface.text.source;
* computes the first line <em>after</em> the range, and a range with
* <code>getNumberOfLines() == 0</code> is empty.
* </p>
- *
+ *
* @since 3.0
*/
public interface ILineRange {
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
index e3033eba751..7bc26b68c88 100644
--- 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
@@ -85,7 +85,7 @@ public interface ISourceViewer extends ITextViewer {
/*
* XXX: Cannot continue numbering due to operation codes used in ProjectionViewer
- */
+ */
/**
* Text operation code for requesting quick assist. This will normally
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension3.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension3.java
index 1ca8b58bed7..b5349a5f848 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension3.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension3.java
@@ -17,7 +17,7 @@ import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext;
/**
* Extension interface for {@link org.eclipse.jface.text.source.ISourceViewer}.<p>
* It introduces the concept of a quick assist assistant and provides access
- * to the quick assist invocation context. It also gives access to any currently
+ * to the quick assist invocation context. It also gives access to any currently
* showing annotation hover.</p>
*
* @see IQuickAssistAssistant
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension4.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension4.java
index 54a351a4ac2..f9933530d21 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension4.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ISourceViewerExtension4.java
@@ -18,7 +18,7 @@ import org.eclipse.jface.text.contentassist.IContentAssistant;
* <p>
* It introduces API to access a minimal set of content assistant APIs.</li>
* </p>
- *
+ *
* @see IContentAssistant
* @since 3.4
*/
@@ -26,7 +26,7 @@ public interface ISourceViewerExtension4 {
/**
* Returns a facade for this viewer's content assistant.
- *
+ *
* @return a content assistant facade or <code>null</code> if none is
* configured
*/
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
index 659d452a102..547912117cd 100644
--- 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
@@ -47,7 +47,7 @@ public interface IVerticalRulerInfo {
* 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 or <code>-1</code> if
+ * @return the line number of the last mouse button activity or <code>-1</code> if
* the last mouse activity does not correspond to a valid document line
*/
int getLineOfLastMouseButtonActivity();
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
index d71ade87466..79251467dd4 100644
--- 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
@@ -11,10 +11,11 @@
package org.eclipse.jface.text.source;
-import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import com.ibm.icu.text.MessageFormat;
+
/**
* Accessor for the <code>JFaceTextMessages.properties</code> file in
* package <code>org.eclipse.jface.text</code>.
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberChangeRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberChangeRulerColumn.java
index 7ba3353cebd..c645db5492e 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberChangeRulerColumn.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberChangeRulerColumn.java
@@ -17,15 +17,15 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.internal.text.revisions.RevisionPainter;
+import org.eclipse.jface.internal.text.source.DiffPainter;
+import org.eclipse.jface.viewers.ISelectionProvider;
+
import org.eclipse.jface.text.revisions.IRevisionListener;
import org.eclipse.jface.text.revisions.IRevisionRulerColumn;
import org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension;
import org.eclipse.jface.text.revisions.RevisionInformation;
-import org.eclipse.jface.internal.text.revisions.RevisionPainter;
-import org.eclipse.jface.internal.text.source.DiffPainter;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
/**
* A vertical ruler column displaying line numbers and serving as a UI for quick diff.
* Clients usually instantiate and configure object of this class.
@@ -39,13 +39,13 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
private boolean fCharacterDisplay;
/**
* The revision painter strategy.
- *
+ *
* @since 3.2
*/
private final RevisionPainter fRevisionPainter;
- /**
+ /**
* The diff information painter strategy.
- *
+ *
* @since 3.2
*/
private final DiffPainter fDiffPainter;
@@ -65,7 +65,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
fRevisionPainter= new RevisionPainter(this, sharedColors);
fDiffPainter= new DiffPainter(this, sharedColors);
}
-
+
/*
* @see org.eclipse.jface.text.source.LineNumberRulerColumn#createControl(org.eclipse.jface.text.source.CompositeRuler, org.eclipse.swt.widgets.Composite)
*/
@@ -75,7 +75,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
fDiffPainter.setParentRuler(parentRuler);
return control;
}
-
+
/*
* @see org.eclipse.jface.text.source.IVerticalRulerInfo#getLineOfLastMouseButtonActivity()
*/
@@ -102,7 +102,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
layout(true);
postRedraw();
}
-
+
private void setAnnotationModel(IAnnotationModel model) {
if (fAnnotationModel != model)
fAnnotationModel= model;
@@ -177,7 +177,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
public void removeVerticalRulerListener(IVerticalRulerListener listener) {
throw new UnsupportedOperationException();
}
-
+
/*
* @see org.eclipse.jface.text.source.LineNumberRulerColumn#doPaint(org.eclipse.swt.graphics.GC)
*/
@@ -193,7 +193,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
if (fShowNumbers || fCharacterDisplay)
super.doPaint(gc, visibleLines);
}
-
+
/*
* @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#getHover()
*/
@@ -243,7 +243,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
public void setDeletedColor(Color deletedColor) {
fDiffPainter.setDeletedColor(deletedColor);
}
-
+
/*
* @see org.eclipse.jface.text.revisions.IRevisionRulerColumn#setRevisionInformation(org.eclipse.jface.text.revisions.RevisionInformation)
*/
@@ -273,7 +273,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
/**
* Sets the line number display mode.
- *
+ *
* @param showNumbers <code>true</code> to show numbers, <code>false</code> to only show
* diff / revision info.
* @since 3.3
@@ -299,7 +299,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
/**
* Returns <code>true</code> if the ruler is showing line numbers, <code>false</code>
* otherwise
- *
+ *
* @return <code>true</code> if line numbers are shown, <code>false</code> otherwise
* @since 3.3
*/
@@ -310,7 +310,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
/**
* Returns <code>true</code> if the ruler is showing revision information, <code>false</code>
* otherwise
- *
+ *
* @return <code>true</code> if revision information is shown, <code>false</code> otherwise
* @since 3.3
*/
@@ -321,7 +321,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
/**
* Returns <code>true</code> if the ruler is showing change information, <code>false</code>
* otherwise
- *
+ *
* @return <code>true</code> if change information is shown, <code>false</code> otherwise
* @since 3.3
*/
@@ -368,7 +368,7 @@ public final class LineNumberChangeRulerColumn extends LineNumberRulerColumn imp
public void removeRevisionListener(IRevisionListener listener) {
fRevisionPainter.removeRevisionListener(listener);
}
-
+
/*
* @see org.eclipse.jface.text.source.LineNumberRulerColumn#handleDispose()
* @since 3.3
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
index 8cb5cb7d9ba..2741c00c6fd 100644
--- 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
@@ -157,7 +157,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
/**
* Called when line drag selection started. Adds mouse move and track
* listeners to this column's control.
- *
+ *
* @param expandExistingSelection if <code>true</code> the existing selection will be expanded,
* otherwise a new selection is started
*/
@@ -195,7 +195,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
} catch (BadLocationException x) {
}
}
-
+
/**
* Called when line drag selection stopped. Removes all previously
* installed listeners from this column's control.
@@ -216,13 +216,13 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
IDocument document= fCachedTextViewer.getDocument();
IRegion lineInfo= document.getLineInformation(lineNumber);
-
+
Display display= fCachedTextWidget.getDisplay();
Point absolutePosition= display.getCursorLocation();
Point relativePosition= fCachedTextWidget.toControl(absolutePosition);
int offset;
-
+
if (relativePosition.x < 0)
offset= lineInfo.getOffset();
else {
@@ -295,7 +295,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
autoScroll(SWT.UP);
return true;
}
-
+
stopAutoScroll();
return false;
}
@@ -699,7 +699,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
/**
* Returns the view port height in lines.
- *
+ *
* @return the view port height in lines
* @deprecated as of 3.2 the number of lines in the viewport cannot be computed because
* StyledText supports variable line heights
@@ -707,12 +707,12 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
protected int getVisibleLinesInViewport() {
return getVisibleLinesInViewport(fCachedTextWidget);
}
-
+
/**
* Returns <code>true</code> if the viewport displays the entire viewer contents, i.e. the
* viewer is not vertically scrollable.
- *
+ *
* @return <code>true</code> if the viewport displays the entire contents, <code>false</code> otherwise
* @since 3.2
*/
@@ -729,10 +729,10 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
*/
void doPaint(GC gc, ILineRange visibleLines) {
Display display= fCachedTextWidget.getDisplay();
-
+
// draw diff info
int y= -JFaceTextUtil.getHiddenTopLinePixels(fCachedTextWidget);
-
+
int lastLine= end(visibleLines);
for (int line= visibleLines.getStartLine(); line < lastLine; line++) {
int widgetLine= JFaceTextUtil.modelLineToWidgetLine(fCachedTextViewer, line);
@@ -749,7 +749,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
private static int end(ILineRange range) {
return range.getStartLine() + range.getNumberOfLines();
}
-
+
/**
* Computes the string to be printed for <code>line</code>. The default implementation returns
* <code>Integer.toString(line + 1)</code>.
@@ -783,7 +783,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
*/
int offset= fCachedTextWidget.getOffsetAtLine(widgetLine);
int widgetBaseline= fCachedTextWidget.getBaseline(offset);
-
+
FontMetrics fm= gc.getFontMetrics();
int fontBaseline= fm.getAscent() + fm.getLeading();
int baselineBias= widgetBaseline - fontBaseline;
@@ -877,7 +877,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
/**
* Returns the number of lines in the view port.
- *
+ *
* @param textWidget the styled text widget
* @return the number of lines visible in the view port <code>-1</code> if there's no client
* area
@@ -897,5 +897,5 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
}
return -1;
}
-
+
}
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
index 39409af55a5..0306bcae9a5 100644
--- 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
@@ -61,7 +61,7 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener {
* 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 exclusive access to the given pair matcher.
- *
+ *
* @param sourceViewer the source viewer
* @param matcher the character pair matcher
*/
@@ -175,7 +175,7 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener {
if (gc != null) {
gc.setForeground(fColor);
-
+
Rectangle bounds;
if (length > 0)
bounds= fTextWidget.getTextBounds(offset, offset + length - 1);
@@ -183,7 +183,7 @@ public final class MatchingCharacterPainter implements IPainter, PaintListener {
Point loc= fTextWidget.getLocationAtOffset(offset);
bounds= new Rectangle(loc.x, loc.y, 1, fTextWidget.getLineHeight(offset));
}
-
+
// draw box around line segment
gc.drawRectangle(bounds.x, bounds.y, bounds.width - 1, bounds.height - 1);
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
index 28bbd87965b..10c72d6df0a 100644
--- 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
@@ -93,12 +93,12 @@ public class OverviewRuler implements IOverviewRuler {
public void modelChanged(AnnotationModelEvent event) {
if (!event.isValid())
return;
-
+
if (event.isWorldChange()) {
update();
return;
}
-
+
Annotation[] annotations= event.getAddedAnnotations();
int length= annotations.length;
for (int i= 0; i < length; i++) {
@@ -107,7 +107,7 @@ public class OverviewRuler implements IOverviewRuler {
return;
}
}
-
+
annotations= event.getRemovedAnnotations();
length= annotations.length;
for (int i= 0; i < length; i++) {
@@ -116,7 +116,7 @@ public class OverviewRuler implements IOverviewRuler {
return;
}
}
-
+
annotations= event.getChangedAnnotations();
length= annotations.length;
for (int i= 0; i < length; i++) {
@@ -125,7 +125,7 @@ public class OverviewRuler implements IOverviewRuler {
return;
}
}
-
+
}
}
@@ -362,7 +362,7 @@ public class OverviewRuler implements IOverviewRuler {
* @since 3.0
*/
private List fCachedAnnotations= new ArrayList();
-
+
/**
* Redraw runnable lock
* @since 3.3
@@ -390,7 +390,7 @@ public class OverviewRuler implements IOverviewRuler {
* Tells whether temporary annotations are drawn with
* a separate color. This color will be computed by
* discoloring the original annotation color.
- *
+ *
* @since 3.4
*/
private boolean fIsTemporaryAnnotationDiscolored;
@@ -414,7 +414,7 @@ public class OverviewRuler implements IOverviewRuler {
/**
* 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
@@ -577,7 +577,7 @@ public class OverviewRuler implements IOverviewRuler {
gc.fillRectangle(0, 0, size.x, size.y);
cacheAnnotations();
-
+
if (fTextViewer instanceof ITextViewerExtension5)
doPaint1(gc);
else
@@ -608,7 +608,7 @@ public class OverviewRuler implements IOverviewRuler {
Point size= fCanvas.getSize();
int writable= JFaceTextUtil.computeLineHeight(textWidget, 0, maxLines, maxLines);
-
+
if (size.y > writable)
size.y= Math.max(writable - fHeader.getSize().y, 0);
@@ -622,7 +622,7 @@ public class OverviewRuler implements IOverviewRuler {
for (int t=0; t < style.length; t++) {
Iterator e= new FilterIterator(annotationType, style[t], fCachedAnnotations.iterator());
-
+
boolean areColorsComputed= false;
Color fill= null;
Color stroke= null;
@@ -733,7 +733,7 @@ public class OverviewRuler implements IOverviewRuler {
for (int t=0; t < style.length; t++) {
Iterator e= new FilterIterator(annotationType, style[t], fCachedAnnotations.iterator());
-
+
boolean areColorsComputed= false;
Color fill= null;
Color stroke= null;
@@ -1296,7 +1296,7 @@ public class OverviewRuler implements IOverviewRuler {
private void updateHeader() {
if (fHeader == null || fHeader.isDisposed())
return;
-
+
fHeader.setToolTipText(null);
Object colorType= null;
@@ -1304,7 +1304,7 @@ public class OverviewRuler implements IOverviewRuler {
Object annotationType= fAnnotationsSortedByLayer.get(i);
if (skipInHeader(annotationType) || skip(annotationType))
continue;
-
+
Iterator e= new FilterIterator(annotationType, FilterIterator.PERSISTENT | FilterIterator.TEMPORARY | FilterIterator.IGNORE_BAGS, fCachedAnnotations.iterator());
while (e.hasNext()) {
if (e.next() != null) {
@@ -1328,18 +1328,18 @@ public class OverviewRuler implements IOverviewRuler {
}
fHeaderPainter.setColor(color);
}
-
+
fHeader.redraw();
}
-
+
/**
* Updates the header tool tip text of this ruler.
*/
private void updateHeaderToolTipText() {
if (fHeader == null || fHeader.isDisposed())
return;
-
+
if (fHeader.getToolTipText() != null)
return;
@@ -1371,7 +1371,7 @@ public class OverviewRuler implements IOverviewRuler {
overview += JFaceTextMessages.getFormattedString("OverviewRulerHeader.toolTipTextEntry", new Object[] {annotationTypeLabel, new Integer(count)}); //$NON-NLS-1$
}
}
-
+
if (overview.length() > 0)
fHeader.setToolTipText(overview);
}
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
index aa7df2a72d6..e10f80eb998 100644
--- 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
@@ -53,12 +53,12 @@ class OverviewRulerHoverManager extends AnnotationBarHoverManager {
Point location= getHoverEventLocation();
int line= getVerticalRulerInfo().toDocumentLineNumber(location.y);
IAnnotationHover hover= getAnnotationHover();
-
+
IInformationControlCreator controlCreator= null;
if (hover instanceof IAnnotationHoverExtension)
controlCreator= ((IAnnotationHoverExtension)hover).getHoverControlCreator();
setCustomInformationControlCreator(controlCreator);
-
+
setInformation(hover.getHoverInfo(getSourceViewer(), line), computeArea(location.y));
}
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
index 5f112f770c1..dff8afecf7c 100644
--- 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
@@ -453,7 +453,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
fOverviewRulerHoveringController.getInternalAccessor().setInformationControlReplacer(new StickyHoverManager(this));
}
}
-
+
/*
* @see org.eclipse.jface.text.TextViewer#setHoverEnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode)
* @since 3.4
@@ -511,17 +511,17 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
/**
* Disposes the visual annotation model.
- *
+ *
* @since 3.1
*/
protected void disposeVisualAnnotationModel() {
if (fVisualAnnotationModel != null) {
if (getDocument() != null)
fVisualAnnotationModel.disconnect(getDocument());
-
+
if ( fVisualAnnotationModel instanceof IAnnotationModelExtension)
((IAnnotationModelExtension)fVisualAnnotationModel).removeAnnotationModel(MODEL_ANNOTATION_MODEL);
-
+
fVisualAnnotationModel= null;
}
}
@@ -570,7 +570,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public final ContentAssistantFacade getContentAssistantFacade() {
@@ -687,7 +687,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
if (operation == CONTENTASSIST_CONTEXT_INFORMATION)
return fContentAssistant != null && fContentAssistantInstalled && isEditable();
-
+
if (operation == QUICK_ASSIST)
return fQuickAssistAssistant != null && fQuickAssistAssistantInstalled && isEditable();
@@ -950,10 +950,10 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
break;
}
case QUICK_ASSIST: {
-
+
if (fQuickAssistAssistant == null)
return;
-
+
if (enable) {
if (!fQuickAssistAssistantInstalled) {
fQuickAssistAssistant.install(this);
@@ -1031,14 +1031,14 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
/**
* Tells whether the vertical ruler only acts as annotation ruler.
- *
+ *
* @return <code>true</code> if the vertical ruler only show annotations
* @since 3.3
*/
private boolean isVerticalRulerOnlyShowingAnnotations() {
if (fVerticalRuler instanceof VerticalRuler)
return true;
-
+
if (fVerticalRuler instanceof CompositeRuler) {
Iterator iter= ((CompositeRuler)fVerticalRuler).getDecoratorIterator();
return iter.hasNext() && iter.next() instanceof AnnotationRulerColumn && !iter.hasNext();
@@ -1074,7 +1074,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
}
}
}
-
+
/*
* @see org.eclipse.jface.text.source.ISourceViewer#getCurrentAnnotationHover()
* @since 3.2
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
index be73aa275ce..4e87f5ec3e6 100644
--- 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
@@ -220,11 +220,11 @@ public class SourceViewerConfiguration {
public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
return new String[] { "\t", " ", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
-
+
/**
* Computes and returns the indent prefixes for tab indentation
* which is represented as <code>tabSizeInSpaces</code>.
- *
+ *
* @param tabWidth the display tab width
* @return the indent prefixes
* @see #getIndentPrefixes(ISourceViewer, String)
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/TextInvocationContext.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/TextInvocationContext.java
index 51c2121bc2b..7d9fa00e74f 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/TextInvocationContext.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/TextInvocationContext.java
@@ -18,7 +18,7 @@ import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext;
* <p>
* Clients may extend this class to add additional context information.
* </p>
- *
+ *
* @since 3.3
*/
public class TextInvocationContext implements IQuickAssistInvocationContext {
@@ -26,7 +26,7 @@ public class TextInvocationContext implements IQuickAssistInvocationContext {
private ISourceViewer fSourceViewer;
private int fOffset;
private int fLength;
-
+
public TextInvocationContext(ISourceViewer sourceViewer, int offset, int length) {
fSourceViewer= sourceViewer;
fOffset= offset;
@@ -53,5 +53,5 @@ public class TextInvocationContext implements IQuickAssistInvocationContext {
public ISourceViewer getSourceViewer() {
return fSourceViewer;
}
-
+
}
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
index 9c2bfc7be1a..9fef74e0446 100644
--- 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
@@ -346,10 +346,10 @@ public final class VerticalRuler implements IVerticalRuler, IVerticalRulerExtens
r.x= 0;
r.y= JFaceTextUtil.computeLineHeight(styledText, 0, startLine, startLine) - fScrollPos;
-
+
r.width= d.x;
int lines= endLine - startLine;
-
+
r.height= JFaceTextUtil.computeLineHeight(styledText, startLine, endLine + 1, (lines+1));
if (r.y < d.y && annotationAccessExtension != null) // annotation within visible area
@@ -424,10 +424,10 @@ public final class VerticalRuler implements IVerticalRuler, IVerticalRulerExtens
r.x= 0;
r.y= JFaceTextUtil.computeLineHeight(textWidget, 0, startLine, startLine) - fScrollPos;
-
+
r.width= dimension.x;
int lines= endLine - startLine;
-
+
r.height= JFaceTextUtil.computeLineHeight(textWidget, startLine, endLine + 1, lines+1);
if (r.y < dimension.y && annotationAccessExtension != null) // annotation within visible area
@@ -520,13 +520,13 @@ public final class VerticalRuler implements IVerticalRuler, IVerticalRulerExtens
StyledText text= fTextViewer.getTextWidget();
int line= text.getLineIndex(y_coordinate);
-
+
if (line == text.getLineCount() - 1) {
// check whether y_coordinate exceeds last line
if (y_coordinate > text.getLinePixel(line + 1))
return -1;
}
-
+
return widgetLine2ModelLine(fTextViewer, line);
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/JFaceTextTemplateMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/JFaceTextTemplateMessages.java
index 9367244333b..8c96ec23f75 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/JFaceTextTemplateMessages.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/JFaceTextTemplateMessages.java
@@ -10,10 +10,11 @@
*******************************************************************************/
package org.eclipse.jface.text.templates;
-import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import com.ibm.icu.text.MessageFormat;
+
/**
* @since 3.0
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/PositionBasedCompletionProposal.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/PositionBasedCompletionProposal.java
index b95f1b2bb58..f969eae1cac 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/PositionBasedCompletionProposal.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/PositionBasedCompletionProposal.java
@@ -29,7 +29,7 @@ import org.eclipse.jface.text.contentassist.IContextInformation;
/**
* A position based completion proposal.
- *
+ *
* @since 3.0
*/
final class PositionBasedCompletionProposal implements ICompletionProposal, ICompletionProposalExtension2 {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/TemplateProposal.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/TemplateProposal.java
index 04878dde6cd..d5b9651a52d 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/TemplateProposal.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/TemplateProposal.java
@@ -10,8 +10,14 @@
*******************************************************************************/
package org.eclipse.jface.text.templates;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Shell;
+
import org.eclipse.core.runtime.Assert;
+
import org.eclipse.jface.dialogs.MessageDialog;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DocumentEvent;
@@ -32,9 +38,6 @@ import org.eclipse.jface.text.link.LinkedModeUI;
import org.eclipse.jface.text.link.LinkedPosition;
import org.eclipse.jface.text.link.LinkedPositionGroup;
import org.eclipse.jface.text.link.ProposalPosition;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
/**
@@ -191,7 +194,7 @@ public class TemplateProposal implements ICompletionProposal, ICompletionProposa
document.addPosition(getCategory(), pos);
proposals[j]= new PositionBasedCompletionProposal(values[j], pos, length);
}
-
+
if (proposals.length > 1)
first= new ProposalPosition(document, offsets[0] + start, length, proposals);
else
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceMessages.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceMessages.java
index b756bad3b54..a830e173f6f 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceMessages.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceMessages.java
@@ -10,10 +10,11 @@
*******************************************************************************/
package org.eclipse.jface.text.templates.persistence;
-import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import com.ibm.icu.text.MessageFormat;
+
/**
* @since 3.0
*/
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateReaderWriter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateReaderWriter.java
index 1ce8a33c48d..f73a5f29793 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateReaderWriter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateReaderWriter.java
@@ -32,6 +32,9 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
@@ -41,9 +44,6 @@ import org.w3c.dom.Text;
import org.eclipse.core.runtime.Assert;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
import org.eclipse.jface.text.templates.Template;
/**
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateStore.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateStore.java
index 10bceecb54c..c4fb28d3c47 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateStore.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplateStore.java
@@ -54,13 +54,13 @@ public class TemplateStore {
/**
* Set to <code>true</code> if property change events should be ignored (e.g. during writing
* to the preference store).
- *
+ *
* @since 3.2
*/
private boolean fIgnorePreferenceStoreChanges= false;
/**
* The property listener, if any is registered, <code>null</code> otherwise.
- *
+ *
* @since 3.2
*/
private IPropertyChangeListener fPropertyListener;
@@ -108,13 +108,13 @@ public class TemplateStore {
loadContributedTemplates();
loadCustomTemplates();
}
-
+
/**
* Starts listening for property changes on the preference store. If the configured preference
* key changes, the template store is {@link #load() reloaded}. Call
* {@link #stopListeningForPreferenceChanges()} to remove any listener and stop the
* auto-updating behavior.
- *
+ *
* @since 3.2
*/
public final void startListeningForPreferenceChanges() {
@@ -136,13 +136,13 @@ public class TemplateStore {
};
fPreferenceStore.addPropertyChangeListener(fPropertyListener);
}
-
+
}
-
+
/**
* Stops the auto-updating behavior started by calling
* {@link #startListeningForPreferenceChanges()}.
- *
+ *
* @since 3.2
*/
public final void stopListeningForPreferenceChanges() {
@@ -151,11 +151,11 @@ public class TemplateStore {
fPropertyListener= null;
}
}
-
+
/**
* Handles an {@link IOException} thrown during reloading the preferences due to a preference
* store update. The default is to write to stderr.
- *
+ *
* @param x the exception
* @since 3.2
*/
@@ -276,7 +276,7 @@ public class TemplateStore {
/**
* Deletes all user-added templates and reverts all contributed templates.
- *
+ *
* @param doSave <code>true</code> if the store should be saved after restoring
* @since 3.5
*/
@@ -298,7 +298,7 @@ public class TemplateStore {
// can't log from jface-text
x.printStackTrace();
}
-
+
if (oldValue != null) {
try {
fIgnorePreferenceStoreChanges= true;
diff --git a/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchEngine.java b/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchEngine.java
index fa3445e1944..6ea2cb9209f 100644
--- a/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchEngine.java
+++ b/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchEngine.java
@@ -32,7 +32,7 @@ import org.eclipse.search.internal.ui.SearchPlugin;
* @since 3.2
*/
public abstract class TextSearchEngine {
-
+
/**
* Creates an instance of the search engine. By default this is the default text search engine (see {@link #createDefault()}),
* but extensions can offer more sophisticated search engine implementations.
@@ -41,7 +41,7 @@ public abstract class TextSearchEngine {
public static TextSearchEngine create() {
return SearchPlugin.getDefault().getTextSearchEngineRegistry().getPreferred();
}
-
+
/**
* Creates the default, built-in, text search engine that implements a brute-force search, not using
* any search index.
@@ -53,13 +53,13 @@ public abstract class TextSearchEngine {
public IStatus search(TextSearchScope scope, TextSearchRequestor requestor, Pattern searchPattern, IProgressMonitor monitor) {
return new TextSearchVisitor(requestor, searchPattern).search(scope, monitor);
}
-
+
public IStatus search(IFile[] scope, TextSearchRequestor requestor, Pattern searchPattern, IProgressMonitor monitor) {
return new TextSearchVisitor(requestor, searchPattern).search(scope, monitor);
}
};
}
-
+
/**
* Uses a given search pattern to find matches in the content of workspace file resources. If a file is open in an editor, the
* editor buffer is searched.
@@ -83,5 +83,5 @@ public abstract class TextSearchEngine {
* @return the status containing information about problems in resources searched.
*/
public abstract IStatus search(IFile[] scope, TextSearchRequestor requestor, Pattern searchPattern, IProgressMonitor monitor);
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchMatchAccess.java b/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchMatchAccess.java
index 2ad73b8b776..2abcc6b4d1f 100644
--- a/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchMatchAccess.java
+++ b/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchMatchAccess.java
@@ -14,10 +14,10 @@ package org.eclipse.search.core.text;
import org.eclipse.core.resources.IFile;
/**
- * A {@link TextSearchMatchAccess} gives access to a pattern match found by the {@link TextSearchEngine}.
+ * A {@link TextSearchMatchAccess} gives access to a pattern match found by the {@link TextSearchEngine}.
* <p>
* Please note that <code>{@link TextSearchMatchAccess}</code> objects <b>do not
- * </b> have value semantic. The state of the object might change over
+ * </b> have value semantic. The state of the object might change over
* time especially since objects are reused for different call backs. Clients shall not keep a reference to
* a {@link TextSearchMatchAccess} element.
* </p>
@@ -27,48 +27,48 @@ import org.eclipse.core.resources.IFile;
* @since 3.2
*/
public abstract class TextSearchMatchAccess {
-
+
/**
* Returns the file the match was found in.
- *
+ *
* @return the file the match was found.
*/
public abstract IFile getFile();
-
+
/**
* Returns the offset of this search match.
- *
+ *
* @return the offset of this search match
*/
public abstract int getMatchOffset();
-
+
/**
* Returns the length of this search match.
- *
+ *
* @return the length of this search match
*/
public abstract int getMatchLength();
-
+
/**
* Returns the length of this file's content.
- *
+ *
* @return the length of this file's content.
*/
public abstract int getFileContentLength();
-
+
/**
* Returns a character of the file's content at the given offset
- *
+ *
* @param offset the offset
* @return the character at the given offset
* @throws IndexOutOfBoundsException an {@link IndexOutOfBoundsException} is
* thrown when the <code>offset</code> is negative or not less than the file content's length.
*/
public abstract char getFileContentChar(int offset);
-
+
/**
* Returns the file's content at the given offsets.
- *
+ *
* @param offset the offset of the requested content
* @param length the of the requested content
* @return the substring of the file's content
diff --git a/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchRequestor.java b/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchRequestor.java
index 842c1d946ac..6547a66107a 100644
--- a/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchRequestor.java
+++ b/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchRequestor.java
@@ -16,10 +16,10 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.resources.IFile;
/**
- * Collects the results from a search engine query.
+ * Collects the results from a search engine query.
* Clients implement a subclass to pass to {@link TextSearchEngine#search(TextSearchScope,
* TextSearchRequestor, java.util.regex.Pattern, org.eclipse.core.runtime.IProgressMonitor)}
- * and implement the {@link #acceptPatternMatch(TextSearchMatchAccess)}
+ * and implement the {@link #acceptPatternMatch(TextSearchMatchAccess)}
* method, and possibly override other life cycle methods.
* <p>
* The search engine calls {@link #beginReporting()} when a search starts,
@@ -41,7 +41,7 @@ import org.eclipse.core.resources.IFile;
* @since 3.2
*/
public abstract class TextSearchRequestor {
-
+
/**
* Notification sent before starting the search action.
* Typically, this would tell a search requestor to clear previously
@@ -67,7 +67,7 @@ public abstract class TextSearchRequestor {
public void endReporting() {
// do nothing
}
-
+
/**
* Notification sent before search starts in the given file. This method is called for all files that are contained
* in the search scope.
@@ -83,7 +83,7 @@ public abstract class TextSearchRequestor {
public boolean acceptFile(IFile file) throws CoreException {
return true;
}
-
+
/**
* Notification sent that a file might contain binary context.
* It is the choice of the search engine to report binary files and it is the heuristic of the search engine to decide
@@ -96,14 +96,14 @@ public abstract class TextSearchRequestor {
* <p>
* The default behaviour is to skip binary files
* </p>
- *
+ *
* @param file the file that might be binary
* @return If false, no pattern matches will be reported for the content of this file.
*/
public boolean reportBinaryFile(IFile file) {
return false;
}
-
+
/**
* Accepts the given search match and decides if the search should continue for this file.
*
diff --git a/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchScope.java b/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchScope.java
index adad971f2b1..a2f13d98603 100644
--- a/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchScope.java
+++ b/org.eclipse.search/new search/org/eclipse/search/core/text/TextSearchScope.java
@@ -27,19 +27,19 @@ import org.eclipse.search.internal.core.text.FilesOfScopeCalculator;
* A {@link TextSearchScope} defines the scope of a search. The scope consists of all workbench resources that are accepted
* by {@link #contains(IResourceProxy)} and that either are a root element ({@link #getRoots()}) or have a root element
* in their parent chain.
- *
+ *
* @see #newSearchScope(IResource[], java.util.regex.Pattern, boolean)
* @since 3.2
*/
public abstract class TextSearchScope {
-
-
+
+
/**
* Creates a scope that consists of all files that match the <code>fileNamePattern</code> and that
* either are one of the roots, or have one of the roots in their parent chain.
* If <code>visitDerivedResources</code> is not enabled, all files that are marked derived or
* have a derived container in their parent chain are not part of the scope.
- *
+ *
* @param rootResources the resources that are the roots of the scope
* @param fileNamePattern file name pattern for this scope.
* @param visitDerivedResources if set also derived folders and files are searched.
@@ -50,32 +50,32 @@ public abstract class TextSearchScope {
scope.setFileNamePattern(fileNamePattern);
return scope;
}
-
-
+
+
/**
* Returns the resources that form the root. Roots can not contain each other. Root elements are only part of the
* scope if they are also accepted by {@link #contains(IResourceProxy)}.
- *
+ *
* @return returns the set of root resources. The default behavior is to return the workspace root.
*/
public IResource[] getRoots() {
return new IResource[] { ResourcesPlugin.getWorkspace().getRoot() };
}
-
+
/**
* Returns if a given resource is part of the scope. If a container is not part of the scope, also all its members
* are not part of the scope.
- *
- * @param proxy the resource proxy to test.
+ *
+ * @param proxy the resource proxy to test.
* @return returns <code>true</code> if a resource is part of the scope. if <code>false</code> is returned the resource
* and all its children are not part of the scope.
*/
public abstract boolean contains(IResourceProxy proxy);
-
+
/**
* Evaluates all files in this scope.
- *
+ *
* @param status a {@link MultiStatus} to collect the error status that occurred while collecting resources.
* @return returns the files in the scope.
*/
@@ -83,5 +83,5 @@ public abstract class TextSearchScope {
return new FilesOfScopeCalculator(this, status).process();
}
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/IContextMenuConstants.java b/org.eclipse.search/new search/org/eclipse/search/ui/IContextMenuConstants.java
index 48ba05f173d..669c22c6007 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/IContextMenuConstants.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/IContextMenuConstants.java
@@ -17,9 +17,9 @@ import org.eclipse.ui.IWorkbenchActionConstants;
* <p>
* This interface declares constants only; it is not intended to be implemented.
* </p>
- *
+ *
* @since 2.0
- *
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IContextMenuConstants {
@@ -47,7 +47,7 @@ public interface IContextMenuConstants {
* </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>
@@ -59,7 +59,7 @@ public interface IContextMenuConstants {
* </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>
@@ -76,53 +76,53 @@ public interface IContextMenuConstants {
* 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;
-
+ */
+ 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 filtering (value <code>"group.filtering"</code>).
* @since 3.3
- */
+ */
public static final String GROUP_FILTERING= "group.filtering"; //$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 cut/copy/paste actions (value <code>"group.edit"</code>).
* @since 3.3
*/
- public static final String GROUP_EDIT = "group.edit"; //$NON-NLS-1$
-
+ public static final String GROUP_EDIT = "group.edit"; //$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/new search/org/eclipse/search/ui/IQueryListener.java b/org.eclipse.search/new search/org/eclipse/search/ui/IQueryListener.java
index 84d72cad92a..1eee41d4bf2 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/IQueryListener.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/IQueryListener.java
@@ -13,36 +13,36 @@ package org.eclipse.search.ui;
/**
* <p>A listener for changes to the set of search queries. Queries are added by running
- * them via {@link org.eclipse.search.ui.NewSearchUI#runQueryInBackground(ISearchQuery) NewSearchUI#runQueryInBackground(ISearchQuery)} or
+ * them via {@link org.eclipse.search.ui.NewSearchUI#runQueryInBackground(ISearchQuery) NewSearchUI#runQueryInBackground(ISearchQuery)} or
* {@link org.eclipse.search.ui.NewSearchUI#runQueryInForeground(org.eclipse.jface.operation.IRunnableContext,ISearchQuery) NewSearchUI#runQueryInForeground(IRunnableContext,ISearchQuery)}</p>
* <p>The search UI determines when queries are rerun, stopped or deleted (and will notify
* interested parties via this interface). Listeners can be added and removed in the {@link org.eclipse.search.ui.NewSearchUI NewSearchUI} class.
* </p>
* <p>Clients may implement this interface.</p>
- *
+ *
* @since 3.0
*/
public interface IQueryListener {
/**
* Called when an query has been added to the system.
- *
+ *
* @param query the query that has been added
*/
-
+
void queryAdded(ISearchQuery query);
/**
* Called when a query has been removed.
- *
+ *
* @param query the query that has been removed
*/
void queryRemoved(ISearchQuery query);
-
+
/**
* Called before an <code>ISearchQuery</code> is starting.
* @param query the query about to start
*/
void queryStarting(ISearchQuery query);
-
+
/**
* Called after an <code>ISearchQuery</code> has finished.
* @param query the query that has finished
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/IReplacePage.java b/org.eclipse.search/new search/org/eclipse/search/ui/IReplacePage.java
index d00f95e94df..cb921611d78 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/IReplacePage.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/IReplacePage.java
@@ -12,7 +12,7 @@ package org.eclipse.search.ui;
/**
* An extension interface to <code>ISearchPage</code>. If clients implement
- * <code>IReplacePage</code> in addition to <code>ISearchPage</code>, a
+ * <code>IReplacePage</code> in addition to <code>ISearchPage</code>, a
* "Replace" button will be shown in the search dialog.
*
* @since 3.0
@@ -27,5 +27,5 @@ public interface IReplacePage {
* @return <code>true</code> if the dialog can be closed after execution
*/
public boolean performReplace();
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPage.java b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPage.java
index 1012f536578..b308f24220e 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPage.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPage.java
@@ -21,7 +21,7 @@ import org.eclipse.jface.dialogs.IDialogPage;
* button is pressed.
* </p>
* <p>
- * If the search page additionally implements {@link IReplacePage}, a
+ * If the search page additionally implements {@link IReplacePage}, a
* 'Replace' button will be shown in the search dialog.
* </p>
*
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPageContainer.java b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPageContainer.java
index b39adaf6a91..605269559a8 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPageContainer.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPageContainer.java
@@ -23,37 +23,37 @@ import org.eclipse.ui.IWorkingSet;
* <p>
* This interface is not intended to be implemented by clients.
* </p>
- *
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ISearchPageContainer {
/**
* Workspace scope (value <code>0</code>).
- *
+ *
* @since 2.0
- */
+ */
public static final int WORKSPACE_SCOPE= 0;
/**
* Selection scope (value <code>1</code>).
- *
+ *
* @since 2.0
- */
+ */
public static final int SELECTION_SCOPE= 1;
/**
* Working set scope (value <code>2</code>).
- *
+ *
* @since 2.0
- */
+ */
public static final int WORKING_SET_SCOPE= 2;
/**
* Current Project scope (value <code>3</code>).
- *
+ *
* @since 3.0
- */
+ */
public static final int SELECTED_PROJECTS_SCOPE= 3;
/**
@@ -61,7 +61,7 @@ public interface ISearchPageContainer {
*
* @return the selection passed to this container when it was opened
*/
- public ISelection getSelection();
+ public ISelection getSelection();
/**
* Returns the context for the search operation.
@@ -82,24 +82,24 @@ public interface ISearchPageContainer {
/**
* Returns search container's selected scope.
* The scope is WORKSPACE_SCOPE, SELECTED_PROJECTS_SCOPE, SELECTION_SCOPE or WORKING_SET_SCOPE.
- *
+ *
* @return the selected scope
* @since 2.0
- */
+ */
public int getSelectedScope();
/**
* Sets the selected scope of this search page container.
* The scope is WORKSPACE_SCOPE, SELECTED_PROJECTS_SCOPE, SELECTION_SCOPE or WORKING_SET_SCOPE.
* @param scope the newly 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
*/
@@ -107,7 +107,7 @@ public interface ISearchPageContainer {
/**
* 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 {@link #WORKING_SET_SCOPE}
* @since 2.0
*/
@@ -115,19 +115,19 @@ public interface ISearchPageContainer {
/**
* Sets the selected working sets of this container.
- *
+ *
* @param workingSets an array of IWorkingSet
* @since 2.0
*/
public void setSelectedWorkingSets(IWorkingSet[] workingSets);
-
+
/**
* Returns the names of the enclosing projects if selected by the container or <code>null</code>
* if the scope is not {@link #SELECTED_PROJECTS_SCOPE}
- *
+ *
* @return the names of the enclosing project or <code>null</code> if the scope is not {@link #SELECTED_PROJECTS_SCOPE}.
* @since 3.2
*/
public String[] getSelectedProjectNames();
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPageScoreComputer.java b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPageScoreComputer.java
index 4443266c7a2..b37f8a9f900 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPageScoreComputer.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchPageScoreComputer.java
@@ -20,7 +20,7 @@ package org.eclipse.search.ui;
* 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.
- *
+ *
* Intended to be implemented.
* </p>
*/
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchQuery.java b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchQuery.java
index ffeb98c5311..8037de1fb35 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchQuery.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchQuery.java
@@ -23,17 +23,17 @@ import org.eclipse.core.runtime.OperationCanceledException;
* <p>
* Clients may implement this interface.
* </p>
- *
+ *
* @since 3.0
*/
public interface ISearchQuery {
/**
* This is the method that actually does the work, i.e. finds the results of
* the search query.
- *
+ *
* @param monitor the progress monitor to be used
- *
- * @return the status after completion of the search job.
+ *
+ * @return the status after completion of the search job.
* @throws OperationCanceledException Thrown when the search query has been canceled.
*/
IStatus run(IProgressMonitor monitor) throws OperationCanceledException;
@@ -43,14 +43,14 @@ public interface ISearchQuery {
* the background. Note that progress notification (for example, the number
* of matches found) should be done via the progress monitor passed into the
* <code>run(IProgressMonitor)</code> method
- *
+ *
* @return the user readable label of this query
*/
String getLabel();
/**
* Returns whether the query can be run more than once. Some queries may
* depend on transient information and return <code>false</code>.
- *
+ *
* @return whether this query can be run more than once
*/
boolean canRerun();
@@ -58,14 +58,14 @@ public interface ISearchQuery {
* Returns whether this query can be run in the background. Note that
* queries must do proper locking when they are run in the background (e.g.
* get the appropriate workspace locks).
- *
+ *
* @return whether this query can be run in the background
*/
boolean canRunInBackground();
/**
* Returns the search result associated with this query. This method can be
* called before run is called.
- *
+ *
* @return this query's search result
*/
ISearchResult getSearchResult();
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResult.java b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResult.java
index 603fc2a1123..e82afd97a5b 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResult.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResult.java
@@ -28,7 +28,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
* <p>
* Clients may implement this interface.
* </p>
- *
+ *
* @see org.eclipse.search.ui.ISearchResultPage
* @since 3.0
*/
@@ -36,39 +36,39 @@ public interface ISearchResult {
/**
* Adds a <code>ISearchResultListener</code>. Has no effect when the
* listener has already been added.
- *
+ *
* @param l the listener to be added
*/
void addListener(ISearchResultListener l);
/**
* Removes a <code>ISearchResultChangedListener</code>. Has no effect
* when the listener hasn't previously been added.
- *
+ *
* @param l the listener to be removed
*/
void removeListener(ISearchResultListener l);
/**
* Returns a user readable label for this search result. The label is typically used in the result
* view and should contain the search query string and number of matches.
- *
+ *
* @return the label for this search result
*/
String getLabel();
/**
* Returns a tooltip to be used when this search result is shown in the UI.
- *
+ *
* @return a user readable String
*/
String getTooltip();
/**
* Returns an image descriptor for the given ISearchResult.
- *
+ *
* @return an image representing this search result or <code>null</code>
*/
ImageDescriptor getImageDescriptor();
/**
* Returns the query that produced this search result.
- *
+ *
* @return the query producing this result
*/
ISearchQuery getQuery();
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultListener.java b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultListener.java
index 75550e29d29..61a406a500b 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultListener.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultListener.java
@@ -11,11 +11,11 @@
package org.eclipse.search.ui;
/**
* Listener interface for changes to an <code>ISearchResult</code>.
- * Implementers of <code>ISearchResult</code> should define subclasses of
+ * Implementers of <code>ISearchResult</code> should define subclasses of
* <code>SearchResultEvent</code> and send those to registered listeners. Implementers of
- * <code>ISearchResultListener</code> will in general know the concrete class of search
+ * <code>ISearchResultListener</code> will in general know the concrete class of search
* result they are listening to, and therefore the kind of events they
- * have to handle.
+ * have to handle.
* <p>
* Clients may implement this interface.
* </p>
@@ -26,9 +26,9 @@ public interface ISearchResultListener {
* Called to notify listeners of changes in a <code>ISearchResult</code>.
* The event object <code>e</code> is only guaranteed to be valid for
* the duration of the call.
- *
- * @param e the event object describing the change. Note that implementers
- * of <code>ISearchResult</code> will be sending subclasses of
+ *
+ * @param e the event object describing the change. Note that implementers
+ * of <code>ISearchResult</code> will be sending subclasses of
* <code>SearchResultEvent</code>
*/
void searchResultChanged(SearchResultEvent e);
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultPage.java b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultPage.java
index 7bf76009ee0..d728cc993a7 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultPage.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultPage.java
@@ -28,7 +28,7 @@ public interface ISearchResultPage extends IPageBookViewPage {
* page. For example, the current selection in a viewer. The UI state will
* be later passed into the <code>setInput()</code> method when the
* currently shown <code>ISearchResult</code> is shown again.
- *
+ *
* @return an object representing the UI state of this page
*/
Object getUIState();
@@ -36,10 +36,10 @@ public interface ISearchResultPage extends IPageBookViewPage {
* Sets the search result to be shown in this search results page.
* Implementers should restore UI state (e.g. selection) from the previously
* saved <code>uiState</code> object.
- *
+ *
* @param search the search result to be shown or <code>null</code> to clear the page.
* @param uiState the previously saved UI state
- *
+ *
* @see ISearchResultPage#getUIState()
*/
void setInput(ISearchResult search, Object uiState);
@@ -47,49 +47,49 @@ public interface ISearchResultPage extends IPageBookViewPage {
/**
* Sets the search view this search results page is shown in. This method will be called before
* the page is shown for the first time (i.e. before the page control is created).
- *
+ *
* @param part the parent search view
*/
void setViewPart(ISearchResultViewPart part);
/**
* Restores the page state. Note that this applies only to state that is
* saved across sessions.
- *
+ *
* @param memento a memento to restore the page state from or <code>null</code>
* if no previous state was saved
- *
+ *
* @see #setInput(ISearchResult, Object)
*/
void restoreState(IMemento memento);
/**
* Saves the page state in a memento. Note that this applies to state that
* should persist across sessions.
- *
+ *
* @param memento a memento to receive the object state
- *
+ *
* @see #getUIState()
*/
void saveState(IMemento memento);
/**
* Sets the id for this page. This method will be called before any other
* initialization is done.
- *
+ *
* @param id the id for this page
*/
void setID(String id);
/**
* Returns the id set via <code>setID</code>.
- *
+ *
* @return the id of this page
*/
String getID();
-
+
/**
* Returns a user readable label for this search result page. The label will be
* used to describe the contents for the page to the user (for example it will be
* displayed in the search view title bar). To take an example from file search,
* a label might read like this: 'test' - 896 matches in workspace.
- *
+ *
* @return the user readable label for this search result page
*/
String getLabel();
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultViewPart.java b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultViewPart.java
index e435c88bccb..aeed4486dda 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultViewPart.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/ISearchResultViewPart.java
@@ -22,30 +22,30 @@ import org.eclipse.ui.IViewPart;
* <p>
* This interface is not intended to be implemented by clients
* </p>
- *
+ *
* @see NewSearchUI#activateSearchResultView()
* @see NewSearchUI#getSearchResultView()
- *
+ *
* @since 3.0
- *
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ISearchResultViewPart extends IViewPart {
/**
* Search result pages should call this method to have the search results view contribute to
* their context menus.
- *
+ *
* @param menuManager the menu manager the search result view should contribute to
*/
void fillContextMenu(IMenuManager menuManager);
/**
* Returns the <code>ISearchResultPage</code> currently shown in this
* search view. Returns <code>null</code> if no page is currently shown.
- *
+ *
* @return the active <code>ISearchResultPage</code> or <code>null</code>
*/
ISearchResultPage getActivePage();
-
+
/**
* Requests that the search view updates the label it is showing for search result
* pages. Typically, a search result page will call this method when the search result
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/NewSearchUI.java b/org.eclipse.search/new search/org/eclipse/search/ui/NewSearchUI.java
index bfac5246116..19f32d9ac81 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/NewSearchUI.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/NewSearchUI.java
@@ -26,16 +26,16 @@ import org.eclipse.search2.internal.ui.SearchMessages;
/**
* A facade for access to the new search UI facilities.
- *
+ *
* @since 3.0
- *
+ *
*/
public class NewSearchUI {
/**
* Activates a search result view in the current workbench window page. If a
* search view is already open in the current workbench window page, it is
* activated. Otherwise a new search view is opened and activated.
- *
+ *
* @return the activate search result view or <code>null</code> if the
* search result view couldn't be activated
*/
@@ -44,7 +44,7 @@ public class NewSearchUI {
}
/**
* Gets the search result view shown in the current workbench window.
- *
+ *
* @return the search result view or <code>null</code>, if none is open
* in the current workbench window page
*/
@@ -57,7 +57,7 @@ public class NewSearchUI {
* returns <code>true</code>. Running a query adds it to the set of known
* queries and notifies any registered <code>IQueryListener</code>s about
* the addition.
- *
+ *
* @param query
* the query to execute
* @deprecated deprecated in 3.1.
@@ -76,22 +76,22 @@ public class NewSearchUI {
if (!status.isOK())
SearchPlugin.log(status);
if (status.getSeverity() == IStatus.ERROR) {
- ErrorDialog.openError(SearchPlugin.getActiveWorkbenchShell(), SearchMessages.NewSearchUI_error_title, SearchMessages.NewSearchUI_error_label, status);
+ ErrorDialog.openError(SearchPlugin.getActiveWorkbenchShell(), SearchMessages.NewSearchUI_error_title, SearchMessages.NewSearchUI_error_label, status);
}
}
}
}
-
+
/**
* Runs the given search query. This method will execute the query in a
- * background thread and not block until the search is finished.
+ * background thread and not block until the search is finished.
* Running a query adds it to the set of known queries and notifies
* any registered {@link IQueryListener}s about the addition.
* <p>
* The search view that shows the result will be activated. That means a call
* to {@link #activateSearchResultView} is not required.
* </p>
- *
+ *
* @param query
* the query to execute. The query must be able to run in background, that means
* {@link ISearchQuery#canRunInBackground()} must be <code>true</code>
@@ -104,17 +104,17 @@ public class NewSearchUI {
}
runQueryInBackground(query, null);
}
-
+
/**
* Runs the given search query. This method will execute the query in a
- * background thread and not block until the search is finished.
+ * background thread and not block until the search is finished.
* Running a query adds it to the set of known queries and notifies
* any registered {@link IQueryListener}s about the addition.
* <p>
* The result will be shown in the given search result view which will be activated. A call to
* to {@link #activateSearchResultView} is not required.
* </p>
- *
+ *
* @param query
* the query to execute. The query must be able to run in background, that means
* {@link ISearchQuery#canRunInBackground()} must be <code>true</code>
@@ -133,7 +133,7 @@ public class NewSearchUI {
else
throw new IllegalArgumentException("Query can not be run in background"); //$NON-NLS-1$
}
-
+
/**
* Runs the given search query. This method will execute the query in the
* same thread as the caller. This method blocks until the query is
@@ -143,7 +143,7 @@ public class NewSearchUI {
* The result will be shown in a search view that will be activated. That means a call
* to {@link #activateSearchResultView} is not required.
* </p>
- *
+ *
* @param context
* the runnable context to run the query in
* @param query
@@ -157,7 +157,7 @@ public class NewSearchUI {
}
return runQueryInForeground(context, query, null);
}
-
+
/**
* Runs the given search query. This method will execute the query in the
* same thread as the caller. This method blocks until the query is
@@ -167,7 +167,7 @@ public class NewSearchUI {
* The result will be shown in the given search result view which will be activated. A call to
* to {@link #activateSearchResultView} is not required.
* </p>
- *
+ *
* @param context
* the runnable context to run the query in
* @param query
@@ -177,7 +177,7 @@ public class NewSearchUI {
* mechanism is used to open a new result view or to select the view to be reused.
* @return a status indicating whether the query ran correctly, including {@link IStatus#CANCEL} to signal
* that the query was canceled.
- *
+ *
* @since 3.2
*/
public static IStatus runQueryInForeground(IRunnableContext context, ISearchQuery query, ISearchResultViewPart view) {
@@ -186,13 +186,13 @@ public class NewSearchUI {
}
return InternalSearchUI.getInstance().runSearchInForeground(context, query, view);
}
-
+
/**
* Registers the given listener to receive notification of changes to
* queries. The listener will be notified whenever a query has been added,
* removed, is starting or has finished. Has no effect if an identical
* listener is already registered.
- *
+ *
* @param l
* the listener to be added
*/
@@ -202,7 +202,7 @@ public class NewSearchUI {
/**
* Removes the given query listener. Does nothing if the listener is not
* present.
- *
+ *
* @param l
* the listener to be removed.
*/
@@ -212,17 +212,17 @@ public class NewSearchUI {
/**
* Returns all search queries know to the search UI (i.e. registered via
* <code>runQuery()</code> or <code>runQueryInForeground())</code>.
- *
+ *
* @return all search results
*/
public static ISearchQuery[] getQueries() {
return InternalSearchUI.getInstance().getQueries();
}
-
+
/**
* Returns whether the given query is currently running. Queries may be run
* by client request or by actions in the search UI.
- *
+ *
* @param query
* the query
* @return whether the given query is currently running
@@ -235,11 +235,11 @@ public class NewSearchUI {
}
return InternalSearchUI.getInstance().isQueryRunning(query);
}
-
+
/**
* Sends a 'cancel' command to the given query running in background.
- * The call has no effect if the query is not running, not in background or is not cancelable.
- *
+ * The call has no effect if the query is not running, not in background or is not cancelable.
+ *
* @param query
* the query
* @since 3.1
@@ -250,25 +250,25 @@ public class NewSearchUI {
}
InternalSearchUI.getInstance().cancelSearch(query);
}
-
+
/**
* 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$
- /**
+ /**
* Id of the new Search view
* (value <code>"org.eclipse.search.ui.views.SearchView"</code>).
*/
public static final String SEARCH_VIEW_ID= "org.eclipse.search.ui.views.SearchView"; //$NON-NLS-1$
-
+
/**
* Id of the Search action set
* (value <code>"org.eclipse.search.searchActionSet"</code>).
@@ -287,12 +287,12 @@ public class NewSearchUI {
*/
public static void openSearchDialog(IWorkbenchWindow window, String pageId) {
new OpenSearchDialogAction(window, pageId).run();
- }
+ }
/**
* 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
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/SearchResultEvent.java b/org.eclipse.search/new search/org/eclipse/search/ui/SearchResultEvent.java
index 0faee480f31..0efb49efc69 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/SearchResultEvent.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/SearchResultEvent.java
@@ -16,28 +16,28 @@ import java.util.EventObject;
* The common superclass of all events sent from <code>ISearchResults</code>.
* This class is supposed to be subclassed to provide more specific
* notification.
- *
+ *
* @see org.eclipse.search.ui.ISearchResultListener#searchResultChanged(SearchResultEvent)
- *
+ *
* @since 3.0
*/
public abstract class SearchResultEvent extends EventObject {
-
+
private static final long serialVersionUID= -4877459368182725252L;
-
-
+
+
/**
* Creates a new search result event for the given search result.
- *
+ *
* @param searchResult the source of the event
*/
protected SearchResultEvent(ISearchResult searchResult) {
super(searchResult);
}
-
+
/**
* Gets the <code>ISearchResult</code> for this event.
- *
+ *
* @return the source of this event
*/
public ISearchResult getSearchResult() {
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/actions/TextSearchGroup.java b/org.eclipse.search/new search/org/eclipse/search/ui/actions/TextSearchGroup.java
index 5b4b82c2e0e..675740a4e51 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/actions/TextSearchGroup.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/actions/TextSearchGroup.java
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.search.ui.actions;
@@ -19,6 +19,7 @@ import org.eclipse.jface.action.Separator;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.actions.ActionGroup;
+
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.search2.internal.ui.SearchMessages;
@@ -30,11 +31,11 @@ import org.eclipse.search2.internal.ui.text2.FindInWorkspaceActionDelegate;
/**
* Action group that adds a sub-menu with text search actions to a context menu.
- *
+ *
* @since 3.2
*/
public class TextSearchGroup extends ActionGroup {
-
+
private static final String CTX_MENU_ID= "org.eclipse.search.text.ctxmenu"; //$NON-NLS-1$
private String fAppendToGroup= ITextEditorActionConstants.GROUP_FIND;
@@ -45,17 +46,17 @@ public class TextSearchGroup extends ActionGroup {
* Constructs a TextSearchGroup for adding actions to the context menu
* of the editor provided. The editor will be accessed for the purpose of
* determining the search string.
- *
- * @param editor the editor
+ *
+ * @param editor the editor
*/
public TextSearchGroup(IEditorPart editor) {
createActions(editor);
}
/**
- * Changes the text that is used for the submenu label. The default is
+ * Changes the text that is used for the submenu label. The default is
* "Search Text".
- *
+ *
* @param text the text for the menu label.
*/
public void setMenuText(String text) {
@@ -65,7 +66,7 @@ public class TextSearchGroup extends ActionGroup {
/**
* Changes the group where the submenu is appended to. The default is
* ITextEditorActionConstants.GROUP_FIND.
- *
+ *
* @param groupID the group id to append to
*/
public void setAppendToGroup(String groupID) {
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchResult.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchResult.java
index 40cd78a0a1e..d67c5c44c8f 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchResult.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchResult.java
@@ -24,15 +24,15 @@ import org.eclipse.search.ui.SearchResultEvent;
/**
* An abstract base implementation for text-match based search results. This search
- * result implementation consists of a list of {@link org.eclipse.search.ui.text.Match matches}.
+ * result implementation consists of a list of {@link org.eclipse.search.ui.text.Match matches}.
* No assumptions are made about the kind of elements these matches are reported against.
- *
- * @since 3.0
+ *
+ * @since 3.0
*/
public abstract class AbstractTextSearchResult implements ISearchResult {
-
+
private static final Match[] EMPTY_ARRAY= new Match[0];
-
+
private final Map fElementsToMatches;
private final List fListeners;
private final MatchEvent fMatchEvent;
@@ -46,14 +46,14 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
fElementsToMatches= new HashMap();
fListeners= new ArrayList();
fMatchEvent= new MatchEvent(this);
-
+
fMatchFilters= null; // filtering disabled by default
}
-
+
/**
* Returns an array with all matches reported against the given element.
* Note that all matches of the given element are returned. The filter state of the matches is not relevant.
- *
+ *
* @param element the element to report matches for
* @return all matches reported for this element
* @see Match#getElement()
@@ -66,14 +66,14 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
return EMPTY_ARRAY;
}
}
-
+
/**
* Adds a <code>Match</code> to this search result. This method does nothing if the
* match is already present.
* <p>
* Subclasses may extend this method.
* </p>
- *
+ *
* @param match the match to add
*/
public void addMatch(Match match) {
@@ -84,9 +84,9 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
if (hasAdded)
fireChange(getSearchResultEvent(match, MatchEvent.ADDED));
}
-
+
/**
- * Adds a number of Matches to this search result. This method does nothing for
+ * Adds a number of Matches to this search result. This method does nothing for
* matches that are already present.
* <p>
* Subclasses may extend this method.
@@ -104,7 +104,7 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
if (!reallyAdded.isEmpty())
fireChange(getSearchResultEvent(reallyAdded, MatchEvent.ADDED));
}
-
+
private MatchEvent getSearchResultEvent(Match match, int eventKind) {
fMatchEvent.setKind(eventKind);
fMatchEvent.setMatch(match);
@@ -120,7 +120,7 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
private boolean doAddMatch(Match match) {
updateFilterState(match);
-
+
List matches= (List) fElementsToMatches.get(match.getElement());
if (matches == null) {
matches= new ArrayList();
@@ -134,12 +134,12 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
}
return false;
}
-
+
private static void insertSorted(List matches, Match match) {
int insertIndex= getInsertIndex(matches, match);
matches.add(insertIndex, match);
}
-
+
private static int getInsertIndex(List matches, Match match) {
int count= matches.size();
int min = 0, max = count - 1;
@@ -178,7 +178,7 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
private void doRemoveAll() {
fElementsToMatches.clear();
}
-
+
/**
* Removes the given match from this search result. This method has no
* effect if the match is not found.
@@ -195,14 +195,14 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
if (existed)
fireChange(getSearchResultEvent(match, MatchEvent.REMOVED));
}
-
+
/**
* Removes the given matches from this search result. This method has no
* effect for matches that are not found
* <p>
* Subclasses may extend this method.
* </p>
- *
+ *
* @param matches the matches to remove
*/
public void removeMatches(Match[] matches) {
@@ -217,7 +217,7 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
fireChange(getSearchResultEvent(existing, MatchEvent.REMOVED));
}
-
+
private boolean doRemoveMatch(Match match) {
boolean existed= false;
List matches= (List) fElementsToMatches.get(match.getElement());
@@ -228,7 +228,7 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
}
return existed;
}
-
+
/**
* {@inheritDoc}
*/
@@ -237,7 +237,7 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
fListeners.add(l);
}
}
-
+
/**
* {@inheritDoc}
*/
@@ -246,13 +246,13 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
fListeners.remove(l);
}
}
-
+
/**
* Send the given <code>SearchResultEvent</code> to all registered search
* result listeners.
- *
+ *
* @param e the event to be sent
- *
+ *
* @see ISearchResultListener
*/
protected void fireChange(SearchResultEvent e) {
@@ -265,7 +265,7 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
((ISearchResultListener) listeners.next()).searchResultChanged(e);
}
}
-
+
private void updateFilterStateForAllMatches() {
boolean disableFiltering= getActiveMatchFilters() == null;
ArrayList changed= new ArrayList();
@@ -281,7 +281,7 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
Match[] allChanges= (Match[]) changed.toArray(new Match[changed.size()]);
fireChange(new FilterUpdateEvent(this, allChanges, getActiveMatchFilters()));
}
-
+
/*
* Evaluates the filter for the match and updates it. Return true if the filter changed.
*/
@@ -290,7 +290,7 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
if (matchFilters == null) {
return false; // do nothing, no change
}
-
+
boolean oldState= match.isFiltered();
for (int i= 0; i < matchFilters.length; i++) {
if (matchFilters[i].filters(match)) {
@@ -301,11 +301,11 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
match.setFiltered(false);
return oldState;
}
-
+
/**
* Returns the total number of matches contained in this search result.
* The filter state of the matches is not relevant when counting matches. All matches are counted.
- *
+ *
* @return total number of matches
*/
public int getMatchCount() {
@@ -319,12 +319,12 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
}
return count;
}
-
+
/**
* Returns the number of matches reported against a given element. This is
* equivalent to calling <code>getMatches(element).length</code>
* The filter state of the matches is not relevant when counting matches. All matches are counted.
- *
+ *
* @param element the element to get the match count for
* @return the number of matches reported against the element
*/
@@ -334,12 +334,12 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
return matches.size();
return 0;
}
-
+
/**
* Returns an array containing the set of all elements that matches are
* reported against in this search result.
* Note that all elements that contain matches are returned. The filter state of the matches is not relevant.
- *
+ *
* @return the set of elements in this search result
*/
public Object[] getElements() {
@@ -347,7 +347,7 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
return fElementsToMatches.keySet().toArray();
}
}
-
+
/**
* Sets the active match filters for this result. If set to non-null, the match filters will be used to update the filter
* state ({@link Match#isFiltered()} of matches and the {@link AbstractTextSearchViewPage} will only
@@ -355,63 +355,63 @@ public abstract class AbstractTextSearchResult implements ISearchResult {
* the filter state of the match is ignored by the {@link AbstractTextSearchViewPage} and all matches
* are shown.
* Note the model contains all matches, regardless if the filter state of a match.
- *
+ *
* @param filters the match filters to set or <code>null</code> if the filter state of the match
* should be ignored.
- *
+ *
* @since 3.3
*/
public void setActiveMatchFilters(MatchFilter[] filters) {
fMatchFilters= filters;
updateFilterStateForAllMatches();
}
-
+
/**
* Returns the active match filters for this result. If not null is returned, the match filters will be used to update the filter
* state ({@link Match#isFiltered()} of matches and the {@link AbstractTextSearchViewPage} will only
* show non-filtered matches. If <code>null</code> is set
* the filter state of the match is ignored by the {@link AbstractTextSearchViewPage} and all matches
* are shown.
- *
+ *
* @return the match filters to be used or <code>null</code> if the filter state of the match
* should be ignored.
- *
+ *
* @since 3.3
*/
public MatchFilter[] getActiveMatchFilters() {
return fMatchFilters;
}
-
+
/**
* Returns all applicable filters for this result or null if match filters are not supported. If match filters are returned,
* the {@link AbstractTextSearchViewPage} will contain menu entries in the view menu.
- *
- * @return all applicable filters for this result.
- *
+ *
+ * @return all applicable filters for this result.
+ *
* @since 3.3
*/
public MatchFilter[] getAllMatchFilters() {
return null;
}
-
+
/**
* Returns an implementation of <code>IEditorMatchAdapter</code> appropriate
* for this search result.
- *
+ *
* @return an appropriate adapter or <code>null</code> if none has been implemented
- *
+ *
* @see IEditorMatchAdapter
*/
public abstract IEditorMatchAdapter getEditorMatchAdapter();
-
+
/**
* Returns an implementation of <code>IFileMatchAdapter</code> appropriate
- * for this search result.
- *
+ * for this search result.
+ *
* @return an appropriate adapter or <code>null</code> if none has been implemented
- *
+ *
* @see IFileMatchAdapter
*/
public abstract IFileMatchAdapter getFileMatchAdapter();
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchViewPage.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchViewPage.java
index 31dd71dc205..e9c50210de2 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchViewPage.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchViewPage.java
@@ -119,17 +119,17 @@ import org.eclipse.search2.internal.ui.text.PositionTracker;
* provider and a content provider. <br>
* Changes in the search result are handled by updating the viewer in the
* <code>elementsChanged()</code> and <code>clear()</code> methods.
- *
+ *
* @since 3.0
*/
public abstract class AbstractTextSearchViewPage extends Page implements ISearchResultPage {
private class UpdateUIJob extends UIJob {
-
+
public UpdateUIJob() {
super(SearchMessages.AbstractTextSearchViewPage_update_job_name);
setSystem(true);
}
-
+
public IStatus runInUIThread(IProgressMonitor monitor) {
Control control= getControl();
if (control == null || control.isDisposed()) {
@@ -155,19 +155,19 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
fViewPart.updateLabel();
return Status.OK_STATUS;
}
-
+
/*
* Undocumented for testing only. Used to find UpdateUIJobs.
*/
public boolean belongsTo(Object family) {
return family == AbstractTextSearchViewPage.this;
}
-
+
}
-
+
private class SelectionProviderAdapter implements ISelectionProvider, ISelectionChangedListener {
private ArrayList fListeners= new ArrayList(5);
-
+
public void addSelectionChangedListener(ISelectionChangedListener listener) {
fListeners.add(listener);
}
@@ -198,12 +198,12 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
private volatile boolean fIsUIUpdateScheduled= false;
private volatile boolean fScheduleEnsureSelection= false;
private static final String KEY_LAYOUT = "org.eclipse.search.resultpage.layout"; //$NON-NLS-1$
-
+
/**
* An empty array.
*/
protected static final Match[] EMPTY_MATCH_ARRAY= new Match[0];
-
+
private StructuredViewer fViewer;
private Composite fViewerContainer;
private Control fBusyLabel;
@@ -212,7 +212,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
private ISearchResultViewPart fViewPart;
private Set fBatchedUpdates;
private boolean fBatchedClearAll;
-
+
private ISearchResultListener fListener;
private IQueryListener fQueryListener;
private MenuManager fMenu;
@@ -224,10 +224,10 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
private Action fRemoveAllResultsAction;
private Action fShowNextAction;
private Action fShowPreviousAction;
-
+
private ExpandAllAction fExpandAllAction;
private CollapseAllAction fCollapseAllAction;
-
+
private SetLayoutAction fFlatAction;
private SetLayoutAction fHierarchicalAction;
private int fCurrentLayout;
@@ -236,10 +236,10 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
private final int fSupportedLayouts;
private SelectionProviderAdapter fViewerAdapter;
private SelectAllAction fSelectAllAction;
-
+
private IAction[] fFilterActions;
private Integer fElementLimit;
-
+
/**
* Flag (<code>value 1</code>) denoting flat list layout.
*/
@@ -249,12 +249,12 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
*/
public static final int FLAG_LAYOUT_TREE = 2;
-
+
/**
* This constructor must be passed a combination of layout flags combined
* with bitwise or. At least one flag must be passed in (i.e. 0 is not a
* permitted value).
- *
+ *
* @param supportedLayouts
* flags determining which layout options this page supports.
* Must not be 0
@@ -274,12 +274,12 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
fExpandAllAction= new ExpandAllAction();
fCollapseAllAction= new CollapseAllAction();
}
-
+
fSelectAllAction= new SelectAllAction();
createLayoutActions();
fBatchedUpdates = new HashSet();
fBatchedClearAll= false;
-
+
fListener = new ISearchResultListener() {
public void searchResultChanged(SearchResultEvent e) {
handleSearchResultChanged(e);
@@ -288,7 +288,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
fFilterActions= null;
fElementLimit= null;
}
-
+
private void initLayout() {
if (supportsTreeLayout())
fCurrentLayout = FLAG_LAYOUT_TREE;
@@ -298,13 +298,13 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Constructs this page with the default layout flags.
- *
+ *
* @see AbstractTextSearchViewPage#AbstractTextSearchViewPage(int)
*/
protected AbstractTextSearchViewPage() {
this(FLAG_LAYOUT_FLAT | FLAG_LAYOUT_TREE);
}
-
+
private void createLayoutActions() {
if (countBits(fSupportedLayouts) > 1) {
@@ -314,7 +314,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
SearchPluginImages.setImageDescriptors(fHierarchicalAction, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_HIERARCHICAL_LAYOUT);
}
}
-
+
private int countBits(int layoutFlags) {
int bitCount = 0;
for (int i = 0; i < 32; i++) {
@@ -332,7 +332,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Returns a dialog settings object for this search result page. There will be
* one dialog settings object per search result page id.
- *
+ *
* @return the dialog settings for this search result page
* @see AbstractTextSearchViewPage#getID()
*/
@@ -357,7 +357,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
public String getID() {
return fId;
}
-
+
/**
* {@inheritDoc}
*/
@@ -372,12 +372,12 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* Opens an editor on the given element and selects the given range of text. If a search results
* implements a <code>IFileMatchAdapter</code>, match locations will be tracked and the current
* match range will be passed into this method.
- *
+ *
* @param match the match to show
* @param currentOffset the current start offset of the match
* @param currentLength the current length of the selection
* @throws PartInitException if an editor can't be opened
- *
+ *
* @see org.eclipse.core.filebuffers.ITextFileBufferManager
* @see IFileMatchAdapter
* @deprecated Use {@link #showMatch(Match, int, int, boolean)} instead
@@ -392,7 +392,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* this method.
* If the <code>activate</code> parameter is <code>true</code> the opened editor
* should have be activated. Otherwise the focus should not be changed.
- *
+ *
* @param match
* the match to show
* @param currentOffset
@@ -403,7 +403,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* whether to activate the editor.
* @throws PartInitException
* if an editor can't be opened
- *
+ *
* @see org.eclipse.core.filebuffers.ITextFileBufferManager
* @see IFileMatchAdapter
*/
@@ -418,7 +418,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* occurred by the time this method is called. They will be described in a
* future call.
* <p>The changed elements are evaluated by {@link #evaluateChangedElements(Match[], Set)}.</p>
- *
+ *
* @param objects
* array of objects that has to be refreshed
*/
@@ -437,7 +437,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* Configures the given viewer. Implementers have to set at least a content
* provider and a label provider. This method may be called if the page was
* constructed with the flag <code>FLAG_LAYOUT_TREE</code>.
- *
+ *
* @param viewer the viewer to be configured
*/
protected abstract void configureTreeViewer(TreeViewer viewer);
@@ -446,7 +446,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* Configures the given viewer. Implementers have to set at least a content
* provider and a label provider. This method may be called if the page was
* constructed with the flag <code>FLAG_LAYOUT_FLAT</code>.
- *
+ *
* @param viewer the viewer to be configured
*/
protected abstract void configureTableViewer(TableViewer viewer);
@@ -454,7 +454,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Fills the context menu for this page. Subclasses may override this
* method.
- *
+ *
* @param mgr the menu manager representing the context menu
*/
protected void fillContextMenu(IMenuManager mgr) {
@@ -466,7 +466,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
if (canRemoveMatchesWith(getViewer().getSelection()))
mgr.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, fRemoveSelectedMatches);
mgr.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, fRemoveAllResultsAction);
-
+
if (getLayout() == FLAG_LAYOUT_TREE) {
mgr.appendToGroup(IContextMenuConstants.GROUP_SHOW, fExpandAllAction);
}
@@ -510,7 +510,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
// Register menu
getSite().registerContextMenu(fViewPart.getViewSite().getId(), fMenu, fViewerAdapter);
-
+
createViewer(fViewerContainer, fCurrentLayout);
showBusyLabel(fIsBusyShown);
NewSearchUI.addQueryListener(fQueryListener);
@@ -597,10 +597,10 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Determines whether a certain layout is supported by this search result
* page.
- *
+ *
* @param layout the layout to test for
* @return whether the given layout is supported or not
- *
+ *
* @see AbstractTextSearchViewPage#AbstractTextSearchViewPage(int)
*/
public boolean isLayoutSupported(int layout) {
@@ -613,7 +613,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* it must be one of the values passed during construction of this search
* result page.
* @param layout the new layout
- *
+ *
* @see AbstractTextSearchViewPage#isLayoutSupported(int)
*/
public void setLayout(int layout) {
@@ -650,9 +650,9 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Return the layout this page is currently using.
- *
+ *
* @return the layout this page is currently using
- *
+ *
* @see #FLAG_LAYOUT_FLAT
* @see #FLAG_LAYOUT_TREE
*/
@@ -672,16 +672,16 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
fCollapseAllAction.setViewer(viewer);
fExpandAllAction.setViewer(viewer);
}
-
+
fCopyToClipboardAction.setViewer(fViewer);
fSelectAllAction.setViewer(fViewer);
-
+
IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
tbm.removeAll();
SearchView.createToolBarGroups(tbm);
fillToolbar(tbm);
tbm.update(false);
-
+
new OpenAndLinkWithEditorHelper(fViewer) {
protected void activate(ISelection selection) {
@@ -710,12 +710,12 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
fRemoveSelectedMatches.setEnabled(canRemoveMatchesWith(event.getSelection()));
}
});
-
+
fViewer.addSelectionChangedListener(fViewerAdapter);
-
+
Menu menu = fMenu.createContextMenu(fViewer.getControl());
fViewer.getControl().setMenu(menu);
-
+
updateLayoutActions();
getViewPart().updateLabel();
}
@@ -723,7 +723,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Creates the tree viewer to be shown on this page. Clients may override
* this method.
- *
+ *
* @param parent the parent widget
* @return returns a newly created <code>TreeViewer</code>.
*/
@@ -734,7 +734,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Creates the table viewer to be shown on this page. Clients may override
* this method.
- *
+ *
* @param parent the parent widget
* @return returns a newly created <code>TableViewer</code>
*/
@@ -764,7 +764,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
public void setInput(ISearchResult newSearch, Object viewState) {
if (newSearch != null && !(newSearch instanceof AbstractTextSearchResult))
return; // ignore
-
+
AbstractTextSearchResult oldSearch= fInput;
if (oldSearch != null) {
disconnectViewer();
@@ -773,21 +773,21 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
AnnotationManagers.removeSearchResult(getSite().getWorkbenchWindow(), oldSearch);
}
fInput= (AbstractTextSearchResult) newSearch;
-
+
if (fInput != null) {
AnnotationManagers.addSearchResult(getSite().getWorkbenchWindow(), fInput);
-
+
fInput.addListener(fListener);
connectViewer(fInput);
if (viewState instanceof ISelection)
fViewer.setSelection((ISelection) viewState, true);
else
navigateNext(true);
-
+
updateBusyLabel();
turnOffDecoration();
scheduleUIUpdate();
-
+
fFilterActions= addFilterActionsToViewMenu();
} else {
getViewPart().updateLabel();
@@ -805,23 +805,23 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
}
menu.remove(MatchFilterSelectionAction.ACTION_ID);
}
-
+
private IAction[] addFilterActionsToViewMenu() {
AbstractTextSearchResult input= getInput();
if (input == null) {
return null;
}
-
+
MatchFilter[] allMatchFilters= input.getAllMatchFilters();
if (allMatchFilters == null && getElementLimit() == null) {
return null;
}
-
+
IActionBars bars= getSite().getActionBars();
IMenuManager menu= bars.getMenuManager();
-
+
menu.prependToGroup(IContextMenuConstants.GROUP_FILTERING, new MatchFilterSelectionAction(this));
-
+
if (allMatchFilters != null) {
MatchFilterAction[] actions= new MatchFilterAction[allMatchFilters.length];
for (int i= allMatchFilters.length - 1; i >= 0; i--) {
@@ -833,7 +833,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
}
return null;
}
-
+
private void updateFilterActions(IAction[] filterActions) {
if (filterActions != null) {
for (int i= 0; i < filterActions.length; i++) {
@@ -862,7 +862,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Returns the viewer currently used in this page.
- *
+ *
* @return the currently used viewer or <code>null</code> if none has been
* created yet.
*/
@@ -889,9 +889,9 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Returns the currently shown result.
- *
+ *
* @return the previously set result or <code>null</code>
- *
+ *
* @see AbstractTextSearchViewPage#setInput(ISearchResult, Object)
*/
public AbstractTextSearchResult getInput() {
@@ -935,7 +935,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
}
showCurrentMatch(activateEditor);
}
-
+
private void navigateNext(boolean forward) {
INavigate navigator = null;
if (fViewer instanceof TableViewer) {
@@ -957,7 +957,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Returns the currently selected match.
- *
+ *
* @return the selected match or <code>null</code> if none are selected
*/
public Match getCurrentMatch() {
@@ -969,7 +969,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
}
return null;
}
-
+
/**
* Returns the matches that are currently displayed for the given element.
* If {@link AbstractTextSearchResult#getActiveMatchFilters()} is not null, only matches are returned
@@ -978,7 +978,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* Any action operating on the visible matches in the search
* result page should use this method to get the matches for a search
* result (instead of asking the search result directly).
- *
+ *
* @param element
* The element to get the matches for
* @return The matches displayed for the given element. If the current input
@@ -1002,7 +1002,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
}
if (count == matches.length)
return matches;
-
+
Match[] filteredMatches= new Match[count];
for (int i= 0, k= 0; i < matches.length; i++) {
if (matches[i] != null)
@@ -1010,7 +1010,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
}
return filteredMatches;
}
-
+
/**
* Returns the current location of the match. This takes possible
* modifications of the file into account. Therefore the result may
@@ -1018,12 +1018,12 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* off the match.
* @param match the match to get the position for.
* @return the current position of the match.
- *
+ *
* @since 3.2
*/
public IRegion getCurrentMatchLocation(Match match) {
PositionTracker tracker= InternalSearchUI.getInstance().getPositionTracker();
-
+
int offset, length;
Position pos= tracker.getCurrentPosition(match);
if (pos == null) {
@@ -1035,7 +1035,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
}
return new Region(offset, length);
}
-
+
/**
* Returns the number of matches that are currently displayed for the given
* element. If {@link AbstractTextSearchResult#getActiveMatchFilters()} is not null, only matches
@@ -1043,7 +1043,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* Any action operating on the visible matches in the
* search result page should use this method to get the match count for a
* search result (instead of asking the search result directly).
- *
+ *
* @param element
* The element to get the matches for
* @return The number of matches displayed for the given element. If the
@@ -1109,7 +1109,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Fills the toolbar contribution for this page. Subclasses may override
* this method.
- *
+ *
* @param tbm the tool bar manager representing the view's toolbar
*/
protected void fillToolbar(IToolBarManager tbm) {
@@ -1149,7 +1149,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
/**
* Returns the view part set with
* <code>setViewPart(ISearchResultViewPart)</code>.
- *
+ *
* @return The view part or <code>null</code> if the view part hasn't been
* set yet (or set to null).
*/
@@ -1158,11 +1158,11 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
}
// multi-threaded update handling.
-
+
/**
* Handles a search result event for the current search result.
* @param e the event to handle
- *
+ *
* @since 3.2
*/
protected void handleSearchResultChanged(final SearchResultEvent e) {
@@ -1175,12 +1175,12 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
updateFilterActions(fFilterActions);
}
}
-
+
/**
* Evaluates the elements to that are later passed to {@link #elementsChanged(Object[])}. By default
* the element to change are the elements received by ({@link Match#getElement()}). Client implementations
* can modify this behavior.
- *
+ *
* @param matches the matches that were added or removed
* @param changedElements the set that collects the elements to change. Clients should only add elements to the set.
* @since 3.4
@@ -1190,7 +1190,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
changedElements.add(matches[i].getElement());
}
}
-
+
private synchronized void postUpdate(Match[] matches) {
evaluateChangedElements(matches, fBatchedUpdates);
scheduleUIUpdate();
@@ -1302,7 +1302,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* Removes the currently selected match. Does nothing if no match is
* selected.
* </p>
- *
+ *
* @noreference This method is not intended to be referenced by clients.
*/
public void internalRemoveSelected() {
@@ -1311,7 +1311,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
return;
StructuredViewer viewer = getViewer();
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
-
+
HashSet set = new HashSet();
if (viewer instanceof TreeViewer) {
ITreeContentProvider cp = (ITreeContentProvider) viewer.getContentProvider();
@@ -1320,7 +1320,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
collectAllMatches(set, selection.toArray());
}
navigateNext(true);
-
+
Match[] matches = new Match[set.size()];
set.toArray(matches);
result.removeMatches(matches);
@@ -1345,7 +1345,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
collectAllMatchesBelow(result, set, cp, children);
}
}
-
+
private void turnOffDecoration() {
IBaseLabelProvider lp= fViewer.getLabelProvider();
if (lp instanceof DecoratingLabelProvider) {
@@ -1357,7 +1357,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
IBaseLabelProvider lp= fViewer.getLabelProvider();
if (lp instanceof DecoratingLabelProvider) {
((DecoratingLabelProvider)lp).setLabelDecorator(PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator());
-
+
}
}
@@ -1371,7 +1371,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* </p>
* @param event
* the event sent for the currently shown viewer
- *
+ *
* @see IOpenListener
*/
protected void handleOpen(OpenEvent event) {
@@ -1393,7 +1393,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
gotoNextMatch(OpenStrategy.activateOnOpen());
}
}
-
+
/**
* Sets the maximal number of top level elements to be shown in a viewer.
* If <code>null</code> is set, the view page does not support to limit the elements and will not provide
@@ -1408,12 +1408,12 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* <li><code>-1</code> to not limit and provide configuration UI</li>
* <li><code>positive integer</code> to limit by the given value and provide configuration UI</li>
* </dl>
- *
+ *
* @since 3.3
*/
public void setElementLimit(Integer limit) {
fElementLimit= limit;
-
+
if (fViewer != null) {
fViewer.refresh();
}
@@ -1421,7 +1421,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
fViewPart.updateLabel();
}
}
-
+
/**
* Gets the maximal number of top level elements to be shown in a viewer.
* <code>null</code> means the view page does not limit the elements and will not provide
@@ -1434,12 +1434,12 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch
* <li><code>-1</code> to not limit and provide configuration UI</li>
* <li><code>positive integer</code> to limit by the given value and provide configuration UI</li>
* </dl>
- *
+ *
* @since 3.3
*/
public Integer getElementLimit() {
return fElementLimit;
}
-
-
+
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/FileTextSearchScope.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/FileTextSearchScope.java
index 23b6e706276..20aee64f64a 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/FileTextSearchScope.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/FileTextSearchScope.java
@@ -43,26 +43,26 @@ import org.eclipse.search.internal.ui.util.FileTypeEditor;
* Clients should not instantiate or subclass this class.
* </p>
* @since 3.2
- *
+ *
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public final class FileTextSearchScope extends TextSearchScope {
-
+
private static final boolean IS_CASE_SENSITIVE_FILESYSTEM = !new File("Temp").equals(new File("temp")); //$NON-NLS-1$ //$NON-NLS-2$
/**
* Returns a scope for the workspace. The created scope contains all resources in the workspace
* that match the given file name patterns. Depending on <code>includeDerived</code>, derived resources or
* resources inside a derived container are part of the scope or not.
- *
- * @param fileNamePatterns file name pattern that all files have to match <code>null</code> to include all file names.
+ *
+ * @param fileNamePatterns file name pattern that all files have to match <code>null</code> to include all file names.
* @param includeDerived defines if derived files and files inside derived containers are included in the scope.
* @return a scope containing all files in the workspace that match the given file name patterns.
*/
public static FileTextSearchScope newWorkspaceScope(String[] fileNamePatterns, boolean includeDerived) {
- return new FileTextSearchScope(SearchMessages.WorkspaceScope, new IResource[] { ResourcesPlugin.getWorkspace().getRoot() }, null, fileNamePatterns, includeDerived);
+ return new FileTextSearchScope(SearchMessages.WorkspaceScope, new IResource[] { ResourcesPlugin.getWorkspace().getRoot() }, null, fileNamePatterns, includeDerived);
}
-
+
/**
* Returns a scope for the given root resources. The created scope contains all root resources and their
* children that match the given file name patterns. Depending on <code>includeDerived</code>, derived resources or
@@ -75,7 +75,7 @@ public final class FileTextSearchScope extends TextSearchScope {
*/
public static FileTextSearchScope newSearchScope(IResource[] roots, String[] fileNamePatterns, boolean includeDerived) {
roots= removeRedundantEntries(roots, includeDerived);
-
+
String description;
if (roots.length == 0) {
description= SearchMessages.FileTextSearchScope_scope_empty;
@@ -90,14 +90,14 @@ public final class FileTextSearchScope extends TextSearchScope {
description= Messages.format(label, new String[] { roots[0].getName(), roots[1].getName()});
}
return new FileTextSearchScope(description, roots, null, fileNamePatterns, includeDerived);
- }
+ }
/**
* Returns a scope for the given working sets. The created scope contains all resources in the
* working sets that match the given file name patterns. Depending on <code>includeDerived</code>, derived resources or
* resources inside a derived container are part of the scope or not.
- *
- * @param workingSets the working sets defining the scope.
+ *
+ * @param workingSets the working sets defining the scope.
* @param fileNamePatterns file name pattern that all files have to match <code>null</code> to include all file names.
* @param includeDerived defines if derived files and files inside derived containers are included in the scope.
* @return a scope containing the resources in the working set if they match the given file name patterns.
@@ -126,7 +126,7 @@ public final class FileTextSearchScope extends TextSearchScope {
private final String[] fFileNamePatterns;
private final Matcher fPositiveFileNameMatcher;
private final Matcher fNegativeFileNameMatcher;
-
+
private boolean fVisitDerived;
private IWorkingSet[] fWorkingSets;
@@ -139,10 +139,10 @@ public final class FileTextSearchScope extends TextSearchScope {
fPositiveFileNameMatcher= createMatcher(fileNamePatterns, false);
fNegativeFileNameMatcher= createMatcher(fileNamePatterns, true);
}
-
+
/**
* Returns the description of the scope
- *
+ *
* @return the description of the scope
*/
public String getDescription() {
@@ -152,17 +152,17 @@ public final class FileTextSearchScope extends TextSearchScope {
/**
* Returns the file name pattern configured for this scope or <code>null</code> to match
* all file names.
- *
+ *
* @return the file name pattern starings
*/
public String[] getFileNamePatterns() {
return fFileNamePatterns;
}
-
+
/**
- * Returns the working-sets that were used to configure this scope or <code>null</code>
+ * Returns the working-sets that were used to configure this scope or <code>null</code>
* if the scope was not created off working sets.
- *
+ *
* @return the working-sets the scope is based on.
*/
public IWorkingSet[] getWorkingSets() {
@@ -172,16 +172,16 @@ public final class FileTextSearchScope extends TextSearchScope {
/**
* Returns the content types configured for this scope or <code>null</code> to match
* all content types.
- *
+ *
* @return the file name pattern starings
*/
public IContentType[] getContentTypes() {
return null; // to be implemented in the future
}
-
+
/**
* Returns a description describing the file name patterns and content types.
- *
+ *
* @return the description of the scope
*/
public String getFilterDescription() {
@@ -199,16 +199,16 @@ public final class FileTextSearchScope extends TextSearchScope {
}
return BasicElementLabels.getFilePattern(buf.toString());
}
-
+
/**
* Returns whether derived resources are included in this search scope.
- *
+ *
* @return whether derived resources are included in this search scope.
*/
public boolean includeDerived() {
return fVisitDerived;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.search.core.text.FileSearchScope#getRoots()
*/
@@ -223,13 +223,13 @@ public final class FileTextSearchScope extends TextSearchScope {
if (!fVisitDerived && proxy.isDerived()) {
return false; // all resources in a derived folder are considered to be derived, see bug 103576
}
-
+
if (proxy.getType() == IResource.FILE) {
return matchesFileName(proxy.getName());
}
return true;
}
-
+
private boolean matchesFileName(String fileName) {
if (fPositiveFileNameMatcher != null && !fPositiveFileNameMatcher.reset(fileName).matches()) {
return false;
@@ -239,7 +239,7 @@ public final class FileTextSearchScope extends TextSearchScope {
}
return true;
}
-
+
private Matcher createMatcher(String[] fileNamePatterns, boolean negativeMatcher) {
if (fileNamePatterns == null || fileNamePatterns.length == 0) {
return null;
@@ -263,7 +263,7 @@ public final class FileTextSearchScope extends TextSearchScope {
}
return null;
}
-
+
private static IResource[] removeRedundantEntries(IResource[] elements, boolean includeDerived) {
ArrayList res= new ArrayList();
for (int i= 0; i < elements.length; i++) {
@@ -290,7 +290,7 @@ public final class FileTextSearchScope extends TextSearchScope {
}
return (IResource[]) res.toArray(new IResource[res.size()]);
}
-
+
private static void addToList(ArrayList res, IResource curr, boolean includeDerived) {
if (!includeDerived && isDerived(curr)) {
return;
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/FilterUpdateEvent.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/FilterUpdateEvent.java
index 4cc01c8f139..3e0ef9b3fb7 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/FilterUpdateEvent.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/FilterUpdateEvent.java
@@ -27,10 +27,10 @@ public class FilterUpdateEvent extends SearchResultEvent {
private final Match[] fMatches;
private final MatchFilter[] fFilters;
-
+
/**
* Constructs a new {@link FilterUpdateEvent}.
- *
+ *
* @param searchResult the search result concerned
* @param matches the matches updated by the filter change
* @param filters the currently activated filters
@@ -40,19 +40,19 @@ public class FilterUpdateEvent extends SearchResultEvent {
fMatches= matches;
fFilters= filters;
}
-
+
/**
* Returns the matches updated by the filter update.
- *
+ *
* @return the matches updated by the filter update
*/
public Match[] getUpdatedMatches() {
return fMatches;
}
-
+
/**
* Returns the the filters currently set, or <code>null</code> if filters have been disabled.
- *
+ *
* @return the filters currently set
*/
public MatchFilter[] getActiveFilters() {
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/IEditorMatchAdapter.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/IEditorMatchAdapter.java
index f15d2c4a76f..18269a88f7d 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/IEditorMatchAdapter.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/IEditorMatchAdapter.java
@@ -13,7 +13,7 @@ package org.eclipse.search.ui.text;
import org.eclipse.ui.IEditorPart;
/**
- * This interface serves as an adapter between matches and editors. It is used to
+ * This interface serves as an adapter between matches and editors. It is used to
* highlight matches in editors. Search implementors who want their matches highlighted
* must return an implementation of <code>IEditorMatchAdapter</code> from the <code>getEditorMatchAdapter()</code>
* method in their search result subclass.
@@ -23,15 +23,15 @@ import org.eclipse.ui.IEditorPart;
* Clients may implement this interface.
* </p>
* @see org.eclipse.search.ui.text.AbstractTextSearchResult
- *
+ *
* @since 3.0
*/
public interface IEditorMatchAdapter {
/**
* Determines whether a match should be displayed in the given editor.
- * For example, if a match is reported in a file, This method should return
- * <code>true</code>, if the given editor displays the file.
- *
+ * For example, if a match is reported in a file, This method should return
+ * <code>true</code>, if the given editor displays the file.
+ *
* @param match The match
* @param editor The editor that possibly contains the matches element
* @return whether the given match should be displayed in the editor
@@ -43,11 +43,11 @@ public interface IEditorMatchAdapter {
* For example, if the editor shows a particular file, all matches in that file should
* be returned.
* @param result the result to search for matches
- *
+ *
* @param editor The editor.
* @return All matches that are contained in the element that is shown in
* the given editor.
*/
public abstract Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor);
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/IFileMatchAdapter.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/IFileMatchAdapter.java
index c4d50154872..f634e610b7d 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/IFileMatchAdapter.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/IFileMatchAdapter.java
@@ -22,7 +22,7 @@ import org.eclipse.core.resources.IFile;
* Clients may implement this interface.
* </p>
* @see org.eclipse.search.ui.text.AbstractTextSearchResult
- *
+ *
* @since 3.0
*/
public interface IFileMatchAdapter {
@@ -30,10 +30,10 @@ public interface IFileMatchAdapter {
* Returns an array with all matches contained in the given file in the
* given search result. If the matches are not contained within an
* <code>IFile</code>, this method must return an empty array.
- *
+ *
* @param result the search result to find matches in
* @param file the file to find matches in
- *
+ *
* @return an array of matches (possibly empty)
*/
public abstract Match[] computeContainedMatches(AbstractTextSearchResult result, IFile file);
@@ -41,9 +41,9 @@ public interface IFileMatchAdapter {
* Returns the file associated with the given element (usually the file the
* element is contained in). If the element is not associated with a file,
* this method should return <code>null</code>.
- *
+ *
* @param element an element associated with a match
- *
+ *
* @return the file associated with the element or <code>null</code>
*/
public abstract IFile getFile(Object element);
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/ISearchEditorAccess.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/ISearchEditorAccess.java
index 4f12f467ce3..1785df18777 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/ISearchEditorAccess.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/ISearchEditorAccess.java
@@ -15,14 +15,14 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.source.IAnnotationModel;
/**
- * <p>This interface allows editors to provide customized access to editor internals for the
- * search implementation to highlight matches. The search system will use the document to
- * do line/character offset conversion if needed and it will add annotations to the annotation
+ * <p>This interface allows editors to provide customized access to editor internals for the
+ * search implementation to highlight matches. The search system will use the document to
+ * do line/character offset conversion if needed and it will add annotations to the annotation
* model.</p>
- * <p> The search system will ask an editor for an adapter of this class whenever it needs
- * access to the document or the annotation model of the editor. Since an editor might use
- * multiple documents and/or annotation models, the match is passed in when asking the editor.
- * The editor is then expected to return the proper annotation model or document for the given
+ * <p> The search system will ask an editor for an adapter of this class whenever it needs
+ * access to the document or the annotation model of the editor. Since an editor might use
+ * multiple documents and/or annotation models, the match is passed in when asking the editor.
+ * The editor is then expected to return the proper annotation model or document for the given
* match.</p>
* <p>
* This interface is intended to be implemented by clients.
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/Match.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/Match.java
index 2b31033abe9..4bf70e38498 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/Match.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/Match.java
@@ -18,17 +18,17 @@ import org.eclipse.core.runtime.Assert;
* against is assumed to contain the match, and the UI will group matches
* against the same element together. A match has an offset and a length which
* may be specified in characters or in lines.
- *
+ *
* @since 3.0
*/
public class Match {
-
+
/**
* A constant expressing that offset and length of this match are specified
* in lines
*/
public static final int UNIT_LINE= 1;
-
+
/**
* A constant expressing that offset and length of this match are specified
* in characters
@@ -36,7 +36,7 @@ public class Match {
public static final int UNIT_CHARACTER= 2;
private static final int IS_FILTERED= 1 << 2;
-
+
private Object fElement;
private int fOffset;
private int fLength;
@@ -44,7 +44,7 @@ public class Match {
/**
* Constructs a new Match object.
- *
+ *
* @param element
* the element that contains the match
* @param unit
@@ -65,7 +65,7 @@ public class Match {
/**
* Constructs a new Match object. The offset and length will be based on
* characters.
- *
+ *
* @param element
* the element that contains the match
* @param offset
@@ -79,7 +79,7 @@ public class Match {
/**
* Returns the offset of this match.
- *
+ *
* @return the offset
*/
public int getOffset() {
@@ -88,7 +88,7 @@ public class Match {
/**
* Sets the offset of this match.
- *
+ *
* @param offset
* the offset to set
*/
@@ -98,7 +98,7 @@ public class Match {
/**
* Returns the length of this match.
- *
+ *
* @return the length
*/
public int getLength() {
@@ -107,7 +107,7 @@ public class Match {
/**
* Sets the length.
- *
+ *
* @param length
* the length to set
*/
@@ -117,7 +117,7 @@ public class Match {
/**
* Returns the element that contains this match. The element is used to group the match.
- *
+ *
* @return the element that contains this match
*/
public Object getElement() {
@@ -127,7 +127,7 @@ public class Match {
/**
* Returns whether match length and offset are expressed in lines or
* characters.
- *
+ *
* @return either UNIT_LINE or UNIT_CHARACTER;
*/
public int getBaseUnit() {
@@ -135,13 +135,13 @@ public class Match {
return UNIT_LINE;
return UNIT_CHARACTER;
}
-
+
/**
* Marks this match as filtered or not.
- *
+ *
* @param value <code>true</code> if the match is filtered;
* otherwise <code>false</code>
- *
+ *
* @since 3.1
*/
public void setFiltered(boolean value) {
@@ -151,13 +151,13 @@ public class Match {
fFlags &= (~IS_FILTERED);
}
}
-
+
/**
* Returns whether this match is filtered or not.
- *
+ *
* @return <code>true<code> if the match is filtered;
* otherwise <code>false</code>
- *
+ *
* @since 3.1
*/
public boolean isFiltered() {
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/MatchEvent.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/MatchEvent.java
index 4f7052722d2..0bdde79062c 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/MatchEvent.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/MatchEvent.java
@@ -27,31 +27,31 @@ public class MatchEvent extends SearchResultEvent {
private Match[] fMatchContainer = new Match[1];
/**
* Constant for a matches being added.
- *
+ *
* @see MatchEvent#getKind()
*/
public static final int ADDED = 1;
/**
* Constant for a matches being removed.
- *
+ *
* @see MatchEvent#getKind()
*/
public static final int REMOVED = 2;
-
+
private static final Match[] fgEmtpyMatches = new Match[0];
-
+
/**
* Constructs a new <code>MatchEvent</code>.
- *
+ *
* @param searchResult the search result concerned
*/
public MatchEvent(ISearchResult searchResult) {
super(searchResult);
}
-
+
/**
* Tells whether this is a remove or an add.
- *
+ *
* @return one of <code>ADDED</code> or <code>REMOVED</code>
*/
public int getKind() {
@@ -59,7 +59,7 @@ public class MatchEvent extends SearchResultEvent {
}
/**
* Returns the concerned matches.
- *
+ *
* @return the matches this event is about
*/
public Match[] getMatches() {
@@ -70,10 +70,10 @@ public class MatchEvent extends SearchResultEvent {
else
return fgEmtpyMatches;
}
-
+
/**
* Sets the kind of event this is.
- *
+ *
* @param kind the kind to set; either <code>ADDED</code> or <code>REMOVED</code>
*/
protected void setKind(int kind) {
@@ -81,17 +81,17 @@ public class MatchEvent extends SearchResultEvent {
}
/**
* Sets the match for the change this event reports.
- *
+ *
* @param match the match to set
*/
protected void setMatch(Match match) {
fMatchContainer[0] = match;
fMatches = null;
}
-
+
/**
* Sets the matches for the change this event reports.
- *
+ *
* @param matches the matches to set
*/
protected void setMatches(Match[] matches) {
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/MatchFilter.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/MatchFilter.java
index eb98e31d622..451a760db1e 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/MatchFilter.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/MatchFilter.java
@@ -17,7 +17,7 @@ package org.eclipse.search.ui.text;
* @since 3.3
*/
public abstract class MatchFilter {
-
+
/**
* Returns whether the given match is filtered by this filter.
*
@@ -25,21 +25,21 @@ public abstract class MatchFilter {
* @return returns <code>true</code> if the given match should be filtered or <code>false</code> if not.
*/
public abstract boolean filters(Match match);
-
+
/**
* Returns the name of the filter as shown in the match filter selection dialog.
*
* @return the name of the filter as shown in the match filter selection dialog.
*/
public abstract String getName();
-
+
/**
* Returns the description of the filter as shown in the match filter selection dialog.
*
* @return the description of the filter as shown in the match filter selection dialog.
*/
public abstract String getDescription();
-
+
/**
* Returns the label of the filter as shown by the filter action.
*
@@ -48,10 +48,10 @@ public abstract class MatchFilter {
public abstract String getActionLabel();
/**
- * Returns an ID of this filter.
+ * Returns an ID of this filter.
*
* @return the id of the filter to be used when persisting this filter.
*/
public abstract String getID();
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/RemoveAllEvent.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/RemoveAllEvent.java
index 6b1ba519b3e..850b0178a5c 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/RemoveAllEvent.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/RemoveAllEvent.java
@@ -13,11 +13,11 @@ import org.eclipse.search.ui.ISearchResult;
import org.eclipse.search.ui.SearchResultEvent;
/**
* An event indicating that all matches have been removed from a <code>AbstractTextSearchResult</code>.
- *
+ *
* <p>
* Clients may instantiate or subclass this class.
* </p>
- *
+ *
* @since 3.0
*/
public class RemoveAllEvent extends SearchResultEvent {
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/TextSearchQueryProvider.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/TextSearchQueryProvider.java
index e676e0dd3b6..73475f7c83c 100644
--- a/org.eclipse.search/new search/org/eclipse/search/ui/text/TextSearchQueryProvider.java
+++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/TextSearchQueryProvider.java
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.search.ui.text;
@@ -17,14 +17,13 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.ui.IWorkingSet;
-import org.eclipse.search.ui.ISearchQuery;
-
import org.eclipse.search.internal.ui.SearchPlugin;
+import org.eclipse.search.ui.ISearchQuery;
/**
* Abstract base class for text search query providers supplied via the <code>org.eclipse.search.textSearchQueryProvider</code>
* extension point. The plug-in preference <code>org.eclipse.search.textSearchQueryProvider<code> defines the preferred
- * query provider. It is intended that only products choose a preferred query provider.
+ * query provider. It is intended that only products choose a preferred query provider.
*
* @since 3.2
*/
@@ -37,44 +36,44 @@ public abstract class TextSearchQueryProvider {
* </p>
*/
public static abstract class TextSearchInput {
-
+
/**
* Returns the search text to search for.
- *
+ *
* @return the search text, depending on {@link #isRegExSearch()} the search text represents a regular expression
* or a pattern using '*' and '?' as wildcards. The empty search text signals a file name search.
*/
public abstract String getSearchText();
-
+
/**
* Returns whether the search is a case sensitive search or not.
- *
+ *
* @return whether the pattern is to be used case sensitive or not.
*/
public abstract boolean isCaseSensitiveSearch();
-
+
/**
* Returns whether the search text denotes a regular expression or not.
- *
+ *
* @return whether the pattern denotes a regular expression.
*/
public abstract boolean isRegExSearch();
-
+
/**
* Returns the scope for the search
- *
+ *
* @return the scope for the search
*/
public abstract FileTextSearchScope getScope();
}
-
+
/**
* Returns the preferred query provider. The preferred query provider is typically configured by the product
* and defined by the search plug-in preference 'org.eclipse.search.textSearchQueryProvider'.
* It is not intended that query providers change at runtime, but clients should always use this method to access
* the query provider.
- *
+ *
* @return the preferred {@link TextSearchQueryProvider}.
*/
public static TextSearchQueryProvider getPreferred() {
@@ -83,17 +82,17 @@ public abstract class TextSearchQueryProvider {
/**
* Create a query for the input with the given information.
- *
+ *
* @param textSearchInput the search input
* @return returns the created search query
* @throws CoreException a {@link CoreException} can be thrown when the query provider can not
* create a query for the given input.
*/
public abstract ISearchQuery createQuery(TextSearchInput textSearchInput) throws CoreException;
-
+
/**
* Create a query to search for the selected text in the workspace.
- *
+ *
* @param selectedText the text to search for
* @return returns the created search query
* @throws CoreException a {@link CoreException} can be thrown when the query provider can not
@@ -103,7 +102,7 @@ public abstract class TextSearchQueryProvider {
/**
* Create a query to search for the selected text in the given resources.
- *
+ *
* @param selectedText the text to search for
* @param resources the resources to search in
* @return returns the created search query
@@ -111,10 +110,10 @@ public abstract class TextSearchQueryProvider {
* create a query for the given input.
*/
public abstract ISearchQuery createQuery(String selectedText, IResource[] resources) throws CoreException;
-
+
/**
* Create a query to search for the selected text in the given working sets.
- *
+ *
* @param selectedText the text to search for
* @param ws the working sets to search in
* @return returns the created search query
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/CancelSearchAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/CancelSearchAction.java
index c5a1b16b410..32c6568625a 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/CancelSearchAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/CancelSearchAction.java
@@ -12,21 +12,20 @@ package org.eclipse.search2.internal.ui;
import org.eclipse.jface.action.Action;
-import org.eclipse.search.ui.ISearchResult;
-
import org.eclipse.search.internal.ui.SearchPluginImages;
+import org.eclipse.search.ui.ISearchResult;
public class CancelSearchAction extends Action {
private SearchView fView;
public CancelSearchAction(SearchView view) {
- super(SearchMessages.CancelSearchAction_label);
+ super(SearchMessages.CancelSearchAction_label);
fView= view;
- setToolTipText(SearchMessages.CancelSearchAction_tooltip);
+ setToolTipText(SearchMessages.CancelSearchAction_tooltip);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_CANCEL);
}
-
+
public void run() {
ISearchResult result= fView.getCurrentSearchResult();
if (result != null) {
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/InternalSearchUI.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/InternalSearchUI.java
index a9e759bb08b..cfea4dbc1e9 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/InternalSearchUI.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/InternalSearchUI.java
@@ -30,28 +30,27 @@ import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
+import org.eclipse.search.internal.ui.SearchPlugin;
+import org.eclipse.search.internal.ui.SearchPluginImages;
+import org.eclipse.search.internal.ui.SearchPreferencePage;
import org.eclipse.search.ui.IQueryListener;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResult;
import org.eclipse.search.ui.ISearchResultViewPart;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.internal.ui.SearchPluginImages;
-import org.eclipse.search.internal.ui.SearchPreferencePage;
-
import org.eclipse.search2.internal.ui.text.PositionTracker;
public class InternalSearchUI {
-
+
//The shared instance.
private static InternalSearchUI fgInstance;
-
+
// contains all running jobs
private HashMap fSearchJobs;
-
+
private QueryManager fSearchResultsManager;
private PositionTracker fPositionTracker;
-
+
private SearchViewManager fSearchViewManager;
public static final Object FAMILY_SEARCH = new Object();
@@ -69,18 +68,18 @@ public class InternalSearchUI {
this.job= null;
}
}
-
+
private class InternalSearchJob extends Job {
-
+
private SearchJobRecord fSearchJobRecord;
-
+
public InternalSearchJob(SearchJobRecord sjr) {
super(sjr.query.getLabel());
-
+
fSearchJobRecord= sjr;
}
-
+
protected IStatus run(IProgressMonitor monitor) {
fSearchJobRecord.job= this;
searchJobStarted(fSearchJobRecord);
@@ -91,7 +90,7 @@ public class InternalSearchUI {
}
catch (SecurityException e) {}
try{
- status= fSearchJobRecord.query.run(monitor);
+ status= fSearchJobRecord.query.run(monitor);
} finally {
try {
Thread.currentThread().setPriority(origPriority);
@@ -112,13 +111,13 @@ public class InternalSearchUI {
record.isRunning= true;
getSearchManager().queryStarting(record.query);
}
-
+
private void searchJobFinished(SearchJobRecord record) {
record.isRunning= false;
fSearchJobs.remove(record);
getSearchManager().queryFinished(record.query);
}
-
+
/**
* The constructor.
*/
@@ -127,9 +126,9 @@ public class InternalSearchUI {
fSearchJobs= new HashMap();
fSearchResultsManager= new QueryManager();
fPositionTracker= new PositionTracker();
-
+
fSearchViewManager= new SearchViewManager(fSearchResultsManager);
-
+
PlatformUI.getWorkbench().getProgressService().registerIconForFamily(SearchPluginImages.DESC_VIEW_SEARCHRES, FAMILY_SEARCH);
}
@@ -155,25 +154,25 @@ public class InternalSearchUI {
}
return null;
}
-
+
public boolean runSearchInBackground(ISearchQuery query, ISearchResultViewPart view) {
if (isQueryRunning(query))
return false;
-
+
// prepare view
if (view == null) {
getSearchViewManager().activateSearchView(true);
} else {
getSearchViewManager().activateSearchView(view);
}
-
+
addQuery(query);
SearchJobRecord sjr= new SearchJobRecord(query, true);
fSearchJobs.put(query, sjr);
-
+
Job job= new InternalSearchJob(sjr);
- job.setPriority(Job.BUILD);
+ job.setPriority(Job.BUILD);
job.setUser(true);
IWorkbenchSiteProgressService service= getProgressService();
@@ -182,7 +181,7 @@ public class InternalSearchUI {
} else {
job.schedule();
}
-
+
return true;
}
@@ -195,7 +194,7 @@ public class InternalSearchUI {
if (isQueryRunning(query)) {
return Status.CANCEL_STATUS;
}
-
+
// prepare view
if (view == null) {
getSearchViewManager().activateSearchView(true);
@@ -204,22 +203,22 @@ public class InternalSearchUI {
}
addQuery(query);
-
+
SearchJobRecord sjr= new SearchJobRecord(query, false);
fSearchJobs.put(query, sjr);
-
+
if (context == null)
context= new ProgressMonitorDialog(null);
-
+
return doRunSearchInForeground(sjr, context);
}
-
+
private IStatus doRunSearchInForeground(final SearchJobRecord rec, IRunnableContext context) {
try {
context.run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
searchJobStarted(rec);
- try {
+ try {
IStatus status= rec.query.run(monitor);
if (status.matches(IStatus.CANCEL)) {
throw new InterruptedException();
@@ -239,7 +238,7 @@ public class InternalSearchUI {
if (innerException instanceof CoreException) {
return ((CoreException) innerException).getStatus();
}
- return new Status(IStatus.ERROR, SearchPlugin.getID(), 0, SearchMessages.InternalSearchUI_error_unexpected, innerException);
+ return new Status(IStatus.ERROR, SearchPlugin.getID(), 0, SearchMessages.InternalSearchUI_error_unexpected, innerException);
} catch (InterruptedException e) {
return Status.CANCEL_STATUS;
}
@@ -248,10 +247,10 @@ public class InternalSearchUI {
public static void shutdown() {
InternalSearchUI instance= fgInstance;
- if (instance != null)
+ if (instance != null)
instance.doShutdown();
}
-
+
private void doShutdown() {
Iterator jobRecs= fSearchJobs.values().iterator();
while (jobRecs.hasNext()) {
@@ -260,9 +259,9 @@ public class InternalSearchUI {
element.job.cancel();
}
fPositionTracker.dispose();
-
+
fSearchViewManager.dispose(fSearchResultsManager);
-
+
}
public void cancelSearch(ISearchQuery job) {
@@ -276,7 +275,7 @@ public class InternalSearchUI {
public QueryManager getSearchManager() {
return fSearchResultsManager;
}
-
+
public SearchViewManager getSearchViewManager() {
return fSearchViewManager;
}
@@ -284,7 +283,7 @@ public class InternalSearchUI {
public PositionTracker getPositionTracker() {
return fPositionTracker;
}
-
+
public void addQueryListener(IQueryListener l) {
getSearchManager().addQueryListener(l);
}
@@ -311,7 +310,7 @@ public class InternalSearchUI {
establishHistoryLimit();
getSearchManager().addQuery(query);
}
-
+
private void establishHistoryLimit() {
int historyLimit= SearchPreferencePage.getHistoryLimit();
QueryManager searchManager= getSearchManager();
@@ -330,7 +329,7 @@ public class InternalSearchUI {
}
}
}
-
+
public void removeAllQueries() {
for (Iterator queries= fSearchJobs.keySet().iterator(); queries.hasNext();) {
ISearchQuery query= (ISearchQuery) queries.next();
@@ -339,7 +338,7 @@ public class InternalSearchUI {
fSearchJobs.clear();
getSearchManager().removeAll();
}
-
+
public void showSearchResult(SearchView searchView, ISearchResult result, boolean openInNew) {
if (openInNew) {
boolean isPinned= searchView.isPinned();
@@ -354,11 +353,11 @@ public class InternalSearchUI {
showSearchResult(searchView, result);
}
}
-
+
private void showSearchResult(SearchView searchView, ISearchResult result) {
getSearchManager().touch(result.getQuery());
searchView.showSearchResult(result);
}
-
-
+
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterAction.java
index 202e55ccb86..6048505d711 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterAction.java
@@ -23,10 +23,10 @@ import org.eclipse.search.ui.text.MatchFilter;
public class MatchFilterAction extends Action implements IUpdate {
-
+
private MatchFilter fFilter;
private AbstractTextSearchViewPage fPage;
-
+
public MatchFilterAction(AbstractTextSearchViewPage page, MatchFilter filter) {
super(filter.getActionLabel(), IAction.AS_CHECK_BOX);
fPage= page;
@@ -45,7 +45,7 @@ public class MatchFilterAction extends Action implements IUpdate {
if (activeMatchFilters == null) {
return;
}
-
+
for (int i= 0; i < activeMatchFilters.length; i++) {
if (!activeMatchFilters[i].equals(fFilter)) {
newFilters.add(activeMatchFilters[i]);
@@ -61,7 +61,7 @@ public class MatchFilterAction extends Action implements IUpdate {
public MatchFilter getFilter() {
return fFilter;
}
-
+
private boolean isActiveMatchFilter() {
AbstractTextSearchResult input= fPage.getInput();
if (input != null) {
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionAction.java
index a5f19254441..a9750b02ce1 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionAction.java
@@ -15,21 +15,20 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.window.Window;
+import org.eclipse.search.internal.ui.SearchPluginImages;
import org.eclipse.search.ui.text.AbstractTextSearchResult;
import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
import org.eclipse.search.ui.text.MatchFilter;
-import org.eclipse.search.internal.ui.SearchPluginImages;
-
public class MatchFilterSelectionAction extends Action {
-
+
public static final String ACTION_ID= "MatchFilterSelectionAction"; //$NON-NLS-1$
-
+
private AbstractTextSearchViewPage fPage;
-
+
public MatchFilterSelectionAction(AbstractTextSearchViewPage page) {
- super(SearchMessages.MatchFilterSelectionAction_label);
+ super(SearchMessages.MatchFilterSelectionAction_label);
setId(ACTION_ID);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_FILTER);
fPage= page;
@@ -37,21 +36,21 @@ public class MatchFilterSelectionAction extends Action {
public void run() {
Shell shell= fPage.getSite().getShell();
-
+
AbstractTextSearchResult input= fPage.getInput();
if (input == null) {
return;
}
-
+
MatchFilter[] allFilters= input.getAllMatchFilters();
MatchFilter[] checkedFilters= input.getActiveMatchFilters();
Integer limit= fPage.getElementLimit();
-
+
boolean enableMatchFilterConfiguration= checkedFilters != null;
boolean enableLimitConfiguration= limit != null;
int elementLimit= limit != null ? limit.intValue() : -1;
-
- MatchFilterSelectionDialog dialog = new MatchFilterSelectionDialog(shell, enableMatchFilterConfiguration, allFilters, checkedFilters, enableLimitConfiguration, elementLimit);
+
+ MatchFilterSelectionDialog dialog = new MatchFilterSelectionDialog(shell, enableMatchFilterConfiguration, allFilters, checkedFilters, enableLimitConfiguration, elementLimit);
if (dialog.open() == Window.OK) {
if (enableMatchFilterConfiguration) {
input.setActiveMatchFilters(dialog.getMatchFilters());
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java
index b7f34d944b5..4ce2f7240cc 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java
@@ -10,9 +10,6 @@
*******************************************************************************/
package org.eclipse.search2.internal.ui;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -28,6 +25,9 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.StatusDialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -39,30 +39,29 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.search.ui.text.MatchFilter;
-import org.eclipse.search.internal.ui.SearchPlugin;
-
/**
* A dialog that lets users configure the active {@link MatchFilter match filters} and (optionally) the
* maximal number of top level elements.
- *
+ *
* @since 3.3
*/
public class MatchFilterSelectionDialog extends StatusDialog {
private final boolean fShowLimitConfigurationControls;
private final MatchFilter[] fAllFilters;
-
+
private MatchFilter[] fEnabledFilters;
-
+
private CheckboxTableViewer fListViewer;
private Button fLimitElementsCheckbox;
private Text fLimitElementsField;
private Text fDescription;
-
+
private int fLimitElementCount;
private int fLastLimit;
private final boolean fEnableMatchFilterConfiguration;
@@ -70,7 +69,7 @@ public class MatchFilterSelectionDialog extends StatusDialog {
/**
* Creates a {@link MatchFilterSelectionDialog}.
- *
+ *
* @param shell the parent shell
* @param enableMatchFilterConfiguration
* @param allFilters all filters available for selection
@@ -84,13 +83,13 @@ public class MatchFilterSelectionDialog extends StatusDialog {
setTitle(SearchMessages.MatchFilterSelectionDialog_label);
setStatusLineAboveButtons(true);
-
+
fShowLimitConfigurationControls= enableLimitConfiguration;
fEnableMatchFilterConfiguration= enableMatchFilterConfiguration;
fAllFilters= allFilters;
fEnabledFilters= selectedFilters;
-
+
fLimitElementCount= limit;
fLastLimit= limit != -1 ? limit : 1000;
}
@@ -110,10 +109,10 @@ public class MatchFilterSelectionDialog extends StatusDialog {
String name= "MatchFilterSelectionDialog_" + String.valueOf(fShowLimitConfigurationControls) + '.' + String.valueOf(fEnableMatchFilterConfiguration); //$NON-NLS-1$
return SearchPlugin.getDefault().getDialogSettingsSection(name);
}
-
+
/**
* Returns the currently selected match filters.
- *
+ *
* @return the currently selected match filters.
*/
public MatchFilter[] getMatchFilters() {
@@ -123,13 +122,13 @@ public class MatchFilterSelectionDialog extends StatusDialog {
/**
* Returns the currently configured limit for top level elements. <code>-1</code> is returned if
* no limit should be applied.
- *
+ *
* @return the currently configured limit for top level elements or -1 if no limit should be used.
*/
public int getLimit() {
return fLimitElementCount;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@@ -151,11 +150,11 @@ public class MatchFilterSelectionDialog extends StatusDialog {
Label l= new Label(parent, SWT.NONE);
l.setFont(parent.getFont());
l.setText(SearchMessages.MatchFilterSelectionDialog_filter_description);
-
+
Table table = new Table(parent, SWT.CHECK | SWT.BORDER);
table.setFont(parent.getFont());
fListViewer = new CheckboxTableViewer(table);
-
+
GridData data = new GridData(GridData.FILL_BOTH);
data.minimumHeight= convertHeightInCharsToPixels(8);
table.setLayoutData(data);
@@ -168,13 +167,13 @@ public class MatchFilterSelectionDialog extends StatusDialog {
public void checkStateChanged(CheckStateChangedEvent event) {
performFilterListCheckStateChanged();
}
-
+
public String getText(Object element) {
return ((MatchFilter) element).getName();
}
}
ListenerAndLabelProvider listenerAndLP= new ListenerAndLabelProvider();
-
+
fListViewer.setLabelProvider(listenerAndLP);
fListViewer.setContentProvider(new ArrayContentProvider());
fListViewer.addSelectionChangedListener(listenerAndLP);
@@ -208,7 +207,7 @@ public class MatchFilterSelectionDialog extends StatusDialog {
fLimitElementsCheckbox.setText(SearchMessages.MatchFilterSelectionDialog_limit_description);
fLimitElementsCheckbox.setLayoutData(new GridData());
fLimitElementsCheckbox.setFont(parent.getFont());
-
+
fLimitElementsField = new Text(parent, SWT.BORDER);
fLimitElementsField.setFont(parent.getFont());
gd = new GridData();
@@ -238,13 +237,13 @@ public class MatchFilterSelectionDialog extends StatusDialog {
else
fDescription.setText(new String());
}
-
+
private void performFilterListCheckStateChanged() {
Object[] checked= fListViewer.getCheckedElements();
fEnabledFilters= new MatchFilter[checked.length];
System.arraycopy(checked, 0, fEnabledFilters, 0, checked.length);
}
-
+
private void performLimitCheckboxChanged() {
boolean isEnabled= fLimitElementsCheckbox.getSelection();
fLimitElementsField.setEnabled(isEnabled);
@@ -269,7 +268,7 @@ public class MatchFilterSelectionDialog extends StatusDialog {
else
updateStatus(createStatus(IStatus.OK, "")); //$NON-NLS-1$
}
-
+
private IStatus createStatus(int severity, String message) {
return new Status(severity, NewSearchUI.PLUGIN_ID, severity, message, null);
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/Messages.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/Messages.java
index 4dfea96553e..df63b840064 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/Messages.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/Messages.java
@@ -14,7 +14,7 @@ import com.ibm.icu.text.MessageFormat;
/**
* Helper class to format message strings.
- *
+ *
* @since 3.1
*/
public class Messages {
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/OpenSearchPreferencesAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/OpenSearchPreferencesAction.java
index f4af673e994..c449a5bc318 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/OpenSearchPreferencesAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/OpenSearchPreferencesAction.java
@@ -25,8 +25,8 @@ import org.eclipse.search.internal.ui.SearchPreferencePage;
*/
public class OpenSearchPreferencesAction extends Action {
public OpenSearchPreferencesAction() {
- super(SearchMessages.OpenSearchPreferencesAction_label);
- setToolTipText(SearchMessages.OpenSearchPreferencesAction_tooltip);
+ super(SearchMessages.OpenSearchPreferencesAction_label);
+ setToolTipText(SearchMessages.OpenSearchPreferencesAction_tooltip);
//PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.OPEN_PREFERENCES_ACTION);
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/PinSearchViewAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/PinSearchViewAction.java
index 2ac9cefba88..dc5b01eac34 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/PinSearchViewAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/PinSearchViewAction.java
@@ -21,7 +21,7 @@ import org.eclipse.search.internal.ui.SearchPluginImages;
* Pins the currently visible search view
*/
public class PinSearchViewAction extends Action implements IUpdate {
-
+
private SearchView fView = null;
/**
@@ -29,13 +29,13 @@ public class PinSearchViewAction extends Action implements IUpdate {
* @param view the search view
*/
public PinSearchViewAction(SearchView view) {
- super(SearchMessages.PinSearchViewAction_label, IAction.AS_CHECK_BOX);
- setToolTipText(SearchMessages.PinSearchViewAction_tooltip);
+ super(SearchMessages.PinSearchViewAction_label, IAction.AS_CHECK_BOX);
+ setToolTipText(SearchMessages.PinSearchViewAction_tooltip);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_PIN_VIEW);
fView = view;
update();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.action.IAction#run()
*/
@@ -43,7 +43,7 @@ public class PinSearchViewAction extends Action implements IUpdate {
fView.setPinned(isChecked());
fView.updatePartName();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/QueryManager.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/QueryManager.java
index eef2f8b388c..84b2795db91 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/QueryManager.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/QueryManager.java
@@ -23,29 +23,29 @@ import org.eclipse.search.ui.ISearchQuery;
class QueryManager {
private List fQueries;
private List fListeners;
-
+
public QueryManager() {
super();
// an ArrayList should be plenty fast enough (few searches).
fListeners= new ArrayList();
fQueries= new LinkedList();
}
-
+
public boolean hasQueries() {
synchronized (this) {
return !fQueries.isEmpty();
}
}
-
+
public int getSize() {
synchronized (this) {
return fQueries.size();
}
}
-
+
/**
- * Returns the queries in LRU order. Smaller index means more recently used.
- *
+ * Returns the queries in LRU order. Smaller index means more recently used.
+ *
* @return all queries
*/
public ISearchQuery[] getQueries() {
@@ -69,7 +69,7 @@ class QueryManager {
}
fireAdded(query);
}
-
+
public void addQueryListener(IQueryListener l) {
synchronized (fListeners) {
fListeners.add(l);
@@ -81,7 +81,7 @@ class QueryManager {
fListeners.remove(l);
}
}
-
+
public void fireAdded(ISearchQuery query) {
Set copiedListeners= new HashSet();
synchronized (fListeners) {
@@ -105,7 +105,7 @@ class QueryManager {
l.queryRemoved(query);
}
}
-
+
public void fireStarting(ISearchQuery query) {
Set copiedListeners= new HashSet();
synchronized (fListeners) {
@@ -149,7 +149,7 @@ class QueryManager {
public void queryStarting(ISearchQuery query) {
fireStarting(query);
}
-
+
public void touch(ISearchQuery query) {
synchronized (this) {
if (fQueries.contains(query)) {
@@ -158,5 +158,5 @@ class QueryManager {
}
}
}
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/RemoveAllSearchesAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/RemoveAllSearchesAction.java
index 468b42f323c..f5f96291d78 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/RemoveAllSearchesAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/RemoveAllSearchesAction.java
@@ -11,6 +11,7 @@
package org.eclipse.search2.internal.ui;
import org.eclipse.jface.action.Action;
+
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.NewSearchUI;
@@ -18,10 +19,10 @@ import org.eclipse.search.ui.NewSearchUI;
class RemoveAllSearchesAction extends Action {
public RemoveAllSearchesAction() {
- super(SearchMessages.RemoveAllSearchesAction_label);
- setToolTipText(SearchMessages.RemoveAllSearchesAction_tooltip);
- }
-
+ super(SearchMessages.RemoveAllSearchesAction_label);
+ setToolTipText(SearchMessages.RemoveAllSearchesAction_tooltip);
+ }
+
public void run() {
ISearchQuery[] queries= NewSearchUI.getQueries();
for (int i = 0; i < queries.length; i++) {
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchAgainAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchAgainAction.java
index 64b74273afe..6efe82c1d54 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchAgainAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchAgainAction.java
@@ -10,28 +10,27 @@
*******************************************************************************/
package org.eclipse.search2.internal.ui;
-import org.eclipse.core.runtime.IStatus;
-
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.core.runtime.IStatus;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.search.internal.ui.SearchPluginImages;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResult;
import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.search.internal.ui.SearchPluginImages;
-
class SearchAgainAction extends Action {
private SearchView fView;
-
+
public SearchAgainAction(SearchView view) {
- setText(SearchMessages.SearchAgainAction_label);
- setToolTipText(SearchMessages.SearchAgainAction_tooltip);
+ setText(SearchMessages.SearchAgainAction_label);
+ setToolTipText(SearchMessages.SearchAgainAction_tooltip);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_AGAIN);
- fView= view;
+ fView= view;
}
public void run() {
@@ -47,7 +46,7 @@ class SearchAgainAction extends Action {
ProgressMonitorDialog pmd= new ProgressMonitorDialog(shell);
IStatus status= NewSearchUI.runQueryInForeground(pmd, query, fView);
if (!status.isOK() && status.getSeverity() != IStatus.CANCEL) {
- ErrorDialog.openError(shell, SearchMessages.SearchAgainAction_Error_title, SearchMessages.SearchAgainAction_Error_message, status);
+ ErrorDialog.openError(shell, SearchMessages.SearchAgainAction_Error_title, SearchMessages.SearchAgainAction_Error_message, status);
}
}
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistoryDropDownAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistoryDropDownAction.java
index 69f4870bcd5..aa7003ca2b7 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistoryDropDownAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistoryDropDownAction.java
@@ -22,12 +22,11 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.search.internal.ui.SearchPluginImages;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResult;
import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.search.internal.ui.SearchPluginImages;
-
class SearchHistoryDropDownAction extends Action implements IMenuCreator {
private class ShowSearchFromHistoryAction extends Action {
@@ -36,10 +35,10 @@ class SearchHistoryDropDownAction extends Action implements IMenuCreator {
public ShowSearchFromHistoryAction(ISearchResult search) {
super("", AS_RADIO_BUTTON); //$NON-NLS-1$
fSearch= search;
-
+
String label= escapeAmp(search.getLabel());
if (InternalSearchUI.getInstance().isQueryRunning(search.getQuery()))
- label= MessageFormat.format(SearchMessages.SearchDropDownAction_running_message, new String[] { label });
+ label= MessageFormat.format(SearchMessages.SearchDropDownAction_running_message, new String[] { label });
// fix for bug 38049
if (label.indexOf('@') >= 0)
label+= '@';
@@ -47,7 +46,7 @@ class SearchHistoryDropDownAction extends Action implements IMenuCreator {
setImageDescriptor(search.getImageDescriptor());
setToolTipText(search.getTooltip());
}
-
+
private String escapeAmp(String label) {
StringBuffer buf= new StringBuffer();
for (int i= 0; i < label.length(); i++) {
@@ -59,11 +58,11 @@ class SearchHistoryDropDownAction extends Action implements IMenuCreator {
}
return buf.toString();
}
-
+
public void runWithEvent(Event event) {
runIfChecked(event.stateMask == SWT.CTRL);
}
-
+
public void run() {
runIfChecked(false);
}
@@ -78,15 +77,15 @@ class SearchHistoryDropDownAction extends Action implements IMenuCreator {
private Menu fMenu;
private SearchView fSearchView;
-
+
public SearchHistoryDropDownAction(SearchView searchView) {
- setText(SearchMessages.SearchDropDownAction_label);
- setToolTipText(SearchMessages.SearchDropDownAction_tooltip);
+ setText(SearchMessages.SearchDropDownAction_label);
+ setToolTipText(SearchMessages.SearchDropDownAction_tooltip);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_HISTORY);
fSearchView= searchView;
setMenuCreator(this);
}
-
+
public void updateEnablement() {
boolean hasQueries= InternalSearchUI.getInstance().getSearchManager().hasQueries();
setEnabled(hasQueries);
@@ -108,11 +107,11 @@ class SearchHistoryDropDownAction extends Action implements IMenuCreator {
public Menu getMenu(Control parent) {
ISearchResult currentSearch= fSearchView.getCurrentSearchResult();
disposeMenu();
-
+
fMenu= new Menu(parent);
-
+
ISearchQuery[] searches= NewSearchUI.getQueries();
- if (searches.length > 0) {
+ if (searches.length > 0) {
for (int i= 0; i < searches.length; i++) {
ISearchResult search= searches[i].getSearchResult();
ShowSearchFromHistoryAction action= new ShowSearchFromHistoryAction(search);
@@ -130,7 +129,7 @@ class SearchHistoryDropDownAction extends Action implements IMenuCreator {
ActionContributionItem item= new ActionContributionItem(action);
item.fill(parent, -1);
}
-
+
public void run() {
new ShowSearchHistoryDialogAction(fSearchView).run();
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java
index e13ddb5ccae..25d0f2a82de 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java
@@ -14,9 +14,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -36,6 +33,9 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.StatusDialog;
@@ -53,44 +53,43 @@ import org.eclipse.jface.window.Window;
import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.ISearchResult;
-
import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.internal.ui.SearchPreferencePage;
import org.eclipse.search.internal.ui.util.SWTUtil;
+import org.eclipse.search.ui.ISearchQuery;
+import org.eclipse.search.ui.ISearchResult;
/**
* Dialog that shows a list of items with icon and label.
*/
public class SearchHistorySelectionDialog extends SelectionDialog {
-
+
private static final int REMOVE_ID= IDialogConstants.CLIENT_ID+1;
private static final int WIDTH_IN_CHARACTERS= 55;
-
+
private List fInput;
private final List fRemovedEntries;
-
+
private TableViewer fViewer;
private Button fRemoveButton;
-
+
private boolean fIsOpenInNewView;
private Link fLink;
-
+
private static class HistoryConfigurationDialog extends StatusDialog {
-
+
private static final int DEFAULT_ID= 100;
-
+
private int fHistorySize;
private Text fHistorySizeTextField;
private final List fCurrentList;
private final List fCurrentRemoves;
-
+
public HistoryConfigurationDialog(Shell parent, List currentList, List removedEntries) {
super(parent);
fCurrentList= currentList;
fCurrentRemoves= removedEntries;
- setTitle(SearchMessages.SearchHistorySelectionDialog_history_size_title);
+ setTitle(SearchMessages.SearchHistorySelectionDialog_history_size_title);
fHistorySize= SearchPreferencePage.getHistoryLimit();
setHelpAvailable(false);
}
@@ -111,11 +110,11 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
GridLayout layout= (GridLayout) ancestor.getLayout();
layout.numColumns= 2;
ancestor.setLayout(layout);
-
+
Label limitText= new Label(ancestor, SWT.NONE);
limitText.setText(SearchMessages.SearchHistorySelectionDialog_history_size_description);
limitText.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
-
+
fHistorySizeTextField= new Text(ancestor, SWT.BORDER | SWT.RIGHT);
fHistorySizeTextField.setTextLimit(2);
fHistorySizeTextField.setText(String.valueOf(fHistorySize));
@@ -124,7 +123,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
validateDialogState();
}
});
-
+
GridData gridData= new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
gridData.widthHint= convertWidthInCharsToPixels(6);
fHistorySizeTextField.setLayoutData(gridData);
@@ -133,7 +132,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
return ancestor;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.StatusDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
@@ -141,7 +140,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
createButton(parent, DEFAULT_ID, SearchMessages.SearchHistorySelectionDialog_restore_default_button, false);
super.createButtonsForButtonBar(parent);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
*/
@@ -153,7 +152,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
}
super.buttonPressed(buttonId);
}
-
+
protected final boolean validateDialogState() {
IStatus status= null;
@@ -174,14 +173,14 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
updateStatus(status);
return !status.matches(IStatus.ERROR);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
protected void okPressed() {
IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
store.setValue(SearchPreferencePage.LIMIT_HISTORY, fHistorySize);
-
+
// establish history size
for (int i= fCurrentList.size() - 1; i >= fHistorySize; i--) {
fCurrentRemoves.add(fCurrentList.get(i));
@@ -189,42 +188,42 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
}
super.okPressed();
}
-
+
}
-
+
private static final class SearchesLabelProvider extends LabelProvider {
-
+
private ArrayList fImages= new ArrayList();
-
+
public String getText(Object element) {
return ((ISearchResult)element).getLabel();
}
-
+
public Image getImage(Object element) {
- ImageDescriptor imageDescriptor= ((ISearchResult)element).getImageDescriptor();
+ ImageDescriptor imageDescriptor= ((ISearchResult)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;
}
}
public SearchHistorySelectionDialog(Shell parent, List input) {
super(parent);
- setTitle(SearchMessages.SearchesDialog_title);
- setMessage(SearchMessages.SearchesDialog_message);
+ setTitle(SearchMessages.SearchesDialog_title);
+ setMessage(SearchMessages.SearchesDialog_message);
fInput= input;
fRemovedEntries= new ArrayList();
setHelpAvailable(false);
@@ -236,22 +235,22 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
public boolean isOpenInNewView() {
return fIsOpenInNewView;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings()
*/
protected IDialogSettings getDialogBoundsSettings() {
return SearchPlugin.getDefault().getDialogSettingsSection("DialogBounds_SearchHistorySelectionDialog"); //$NON-NLS-1$
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsStrategy()
*/
protected int getDialogBoundsStrategy() {
return DIALOG_PERSISTSIZE;
}
-
-
+
+
/*
* Overrides method from Dialog
*/
@@ -263,43 +262,43 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
layout.marginWidth= 0;
parent.setLayout(layout);
parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
Label label = new Label(parent,SWT.WRAP);
- label.setText(getMessage());
+ label.setText(getMessage());
GridData gd= new GridData(GridData.FILL_HORIZONTAL);
//gd.widthHint= convertWidthInCharsToPixels(WIDTH_IN_CHARACTERS);
label.setLayoutData(gd);
-
+
applyDialogFont(label);
return label;
}
-
-
-
+
+
+
/* (non-Javadoc)
* @see org.eclipse.jface.window.Window#create()
*/
public void create() {
super.create();
-
+
List initialSelection= getInitialElementSelections();
if (initialSelection != null)
fViewer.setSelection(new StructuredSelection(initialSelection));
validateDialogState();
}
-
+
/*
* Overrides method from Dialog
*/
protected Control createDialogArea(Composite container) {
Composite ancestor= (Composite) super.createDialogArea(container);
-
+
createMessageArea(ancestor);
-
+
Composite parent= new Composite(ancestor, SWT.NONE);
-
+
GridLayout layout= new GridLayout();
layout.numColumns= 2;
layout.marginHeight= 0;
@@ -309,7 +308,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
fViewer= new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
fViewer.setContentProvider(new ArrayContentProvider());
-
+
final Table table= fViewer.getTable();
table.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
@@ -321,10 +320,10 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
gd.heightHint= convertHeightInCharsToPixels(15);
gd.widthHint= convertWidthInCharsToPixels(WIDTH_IN_CHARACTERS);
table.setLayoutData(gd);
-
-
+
+
fRemoveButton= new Button(parent, SWT.PUSH);
- fRemoveButton.setText(SearchMessages.SearchesDialog_remove_label);
+ fRemoveButton.setText(SearchMessages.SearchesDialog_remove_label);
fRemoveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
buttonPressed(REMOVE_ID);
@@ -332,13 +331,13 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
});
fRemoveButton.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
SWTUtil.setButtonDimensionHint(fRemoveButton);
-
+
fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
validateDialogState();
}
- });
-
+ });
+
fLink= new Link(parent, SWT.NONE);
configureHistoryLink();
fLink.addSelectionListener(new SelectionAdapter() {
@@ -351,8 +350,8 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
}
});
fLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
-
-
+
+
applyDialogFont(ancestor);
// set input & selections last, so all the widgets are created.
@@ -365,11 +364,11 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
int historyLimit= SearchPreferencePage.getHistoryLimit();
fLink.setText(Messages.format(SearchMessages.SearchHistorySelectionDialog_configure_link_label, new Integer(historyLimit)));
}
-
+
protected final void validateDialogState() {
IStructuredSelection sel= (IStructuredSelection) fViewer.getSelection();
int elementsSelected= sel.toList().size();
-
+
fRemoveButton.setEnabled(elementsSelected > 0);
Button okButton= getOkButton();
if (okButton != null) {
@@ -380,7 +379,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
openInNewButton.setEnabled(elementsSelected == 1);
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.dialogs.SelectionDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
@@ -389,8 +388,8 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
createButton(parent, IDialogConstants.OPEN_ID, SearchMessages.SearchHistorySelectionDialog_open_in_new_button, false);
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}
-
-
+
+
protected void buttonPressed(int buttonId) {
if (buttonId == REMOVE_ID) {
IStructuredSelection selection= (IStructuredSelection) fViewer.getSelection();
@@ -412,7 +411,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
}
super.buttonPressed(buttonId);
}
-
+
/*
* Overrides method from Dialog
*/
@@ -421,7 +420,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog {
ISelection selection= fViewer.getSelection();
if (selection instanceof IStructuredSelection)
setResult(((IStructuredSelection) fViewer.getSelection()).toList());
-
+
// remove queries
for (Iterator iter= fRemovedEntries.iterator(); iter.hasNext();) {
ISearchResult result= (ISearchResult) iter.next();
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.java
index 4ab503a00dd..0f2f3a01df4 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.java
@@ -19,7 +19,7 @@ public final class SearchMessages extends NLS {
private SearchMessages() {
// Do not instantiate
}
-
+
static {
NLS.initializeMessages(BUNDLE_NAME, SearchMessages.class);
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchPageRegistry.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchPageRegistry.java
index 62d9f49dfc4..519ffec5db4 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchPageRegistry.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchPageRegistry.java
@@ -20,26 +20,25 @@ import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.ISearchResult;
import org.eclipse.search.ui.ISearchResultPage;
-import org.eclipse.search.internal.ui.SearchPlugin;
-
public class SearchPageRegistry {
-
+
public static final String ID_EXTENSION_POINT= "org.eclipse.search.searchResultViewPages"; //$NON-NLS-1$
public static final String ATTRIB_SEARCH_RESULT_CLASS= "searchResultClass"; //$NON-NLS-1$
public static final String ATTRIB_ID= "id"; //$NON-NLS-1$
public static final String ATTRIB_LABEL= "label"; //$NON-NLS-1$
public static final String ATTRIB_ICON= "icon"; //$NON-NLS-1$
-
+
public static final String ATTRIB_HELP_CONTEXT= "helpContextId"; //$NON-NLS-1$
-
+
private final Map fResultClassNameToExtension;
private final Map fExtensionToInstance;
private final IConfigurationElement[] fExtensions;
-
+
public SearchPageRegistry() {
fExtensionToInstance= new HashMap();
fResultClassNameToExtension= new HashMap();
@@ -57,7 +56,7 @@ public class SearchPageRegistry {
}
return null;
}
-
+
public ISearchResultPage findPageForPageId(String pageId, boolean create) {
IConfigurationElement configElement= findConfigurationElement(pageId);
if (configElement != null) {
@@ -105,7 +104,7 @@ public class SearchPageRegistry {
}
return instance;
}
-
+
private IConfigurationElement findConfigurationElement(String pageId) {
for (int i= 0; i < fExtensions.length; i++) {
IConfigurationElement curr= fExtensions[i];
@@ -115,7 +114,7 @@ public class SearchPageRegistry {
}
return null;
}
-
+
private IConfigurationElement findConfigurationElement(Class resultClass) {
String className= resultClass.getName();
IConfigurationElement configElement= (IConfigurationElement) fResultClassNameToExtension.get(className);
@@ -130,7 +129,7 @@ public class SearchPageRegistry {
return foundExtension;
}
}
-
+
Class[] interfaces= resultClass.getInterfaces();
for (int i= 0; i < interfaces.length; i++) {
IConfigurationElement foundExtension= findConfigurationElement(interfaces[i]);
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java
index be3c28791b7..783df2c639a 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java
@@ -13,18 +13,11 @@
*******************************************************************************/
package org.eclipse.search2.internal.ui;
-import com.ibm.icu.text.MessageFormat;
-
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import org.eclipse.core.commands.operations.IUndoContext;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.core.resources.ResourcesPlugin;
+import com.ibm.icu.text.MessageFormat;
import org.eclipse.osgi.util.NLS;
@@ -40,6 +33,13 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
+import org.eclipse.core.commands.operations.IUndoContext;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
@@ -72,6 +72,9 @@ import org.eclipse.ui.part.PageSwitcher;
import org.eclipse.ui.part.ShowInContext;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
+import org.eclipse.search.internal.ui.ISearchHelpContextIds;
+import org.eclipse.search.internal.ui.OpenSearchDialogAction;
+import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.IContextMenuConstants;
import org.eclipse.search.ui.IQueryListener;
import org.eclipse.search.ui.ISearchQuery;
@@ -80,12 +83,8 @@ import org.eclipse.search.ui.ISearchResultPage;
import org.eclipse.search.ui.ISearchResultViewPart;
import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.search.internal.ui.ISearchHelpContextIds;
-import org.eclipse.search.internal.ui.OpenSearchDialogAction;
-import org.eclipse.search.internal.ui.SearchPlugin;
-
public class SearchView extends PageBookView implements ISearchResultViewPart, IQueryListener {
-
+
private static final String MEMENTO_TYPE= "view"; //$NON-NLS-1$
private static final String MEMENTO_KEY_IS_PINNED= "isPinned"; //$NON-NLS-1$
private static final String MEMENTO_KEY_LAST_ACTIVATION= "org.eclipse.search.lastActivation"; //$NON-NLS-1$
@@ -101,19 +100,19 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
private CancelSearchAction fCancelAction;
private PinSearchViewAction fPinSearchViewAction;
private UndoRedoActionGroup fUndoRedoActionGroup;
-
+
private IMemento fPageState;
private boolean fIsPinned;
private int fActivationCount= 0;
private String fDefaultPartName;
-
+
private Composite fPageContent;
private Link fDescription;
private Composite fDescriptionComposite;
-
+
/**
* Creates the groups and separators for the search view's context menu
- *
+ *
* @param menu the context menu
*/
public static void createContextMenuGroups(IMenuManager menu) {
@@ -131,10 +130,10 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP));
menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES));
}
-
+
/**
* Creates the groups and separators for the search view's context menu
- *
+ *
* @param menu the context menu
*/
private static void createViewMenuGroups(IMenuManager menu) {
@@ -155,9 +154,9 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
}
/**
- * Creates the groups and separators for the search view's
+ * Creates the groups and separators for the search view's
* tool bar
- *
+ *
* @param toolbar the toolbar
*/
public static void createToolBarGroups(IToolBarManager toolbar) {
@@ -176,7 +175,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
toolbar.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
}
- static class DummyPart implements IWorkbenchPart {
+ static class DummyPart implements IWorkbenchPart {
private int fLastActivation= 0;
public void setLastActivation(int lastActivation) {
fLastActivation= lastActivation;
@@ -202,12 +201,12 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
public void createControl(Composite parent) {
Color background= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
-
+
Composite composite= new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(1, false));
-
+
composite.setBackground(background);
-
+
Link link= new Link(composite, SWT.NONE);
link.setText(SearchMessages.SearchView_empty_search_label);
link.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
@@ -217,9 +216,9 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
new OpenSearchDialogAction().run();
}
});
-
+
fControl= composite;
- }
+ }
public Control getControl() {
return fControl;
@@ -249,7 +248,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
return null;
}
-
+
public void init(IPageSite pageSite) {
super.init(pageSite);
getSite().setSelectionProvider(null);
@@ -263,7 +262,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
*/
public void saveState(IMemento memento) {
// do nothing
-
+
}
/* (non-Javadoc)
@@ -303,14 +302,14 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
fSearchViewStates= new HashMap();
fIsPinned= false;
}
-
+
/**
* @return the search result page registry
*/
public SearchPageRegistry getSearchPageRegistry() {
return fSearchViewPageService;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.part.PageBookView#partActivated(org.eclipse.ui.IWorkbenchPart)
*/
@@ -320,8 +319,8 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
InternalSearchUI.getInstance().getSearchViewManager().searchViewActivated(this);
}
}
-
-
+
+
protected IPage createDefaultPage(PageBook book) {
IPageBookViewPage page= new EmptySearchView();
page.createControl(book);
@@ -345,7 +344,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
IPage page = pageRecord.page;
page.dispose();
pageRecord.dispose();
-
+
// empty cross-reference cache
fPartsToPages.remove(part);
}
@@ -357,14 +356,14 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
protected boolean isImportant(IWorkbenchPart part) {
return part instanceof DummyPart;
}
-
-
+
+
public void showSearchResult(ISearchResult search) {
ISearchResultPage newPage= null;
if (search != null) {
newPage= fSearchViewPageService.findPageForSearchResult(search, true);
if (newPage == null) {
- String format= SearchMessages.SearchView_error_noResultPage;
+ String format= SearchMessages.SearchView_error_noResultPage;
String message= MessageFormat.format(format, new Object[] { search.getClass().getName() });
SearchPlugin.log(new Status(IStatus.ERROR, SearchPlugin.getID(), 0, message, null));
return;
@@ -372,13 +371,13 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
}
internalShowSearchPage(newPage, search);
}
-
+
public void showEmptySearchPage(String pageId) {
ISearchResultPage newPage= fSearchViewPageService.findPageForPageId(pageId, true);
internalShowSearchPage(newPage, null);
}
-
-
+
+
private void internalShowSearchPage(ISearchResultPage page, ISearchResult search) {
// detach the previous page.
ISearchResultPage currentPage= (ISearchResultPage) getCurrentPage();
@@ -386,7 +385,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
fSearchViewStates.put(fCurrentSearch, currentPage.getUIState());
currentPage.setInput(null, null);
}
-
+
fCurrentSearch= search;
if (page != null) {
@@ -401,7 +400,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
part.setLastActivation(++fActivationCount);
partActivated(part);
}
-
+
// connect to the new pages
Object uiState= search != null ? fSearchViewStates.get(search) : null;
page.setInput(search, uiState);
@@ -409,21 +408,21 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
updatePartName();
updateLabel();
updateCancelAction();
-
+
updateHelpContextID(page);
}
-
+
private void updateHelpContextID(ISearchResultPage page) {
String helpContextId= null;
String pageId= null;
-
+
if (page != null)
pageId= page.getID();
-
+
if (pageId != null)
helpContextId= fSearchViewPageService.getHelpContextId(pageId);
-
+
if (helpContextId == null)
helpContextId= ISearchHelpContextIds.New_SEARCH_VIEW;
@@ -447,20 +446,20 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
if (fDescriptionComposite == null) {
fDescriptionComposite= new Composite(fPageContent, SWT.NONE);
fDescriptionComposite.moveAbove(null);
-
+
GridLayout layout= new GridLayout();
layout.marginHeight= 0;
layout.marginWidth= 0;
layout.verticalSpacing= 0;
fDescriptionComposite.setLayout(layout);
fDescriptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
+
fDescription= new Link(fDescriptionComposite, SWT.NONE);
GridData gridData= new GridData(SWT.FILL, SWT.CENTER, true, false);
gridData.horizontalIndent= 5;
fDescription.setLayoutData(gridData);
fDescription.setText(label);
-
+
Label separator= new Label(fDescriptionComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
separator.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
fPageContent.layout();
@@ -470,14 +469,14 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
}
}
}
-
+
public ISearchResult getCurrentSearchResult() {
return fCurrentSearch;
}
public void createPartControl(Composite parent) {
createActions();
-
+
fPageContent= new Composite(parent, SWT.NONE);
GridLayout layout= new GridLayout();
layout.marginHeight= 0;
@@ -485,17 +484,17 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
layout.horizontalSpacing= 0;
layout.verticalSpacing= 0;
fPageContent.setLayout(layout);
-
+
fDescriptionComposite= null;
-
+
super.createPartControl(fPageContent);
getPageBook().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
+
fDefaultPartName= getPartName();
initializeToolBar();
InternalSearchUI.getInstance().getSearchManager().addQueryListener(this);
initializePageSwitcher();
-
+
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ISearchHelpContextIds.New_SEARCH_VIEW);
restorePageFromMemento();
}
@@ -558,7 +557,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
tbm.appendToGroup(IContextMenuConstants.GROUP_SEARCH, fPinSearchViewAction);
getViewSite().getActionBars().updateActionBars();
}
-
+
private void createActions() {
fSearchesDropDownAction= new SearchHistoryDropDownAction(this);
fSearchesDropDownAction.updateEnablement();
@@ -569,7 +568,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
fCancelAction= new CancelSearchAction(this);
fCancelAction.setEnabled(false);
fPinSearchViewAction= new PinSearchViewAction(this);
-
+
IUndoContext workspaceContext= (IUndoContext)ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
fUndoRedoActionGroup= new UndoRedoActionGroup(getViewSite(), workspaceContext, true);
}
@@ -642,21 +641,21 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
}
}
}
-
+
private String getShowInMenuLabel() {
String keyBinding= null;
-
+
IBindingService bindingService= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
if (bindingService != null)
keyBinding= bindingService.getBestActiveBindingFormattedFor("org.eclipse.ui.navigate.showInQuickMenu"); //$NON-NLS-1$
-
+
if (keyBinding == null)
keyBinding= ""; //$NON-NLS-1$
-
+
return NLS.bind(SearchMessages.SearchView_showIn_menu, keyBinding);
}
-
+
// Methods related to saving page state. -------------------------------------------
public void saveState(IMemento memento) {
@@ -671,7 +670,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
}
memento.putString(MEMENTO_KEY_IS_PINNED, String.valueOf(isPinned()));
}
-
+
public void init(IViewSite site, IMemento memento) throws PartInitException {
super.init(site, memento);
@@ -682,16 +681,16 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
if (progressService != null)
progressService.showBusyForFamily(InternalSearchUI.FAMILY_SEARCH);
}
-
+
protected void initPage(IPageBookViewPage page) {
super.initPage(page);
IActionBars actionBars= page.getSite().getActionBars();
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fSearchAgainAction);
actionBars.updateActionBars();
-
+
fUndoRedoActionGroup.fillActionBars(actionBars);
-
+
ISearchResultPage srPage= (ISearchResultPage) page;
IMemento memento= null;
if (fPageState != null) {
@@ -705,7 +704,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
}
srPage.restoreState(memento);
}
-
+
/*
* TODO workaround for focus problem. Clarify focus behavior.
* @see org.eclipse.ui.IWorkbenchPart#setFocus()
@@ -714,17 +713,17 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
IPage currentPage= getCurrentPage();
if (currentPage != null)
currentPage.setFocus();
- else
+ else
super.setFocus();
}
-
+
public ISearchResultPage getActivePage() {
IPage page= getCurrentPage();
if (page instanceof ISearchResultPage)
return (ISearchResultPage) page;
return null;
}
-
+
public IWorkbenchSiteProgressService getProgressService() {
IWorkbenchSiteProgressService service = null;
Object siteService =
@@ -738,7 +737,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
super.showBusy(busy);
getProgressService().warnOfContentChange();
}
-
+
public Object getAdapter(Class adapter) {
Object superAdapter= super.getAdapter(adapter);
if (superAdapter != null)
@@ -754,21 +753,21 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
}
/**
- * Marks the view as pinned.
- *
- * @param pinned if <code>true</code> the view is marked as pinned
+ * Marks the view as pinned.
+ *
+ * @param pinned if <code>true</code> the view is marked as pinned
*/
public void setPinned(boolean pinned) {
fIsPinned= pinned;
}
/**
- * @return returns <code>true</code> the view is marked as pinned
+ * @return returns <code>true</code> the view is marked as pinned
*/
public boolean isPinned() {
return fIsPinned;
}
-
+
public void updatePartName() {
if (fDefaultPartName != null) {
// mstodo not yet enabled.
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchViewManager.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchViewManager.java
index 5e21347fe3d..4869e2e22f9 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchViewManager.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchViewManager.java
@@ -21,26 +21,25 @@ import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchException;
+import org.eclipse.search.internal.ui.SearchPlugin;
+import org.eclipse.search.internal.ui.util.ExceptionHandler;
import org.eclipse.search.ui.IQueryListener;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResult;
import org.eclipse.search.ui.ISearchResultViewPart;
import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
/**
- *
+ *
*/
public class SearchViewManager {
-
+
private IQueryListener fNewQueryListener;
private int fViewCount= 0;
-
+
private LinkedList fLRUSearchViews;
-
-
+
+
public SearchViewManager(QueryManager queryManager) {
fNewQueryListener= new IQueryListener() {
@@ -51,20 +50,20 @@ public class SearchViewManager {
public void queryRemoved(ISearchQuery query) {}
public void queryStarting(ISearchQuery query) {}
public void queryFinished(ISearchQuery query) {}
-
+
};
-
+
queryManager.addQueryListener(fNewQueryListener);
-
+
fLRUSearchViews= new LinkedList();
-
+
}
-
+
public void dispose(QueryManager queryManager) {
queryManager.removeQueryListener(fNewQueryListener);
}
-
-
+
+
protected boolean showNewSearchQuery(ISearchQuery query) {
if (!fLRUSearchViews.isEmpty()) {
SearchView view= (SearchView) fLRUSearchViews.getFirst();
@@ -76,7 +75,7 @@ public class SearchViewManager {
public ISearchResultViewPart activateSearchView(boolean useForNewSearch) {
IWorkbenchPage activePage= SearchPlugin.getActivePage();
-
+
String defaultPerspectiveId= NewSearchUI.getDefaultPerspectiveId();
if (defaultPerspectiveId != null) {
IWorkbenchWindow window= activePage.getWorkbenchWindow();
@@ -101,12 +100,12 @@ public class SearchViewManager {
}
return (ISearchResultViewPart) activePage.showView(NewSearchUI.SEARCH_VIEW_ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_openResultView_title, SearchMessages.Search_Error_openResultView_message);
- }
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_openResultView_title, SearchMessages.Search_Error_openResultView_message);
+ }
}
return null;
}
-
+
public boolean isShown(ISearchQuery query) {
for (Iterator iter= fLRUSearchViews.iterator(); iter.hasNext();) {
SearchView view= (SearchView) iter.next();
@@ -117,15 +116,15 @@ public class SearchViewManager {
}
return false;
}
-
+
public void activateSearchView(ISearchResultViewPart viewPart) {
try {
IWorkbenchPage activePage= viewPart.getSite().getPage();
String secondaryId= viewPart.getViewSite().getSecondaryId();
activePage.showView(NewSearchUI.SEARCH_VIEW_ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_openResultView_title, SearchMessages.Search_Error_openResultView_message);
- }
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_openResultView_title, SearchMessages.Search_Error_openResultView_message);
+ }
}
private ISearchResultViewPart findLRUSearchResultView(IWorkbenchPage page, boolean avoidPinnedViews) {
@@ -149,14 +148,14 @@ public class SearchViewManager {
if (view != null && (!avoidPinnedViews || !view.isPinned())) {
return view;
}
-
+
}
}
}
return null;
}
-
-
+
+
public void searchViewActivated(SearchView view) {
fLRUSearchViews.remove(view);
fLRUSearchViews.addFirst(view);
@@ -175,7 +174,7 @@ public class SearchViewManager {
}
-
-
-
+
+
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/ShowSearchHistoryDialogAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/ShowSearchHistoryDialogAction.java
index e721b8a4b5c..2efe0511fbc 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/ShowSearchHistoryDialogAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/ShowSearchHistoryDialogAction.java
@@ -15,12 +15,11 @@ import java.util.ArrayList;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.window.Window;
+import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResult;
import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.search.internal.ui.SearchPlugin;
-
/**
@@ -35,11 +34,11 @@ class ShowSearchHistoryDialogAction extends Action {
* Create a new instance of this class
*/
public ShowSearchHistoryDialogAction(SearchView searchView) {
- super(SearchMessages.ShowSearchesAction_label);
- setToolTipText(SearchMessages.ShowSearchesAction_tooltip);
+ super(SearchMessages.ShowSearchesAction_label);
+ setToolTipText(SearchMessages.ShowSearchesAction_tooltip);
fSearchView= searchView;
}
-
+
public void run() {
ISearchQuery[] queries= NewSearchUI.getQueries();
@@ -48,9 +47,9 @@ class ShowSearchHistoryDialogAction extends Action {
ISearchResult search= queries[j].getSearchResult();
input.add(search);
}
-
+
SearchHistorySelectionDialog dlg= new SearchHistorySelectionDialog(SearchPlugin.getActiveWorkbenchShell(),input);
-
+
ISearchResult current= fSearchView.getCurrentSearchResult();
if (current != null) {
Object[] selected= new Object[1];
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/CollapseAllAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/CollapseAllAction.java
index 3c320865bc3..4bcb61a3620 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/CollapseAllAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/CollapseAllAction.java
@@ -22,15 +22,15 @@ public class CollapseAllAction extends Action {
private TreeViewer fViewer;
public CollapseAllAction() {
- super(SearchMessages.CollapseAllAction_0);
- setToolTipText(SearchMessages.CollapseAllAction_1);
+ super(SearchMessages.CollapseAllAction_0);
+ setToolTipText(SearchMessages.CollapseAllAction_1);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_COLLAPSE_ALL);
}
-
+
public void setViewer(TreeViewer viewer) {
fViewer= viewer;
}
-
+
public void run() {
if (fViewer != null) {
fViewer.collapseAll();
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ExpandAllAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ExpandAllAction.java
index c5240a17a20..c797fad8615 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ExpandAllAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ExpandAllAction.java
@@ -22,15 +22,15 @@ public class ExpandAllAction extends Action {
private TreeViewer fViewer;
public ExpandAllAction() {
- super(SearchMessages.ExpandAllAction_label);
- setToolTipText(SearchMessages.ExpandAllAction_tooltip);
+ super(SearchMessages.ExpandAllAction_label);
+ setToolTipText(SearchMessages.ExpandAllAction_tooltip);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_EXPAND_ALL);
}
-
+
public void setViewer(TreeViewer viewer) {
fViewer= viewer;
}
-
+
public void run() {
if (fViewer != null) {
fViewer.expandAll();
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveAllMatchesAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveAllMatchesAction.java
index 059ab342cdd..aefa27e345f 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveAllMatchesAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveAllMatchesAction.java
@@ -12,10 +12,9 @@ package org.eclipse.search2.internal.ui.basic.views;
import org.eclipse.jface.action.Action;
-import org.eclipse.search.ui.text.*;
-import org.eclipse.search.ui.text.AbstractTextSearchResult;
-
import org.eclipse.search.internal.ui.SearchPluginImages;
+import org.eclipse.search.ui.text.AbstractTextSearchResult;
+import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
import org.eclipse.search2.internal.ui.SearchMessages;
@@ -23,12 +22,12 @@ public class RemoveAllMatchesAction extends Action {
AbstractTextSearchViewPage fPage;
public RemoveAllMatchesAction(AbstractTextSearchViewPage page) {
- super(SearchMessages.RemoveAllMatchesAction_label);
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_REM_ALL);
- setToolTipText(SearchMessages.RemoveAllMatchesAction_tooltip);
+ super(SearchMessages.RemoveAllMatchesAction_label);
+ SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_REM_ALL);
+ setToolTipText(SearchMessages.RemoveAllMatchesAction_tooltip);
fPage= page;
}
-
+
public void run() {
AbstractTextSearchResult search= fPage.getInput();
if (search != null)
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveMatchAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveMatchAction.java
index ac7b6e30fa2..de5b1afada1 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveMatchAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveMatchAction.java
@@ -12,9 +12,10 @@ package org.eclipse.search2.internal.ui.basic.views;
import org.eclipse.jface.action.Action;
-import org.eclipse.search.ui.text.*;
-
import org.eclipse.search.internal.ui.SearchPluginImages;
+import org.eclipse.search.ui.text.AbstractTextSearchResult;
+import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
+import org.eclipse.search.ui.text.Match;
import org.eclipse.search2.internal.ui.SearchMessages;
@@ -24,16 +25,16 @@ public class RemoveMatchAction extends Action {
public RemoveMatchAction(AbstractTextSearchViewPage page) {
fPage= page;
- setText(SearchMessages.RemoveMatchAction_label);
- setToolTipText(SearchMessages.RemoveMatchAction_tooltip);
+ setText(SearchMessages.RemoveMatchAction_label);
+ setToolTipText(SearchMessages.RemoveMatchAction_tooltip);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_REM);
}
-
+
public void run() {
Match match= fPage.getCurrentMatch();
AbstractTextSearchResult result= fPage.getInput();
if (match != null && result != null)
result.removeMatch(match);
}
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveSelectedMatchesAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveSelectedMatchesAction.java
index 48be45f5c26..f4b7e698671 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveSelectedMatchesAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/RemoveSelectedMatchesAction.java
@@ -11,8 +11,10 @@
package org.eclipse.search2.internal.ui.basic.views;
import org.eclipse.jface.action.Action;
+
import org.eclipse.search.internal.ui.SearchPluginImages;
import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
+
import org.eclipse.search2.internal.ui.SearchMessages;
public class RemoveSelectedMatchesAction extends Action {
@@ -21,11 +23,11 @@ public class RemoveSelectedMatchesAction extends Action {
public RemoveSelectedMatchesAction(AbstractTextSearchViewPage page) {
fPage= page;
- setText(SearchMessages.RemoveSelectedMatchesAction_label);
- setToolTipText(SearchMessages.RemoveSelectedMatchesAction_tooltip);
+ setText(SearchMessages.RemoveSelectedMatchesAction_label);
+ setToolTipText(SearchMessages.RemoveSelectedMatchesAction_tooltip);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_REM);
}
-
+
public void run() {
fPage.internalRemoveSelected();
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/SetLayoutAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/SetLayoutAction.java
index 4d7756282b5..a8fa3b61266 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/SetLayoutAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/SetLayoutAction.java
@@ -12,6 +12,7 @@ package org.eclipse.search2.internal.ui.basic.views;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
+
import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
public class SetLayoutAction extends Action {
@@ -25,11 +26,11 @@ public class SetLayoutAction extends Action {
setToolTipText(tooltip);
fLayout= layout;
}
-
+
public void run() {
fPage.setLayout(fLayout);
}
-
+
public int getLayout() {
return fLayout;
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ShowNextResultAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ShowNextResultAction.java
index 37cd383200a..df4eae3ca9a 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ShowNextResultAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ShowNextResultAction.java
@@ -12,23 +12,22 @@ package org.eclipse.search2.internal.ui.basic.views;
import org.eclipse.jface.action.Action;
-import org.eclipse.search.ui.text.*;
-
import org.eclipse.search.internal.ui.SearchPluginImages;
+import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
import org.eclipse.search2.internal.ui.SearchMessages;
public class ShowNextResultAction extends Action {
-
+
private AbstractTextSearchViewPage fPage;
public ShowNextResultAction(AbstractTextSearchViewPage page) {
- super(SearchMessages.ShowNextResultAction_label);
+ super(SearchMessages.ShowNextResultAction_label);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_NEXT);
- setToolTipText(SearchMessages.ShowNextResultAction_tooltip);
+ setToolTipText(SearchMessages.ShowNextResultAction_tooltip);
fPage= page;
}
-
+
public void run() {
fPage.gotoNextMatch();
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ShowPreviousResultAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ShowPreviousResultAction.java
index c433eaa9ab8..fad52bbe8e2 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ShowPreviousResultAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/ShowPreviousResultAction.java
@@ -12,23 +12,22 @@ package org.eclipse.search2.internal.ui.basic.views;
import org.eclipse.jface.action.Action;
-import org.eclipse.search.ui.text.*;
-
import org.eclipse.search.internal.ui.SearchPluginImages;
+import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
import org.eclipse.search2.internal.ui.SearchMessages;
public class ShowPreviousResultAction extends Action {
-
+
private AbstractTextSearchViewPage fPage;
public ShowPreviousResultAction(AbstractTextSearchViewPage page) {
- super(SearchMessages.ShowPreviousResultAction_label);
+ super(SearchMessages.ShowPreviousResultAction_label);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_PREV);
- setToolTipText(SearchMessages.ShowPreviousResultAction_tooltip);
+ setToolTipText(SearchMessages.ShowPreviousResultAction_tooltip);
fPage= page;
}
-
+
public void run() {
fPage.gotoPreviousMatch();
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/TreeViewerNavigator.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/TreeViewerNavigator.java
index 2f646165df0..6ebd84af56a 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/TreeViewerNavigator.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/basic/views/TreeViewerNavigator.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.search2.internal.ui.basic.views;
-import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
-
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
@@ -19,15 +17,17 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
+
public class TreeViewerNavigator implements INavigate {
private TreeViewer fViewer;
private AbstractTextSearchViewPage fPage;
-
+
public TreeViewerNavigator(AbstractTextSearchViewPage page, TreeViewer viewer) {
fViewer= viewer;
fPage= page;
}
-
+
public void navigateNext(boolean forward) {
TreeItem currentItem= getCurrentItem(forward);
if (currentItem == null)
@@ -46,7 +46,7 @@ public class TreeViewerNavigator implements INavigate {
internalSetSelection(nextItem);
}
}
-
+
private TreeItem getFirstItem() {
TreeItem[] roots= fViewer.getTree().getItems();
if (roots.length == 0)
@@ -60,7 +60,7 @@ public class TreeViewerNavigator implements INavigate {
}
return null;
}
-
+
private TreeItem getLastItem() {
TreeItem[] roots= fViewer.getTree().getItems();
if (roots.length == 0)
@@ -131,7 +131,7 @@ public class TreeViewerNavigator implements INavigate {
return child;
return getFirstChildWithMatches(child);
}
-
+
private TreeItem[] getChildren(TreeItem item) {
fViewer.setExpandedState(item.getData(), true);
return item.getItems();
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationHighlighter.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationHighlighter.java
index 6ead01db158..eecadbed188 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationHighlighter.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationHighlighter.java
@@ -18,12 +18,12 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import org.eclipse.core.filebuffers.IFileBuffer;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.filebuffers.IFileBuffer;
+import org.eclipse.core.filebuffers.ITextFileBuffer;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
@@ -31,9 +31,8 @@ import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.IAnnotationModelExtension;
-import org.eclipse.search.ui.text.Match;
-
import org.eclipse.search.internal.ui.SearchPlugin;
+import org.eclipse.search.ui.text.Match;
import org.eclipse.search2.internal.ui.InternalSearchUI;
import org.eclipse.search2.internal.ui.SearchMessages;
@@ -43,7 +42,7 @@ public class AnnotationHighlighter extends Highlighter {
private IAnnotationModel fModel;
private IDocument fDocument;
private Map fMatchesToAnnotations;
-
+
public AnnotationHighlighter(IAnnotationModel model, IDocument document) {
fModel= model;
fDocument= document;
@@ -58,7 +57,7 @@ public class AnnotationHighlighter extends Highlighter {
if (offset >= 0 && length >= 0) {
Position position= createPosition(matches[i]);
if (position != null) {
- Annotation annotation= matches[i].isFiltered()
+ Annotation annotation= matches[i].isFiltered()
? new Annotation(SearchPlugin.FILTERED_SEARCH_ANNOTATION_TYPE, true, null)
: new Annotation(SearchPlugin.SEARCH_ANNOTATION_TYPE, true, null);
fMatchesToAnnotations.put(matches[i], annotation);
@@ -67,14 +66,14 @@ public class AnnotationHighlighter extends Highlighter {
}
}
addAnnotations(map);
-
+
}
-
+
private Position createPosition(Match match) {
Position position= InternalSearchUI.getInstance().getPositionTracker().getCurrentPosition(match);
if (position == null)
position= new Position(match.getOffset(), match.getLength());
- else
+ else
// need to clone position, can't have it twice in a document.
position= new Position(position.getOffset(), position.getLength());
if (match.getBaseUnit() == Match.UNIT_LINE) {
@@ -82,11 +81,11 @@ public class AnnotationHighlighter extends Highlighter {
try {
position= PositionTracker.convertToCharacterPosition(position, fDocument);
} catch (BadLocationException e) {
- // ignore, match must be outdated
+ // ignore, match must be outdated
return null;
}
} else {
- SearchPlugin.log(new Status(IStatus.ERROR, SearchPlugin.getID(), 0, SearchMessages.AnnotationHighlighter_error_noDocument, null));
+ SearchPlugin.log(new Status(IStatus.ERROR, SearchPlugin.getID(), 0, SearchMessages.AnnotationHighlighter_error_noDocument, null));
return null;
}
}
@@ -103,13 +102,13 @@ public class AnnotationHighlighter extends Highlighter {
}
removeAnnotations(annotations);
}
-
+
public void removeAll() {
Collection matchSet= fMatchesToAnnotations.values();
removeAnnotations(matchSet);
fMatchesToAnnotations.clear();
}
-
+
private void addAnnotations(Map annotationToPositionMap) {
if (fModel instanceof IAnnotationModelExtension) {
IAnnotationModelExtension ame= (IAnnotationModelExtension) fModel;
@@ -122,11 +121,11 @@ public class AnnotationHighlighter extends Highlighter {
}
}
}
-
+
/**
* Removes annotations from the given annotation model. The default implementation works for editors that
* implement <code>ITextEditor</code>.
- * Subclasses may override this method.
+ * Subclasses may override this method.
* @param annotations A set containing the annotations to be removed.
* @see Annotation
*/
@@ -146,7 +145,7 @@ public class AnnotationHighlighter extends Highlighter {
protected void handleContentReplaced(IFileBuffer buffer) {
if (!(buffer instanceof ITextFileBuffer))
return;
-
+
ITextFileBuffer textBuffer= (ITextFileBuffer) buffer;
if (fDocument != null && fDocument.equals(textBuffer.getDocument())) {
Set allMatches= fMatchesToAnnotations.keySet();
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationManagers.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationManagers.java
index 586fd434f4e..975ea6f20c4 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationManagers.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/AnnotationManagers.java
@@ -13,11 +13,12 @@ package org.eclipse.search2.internal.ui.text;
import java.util.HashMap;
-import org.eclipse.search.ui.text.AbstractTextSearchResult;
import org.eclipse.ui.IWindowListener;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.search.ui.text.AbstractTextSearchResult;
+
public class AnnotationManagers {
static {
fgManagerMap = new HashMap();
@@ -53,11 +54,11 @@ public class AnnotationManagers {
public static void addSearchResult(IWorkbenchWindow window, AbstractTextSearchResult newResult) {
getWindowAnnotationManager(window).addSearchResult(newResult);
}
-
+
public static void removeSearchResult(IWorkbenchWindow window, AbstractTextSearchResult result) {
getWindowAnnotationManager(window).removeSearchResult(result);
}
-
+
private static WindowAnnotationManager getWindowAnnotationManager(IWorkbenchWindow window) {
WindowAnnotationManager mgr= (WindowAnnotationManager) fgManagerMap.get(window);
if (mgr == null) {
@@ -66,6 +67,6 @@ public class AnnotationManagers {
}
return mgr;
}
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java
index ba8342d37ca..d3ef848d49b 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAccessHighlighter.java
@@ -17,12 +17,12 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import org.eclipse.core.filebuffers.IFileBuffer;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.filebuffers.IFileBuffer;
+import org.eclipse.core.filebuffers.ITextFileBuffer;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
@@ -30,11 +30,10 @@ import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.IAnnotationModelExtension;
+import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.text.ISearchEditorAccess;
import org.eclipse.search.ui.text.Match;
-import org.eclipse.search.internal.ui.SearchPlugin;
-
import org.eclipse.search2.internal.ui.InternalSearchUI;
import org.eclipse.search2.internal.ui.SearchMessages;
@@ -42,7 +41,7 @@ import org.eclipse.search2.internal.ui.SearchMessages;
public class EditorAccessHighlighter extends Highlighter {
private ISearchEditorAccess fEditorAcess;
private Map fMatchesToAnnotations;
-
+
public EditorAccessHighlighter(ISearchEditorAccess editorAccess) {
fEditorAcess= editorAccess;
fMatchesToAnnotations= new HashMap();
@@ -59,7 +58,7 @@ public class EditorAccessHighlighter extends Highlighter {
if (position != null) {
Map map= getMap(mapsByAnnotationModel, matches[i]);
if (map != null) {
- Annotation annotation= matches[i].isFiltered()
+ Annotation annotation= matches[i].isFiltered()
? new Annotation(SearchPlugin.FILTERED_SEARCH_ANNOTATION_TYPE, true, null)
: new Annotation(SearchPlugin.SEARCH_ANNOTATION_TYPE, true, null);
fMatchesToAnnotations.put(matches[i], annotation);
@@ -67,7 +66,7 @@ public class EditorAccessHighlighter extends Highlighter {
}
}
} catch (BadLocationException e) {
- SearchPlugin.log(new Status(IStatus.ERROR, SearchPlugin.getID(), 0, SearchMessages.EditorAccessHighlighter_error_badLocation, e));
+ SearchPlugin.log(new Status(IStatus.ERROR, SearchPlugin.getID(), 0, SearchMessages.EditorAccessHighlighter_error_badLocation, e));
}
}
}
@@ -76,7 +75,7 @@ public class EditorAccessHighlighter extends Highlighter {
Map positionMap= (Map) mapsByAnnotationModel.get(model);
addAnnotations(model, positionMap);
}
-
+
}
private Position createPosition(Match match) throws BadLocationException {
@@ -91,7 +90,7 @@ public class EditorAccessHighlighter extends Highlighter {
if (doc != null) {
position= PositionTracker.convertToCharacterPosition(position, doc);
} else {
- SearchPlugin.log(new Status(IStatus.ERROR, SearchPlugin.getID(), 0, SearchMessages.AnnotationHighlighter_error_noDocument, null));
+ SearchPlugin.log(new Status(IStatus.ERROR, SearchPlugin.getID(), 0, SearchMessages.AnnotationHighlighter_error_noDocument, null));
return null;
}
}
@@ -140,7 +139,7 @@ public class EditorAccessHighlighter extends Highlighter {
}
}
-
+
private void addAnnotations(IAnnotationModel model, Map annotationToPositionMap) {
if (model instanceof IAnnotationModelExtension) {
IAnnotationModelExtension ame= (IAnnotationModelExtension) model;
@@ -153,11 +152,11 @@ public class EditorAccessHighlighter extends Highlighter {
}
}
}
-
+
/*
* Removes annotations from the given annotation model. The default implementation works for editors that
* implement <code>ITextEditor</code>.
- * Subclasses may override this method.
+ * Subclasses may override this method.
* @param annotations A set containing the annotations to be removed.
* @see Annotation
*/
@@ -191,12 +190,12 @@ public class EditorAccessHighlighter extends Highlighter {
if (document != null)
break;
}
-
+
if (document != null && document.equals(textBuffer.getDocument())) {
Match[] matches= new Match[fMatchesToAnnotations.keySet().size()];
fMatchesToAnnotations.keySet().toArray(matches);
removeAll();
- addHighlights(matches);
+ addHighlights(matches);
}
}
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAnnotationManager.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAnnotationManager.java
index a0bb42dd5a4..ad41643a2cd 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAnnotationManager.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/EditorAnnotationManager.java
@@ -25,6 +25,7 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPart;
+
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
@@ -40,25 +41,25 @@ import org.eclipse.search.ui.text.MatchEvent;
import org.eclipse.search.ui.text.RemoveAllEvent;
public class EditorAnnotationManager implements ISearchResultListener {
-
+
private ArrayList fResults;
private IEditorPart fEditor;
private Highlighter fHighlighter; // initialized lazy
-
+
public static final int HIGHLLIGHTER_ANY= 0;
public static final int HIGHLIGHTER_MARKER= 1;
public static final int HIGHLIGHTER_ANNOTATION= 2;
public static final int HIGHLIGHTER_EDITOR_ACCESS= 3;
private static int fgHighlighterType= HIGHLLIGHTER_ANY;
-
-
+
+
public EditorAnnotationManager(IEditorPart editorPart) {
Assert.isNotNull(editorPart);
fEditor= editorPart;
fHighlighter= null; // lazy initialization
fResults= new ArrayList(3);
}
-
+
public static final void debugSetHighlighterType(int type) {
fgHighlighterType= type;
@@ -69,21 +70,21 @@ public class EditorAnnotationManager implements ISearchResultListener {
removeAllAnnotations();
if (fHighlighter != null)
fHighlighter.dispose();
-
+
for (int i= 0; i < fResults.size(); i++) {
((AbstractTextSearchResult) fResults.get(i)).removeListener(this);
}
fResults.clear();
}
-
+
public synchronized void doEditorInputChanged() {
removeAllAnnotations();
-
+
if (fHighlighter != null) {
fHighlighter.dispose();
fHighlighter= null;
}
-
+
for (int i= 0; i < fResults.size(); i++) {
AbstractTextSearchResult curr= (AbstractTextSearchResult) fResults.get(i);
addAnnotations(curr);
@@ -96,24 +97,24 @@ public class EditorAnnotationManager implements ISearchResultListener {
((AbstractTextSearchResult) fResults.get(i)).removeListener(this);
}
fResults.clear();
-
+
for (int i= 0; i < results.size(); i++) {
addSearchResult((AbstractTextSearchResult) results.get(i));
}
}
-
+
public synchronized void addSearchResult(AbstractTextSearchResult result) {
fResults.add(result);
result.addListener(this);
addAnnotations(result);
}
-
+
public synchronized void removeSearchResult(AbstractTextSearchResult result) {
fResults.remove(result);
result.removeListener(this);
removeAnnotations(result);
}
-
+
public synchronized void searchResultChanged(SearchResultEvent e) {
ISearchResult searchResult= e.getSearchResult();
@@ -146,12 +147,12 @@ public class EditorAnnotationManager implements ISearchResultListener {
if (adapter == null) {
return null;
}
-
+
// optimize the array-length == 1 case (most common)
if (matches.length == 1) {
return adapter.isShownInEditor(matches[0], fEditor) ? matches : null;
}
-
+
ArrayList matchesInEditor= null; // lazy initialization
for (int i= 0; i < matches.length; i++) {
Match curr= matches[i];
@@ -197,7 +198,7 @@ public class EditorAnnotationManager implements ISearchResultListener {
if (fgHighlighterType == HIGHLIGHTER_ANNOTATION) {
IAnnotationModel model= getAnnotationModel(editor);
if (model != null)
- return new AnnotationHighlighter(model, getDocument(editor));
+ return new AnnotationHighlighter(model, getDocument(editor));
} else if (fgHighlighterType == HIGHLIGHTER_MARKER) {
IEditorInput input= editor.getEditorInput();
if (input instanceof IFileEditorInput) {
@@ -205,7 +206,7 @@ public class EditorAnnotationManager implements ISearchResultListener {
if (file != null)
return new MarkerHighlighter(file);
}
-
+
} else if (fgHighlighterType == HIGHLIGHTER_EDITOR_ACCESS) {
ISearchEditorAccess access= (ISearchEditorAccess) editor.getAdapter(ISearchEditorAccess.class);
if (access != null)
@@ -223,10 +224,10 @@ public class EditorAnnotationManager implements ISearchResultListener {
return;
addAnnotations(matches);
}
-
+
private void removeAnnotations(AbstractTextSearchResult result) {
removeAllAnnotations();
-
+
for (int i= 0; i < fResults.size(); i++) {
AbstractTextSearchResult curr= (AbstractTextSearchResult) fResults.get(i);
if (curr != result) {
@@ -249,11 +250,11 @@ public class EditorAnnotationManager implements ISearchResultListener {
private static IAnnotationModel getAnnotationModel(IWorkbenchPart part) {
IAnnotationModel model= null;
- model= (IAnnotationModel) part.getAdapter(IAnnotationModel.class);
+ model= (IAnnotationModel) part.getAdapter(IAnnotationModel.class);
if (model == null) {
ITextEditor textEditor= null;
if (part instanceof ITextEditor) {
- textEditor= (ITextEditor) part;
+ textEditor= (ITextEditor) part;
}
if (textEditor != null) {
IDocumentProvider dp= textEditor.getDocumentProvider();
@@ -266,11 +267,11 @@ public class EditorAnnotationManager implements ISearchResultListener {
private static IDocument getDocument(IWorkbenchPart part) {
IDocument doc= null;
- doc= (IDocument) part.getAdapter(IDocument.class);
+ doc= (IDocument) part.getAdapter(IDocument.class);
if (doc == null) {
ITextEditor textEditor= null;
if (part instanceof ITextEditor) {
- textEditor= (ITextEditor) part;
+ textEditor= (ITextEditor) part;
}
if (textEditor != null) {
IDocumentProvider dp= textEditor.getDocumentProvider();
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/Highlighter.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/Highlighter.java
index 7a743873aee..15f61589c9d 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/Highlighter.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/Highlighter.java
@@ -10,10 +10,12 @@
*******************************************************************************/
package org.eclipse.search2.internal.ui.text;
+import org.eclipse.core.runtime.IPath;
+
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.IFileBuffer;
import org.eclipse.core.filebuffers.IFileBufferListener;
-import org.eclipse.core.runtime.IPath;
+
import org.eclipse.search.ui.text.Match;
public class Highlighter {
@@ -54,39 +56,39 @@ public class Highlighter {
};
FileBuffers.getTextFileBufferManager().addFileBufferListener(fBufferListener);
}
-
+
/**
* Adds highlighting for the given matches
- *
+ *
* @param matches the matches to add highlighting
*/
public void addHighlights(Match[] matches) {
}
-
+
/**
* Removes highlighting for the given matches
- *
+ *
* @param matches the matches to remove the highlighting
*/
public void removeHighlights(Match[] matches) {
}
-
+
/**
* Removes all highlighting
*/
public void removeAll() {
}
-
+
/**
* Called when the highlighter is disposed.
*/
public void dispose() {
FileBuffers.getTextFileBufferManager().removeFileBufferListener(fBufferListener);
}
-
+
/**
* Notifies that a buffer has its content changed
- *
+ *
* @param buffer the buffer
*/
protected void handleContentReplaced(IFileBuffer buffer) {
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java
index 47108441f80..b3e2236a178 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/MarkerHighlighter.java
@@ -13,24 +13,29 @@ package org.eclipse.search2.internal.ui.text;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.core.filebuffers.IFileBuffer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.core.filebuffers.IFileBuffer;
+
import org.eclipse.jface.text.Position;
+
import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.search.ui.text.Match;
+
import org.eclipse.search2.internal.ui.InternalSearchUI;
public class MarkerHighlighter extends Highlighter {
private IFile fFile;
private Map fMatchesToAnnotations;
-
+
public MarkerHighlighter(IFile file) {
fFile= file;
fMatchesToAnnotations= new HashMap();
@@ -53,7 +58,7 @@ public class MarkerHighlighter extends Highlighter {
SearchPlugin.log(e.getStatus());
}
}
-
+
private IMarker createMarker(Match match) throws CoreException {
Position position= InternalSearchUI.getInstance().getPositionTracker().getCurrentPosition(match);
if (position == null) {
@@ -64,7 +69,7 @@ public class MarkerHighlighter extends Highlighter {
// need to clone position, can't have it twice in a document.
position= new Position(position.getOffset(), position.getLength());
}
- IMarker marker= match.isFiltered()
+ IMarker marker= match.isFiltered()
? fFile.createMarker(SearchPlugin.FILTERED_SEARCH_MARKER)
: fFile.createMarker(NewSearchUI.SEARCH_MARKER);
HashMap attributes= new HashMap(4);
@@ -77,7 +82,7 @@ public class MarkerHighlighter extends Highlighter {
marker.setAttributes(attributes);
return marker;
}
-
+
public void removeHighlights(Match[] matches) {
for (int i= 0; i < matches.length; i++) {
IMarker marker= (IMarker) fMatchesToAnnotations.remove(matches[i]);
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/PositionTracker.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/PositionTracker.java
index 7359e2d0a0b..76a301bae63 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/PositionTracker.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/PositionTracker.java
@@ -16,6 +16,22 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+import org.eclipse.core.resources.IFile;
+
+import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.filebuffers.IFileBuffer;
+import org.eclipse.core.filebuffers.IFileBufferListener;
+import org.eclipse.core.filebuffers.ITextFileBuffer;
+import org.eclipse.core.filebuffers.LocationKind;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.Position;
+
import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.IQueryListener;
import org.eclipse.search.ui.ISearchQuery;
@@ -29,44 +45,29 @@ import org.eclipse.search.ui.text.Match;
import org.eclipse.search.ui.text.MatchEvent;
import org.eclipse.search.ui.text.RemoveAllEvent;
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.filebuffers.IFileBuffer;
-import org.eclipse.core.filebuffers.IFileBufferListener;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-import org.eclipse.core.filebuffers.LocationKind;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-
public class PositionTracker implements IQueryListener, ISearchResultListener, IFileBufferListener {
private Map fMatchesToPositions= new HashMap();
private Map fMatchesToSearchResults= new HashMap();
private Map fFileBuffersToMatches= new HashMap();
-
+
private interface IFileBufferMatchOperation {
void run(ITextFileBuffer buffer, Match match);
}
-
+
public PositionTracker() {
NewSearchUI.addQueryListener(this);
FileBuffers.getTextFileBufferManager().addFileBufferListener(this);
}
-
+
// tracking search results --------------------------------------------------------------
public void queryAdded(ISearchQuery query) {
if (query.getSearchResult() instanceof AbstractTextSearchResult) {
query.getSearchResult().addListener(this);
}
}
-
+
public void queryRemoved(ISearchQuery query) {
ISearchResult result= query.getSearchResult();
if (result instanceof AbstractTextSearchResult) {
@@ -132,7 +133,7 @@ public class PositionTracker implements IQueryListener, ISearchResultListener, I
int length = match.getLength();
if (offset < 0 || length < 0)
return;
-
+
try {
IDocument doc= fb.getDocument();
Position position= new Position(offset, length);
@@ -152,7 +153,7 @@ public class PositionTracker implements IQueryListener, ISearchResultListener, I
public static Position convertToCharacterPosition(Position linePosition, IDocument doc) throws BadLocationException {
int lineOffset= linePosition.getOffset();
int lineLength= linePosition.getLength();
-
+
int charOffset= doc.getLineOffset(lineOffset);
int charLength= 0;
if (lineLength > 0) {
@@ -180,7 +181,7 @@ public class PositionTracker implements IQueryListener, ISearchResultListener, I
fFileBuffersToMatches.remove(fb);
}
}
-
+
private ITextFileBuffer getTrackedFileBuffer(AbstractTextSearchResult result, Object element) {
IFileMatchAdapter adapter= result.getFileMatchAdapter();
if (adapter == null)
@@ -192,7 +193,7 @@ public class PositionTracker implements IQueryListener, ISearchResultListener, I
return null;
return FileBuffers.getTextFileBufferManager().getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
}
-
+
public Position getCurrentPosition(Match match) {
Position pos= (Position)fMatchesToPositions.get(match);
if (pos == null)
@@ -205,14 +206,14 @@ public class PositionTracker implements IQueryListener, ISearchResultListener, I
try {
pos= convertToLinePosition(pos, doc);
} catch (BadLocationException e) {
-
+
}
}
}
-
+
return pos;
}
-
+
public static Position convertToLinePosition(Position pos, IDocument doc) throws BadLocationException {
int offset= doc.getLineOfOffset(pos.getOffset());
int end= doc.getLineOfOffset(pos.getOffset()+pos.getLength());
@@ -237,7 +238,7 @@ public class PositionTracker implements IQueryListener, ISearchResultListener, I
final int[] trackCount= new int[1];
if (!(buffer instanceof ITextFileBuffer))
return;
-
+
IFile file= FileBuffers.getWorkspaceFileAtLocation(buffer.getLocation());
if (file == null)
return;
@@ -258,7 +259,7 @@ public class PositionTracker implements IQueryListener, ISearchResultListener, I
}
}
}
-
+
private void doForExistingMatchesIn(IFileBuffer buffer, IFileBufferMatchOperation operation) {
if (!(buffer instanceof ITextFileBuffer))
return;
@@ -271,7 +272,7 @@ public class PositionTracker implements IQueryListener, ISearchResultListener, I
}
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.filebuffers.IFileBufferListener#bufferDisposed(org.eclipse.core.filebuffers.IFileBuffer)
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/WindowAnnotationManager.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/WindowAnnotationManager.java
index d747ea3d355..8546012f855 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/WindowAnnotationManager.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text/WindowAnnotationManager.java
@@ -29,13 +29,13 @@ public class WindowAnnotationManager {
private Map fAnnotationManagers;
private IPartListener2 fPartListener;
private ArrayList fSearchResults;
-
+
public WindowAnnotationManager(IWorkbenchWindow window) {
fWindow = window;
fAnnotationManagers = new HashMap();
-
+
fSearchResults= new ArrayList();
-
+
initEditors();
fPartListener= new IPartListener2() {
public void partActivated(IWorkbenchPartReference partRef) {
@@ -69,9 +69,9 @@ public class WindowAnnotationManager {
}
};
fWindow.getPartService().addPartListener(fPartListener);
-
+
}
-
+
private void startHighlighting(IEditorPart editor) {
if (editor == null)
return;
@@ -82,7 +82,7 @@ public class WindowAnnotationManager {
mgr.setSearchResults(fSearchResults);
}
}
-
+
private void updateHighlighting(IEditorPart editor) {
if (editor == null)
return;
@@ -91,7 +91,7 @@ public class WindowAnnotationManager {
mgr.doEditorInputChanged();
}
}
-
+
private void initEditors() {
IWorkbenchPage[] pages= fWindow.getPages();
@@ -140,7 +140,7 @@ public class WindowAnnotationManager {
}
}
}
-
+
void removeSearchResult(AbstractTextSearchResult result) {
fSearchResults.remove(result);
boolean stillShown= fSearchResults.contains(result);
@@ -151,5 +151,5 @@ public class WindowAnnotationManager {
}
}
}
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/DefaultTextSearchQueryProvider.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/DefaultTextSearchQueryProvider.java
index 3d1df24d7a4..ef6c1f4b296 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/DefaultTextSearchQueryProvider.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/DefaultTextSearchQueryProvider.java
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.search2.internal.ui.text2;
@@ -15,12 +15,11 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.ui.IWorkingSet;
+import org.eclipse.search.internal.ui.text.FileSearchQuery;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.text.FileTextSearchScope;
import org.eclipse.search.ui.text.TextSearchQueryProvider;
-import org.eclipse.search.internal.ui.text.FileSearchQuery;
-
public class DefaultTextSearchQueryProvider extends TextSearchQueryProvider {
/* (non-Javadoc)
@@ -41,7 +40,7 @@ public class DefaultTextSearchQueryProvider extends TextSearchQueryProvider {
FileTextSearchScope scope= FileTextSearchScope.newWorkspaceScope(getPreviousFileNamePatterns(), false);
return new FileSearchQuery(searchForString, false, true, scope);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.search.ui.text.TextSearchQueryProvider#createQuery(java.lang.String, org.eclipse.core.resources.IResource[])
*/
@@ -57,9 +56,9 @@ public class DefaultTextSearchQueryProvider extends TextSearchQueryProvider {
FileTextSearchScope scope= FileTextSearchScope.newSearchScope(ws, getPreviousFileNamePatterns(), false);
return new FileSearchQuery(selectedText, false, true, scope);
}
-
+
private String[] getPreviousFileNamePatterns() {
return new String[] { "*" }; //$NON-NLS-1$
}
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInFileActionDelegate.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInFileActionDelegate.java
index 0a34f616042..4376bb04f7a 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInFileActionDelegate.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInFileActionDelegate.java
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.search2.internal.ui.text2;
@@ -33,7 +33,7 @@ import org.eclipse.search2.internal.ui.SearchMessages;
public class FindInFileActionDelegate extends FindInRecentScopeActionDelegate {
private IEditorPart fEditor= null;
-
+
public FindInFileActionDelegate() {
super(SearchMessages.FindInFileActionDelegate_text);
setActionDefinitionId("org.eclipse.search.ui.performTextSearchFile"); //$NON-NLS-1$
@@ -63,7 +63,7 @@ public class FindInFileActionDelegate extends FindInRecentScopeActionDelegate {
super.setActiveEditor(action, editor);
}
-
+
private IFile getFile() {
if (fEditor != null) {
IEditorInput ei= fEditor.getEditorInput();
@@ -77,5 +77,5 @@ public class FindInFileActionDelegate extends FindInRecentScopeActionDelegate {
protected ISearchQuery createQuery(TextSearchQueryProvider provider, String searchForString) throws CoreException {
return provider.createQuery(searchForString, new IResource[] { getFile() });
}
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInProjectActionDelegate.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInProjectActionDelegate.java
index fe786afeb6f..50723529886 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInProjectActionDelegate.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInProjectActionDelegate.java
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.search2.internal.ui.text2;
@@ -78,5 +78,5 @@ public class FindInProjectActionDelegate extends FindInRecentScopeActionDelegate
return provider.createQuery(searchForString, new IResource[] { getCurrentProject() });
}
return provider.createQuery(searchForString);
- }
+ }
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInRecentScopeActionDelegate.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInRecentScopeActionDelegate.java
index 991f01e96aa..8c4f17675d6 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInRecentScopeActionDelegate.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInRecentScopeActionDelegate.java
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.search2.internal.ui.text2;
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInWorkingSetActionDelegate.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInWorkingSetActionDelegate.java
index eb6f5527276..3d0c305338a 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInWorkingSetActionDelegate.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInWorkingSetActionDelegate.java
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.search2.internal.ui.text2;
@@ -33,7 +33,7 @@ public class FindInWorkingSetActionDelegate extends FindInRecentScopeActionDeleg
super(SearchMessages.FindInWorkingSetActionDelegate_text);
setActionDefinitionId("org.eclipse.search.ui.performTextSearchWorkingSet"); //$NON-NLS-1$
}
-
+
protected ISearchQuery createQuery(TextSearchQueryProvider provider, String searchForString) throws CoreException {
IWorkbenchPage page= getWorkbenchPage();
if (page != null) {
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInWorkspaceActionDelegate.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInWorkspaceActionDelegate.java
index 82fcf31a3a5..9da18c7e120 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInWorkspaceActionDelegate.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/FindInWorkspaceActionDelegate.java
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.search2.internal.ui.text2;
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/RetrieverAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/RetrieverAction.java
index 5f28538a14d..405677cebf2 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/RetrieverAction.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/RetrieverAction.java
@@ -1,20 +1,16 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.search2.internal.ui.text2;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.OperationCanceledException;
-
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Point;
@@ -28,6 +24,10 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.OperationCanceledException;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -46,14 +46,14 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.model.IWorkbenchAdapter;
+
import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.search.ui.text.TextSearchQueryProvider;
-import org.eclipse.search.internal.ui.SearchPlugin;
-
import org.eclipse.search2.internal.ui.SearchMessages;
abstract public class RetrieverAction extends Action {
@@ -75,7 +75,7 @@ abstract public class RetrieverAction extends Action {
ISearchQuery query= createQuery(provider, searchForString);
if (query != null) {
NewSearchUI.runQueryInBackground(query);
- }
+ }
} catch (OperationCanceledException ex) {
// action cancelled
} catch (CoreException e) {
@@ -90,7 +90,7 @@ abstract public class RetrieverAction extends Action {
}
return null;
}
-
+
private Shell getShell() {
IWorkbenchPart part= getActivePart();
if (part != null) {
@@ -155,13 +155,13 @@ abstract public class RetrieverAction extends Action {
sel= combo.getText();
Point selection= combo.getSelection();
sel= sel.substring(selection.x, selection.y);
- }
+ }
if (control instanceof CCombo) {
CCombo combo= (CCombo) control;
sel= combo.getText();
Point selection= combo.getSelection();
sel= sel.substring(selection.x, selection.y);
- }
+ }
else if (control instanceof Text) {
Text text= (Text) control;
sel= text.getSelectionText();
@@ -195,7 +195,7 @@ abstract public class RetrieverAction extends Action {
sel= s[0];
}
}
-
+
if (sel != null) {
sel= trimSearchString(sel);
}
@@ -319,5 +319,5 @@ abstract public class RetrieverAction extends Action {
}
return searchFor == null ? "" : searchFor; //$NON-NLS-1$
}
-
+
}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/TextSearchQueryProviderRegistry.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/TextSearchQueryProviderRegistry.java
index 4e79a78fb16..3ade7252bfe 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/TextSearchQueryProviderRegistry.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/TextSearchQueryProviderRegistry.java
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.search2.internal.ui.text2;
@@ -19,10 +19,9 @@ import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.search.ui.text.TextSearchQueryProvider;
-
import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.internal.ui.SearchPreferencePage;
+import org.eclipse.search.ui.text.TextSearchQueryProvider;
import org.eclipse.search2.internal.ui.SearchMessages;
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java
index e75b5ab87ba..1b80bbef98c 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java
@@ -22,15 +22,15 @@ import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.resources.IFile;
/**
- *
+ *
*/
public class FileCharSequenceProvider {
-
+
private static int NUMBER_OF_BUFFERS= 3;
public static int BUFFER_SIZE= 2 << 18; // public for testing
-
+
private FileCharSequence fReused= null;
-
+
public CharSequence newCharSequence(IFile file) throws CoreException, IOException {
if (fReused == null) {
return new FileCharSequence(file);
@@ -40,7 +40,7 @@ public class FileCharSequenceProvider {
curr.reset(file);
return curr;
}
-
+
public void releaseCharSequence(CharSequence seq) throws IOException {
if (seq instanceof FileCharSequence) {
FileCharSequence curr= (FileCharSequence) seq;
@@ -53,18 +53,18 @@ public class FileCharSequenceProvider {
}
}
}
-
+
public static class FileCharSequenceException extends RuntimeException {
private static final long serialVersionUID= 1L;
/* package */ FileCharSequenceException(IOException e) {
super(e);
}
-
+
/* package */ FileCharSequenceException(CoreException e) {
super(e);
}
-
+
public void throwWrappedException() throws CoreException, IOException {
Throwable wrapped= getCause();
if (wrapped instanceof CoreException) {
@@ -75,14 +75,14 @@ public class FileCharSequenceProvider {
// not possible
}
}
-
-
+
+
private static final class CharSubSequence implements CharSequence {
-
+
private final int fSequenceOffset;
private final int fSequenceLength;
private final FileCharSequence fParent;
-
+
public CharSubSequence(FileCharSequence parent, int offset, int length) {
fParent= parent;
fSequenceOffset= offset;
@@ -124,7 +124,7 @@ public class FileCharSequenceProvider {
}
return fParent.subSequence(fSequenceOffset + start, fSequenceOffset + end);
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@@ -132,14 +132,14 @@ public class FileCharSequenceProvider {
try {
return fParent.getSubstring(fSequenceOffset, fSequenceLength);
} catch (IOException e) {
- throw new FileCharSequenceException(e);
+ throw new FileCharSequenceException(e);
} catch (CoreException e) {
- throw new FileCharSequenceException(e);
+ throw new FileCharSequenceException(e);
}
}
}
-
-
+
+
private static final class Buffer {
private final char[] fBuf;
private int fOffset;
@@ -147,19 +147,19 @@ public class FileCharSequenceProvider {
private Buffer fNext;
private Buffer fPrevious;
-
+
public Buffer() {
fBuf= new char[BUFFER_SIZE];
reset();
fNext= this;
fPrevious= this;
}
-
+
public boolean contains(int pos) {
int offset= fOffset;
return offset <= pos && pos < offset + fLength;
}
-
+
/**
* Fills the buffer by reading from the given reader.
* @param reader the reader to read from
@@ -174,7 +174,7 @@ public class FileCharSequenceProvider {
fLength= 0;
return true;
}
-
+
int charsRead= res;
while (charsRead < BUFFER_SIZE) {
res= reader.read(fBuf, charsRead, BUFFER_SIZE - charsRead);
@@ -189,38 +189,38 @@ public class FileCharSequenceProvider {
fLength= BUFFER_SIZE;
return false;
}
-
+
public char get(int pos) {
return fBuf[pos - fOffset];
}
-
+
public StringBuffer append(StringBuffer buf, int start, int length) {
return buf.append(fBuf, start - fOffset, length);
}
-
+
public StringBuffer appendAll(StringBuffer buf) {
return buf.append(fBuf, 0, fLength);
}
-
+
public int getEndOffset() {
return fOffset + fLength;
}
-
+
public void removeFromChain() {
fPrevious.fNext= fNext;
fNext.fPrevious= fPrevious;
-
+
fNext= this;
fPrevious= this;
}
-
+
public void insertBefore(Buffer other) {
fNext= other;
fPrevious= other.fPrevious;
fPrevious.fNext= this;
other.fPrevious= this;
}
-
+
public Buffer getNext() {
return fNext;
}
@@ -234,30 +234,30 @@ public class FileCharSequenceProvider {
fLength= 0;
}
}
-
+
private final class FileCharSequence implements CharSequence {
-
+
private static final String CHARSET_UTF_8= "UTF-8"; //$NON-NLS-1$
-
+
private Reader fReader;
private int fReaderPos;
-
+
private Integer fLength;
-
+
private Buffer fMostCurrentBuffer; // access to the buffer chain
private int fNumberOfBuffers;
-
+
private IFile fFile;
-
+
public FileCharSequence(IFile file) throws CoreException, IOException {
fNumberOfBuffers= 0;
reset(file);
}
-
+
public void reset(IFile file) throws CoreException, IOException {
fFile= file;
fLength= null; // only calculated on demand
-
+
Buffer curr= fMostCurrentBuffer;
if (curr != null) {
do {
@@ -267,7 +267,7 @@ public class FileCharSequenceProvider {
}
initializeReader();
}
-
+
private void initializeReader() throws CoreException, IOException {
if (fReader != null) {
fReader.close();
@@ -276,7 +276,7 @@ public class FileCharSequenceProvider {
fReader= new InputStreamReader(getInputStream(charset), charset);
fReaderPos= 0;
}
-
+
private InputStream getInputStream(String charset) throws CoreException, IOException {
boolean ok= false;
InputStream contents= fFile.getContents();
@@ -298,7 +298,7 @@ public class FileCharSequenceProvider {
throw new IOException();
bytesRead += bytes;
} while (bytesRead < bomLength);
-
+
if (!Arrays.equals(bomStore, IContentDescription.BOM_UTF_8)) {
// discard file reader, we were wrong, no BOM -> new stream
contents.close();
@@ -317,7 +317,7 @@ public class FileCharSequenceProvider {
}
return contents;
}
-
+
private void clearReader() throws IOException {
if (fReader != null) {
fReader.close();
@@ -325,7 +325,7 @@ public class FileCharSequenceProvider {
fReader= null;
fReaderPos= Integer.MAX_VALUE;
}
-
+
/* (non-Javadoc)
* @see java.lang.CharSequence#length()
*/
@@ -334,14 +334,14 @@ public class FileCharSequenceProvider {
try {
getBuffer(Integer.MAX_VALUE);
} catch (IOException e) {
- throw new FileCharSequenceException(e);
+ throw new FileCharSequenceException(e);
} catch (CoreException e) {
- throw new FileCharSequenceException(e);
+ throw new FileCharSequenceException(e);
}
}
return fLength.intValue();
}
-
+
private Buffer getBuffer(int pos) throws IOException, CoreException {
Buffer curr= fMostCurrentBuffer;
if (curr != null) {
@@ -352,7 +352,7 @@ public class FileCharSequenceProvider {
curr= curr.getNext();
} while (curr != fMostCurrentBuffer);
}
-
+
Buffer buf= findBufferToUse();
fillBuffer(buf, pos);
if (buf.contains(pos)) {
@@ -360,7 +360,7 @@ public class FileCharSequenceProvider {
}
return null;
}
-
+
private Buffer findBufferToUse() {
if (fNumberOfBuffers < NUMBER_OF_BUFFERS) {
fNumberOfBuffers++;
@@ -374,12 +374,12 @@ public class FileCharSequenceProvider {
}
return fMostCurrentBuffer.getPrevious();
}
-
+
private boolean fillBuffer(Buffer buffer, int pos) throws CoreException, IOException {
if (fReaderPos > pos) {
initializeReader();
}
-
+
do {
boolean endReached= buffer.fill(fReader, fReaderPos);
fReaderPos= buffer.getEndOffset();
@@ -389,10 +389,10 @@ public class FileCharSequenceProvider {
return true;
}
} while (fReaderPos <= pos);
-
+
return true;
}
-
+
/* (non-Javadoc)
* @see java.lang.CharSequence#charAt(int)
*/
@@ -401,14 +401,14 @@ public class FileCharSequenceProvider {
if (current != null && current.contains(index)) {
return current.get(index);
}
-
+
if (index < 0) {
throw new IndexOutOfBoundsException("index must be larger than 0"); //$NON-NLS-1$
}
if (fLength != null && index >= fLength.intValue()) {
throw new IndexOutOfBoundsException("index must be smaller than length"); //$NON-NLS-1$
}
-
+
try {
final Buffer buffer= getBuffer(index);
if (buffer == null) {
@@ -424,22 +424,22 @@ public class FileCharSequenceProvider {
}
return buffer.get(index);
} catch (IOException e) {
- throw new FileCharSequenceException(e);
+ throw new FileCharSequenceException(e);
} catch (CoreException e) {
- throw new FileCharSequenceException(e);
+ throw new FileCharSequenceException(e);
}
}
-
+
public String getSubstring(int start, int length) throws IOException, CoreException {
int pos= start;
int endPos= start + length;
-
+
if (fLength != null && endPos > fLength.intValue()) {
throw new IndexOutOfBoundsException("end must be smaller than length"); //$NON-NLS-1$
}
-
+
StringBuffer res= new StringBuffer(length);
-
+
Buffer buffer= getBuffer(pos);
while (pos < endPos && buffer != null) {
int bufEnd= buffer.getEndOffset();
@@ -452,8 +452,8 @@ public class FileCharSequenceProvider {
}
return res.toString();
}
-
-
+
+
/* (non-Javadoc)
* @see java.lang.CharSequence#subSequence(int, int)
*/
@@ -469,11 +469,11 @@ public class FileCharSequenceProvider {
}
return new CharSubSequence(this, start, end - start);
}
-
+
public void close() throws IOException {
clearReader();
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@@ -488,9 +488,9 @@ public class FileCharSequenceProvider {
}
return res.toString();
} catch (IOException e) {
- throw new FileCharSequenceException(e);
+ throw new FileCharSequenceException(e);
} catch (CoreException e) {
- throw new FileCharSequenceException(e);
+ throw new FileCharSequenceException(e);
}
}
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileNamePatternSearchScope.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileNamePatternSearchScope.java
index 46fdb9d8e63..e55bc7b45b8 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileNamePatternSearchScope.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileNamePatternSearchScope.java
@@ -24,7 +24,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceProxy;
-
import org.eclipse.search.core.text.TextSearchScope;
public class FileNamePatternSearchScope extends TextSearchScope {
@@ -39,15 +38,15 @@ public class FileNamePatternSearchScope extends TextSearchScope {
public static FileNamePatternSearchScope newSearchScope(String description, IResource[] resources, boolean includeDerived) {
return new FileNamePatternSearchScope(description, removeRedundantEntries(resources, includeDerived), includeDerived);
}
-
+
private static final boolean IS_CASE_SENSITIVE_FILESYSTEM = !new File("Temp").equals(new File("temp")); //$NON-NLS-1$ //$NON-NLS-2$
-
+
private final String fDescription;
private final IResource[] fRootElements;
-
+
private final Set fFileNamePatterns;
private Matcher fFileNameMatcher;
-
+
private boolean fVisitDerived;
private FileNamePatternSearchScope(String description, IResource[] resources, boolean visitDerived) {
@@ -58,7 +57,7 @@ public class FileNamePatternSearchScope extends TextSearchScope {
fFileNameMatcher= null;
fVisitDerived= visitDerived;
}
-
+
/**
* Returns the description of the scope
* @return the description of the scope
@@ -66,7 +65,7 @@ public class FileNamePatternSearchScope extends TextSearchScope {
public String getDescription() {
return fDescription;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.search.core.text.FileSearchScope#getRoots()
*/
@@ -81,13 +80,13 @@ public class FileNamePatternSearchScope extends TextSearchScope {
if (!fVisitDerived && proxy.isDerived()) {
return false; // all resources in a derived folder are considered to be derived, see bug 103576
}
-
+
if (proxy.getType() == IResource.FILE) {
return matchesFileName(proxy.getName());
}
return true;
}
-
+
/**
* Adds an file name pattern to the scope.
* @param pattern
@@ -97,25 +96,25 @@ public class FileNamePatternSearchScope extends TextSearchScope {
fFileNameMatcher= null; // clear cache
}
}
-
+
public void setFileNamePattern(Pattern pattern) {
fFileNameMatcher= pattern.matcher(""); //$NON-NLS-1$
}
-
-
+
+
public Pattern getFileNamePattern() {
return getFileNameMatcher().pattern();
}
-
+
/**
* Returns if derived resources are included in the scope.
- *
+ *
* @return if set derived resources are included in the scope.
*/
public boolean isIncludeDerived() {
return fVisitDerived;
}
-
+
private Matcher getFileNameMatcher() {
if (fFileNameMatcher == null) {
@@ -130,7 +129,7 @@ public class FileNamePatternSearchScope extends TextSearchScope {
}
return fFileNameMatcher;
}
-
+
/**
* Tests if a file name matches to the file name patterns contained in the scope
* @param fileName The file name to test
@@ -139,7 +138,7 @@ public class FileNamePatternSearchScope extends TextSearchScope {
private boolean matchesFileName(String fileName) {
return getFileNameMatcher().reset(fileName).matches();
}
-
+
/**
* Returns a description for the file name patterns in the scope
* @return the description of the scope
@@ -157,7 +156,7 @@ public class FileNamePatternSearchScope extends TextSearchScope {
return buf.toString();
}
-
+
private static IResource[] removeRedundantEntries(IResource[] elements, boolean includeDerived) {
ArrayList res= new ArrayList();
for (int i= 0; i < elements.length; i++) {
@@ -166,7 +165,7 @@ public class FileNamePatternSearchScope extends TextSearchScope {
}
return (IResource[])res.toArray(new IResource[res.size()]);
}
-
+
private static void addToList(ArrayList res, IResource curr, boolean includeDerived) {
if (!includeDerived && isDerived(curr)) {
return;
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FilesOfScopeCalculator.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FilesOfScopeCalculator.java
index f4b9f712da9..eadbdcb0def 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FilesOfScopeCalculator.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FilesOfScopeCalculator.java
@@ -33,7 +33,7 @@ public class FilesOfScopeCalculator implements IResourceProxyVisitor {
fStatus= status;
}
- public boolean visit(IResourceProxy proxy) {
+ public boolean visit(IResourceProxy proxy) {
boolean inScope= fScope.contains(proxy);
if (inScope && proxy.getType() == IResource.FILE) {
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/PatternConstructor.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/PatternConstructor.java
index 604b18ab4a2..d2c52d1e531 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/PatternConstructor.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/PatternConstructor.java
@@ -21,12 +21,12 @@ import org.eclipse.search.internal.ui.SearchMessages;
*
*/
public class PatternConstructor {
-
+
private PatternConstructor() {
// don't instantiate
}
-
+
public static Pattern createPattern(String pattern, boolean isCaseSensitive, boolean isRegex) throws PatternSyntaxException {
return createPattern(pattern, isRegex, true, isCaseSensitive, false);
}
@@ -71,9 +71,9 @@ public class PatternConstructor {
}
return Pattern.compile(pattern, regexOptions);
}
-
+
/**
- * Copied from {@link org.eclipse.jface.text.FindReplaceDocumentAdapter}' to support '\R'
+ * Copied from {@link org.eclipse.jface.text.FindReplaceDocumentAdapter}' to support '\R'
* @param findString the string to substitute
* @return the new string
* @throws PatternSyntaxException
@@ -81,7 +81,7 @@ public class PatternConstructor {
private static String substituteLinebreak(String findString) throws PatternSyntaxException {
int length= findString.length();
StringBuffer buf= new StringBuffer(length);
-
+
int inCharGroup= 0;
int inBraces= 0;
boolean inQuote= false;
@@ -93,25 +93,25 @@ public class PatternConstructor {
if (! inQuote)
inCharGroup++;
break;
-
+
case ']':
buf.append(ch);
if (! inQuote)
inCharGroup--;
break;
-
+
case '{':
buf.append(ch);
if (! inQuote && inCharGroup == 0)
inBraces++;
break;
-
+
case '}':
buf.append(ch);
if (! inQuote && inCharGroup == 0)
inBraces--;
break;
-
+
case '\\':
if (i + 1 < length) {
char ch1= findString.charAt(i + 1);
@@ -120,7 +120,7 @@ public class PatternConstructor {
inQuote= false;
buf.append(ch).append(ch1);
i++;
-
+
} else if (ch1 == 'R') {
if (inCharGroup > 0 || inBraces > 0) {
String msg= SearchMessages.PatternConstructor_error_line_delim_position;
@@ -128,7 +128,7 @@ public class PatternConstructor {
}
buf.append("(?>\\r\\n?|\\n)"); //$NON-NLS-1$
i++;
-
+
} else {
if (ch1 == 'Q') {
inQuote= true;
@@ -140,17 +140,17 @@ public class PatternConstructor {
buf.append(ch);
}
break;
-
+
default:
buf.append(ch);
break;
}
-
+
}
return buf.toString();
}
-
+
private static boolean isWordChar(char c) {
return Character.isLetterOrDigit(c);
}
@@ -175,8 +175,8 @@ public class PatternConstructor {
}
return createPattern(pattern.toString(), true, true, isCaseSensitive, false);
}
-
-
+
+
public static StringBuffer appendAsRegEx(boolean isStringMatcher, String pattern, StringBuffer buffer) {
boolean isEscaped= false;
for (int i = 0; i < pattern.length(); i++) {
@@ -247,10 +247,10 @@ public class PatternConstructor {
}
return buffer;
}
-
+
/**
* Interprets escaped characters in the given replace pattern.
- *
+ *
* @param replaceText the replace pattern
* @param foundText the found pattern to be replaced
* @param lineDelim the line delimiter to use for \R
@@ -260,33 +260,33 @@ public class PatternConstructor {
public static String interpretReplaceEscapes(String replaceText, String foundText, String lineDelim) {
return new ReplaceStringConstructor(lineDelim).interpretReplaceEscapes(replaceText, foundText);
}
-
+
/**
* Copied from {@link FindReplaceDocumentAdapter}}
- *
+ *
* FindReplaceDocumentAdapter with contributions from:
* Cagatay Calli <ccalli@gmail.com> - [find/replace] retain caps when replacing - https://bugs.eclipse.org/bugs/show_bug.cgi?id=28949
* Cagatay Calli <ccalli@gmail.com> - [find/replace] define & fix behavior of retain caps with other escapes and text before \C - https://bugs.eclipse.org/bugs/show_bug.cgi?id=217061
*/
private static class ReplaceStringConstructor {
-
+
private static final int RC_MIXED= 0;
private static final int RC_UPPER= 1;
private static final int RC_LOWER= 2;
private static final int RC_FIRSTUPPER= 3;
-
-
+
+
private int fRetainCaseMode;
private final String fLineDelim;
-
+
public ReplaceStringConstructor(String lineDelim) {
fLineDelim= lineDelim;
-
+
}
-
+
/**
* Interprets escaped characters in the given replace pattern.
- *
+ *
* @param replaceText the replace pattern
* @param foundText the found pattern to be replaced
* @return a replace pattern with escaped characters substituted by the respective characters
@@ -296,21 +296,21 @@ public class PatternConstructor {
int length= replaceText.length();
boolean inEscape= false;
StringBuffer buf= new StringBuffer(length);
-
+
/* every string we did not check looks mixed at first
* so initialize retain case mode with RC_MIXED
*/
fRetainCaseMode= RC_MIXED;
-
+
for (int i= 0; i < length; i++) {
final char ch= replaceText.charAt(i);
if (inEscape) {
i= interpretReplaceEscape(ch, i, buf, replaceText, foundText);
inEscape= false;
-
+
} else if (ch == '\\') {
inEscape= true;
-
+
} else if (ch == '$') {
buf.append(ch);
@@ -336,7 +336,7 @@ public class PatternConstructor {
interpretRetainCase(buf, ch);
}
}
-
+
if (inEscape) {
// '\' as last character is invalid, but we still add it to get an error message
buf.append('\\');
@@ -347,7 +347,7 @@ public class PatternConstructor {
/**
* Interprets the escaped character <code>ch</code> at offset <code>i</code>
* of the <code>replaceText</code> and appends the interpretation to <code>buf</code>.
- *
+ *
* @param ch the escaped character
* @param i the offset
* @param buf the output buffer
@@ -397,7 +397,7 @@ public class PatternConstructor {
}
}
break;
-
+
case '1':
case '2':
case '3':
@@ -416,11 +416,11 @@ public class PatternConstructor {
interpretRetainCase(buf, (char)(ch1 ^ 64));
i++;
} else {
- String msg= SearchMessages.PatternConstructor_error_escape_sequence;
+ String msg= SearchMessages.PatternConstructor_error_escape_sequence;
throw new PatternSyntaxException(msg, replaceText, i);
}
break;
-
+
case 'x':
if (i + 2 < length) {
int parsedInt;
@@ -429,17 +429,17 @@ public class PatternConstructor {
if (parsedInt < 0)
throw new NumberFormatException();
} catch (NumberFormatException e) {
- String msg= SearchMessages.PatternConstructor_error_hex_escape_sequence;
+ String msg= SearchMessages.PatternConstructor_error_hex_escape_sequence;
throw new PatternSyntaxException(msg, replaceText, i);
}
interpretRetainCase(buf, (char) parsedInt);
i+= 2;
} else {
- String msg= SearchMessages.PatternConstructor_error_hex_escape_sequence;
+ String msg= SearchMessages.PatternConstructor_error_hex_escape_sequence;
throw new PatternSyntaxException(msg, replaceText, i);
}
break;
-
+
case 'u':
if (i + 4 < length) {
int parsedInt;
@@ -448,17 +448,17 @@ public class PatternConstructor {
if (parsedInt < 0)
throw new NumberFormatException();
} catch (NumberFormatException e) {
- String msg= SearchMessages.PatternConstructor_error_unicode_escape_sequence;
+ String msg= SearchMessages.PatternConstructor_error_unicode_escape_sequence;
throw new PatternSyntaxException(msg, replaceText, i);
}
interpretRetainCase(buf, (char) parsedInt);
i+= 4;
} else {
- String msg= SearchMessages.PatternConstructor_error_unicode_escape_sequence;
+ String msg= SearchMessages.PatternConstructor_error_unicode_escape_sequence;
throw new PatternSyntaxException(msg, replaceText, i);
}
break;
-
+
case 'C':
if(foundText.toUpperCase().equals(foundText)) // is whole match upper-case?
fRetainCaseMode= RC_UPPER;
@@ -481,7 +481,7 @@ public class PatternConstructor {
/**
* Interprets current Retain Case mode (all upper-case,all lower-case,capitalized or mixed)
* and appends the character <code>ch</code> to <code>buf</code> after processing.
- *
+ *
* @param buf the output buffer
* @param ch the character to process
* @since 3.4
@@ -497,6 +497,6 @@ public class PatternConstructor {
} else
buf.append(ch);
}
-
+
}
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngineRegistry.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngineRegistry.java
index 4ff98c9249c..1e82f05f502 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngineRegistry.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchEngineRegistry.java
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Markus Schorn - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.search.internal.core.text;
@@ -20,7 +20,6 @@ import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.search.core.text.TextSearchEngine;
-
import org.eclipse.search.internal.ui.SearchMessages;
import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.internal.ui.SearchPreferencePage;
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
index 11b460a335e..e4224326262 100644
--- 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
@@ -64,29 +64,29 @@ import org.eclipse.search.ui.NewSearchUI;
* The visitor that does the actual work.
*/
public class TextSearchVisitor {
-
+
public static class ReusableMatchAccess extends TextSearchMatchAccess {
-
+
private int fOffset;
private int fLength;
private IFile fFile;
private CharSequence fContent;
-
+
public void initialize(IFile file, int offset, int length, CharSequence content) {
fFile= file;
fOffset= offset;
fLength= length;
fContent= content;
}
-
+
public IFile getFile() {
return fFile;
}
-
+
public int getMatchOffset() {
return fOffset;
}
-
+
public int getMatchLength() {
return fLength;
}
@@ -103,11 +103,11 @@ public class TextSearchVisitor {
return fContent.subSequence(offset, offset + length).toString(); // must pass a copy!
}
}
-
+
private final TextSearchRequestor fCollector;
private final Matcher fMatcher;
-
+
private IProgressMonitor fProgressMonitor;
private int fNumberOfScannedFiles;
@@ -115,30 +115,30 @@ public class TextSearchVisitor {
private IFile fCurrentFile;
private final MultiStatus fStatus;
-
+
private final FileCharSequenceProvider fFileCharSequenceProvider;
-
+
private final ReusableMatchAccess fMatchAccess;
-
+
public TextSearchVisitor(TextSearchRequestor collector, Pattern searchPattern) {
fCollector= collector;
fStatus= new MultiStatus(NewSearchUI.PLUGIN_ID, IStatus.OK, SearchMessages.TextSearchEngine_statusMessage, null);
-
+
fMatcher= searchPattern.pattern().length() == 0 ? null : searchPattern.matcher(new String());
-
+
fFileCharSequenceProvider= new FileCharSequenceProvider();
fMatchAccess= new ReusableMatchAccess();
}
-
+
public IStatus search(IFile[] files, IProgressMonitor monitor) {
fProgressMonitor= monitor == null ? new NullProgressMonitor() : monitor;
fNumberOfScannedFiles= 0;
fNumberOfFilesToScan= files.length;
fCurrentFile= null;
-
+
Job monitorUpdateJob= new Job(SearchMessages.TextSearchVisitor_progress_updating_job) {
private int fLastNumberOfScannedFiles= 0;
-
+
public IStatus run(IProgressMonitor inner) {
while (!inner.isCanceled()) {
IFile file= fCurrentFile;
@@ -177,18 +177,18 @@ public class TextSearchVisitor {
fCollector.endReporting();
}
}
-
+
public IStatus search(TextSearchScope scope, IProgressMonitor monitor) {
return search(scope.evaluateFilesInScope(fStatus), monitor);
}
-
+
private void processFiles(IFile[] files) {
final Map documentsInEditors;
if (PlatformUI.isWorkbenchRunning())
documentsInEditors= evalNonFileBufferDocuments();
else
documentsInEditors= Collections.EMPTY_MAP;
-
+
for (int i= 0; i < files.length; i++) {
fCurrentFile= files[i];
boolean res= processFile(fCurrentFile, documentsInEditors);
@@ -196,7 +196,7 @@ public class TextSearchVisitor {
break;
}
}
-
+
/**
* @return returns a map from IFile to IDocument for all open, dirty editors
*/
@@ -245,9 +245,9 @@ public class TextSearchVisitor {
if (!fCollector.acceptFile(file) || fMatcher == null) {
return true;
}
-
+
IDocument document= getOpenDocument(file, documentsInEditors);
-
+
if (document != null) {
DocumentCharSequence documentCharSequence= new DocumentCharSequence(document);
// assume all documents are non-binary
@@ -297,10 +297,10 @@ public class TextSearchVisitor {
}
if (fProgressMonitor.isCanceled())
throw new OperationCanceledException(SearchMessages.TextSearchVisitor_canceled);
-
+
return true;
}
-
+
private boolean hasBinaryContent(CharSequence seq, IFile file) throws CoreException {
IContentDescription desc= file.getContentDescription();
if (desc != null) {
@@ -309,7 +309,7 @@ public class TextSearchVisitor {
return false;
}
}
-
+
// avoid calling seq.length() at it runs through the complete file,
// thus it would do so for all binary files.
try {
@@ -349,8 +349,8 @@ public class TextSearchVisitor {
fMatchAccess.initialize(null, 0, 0, new String()); // clear references
}
}
-
-
+
+
private String getExceptionMessage(Exception e) {
String message= e.getLocalizedMessage();
if (message == null) {
@@ -370,7 +370,7 @@ public class TextSearchVisitor {
}
return document;
}
-
+
private String getCharSetName(IFile file) {
try {
return file.getCharset();
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
index 2d004844f6f..e04b6d8f524 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/CopyToClipboardAction.java
@@ -13,8 +13,6 @@ package org.eclipse.search.internal.ui;
import java.util.Collections;
import java.util.Iterator;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.swt.SWTError;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.DND;
@@ -26,6 +24,8 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.core.runtime.Assert;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ILabelProvider;
@@ -39,15 +39,15 @@ import org.eclipse.ui.PlatformUI;
public class CopyToClipboardAction extends Action {
private StructuredViewer fViewer;
-
+
public CopyToClipboardAction(StructuredViewer viewer) {
this();
Assert.isNotNull(viewer);
fViewer= viewer;
}
-
+
public CopyToClipboardAction() {
- setText(SearchMessages.CopyToClipboardAction_label);
+ setText(SearchMessages.CopyToClipboardAction_label);
setToolTipText(SearchMessages.CopyToClipboardAction_tooltip);
ISharedImages workbenchImages= PlatformUI.getWorkbench().getSharedImages();
setDisabledImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
@@ -55,7 +55,7 @@ public class CopyToClipboardAction extends Action {
setHoverImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
}
-
+
/**
* @param viewer The viewer to set.
*/
@@ -64,7 +64,7 @@ public class CopyToClipboardAction extends Action {
}
public void runWithEvent(Event event) {
- // bugzilla 126062: allow combos and text fields of the view to fill
+ // bugzilla 126062: allow combos and text fields of the view to fill
// the clipboard
Shell shell= SearchPlugin.getActiveWorkbenchShell();
if (shell != null) {
@@ -74,7 +74,7 @@ public class CopyToClipboardAction extends Action {
sel= combo.getText();
Point selection= combo.getSelection();
sel= sel.substring(selection.x, selection.y);
- }
+ }
else if (event.widget instanceof Text) {
Text text= (Text) event.widget;
sel= text.getSelectionText();
@@ -89,10 +89,10 @@ public class CopyToClipboardAction extends Action {
run();
}
-
+
/*
* Implements method from IAction
- */
+ */
public void run() {
Shell shell= SearchPlugin.getActiveWorkbenchShell();
if (shell == null || fViewer == null)
@@ -108,7 +108,7 @@ public class CopyToClipboardAction extends Action {
}
buf.append(labelProvider.getText(iter.next()));
}
-
+
if (buf.length() > 0) {
copyToClipboard(buf.toString(), shell);
}
@@ -132,14 +132,14 @@ public class CopyToClipboardAction extends Action {
private void copyToClipboard(Clipboard clipboard, String str, Shell shell) {
try {
- clipboard.setContents(new String[] { str }, new Transfer[] { TextTransfer.getInstance() });
+ 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.CopyToClipboardAction_error_title;
- String message= SearchMessages.CopyToClipboardAction_error_message;
+ String title= SearchMessages.CopyToClipboardAction_error_title;
+ String message= SearchMessages.CopyToClipboardAction_error_message;
if (MessageDialog.openQuestion(shell, title, message))
copyToClipboard(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
index 808ed27f9a3..5775328a944 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/GotoMarkerAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/GotoMarkerAction.java
@@ -16,16 +16,16 @@ import org.eclipse.jface.action.Action;
* @deprecated old search
*/
class GotoMarkerAction extends Action {
-
+
private SearchResultViewer fViewer;
public GotoMarkerAction(SearchResultViewer viewer) {
- super(SearchMessages.SearchResultView_gotoMarker_text);
+ super(SearchMessages.SearchResultView_gotoMarker_text);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_GOTO);
- setToolTipText(SearchMessages.SearchResultView_gotoMarker_tooltip);
+ setToolTipText(SearchMessages.SearchResultView_gotoMarker_tooltip);
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
index c374e4a0f90..4ff6a728d41 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java
@@ -13,7 +13,7 @@ package org.eclipse.search.internal.ui;
import org.eclipse.search.ui.NewSearchUI;
public interface ISearchHelpContextIds {
-
+
public static final String PREFIX= NewSearchUI.PLUGIN_ID + "."; //$NON-NLS-1$
public static final String SEARCH_DIALOG= PREFIX + "search_dialog_context"; //$NON-NLS-1$
@@ -23,14 +23,14 @@ public interface ISearchHelpContextIds {
public static final String SEARCH_VIEW= PREFIX + "search_view_context"; //$NON-NLS-1$
public static final String New_SEARCH_VIEW= PREFIX + "new_search_view_context"; //$NON-NLS-1$
-
+
public static final String REPLACE_DIALOG= PREFIX + "replace_dialog_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/Messages.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/Messages.java
index 7b1a633d512..40aaef9ca34 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/Messages.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/Messages.java
@@ -14,7 +14,7 @@ import com.ibm.icu.text.MessageFormat;
/**
* Helper class to format message strings.
- *
+ *
* @since 3.1
*/
public class Messages {
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
index 4d423713202..55c6f22c7a7 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenFileSearchPageAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenFileSearchPageAction.java
@@ -12,12 +12,15 @@ 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.search.ui.NewSearchUI;
+
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.search.ui.NewSearchUI;
+
/**
* Opens the Search Dialog.
*/
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
index b3219785cec..6ad5d385d9f 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogAction.java
@@ -26,9 +26,9 @@ public class OpenSearchDialogAction extends Action implements IWorkbenchWindowAc
private String fPageId;
public OpenSearchDialogAction() {
- super(SearchMessages.OpenSearchDialogAction_label);
+ super(SearchMessages.OpenSearchDialogAction_label);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_TOOL, SearchPluginImages.IMG_TOOL_SEARCH);
- setToolTipText(SearchMessages.OpenSearchDialogAction_tooltip);
+ setToolTipText(SearchMessages.OpenSearchDialogAction_tooltip);
}
public OpenSearchDialogAction(IWorkbenchWindow window, String pageId) {
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogPageAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogPageAction.java
index a720102b73b..39541105f91 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogPageAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/OpenSearchDialogPageAction.java
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2006 Klaus Wenger, Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Klaus Wenger - initial API and implementation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Klaus Wenger - initial API and implementation
* Markus Schorn - cleanup and conversion to inner part of the search plugin.
*******************************************************************************/
@@ -29,7 +29,7 @@ import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
import org.eclipse.ui.activities.WorkbenchActivityHelper;
public class OpenSearchDialogPageAction implements IWorkbenchWindowPulldownDelegate2 {
-
+
private IWorkbenchWindow fWorkbenchWindow;
private Menu fMenu;
private OpenSearchDialogAction fOpenSearchDialogAction;
@@ -42,7 +42,7 @@ public class OpenSearchDialogPageAction implements IWorkbenchWindowPulldownDeleg
fillMenu(fMenu);
return fMenu;
}
-
+
/*
* @see org.eclipse.ui.IWorkbenchWindowPulldownDelegate#getMenu(org.eclipse.swt.widgets.Control)
*/
@@ -51,7 +51,7 @@ public class OpenSearchDialogPageAction implements IWorkbenchWindowPulldownDeleg
fillMenu(fMenu);
return fMenu;
}
-
+
/*
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
*/
@@ -61,14 +61,14 @@ public class OpenSearchDialogPageAction implements IWorkbenchWindowPulldownDeleg
fOpenSearchDialogAction.dispose();
}
}
-
+
/*
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
*/
public void init(IWorkbenchWindow window) {
fWorkbenchWindow= window;
}
-
+
/*
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@@ -78,14 +78,14 @@ public class OpenSearchDialogPageAction implements IWorkbenchWindowPulldownDeleg
}
fOpenSearchDialogAction.run(action);
}
-
+
/*
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IAction action, ISelection sel) {
// Empty
}
-
+
protected void fillMenu(Menu localMenu) {
List pageDescriptors= SearchPlugin.getDefault().getSearchPageDescriptors();
int accelerator= 1;
@@ -97,7 +97,7 @@ public class OpenSearchDialogPageAction implements IWorkbenchWindowPulldownDeleg
}
}
}
-
+
protected void addToMenu(Menu localMenu, IAction action, int accelerator) {
StringBuffer label= new StringBuffer();
if (accelerator >= 0 && accelerator < 10) {
@@ -114,7 +114,7 @@ public class OpenSearchDialogPageAction implements IWorkbenchWindowPulldownDeleg
private static final class SearchPageAction extends Action {
private final OpenSearchDialogAction fOpenSearchDialogAction;
-
+
public SearchPageAction(IWorkbenchWindow workbenchWindow, SearchPageDescriptor pageDescriptor) {
super();
fOpenSearchDialogAction= new OpenSearchDialogAction(workbenchWindow, pageDescriptor.getId());
@@ -129,7 +129,7 @@ public class OpenSearchDialogPageAction implements IWorkbenchWindowPulldownDeleg
setImageDescriptor(imageDescriptor);
}
}
-
+
public void run() {
fOpenSearchDialogAction.run(this);
}
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
index 248008717d4..b3bce8ce84a 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllResultsAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllResultsAction.java
@@ -18,11 +18,11 @@ import org.eclipse.jface.action.Action;
class RemoveAllResultsAction extends Action {
public RemoveAllResultsAction() {
- super(SearchMessages.SearchResultView_removeAllResults_text);
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_REM_ALL);
- setToolTipText(SearchMessages.SearchResultView_removeAllResults_tooltip);
+ super(SearchMessages.SearchResultView_removeAllResults_text);
+ SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_REM_ALL);
+ setToolTipText(SearchMessages.SearchResultView_removeAllResults_tooltip);
}
-
+
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
index 5fd3b427fbf..7214b03a85f 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllSearchesAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveAllSearchesAction.java
@@ -18,11 +18,11 @@ import org.eclipse.jface.action.Action;
class RemoveAllSearchesAction extends Action {
public RemoveAllSearchesAction() {
- super(SearchMessages.SearchResultView_removeAllSearches_text);
- SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_REM_ALL);
- setToolTipText(SearchMessages.SearchResultView_removeAllSearches_tooltip);
+ super(SearchMessages.SearchResultView_removeAllSearches_text);
+ SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_REM_ALL);
+ setToolTipText(SearchMessages.SearchResultView_removeAllSearches_tooltip);
}
-
+
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
index 27b24d57c55..4b9310527db 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveMatchAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveMatchAction.java
@@ -10,17 +10,17 @@
*******************************************************************************/
package org.eclipse.search.internal.ui;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.resources.IMarker;
+
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;
+import org.eclipse.search.ui.ISearchResultViewEntry;
/**
* @deprecated old search
@@ -30,25 +30,25 @@ class RemoveMatchAction extends Action {
private ISelectionProvider fSelectionProvider;
public RemoveMatchAction(ISelectionProvider provider) {
- super(SearchMessages.SearchResultView_removeMatch_text);
- setToolTipText(SearchMessages.SearchResultView_removeMatch_tooltip);
+ super(SearchMessages.SearchResultView_removeMatch_text);
+ setToolTipText(SearchMessages.SearchResultView_removeMatch_tooltip);
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.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
}
}
-
+
private IMarker[] getMarkers(ISelection s) {
if (! (s instanceof IStructuredSelection) || s.isEmpty())
return null;
-
+
IStructuredSelection selection= (IStructuredSelection)s;
int size= selection.size();
if (size != 1)
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
index 4069566e7e6..2a933cd3eed 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemovePotentialMatchesAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/RemovePotentialMatchesAction.java
@@ -13,9 +13,10 @@ 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.core.resources.IMarker;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
@@ -23,9 +24,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.search.ui.SearchUI;
-
import org.eclipse.search.internal.ui.util.ExceptionHandler;
+import org.eclipse.search.ui.SearchUI;
/**
* @deprecated old search
@@ -38,33 +38,33 @@ class RemovePotentialMatchesAction extends Action {
fSite= site;
if (usePluralLabel()) {
- setText(SearchMessages.RemovePotentialMatchesAction_removePotentialMatches_text);
- setToolTipText(SearchMessages.RemovePotentialMatchesAction_removePotentialMatches_tooltip);
+ setText(SearchMessages.RemovePotentialMatchesAction_removePotentialMatches_text);
+ setToolTipText(SearchMessages.RemovePotentialMatchesAction_removePotentialMatches_tooltip);
}
else {
- setText(SearchMessages.RemovePotentialMatchesAction_removePotentialMatch_text);
- setToolTipText(SearchMessages.RemovePotentialMatchesAction_removePotentialMatch_tooltip);
+ setText(SearchMessages.RemovePotentialMatchesAction_removePotentialMatch_text);
+ setToolTipText(SearchMessages.RemovePotentialMatchesAction_removePotentialMatch_tooltip);
}
}
-
+
public void run() {
IMarker[] markers= getMarkers();
if (markers != null)
try {
SearchPlugin.getWorkspace().deleteMarkers(markers);
} catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
}
else {
- String title= SearchMessages.RemovePotentialMatchesAction_dialog_title;
- String message= SearchMessages.RemovePotentialMatchesAction_dialog_message;
+ String title= SearchMessages.RemovePotentialMatchesAction_dialog_title;
+ String message= SearchMessages.RemovePotentialMatchesAction_dialog_message;
MessageDialog.openInformation(fSite.getShell(), title, message);
}
// action only makes sense once
setEnabled(false);
}
-
+
private IMarker[] getMarkers() {
ISelection s= fSite.getSelectionProvider().getSelection();
@@ -95,7 +95,7 @@ class RemovePotentialMatchesAction extends Action {
if (! (s instanceof IStructuredSelection) || s.isEmpty())
return false;
-
+
IStructuredSelection selection= (IStructuredSelection)s;
int size= selection.size();
if (size <= 0)
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
index 474e4b6c8a7..be8c03e14d3 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveResultAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/RemoveResultAction.java
@@ -13,19 +13,19 @@ package org.eclipse.search.internal.ui;
import java.util.ArrayList;
import java.util.Iterator;
-import org.eclipse.core.resources.IMarker;
+import org.eclipse.swt.custom.BusyIndicator;
+
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.core.resources.IMarker;
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;
+import org.eclipse.search.ui.ISearchResultViewEntry;
/**
* @deprecated old search
@@ -37,35 +37,35 @@ class RemoveResultAction extends Action {
public RemoveResultAction(ISelectionProvider provider, boolean stringsDependOnMatchCount) {
fSelectionProvider= provider;
if (!stringsDependOnMatchCount || usePluralLabel()) {
- setText(SearchMessages.SearchResultView_removeEntries_text);
- setToolTipText(SearchMessages.SearchResultView_removeEntries_tooltip);
+ setText(SearchMessages.SearchResultView_removeEntries_text);
+ setToolTipText(SearchMessages.SearchResultView_removeEntries_tooltip);
}
else {
- setText(SearchMessages.SearchResultView_removeEntry_text);
- setToolTipText(SearchMessages.SearchResultView_removeEntry_tooltip);
+ setText(SearchMessages.SearchResultView_removeEntry_text);
+ setToolTipText(SearchMessages.SearchResultView_removeEntry_tooltip);
}
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 {
+ try {
SearchPlugin.getWorkspace().deleteMarkers(markers);
} catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
}
}
});
}
}
-
+
private IMarker[] getMarkers(ISelection s) {
if (! (s instanceof IStructuredSelection) || s.isEmpty())
return null;
-
+
IStructuredSelection selection= (IStructuredSelection)s;
int size= selection.size();
if (size <= 0)
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
index 24ae84ce9bd..2d78d0ac123 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ResourceToItemsMapper.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/ResourceToItemsMapper.java
@@ -15,11 +15,11 @@ 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.core.resources.IResource;
+
import org.eclipse.jface.viewers.ContentViewer;
import org.eclipse.jface.viewers.ILabelProvider;
@@ -39,13 +39,13 @@ class ResourceToItemsMapper {
// 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;
}
@@ -66,11 +66,11 @@ class ResourceToItemsMapper {
}
}
}
-
+
private void updateItem(Item item) {
if (!item.isDisposed()) { // defensive code
ILabelProvider lprovider= (ILabelProvider) fContentViewer.getLabelProvider();
-
+
Object data= item.getData();
String oldText= item.getText();
@@ -105,7 +105,7 @@ class ResourceToItemsMapper {
list.add(item);
fResourceToItem.put(resource, list);
}
- } else { // List
+ } else { // List
List list= (List) existingMapping;
if (!list.contains(item)) {
list.add(item);
@@ -118,7 +118,7 @@ class ResourceToItemsMapper {
* Removes an element from the map.
* @param element element to remove
* @param item The item used for the element
- */
+ */
public void removeFromMap(Object element, Item item) {
IResource resource= ((ISearchResultViewEntry)element).getResource();
if (resource != null) {
@@ -137,32 +137,32 @@ class ResourceToItemsMapper {
}
}
}
-
+
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();
}
-
+
/**
* Tests if the map is empty
* @return returns if the map is empty
*/
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
index 19bc592cb98..ad926e6998a 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java
@@ -14,10 +14,6 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
@@ -30,6 +26,10 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -41,11 +41,10 @@ import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-import org.eclipse.search.ui.ISearchPageContainer;
-import org.eclipse.search.ui.NewSearchUI;
-
import org.eclipse.search.internal.ui.util.PixelConverter;
import org.eclipse.search.internal.ui.util.SWTUtil;
+import org.eclipse.search.ui.ISearchPageContainer;
+import org.eclipse.search.ui.NewSearchUI;
public class ScopePart {
@@ -54,7 +53,7 @@ public class ScopePart {
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 IDialogSettings fSettingsStore;
private Group fPart;
@@ -81,10 +80,10 @@ public class ScopePart {
public ScopePart(SearchDialog searchDialog, boolean searchEnclosingProjects) {
fSearchDialog= searchDialog;
fCanSearchEnclosingProjects= searchEnclosingProjects;
-
- fSettingsStore= SearchPlugin.getDefault().getDialogSettingsSection(DIALOG_SETTINGS_KEY);
+
+ fSettingsStore= SearchPlugin.getDefault().getDialogSettingsSection(DIALOG_SETTINGS_KEY);
fScope= getStoredScope(fSettingsStore, searchEnclosingProjects);
-
+
fWorkingSets= getStoredWorkingSets();
}
@@ -100,13 +99,13 @@ public class ScopePart {
&& scope != ISearchPageContainer.SELECTED_PROJECTS_SCOPE
&& scope != ISearchPageContainer.WORKSPACE_SCOPE)
scope= ISearchPageContainer.WORKSPACE_SCOPE;
-
+
if (!canSearchEnclosingProjects && scope == ISearchPageContainer.SELECTED_PROJECTS_SCOPE)
scope= ISearchPageContainer.WORKSPACE_SCOPE;
-
+
return scope;
}
-
+
private IWorkingSet getWorkingSet(IWorkingSetManager workingSetManager, String storedName) {
if (storedName.length() == 0) {
IWorkbenchPage page= fSearchDialog.getWorkbenchWindow().getActivePage();
@@ -117,8 +116,8 @@ public class ScopePart {
}
return workingSetManager.getWorkingSet(storedName);
}
-
-
+
+
private IWorkingSet[] getStoredWorkingSets() {
String[] lruWorkingSetNames= fSettingsStore.getArray(STORE_LRU_WORKING_SET_NAMES);
@@ -150,7 +149,7 @@ public class ScopePart {
/**
* Returns the scope selected in this part
- *
+ *
* @return the selected scope
*/
public int getSelectedScope() {
@@ -160,7 +159,7 @@ public class ScopePart {
/**
* 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) {
@@ -183,7 +182,7 @@ public class ScopePart {
}
}
fScope= scope;
-
+
fUseWorkspace.setSelection(scope == ISearchPageContainer.WORKSPACE_SCOPE);
fUseSelection.setSelection(scope == ISearchPageContainer.SELECTION_SCOPE);
fUseProject.setSelection(scope == ISearchPageContainer.SELECTED_PROJECTS_SCOPE);
@@ -191,7 +190,7 @@ public class ScopePart {
updateSearchPageContainerActionPerformedEnablement();
fSettingsStore.put(STORE_SCOPE, scope);
-
+
}
private void updateSearchPageContainerActionPerformedEnablement() {
@@ -200,7 +199,7 @@ public class ScopePart {
/**
* 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
@@ -214,7 +213,7 @@ public class ScopePart {
/**
* Sets the selected working set for this part.
* This method must only be called on a created part.
- *
+ *
* @param workingSets the working set to be selected
*/
public void setSelectedWorkingSets(IWorkingSet[] workingSets) {
@@ -255,13 +254,13 @@ public class ScopePart {
/**
* Creates this scope part.
- *
+ *
* @param parent a widget which will be the parent of the new instance (cannot be null)
* @return Returns the created part control
*/
public Composite createPart(Composite parent) {
fPart= new Group(parent, SWT.NONE);
- fPart.setText(SearchMessages.ScopePart_group_text);
+ fPart.setText(SearchMessages.ScopePart_group_text);
GridLayout layout= new GridLayout();
layout.numColumns= 4;
@@ -270,22 +269,22 @@ public class ScopePart {
fUseWorkspace= new Button(fPart, SWT.RADIO);
fUseWorkspace.setData(new Integer(ISearchPageContainer.WORKSPACE_SCOPE));
- fUseWorkspace.setText(SearchMessages.ScopePart_workspaceScope_text);
+ fUseWorkspace.setText(SearchMessages.ScopePart_workspaceScope_text);
fUseSelection= new Button(fPart, SWT.RADIO);
fUseSelection.setData(new Integer(ISearchPageContainer.SELECTION_SCOPE));
fUseSelection.setText(SearchMessages.ScopePart_selectedResourcesScope_text);
-
+
boolean canSearchInSelection= canSearchInSelection();
fUseSelection.setEnabled(canSearchInSelection);
-
+
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent= 8;
fUseSelection.setLayoutData(gd);
fUseProject= new Button(fPart, SWT.RADIO);
fUseProject.setData(new Integer(ISearchPageContainer.SELECTED_PROJECTS_SCOPE));
- fUseProject.setText(SearchMessages.ScopePart_enclosingProjectsScope_text);
+ fUseProject.setText(SearchMessages.ScopePart_enclosingProjectsScope_text);
fUseProject.setEnabled(fSearchDialog.getEnclosingProjectNames().length > 0);
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
@@ -297,17 +296,17 @@ public class ScopePart {
fUseWorkingSet= new Button(fPart, SWT.RADIO);
fUseWorkingSet.setData(new Integer(ISearchPageContainer.WORKING_SET_SCOPE));
- fUseWorkingSet.setText(SearchMessages.ScopePart_workingSetScope_text);
+ fUseWorkingSet.setText(SearchMessages.ScopePart_workingSetScope_text);
fWorkingSetText= new Text(fPart, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
fWorkingSetText.getAccessible().addAccessibleListener(new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
- e.result= SearchMessages.ScopePart_workingSetText_accessible_label;
+ e.result= SearchMessages.ScopePart_workingSetText_accessible_label;
}
});
-
+
Button chooseWorkingSet= new Button(fPart, SWT.PUSH);
chooseWorkingSet.setLayoutData(new GridData());
- chooseWorkingSet.setText(SearchMessages.ScopePart_workingSetChooseButton_text);
+ chooseWorkingSet.setText(SearchMessages.ScopePart_workingSetChooseButton_text);
SWTUtil.setButtonDimensionHint(chooseWorkingSet);
chooseWorkingSet.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -406,7 +405,7 @@ public class ScopePart {
for (int i= 0; i < workingSets.length; i++) {
String workingSetName= workingSets[i].getLabel();
if (firstFound)
- result= Messages.format(SearchMessages.ScopePart_workingSetConcatenation, new String[] { result, workingSetName });
+ result= Messages.format(SearchMessages.ScopePart_workingSetConcatenation, new String[] { result, workingSetName });
else {
result= workingSetName;
firstFound= true;
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
index a91eaf8afcc..2f80efdb79b 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java
@@ -15,10 +15,10 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.core.runtime.Assert;
+
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -26,12 +26,11 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.search.internal.ui.util.ExceptionHandler;
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;
/**
* @deprecated old search
*/
@@ -60,7 +59,7 @@ public class Search extends Object {
fActionGroupFactory= groupFactory;
fGroupByKeyComputer= groupByKeyComputer;
fOperation= operation;
-
+
if (fPluralLabelPattern == null)
fPluralLabelPattern= ""; //$NON-NLS-1$
}
@@ -75,7 +74,7 @@ public class Search extends Object {
fContextMenuContributor= contextMenuContributor;
fGroupByKeyComputer= groupByKeyComputer;
fOperation= operation;
-
+
if (fPluralLabelPattern == null)
fPluralLabelPattern= ""; //$NON-NLS-1$
}
@@ -115,8 +114,8 @@ public class Search extends Object {
return text.substring(0, Math.min(30, text.length())) + "...\" - " + text.substring(Math.min(separatorPos + 3, text.length())); //$NON-NLS-1$
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
+ /**
+ * Image used when search is displayed in a list
* @return the image descriptor
*/
ImageDescriptor getImageDescriptor() {
@@ -149,17 +148,17 @@ public class Search extends Object {
try {
new ProgressMonitorDialog(shell).run(true, true, fOperation);
} catch (InvocationTargetException ex) {
- ExceptionHandler.handle(ex, shell, SearchMessages.Search_Error_search_title, SearchMessages.Search_Error_search_message);
+ ExceptionHandler.handle(ex, shell, SearchMessages.Search_Error_search_title, SearchMessages.Search_Error_search_message);
} catch(InterruptedException e) {
} finally {
SearchPlugin.setAutoBuilding(isAutoBuilding);
}
}
-
+
boolean isSameSearch(Search search) {
return search != null && search.getOperation() == fOperation && fOperation != null;
}
-
+
void backupMarkers() {
Iterator iter= getResults().iterator();
while (iter.hasNext()) {
@@ -170,7 +169,7 @@ public class Search extends Object {
String getPageId() {
return fPageId;
}
-
+
IGroupByKeyComputer getGroupByKeyComputer() {
return fGroupByKeyComputer;
}
@@ -186,15 +185,15 @@ public class Search extends Object {
IContextMenuContributor getContextMenuContributor() {
return fContextMenuContributor;
}
-
+
IActionGroupFactory getActionGroupFactory() {
return fActionGroupFactory;
}
-
+
public void removeResults() {
fResults= null;
}
-
+
void setResults(ArrayList results) {
Assert.isNotNull(results);
fResults= results;
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
index d418818efc1..17b1847e021 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchAgainAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchAgainAction.java
@@ -18,10 +18,10 @@ import org.eclipse.jface.action.Action;
class SearchAgainAction extends Action {
public SearchAgainAction() {
- super(SearchMessages.SearchResultView_searchAgain_text);
- setToolTipText(SearchMessages.SearchResultView_searchAgain_tooltip);
+ super(SearchMessages.SearchResultView_searchAgain_text);
+ setToolTipText(SearchMessages.SearchResultView_searchAgain_tooltip);
}
-
+
public void run() {
Search selected= SearchManager.getDefault().getCurrentSearch();
if (selected != null)
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
index f10c320e1aa..238cb20afde 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java
@@ -18,16 +18,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.SafeRunner;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.events.DisposeEvent;
@@ -50,6 +40,16 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.SafeRunner;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+
import org.eclipse.jface.action.LegacyActionTools;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -77,14 +77,13 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.activities.WorkbenchActivityHelper;
import org.eclipse.ui.dialogs.ListSelectionDialog;
+import org.eclipse.search.internal.ui.util.ExceptionHandler;
+import org.eclipse.search.internal.ui.util.ExtendedDialogWindow;
import org.eclipse.search.ui.IReplacePage;
import org.eclipse.search.ui.ISearchPage;
import org.eclipse.search.ui.ISearchPageContainer;
import org.eclipse.search.ui.ISearchPageScoreComputer;
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-import org.eclipse.search.internal.ui.util.ExtendedDialogWindow;
-
public class SearchDialog extends ExtendedDialogWindow implements ISearchPageContainer, IPageChangeProvider {
private class TabFolderLayout extends Layout {
@@ -92,40 +91,40 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
return new Point(wHint, hHint);
- int x= 0;
- int y= 0;
+ 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);
+ return new Point(x, y);
}
protected void layout(Composite composite, boolean flushCache) {
Rectangle rect= composite.getClientArea();
-
+
Control[] children= composite.getChildren();
for (int i= 0; i < children.length; i++) {
children[i].setBounds(rect);
}
}
}
-
-
+
+
private static final int SEARCH_ID= IDialogConstants.CLIENT_ID + 1;
private static final int REPLACE_ID= SEARCH_ID + 1;
private static final int CUSTOMIZE_ID= REPLACE_ID + 1;
-
+
private ISearchPage fCurrentPage;
private String fInitialPageId;
private int fCurrentIndex;
@@ -137,7 +136,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
private Button fCustomizeButton;
private Button fReplaceButton;
private ListenerList fPageChangeListeners;
-
+
private final IWorkbenchWindow fWorkbenchWindow;
private final ISelection fCurrentSelection;
private final String[] fCurrentEnclosingProject;
@@ -155,7 +154,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
setUseEmbeddedProgressMonitorPart(false);
}
- public static String evaluateEnclosingProject(IAdaptable adaptable) {
+ public static String evaluateEnclosingProject(IAdaptable adaptable) {
IProject project= (IProject) adaptable.getAdapter(IProject.class);
if (project == null) {
IResource resource= (IResource) adaptable.getAdapter(IResource.class);
@@ -168,9 +167,9 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
}
return null;
}
-
+
public static String[] evaluateEnclosingProject(ISelection selection, IEditorPart activeEditor) {
- // always use the editor if active
+ // always use the editor if active
if (activeEditor != null) {
String name= evaluateEnclosingProject(activeEditor.getEditorInput());
if (name != null) {
@@ -219,7 +218,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
protected IDialogSettings getDialogBoundsSettings() {
return SearchPlugin.getDefault().getDialogSettingsSection("DialogBounds_SearchDialog"); //$NON-NLS-1$
}
-
+
protected Point getInitialSize() {
Point requiredSize= getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
Point lastSize= super.getInitialSize();
@@ -228,24 +227,24 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
}
return lastSize;
}
-
+
/* (non-Javadoc)
* Method declared in Window.
*/
protected void configureShell(Shell shell) {
super.configureShell(shell);
- shell.setText(SearchMessages.SearchDialog_title);
+ shell.setText(SearchMessages.SearchDialog_title);
PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, ISearchHelpContextIds.SEARCH_DIALOG);
}
public IWorkbenchWindow getWorkbenchWindow() {
return fWorkbenchWindow;
}
-
+
public ISelection getSelection() {
return fCurrentSelection;
}
-
+
private IEditorPart getActiveEditor() {
IWorkbenchPage activePage= fWorkbenchWindow.getActivePage();
if (activePage != null) {
@@ -255,7 +254,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
}
return null;
}
-
+
//---- Page Handling -------------------------------------------------------
/*
@@ -293,8 +292,8 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
}
};
- String message= SearchMessages.SearchPageSelectionDialog_message;
-
+ String message= SearchMessages.SearchPageSelectionDialog_message;
+
ListSelectionDialog dialog= new ListSelectionDialog(getShell(), input, new ArrayContentProvider(), labelProvider, message) {
public void create() {
super.create();
@@ -314,12 +313,12 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
this.getButton(IDialogConstants.DESELECT_ALL_ID).addSelectionListener(listener);
}
};
- dialog.setTitle(SearchMessages.SearchPageSelectionDialog_title);
+ dialog.setTitle(SearchMessages.SearchPageSelectionDialog_title);
dialog.setInitialSelections(SearchPlugin.getDefault().getEnabledSearchPageDescriptors(fInitialPageId).toArray());
if (dialog.open() == Window.OK) {
SearchPageDescriptor.setEnabled(dialog.getResult());
Display display= getShell().getDisplay();
- close();
+ close();
if (display != null && !display.isDisposed()) {
display.asyncExec(
new Runnable() {
@@ -329,7 +328,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
});
}
}
- destroyImages(createdImages);
+ destroyImages(createdImages);
}
private List filterByActivities(List input) {
@@ -338,7 +337,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
SearchPageDescriptor descriptor= (SearchPageDescriptor) descriptors.next();
if (!WorkbenchActivityHelper.filterItem(descriptor))
filteredList.add(descriptor);
-
+
}
return filteredList;
}
@@ -351,39 +350,39 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
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.SearchDialog_noSearchExtension);
+ label.setText(SearchMessages.SearchDialog_noSearchExtension);
return label;
}
-
+
fCurrentIndex= getPreferredPageIndex();
final SearchPageDescriptor currentDesc= getDescriptorAt(fCurrentIndex);
-
+
Composite composite= new Composite(parent, SWT.NONE);
composite.setFont(parent.getFont());
-
+
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
TabFolder folder= new TabFolder(composite, SWT.NONE);
folder.setLayout(new TabFolderLayout());
folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
folder.setFont(composite.getFont());
-
- for (int i= 0; i < numPages; i++) {
+
+ for (int i= 0; i < numPages; i++) {
SearchPageDescriptor descriptor= getDescriptorAt(i);
if (WorkbenchActivityHelper.filterItem(descriptor))
continue;
-
+
final TabItem item= new TabItem(folder, SWT.NONE);
item.setData("descriptor", descriptor); //$NON-NLS-1$
item.setText(descriptor.getLabel());
@@ -397,7 +396,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
ImageDescriptor imageDesc= descriptor.getImage();
if (imageDesc != null)
item.setImage(imageDesc.createImage());
-
+
if (i == fCurrentIndex) {
Control pageControl= createPageControl(folder, descriptor);
pageControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
@@ -405,7 +404,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
fCurrentPage= currentDesc.getPage();
}
}
-
+
folder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
turnToPage(event);
@@ -413,38 +412,38 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
});
folder.setSelection(fCurrentIndex);
-
+
return composite;
}
-
+
protected Control createButtonBar(Composite parent) {
Composite composite= new Composite(parent, SWT.NONE);
GridLayout layout= new GridLayout();
- layout.numColumns= 0; // create
+ layout.numColumns= 0; // create
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
-
+
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
// create help control if needed
if (isHelpAvailable()) {
createHelpControl(composite);
}
- fCustomizeButton= createButton(composite, CUSTOMIZE_ID, SearchMessages.SearchDialog_customize, true);
-
+ fCustomizeButton= createButton(composite, CUSTOMIZE_ID, SearchMessages.SearchDialog_customize, true);
+
Label filler= new Label(composite, SWT.NONE);
filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
layout.numColumns++;
-
- fReplaceButton= createActionButton(composite, REPLACE_ID, SearchMessages.SearchDialog_replaceAction, true);
+
+ fReplaceButton= createActionButton(composite, REPLACE_ID, SearchMessages.SearchDialog_replaceAction, true);
fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage);
- Button searchButton= createActionButton(composite, SEARCH_ID, SearchMessages.SearchDialog_searchAction, true);
+ Button searchButton= createActionButton(composite, SEARCH_ID, SearchMessages.SearchDialog_searchAction, true);
searchButton.setEnabled(fDescriptors.size() > 0);
super.createButtonsForButtonBar(composite); // cancel button
-
+
return composite;
}
@@ -465,26 +464,26 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
try {
fCustomizeButton.setEnabled(false);
- // safe cast, replace button is only visible when the current page is
+ // safe cast, replace button is only visible when the current page is
// a replace page.
return ((IReplacePage)fCurrentPage).performReplace();
} finally {
fCustomizeButton.setEnabled(true);
- SearchPlugin.setAutoBuilding(isAutoBuilding);
+ SearchPlugin.setAutoBuilding(isAutoBuilding);
}
default:
return false;
- }
+ }
}
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();
@@ -495,35 +494,35 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
if (size.y != SWT.DEFAULT)
y= Math.max(y, size.y);
}
-
+
fMinSize= new Point(x, y);
- return fMinSize;
+ return fMinSize;
}
-
+
private void turnToPage(SelectionEvent event) {
final TabItem item= (TabItem) event.item;
TabFolder folder= item.getParent();
-
+
SearchPageDescriptor descriptor= (SearchPageDescriptor) item.getData("descriptor"); //$NON-NLS-1$
-
+
if (item.getControl() == null) {
item.setControl(createPageControl(folder, descriptor));
}
-
+
Control oldControl= folder.getItem(fCurrentIndex).getControl();
Point oldSize= oldControl.getSize();
Control newControl= item.getControl();
Point newSize= newControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
resizeDialogIfNeeded(oldSize, newSize);
-
+
ISearchPage oldPage= fCurrentPage;
if (oldPage != null) {
oldPage.setVisible(false);
}
-
+
fCurrentPage= descriptor.getPage();
fCurrentIndex= folder.getSelectionIndex();
-
+
setPerformActionEnabled(fCurrentPage != null);
if (fCurrentPage != null) {
fCurrentPage.setVisible(true);
@@ -531,13 +530,13 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage);
notifyPageChanged();
}
-
+
private int getPreferredPageIndex() {
Object element= null;
ISelection selection= getSelection();
if (selection instanceof IStructuredSelection)
element= ((IStructuredSelection) selection).getFirstElement();
-
+
if (element == null) {
IEditorPart editorPart= getActiveEditor();
if (editorPart != null) {
@@ -551,7 +550,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
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;
@@ -570,12 +569,12 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
/*
* Implements method from ISearchPageContainer
- */
+ */
public int getSelectedScope() {
if (fScopeParts[fCurrentIndex] == null)
// safe code - should not happen
return ISearchPageContainer.WORKSPACE_SCOPE;
-
+
return fScopeParts[fCurrentIndex].getSelectedScope();
}
@@ -586,15 +585,15 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
if (fScopeParts[fCurrentIndex] == null)
// safe code - should not happen
return null;
-
+
return fScopeParts[fCurrentIndex].getSelectedWorkingSets();
}
-
+
public String[] getEnclosingProjectNames() {
return fCurrentEnclosingProject;
}
-
-
+
+
public String[] getSelectedProjectNames() {
if (getSelectedScope() == SELECTED_PROJECTS_SCOPE) {
return getEnclosingProjectNames();
@@ -616,7 +615,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
public boolean hasValidScope() {
return getSelectedScope() != WORKING_SET_SCOPE || getSelectedWorkingSets() != null;
}
-
+
/*
* Implements method from ISearchPageContainer
*/
@@ -631,7 +630,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
public void setPerformActionEnabled(boolean state) {
fLastEnableState= state;
super.setPerformActionEnabled(state && hasValidScope());
- }
+ }
/**
* Notify that the scope selection has changed
@@ -644,16 +643,16 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
}
private Control createPageControl(Composite parent, final SearchPageDescriptor descriptor) {
-
+
// Page wrapper
final Composite pageWrapper= new Composite(parent, SWT.NONE);
GridLayout layout= new GridLayout();
layout.marginWidth= 0;
layout.marginHeight= 0;
pageWrapper.setLayout(layout);
-
+
applyDialogFont(pageWrapper);
-
+
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
SafeRunner.run(new ISafeRunnable() {
@@ -666,34 +665,34 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
}
public void handleException(Throwable ex) {
if (ex instanceof CoreException) {
- ExceptionHandler.handle((CoreException) ex, getShell(), SearchMessages.Search_Error_createSearchPage_title, Messages.format(SearchMessages.Search_Error_createSearchPage_message, descriptor.getLabel()));
+ ExceptionHandler.handle((CoreException) ex, getShell(), SearchMessages.Search_Error_createSearchPage_title, Messages.format(SearchMessages.Search_Error_createSearchPage_message, descriptor.getLabel()));
} else {
- ExceptionHandler.displayMessageDialog(ex, getShell(), SearchMessages.Search_Error_createSearchPage_title, Messages.format(SearchMessages.Search_Error_createSearchPage_message, descriptor.getLabel()));
+ ExceptionHandler.displayMessageDialog(ex, getShell(), SearchMessages.Search_Error_createSearchPage_title, Messages.format(SearchMessages.Search_Error_createSearchPage_message, descriptor.getLabel()));
}
}
});
}
});
-
+
ISearchPage page= descriptor.getPage();
if (page == null || page.getControl() == null) {
Composite container= new Composite(parent, SWT.NONE);
Label label= new Label(container, SWT.WRAP);
- label.setText(Messages.format(SearchMessages.SearchDialog_error_pageCreationFailed, descriptor.getLabel()));
+ label.setText(Messages.format(SearchMessages.SearchDialog_error_pageCreationFailed, descriptor.getLabel()));
container.setLayout(new GridLayout());
label.setLayoutData(new GridData());
return container;
}
-
+
page.getControl().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
-
+
// Search scope
boolean showScope= descriptor.showScopeSection();
if (showScope) {
Composite c= new Composite(pageWrapper, SWT.NONE);
c.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
c.setLayout(new GridLayout());
-
+
int index= fDescriptors.indexOf(descriptor);
fScopeParts[index]= new ScopePart(this, descriptor.canSearchInProjects());
Control part= fScopeParts[index].createPart(c);
@@ -701,10 +700,10 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
part.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
fScopeParts[index].setVisible(true);
}
-
+
return pageWrapper;
}
-
+
private void resizeDialogIfNeeded(Point oldSize, Point newSize) {
if (oldSize == null || newSize == null)
return;
@@ -719,11 +718,11 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
shell.layout(true);
}
}
-
+
private boolean mustResize(Point currentSize, Point newSize) {
return currentSize.x < newSize.x || currentSize.y < newSize.y;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#close()
*/
@@ -758,7 +757,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
public void removePageChangedListener(IPageChangedListener listener) {
fPageChangeListeners.remove(listener);
}
-
+
private void notifyPageChanged() {
if (fPageChangeListeners != null && !fPageChangeListeners.isEmpty()) {
// Fires the page change event
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
index 40b8004528e..f074001adc5 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDropDownAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDropDownAction.java
@@ -30,10 +30,10 @@ class SearchDropDownAction extends Action implements IMenuCreator {
public static final int RESULTS_IN_DROP_DOWN= 10;
private Menu fMenu;
-
+
public SearchDropDownAction() {
- setText(SearchMessages.SearchResultView_previousSearches_text);
- setToolTipText(SearchMessages.SearchResultView_previousSearches_tooltip);
+ setText(SearchMessages.SearchResultView_previousSearches_text);
+ setToolTipText(SearchMessages.SearchResultView_previousSearches_tooltip);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_HISTORY);
setMenuCreator(this);
}
@@ -52,7 +52,7 @@ class SearchDropDownAction extends Action implements IMenuCreator {
public Menu getMenu(Control parent) {
if (fMenu != null)
fMenu.dispose();
-
+
fMenu= new Menu(parent);
boolean checkedOne= false;
Iterator iter= SearchManager.getDefault().getPreviousSearches().iterator();
@@ -86,7 +86,7 @@ class SearchDropDownAction extends Action implements IMenuCreator {
}
/**
- * Get's rid of the menu, because the menu hangs on to
+ * Get's rid of the menu, because the menu hangs on to
* the searches, etc.
*/
void clear() {
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
index 90e45192e1a..23f6bf50e2c 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchManager.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchManager.java
@@ -17,6 +17,10 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -28,21 +32,16 @@ import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
-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.viewers.Viewer;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.search.internal.ui.util.ExceptionHandler;
import org.eclipse.search.ui.IGroupByKeyComputer;
import org.eclipse.search.ui.SearchUI;
-import org.eclipse.search.internal.ui.util.ExceptionHandler;
-
/**
* Manage search results
* @deprecated old search
@@ -50,25 +49,25 @@ import org.eclipse.search.internal.ui.util.ExceptionHandler;
public class SearchManager implements IResourceChangeListener {
static final SearchManager fgDefault= new SearchManager();
-
+
Search fCurrentSearch= null;
-
+
private SearchManager() {
SearchPlugin.getWorkspace().addResourceChangeListener(this);
}
-
+
private HashSet fListeners= new HashSet();
private LinkedList fPreviousSearches= new LinkedList();
private boolean fIsRemoveAll= false;
-
+
public static SearchManager getDefault() {
return fgDefault;
}
-
+
public void dispose() {
SearchPlugin.getWorkspace().removeResourceChangeListener(this);
}
-
+
/**
* Returns the list with previous searches (ISearch).
* @return previous searches
@@ -94,7 +93,7 @@ public class SearchManager implements IResourceChangeListener {
SearchPlugin.getWorkspace().removeResourceChangeListener(this);
WorkspaceModifyOperation op= new WorkspaceModifyOperation(null) {
protected void execute(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(SearchMessages.SearchManager_updating, 100);
+ monitor.beginTask(SearchMessages.SearchManager_updating, 100);
SearchPlugin.getWorkspace().getRoot().deleteMarkers(SearchUI.SEARCH_MARKER, true, IResource.DEPTH_INFINITE);
monitor.worked(100);
monitor.done();
@@ -105,12 +104,12 @@ public class SearchManager implements IResourceChangeListener {
ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
dialog.run(true, true, op);
} catch (InvocationTargetException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
} catch (InterruptedException e) {
// Do nothing. Operation has been canceled.
} finally {
SearchPlugin.getWorkspace().addResourceChangeListener(this);
- SearchPlugin.setAutoBuilding(isAutoBuilding);
+ SearchPlugin.setAutoBuilding(isAutoBuilding);
}
// clear searches
@@ -132,7 +131,7 @@ public class SearchManager implements IResourceChangeListener {
void setCurrentSearch(final Search search) {
if (fCurrentSearch == search)
return;
-
+
SearchPlugin.getWorkspace().removeResourceChangeListener(this);
WorkspaceModifyOperation op= new WorkspaceModifyOperation(null) {
protected void execute(IProgressMonitor monitor) throws CoreException {
@@ -144,13 +143,13 @@ public class SearchManager implements IResourceChangeListener {
ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
dialog.run(true, true, op);
} catch (InvocationTargetException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_switchSearch_title, SearchMessages.Search_Error_switchSearch_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_switchSearch_title, SearchMessages.Search_Error_switchSearch_message);
} catch (InterruptedException e) {
// Do nothing. Operation has been canceled.
} finally {
- SearchPlugin.setAutoBuilding(isAutoBuilding);
+ SearchPlugin.setAutoBuilding(isAutoBuilding);
}
-
+
getPreviousSearches().remove(search);
getPreviousSearches().addFirst(search);
}
@@ -158,16 +157,16 @@ public class SearchManager implements IResourceChangeListener {
void internalSetCurrentSearch(final Search search, IProgressMonitor monitor) {
if (fCurrentSearch != null)
fCurrentSearch.backupMarkers();
-
+
final Search previousSearch= fCurrentSearch;
fCurrentSearch= search;
- monitor.beginTask(SearchMessages.SearchManager_updating, getCurrentResults().size() + 20);
-
+ monitor.beginTask(SearchMessages.SearchManager_updating, getCurrentResults().size() + 20);
+
// remove current search markers
try {
SearchPlugin.getWorkspace().getRoot().deleteMarkers(SearchUI.SEARCH_MARKER, true, IResource.DEPTH_INFINITE);
} catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
}
monitor.worked(10);
@@ -192,18 +191,18 @@ public class SearchManager implements IResourceChangeListener {
try {
newMarker= entry.getResource().createMarker(entry.getMarkerType());
} catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_createMarker_title, SearchMessages.Search_Error_createMarker_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_createMarker_title, SearchMessages.Search_Error_createMarker_message);
continue;
}
try {
newMarker.setAttributes((Map)attrPerMarkerIter.next());
if (groupByKeyComputer !=null && groupByKeyComputer.computeGroupByKey(newMarker) == null) {
- filesDeleted= true;
+ filesDeleted= true;
newMarker.delete();
continue;
}
} catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_markerAttributeAccess_title, SearchMessages.Search_Error_markerAttributeAccess_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_markerAttributeAccess_title, SearchMessages.Search_Error_markerAttributeAccess_message);
}
entry.add(newMarker);
}
@@ -214,22 +213,22 @@ public class SearchManager implements IResourceChangeListener {
}
getCurrentResults().removeAll(emptyEntries);
monitor.worked(10);
-
+
String warningMessage= null;
Display display= getDisplay();
-
+
if (filesChanged)
- warningMessage= SearchMessages.SearchManager_resourceChanged;
+ warningMessage= SearchMessages.SearchManager_resourceChanged;
if (filesDeleted) {
if (warningMessage == null)
warningMessage= ""; //$NON-NLS-1$
else
warningMessage += "\n"; //$NON-NLS-1$
- warningMessage += SearchMessages.SearchManager_resourceDeleted;
+ warningMessage += SearchMessages.SearchManager_resourceDeleted;
}
if (warningMessage != null) {
if (display != null && !display.isDisposed()) {
- final String warningTitle= SearchMessages.SearchManager_resourceChangedWarning;
+ final String warningTitle= SearchMessages.SearchManager_resourceChangedWarning;
final String warningMsg= warningMessage;
display.syncExec(new Runnable() {
public void run() {
@@ -238,7 +237,7 @@ public class SearchManager implements IResourceChangeListener {
});
}
}
-
+
// update viewers
iter= fListeners.iterator();
if (display != null && !display.isDisposed()) {
@@ -279,15 +278,15 @@ public class SearchManager implements IResourceChangeListener {
try {
SearchPlugin.getWorkspace().getRoot().deleteMarkers(SearchUI.SEARCH_MARKER, true, IResource.DEPTH_INFINITE);
} catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
fIsRemoveAll= false;
}
}
void addNewSearch(final Search newSearch) {
-
+
SearchPlugin.getWorkspace().removeResourceChangeListener(this);
-
+
// Clear the viewers
Iterator iter= fListeners.iterator();
Display display= getDisplay();
@@ -304,7 +303,7 @@ public class SearchManager implements IResourceChangeListener {
});
}
}
-
+
if (fCurrentSearch != null) {
if (fCurrentSearch.isSameSearch(newSearch))
getPreviousSearches().remove(fCurrentSearch);
@@ -313,12 +312,12 @@ public class SearchManager implements IResourceChangeListener {
}
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.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_deleteMarkers_title, SearchMessages.Search_Error_deleteMarkers_message);
}
}
@@ -329,7 +328,7 @@ public class SearchManager implements IResourceChangeListener {
Display display= getDisplay();
if (display == null || display.isDisposed())
return;
-
+
if (Thread.currentThread() == display.getThread())
handleNewSearchResult();
else {
@@ -341,7 +340,7 @@ public class SearchManager implements IResourceChangeListener {
}
SearchPlugin.getWorkspace().addResourceChangeListener(this);
}
-
+
//--- Change event handling -------------------------------------------------
void addSearchChangeListener(SearchResultViewer viewer) {
@@ -363,7 +362,7 @@ public class SearchManager implements IResourceChangeListener {
Iterator iter= fListeners.iterator();
while (iter.hasNext())
((SearchResultViewer)iter.next()).getControl().setRedraw(false);
-
+
for (int i=0; i < markerDeltas.length; i++) {
handleSearchMarkerChanged(markerDeltas[i]);
}
@@ -390,7 +389,7 @@ public class SearchManager implements IResourceChangeListener {
while (iter.hasNext())
((SearchResultViewer)iter.next()).handleRemoveAll();
}
-
+
private void handleNewSearchResult() {
Iterator iter= fListeners.iterator();
while (iter.hasNext()) {
@@ -398,7 +397,7 @@ public class SearchManager implements IResourceChangeListener {
viewer.setInput(getCurrentResults());
}
}
-
+
private void setNewSearch(SearchResultViewer viewer, Search search) {
viewer.setInput(null);
viewer.clearTitle();
@@ -407,7 +406,7 @@ public class SearchManager implements IResourceChangeListener {
viewer.setContextMenuTarget(search.getContextMenuContributor());
viewer.setActionGroupFactory(search.getActionGroupFactory());
}
-
+
private void handleRemoveMatch(IMarker marker) {
SearchResultViewEntry entry= findEntry(marker);
if (entry != null) {
@@ -446,8 +445,8 @@ public class SearchManager implements IResourceChangeListener {
}
/**
- * Received a resource event. Since the delta could be created in a
- * separate thread this methods post the event into the viewer's
+ * 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.
* @param event the event
*/
@@ -477,7 +476,7 @@ public class SearchManager implements IResourceChangeListener {
}
}
};
- display.syncExec(runnable);
+ display.syncExec(runnable);
}
/**
* Find and return a valid display
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
index b3066502463..2478aa42b9b 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java
@@ -27,7 +27,7 @@ public final class SearchMessages extends NLS {
public static String FileTextSearchScope_scope_single;
public static String FileTextSearchScope_scope_double;
public static String FileTextSearchScope_scope_multiple;
-
+
public static String FileTextSearchScope_ws_scope_empty;
public static String FileTextSearchScope_ws_scope_single;
public static String FileTextSearchScope_ws_scope_double;
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
index b127cc2381f..bab41bf5933 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPageDescriptor.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPageDescriptor.java
@@ -19,6 +19,11 @@ import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
+import org.osgi.framework.Bundle;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -28,23 +33,17 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-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.ui.IPluginContribution;
+import org.eclipse.search.internal.ui.util.ExceptionHandler;
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.ExceptionHandler;
-
-import org.osgi.framework.Bundle;
-
/**
* Proxy that represents a search page.
*/
@@ -62,16 +61,16 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
private final static String CAN_SEARCH_ENCLOSING_PROJECTS= "canSearchEnclosingProjects"; //$NON-NLS-1$
private final static String ENABLED_ATTRIBUTE= "enabled"; //$NON-NLS-1$
private final static String SEARCH_VIEW_HELP_CONTEXT_ID_ATTRIBUTE= "searchViewHelpContextId"; //$NON-NLS-1$
-
+
public final static Point UNKNOWN_SIZE= new Point(SWT.DEFAULT, SWT.DEFAULT);
// dialog store id constants
private final static String SECTION_ID= "Search"; //$NON-NLS-1$
private final static String STORE_ENABLED_PAGE_IDS= SECTION_ID + ".enabledPageIds"; //$NON-NLS-1$
private final static String STORE_PROCESSED_PAGE_IDS= SECTION_ID + ".processedPageIds"; //$NON-NLS-1$
-
+
private static List fgEnabledPageIds;
-
+
private static class ExtensionScorePair {
public String extension;
public int score;
@@ -85,7 +84,7 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
private List fExtensionScorePairs;
private int fWildcardScore= ISearchPageScoreComputer.UNKNOWN;
private ISearchPage fCreatedPage;
-
+
/**
* Creates a new search page node with the given configuration element.
* @param element The configuration element
@@ -108,21 +107,21 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
}
return fCreatedPage;
}
-
+
public ISearchPage getPage() {
return fCreatedPage;
}
-
-
+
+
public void dispose() {
if (fCreatedPage != null) {
fCreatedPage.dispose();
fCreatedPage= null;
}
}
-
+
//---- XML Attribute accessors ---------------------------------------------
-
+
/**
* Returns the page's id.
* @return The id of the page
@@ -130,7 +129,7 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
public String getId() {
return fElement.getAttribute(ID_ATTRIBUTE);
}
-
+
/**
* Returns the page's image
* @return ImageDescriptor of the image or null if creating failed
@@ -161,7 +160,7 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
/**
* Returns <code>true</code> if the page is initially
* shown in the Search dialog.
- *
+ *
* This attribute is optional and defaults to <code>true</code>.
* @return Returns if the page should be initially shown
*/
@@ -174,7 +173,7 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
* Returns <code>true</code> if the page can handle
* searches in enclosing projects. The value should be ignored if <code>showScopeSection()</code>
* returns <code>false</code>.
- *
+ *
* This attribute is optional and defaults to <code>false</code>.
* @return Returns if the page can handle searches in enclosing projects
*/
@@ -200,7 +199,7 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
}
return 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
@@ -213,7 +212,7 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
try {
position= Integer.parseInt(str);
} catch (NumberFormatException ex) {
- ExceptionHandler.log(ex, SearchMessages.Search_Error_createSearchPage_message);
+ ExceptionHandler.log(ex, SearchMessages.Search_Error_createSearchPage_message);
// position is Integer.MAX_VALUE;
}
return position;
@@ -225,7 +224,7 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
/**
* Returns the help context for help shown in search view.
- *
+ *
* @return the help context id or <code>null</code> if not defined
*/
public String getSearchViewHelpContextId() {
@@ -244,13 +243,13 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
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);
@@ -258,14 +257,14 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
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());
@@ -291,20 +290,20 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
return section;
}
- /*
- * Implements a method from IComparable
- */
+ /*
+ * 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());
-
+
return myPos - objsPos;
}
-
+
//---- Suitability tests ---------------------------------------------------
-
+
/**
* Returns the score for this page with the given input element.
* @param element The input element
@@ -318,22 +317,22 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
if (extension != null)
return getScoreForFileExtension(extension);
} else {
- ISearchPageScoreComputer tester=
+ ISearchPageScoreComputer tester=
(ISearchPageScoreComputer)((IAdaptable)element).getAdapter(ISearchPageScoreComputer.class);
if (tester != null)
- return tester.computeScore(getId(), element);
+ return tester.computeScore(getId(), element);
}
}
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);
@@ -342,10 +341,10 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
}
if (fWildcardScore != ISearchPageScoreComputer.UNKNOWN)
return fWildcardScore;
-
- return ISearchPageScoreComputer.LOWEST;
+
+ return ISearchPageScoreComputer.LOWEST;
}
-
+
private void readExtensionScorePairs() {
fExtensionScorePairs= new ArrayList(3);
String content= fElement.getAttribute(EXTENSIONS_ATTRIBUTE);
@@ -362,7 +361,7 @@ class SearchPageDescriptor implements IPluginContribution, Comparable {
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
index 3719a1ef2a3..ee31141b6ef 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java
@@ -15,6 +15,12 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import org.osgi.framework.BundleContext;
+
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -26,10 +32,6 @@ import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceDescription;
import org.eclipse.core.resources.ResourcesPlugin;
-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;
@@ -39,52 +41,49 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.search.ui.IContextMenuConstants;
-import org.eclipse.search.ui.NewSearchUI;
-
import org.eclipse.search.internal.core.text.TextSearchEngineRegistry;
import org.eclipse.search.internal.ui.util.ExceptionHandler;
+import org.eclipse.search.ui.IContextMenuConstants;
+import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.search2.internal.ui.InternalSearchUI;
import org.eclipse.search2.internal.ui.text2.TextSearchQueryProviderRegistry;
-import org.osgi.framework.BundleContext;
-
/**
* 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$
- /**
+ /**
* Filtered search marker type (value <code>"org.eclipse.search.filteredsearchmarker"</code>).
*
* @see org.eclipse.core.resources.IMarker
- */
+ */
public static final String FILTERED_SEARCH_MARKER= NewSearchUI.PLUGIN_ID + ".filteredsearchmarker"; //$NON-NLS-1$
- /**
+ /**
* Search annotation type (value <code>"org.eclipse.search.results"</code>).
*
* @since 3.2
- */
+ */
public static final String SEARCH_ANNOTATION_TYPE= NewSearchUI.PLUGIN_ID + ".results"; //$NON-NLS-1$
-
- /**
+
+ /**
* Filtered search annotation type (value <code>"org.eclipse.search.filteredResults"</code>).
*
* @since 3.2
- */
+ */
public static final String FILTERED_SEARCH_ANNOTATION_TYPE= NewSearchUI.PLUGIN_ID + ".filteredResults"; //$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 TextSearchEngineRegistry fTextSearchEngineRegistry;
@@ -104,7 +103,7 @@ public class SearchPlugin extends AbstractUIPlugin {
public static SearchPlugin getDefault() {
return fgSearchPlugin;
}
-
+
/**
* Returns the active workbench window.
* @return returns <code>null</code> if the active window is not a workbench window
@@ -173,11 +172,11 @@ public class SearchPlugin extends AbstractUIPlugin {
*/
public static IWorkbenchPage getActivePage() {
return getActiveWorkbenchWindow().getActivePage();
- }
+ }
/**
* @return Returns the workbench from which this plugin has been loaded.
- */
+ */
public static IWorkspace getWorkspace() {
return ResourcesPlugin.getWorkspace();
}
@@ -187,23 +186,23 @@ public class SearchPlugin extends AbstractUIPlugin {
static boolean setAutoBuilding(boolean state) {
IWorkspaceDescription workspaceDesc= getWorkspace().getDescription();
boolean isAutobuilding= workspaceDesc.isAutoBuilding();
-
+
if (isAutobuilding != state) {
workspaceDesc.setAutoBuilding(state);
try {
getWorkspace().setDescription(workspaceDesc);
}
catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_setDescription_title, SearchMessages.Search_Error_setDescription_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_setDescription_title, SearchMessages.Search_Error_setDescription_message);
}
}
return isAutobuilding;
}
-
+
/**
* This method is called upon plug-in activation
- * @param context
- * @throws Exception
+ * @param context
+ * @throws Exception
*/
public void start(BundleContext context) throws Exception {
super.start(context);
@@ -211,8 +210,8 @@ public class SearchPlugin extends AbstractUIPlugin {
/**
* This method is called when the plug-in is stopped
- * @param context
- * @throws Exception
+ * @param context
+ * @throws Exception
*/
public void stop(BundleContext context) throws Exception {
InternalSearchUI.shutdown();
@@ -220,7 +219,7 @@ public class SearchPlugin extends AbstractUIPlugin {
super.stop(context);
fgSearchPlugin= null;
}
-
+
/**
* @deprecated
*/
@@ -235,9 +234,9 @@ public class SearchPlugin extends AbstractUIPlugin {
if (fPageDescriptors == null) {
IConfigurationElement[] elements= Platform.getExtensionRegistry().getConfigurationElementsFor(NewSearchUI.PLUGIN_ID, SEARCH_PAGE_EXTENSION_POINT);
fPageDescriptors= createSearchPageDescriptors(elements);
- }
+ }
return fPageDescriptors;
- }
+ }
/**
* @param pageId the page id
@@ -252,12 +251,12 @@ public class SearchPlugin extends AbstractUIPlugin {
enabledDescriptors.add(desc);
}
return enabledDescriptors;
- }
+ }
/**
* @return Returns the help context ID for the Search view
* as provided by the current search page extension.
- *
+ *
* @since 3.0
* @deprecated old search
*/
@@ -277,7 +276,7 @@ public class SearchPlugin extends AbstractUIPlugin {
}
}
return ISearchHelpContextIds.SEARCH_VIEW;
- }
+ }
/**
* Creates all necessary search page nodes.
@@ -304,18 +303,18 @@ public class SearchPlugin extends AbstractUIPlugin {
if (fSorterDescriptors == null) {
IConfigurationElement[] elements= Platform.getExtensionRegistry().getConfigurationElementsFor(NewSearchUI.PLUGIN_ID, SORTER_EXTENSION_POINT);
fSorterDescriptors= createSorterDescriptors(elements);
- }
+ }
return fSorterDescriptors;
}
-
-
+
+
public TextSearchEngineRegistry getTextSearchEngineRegistry() {
if (fTextSearchEngineRegistry == null) {
fTextSearchEngineRegistry= new TextSearchEngineRegistry();
}
return fTextSearchEngineRegistry;
}
-
+
public TextSearchQueryProviderRegistry getTextSearchQueryProviderRegistry() {
if (fTextSearchQueryProviderRegistry == null) {
fTextSearchQueryProviderRegistry= new TextSearchQueryProviderRegistry();
@@ -337,7 +336,7 @@ public class SearchPlugin extends AbstractUIPlugin {
}
return result;
}
-
+
public IDialogSettings getDialogSettingsSection(String name) {
IDialogSettings dialogSettings= getDialogSettings();
IDialogSettings section= dialogSettings.getSection(name);
@@ -346,20 +345,20 @@ public class SearchPlugin extends AbstractUIPlugin {
}
return section;
}
-
+
/**
* Log status to platform log
* @param status the status to log
- */
+ */
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, NewSearchUI.PLUGIN_ID, INTERNAL_ERROR, SearchMessages.SearchPlugin_internal_error, e));
+ log(new Status(IStatus.ERROR, NewSearchUI.PLUGIN_ID, INTERNAL_ERROR, SearchMessages.SearchPlugin_internal_error, e));
}
-
+
public static String getID() {
return NewSearchUI.PLUGIN_ID;
}
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
index 619d24be94c..0c0f2aca825 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java
@@ -12,18 +12,18 @@ package org.eclipse.search.internal.ui;
import java.net.URL;
+import org.osgi.framework.Bundle;
+
+import org.eclipse.swt.graphics.Image;
+
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-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.osgi.framework.Bundle;
-
/**
* Bundle of all images used by the Search UI plugin.
*/
@@ -33,7 +33,7 @@ public class SearchPluginImages {
private final static ImageRegistry PLUGIN_REGISTRY= SearchPlugin.getDefault().getImageRegistry();
private static final IPath ICONS_PATH= new Path("$nl$/icons/full"); //$NON-NLS-1$
-
+
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$
@@ -45,7 +45,7 @@ public class SearchPluginImages {
// Define image names
public static final String IMG_TOOL_SEARCH= NAME_PREFIX + "search.gif"; //$NON-NLS-1$
-
+
public static final String IMG_LCL_SEARCH_AGAIN= NAME_PREFIX + "search_again.gif"; //$NON-NLS-1$
public static final String IMG_LCL_PIN_VIEW= NAME_PREFIX + "pin_view.gif"; //$NON-NLS-1$
@@ -77,11 +77,11 @@ public class SearchPluginImages {
public static final ImageDescriptor DESC_OBJ_SEARCHMARKER= createManaged(T_OBJ, IMG_OBJ_SEARCHMARKER);
public static final ImageDescriptor DESC_OBJ_TEXT_SEARCH_LINE= createManaged(T_OBJ, IMG_OBJ_TEXT_SEARCH_LINE);
public static final ImageDescriptor DESC_VIEW_SEARCHRES= createManaged(T_EVIEW, IMG_VIEW_SEARCHRES);
-
+
public static Image get(String key) {
return PLUGIN_REGISTRY.get(key);
}
-
+
private static ImageDescriptor createManaged(String prefix, String name) {
ImageDescriptor result= create(prefix, name.substring(NAME_PREFIX_LENGTH), true);
PLUGIN_REGISTRY.put(name, result);
@@ -99,20 +99,20 @@ public class SearchPluginImages {
IPath path= ICONS_PATH.append(prefix).append(name);
return createImageDescriptor(SearchPlugin.getDefault().getBundle(), path, useMissingImageDescriptor);
}
-
+
/*
* 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, false)); //$NON-NLS-1$
-
+
ImageDescriptor desc= create("e" + type, relPath, true); //$NON-NLS-1$
- action.setHoverImageDescriptor(desc);
+ action.setHoverImageDescriptor(desc);
action.setImageDescriptor(desc);
}
-
+
/*
* Creates an image descriptor for the given path in a bundle. The path can contain variables
* like $NL$.
@@ -130,5 +130,5 @@ public class SearchPluginImages {
}
return null;
}
-
+
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferenceInitializer.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferenceInitializer.java
index ad9084bfb46..88dca796c5f 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferenceInitializer.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferenceInitializer.java
@@ -7,7 +7,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
- *******************************************************************************/
+ *******************************************************************************/
package org.eclipse.search.internal.ui;
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
index 0a66973fcea..40624945a5b 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPreferencePage.java
@@ -10,11 +10,11 @@
*******************************************************************************/
package org.eclipse.search.internal.ui;
-import com.ibm.icu.text.Collator;
-
import java.util.Arrays;
import java.util.Comparator;
+import com.ibm.icu.text.Collator;
+
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
@@ -41,8 +41,8 @@ import org.eclipse.search.internal.core.text.TextSearchEngineRegistry;
public class SearchPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
public static final String PAGE_ID= "org.eclipse.search.preferences.SearchPreferencePage"; //$NON-NLS-1$
-
-
+
+
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$
@@ -53,7 +53,7 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I
public static final String TEXT_SEARCH_ENGINE = "org.eclipse.search.textSearchEngine"; //$NON-NLS-1$
public static final String TEXT_SEARCH_QUERY_PROVIDER = "org.eclipse.search.textSearchQueryProvider"; //$NON-NLS-1$
public static final String LIMIT_HISTORY= "org.eclipse.search.limitHistory"; //$NON-NLS-1$
-
+
private ColorFieldEditor fColorEditor;
private BooleanFieldEditor fEmphasizedCheckbox;
private BooleanFieldEditor fIgnorePotentialMatchesCheckbox;
@@ -98,11 +98,11 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I
super.createControl(parent);
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ISearchHelpContextIds.SEARCH_PREFERENCE_PAGE);
}
-
+
protected void createFieldEditors() {
addField(new BooleanFieldEditor(REUSE_EDITOR, SearchMessages.SearchPreferencePage_reuseEditor, getFieldEditorParent()));
addField(new BooleanFieldEditor(BRING_VIEW_TO_FRONT, SearchMessages.SearchPreferencePage_bringToFront, getFieldEditorParent()));
-
+
fIgnorePotentialMatchesCheckbox= new BooleanFieldEditor(
IGNORE_POTENTIAL_MATCHES,
SearchMessages.SearchPreferencePage_ignorePotentialMatches,
@@ -114,14 +114,14 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I
SearchMessages.SearchPreferencePage_emphasizePotentialMatches,
getFieldEditorParent());
addField(fEmphasizedCheckbox);
-
+
fColorEditor= new ColorFieldEditor(
POTENTIAL_MATCH_FG_COLOR,
SearchMessages.SearchPreferencePage_potentialMatchFgColor,
getFieldEditorParent()
);
addField(fColorEditor);
-
+
fEmphasizedCheckbox.setEnabled(!arePotentialMatchesIgnored(), getFieldEditorParent());
fColorEditor.setEnabled(!arePotentialMatchesIgnored() && arePotentialMatchesEmphasized(), getFieldEditorParent());
@@ -133,7 +133,7 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I
perspectiveNamesAndIds,
getFieldEditorParent());
addField(comboEditor);
-
+
// in case we have a contributed engine, let the user choose.
TextSearchEngineRegistry reg= SearchPlugin.getDefault().getTextSearchEngineRegistry();
String[][] engineNamesAndIds= reg.getAvailableEngines();
@@ -163,8 +163,8 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I
super.performDefaults();
updateFieldEnablement();
}
-
-
+
+
private void updateFieldEnablement() {
boolean arePotentialMatchesIgnored= fIgnorePotentialMatchesCheckbox.getBooleanValue();
fEmphasizedCheckbox.setEnabled(!arePotentialMatchesIgnored, getFieldEditorParent());
@@ -175,12 +175,12 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I
* 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.SearchPreferencePage_defaultPerspective_none;
table[0][1] = NO_DEFAULT_PERSPECTIVE;
@@ -198,8 +198,8 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I
store.putValue(DEFAULT_PERSPECTIVE, NO_DEFAULT_PERSPECTIVE);
}
}
-
-
+
+
// Accessors to preference values
public static String getDefaultPerspectiveId() {
handleDeletedPerspectives();
@@ -218,7 +218,7 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I
IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
return store.getBoolean(REUSE_EDITOR);
}
-
+
public static boolean isViewBroughtToFront() {
IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
return store.getBoolean(BRING_VIEW_TO_FRONT);
@@ -238,7 +238,7 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I
IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
return PreferenceConverter.getColor(store, POTENTIAL_MATCH_FG_COLOR);
}
-
+
public static int getHistoryLimit() {
IPreferenceStore store= SearchPlugin.getDefault().getPreferenceStore();
int limit= store.getInt(LIMIT_HISTORY);
@@ -249,5 +249,5 @@ public class SearchPreferencePage extends FieldEditorPreferencePage implements I
}
return limit;
}
-
+
}
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
index c4cd8a55417..6d6d329adee 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultLabelProvider.java
@@ -24,12 +24,12 @@ import org.eclipse.search.ui.ISearchResultViewEntry;
* @deprecated old search
*/
class SearchResultLabelProvider extends LabelProvider {
-
+
private static final String MATCHES_POSTFIX= " " + SearchMessages.SearchResultView_matches + ")"; //$NON-NLS-1$ //$NON-NLS-2$
private ILabelProvider fLabelProvider;
-
+
SearchResultLabelProvider(ILabelProvider provider) {
fLabelProvider= provider;
}
@@ -42,13 +42,13 @@ class SearchResultLabelProvider extends LabelProvider {
buf.append(count);
buf.append(MATCHES_POSTFIX);
}
- return buf.toString();
+ return buf.toString();
}
-
+
public Image getImage(Object element) {
return fLabelProvider.getImage(element);
}
-
+
// Don't dispose since label providers are reused.
public void dispose() {
}
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
index c5f7e14b36a..00fe29697e8 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java
@@ -18,14 +18,14 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
import org.eclipse.core.runtime.Assert;
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;
@@ -57,7 +57,7 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
private static Map fgLabelProviders= new HashMap(5);
-
+
private SearchResultViewer fViewer;
private Map fResponse;
private IMemento fMemento;
@@ -84,7 +84,7 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
return;
}
fViewer.saveState(memento);
- }
+ }
/**
* Creates the search list inner viewer.
@@ -106,7 +106,7 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
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()))
@@ -114,12 +114,12 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
fViewer.updatedPotentialMatchFgColor();
}
};
-
+
SearchPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener);
-
+
PlatformUI.getWorkbench().getHelpSystem().setHelp(fViewer.getControl(), SearchPlugin.getDefault().getSearchViewHelpContextId());
}
-
+
/**
* Returns the search result viewer.
* @return the search result viewer.
@@ -127,14 +127,14 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
public SearchResultViewer getViewer() {
return fViewer;
}
-
+
//---- IWorkbenchPart ------------------------------------------------------
public void setFocus() {
fViewer.getControl().setFocus();
}
-
+
public void dispose() {
if (fViewer != null) {
SearchManager.getDefault().removeSearchChangeListener(fViewer);
@@ -148,29 +148,29 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
}
super.dispose();
}
-
+
protected void setContentDescription(String title) {
super.setContentDescription(title);
}
-
+
protected void setTitleToolTip(String text) {
super.setTitleToolTip(text);
}
-
+
//---- Adding Action to Toolbar -------------------------------------------
-
+
private void fillActionBars(IActionBars actionBars) {
IToolBarManager toolBar= actionBars.getToolBarManager();
fillToolBar(toolBar);
actionBars.updateActionBars();
-
+
// Add selectAll action handlers.
actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction);
}
private void fillToolBar(IToolBarManager tbm) {
fViewer.fillToolBar(tbm);
- }
+ }
ILabelProvider getLabelProvider(String pageId) {
if (pageId != null)
@@ -184,7 +184,7 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
IBaseLabelProvider labelProvider= fViewer.getLabelProvider();
if (labelProvider == null)
return null;
-
+
return ((SearchResultLabelProvider)labelProvider).getLabelProvider();
}
@@ -200,7 +200,7 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
Display getDisplay() {
return fViewer.getControl().getDisplay();
- }
+ }
//---- ISearchResultView --------------------------------------------------
@@ -230,7 +230,7 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
Assert.isNotNull(pageId);
Assert.isNotNull(pluralLabelPattern);
- Assert.isNotNull(gotoAction);
+ Assert.isNotNull(gotoAction);
fResponse= new HashMap(500);
setGotoMarkerAction(gotoAction);
@@ -240,7 +240,7 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
oldLabelProvider.dispose();
fgLabelProviders.put(pageId, labelProvider);
- SearchManager.getDefault().addNewSearch(
+ SearchManager.getDefault().addNewSearch(
new Search(
pageId,
singularLabel,
@@ -265,7 +265,7 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
IAction gotoAction,
IGroupByKeyComputer groupByKeyComputer,
IRunnableWithProgress operation) {
-
+
searchStarted(pageId, null, label, imageDescriptor, contributor, labelProvider, gotoAction, groupByKeyComputer, operation);
}
@@ -287,7 +287,7 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
Assert.isNotNull(pageId);
Assert.isNotNull(pluralLabelPattern);
- Assert.isNotNull(gotoAction);
+ Assert.isNotNull(gotoAction);
fResponse= new HashMap(500);
setGotoMarkerAction(gotoAction);
@@ -297,7 +297,7 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
oldLabelProvider.dispose();
fgLabelProviders.put(pageId, labelProvider);
- SearchManager.getDefault().addNewSearch(
+ SearchManager.getDefault().addNewSearch(
new Search(
pageId,
singularLabel,
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
index 6bc6a1042bd..dc5d245ac55 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntry.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntry.java
@@ -15,11 +15,12 @@ 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.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+
import org.eclipse.search.ui.ISearchResultViewEntry;
import org.eclipse.search.ui.SearchUI;
@@ -37,14 +38,14 @@ public class SearchResultViewEntry extends PlatformObject implements ISearchResu
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;
@@ -53,11 +54,11 @@ public class SearchResultViewEntry extends PlatformObject implements ISearchResu
void setGroupByKey(Object groupByKey) {
fGroupByKey= groupByKey;
}
-
+
public IResource getResource() {
return fResource;
}
-
+
public int getMatchCount() {
if (fMarkers != null)
return fMarkers.size();
@@ -71,23 +72,23 @@ public class SearchResultViewEntry extends PlatformObject implements ISearchResu
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 {
@@ -109,11 +110,11 @@ public class SearchResultViewEntry extends PlatformObject implements ISearchResu
}
addByStartpos(fMarkers, marker);
}
-
+
void setSelectedMarkerIndex(int index) {
fSelectedMarkerIndex= index;
}
-
+
public IMarker getSelectedMarker() {
fSelectedMarkerIndex= Math.min(fSelectedMarkerIndex, getMatchCount() - 1);
if (fMarkers == null && fMarker == null)
@@ -122,7 +123,7 @@ public class SearchResultViewEntry extends PlatformObject implements ISearchResu
return (IMarker)fMarkers.get(fSelectedMarkerIndex);
return fMarker;
}
-
+
public List getMarkers() {
if (fMarkers == null && fMarker == null)
return new ArrayList(0);
@@ -139,7 +140,7 @@ public class SearchResultViewEntry extends PlatformObject implements ISearchResu
return SearchUI.SEARCH_MARKER;
return fMarkerType;
}
-
+
boolean contains(IMarker marker) {
if (fMarkers == null && fMarker == null)
return false;
@@ -147,11 +148,11 @@ public class SearchResultViewEntry extends PlatformObject implements ISearchResu
return fMarker.equals(marker);
return fMarkers.contains(marker);
}
-
+
void remove(IMarker marker) {
if (marker == null)
return;
-
+
if (fMarkers == null) {
if (fMarker != null && fMarker.equals(marker))
fMarker= null;
@@ -164,7 +165,7 @@ public class SearchResultViewEntry extends PlatformObject implements ISearchResu
}
}
}
-
+
void backupMarkers() {
if (fResource != null)
fModificationStamp= fResource.getModificationStamp();
@@ -183,7 +184,7 @@ public class SearchResultViewEntry extends PlatformObject implements ISearchResu
fAttributes.add(attributes);
}
}
-
+
private void addByStartpos(ArrayList markers, IMarker marker) {
int startPos= marker.getAttribute(IMarker.CHAR_START, -1);
int i= 0;
@@ -194,7 +195,7 @@ public class SearchResultViewEntry extends PlatformObject implements ISearchResu
if (i == 0)
fMarker= marker;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
*/
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
index a3d50706c28..9b5f69f9680 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntryAdapterFactory.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewEntryAdapterFactory.java
@@ -12,9 +12,10 @@
package org.eclipse.search.internal.ui;
+import org.eclipse.core.runtime.IAdapterFactory;
+
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.search.ui.ISearchResultViewEntry;
@@ -24,27 +25,27 @@ import org.eclipse.search.ui.ISearchResultViewEntry;
* @deprecated old search
*/
public class SearchResultViewEntryAdapterFactory implements IAdapterFactory {
-
+
private static Class[] PROPERTIES= new Class[] {
IResource.class, IMarker.class,
};
-
+
public Class[] getAdapterList() {
return PROPERTIES;
}
-
+
public Object getAdapter(Object element, Class key) {
-
+
ISearchResultViewEntry entry= (ISearchResultViewEntry) element;
-
+
if (IMarker.class.equals(key)) {
return entry.getSelectedMarker();
}
if (IResource.class.equals(key)) {
IResource resource= entry.getResource();
/*
- * This is a trick to filter out dummy markers that
+ * 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.
*/
@@ -52,6 +53,6 @@ public class SearchResultViewEntryAdapterFactory implements IAdapterFactory {
if (type != IResource.PROJECT && type != IResource.ROOT)
return resource;
}
- return null;
+ 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
index 6114159146e..3936a076e61 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java
@@ -18,13 +18,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.KeyAdapter;
@@ -37,6 +30,13 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Widget;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -63,14 +63,13 @@ import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.search.internal.ui.util.FileLabelProvider;
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
@@ -81,7 +80,7 @@ import org.eclipse.search.internal.ui.util.FileLabelProvider;
* @deprecated old search
*/
public class SearchResultViewer extends TableViewer {
-
+
private SearchResultView fOuterPart;
private ShowNextResultAction fShowNextResultAction;
private ShowPreviousResultAction fShowPreviousResultAction;
@@ -100,27 +99,27 @@ public class SearchResultViewer extends TableViewer {
private ActionGroup fActionGroup;
private IContextMenuContributor fContextMenuContributor;
private IAction fGotoMarkerAction;
-
+
private ResourceToItemsMapper fResourceToItemsMapper;
private String fCurrentPageId= null;
-
+
public SearchResultViewer(SearchResultView outerPart, Composite parent) {
super(new Table(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
fResourceToItemsMapper= new ResourceToItemsMapper(this);
-
+
fOuterPart= outerPart;
Assert.isNotNull(fOuterPart);
if (SearchPreferencePage.arePotentialMatchesEmphasized())
fPotentialMatchFgColor= new Color(SearchPlugin.getActiveWorkbenchShell().getDisplay(), SearchPreferencePage.getPotentialMatchForegroundColor());
-
+
setUseHashlookup(true);
setContentProvider(new ArrayContentProvider());
ILabelProvider labelProvider= new SearchResultLabelProvider(new FileLabelProvider(FileLabelProvider.SHOW_LABEL));
setLabelProvider(labelProvider);
-
+
Search currentSearch= SearchManager.getDefault().getCurrentSearch();
boolean hasSearch= currentSearch != null;
boolean hasSearchOperation= currentSearch != null && currentSearch.getOperation() != null;
@@ -159,7 +158,7 @@ public class SearchResultViewer extends TableViewer {
showResult();
}
});
-
+
MenuManager menuMgr= new MenuManager("#PopUp"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(
@@ -170,11 +169,11 @@ public class SearchResultViewer extends TableViewer {
}
});
Menu menu= menuMgr.createContextMenu(getTable());
- getTable().setMenu(menu);
-
+ getTable().setMenu(menu);
+
// Register menu
fOuterPart.getSite().registerContextMenu(menuMgr, this);
-
+
IActionBars actionBars= fOuterPart.getViewSite().getActionBars();
if (actionBars != null) {
actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), fShowNextResultAction);
@@ -183,7 +182,7 @@ public class SearchResultViewer extends TableViewer {
fOuterPart.getSite().setSelectionProvider(this);
}
-
+
void init() {
Search search= SearchManager.getDefault().getCurrentSearch();
if (search != null) {
@@ -192,7 +191,7 @@ public class SearchResultViewer extends TableViewer {
setActionGroupFactory(null);
setActionGroupFactory(search.getActionGroupFactory());
setPageId(search.getPageId());
- setInput(search.getResults());
+ setInput(search.getResults());
}
}
@@ -202,8 +201,8 @@ public class SearchResultViewer extends TableViewer {
TableItem ti = (TableItem) item;
ti.setForeground(fPotentialMatchFgColor);
}
- }
-
+ }
+
private void handleSelectionChanged() {
int selectionCount= getSelectedEntriesCount();
boolean hasSingleSelection= selectionCount == 1;
@@ -298,12 +297,12 @@ public class SearchResultViewer extends TableViewer {
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());
@@ -311,10 +310,10 @@ public class SearchResultViewer extends TableViewer {
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);
@@ -329,7 +328,7 @@ public class SearchResultViewer extends TableViewer {
// 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();
@@ -374,12 +373,12 @@ public class SearchResultViewer extends TableViewer {
}
void setActionGroupFactory(IActionGroupFactory groupFactory) {
- IActionBars actionBars= fOuterPart.getViewSite().getActionBars();
+ IActionBars actionBars= fOuterPart.getViewSite().getActionBars();
if (fActionGroup != null) {
fActionGroup.dispose();
fActionGroup= null;
}
-
+
if (groupFactory != null) {
fActionGroup= groupFactory.createActionGroup(fOuterPart);
if (actionBars != null)
@@ -393,13 +392,13 @@ public class SearchResultViewer extends TableViewer {
if (fCurrentPageId != null && fCurrentPageId.equals(pageId))
return;
- fCurrentPageId= pageId;
+ fCurrentPageId= pageId;
ILabelProvider labelProvider= fOuterPart.getLabelProvider(pageId);
if (labelProvider != null)
internalSetLabelProvider(labelProvider);
fSortDropDownAction.setPageId(pageId);
}
-
+
void fillToolBar(IToolBarManager tbm) {
tbm.add(fShowNextResultAction);
tbm.add(fShowPreviousResultAction);
@@ -409,7 +408,7 @@ public class SearchResultViewer extends TableViewer {
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) {
@@ -423,7 +422,7 @@ public class SearchResultViewer extends TableViewer {
}
}
});
- }
+ }
int getItemCount() {
return SearchManager.getDefault().getCurrentItemCount();
@@ -503,16 +502,16 @@ public class SearchResultViewer extends TableViewer {
Table table= getTable();
if (!canDoShowResult(table))
return;
-
+
int index= table.getSelectionIndex();
SearchResultViewEntry entry;
fMarkerToShow--;
if (fMarkerToShow >= 0)
- entry= (SearchResultViewEntry)getTable().getItem(getTable().getSelectionIndex()).getData();
+ entry= (SearchResultViewEntry)getTable().getItem(getTable().getSelectionIndex()).getData();
else {
- // move selection
+ // move selection
int count= table.getItemCount();
if (index == -1) {
index= count - 1;
@@ -529,13 +528,13 @@ public class SearchResultViewer extends TableViewer {
openCurrentSelection();
updateStatusLine();
}
-
+
private boolean canDoShowResult(Table table) {
if (table == null || getItemCount() == 0)
return false;
- return true;
+ return true;
}
-
+
private void selectResult(int index) {
fHandleSelectionChangedEvents= false;
Object element= getElementAt(index);
@@ -571,9 +570,9 @@ public class SearchResultViewer extends TableViewer {
String title;
if (hasCurrentSearch) {
String description= SearchManager.getDefault().getCurrentSearch().getFullDescription();
- title= Messages.format(SearchMessages.SearchResultView_titleWithDescription, description);
+ title= Messages.format(SearchMessages.SearchResultView_titleWithDescription, description);
} else
- title= SearchMessages.SearchResultView_title;
+ title= SearchMessages.SearchResultView_title;
if (title == null || !title.equals(fOuterPart.getContentDescription()))
fOuterPart.setContentDescription(title);
}
@@ -582,7 +581,7 @@ public class SearchResultViewer extends TableViewer {
* Clear the title
*/
protected void clearTitle() {
- String title= SearchMessages.SearchResultView_title;
+ String title= SearchMessages.SearchResultView_title;
if (!title.equals(fOuterPart.getContentDescription()))
fOuterPart.setContentDescription(title);
}
@@ -612,7 +611,7 @@ public class SearchResultViewer extends TableViewer {
}
//--- Change event handling -------------------------------------------------
-
+
/**
* Handle a single add.
* @param entry the entry to add
@@ -646,7 +645,7 @@ public class SearchResultViewer extends TableViewer {
/**
* Handle an update of an entry.
* @param entry the entry
- * @param matchRemoved
+ * @param matchRemoved
*/
protected void handleUpdateMatch(ISearchResultViewEntry entry, boolean matchRemoved) {
Widget item= findItem(entry);
@@ -660,10 +659,10 @@ public class SearchResultViewer extends TableViewer {
void restoreState(IMemento memento) {
fSortDropDownAction.restoreState(memento);
}
-
+
void saveState(IMemento memento) {
fSortDropDownAction.saveState(memento);
- }
+ }
/*
* @see ContentViewer#handleLabelProviderChanged(LabelProviderChangedEvent)
@@ -707,7 +706,7 @@ public class SearchResultViewer extends TableViewer {
protected void unmapElement(Object element, Widget item) {
if (item instanceof Item) {
fResourceToItemsMapper.removeFromMap(element, (Item)item);
- }
+ }
super.unmapElement(element, item);
}
@@ -718,7 +717,7 @@ public class SearchResultViewer extends TableViewer {
fResourceToItemsMapper.clearMap();
super.unmapAllElements();
}
-
+
protected void internalRefresh(Object element, boolean updateLabels) {
// see bug 44891
getTable().setRedraw(false);
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
index bbcbe93e6c5..dad75aafa8d 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.java
@@ -22,28 +22,28 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.ui.PlatformUI;
-
+
/**
* This action selects all entries currently showing in view.
*/
public class SelectAllAction extends Action {
private StructuredViewer fViewer;
-
+
/**
* Creates the action.
*/
public SelectAllAction() {
super("selectAll"); //$NON-NLS-1$
- setText(SearchMessages.SelectAllAction_label);
- setToolTipText(SearchMessages.SelectAllAction_tooltip);
+ setText(SearchMessages.SelectAllAction_label);
+ setToolTipText(SearchMessages.SelectAllAction_tooltip);
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ISearchHelpContextIds.SELECT_ALL_ACTION);
}
-
+
public void setViewer(StructuredViewer viewer) {
fViewer= viewer;
}
-
+
private void collectExpandedAndVisible(TreeItem[] items, List result) {
for (int i= 0; i < items.length; i++) {
TreeItem item= items[i];
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
index 08e7193f802..02945849af6 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowNextResultAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowNextResultAction.java
@@ -16,17 +16,17 @@ import org.eclipse.jface.action.Action;
* @deprecated old search
*/
class ShowNextResultAction extends Action {
-
+
private SearchResultViewer fViewer;
public ShowNextResultAction(SearchResultViewer viewer) {
- super(SearchMessages.SearchResultView_showNext_text);
+ super(SearchMessages.SearchResultView_showNext_text);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_NEXT);
- setToolTipText(SearchMessages.SearchResultView_showNext_tooltip);
+ setToolTipText(SearchMessages.SearchResultView_showNext_tooltip);
fViewer= viewer;
setActionDefinitionId("org.eclipse.ui.navigate.next"); //$NON-NLS-1$
}
-
+
public void run() {
fViewer.showNextResult();
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowPreviousResultAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowPreviousResultAction.java
index d7c411e6fef..d2038075190 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowPreviousResultAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowPreviousResultAction.java
@@ -16,17 +16,17 @@ import org.eclipse.jface.action.Action;
* @deprecated old search
*/
class ShowPreviousResultAction extends Action {
-
+
private SearchResultViewer fViewer;
public ShowPreviousResultAction(SearchResultViewer viewer) {
- super(SearchMessages.SearchResultView_showPrev_text);
+ super(SearchMessages.SearchResultView_showPrev_text);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_PREV);
- setToolTipText(SearchMessages.SearchResultView_showPrev_tooltip);
+ setToolTipText(SearchMessages.SearchResultView_showPrev_tooltip);
setActionDefinitionId("org.eclipse.ui.navigate.previous"); //$NON-NLS-1$
fViewer= viewer;
}
-
+
public void run() {
fViewer.showPreviousResult();
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchAction.java
index 6c26e531c79..6503e25bde9 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchAction.java
@@ -17,10 +17,10 @@ import org.eclipse.jface.action.Action;
*/
class ShowSearchAction extends Action {
private Search fSearch;
-
+
/**
* Create a new instance of this class
- * @param search
+ * @param search
*/
public ShowSearchAction(Search search) {
fSearch= search;
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
index b1d33f468ba..3998a9b95f6 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java
@@ -33,9 +33,9 @@ import org.eclipse.search.internal.ui.util.ListDialog;
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$
@@ -45,21 +45,21 @@ class ShowSearchesAction extends Action {
if (!(element instanceof ShowSearchAction))
return null;
- ImageDescriptor imageDescriptor= ((ShowSearchAction)element).getImageDescriptor();
+ 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;
}
}
@@ -68,8 +68,8 @@ class ShowSearchesAction extends Action {
* Create a new instance of this class
*/
public ShowSearchesAction() {
- super(SearchMessages.ShowOtherSearchesAction_label);
- setToolTipText(SearchMessages.ShowOtherSearchesAction_tooltip);
+ super(SearchMessages.ShowOtherSearchesAction_label);
+ setToolTipText(SearchMessages.ShowOtherSearchesAction_tooltip);
}
/*
* Overrides method from Action
@@ -77,7 +77,7 @@ class ShowSearchesAction extends Action {
public void run() {
run(false);
}
-
+
public void run(boolean showAll) {
Iterator iter= SearchManager.getDefault().getPreviousSearches().iterator();
int cutOffSize;
@@ -104,14 +104,14 @@ class ShowSearchesAction extends Action {
String title;
String message;
if (showAll) {
- title= SearchMessages.PreviousSearchesDialog_title;
- message= SearchMessages.PreviousSearchesDialog_message;
+ title= SearchMessages.PreviousSearchesDialog_title;
+ message= SearchMessages.PreviousSearchesDialog_message;
}
else {
- title= SearchMessages.OtherSearchesDialog_title;
- message= SearchMessages.OtherSearchesDialog_message;
+ title= SearchMessages.OtherSearchesDialog_title;
+ message= SearchMessages.OtherSearchesDialog_message;
}
-
+
LabelProvider labelProvider=new SearchesLabelProvider();
ListDialog dlg= new ListDialog(SearchPlugin.getActiveWorkbenchShell(),input, title, message, new ArrayContentProvider(), labelProvider);
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
index ed6e839c42f..46c8f4212fd 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SortDropDownAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SortDropDownAction.java
@@ -34,8 +34,8 @@ 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_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$
@@ -47,10 +47,10 @@ class SortDropDownAction extends Action implements IMenuCreator {
private Map fLastCheckedForType;
public SortDropDownAction(SearchResultViewer viewer) {
- super(SearchMessages.SortDropDownAction_label);
+ super(SearchMessages.SortDropDownAction_label);
SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_SORT);
fViewer= viewer;
- setToolTipText(SearchMessages.SortDropDownAction_tooltip);
+ setToolTipText(SearchMessages.SortDropDownAction_tooltip);
setMenuCreator(this);
fLastCheckedForType= new HashMap(5);
}
@@ -83,9 +83,9 @@ class SortDropDownAction extends Action implements IMenuCreator {
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);
@@ -94,7 +94,7 @@ class SortDropDownAction extends Action implements IMenuCreator {
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;
@@ -169,7 +169,7 @@ class SortDropDownAction extends Action implements IMenuCreator {
}
//--- Persistency -------------------------------------------------
-
+
void restoreState(IMemento memento) {
if (fLastCheckedForType.isEmpty())
restoreState(memento, fLastCheckedForType, TAG_SORTERS);
@@ -190,12 +190,12 @@ class SortDropDownAction extends Action implements IMenuCreator {
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);
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
index e603c53c1af..8c168ecacf5 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SorterDescriptor.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SorterDescriptor.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.search.internal.ui;
+import org.osgi.framework.Bundle;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Path;
@@ -20,8 +22,6 @@ import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.search.internal.ui.util.ExceptionHandler;
-import org.osgi.framework.Bundle;
-
/**
* Proxy that represents a sorter.
*/
@@ -34,13 +34,13 @@ class SorterDescriptor {
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.
- *
- * @param element the configuration element
+ *
+ * @param element the configuration element
*/
public SorterDescriptor(IConfigurationElement element) {
fElement= element;
@@ -54,16 +54,16 @@ class SorterDescriptor {
try {
return (ViewerSorter)fElement.createExecutableExtension(CLASS_ATTRIBUTE);
} catch (CoreException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_createSorter_title, SearchMessages.Search_Error_createSorter_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_createSorter_title, SearchMessages.Search_Error_createSorter_message);
return null;
} catch (ClassCastException ex) {
- ExceptionHandler.displayMessageDialog(ex, SearchMessages.Search_Error_createSorter_title, SearchMessages.Search_Error_createSorter_message);
+ ExceptionHandler.displayMessageDialog(ex, SearchMessages.Search_Error_createSorter_title, SearchMessages.Search_Error_createSorter_message);
return null;
}
}
-
+
//---- XML Attribute accessors ---------------------------------------------
-
+
/**
* Returns the sorter's id.
* @return the sorter's id.
@@ -71,7 +71,7 @@ class SorterDescriptor {
public String getId() {
return fElement.getAttribute(ID_ATTRIBUTE);
}
-
+
/**
* Returns the sorter's image
* @return the sorter's image
@@ -91,7 +91,7 @@ class SorterDescriptor {
public String getLabel() {
return fElement.getAttribute(LABEL_ATTRIBUTE);
}
-
+
/**
* Returns the sorter's tooltip.
* @return the sorter's tooltip.
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
index ac473ec2b96..99c5d3e4af5 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/WorkingSetComparator.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/WorkingSetComparator.java
@@ -10,22 +10,23 @@
*******************************************************************************/
package org.eclipse.search.internal.ui;
-import com.ibm.icu.text.Collator;
import java.util.Comparator;
+import com.ibm.icu.text.Collator;
+
import org.eclipse.ui.IWorkingSet;
public 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).getLabel();
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/BasicElementLabels.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/BasicElementLabels.java
index 5e1a9a25fe6..0a3e2619164 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/BasicElementLabels.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/BasicElementLabels.java
@@ -10,25 +10,25 @@
*******************************************************************************/
package org.eclipse.search.internal.ui.text;
+import org.eclipse.osgi.util.TextProcessor;
+
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.resources.IResource;
-import org.eclipse.osgi.util.TextProcessor;
-
/**
* A label provider for basic elements like paths. The label provider will make sure that the labels are correctly
* shown in RTL environments.
- *
+ *
* @since 3.4
*/
public class BasicElementLabels {
-
+
private BasicElementLabels(){}
-
+
/**
* Adds special marks so that that the given string is readable in a BIDI environment.
- *
+ *
* @param string the string
* @param delimiters the additional delimiters
* @return the processed styled string
@@ -37,10 +37,10 @@ public class BasicElementLabels {
private static String markLTR(String string, String delimiters) {
return TextProcessor.process(string, delimiters);
}
-
+
/**
- * Returns the label of a path.
- *
+ * Returns the label of a path.
+ *
* @param path the path
* @param isOSPath if <code>true</code>, the path represents an OS path, if <code>false</code> it is a workspace path.
* @return the label of the path to be used in the UI.
@@ -54,50 +54,50 @@ public class BasicElementLabels {
}
return markLTR(label, "/\\:."); //$NON-NLS-1$
}
-
+
/**
* Returns the label for a file pattern like '*.java'
- *
+ *
* @param name the pattern
* @return the label of the pattern.
*/
public static String getFilePattern(String name) {
return markLTR(name, "*.?/\\:."); //$NON-NLS-1$
}
-
+
/**
* Returns the label for a URL, URI or URL part. Example is 'http://www.x.xom/s.html#1'
- *
+ *
* @param name the URL string
* @return the label of the URL.
*/
public static String getURLPart(String name) {
return markLTR(name, ":@?-#/\\:."); //$NON-NLS-1$
}
-
+
/**
* Returns a label for a resource name.
- *
+ *
* @param resource the resource
* @return the label of the resource name.
*/
public static String getResourceName(IResource resource) {
return markLTR(resource.getName(), ":."); //$NON-NLS-1$
}
-
+
/**
* Returns a label for a resource name.
- *
+ *
* @param resourceName the resource name
* @return the label of the resource name.
*/
public static String getResourceName(String resourceName) {
return markLTR(resourceName, ":."); //$NON-NLS-1$
}
-
+
/**
* Returns a label for a version name. Example is '1.4.1'
- *
+ *
* @param name the version string
* @return the version label
*/
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/DecoratingFileSearchLabelProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/DecoratingFileSearchLabelProvider.java
index 73969b93c57..3c0708b744d 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/DecoratingFileSearchLabelProvider.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/DecoratingFileSearchLabelProvider.java
@@ -33,29 +33,29 @@ public class DecoratingFileSearchLabelProvider extends DecoratingStyledCellLabel
private static final String HIGHLIGHT_BG_COLOR_NAME= "org.eclipse.jdt.ui.ColoredLabels.match_highlight"; //$NON-NLS-1$
public static final Styler HIGHLIGHT_STYLE= StyledString.createColorRegistryStyler(null, HIGHLIGHT_BG_COLOR_NAME);
-
+
public DecoratingFileSearchLabelProvider(FileLabelProvider provider) {
super(provider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), null);
}
-
+
public void initialize(ColumnViewer viewer, ViewerColumn column) {
PlatformUI.getPreferenceStore().addPropertyChangeListener(this);
JFaceResources.getColorRegistry().addListener(this);
-
+
setOwnerDrawEnabled(showColoredLabels());
-
+
super.initialize(viewer, column);
}
-
+
public void dispose() {
super.dispose();
PlatformUI.getPreferenceStore().removePropertyChangeListener(this);
JFaceResources.getColorRegistry().removeListener(this);
}
-
+
private void refresh() {
ColumnViewer viewer= getViewer();
-
+
if (viewer == null) {
return;
}
@@ -67,7 +67,7 @@ public class DecoratingFileSearchLabelProvider extends DecoratingStyledCellLabel
viewer.refresh();
}
}
-
+
protected StyleRange prepareStyleRange(StyleRange styleRange, boolean applyColors) {
if (!applyColors && styleRange.background != null) {
styleRange= super.prepareStyleRange(styleRange, applyColors);
@@ -76,11 +76,11 @@ public class DecoratingFileSearchLabelProvider extends DecoratingStyledCellLabel
}
return super.prepareStyleRange(styleRange, applyColors);
}
-
+
public static boolean showColoredLabels() {
return PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS);
}
-
+
public void propertyChange(PropertyChangeEvent event) {
String property= event.getProperty();
if (property.equals(JFacePreferences.QUALIFIER_COLOR) || property.equals(JFacePreferences.COUNTER_COLOR) || property.equals(JFacePreferences.DECORATIONS_COLOR)
@@ -96,6 +96,6 @@ public class DecoratingFileSearchLabelProvider extends DecoratingStyledCellLabel
public String getText(Object element) {
return getStyledText(element).getString();
}
-
+
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java
index 9a3b34457c6..8b0744b8259 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java
@@ -27,23 +27,23 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.search.internal.ui.SearchMessages;
import org.eclipse.search.internal.ui.SearchPlugin;
+import org.eclipse.search.ui.NewSearchUI;
public class EditorOpener {
private IEditorReference fReusedEditor;
-
+
public IEditorPart open(IWorkbenchPage wbPage, IFile file, boolean activate) throws PartInitException {
if (NewSearchUI.reuseEditor())
return showWithReuse(file, wbPage, getEditorID(file), activate);
return showWithoutReuse(file, wbPage, getEditorID(file), activate);
}
-
+
public IEditorPart openAndSelect(IWorkbenchPage wbPage, IFile file, int offset, int length, boolean activate) throws PartInitException {
String editorId= null;
IEditorDescriptor desc= IDE.getEditorDescriptor(file);
@@ -52,14 +52,14 @@ public class EditorOpener {
} else {
editorId= desc.getId();
}
-
+
IEditorPart editor;
if (NewSearchUI.reuseEditor()) {
editor= showWithReuse(file, wbPage, editorId, activate);
} else {
editor= showWithoutReuse(file, wbPage, editorId, activate);
}
-
+
if (editor instanceof ITextEditor) {
ITextEditor textEditor= (ITextEditor) editor;
textEditor.selectAndReveal(offset, length);
@@ -68,7 +68,7 @@ public class EditorOpener {
}
return editor;
}
-
+
private IEditorPart showWithoutReuse(IFile file, IWorkbenchPage wbPage, String editorID, boolean activate) throws PartInitException {
return IDE.openEditor(wbPage, file, editorID, activate);
}
@@ -80,7 +80,7 @@ public class EditorOpener {
return SearchPlugin.getDefault().getWorkbench().getEditorRegistry().findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID).getId();
return desc.getId();
}
-
+
private IEditorPart showWithReuse(IFile file, IWorkbenchPage page, String editorId, boolean activate) throws PartInitException {
IEditorInput input= new FileEditorInput(file);
IEditorPart editor= page.findEditor(input);
@@ -133,7 +133,7 @@ public class EditorOpener {
marker.setAttributes(attributes);
IDE.gotoMarker(editor, marker);
} catch (CoreException e) {
- throw new PartInitException(SearchMessages.FileSearchPage_error_marker, e);
+ throw new PartInitException(SearchMessages.FileSearchPage_error_marker, e);
} finally {
if (marker != null)
try {
@@ -143,5 +143,5 @@ public class EditorOpener {
}
}
}
-
+
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileLabelProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileLabelProvider.java
index 62fef0f56a5..5e01ce2afcd 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileLabelProvider.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileLabelProvider.java
@@ -16,11 +16,11 @@ package org.eclipse.search.internal.ui.text;
import java.util.Arrays;
import java.util.Comparator;
-import org.eclipse.core.resources.IResource;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.core.resources.IResource;
+
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StyledString;
@@ -29,30 +29,29 @@ import org.eclipse.jface.viewers.StyledString.Styler;
import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.search.ui.text.AbstractTextSearchResult;
-import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
-import org.eclipse.search.ui.text.Match;
-
import org.eclipse.search.internal.ui.Messages;
import org.eclipse.search.internal.ui.SearchMessages;
import org.eclipse.search.internal.ui.SearchPluginImages;
+import org.eclipse.search.ui.text.AbstractTextSearchResult;
+import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
+import org.eclipse.search.ui.text.Match;
public class FileLabelProvider extends LabelProvider implements IStyledLabelProvider {
-
+
public static final int SHOW_LABEL= 1;
public static final int SHOW_LABEL_PATH= 2;
public static final int SHOW_PATH_LABEL= 3;
-
+
private static final String fgSeparatorFormat= "{0} - {1}"; //$NON-NLS-1$
-
+
private static final String fgEllipses= " ... "; //$NON-NLS-1$
-
+
private final WorkbenchLabelProvider fLabelProvider;
private final AbstractTextSearchViewPage fPage;
private final Comparator fMatchComparator;
-
+
private final Image fLineMatchImage;
-
+
private int fOrder;
public FileLabelProvider(AbstractTextSearchViewPage page, int orderFlag) {
@@ -70,34 +69,34 @@ public class FileLabelProvider extends LabelProvider implements IStyledLabelProv
public void setOrder(int orderFlag) {
fOrder= orderFlag;
}
-
+
public int getOrder() {
return fOrder;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
*/
public String getText(Object object) {
return getStyledText(object).getString();
}
-
+
public StyledString getStyledText(Object element) {
if (element instanceof LineElement)
return getLineElementLabel((LineElement) element);
-
+
if (!(element instanceof IResource))
return new StyledString();
IResource resource= (IResource) element;
if (!resource.exists())
new StyledString(SearchMessages.FileLabelProvider_removed_resource_label);
-
+
String name= BasicElementLabels.getResourceName(resource);
if (fOrder == SHOW_LABEL) {
return getColoredLabelWithCounts(resource, new StyledString(name));
}
-
+
String pathString= BasicElementLabels.getPathLabel(resource.getParent().getFullPath(), false);
if (fOrder == SHOW_LABEL_PATH) {
StyledString str= new StyledString(name);
@@ -116,12 +115,12 @@ public class FileLabelProvider extends LabelProvider implements IStyledLabelProv
String lineNumberString= Messages.format(SearchMessages.FileLabelProvider_line_number, new Integer(lineNumber));
StyledString str= new StyledString(lineNumberString, StyledString.QUALIFIER_STYLER);
-
+
Match[] matches= lineElement.getMatches(fPage.getInput());
Arrays.sort(matches, fMatchComparator);
-
+
String content= lineElement.getContents();
-
+
int pos= evaluateLineStart(matches, content, lineElement.getOffset());
int length= content.length();
@@ -166,7 +165,7 @@ public class FileLabelProvider extends LabelProvider implements IStyledLabelProv
str.append(content.substring(start, end));
return charsToCut;
}
-
+
int context= MIN_MATCH_CONTEXT;
if (gapLength > charsToCut) {
context+= gapLength - charsToCut;
@@ -184,7 +183,7 @@ public class FileLabelProvider extends LabelProvider implements IStyledLabelProv
}
return charsToCut - gapLength + fgEllipses.length();
}
-
+
private int getCharsToCut(int contentLength, Match[] matches) {
if (contentLength <= 256 || !"win32".equals(SWT.getPlatform()) || matches.length == 0) { //$NON-NLS-1$
@@ -211,21 +210,21 @@ public class FileLabelProvider extends LabelProvider implements IStyledLabelProv
}
return max;
}
-
+
private StyledString getColoredLabelWithCounts(Object element, StyledString coloredName) {
AbstractTextSearchResult result= fPage.getInput();
if (result == null)
return coloredName;
-
+
int matchCount= result.getMatchCount(element);
if (matchCount <= 1)
return coloredName;
-
+
String countInfo= Messages.format(SearchMessages.FileLabelProvider_count_format, new Integer(matchCount));
coloredName.append(' ').append(countInfo, StyledString.COUNTER_STYLER);
return coloredName;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
*/
@@ -288,5 +287,5 @@ public class FileLabelProvider extends LabelProvider implements IStyledLabelProv
}
return string; // no change
}
-
+
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileMatch.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileMatch.java
index 92aa7037f76..6e93634904c 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileMatch.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileMatch.java
@@ -24,19 +24,19 @@ import org.eclipse.search.ui.text.Match;
public class FileMatch extends Match {
private LineElement fLineElement;
private Region fOriginalLocation;
-
+
public FileMatch(IFile element) {
super(element, -1, -1);
fLineElement= null;
fOriginalLocation= null;
}
-
+
public FileMatch(IFile element, int offset, int length, LineElement lineEntry) {
super(element, offset, length);
Assert.isLegal(lineEntry != null);
fLineElement= lineEntry;
}
-
+
public void setOffset(int offset) {
if (fOriginalLocation == null) {
// remember the original location before changing it
@@ -44,7 +44,7 @@ public class FileMatch extends Match {
}
super.setOffset(offset);
}
-
+
public void setLength(int length) {
if (fOriginalLocation == null) {
// remember the original location before changing it
@@ -52,30 +52,30 @@ public class FileMatch extends Match {
}
super.setLength(length);
}
-
+
public int getOriginalOffset() {
if (fOriginalLocation != null) {
return fOriginalLocation.getOffset();
}
return getOffset();
}
-
+
public int getOriginalLength() {
if (fOriginalLocation != null) {
return fOriginalLocation.getLength();
}
return getLength();
}
-
-
+
+
public LineElement getLineElement() {
return fLineElement;
}
-
+
public IFile getFile() {
return (IFile) getElement();
}
-
+
public boolean isFileSearch() {
return fLineElement == null;
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java
index 993ba613c82..880db15befc 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java
@@ -15,14 +15,14 @@ package org.eclipse.search.internal.ui.text;
import java.util.Set;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.Transfer;
-
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.dialogs.ErrorDialog;
@@ -48,27 +48,26 @@ import org.eclipse.ui.part.IShowInTargetList;
import org.eclipse.ui.part.ResourceTransfer;
import org.eclipse.ui.views.navigator.NavigatorDragAdapter;
+import org.eclipse.search.internal.ui.Messages;
+import org.eclipse.search.internal.ui.SearchMessages;
import org.eclipse.search.ui.IContextMenuConstants;
import org.eclipse.search.ui.ISearchResultViewPart;
import org.eclipse.search.ui.text.AbstractTextSearchResult;
import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
import org.eclipse.search.ui.text.Match;
-import org.eclipse.search.internal.ui.Messages;
-import org.eclipse.search.internal.ui.SearchMessages;
-
import org.eclipse.search2.internal.ui.OpenSearchPreferencesAction;
public class FileSearchPage extends AbstractTextSearchViewPage implements IAdaptable {
-
+
public static class DecoratorIgnoringViewerSorter extends ViewerComparator {
private final ILabelProvider fLabelProvider;
-
+
public DecoratorIgnoringViewerSorter(ILabelProvider labelProvider) {
fLabelProvider= labelProvider;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ViewerComparator#category(java.lang.Object)
*/
@@ -78,7 +77,7 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
}
return 2;
}
-
+
public int compare(Viewer viewer, Object e1, Object e2) {
int cat1 = category(e1);
int cat2 = category(e2);
@@ -86,13 +85,13 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
if (cat1 != cat2) {
return cat1 - cat2;
}
-
+
if (e1 instanceof LineElement && e2 instanceof LineElement) {
LineElement m1= (LineElement) e1;
LineElement m2= (LineElement) e2;
return m1.getOffset() - m2.getOffset();
}
-
+
String name1= fLabelProvider.getText(e1);
String name2= fLabelProvider.getText(e2);
if (name1 == null)
@@ -102,10 +101,10 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
return getComparator().compare(name1, name2);
}
}
-
+
private static final String KEY_SORTING= "org.eclipse.search.resultpage.sorting"; //$NON-NLS-1$
private static final String KEY_LIMIT= "org.eclipse.search.resultpage.limit"; //$NON-NLS-1$
-
+
private static final int DEFAULT_ELEMENT_LIMIT = 1000;
private ActionGroup fActionGroup;
@@ -113,10 +112,10 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
private int fCurrentSortOrder;
private SortAction fSortByNameAction;
private SortAction fSortByPathAction;
-
+
private EditorOpener fEditorOpener= new EditorOpener();
-
+
private static final String[] SHOW_IN_TARGETS= new String[] { IPageLayout.ID_RES_NAV };
private static final IShowInTargetList SHOW_IN_TARGET_LIST= new IShowInTargetList() {
public String[] getShowInTargetIds() {
@@ -125,27 +124,27 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
};
public FileSearchPage() {
- fSortByNameAction= new SortAction(SearchMessages.FileSearchPage_sort_name_label, this, FileLabelProvider.SHOW_LABEL_PATH);
- fSortByPathAction= new SortAction(SearchMessages.FileSearchPage_sort_path_label, this, FileLabelProvider.SHOW_PATH_LABEL);
+ fSortByNameAction= new SortAction(SearchMessages.FileSearchPage_sort_name_label, this, FileLabelProvider.SHOW_LABEL_PATH);
+ fSortByPathAction= new SortAction(SearchMessages.FileSearchPage_sort_path_label, this, FileLabelProvider.SHOW_PATH_LABEL);
setElementLimit(new Integer(DEFAULT_ELEMENT_LIMIT));
}
-
+
public void setElementLimit(Integer elementLimit) {
super.setElementLimit(elementLimit);
int limit= elementLimit.intValue();
getSettings().put(KEY_LIMIT, limit);
- }
-
+ }
+
public StructuredViewer getViewer() {
return super.getViewer();
}
-
+
private void addDragAdapters(StructuredViewer viewer) {
Transfer[] transfers= new Transfer[] { ResourceTransfer.getInstance() };
int ops= DND.DROP_COPY | DND.DROP_LINK;
viewer.addDragSupport(ops, transfers, new NavigatorDragAdapter(viewer));
- }
+ }
protected void configureTableViewer(TableViewer viewer) {
viewer.setUseHashlookup(true);
@@ -171,12 +170,12 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
IFile file= (IFile) match.getElement();
IWorkbenchPage page= getSite().getPage();
if (offset >= 0 && length != 0) {
- fEditorOpener.openAndSelect(page, file, offset, length, activate);
+ fEditorOpener.openAndSelect(page, file, offset, length, activate);
} else {
fEditorOpener.open(page, file, activate);
}
}
-
+
protected void handleOpen(OpenEvent event) {
if (showLineMatches()) {
Object firstElement= ((IStructuredSelection)event.getSelection()).getFirstElement();
@@ -185,7 +184,7 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
try {
fEditorOpener.open(getSite().getPage(), (IFile) firstElement, false);
} catch (PartInitException e) {
- ErrorDialog.openError(getSite().getShell(), SearchMessages.FileSearchPage_open_file_dialog_title, SearchMessages.FileSearchPage_open_file_failed, e.getStatus());
+ ErrorDialog.openError(getSite().getShell(), SearchMessages.FileSearchPage_open_file_dialog_title, SearchMessages.FileSearchPage_open_file_failed, e.getStatus());
}
return;
}
@@ -193,7 +192,7 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
}
super.handleOpen(event);
}
-
+
protected void fillContextMenu(IMenuManager mgr) {
super.fillContextMenu(mgr);
addSortActions(mgr);
@@ -206,24 +205,24 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
ReplaceAction replaceSelection= new ReplaceAction(getSite().getShell(), (FileSearchResult) getInput(), selection.toArray(), true);
replaceSelection.setText(SearchMessages.ReplaceAction_label_selected);
mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceSelection);
-
+
}
ReplaceAction replaceAll= new ReplaceAction(getSite().getShell(), (FileSearchResult) getInput(), null, true);
replaceAll.setText(SearchMessages.ReplaceAction_label_all);
mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceAll);
}
}
-
+
private void addSortActions(IMenuManager mgr) {
if (getLayout() != FLAG_LAYOUT_FLAT)
return;
- MenuManager sortMenu= new MenuManager(SearchMessages.FileSearchPage_sort_by_label);
+ MenuManager sortMenu= new MenuManager(SearchMessages.FileSearchPage_sort_by_label);
sortMenu.add(fSortByNameAction);
sortMenu.add(fSortByPathAction);
-
+
fSortByNameAction.setChecked(fCurrentSortOrder == fSortByNameAction.getSortOrder());
fSortByPathAction.setChecked(fCurrentSortOrder == fSortByPathAction.getSortOrder());
-
+
mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenu);
}
@@ -231,13 +230,13 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
super.setViewPart(part);
fActionGroup= new NewTextSearchActionGroup(part);
}
-
+
public void init(IPageSite site) {
super.init(site);
IMenuManager menuManager = site.getActionBars().getMenuManager();
menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new OpenSearchPreferencesAction());
}
-
+
public void dispose() {
fActionGroup.dispose();
super.dispose();
@@ -260,7 +259,7 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
getViewer().refresh();
getSettings().put(KEY_SORTING, fCurrentSortOrder);
}
-
+
public void restoreState(IMemento memento) {
super.restoreState(memento);
try {
@@ -277,7 +276,7 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
Integer value= memento.getInteger(KEY_SORTING);
if (value != null)
fCurrentSortOrder= value.intValue();
-
+
value= memento.getInteger(KEY_LIMIT);
if (value != null)
elementLimit= value.intValue();
@@ -289,14 +288,14 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
memento.putInteger(KEY_SORTING, fCurrentSortOrder);
memento.putInteger(KEY_LIMIT, getElementLimit().intValue());
}
-
+
public Object getAdapter(Class adapter) {
if (IShowInTargetList.class.equals(adapter)) {
return SHOW_IN_TARGET_LIST;
}
return null;
}
-
+
public String getLabel() {
String label= super.getLabel();
StructuredViewer viewer= getViewer();
@@ -321,7 +320,7 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
}
return label;
}
-
+
public int getDisplayedMatchCount(Object element) {
if (showLineMatches()) {
if (element instanceof LineElement) {
@@ -343,7 +342,7 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
}
return super.getDisplayedMatches(element);
}
-
+
protected void evaluateChangedElements(Match[] matches, Set changedElements) {
if (showLineMatches()) {
for (int i = 0; i < matches.length; i++) {
@@ -353,10 +352,10 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt
super.evaluateChangedElements(matches, changedElements);
}
}
-
+
private boolean showLineMatches() {
AbstractTextSearchResult input= getInput();
return getLayout() == FLAG_LAYOUT_TREE && input != null && !((FileSearchQuery) input.getQuery()).isFileNameSearch();
}
-
+
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java
index 12fb7889e1c..1511be5d9ce 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java
@@ -23,37 +23,35 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.ISearchResult;
-import org.eclipse.search.ui.text.AbstractTextSearchResult;
-import org.eclipse.search.ui.text.FileTextSearchScope;
-import org.eclipse.search.ui.text.Match;
-
import org.eclipse.search.core.text.TextSearchEngine;
import org.eclipse.search.core.text.TextSearchMatchAccess;
import org.eclipse.search.core.text.TextSearchRequestor;
-
import org.eclipse.search.internal.core.text.PatternConstructor;
import org.eclipse.search.internal.ui.Messages;
import org.eclipse.search.internal.ui.SearchMessages;
+import org.eclipse.search.ui.ISearchQuery;
+import org.eclipse.search.ui.ISearchResult;
+import org.eclipse.search.ui.text.AbstractTextSearchResult;
+import org.eclipse.search.ui.text.FileTextSearchScope;
+import org.eclipse.search.ui.text.Match;
public class FileSearchQuery implements ISearchQuery {
-
+
private final static class TextSearchResultCollector extends TextSearchRequestor {
-
+
private final AbstractTextSearchResult fResult;
private final boolean fIsFileSearchOnly;
private final boolean fSearchInBinaries;
private ArrayList fCachedMatches;
-
+
private TextSearchResultCollector(AbstractTextSearchResult result, boolean isFileSearchOnly, boolean searchInBinaries) {
fResult= result;
fIsFileSearchOnly= isFileSearchOnly;
fSearchInBinaries= searchInBinaries;
-
+
}
-
+
public boolean acceptFile(IFile file) throws CoreException {
if (fIsFileSearchOnly) {
fResult.addMatch(new FileMatch(file));
@@ -61,7 +59,7 @@ public class FileSearchQuery implements ISearchQuery {
flushMatches();
return true;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.search.core.text.TextSearchRequestor#reportBinaryFile(org.eclipse.core.resources.IFile)
*/
@@ -71,7 +69,7 @@ public class FileSearchQuery implements ISearchQuery {
public boolean acceptPatternMatch(TextSearchMatchAccess matchRequestor) throws CoreException {
int matchOffset= matchRequestor.getMatchOffset();
-
+
LineElement lineElement= getLineElement(matchOffset, matchRequestor);
if (lineElement != null) {
FileMatch fileMatch= new FileMatch(matchRequestor.getFile(), matchOffset, matchRequestor.getMatchLength(), lineElement);
@@ -97,7 +95,7 @@ public class FileSearchQuery implements ISearchQuery {
if (offset < lineStart) {
return null; // offset before the last line
}
-
+
int i= lineStart;
int contentLength= matchRequestor.getFileContentLength();
while (i < contentLength) {
@@ -120,7 +118,7 @@ public class FileSearchQuery implements ISearchQuery {
}
return null; // offset outside of range
}
-
+
private static String getContents(TextSearchMatchAccess matchRequestor, int start, int end) {
StringBuffer buf= new StringBuffer();
for (int i= start; i < end; i++) {
@@ -133,11 +131,11 @@ public class FileSearchQuery implements ISearchQuery {
}
return buf.toString();
}
-
+
public void beginReporting() {
fCachedMatches= new ArrayList();
}
-
+
public void endReporting() {
flushMatches();
fCachedMatches= null;
@@ -150,25 +148,25 @@ public class FileSearchQuery implements ISearchQuery {
}
}
}
-
+
private final FileTextSearchScope fScope;
private final String fSearchText;
private final boolean fIsRegEx;
private final boolean fIsCaseSensitive;
-
+
private FileSearchResult fResult;
-
+
public FileSearchQuery(String searchText, boolean isRegEx, boolean isCaseSensitive, FileTextSearchScope scope) {
fSearchText= searchText;
fIsRegEx= isRegEx;
fIsCaseSensitive= isCaseSensitive;
fScope= scope;
}
-
+
public FileTextSearchScope getSearchScope() {
return fScope;
}
-
+
public boolean canRunInBackground() {
return true;
}
@@ -176,14 +174,14 @@ public class FileSearchQuery implements ISearchQuery {
public IStatus run(final IProgressMonitor monitor) {
AbstractTextSearchResult textResult= (AbstractTextSearchResult) getSearchResult();
textResult.removeAll();
-
+
Pattern searchPattern= getSearchPattern();
boolean searchInBinaries= !isScopeAllFileTypes();
-
+
TextSearchResultCollector collector= new TextSearchResultCollector(textResult, isFileNameSearch(), searchInBinaries);
return TextSearchEngine.create().search(fScope, collector, searchPattern, monitor);
}
-
+
private boolean isScopeAllFileTypes() {
String[] fileNamePatterns= fScope.getFileNamePatterns();
if (fileNamePatterns == null)
@@ -195,16 +193,16 @@ public class FileSearchQuery implements ISearchQuery {
}
return false;
}
-
+
public String getLabel() {
- return SearchMessages.FileSearchQuery_label;
+ return SearchMessages.FileSearchQuery_label;
}
-
+
public String getSearchString() {
return fSearchText;
}
-
+
public String getResultLabel(int nMatches) {
String searchString= getSearchString();
if (searchString.length() > 0) {
@@ -216,7 +214,7 @@ public class FileSearchQuery implements ISearchQuery {
return Messages.format(SearchMessages.FileSearchQuery_singularLabel, args);
}
Object[] args= { searchString, new Integer(nMatches), fScope.getDescription() };
- return Messages.format(SearchMessages.FileSearchQuery_pluralPattern, args);
+ return Messages.format(SearchMessages.FileSearchQuery_pluralPattern, args);
}
// search selected file extensions
if (nMatches == 1) {
@@ -229,10 +227,10 @@ public class FileSearchQuery implements ISearchQuery {
// file search
if (nMatches == 1) {
Object[] args= { fScope.getFilterDescription(), fScope.getDescription() };
- return Messages.format(SearchMessages.FileSearchQuery_singularLabel_fileNameSearch, args);
+ return Messages.format(SearchMessages.FileSearchQuery_singularLabel_fileNameSearch, args);
}
Object[] args= { fScope.getFilterDescription(), new Integer(nMatches), fScope.getDescription() };
- return Messages.format(SearchMessages.FileSearchQuery_pluralPattern_fileNameSearch, args);
+ return Messages.format(SearchMessages.FileSearchQuery_pluralPattern_fileNameSearch, args);
}
/**
@@ -243,25 +241,25 @@ public class FileSearchQuery implements ISearchQuery {
*/
public IStatus searchInFile(final AbstractTextSearchResult result, final IProgressMonitor monitor, IFile file) {
FileTextSearchScope scope= FileTextSearchScope.newSearchScope(new IResource[] { file }, new String[] { "*" }, true); //$NON-NLS-1$
-
+
Pattern searchPattern= getSearchPattern();
TextSearchResultCollector collector= new TextSearchResultCollector(result, isFileNameSearch(), true);
-
+
return TextSearchEngine.create().search(scope, collector, searchPattern, monitor);
}
-
+
protected Pattern getSearchPattern() {
return PatternConstructor.createPattern(fSearchText, fIsCaseSensitive, fIsRegEx);
}
-
+
public boolean isFileNameSearch() {
return fSearchText.length() == 0;
}
-
+
public boolean isRegexSearch() {
return fIsRegEx;
}
-
+
public boolean isCaseSensitive() {
return fIsCaseSensitive;
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchResult.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchResult.java
index 6ea92050df3..38a88dfbd74 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchResult.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchResult.java
@@ -18,17 +18,16 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.search.internal.ui.SearchPluginImages;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.text.AbstractTextSearchResult;
import org.eclipse.search.ui.text.IEditorMatchAdapter;
import org.eclipse.search.ui.text.IFileMatchAdapter;
import org.eclipse.search.ui.text.Match;
-import org.eclipse.search.internal.ui.SearchPluginImages;
-
public class FileSearchResult extends AbstractTextSearchResult implements IEditorMatchAdapter, IFileMatchAdapter {
private final Match[] EMPTY_ARR= new Match[0];
-
+
private FileSearchQuery fQuery;
public FileSearchResult(FileSearchQuery job) {
@@ -62,7 +61,7 @@ public class FileSearchResult extends AbstractTextSearchResult implements IEdito
}
return false;
}
-
+
public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) {
IEditorInput ei= editor.getEditorInput();
if (ei instanceof IFileEditorInput) {
@@ -75,11 +74,11 @@ public class FileSearchResult extends AbstractTextSearchResult implements IEdito
public ISearchQuery getQuery() {
return fQuery;
}
-
+
public IFileMatchAdapter getFileMatchAdapter() {
return this;
}
-
+
public IEditorMatchAdapter getEditorMatchAdapter() {
return this;
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileTableContentProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileTableContentProvider.java
index c39a9d18da2..d53bf02d619 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileTableContentProvider.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileTableContentProvider.java
@@ -17,20 +17,20 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.search.ui.text.AbstractTextSearchResult;
public class FileTableContentProvider implements IStructuredContentProvider, IFileSearchContentProvider {
-
+
private final Object[] EMPTY_ARR= new Object[0];
-
+
private FileSearchPage fPage;
private AbstractTextSearchResult fResult;
public FileTableContentProvider(FileSearchPage page) {
fPage= page;
}
-
+
public void dispose() {
// nothing to do
}
-
+
public Object[] getElements(Object inputElement) {
if (inputElement instanceof FileSearchResult) {
int elementLimit= getElementLimit();
@@ -44,13 +44,13 @@ public class FileTableContentProvider implements IStructuredContentProvider, IFi
}
return EMPTY_ARR;
}
-
+
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (newInput instanceof FileSearchResult) {
fResult= (FileSearchResult) newInput;
}
}
-
+
public void elementsChanged(Object[] updatedElements) {
TableViewer viewer= getViewer();
int elementLimit= getElementLimit();
@@ -75,7 +75,7 @@ public class FileTableContentProvider implements IStructuredContentProvider, IFi
private TableViewer getViewer() {
return (TableViewer) fPage.getViewer();
}
-
+
public void clear() {
getViewer().refresh();
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileTreeContentProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileTreeContentProvider.java
index ae9eea952b5..98ae326e193 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileTreeContentProvider.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileTreeContentProvider.java
@@ -36,12 +36,12 @@ public class FileTreeContentProvider implements ITreeContentProvider, IFileSearc
private FileSearchPage fPage;
private AbstractTreeViewer fTreeViewer;
private Map fChildrenMap;
-
+
FileTreeContentProvider(FileSearchPage page, AbstractTreeViewer viewer) {
fPage= page;
fTreeViewer= viewer;
}
-
+
public Object[] getElements(Object inputElement) {
Object[] children= getChildren(inputElement);
int elementLimit= getElementLimit();
@@ -52,26 +52,26 @@ public class FileTreeContentProvider implements ITreeContentProvider, IFileSearc
}
return children;
}
-
+
private int getElementLimit() {
return fPage.getElementLimit().intValue();
}
-
+
public void dispose() {
// nothing to do
}
-
+
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (newInput instanceof FileSearchResult) {
initialize((FileSearchResult) newInput);
}
}
-
+
private synchronized void initialize(AbstractTextSearchResult result) {
fResult= result;
fChildrenMap= new HashMap();
boolean showLineMatches= !((FileSearchQuery) fResult.getQuery()).isFileNameSearch();
-
+
if (result != null) {
Object[] elements= result.getElements();
for (int i= 0; i < elements.length; i++) {
@@ -109,7 +109,7 @@ public class FileTreeContentProvider implements ITreeContentProvider, IFileSearc
/**
* returns true if the child already was a child of parent.
- *
+ *
* @param parent
* @param child
* @return Returns <code>trye</code> if the child was added
@@ -122,16 +122,16 @@ public class FileTreeContentProvider implements ITreeContentProvider, IFileSearc
}
return children.add(child);
}
-
+
private boolean hasChild(Object parent, Object child) {
Set children= (Set) fChildrenMap.get(parent);
return children != null && children.contains(child);
}
-
+
private void remove(Object element, boolean refreshViewer) {
// precondition here: fResult.getMatchCount(child) <= 0
-
+
if (hasChildren(element)) {
if (refreshViewer)
fTreeViewer.refresh(element);
@@ -162,8 +162,8 @@ public class FileTreeContentProvider implements ITreeContentProvider, IFileSearc
}
return fResult.getMatchCount(element) > 0;
}
-
-
+
+
private void removeFromSiblings(Object element, Object parent) {
Set siblings= (Set) fChildrenMap.get(parent);
if (siblings != null) {
@@ -192,7 +192,7 @@ public class FileTreeContentProvider implements ITreeContentProvider, IFileSearc
// change events to elements are reported in file search
if (fResult.getMatchCount(updatedElements[i]) > 0)
insert(updatedElements[i], true);
- else
+ else
remove(updatedElements[i], true);
} else {
// change events to line elements are reported in text search
@@ -226,7 +226,7 @@ public class FileTreeContentProvider implements ITreeContentProvider, IFileSearc
if (element instanceof LineElement) {
return ((LineElement) element).getParent();
}
-
+
if (element instanceof FileMatch) {
FileMatch match= (FileMatch) element;
return match.getLineElement();
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/LineElement.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/LineElement.java
index c30c33a983c..389c2916f36 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/LineElement.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/LineElement.java
@@ -20,7 +20,7 @@ import org.eclipse.search.ui.text.Match;
/**
* Element representing a line in a file
- *
+ *
*/
public class LineElement {
@@ -40,7 +40,7 @@ public class LineElement {
public IResource getParent() {
return fParent;
}
-
+
public int getLine() {
return fLineNumber;
}
@@ -48,7 +48,7 @@ public class LineElement {
public String getContents() {
return fLineContents;
}
-
+
public int getOffset() {
return fLineStartOffset;
}
@@ -56,7 +56,7 @@ public class LineElement {
public boolean contains(int offset) {
return fLineStartOffset <= offset && offset < fLineStartOffset + fLineContents.length();
}
-
+
public int getLength() {
return fLineContents.length();
}
@@ -72,7 +72,7 @@ public class LineElement {
}
return (FileMatch[]) res.toArray(new FileMatch[res.size()]);
}
-
+
public int getNumberOfMatches(AbstractTextSearchResult result) {
int count= 0;
Match[] matches= result.getMatches(fParent);
@@ -84,6 +84,6 @@ public class LineElement {
}
return count;
}
-
-
+
+
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/NewTextSearchActionGroup.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/NewTextSearchActionGroup.java
index 6fb0722053f..f20cac17726 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/NewTextSearchActionGroup.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/NewTextSearchActionGroup.java
@@ -29,23 +29,22 @@ import org.eclipse.ui.actions.OpenFileAction;
import org.eclipse.ui.actions.OpenWithMenu;
import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.search.ui.IContextMenuConstants;
-
import org.eclipse.search.internal.ui.SearchMessages;
+import org.eclipse.search.ui.IContextMenuConstants;
/**
* 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
*/
public class NewTextSearchActionGroup extends ActionGroup {
- private ISelectionProvider fSelectionProvider;
+ private ISelectionProvider fSelectionProvider;
private IWorkbenchPage fPage;
private OpenFileAction fOpenAction;
private PropertyDialogAction fOpenPropertiesDialog;
@@ -63,42 +62,42 @@ public class NewTextSearchActionGroup extends ActionGroup {
fOpenPropertiesDialog.selectionChanged((IStructuredSelection)selection);
else
fOpenPropertiesDialog.selectionChanged(selection);
-
+
}
-
+
public void fillContextMenu(IMenuManager menu) {
// view must exist if we create a context menu for it.
-
+
ISelection selection= getContext().getSelection();
if (selection instanceof IStructuredSelection) {
addOpenWithMenu(menu, (IStructuredSelection) selection);
if (fOpenPropertiesDialog != null && fOpenPropertiesDialog.isEnabled() && fOpenPropertiesDialog.isApplicableForSelection((IStructuredSelection) selection))
menu.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, fOpenPropertiesDialog);
}
-
+
}
-
+
private void addOpenWithMenu(IMenuManager menu, IStructuredSelection selection) {
if (selection == null)
return;
-
+
fOpenAction.selectionChanged(selection);
if (fOpenAction.isEnabled()) {
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fOpenAction);
}
-
+
if (selection.size() != 1) {
return;
}
-
+
Object o= selection.getFirstElement();
if (!(o instanceof IAdaptable))
- return;
-
+ return;
+
// Create menu
- IMenuManager submenu= new MenuManager(SearchMessages.OpenWithMenu_label);
+ IMenuManager submenu= new MenuManager(SearchMessages.OpenWithMenu_label);
submenu.add(new OpenWithMenu(fPage, (IAdaptable)o));
-
+
// Add the submenu.
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
@@ -110,8 +109,8 @@ public class NewTextSearchActionGroup extends ActionGroup {
super.fillActionBars(actionBar);
setGlobalActionHandlers(actionBar);
}
-
+
private void setGlobalActionHandlers(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), fOpenPropertiesDialog);
+ actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), fOpenPropertiesDialog);
}
-}
+}
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
index 2d3a3b3b0ef..caa5b5f465f 100644
--- 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
@@ -21,7 +21,7 @@ import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
public class ReplaceAction extends Action {
- public static class ReplaceWizard extends RefactoringWizard {
+ public static class ReplaceWizard extends RefactoringWizard {
public ReplaceWizard(ReplaceRefactoring refactoring) {
super(refactoring, RefactoringWizard.DIALOG_BASED_USER_INTERFACE);
}
@@ -33,14 +33,14 @@ public class ReplaceAction extends Action {
addPage(new ReplaceConfigurationPage((ReplaceRefactoring) getRefactoring()));
}
}
-
+
private final FileSearchResult fResult;
private final Object[] fSelection;
private final boolean fSkipFiltered;
private final Shell fShell;
/**
- * Creates the replace action to be
+ * Creates the replace action to be
* @param shell the parent shell
* @param result the file search page to
* @param selection the selected entries or <code>null</code> to replace all
@@ -52,7 +52,7 @@ public class ReplaceAction extends Action {
fSelection= selection;
fSkipFiltered= skipFiltered;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.action.Action#run()
*/
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceConfigurationPage.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceConfigurationPage.java
index efdde0a9864..4a7a7bca5e1 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceConfigurationPage.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceConfigurationPage.java
@@ -33,11 +33,9 @@ import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.text.FindReplaceDocumentAdapterContentProposalProvider;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
-
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
+
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.search.internal.core.text.PatternConstructor;
@@ -46,11 +44,14 @@ import org.eclipse.search.internal.ui.Messages;
import org.eclipse.search.internal.ui.SearchMessages;
import org.eclipse.search.internal.ui.SearchPlugin;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
+
public class ReplaceConfigurationPage extends UserInputWizardPage {
private static final String SETTINGS_GROUP= "ReplaceDialog2"; //$NON-NLS-1$
private static final String SETTINGS_REPLACE_WITH= "replace_with"; //$NON-NLS-1$
-
+
private final ReplaceRefactoring fReplaceRefactoring;
private Combo fTextField;
@@ -70,7 +71,7 @@ public class ReplaceConfigurationPage extends UserInputWizardPage {
Composite result= new Composite(parent, SWT.NONE);
GridLayout layout= new GridLayout(2, false);
result.setLayout(layout);
-
+
Label description= new Label(result, SWT.NONE);
int numberOfMatches= fReplaceRefactoring.getNumberOfMatches();
int numberOfFiles= fReplaceRefactoring.getNumberOfFiles();
@@ -83,22 +84,22 @@ public class ReplaceConfigurationPage extends UserInputWizardPage {
description.setText(Messages.format(SearchMessages.ReplaceConfigurationPage_description_many_in_one, arguments ));
}
description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
-
+
FileSearchQuery query= fReplaceRefactoring.getQuery();
-
+
Label label1= new Label(result, SWT.NONE);
label1.setText(SearchMessages.ReplaceConfigurationPage_replace_label);
-
+
Text clabel= new Text(result, SWT.BORDER | SWT.READ_ONLY);
clabel.setText(query.getSearchString());
GridData gd= new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint= convertWidthInCharsToPixels(50);
clabel.setLayoutData(gd);
-
-
+
+
Label label2= new Label(result, SWT.NONE);
label2.setText(SearchMessages.ReplaceConfigurationPage_with_label);
-
+
fTextField= new Combo(result, SWT.DROP_DOWN);
gd= new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint= convertWidthInCharsToPixels(50);
@@ -109,7 +110,7 @@ public class ReplaceConfigurationPage extends UserInputWizardPage {
updateOKStatus();
}
});
-
+
IDialogSettings settings= SearchPlugin.getDefault().getDialogSettings().getSection(SETTINGS_GROUP);
if (settings != null) {
String[] previousReplaceWith= settings.getArray(SETTINGS_REPLACE_WITH);
@@ -118,7 +119,7 @@ public class ReplaceConfigurationPage extends UserInputWizardPage {
fTextField.select(0);
}
}
-
+
ComboContentAdapter contentAdapter= new ComboContentAdapter();
FindReplaceDocumentAdapterContentProposalProvider replaceProposer= new FindReplaceDocumentAdapterContentProposalProvider(false);
fTextFieldContentAssist= new ContentAssistCommandAdapter(
@@ -127,7 +128,7 @@ public class ReplaceConfigurationPage extends UserInputWizardPage {
ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS,
new char[] {'$', '\\'},
true);
-
+
new Label(result, SWT.NONE);
fReplaceWithRegex= new Button(result, SWT.CHECK);
fReplaceWithRegex.setText(SearchMessages.ReplaceConfigurationPage_isRegex_label);
@@ -142,7 +143,7 @@ public class ReplaceConfigurationPage extends UserInputWizardPage {
fReplaceWithRegex.setSelection(false);
fReplaceWithRegex.setEnabled(false);
}
-
+
fStatusLabel= new Label(result, SWT.NULL);
gd= new GridData(GridData.FILL_HORIZONTAL);
gd.verticalAlignment= SWT.BOTTOM;
@@ -150,14 +151,14 @@ public class ReplaceConfigurationPage extends UserInputWizardPage {
fStatusLabel.setLayoutData(gd);
setContentAssistsEnablement(fReplaceWithRegex.getSelection());
-
+
setControl(result);
-
+
Dialog.applyDialogFont(result);
-
+
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ISearchHelpContextIds.REPLACE_DIALOG);
}
-
+
final void updateOKStatus() {
RefactoringStatus status= new RefactoringStatus();
if (fReplaceWithRegex != null && fReplaceWithRegex.getSelection()) {
@@ -174,11 +175,11 @@ public class ReplaceConfigurationPage extends UserInputWizardPage {
}
setPageComplete(status);
}
-
+
private void setContentAssistsEnablement(boolean enable) {
fTextFieldContentAssist.setEnabled(enable);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ltk.ui.refactoring.UserInputWizardPage#performFinish()
*/
@@ -196,7 +197,7 @@ public class ReplaceConfigurationPage extends UserInputWizardPage {
storeSettings();
return super.getNextPage();
}
-
+
private void storeSettings() {
String[] items= fTextField.getItems();
ArrayList history= new ArrayList();
@@ -216,5 +217,5 @@ public class ReplaceConfigurationPage extends UserInputWizardPage {
private void initializeRefactoring() {
fReplaceRefactoring.setReplaceString(fTextField.getText());
}
-
+
} \ No newline at end of file
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
index 81249e9e593..68006b4dbfd 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
@@ -20,11 +20,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.filebuffers.ITextFileBuffer;
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-import org.eclipse.core.filebuffers.LocationKind;
-
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -36,11 +31,28 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.filebuffers.ITextFileBuffer;
+import org.eclipse.core.filebuffers.ITextFileBufferManager;
+import org.eclipse.core.filebuffers.LocationKind;
+
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEditGroup;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.search.internal.core.text.PatternConstructor;
+import org.eclipse.search.internal.ui.Messages;
+import org.eclipse.search.internal.ui.SearchMessages;
+import org.eclipse.search.ui.text.Match;
+
+import org.eclipse.search2.internal.ui.InternalSearchUI;
+import org.eclipse.search2.internal.ui.text.PositionTracker;
+
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.Refactoring;
@@ -50,52 +62,39 @@ import org.eclipse.ltk.core.refactoring.TextEditChangeGroup;
import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
-import org.eclipse.search.ui.text.Match;
-
-import org.eclipse.search.internal.core.text.PatternConstructor;
-import org.eclipse.search.internal.ui.Messages;
-import org.eclipse.search.internal.ui.SearchMessages;
-
-import org.eclipse.search2.internal.ui.InternalSearchUI;
-import org.eclipse.search2.internal.ui.text.PositionTracker;
-
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEditGroup;
-
public class ReplaceRefactoring extends Refactoring {
-
+
private static class MatchGroup {
public TextEditChangeGroup group;
public FileMatch match;
-
+
public MatchGroup(TextEditChangeGroup group, FileMatch match) {
this.group= group;
this.match= match;
}
}
-
+
public static class SearchResultUpdateChange extends Change {
-
+
private MatchGroup[] fMatchGroups;
private Match[] fMatches;
private final FileSearchResult fResult;
private final boolean fIsRemove;
-
+
public SearchResultUpdateChange(FileSearchResult result, MatchGroup[] matchGroups, boolean isRemove) {
fResult= result;
fMatchGroups= matchGroups;
fMatches= null;
fIsRemove= isRemove;
}
-
+
public SearchResultUpdateChange(FileSearchResult result, Match[] matches, boolean isRemove) {
fResult= result;
fMatches= matches;
fMatchGroups= null;
fIsRemove= isRemove;
}
-
+
public Object getModifiedElement() {
return null;
}
@@ -110,7 +109,7 @@ public class ReplaceRefactoring extends Refactoring {
public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException, OperationCanceledException {
return new RefactoringStatus();
}
-
+
private Match[] getMatches() {
if (fMatches == null) {
ArrayList matches= new ArrayList();
@@ -138,41 +137,41 @@ public class ReplaceRefactoring extends Refactoring {
}
-
+
private final FileSearchResult fResult;
private final Object[] fSelection;
private final boolean fSkipFiltered;
-
+
private HashMap/*<IFile,Set<Match>*/ fMatches;
-
+
private String fReplaceString;
-
+
private Change fChange;
-
+
public ReplaceRefactoring(FileSearchResult result, Object[] selection, boolean skipFiltered) {
Assert.isNotNull(result);
-
+
fResult= result;
fSelection= selection;
fSkipFiltered= skipFiltered;
-
+
fMatches= new HashMap();
-
+
fReplaceString= null;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ltk.core.refactoring.Refactoring#getName()
*/
public String getName() {
return SearchMessages.ReplaceRefactoring_refactoring_name;
}
-
+
public void setReplaceString(String string) {
fReplaceString= string;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ltk.core.refactoring.Refactoring#checkInitialConditions(org.eclipse.core.runtime.IProgressMonitor)
*/
@@ -182,7 +181,7 @@ public class ReplaceRefactoring extends Refactoring {
return RefactoringStatus.createFatalErrorStatus(SearchMessages.ReplaceRefactoring_error_illegal_search_string);
}
fMatches.clear();
-
+
if (fSelection != null) {
for (int i= 0; i < fSelection.length; i++) {
collectMatches(fSelection[i]);
@@ -198,7 +197,7 @@ public class ReplaceRefactoring extends Refactoring {
}
return new RefactoringStatus();
}
-
+
private void collectMatches(Object object) throws CoreException {
if (object instanceof LineElement) {
LineElement lineElement= (LineElement) object;
@@ -231,11 +230,11 @@ public class ReplaceRefactoring extends Refactoring {
}
}
}
-
+
public int getNumberOfFiles() {
return fMatches.keySet().size();
}
-
+
public int getNumberOfMatches() {
int count= 0;
for (Iterator iterator= fMatches.values().iterator(); iterator.hasNext();) {
@@ -244,15 +243,15 @@ public class ReplaceRefactoring extends Refactoring {
}
return count;
}
-
+
public boolean hasMatches() {
return !fMatches.isEmpty();
}
-
+
private boolean isSkipped(FileMatch match) {
return !fSkipFiltered && match.isFiltered();
}
-
+
private Collection getBucket(IFile file) {
Collection col= (Collection) fMatches.get(file);
if (col == null) {
@@ -269,24 +268,24 @@ public class ReplaceRefactoring extends Refactoring {
if (fReplaceString == null) {
return RefactoringStatus.createFatalErrorStatus(SearchMessages.ReplaceRefactoring_error_no_replace_string);
}
-
+
Pattern pattern= null;
FileSearchQuery query= getQuery();
if (query.isRegexSearch()) {
pattern= createSearchPattern(query);
}
-
+
RefactoringStatus resultingStatus= new RefactoringStatus();
-
+
Collection allFiles= fMatches.keySet();
checkFilesToBeChanged((IFile[]) allFiles.toArray(new IFile[allFiles.size()]), resultingStatus);
if (resultingStatus.hasFatalError()) {
return resultingStatus;
}
-
+
CompositeChange compositeChange= new CompositeChange(SearchMessages.ReplaceRefactoring_composite_change_name);
compositeChange.markAsSynthetic();
-
+
ArrayList matchGroups= new ArrayList();
boolean hasChanges= false;
try {
@@ -316,11 +315,11 @@ public class ReplaceRefactoring extends Refactoring {
}
compositeChange.add(new SearchResultUpdateChange(fResult, (MatchGroup[]) matchGroups.toArray(new MatchGroup[matchGroups.size()]), true));
-
+
fChange= compositeChange;
return resultingStatus;
}
-
+
private void checkFilesToBeChanged(IFile[] filesToBeChanged, RefactoringStatus resultingStatus) throws CoreException {
ArrayList readOnly= new ArrayList();
for (int i= 0; i < filesToBeChanged.length; i++) {
@@ -329,7 +328,7 @@ public class ReplaceRefactoring extends Refactoring {
readOnly.add(file);
}
IFile[] readOnlyFiles= (IFile[]) readOnly.toArray(new IFile[readOnly.size()]);
-
+
IStatus status= ResourcesPlugin.getWorkspace().validateEdit(readOnlyFiles, getValidationContext());
if (status.getSeverity() == IStatus.CANCEL) {
throw new OperationCanceledException();
@@ -343,10 +342,10 @@ public class ReplaceRefactoring extends Refactoring {
private TextChange createFileChange(IFile file, Pattern pattern, Collection/*FileMatch*/ matches, RefactoringStatus resultingStatus, Collection matchGroups) throws PatternSyntaxException, CoreException {
PositionTracker tracker= InternalSearchUI.getInstance().getPositionTracker();
-
+
TextFileChange change= new TextFileChange(Messages.format(SearchMessages.ReplaceRefactoring_group_label_change_for_file, file.getName()), file);
change.setEdit(new MultiTextEdit());
-
+
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connect(file.getFullPath(), LocationKind.IFILE, null);
try {
@@ -357,7 +356,7 @@ public class ReplaceRefactoring extends Refactoring {
}
IDocument document= textFileBuffer.getDocument();
String lineDelimiter= TextUtilities.getDefaultLineDelimiter(document);
-
+
for (Iterator iterator= matches.iterator(); iterator.hasNext();) {
FileMatch match= (FileMatch) iterator.next();
int offset= match.getOffset();
@@ -370,19 +369,19 @@ public class ReplaceRefactoring extends Refactoring {
continue;
}
}
-
+
String originalText= getOriginalText(document, offset, length);
if (originalText == null) {
resultingStatus.addError(Messages.format(SearchMessages.ReplaceRefactoring_error_match_content_changed, file.getName()));
continue;
}
-
+
String replacementString= computeReplacementString(pattern, originalText, fReplaceString, lineDelimiter);
if (replacementString == null) {
resultingStatus.addError(Messages.format(SearchMessages.ReplaceRefactoring_error_match_content_changed, file.getName()));
continue;
}
-
+
ReplaceEdit replaceEdit= new ReplaceEdit(offset, length, replacementString);
change.addEdit(replaceEdit);
TextEditChangeGroup textEditChangeGroup= new TextEditChangeGroup(change, new TextEditGroup(SearchMessages.ReplaceRefactoring_group_label_match_replace, replaceEdit));
@@ -394,7 +393,7 @@ public class ReplaceRefactoring extends Refactoring {
}
return change;
}
-
+
private static String getOriginalText(IDocument doc, int offset, int length) {
try {
return doc.get(offset, length);
@@ -402,16 +401,16 @@ public class ReplaceRefactoring extends Refactoring {
return null;
}
}
-
+
private Pattern createSearchPattern(FileSearchQuery query) {
return PatternConstructor.createPattern(query.getSearchString(), true, true, query.isCaseSensitive(), false);
}
-
+
private String computeReplacementString(Pattern pattern, String originalText, String replacementText, String lineDelimiter) throws PatternSyntaxException {
if (pattern != null) {
try {
replacementText= PatternConstructor.interpretReplaceEscapes(replacementText, originalText, lineDelimiter);
-
+
Matcher matcher= pattern.matcher(originalText);
StringBuffer sb = new StringBuffer();
matcher.reset();
@@ -428,17 +427,17 @@ public class ReplaceRefactoring extends Refactoring {
}
return replacementText;
}
-
+
public FileSearchQuery getQuery() {
return (FileSearchQuery) fResult.getQuery();
}
-
-
+
+
/* (non-Javadoc)
* @see org.eclipse.ltk.core.refactoring.Refactoring#createChange(org.eclipse.core.runtime.IProgressMonitor)
*/
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
return fChange;
}
-
+
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/SearchResultUpdater.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/SearchResultUpdater.java
index d4b6b920bf3..200fff2b552 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/SearchResultUpdater.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/SearchResultUpdater.java
@@ -20,14 +20,13 @@ import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.IQueryListener;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.search.ui.text.AbstractTextSearchResult;
import org.eclipse.search.ui.text.Match;
-import org.eclipse.search.internal.ui.SearchPlugin;
-
public class SearchResultUpdater implements IResourceChangeListener, IQueryListener {
private AbstractTextSearchResult fResult;
@@ -79,7 +78,7 @@ public class SearchResultUpdater implements IResourceChangeListener, IQueryListe
NewSearchUI.removeQueryListener(this);
}
}
-
+
public void queryStarting(ISearchQuery query) {
// don't care
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/SortAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/SortAction.java
index d25892bed03..463f6978cb9 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/SortAction.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/SortAction.java
@@ -15,7 +15,7 @@ import org.eclipse.jface.action.Action;
public class SortAction extends Action {
private int fSortOrder;
private FileSearchPage fPage;
-
+
public SortAction(String label, FileSearchPage page, int sortOrder) {
super(label);
fPage= page;
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
index 46b08289635..54e315710b3 100644
--- 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
@@ -22,15 +22,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.regex.PatternSyntaxException;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.ModifyEvent;
@@ -45,6 +36,15 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.dialogs.ErrorDialog;
@@ -63,8 +63,15 @@ import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
+
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+import org.eclipse.search.internal.core.text.PatternConstructor;
+import org.eclipse.search.internal.ui.ISearchHelpContextIds;
+import org.eclipse.search.internal.ui.SearchMessages;
+import org.eclipse.search.internal.ui.SearchPlugin;
+import org.eclipse.search.internal.ui.util.FileTypeEditor;
+import org.eclipse.search.internal.ui.util.SWTUtil;
import org.eclipse.search.ui.IReplacePage;
import org.eclipse.search.ui.ISearchPage;
import org.eclipse.search.ui.ISearchPageContainer;
@@ -76,13 +83,6 @@ import org.eclipse.search.ui.text.FileTextSearchScope;
import org.eclipse.search.ui.text.TextSearchQueryProvider;
import org.eclipse.search.ui.text.TextSearchQueryProvider.TextSearchInput;
-import org.eclipse.search.internal.core.text.PatternConstructor;
-import org.eclipse.search.internal.ui.ISearchHelpContextIds;
-import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.internal.ui.util.FileTypeEditor;
-import org.eclipse.search.internal.ui.util.SWTUtil;
-
public class TextSearchPage extends DialogPage implements ISearchPage, IReplacePage {
@@ -103,7 +103,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
private boolean fIsCaseSensitive;
private boolean fIsRegExSearch;
private boolean fSearchDerived;
-
+
private Combo fPattern;
private Button fIsCaseSensitiveCheckbox;
private Combo fExtensions;
@@ -115,7 +115,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
private FileTypeEditor fFileTypeEditor;
private ContentAssistCommandAdapter fPatterFieldContentAssist;
-
+
private static class SearchPatternData {
public final boolean isCaseSensitive;
public final boolean isRegExSearch;
@@ -123,7 +123,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
public final String[] fileNamePatterns;
public final int scope;
public final IWorkingSet[] workingSets;
-
+
public SearchPatternData(String textPattern, boolean isCaseSensitive, boolean isRegExSearch, String[] fileNamePatterns, int scope, IWorkingSet[] workingSets) {
Assert.isNotNull(fileNamePatterns);
this.isCaseSensitive= isCaseSensitive;
@@ -133,7 +133,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
this.scope= scope;
this.workingSets= workingSets; // can be null
}
-
+
public void store(IDialogSettings settings) {
settings.put("ignoreCase", !isCaseSensitive); //$NON-NLS-1$
settings.put("isRegExSearch", isRegExSearch); //$NON-NLS-1$
@@ -151,7 +151,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
}
}
-
+
public static SearchPatternData create(IDialogSettings settings) {
String textPattern= settings.get("textPattern"); //$NON-NLS-1$
String[] wsIds= settings.getArray("workingSets"); //$NON-NLS-1$
@@ -197,9 +197,9 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
return !isRegExSearch;
}
}
-
+
private static class TextSearchPageInput extends TextSearchInput {
-
+
private final String fSearchText;
private final boolean fIsCaseSensitive;
private final boolean fIsRegEx;
@@ -228,15 +228,15 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
return fScope;
}
}
-
+
//---- Action Handling ------------------------------------------------
-
+
private ISearchQuery newQuery() throws CoreException {
SearchPatternData data= getPatternData();
TextSearchPageInput input= new TextSearchPageInput(data.textPattern, data.isCaseSensitive, data.isRegExSearch, createTextSearchScope());
return TextSearchQueryProvider.getPreferred().createQuery(input);
}
-
+
public boolean performAction() {
try {
NewSearchUI.runQueryInBackground(newQuery());
@@ -246,7 +246,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
}
return true;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.search.ui.IReplacePage#performReplace()
*/
@@ -259,7 +259,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
if (!status.isOK()) {
ErrorDialog.openError(getShell(), SearchMessages.TextSearchPage_replace_searchproblems_title, SearchMessages.TextSearchPage_replace_runproblem_message, status);
}
-
+
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
ISearchResultViewPart view= NewSearchUI.activateSearchResultView();
@@ -282,7 +282,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
private String getPattern() {
return fPattern.getText();
}
-
+
public FileTextSearchScope createTextSearchScope() {
// Setup search scope
switch (getContainer().getSelectedScope()) {
@@ -300,7 +300,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
return FileTextSearchScope.newWorkspaceScope(getExtensions(), fSearchDerived);
}
}
-
+
private FileTextSearchScope getSelectedResourcesScope() {
HashSet resources= new HashSet();
ISelection sel= getContainer().getSelection();
@@ -337,17 +337,17 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
if (enclosingProjectName == null) {
return FileTextSearchScope.newWorkspaceScope(getExtensions(), fSearchDerived);
}
-
+
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
IResource[] res= new IResource[enclosingProjectName.length];
for (int i= 0; i < res.length; i++) {
res[i]= root.getProject(enclosingProjectName[i]);
}
-
+
return FileTextSearchScope.newSearchScope(res, getExtensions(), fSearchDerived);
}
-
+
private SearchPatternData findInPrevious(String pattern) {
for (Iterator iter= fPreviousSearchPatterns.iterator(); iter.hasNext();) {
SearchPatternData element= (SearchPatternData) iter.next();
@@ -398,7 +398,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
patterns[i]= ((SearchPatternData) fPreviousSearchPatterns.get(i)).textPattern;
return patterns;
}
-
+
private String[] getExtensions() {
return fFileTypeEditor.getFileTypes();
}
@@ -431,7 +431,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
updateOKStatus();
super.setVisible(visible);
}
-
+
final void updateOKStatus() {
boolean regexStatus= validateRegex();
boolean hasFilePattern= fExtensions.getText().length() > 0;
@@ -443,27 +443,27 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
public void createControl(Composite parent) {
initializeDialogUnits(parent);
readConfiguration();
-
+
Composite result= new Composite(parent, SWT.NONE);
result.setFont(parent.getFont());
GridLayout layout= new GridLayout(2, false);
result.setLayout(layout);
-
+
addTextPatternControls(result);
-
+
Label separator= new Label(result, SWT.NONE);
separator.setVisible(false);
GridData data= new GridData(GridData.FILL, GridData.FILL, false, false, 2, 1);
data.heightHint= convertHeightInCharsToPixels(1) / 3;
separator.setLayoutData(data);
-
+
addFileNameControls(result);
setControl(result);
Dialog.applyDialogFont(result);
PlatformUI.getWorkbench().getHelpSystem().setHelp(result, ISearchHelpContextIds.TEXT_SEARCH_PAGE);
}
-
+
private boolean validateRegex() {
if (fIsRegExCheckbox.getSelection()) {
try {
@@ -479,7 +479,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
}
statusMessage(false, ""); //$NON-NLS-1$
} else {
- statusMessage(false, SearchMessages.SearchPage_containingText_hint);
+ statusMessage(false, SearchMessages.SearchPage_containingText_hint);
}
return true;
}
@@ -487,9 +487,9 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
private void addTextPatternControls(Composite group) {
// grid layout with 2 columns
- // Info text
+ // Info text
Label label= new Label(group, SWT.LEAD);
- label.setText(SearchMessages.SearchPage_containingText_text);
+ label.setText(SearchMessages.SearchPage_containingText_text);
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
label.setFont(group.getFont());
@@ -513,20 +513,20 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
GridData data= new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1);
data.widthHint= convertWidthInCharsToPixels(50);
fPattern.setLayoutData(data);
-
+
ComboContentAdapter contentAdapter= new ComboContentAdapter();
FindReplaceDocumentAdapterContentProposalProvider findProposer= new FindReplaceDocumentAdapterContentProposalProvider(true);
fPatterFieldContentAssist= new ContentAssistCommandAdapter(
fPattern,
contentAdapter,
- findProposer,
+ findProposer,
ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS,
new char[] {'\\', '[', '('},
true);
fPatterFieldContentAssist.setEnabled(fIsRegExSearch);
-
+
fIsCaseSensitiveCheckbox= new Button(group, SWT.CHECK);
- fIsCaseSensitiveCheckbox.setText(SearchMessages.SearchPage_caseSensitive);
+ fIsCaseSensitiveCheckbox.setText(SearchMessages.SearchPage_caseSensitive);
fIsCaseSensitiveCheckbox.setSelection(fIsCaseSensitive);
fIsCaseSensitiveCheckbox.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -541,11 +541,11 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
fStatusLabel.setFont(group.getFont());
fStatusLabel.setAlignment(SWT.LEFT);
- fStatusLabel.setText(SearchMessages.SearchPage_containingText_hint);
+ fStatusLabel.setText(SearchMessages.SearchPage_containingText_hint);
// RegEx checkbox
fIsRegExCheckbox= new Button(group, SWT.CHECK);
- fIsRegExCheckbox.setText(SearchMessages.SearchPage_regularExpression);
+ fIsRegExCheckbox.setText(SearchMessages.SearchPage_regularExpression);
fIsRegExCheckbox.setSelection(fIsRegExSearch);
fIsRegExCheckbox.addSelectionListener(new SelectionAdapter() {
@@ -565,7 +565,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
int selectionIndex= fPattern.getSelectionIndex();
if (selectionIndex < 0 || selectionIndex >= fPreviousSearchPatterns.size())
return;
-
+
SearchPatternData patternData= (SearchPatternData) fPreviousSearchPatterns.get(selectionIndex);
if (!fPattern.getText().equals(patternData.textPattern))
return;
@@ -588,14 +588,14 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
fPattern.setText(escapeForRegExPattern(text));
else
fPattern.setText(insertEscapeChars(text));
-
+
if (getPreviousExtensions().length > 0) {
fExtensions.setText(getPreviousExtensions()[0]);
} else {
String extension= getExtensionFromEditor();
if (extension != null)
fExtensions.setText(extension);
- else
+ else
fExtensions.setText("*"); //$NON-NLS-1$
}
return true;
@@ -603,7 +603,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
}
return false;
}
-
+
// private void loadFilePatternDefaults() {
// SearchMatchInformationProviderRegistry registry= SearchPlugin.getDefault().getSearchMatchInformationProviderRegistry();
// String[] defaults= registry.getDefaultFilePatterns();
@@ -633,11 +633,11 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
}
return sbOut.toString();
}
-
+
/**
* Escapes special characters in the string, such that the resulting pattern
* matches the given string.
- *
+ *
* @param string the string to escape
* @return a regex pattern that matches the given string
* @since 3.5
@@ -666,7 +666,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
case '|':
pattern.append('\\').append(ch);
break;
-
+
case '\n':
pattern.append("\\n"); //$NON-NLS-1$
break;
@@ -699,7 +699,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
pattern.insert(pattern.length() - 1, '\\');
return pattern.toString();
}
-
+
private String getExtensionFromEditor() {
IEditorPart ep= SearchPlugin.getActivePage().getActiveEditor();
@@ -717,13 +717,13 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
private void addFileNameControls(Composite group) {
// grid layout with 2 columns
-
+
// Line with label, combo and button
Label label= new Label(group, SWT.LEAD);
- label.setText(SearchMessages.SearchPage_fileNamePatterns_text);
+ label.setText(SearchMessages.SearchPage_fileNamePatterns_text);
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
label.setFont(group.getFont());
-
+
fExtensions= new Combo(group, SWT.SINGLE | SWT.BORDER);
fExtensions.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -734,25 +734,25 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
data.widthHint= convertWidthInCharsToPixels(50);
fExtensions.setLayoutData(data);
fExtensions.setFont(group.getFont());
-
+
Button button= new Button(group, SWT.PUSH);
- button.setText(SearchMessages.SearchPage_browse);
+ button.setText(SearchMessages.SearchPage_browse);
GridData gridData= new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 1);
- gridData.widthHint= SWTUtil.getButtonWidthHint(button);
+ gridData.widthHint= SWTUtil.getButtonWidthHint(button);
button.setLayoutData(gridData);
button.setFont(group.getFont());
-
+
fFileTypeEditor= new FileTypeEditor(fExtensions, button);
-
+
// Text line which explains the special characters
Label description= new Label(group, SWT.LEAD);
- description.setText(SearchMessages.SearchPage_fileNamePatterns_hint);
+ description.setText(SearchMessages.SearchPage_fileNamePatterns_hint);
description.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
description.setFont(group.getFont());
-
+
fSearchDerivedCheckbox= new Button(group, SWT.CHECK);
- fSearchDerivedCheckbox.setText(SearchMessages.TextSearchPage_searchDerived_label);
-
+ fSearchDerivedCheckbox.setText(SearchMessages.TextSearchPage_searchDerived_label);
+
fSearchDerivedCheckbox.setSelection(fSearchDerived);
fSearchDerivedCheckbox.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -771,18 +771,18 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
public void setContainer(ISearchPageContainer container) {
fContainer= container;
}
-
+
private ISearchPageContainer getContainer() {
return fContainer;
}
-
+
private ISelection getSelection() {
return fContainer.getSelection();
}
-
+
//--------------- Configuration handling --------------
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.DialogPage#dispose()
*/
@@ -790,17 +790,17 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
writeConfiguration();
super.dispose();
}
-
+
/**
* Returns the page settings for this Text search page.
- *
+ *
* @return the page settings to be used
*/
private IDialogSettings getDialogSettings() {
return SearchPlugin.getDefault().getDialogSettingsSection(PAGE_NAME);
}
-
-
+
+
/**
* Initializes itself from the stored page settings.
*/
@@ -809,7 +809,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
fIsCaseSensitive= s.getBoolean(STORE_CASE_SENSITIVE);
fIsRegExSearch= s.getBoolean(STORE_IS_REG_EX_SEARCH);
fSearchDerived= s.getBoolean(STORE_SEARCH_DERIVED);
-
+
try {
int historySize= s.getInt(STORE_HISTORY_SIZE);
for (int i= 0; i < historySize; i++) {
@@ -825,7 +825,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
// ignore
}
}
-
+
/**
* Stores it current configuration in the dialog store.
*/
@@ -834,7 +834,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
s.put(STORE_CASE_SENSITIVE, fIsCaseSensitive);
s.put(STORE_IS_REG_EX_SEARCH, fIsRegExSearch);
s.put(STORE_SEARCH_DERIVED, fSearchDerived);
-
+
int historySize= Math.min(fPreviousSearchPatterns.size(), HISTORY_SIZE);
s.put(STORE_HISTORY_SIZE, historySize);
for (int i= 0; i < historySize; i++) {
@@ -852,4 +852,4 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP
fStatusLabel.setForeground(null);
}
-}
+}
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
index ddfea673e47..477fee7d856 100644
--- 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
@@ -13,15 +13,18 @@ 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.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
+
import org.eclipse.search.internal.ui.SearchMessages;
import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.swt.widgets.Shell;
/**
* The default exception handler shows an error dialog when one of its handle methods
@@ -33,7 +36,7 @@ import org.eclipse.swt.widgets.Shell;
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>.
@@ -43,11 +46,11 @@ public class ExceptionHandler {
public static void log(Throwable t, String message) {
SearchPlugin.log(new Status(IStatus.ERROR, NewSearchUI.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
@@ -55,10 +58,10 @@ public class ExceptionHandler {
public static void handle(CoreException e, String title, String message) {
handle(e, SearchPlugin.getActiveWorkbenchShell(), title, message);
}
-
+
/**
- * Handles the given <code>CoreException</code>.
- *
+ * 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
@@ -67,11 +70,11 @@ public class ExceptionHandler {
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
+ * 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
@@ -79,10 +82,10 @@ public class ExceptionHandler {
public static void handle(InvocationTargetException e, String title, String message) {
handle(e, SearchPlugin.getActiveWorkbenchShell(), title, message);
}
-
+
/**
- * Handles the given <code>InvocationTargetException</code>.
- *
+ * 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
@@ -93,7 +96,7 @@ public class ExceptionHandler {
}
//---- 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();
@@ -127,7 +130,7 @@ public class ExceptionHandler {
public static void displayMessageDialog(Throwable t, String title, String message) {
displayMessageDialog(t, SearchPlugin.getActiveWorkbenchShell(), title, message);
}
-
+
private void displayMessageDialog(String exceptionMessage, Shell shell, String title, String message) {
StringWriter msg= new StringWriter();
if (message != null) {
@@ -135,9 +138,9 @@ public class ExceptionHandler {
msg.write("\n\n"); //$NON-NLS-1$
}
if (exceptionMessage == null || exceptionMessage.length() == 0)
- msg.write(SearchMessages.ExceptionDialog_seeErrorLogMessage);
+ msg.write(SearchMessages.ExceptionDialog_seeErrorLogMessage);
else
msg.write(exceptionMessage);
- MessageDialog.openError(shell, title, msg.toString());
- }
+ 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
index 2b8f76cff32..411bb3e7059 100644
--- 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
@@ -16,8 +16,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.GridData;
@@ -29,6 +27,8 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.core.runtime.Assert;
+
import org.eclipse.jface.dialogs.ControlEnableState;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -43,11 +43,11 @@ import org.eclipse.search.internal.ui.SearchMessages;
public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnableContext {
-
+
private Control fContents;
private Button fCancelButton;
private List fActionButtons;
- // The number of long running operation executed from the dialog.
+ // The number of long running operation executed from the dialog.
private long fActiveRunningOperations;
// The progress monitor
@@ -73,14 +73,14 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
}
//---- Hooks to reimplement in subclasses -----------------------------------
-
+
/**
* @param enable Use the embedded progress monitor part
*/
public void setUseEmbeddedProgressMonitorPart(boolean enable) {
fUseEmbeddedProgressMonitorPart= enable;
}
-
+
/**
* Hook called when the user has pressed the button to perform
* the dialog's action. If the method returns <code>false</code>
@@ -92,10 +92,10 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
protected boolean performAction(int buttonId) {
return true;
}
-
+
/**
* Hook called when the user has pressed the button to cancel
- * the dialog. If the method returns <code>false</code> the dialog
+ * the dialog. If the method returns <code>false</code> the dialog
* stays open. Otherwise the dialog is going to be closed.
* @return If the method returns <code>false</code>
* the dialog stays open.
@@ -103,7 +103,7 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
protected boolean performCancel() {
return true;
}
-
+
//---- UI creation ----------------------------------------------------------
/**
@@ -111,8 +111,8 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
* @param parent The parent composite
* @return The created control
*/
- protected abstract Control createPageArea(Composite parent);
-
+ protected abstract Control createPageArea(Composite parent);
+
/**
* Add buttons to the dialog's button bar.
*
@@ -123,14 +123,14 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
protected void createButtonsForButtonBar(Composite parent) {
fCancelButton= createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}
-
+
protected Button createActionButton(Composite parent, int id, String label,
boolean defaultButton) {
Button actionButton= createButton(parent, id, label, defaultButton);
fActionButtons.add(actionButton);
return actionButton;
}
-
+
/**
* Creates the layout of the extended dialog window.
* @param parent The parent composite
@@ -138,10 +138,10 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
*/
protected Control createDialogArea(Composite parent) {
Composite result= (Composite) super.createDialogArea(parent);
-
+
fContents= createPageArea(result);
fContents.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
if (fUseEmbeddedProgressMonitorPart) {
// Insert a progress monitor
fProgressMonitorPart= new ProgressMonitorPart(result, new GridLayout(), SWT.DEFAULT);
@@ -152,7 +152,7 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
Label separator= new Label(result, SWT.SEPARATOR | SWT.HORIZONTAL);
separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
return result;
}
@@ -161,15 +161,15 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
case IDialogConstants.CANCEL_ID:
if (fActiveRunningOperations == 0)
close();
- break;
+ break;
default:
if (performAction(buttonId))
close();
}
}
-
+
//---- Setters and Getters --------------------------------------------------
-
+
/**
* Set the enable state of the perform action button.
* @param state The new state
@@ -179,11 +179,11 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
Button element = (Button) buttons.next();
element.setEnabled(state);
}
- }
+ }
//---- Operation stuff ------------------------------------------------------
-
-
+
+
/* (non-Javadoc)
* @see org.eclipse.jface.operation.IRunnableContext#run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
*/
@@ -205,7 +205,7 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
fActiveRunningOperations--;
}
}
-
+
/**
* About to start a long running operation triggered through
* the wizard. So show the progress monitor and disable
@@ -218,35 +218,35 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
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);
-
+
if (fUseEmbeddedProgressMonitorPart) {
// 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.
@@ -258,14 +258,14 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
Shell shell= getShell();
if (shell != null) {
if (fUseEmbeddedProgressMonitorPart) {
- fProgressMonitorPart.setVisible(false);
+ fProgressMonitorPart.setVisible(false);
fProgressMonitorPart.removeFromCancelComponent(fCancelButton);
}
-
+
HashMap state= (HashMap)savedState;
restoreUIState(state);
-
- setDisplayCursor(shell.getDisplay(), null);
+
+ setDisplayCursor(shell.getDisplay(), null);
fCancelButton.setCursor(null);
fWaitCursor.dispose();
fWaitCursor= null;
@@ -276,15 +276,15 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
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);
for (Iterator actionButtons = fActionButtons.iterator(); actionButtons.hasNext(); ) {
@@ -294,7 +294,7 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
ControlEnableState pageState= (ControlEnableState)state.get("tabForm"); //$NON-NLS-1$
pageState.restore();
}
-
+
/*
* Restores the enable state of the given control.
*/
@@ -305,7 +305,7 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
w.setEnabled(b.booleanValue());
}
}
-
+
private HashMap saveUIState(boolean keepCancelEnabled) {
HashMap savedState= new HashMap(10);
saveEnableStateAndSet(fCancelButton, savedState, keepCancelEnabled);
@@ -314,16 +314,16 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
saveEnableStateAndSet(button, savedState, false);
}
savedState.put("tabForm", ControlEnableState.disable(fContents)); //$NON-NLS-1$
-
+
return savedState;
}
-
+
private void saveEnableStateAndSet(Control w, HashMap h, boolean enabled) {
if (!w.isDisposed()) {
h.put(w, new Boolean(w.isEnabled()));
w.setEnabled(enabled);
- }
- }
+ }
+ }
protected void handleShellCloseEvent() {
if (okToClose())
@@ -340,7 +340,7 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
if (fActiveRunningOperations > 0) {
synchronized (this) {
fWindowClosingDialog= createClosingDialog();
- }
+ }
fWindowClosingDialog.open();
synchronized (this) {
fWindowClosingDialog= null;
@@ -349,25 +349,25 @@ public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnab
}
return true;
}
-
+
private MessageDialog createClosingDialog() {
- MessageDialog result=
+ MessageDialog result=
new MessageDialog(
getShell(),
- SearchMessages.SearchDialogClosingDialog_title,
- null,
- SearchMessages.SearchDialogClosingDialog_message,
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL},
- 0);
- return result;
+ SearchMessages.SearchDialogClosingDialog_title,
+ null,
+ SearchMessages.SearchDialogClosingDialog_message,
+ MessageDialog.QUESTION,
+ new String[] {IDialogConstants.OK_LABEL},
+ 0);
+ return result;
}
/**
- * @return Returns the cancel component that is to be used to cancel
+ * @return 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
index 3cbff472ce9..39d92695c8e 100644
--- 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
@@ -12,10 +12,11 @@ package org.eclipse.search.internal.ui.util;
import com.ibm.icu.text.MessageFormat;
-import org.eclipse.core.resources.IResource;
+import org.eclipse.swt.graphics.Image;
+
import org.eclipse.core.runtime.IPath;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProviderListener;
@@ -24,25 +25,24 @@ 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;
+import org.eclipse.search.ui.ISearchResultViewEntry;
/**
* @deprecated Old search view
*/
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.FileLabelProvider_dashSeparated;
-
+
+ private static final String fgSeparatorFormat= SearchMessages.FileLabelProvider_dashSeparated;
+
private WorkbenchLabelProvider fLabelProvider;
private ILabelDecorator fDecorator;
-
+
private int fOrder;
private String[] fArgs= new String[2];
@@ -55,7 +55,7 @@ public class FileLabelProvider extends LabelProvider {
public void setOrder(int orderFlag) {
fOrder= orderFlag;
}
-
+
public String getText(Object element) {
if (!(element instanceof ISearchResultViewEntry))
return ""; //$NON-NLS-1$
@@ -64,8 +64,8 @@ public class FileLabelProvider extends LabelProvider {
String text= null;
if (resource == null || !resource.exists())
- text= SearchMessages.SearchResultView_removed_resource;
-
+ text= SearchMessages.SearchResultView_removed_resource;
+
else {
IPath path= resource.getFullPath().removeLastSegments(1);
if (path.getDevice() == null)
@@ -89,7 +89,7 @@ public class FileLabelProvider extends LabelProvider {
}
}
}
-
+
// Do the decoration
if (fDecorator != null) {
String decoratedText= fDecorator.decorateText(text, resource);
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
index 7704bb01e1d..9b1e5544670 100644
--- 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
@@ -31,7 +31,7 @@ import org.eclipse.ui.dialogs.TypeFilteringDialog;
import org.eclipse.search.internal.ui.SearchMessages;
public class FileTypeEditor extends SelectionAdapter implements DisposeListener {
-
+
private Combo fTextField;
private Button fBrowseButton;
@@ -55,12 +55,12 @@ public class FileTypeEditor extends SelectionAdapter implements DisposeListener
public FileTypeEditor(Combo textField, Button browseButton) {
fTextField= textField;
fBrowseButton= browseButton;
-
+
fTextField.addDisposeListener(this);
fBrowseButton.addDisposeListener(this);
fBrowseButton.addSelectionListener(this);
}
-
+
public void widgetDisposed(DisposeEvent event) {
Widget widget= event.widget;
if (widget == fTextField)
@@ -68,12 +68,12 @@ public class FileTypeEditor extends SelectionAdapter implements DisposeListener
else if (widget == fBrowseButton)
fBrowseButton= null;
}
-
+
public void widgetSelected(SelectionEvent event) {
if (event.widget == fBrowseButton)
handleBrowseButton();
}
-
+
public String[] getFileTypes() {
Set result= new HashSet();
StringTokenizer tokenizer= new StringTokenizer(fTextField.getText(), TYPE_DELIMITER);
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
index 13b44624622..ea0889be3b0 100644
--- 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
@@ -36,15 +36,15 @@ 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);
@@ -53,24 +53,24 @@ public class ListDialog extends SelectionDialog {
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());
+ 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
*/
@@ -99,7 +99,7 @@ public class ListDialog extends SelectionDialog {
applyDialogFont(table);
return table;
}
-
+
/*
* Overrides method from Dialog
*/
@@ -107,9 +107,9 @@ public class ListDialog extends SelectionDialog {
if (! fCreateCancelButton)
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
else
- super.createButtonsForButtonBar(parent);
- }
-
+ super.createButtonsForButtonBar(parent);
+ }
+
/*
* Overrides method from Dialog
*/
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/PixelConverter.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/PixelConverter.java
index 4fd00e7f13d..fd66502de32 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/PixelConverter.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/PixelConverter.java
@@ -17,16 +17,16 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.jface.dialogs.Dialog;
public class PixelConverter {
-
+
private FontMetrics fFontMetrics;
-
+
public PixelConverter(Control control) {
GC gc = new GC(control);
gc.setFont(control.getFont());
fFontMetrics= gc.getFontMetrics();
gc.dispose();
}
-
+
/*
* @see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int)
*/
@@ -47,12 +47,12 @@ public class PixelConverter {
public int convertVerticalDLUsToPixels(int dlus) {
return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
}
-
+
/*
* @see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int)
*/
public int convertWidthInCharsToPixels(int chars) {
return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);
- }
+ }
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/util/SWTUtil.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/util/SWTUtil.java
index 08bac0d5959..57d1e394d53 100644
--- 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
@@ -11,8 +11,6 @@
package org.eclipse.search.internal.ui.util;
-import org.eclipse.core.runtime.Assert;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DragSource;
import org.eclipse.swt.dnd.DropTarget;
@@ -27,14 +25,16 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Widget;
+import org.eclipse.core.runtime.Assert;
+
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.JFaceResources;
/**
- * Utility class to simplify access to some SWT resources.
+ * 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
@@ -46,9 +46,9 @@ public class SWTUtil {
display= Display.getCurrent();
if (display == null)
display= Display.getDefault();
- return display;
+ 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.
@@ -69,8 +69,8 @@ public class SWTUtil {
return ((Menu)widget).getParent().getShell();
if (widget instanceof ScrollBar)
return ((ScrollBar)widget).getParent().getShell();
-
- return null;
+
+ return null;
}
@@ -90,26 +90,26 @@ public class SWTUtil {
* 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 button 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).widthHint= getButtonWidthHint(button);
- ((GridData)gd).horizontalAlignment = GridData.FILL;
+ ((GridData)gd).widthHint= getButtonWidthHint(button);
+ ((GridData)gd).horizontalAlignment = GridData.FILL;
}
}
-
+
public static int getTableHeightHint(Table table, int rows) {
if (table.getFont().equals(JFaceResources.getDefaultFont()))
table.setFont(JFaceResources.getDialogFont());
int result= table.getItemHeight() * rows + table.getHeaderHeight();
if (table.getLinesVisible())
result+= table.getGridLineWidth() * (rows - 1);
- return result;
+ return result;
}
-
+
}
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/IActionGroupFactory.java b/org.eclipse.search/search/org/eclipse/search/ui/IActionGroupFactory.java
index 8d32d46511d..f2376086390 100644
--- a/org.eclipse.search/search/org/eclipse/search/ui/IActionGroupFactory.java
+++ b/org.eclipse.search/search/org/eclipse/search/ui/IActionGroupFactory.java
@@ -10,11 +10,12 @@
*******************************************************************************/
package org.eclipse.search.ui;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.jface.resource.ImageDescriptor;
+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.action.IAction;
+
+import org.eclipse.ui.actions.ActionGroup;
/**
* Allows to specify an <code>ActionGroup</code> factory
@@ -24,14 +25,14 @@ import org.eclipse.jface.action.IAction;
* <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(IActionGroupFactory, String, String, ImageDescriptor, String, ILabelProvider, IAction, IGroupByKeyComputer, IRunnableWithProgress)
* @since 2.0
- * @deprecated Part of the old ('classic') search result view. Since 3.0 clients can create their own search result view pages (see {@link ISearchResultPage}), leaving it up to the page
+ * @deprecated Part of the old ('classic') search result view. Since 3.0 clients can create their own search result view pages (see {@link ISearchResultPage}), leaving it up to the page
* how to create actions.
*/
public interface IActionGroupFactory {
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/IContextMenuContributor.java b/org.eclipse.search/search/org/eclipse/search/ui/IContextMenuContributor.java
index 80bf854e501..4db5da62a21 100644
--- a/org.eclipse.search/search/org/eclipse/search/ui/IContextMenuContributor.java
+++ b/org.eclipse.search/search/org/eclipse/search/ui/IContextMenuContributor.java
@@ -10,12 +10,12 @@
*******************************************************************************/
package org.eclipse.search.ui;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.IInputSelectionProvider;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IInputSelectionProvider;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.action.IAction;
/**
* Specify how clients can add menu items
@@ -23,9 +23,9 @@ import org.eclipse.jface.action.IAction;
* 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(IActionGroupFactory, String, String, ImageDescriptor, String, ILabelProvider, IAction, IGroupByKeyComputer, IRunnableWithProgress)
- * @deprecated Part of the old ('classic') search result view. Since 3.0 clients can create their own search result view pages (see {@link ISearchResultPage}), leaving it up to the page
+ * @deprecated Part of the old ('classic') search result view. Since 3.0 clients can create their own search result view pages (see {@link ISearchResultPage}), leaving it up to the page
* how to create actions in context menus.
*/
public interface IContextMenuContributor {
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/IGroupByKeyComputer.java b/org.eclipse.search/search/org/eclipse/search/ui/IGroupByKeyComputer.java
index c693216a29d..db0ac1b0efb 100644
--- a/org.eclipse.search/search/org/eclipse/search/ui/IGroupByKeyComputer.java
+++ b/org.eclipse.search/search/org/eclipse/search/ui/IGroupByKeyComputer.java
@@ -15,16 +15,16 @@ import org.eclipse.core.resources.IMarker;
/**
* Computes the key by which the markers in the search result view
* are grouped.
- *
+ *
* <p>
* Clients may implement this interface.
* </p>
- *
- * @deprecated Part of the old ('classic') search result view. Since 3.0 clients can create their own search result view pages (see {@link ISearchResultPage}), leaving it up to the page
+ *
+ * @deprecated Part of the old ('classic') search result view. Since 3.0 clients can create their own search result view pages (see {@link ISearchResultPage}), leaving it up to the page
* how to group search results.
*/
public interface IGroupByKeyComputer {
-
+
/**
* Computes and returns key by which the given marker is grouped.
*
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java b/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java
index 0501fd08a0d..9ca2c493715 100644
--- a/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java
+++ b/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java
@@ -34,19 +34,19 @@ import org.eclipse.ui.IViewPart;
* <p>
* This interface is not intended to be implemented by clients.
* </p>
- * @deprecated Part of the old ('classic') search result view. Since 3.0 clients can create their own search result view pages.
+ * @deprecated Part of the old ('classic') search result view. Since 3.0 clients can create their own search result view pages.
* To access the parent view, {@link org.eclipse.search.ui.ISearchResultViewPart} is used instead.
- *
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
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
+ * 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.
+ * itself can be used as key.
*
* @param groupFactory the action group factory
* or <code>null</code> if no factory is provided.
@@ -65,7 +65,7 @@ public interface ISearchResultView extends IViewPart {
* @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
*/
@@ -90,10 +90,10 @@ 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
+ * 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.
+ * 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
@@ -121,10 +121,10 @@ 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
+ * 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.
+ * 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
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultViewEntry.java b/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultViewEntry.java
index 35ae64db2b7..34e7c827627 100644
--- a/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultViewEntry.java
+++ b/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultViewEntry.java
@@ -24,9 +24,9 @@ import org.eclipse.core.resources.IResource;
* <p>
* This interface is not intended to be implemented by clients.
* </p>
- * @deprecated Part of the old ('classic') search result view. Since 3.0 clients can create their own search result view pages (see {@link ISearchResultPage}), leaving it up to the search
+ * @deprecated Part of the old ('classic') search result view. Since 3.0 clients can create their own search result view pages (see {@link ISearchResultPage}), leaving it up to the search
* how to model search results. {@link org.eclipse.search.ui.text.AbstractTextSearchResult} and {@link org.eclipse.search.ui.text.Match} can be used to port old searches to the new API design.
- *
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ISearchResultViewEntry {
@@ -53,7 +53,7 @@ public interface ISearchResultViewEntry {
* Returns the number of markers grouped by this entry.
*
* @return the number of markers
- */
+ */
public int getMatchCount();
/**
@@ -65,6 +65,6 @@ public interface ISearchResultViewEntry {
*
* @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
index 2ceefe256f4..a74352fc457 100644
--- a/org.eclipse.search/search/org/eclipse/search/ui/SearchUI.java
+++ b/org.eclipse.search/search/org/eclipse/search/ui/SearchUI.java
@@ -25,10 +25,10 @@ import org.eclipse.search.internal.ui.SearchPreferencePage;
import org.eclipse.search.internal.ui.util.ExceptionHandler;
/**
- * The central class for access to the Search Plug-in's User Interface.
- * This class cannot be instantiated; all functionality is provided by
+ * 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
@@ -37,7 +37,7 @@ import org.eclipse.search.internal.ui.util.ExceptionHandler;
*
* @see ISearchResultView
* @deprecated Part of the old ('classic') search. Since 3.0 clients can create their own search result view pages and use {@link org.eclipse.search.ui.NewSearchUI} instead.
- *
+ *
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public final class SearchUI {
@@ -48,15 +48,15 @@ public final class SearchUI {
*/
public static final String PLUGIN_ID= NewSearchUI.PLUGIN_ID;
- /**
+ /**
* Search marker type (value <code>"org.eclipse.search.searchmarker"</code>).
*
* @see org.eclipse.core.resources.IMarker
* @deprecated Use {@link NewSearchUI#SEARCH_MARKER} instead.
- */
+ */
public static final String SEARCH_MARKER= NewSearchUI.SEARCH_MARKER;
- /**
+ /**
* Line marker attribute (value <code>"line"</code>)
* The value of the marker attribute is the line which contains the text search match.
*
@@ -64,7 +64,7 @@ public final class SearchUI {
*/
public static final String LINE= "line"; //$NON-NLS-1$
- /**
+ /**
* Potential match marker attribute
* (value <code>"potentialMatch"</code>).
* <p>
@@ -82,19 +82,19 @@ public final class SearchUI {
*/
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 new Search view
* (value <code>"org.eclipse.search.ui.views.SearchView"</code>).
* @deprecated Use {@link NewSearchUI#SEARCH_VIEW_ID} instead.
*/
public static final String SEARCH_VIEW_ID= NewSearchUI.SEARCH_VIEW_ID;
-
+
/**
* Id of the Search action set
* (value <code>"org.eclipse.search.searchActionSet"</code>).
@@ -132,10 +132,10 @@ public final class SearchUI {
}
return true;
} catch (PartInitException ex) {
- ExceptionHandler.handle(ex, SearchMessages.Search_Error_openResultView_title, SearchMessages.Search_Error_openResultView_message);
+ ExceptionHandler.handle(ex, SearchMessages.Search_Error_openResultView_title, SearchMessages.Search_Error_openResultView_message);
return false;
- }
- }
+ }
+ }
/**
* Opens the search dialog.
@@ -151,7 +151,7 @@ public final class SearchUI {
public static void openSearchDialog(IWorkbenchWindow window, String pageId) {
NewSearchUI.openSearchDialog(window, pageId);
}
-
+
/**
* Returns the search result view of the active page of the
@@ -165,7 +165,7 @@ public final class SearchUI {
IViewPart part= SearchPlugin.getActivePage().findView(SearchUI.SEARCH_RESULT_VIEW_ID);
if (part instanceof ISearchResultView)
return (ISearchResultView) part;
- return null;
+ return null;
}
/**
@@ -183,7 +183,7 @@ public final class SearchUI {
/**
* 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
diff --git a/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionDocumentTest.java b/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionDocumentTest.java
index bc91a2c9374..a4ffb7fcab8 100644
--- a/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionDocumentTest.java
+++ b/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionDocumentTest.java
@@ -29,11 +29,11 @@ import org.eclipse.jface.text.projection.Fragment;
import org.eclipse.jface.text.projection.Segment;
public class ProjectionDocumentTest extends TestCase {
-
+
static private class ProjectionDocument extends org.eclipse.jface.text.projection.ProjectionDocument {
-
+
public boolean isUpdating= false;
-
+
public ProjectionDocument(IDocument masterDocument) {
super(masterDocument);
}
@@ -44,21 +44,21 @@ public class ProjectionDocumentTest extends TestCase {
public Position[] getSegments2() {
return super.getSegments();
}
-
+
/*
* @see org.eclipse.jface.text.projection.ProjectionDocument#getFragments()
*/
public Position[] getFragments2() {
return super.getFragments();
}
-
+
/*
* @see org.eclipse.jface.text.projection.ProjectionDocument#adaptProjectionToMasterChange(org.eclipse.jface.text.DocumentEvent)
*/
public boolean adaptProjectionToMasterChange2(DocumentEvent masterEvent) throws BadLocationException {
return super.adaptProjectionToMasterChange(masterEvent);
}
-
+
/*
* @see org.eclipse.jface.text.projection.ProjectionDocument#isUpdating()
*/
@@ -66,7 +66,7 @@ public class ProjectionDocumentTest extends TestCase {
return super.isUpdating() || isUpdating;
}
}
-
+
static private class ProjectionDocumentManager extends org.eclipse.jface.text.projection.ProjectionDocumentManager {
/*
* @see org.eclipse.jface.text.projection.ProjectionDocumentManager#createProjectionDocument(org.eclipse.jface.text.IDocument)
@@ -75,19 +75,19 @@ public class ProjectionDocumentTest extends TestCase {
return new ProjectionDocument(master);
}
}
-
+
static private boolean LINES= true;
-
-
+
+
private ProjectionDocument fSlaveDocument;
private IDocument fMasterDocument;
private ISlaveDocumentManager fSlaveDocumentManager;
-
-
+
+
public ProjectionDocumentTest(String name) {
super(name);
}
-
+
private String getOriginalMasterContents() {
return LINES ?
"1111111111111111111\n" +
@@ -117,13 +117,13 @@ public class ProjectionDocumentTest extends TestCase {
fSlaveDocumentManager= new ProjectionDocumentManager();
fSlaveDocument= (ProjectionDocument) fSlaveDocumentManager.createSlaveDocument(fMasterDocument);
}
-
+
protected void tearDown () {
fSlaveDocumentManager.freeSlaveDocument(fSlaveDocument);
fSlaveDocument= null;
fSlaveDocumentManager= null;
}
-
+
private void createIdenticalProjection() {
int offset= 0;
int length= fMasterDocument.getLength();
@@ -133,7 +133,7 @@ public class ProjectionDocumentTest extends TestCase {
assertTrue(false);
}
}
-
+
private void createProjectionA() {
createProjectionA(fSlaveDocument);
}
@@ -149,22 +149,22 @@ public class ProjectionDocumentTest extends TestCase {
assertTrue(false);
}
}
-
+
private String getProjectionASlaveContents() {
return LINES ?
- "1111111111111111111\n" +
- "3333333333333333333\n" +
+ "1111111111111111111\n" +
+ "3333333333333333333\n" +
"5555555555555555555\n" +
"7777777777777777777\n" +
"9999999999999999999\n"
:
- "11111111111111111111" +
- "33333333333333333333" +
+ "11111111111111111111" +
+ "33333333333333333333" +
"55555555555555555555" +
"77777777777777777777" +
"99999999999999999999";
}
-
+
private void createProjectionB() {
createProjectionB(fSlaveDocument);
}
@@ -179,7 +179,7 @@ public class ProjectionDocumentTest extends TestCase {
assertTrue(false);
}
}
-
+
private String getProjectionBSlaveContents() {
return LINES ?
"2222222222222222222\n" +
@@ -192,11 +192,11 @@ public class ProjectionDocumentTest extends TestCase {
"66666666666666666666" +
"88888888888888888888";
}
-
+
private String print(Position p) {
return "[" + p.getOffset() + "," + p.getLength() + "]";
}
-
+
private void assertWellFormedSegmentation() {
Position[] segmentation= fSlaveDocument.getSegments2();
assertNotNull(segmentation);
@@ -209,15 +209,15 @@ public class ProjectionDocumentTest extends TestCase {
previous= segmentation[i];
}
}
-
+
private void assertWellFormedFragmentation() {
Position[] segmentation= fSlaveDocument.getSegments2();
assertNotNull(segmentation);
Position[] fragmention= fSlaveDocument.getFragments2();
assertNotNull(fragmention);
-
+
assertTrue(fragmention.length == segmentation.length);
-
+
Position previous= null;
for (int i= 0; i < segmentation.length; i++) {
Segment segment= (Segment) segmentation[i];
@@ -231,61 +231,61 @@ public class ProjectionDocumentTest extends TestCase {
previous= fragment;
}
}
-
+
private void assertFragmentation(Position[] expected) {
assertFragmentation(expected, true);
}
-
+
private void assertFragmentation(Position[] expected, boolean checkWellFormedness) {
if (checkWellFormedness) {
assertWellFormedSegmentation();
assertWellFormedFragmentation();
}
-
+
Position[] segmentation= fSlaveDocument.getSegments2();
assertTrue("invalid number of segments", expected.length == segmentation.length);
-
+
for (int i= 0; i < expected.length; i++) {
Segment segment= (Segment) segmentation[i];
Fragment actual= segment.fragment;
assertEquals(print(actual) + " != " + print(expected[i]), expected[i], actual);
}
-
+
}
-
+
private void assertLineInformationConsistency(IDocument document) {
DefaultLineTracker textTracker= new DefaultLineTracker();
textTracker.set(document.get());
-
+
int textLines= textTracker.getNumberOfLines();
int trackerLines= document.getNumberOfLines();
assertEquals(trackerLines, textLines);
-
+
for (int i= 0; i < trackerLines; i++) {
try {
IRegion trackerLine= document.getLineInformation(i);
IRegion textLine= textTracker.getLineInformation(i);
-
+
assertEquals(trackerLine.getOffset(), textLine.getOffset());
assertEquals(trackerLine.getLength(), textLine.getLength());
-
+
} catch (BadLocationException e) {
assertTrue(false);
}
}
}
-
+
private void assertContents(String expected, IDocument document) {
assertWellFormedSegmentation();
assertWellFormedFragmentation();
assertEquals(expected, document.get());
assertLineInformationConsistency(document);
}
-
+
private void assertSlaveContents(String expected) {
assertContents(expected, fSlaveDocument);
}
-
+
private void assertMasterContents(String expected) {
assertContents(expected, fMasterDocument);
}
@@ -306,13 +306,13 @@ public class ProjectionDocumentTest extends TestCase {
}
assertSlaveContents(fMasterDocument.get());
}
-
+
public void test3() {
// test standard projection, i.e. all odd digits
createProjectionA();
assertSlaveContents(getProjectionASlaveContents());
}
-
+
public void test4() {
// test modifying the unprojected regions of the master document
createProjectionA();
@@ -326,7 +326,7 @@ public class ProjectionDocumentTest extends TestCase {
}
assertSlaveContents(getProjectionASlaveContents());
}
-
+
public void test5() {
// test modifying the projected regions of the master document
createProjectionA();
@@ -339,7 +339,7 @@ public class ProjectionDocumentTest extends TestCase {
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.replace(85, 90, "~");
buffer.replace(65, 70, "~");
@@ -348,7 +348,7 @@ public class ProjectionDocumentTest extends TestCase {
buffer.replace(5, 10, "~");
assertSlaveContents(buffer.toString());
}
-
+
public void test6() {
// test replacing the contents of the projected regions of the master document
createProjectionA();
@@ -361,10 +361,10 @@ public class ProjectionDocumentTest extends TestCase {
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents("~~~~~");
}
-
+
public void test7() {
// test replacing the contents of the master document
createProjectionA();
@@ -373,80 +373,80 @@ public class ProjectionDocumentTest extends TestCase {
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents("~~~~~");
-
+
Position[] expected= { new Position(0, 5) };
assertFragmentation(expected);
}
-
+
public void test8_1() {
// test corner case manipulation of the projected regions of the master document
// insert at the beginning of the document
-
+
createProjectionA();
try {
fMasterDocument.replace(0, 0, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents("~" + getProjectionASlaveContents());
}
public void test8_2() {
// test corner case manipulation of the projected regions of the master document
// delete at the beginning of the document
-
+
createProjectionA();
try {
fMasterDocument.replace(0, 1, "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents(getProjectionASlaveContents().substring(1));
}
public void test8_3() {
// test corner case manipulation of the projected regions of the master document
// replace at the beginning of the document
-
+
createProjectionA();
try {
fMasterDocument.replace(0, 1, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents("~" + getProjectionASlaveContents().substring(1));
}
public void test8_4() {
// test corner case manipulation of the projected regions of the master document
// insert at the end of the document
-
+
createProjectionA();
try {
fMasterDocument.replace(fMasterDocument.getLength(), 0, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents(getProjectionASlaveContents() + "~");
}
public void test8_5() {
// test corner case manipulation of the projected regions of the master document
// delete at the end of the document
-
+
createProjectionA();
try {
fMasterDocument.replace(fMasterDocument.getLength()-1, 1, "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
String text= getProjectionASlaveContents();
assertSlaveContents(text.substring(0, text.length()-1));
}
@@ -454,14 +454,14 @@ public class ProjectionDocumentTest extends TestCase {
public void test8_6() {
// test corner case manipulation of the projected regions of the master document
// replace at the end of the document
-
+
createProjectionA();
try {
fMasterDocument.replace(fMasterDocument.getLength()-1, 1, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
String text= getProjectionASlaveContents();
assertSlaveContents(text.substring(0, text.length()-1) + "~");
}
@@ -469,14 +469,14 @@ public class ProjectionDocumentTest extends TestCase {
public void test8_7() {
// test corner case manipulation of the projected regions of the master document
// insert at the beginning of a projected region of the master document
-
+
createProjectionA();
try {
fMasterDocument.replace(80, 0, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.insert(40, '~');
assertSlaveContents(buffer.toString());
@@ -485,14 +485,14 @@ public class ProjectionDocumentTest extends TestCase {
public void test8_8() {
// test corner case manipulation of the projected regions of the master document
// delete at the beginning of a projected region of the master document
-
+
createProjectionA();
try {
fMasterDocument.replace(80, 1, "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.deleteCharAt(40);
assertSlaveContents(buffer.toString());
@@ -501,14 +501,14 @@ public class ProjectionDocumentTest extends TestCase {
public void test8_9() {
// test corner case manipulation of the projected regions of the master document
// replace at the beginning of a projected region of the master document
-
+
createProjectionA();
try {
fMasterDocument.replace(80, 1, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.replace(40, 41, "~");
assertSlaveContents(buffer.toString());
@@ -518,7 +518,7 @@ public class ProjectionDocumentTest extends TestCase {
// test corner case manipulation of the projected regions of the master document
// insert at the end of a projected region of the master document
// -> slave document unchanged as this is interpreted as "beginning of an unprojected region"
-
+
test9_1();
}
@@ -526,170 +526,170 @@ public class ProjectionDocumentTest extends TestCase {
// test corner case manipulation of the projected regions of the master document
// delete at the end of a projected region of the master document
// -> slave document changed
-
+
createProjectionA();
try {
fMasterDocument.replace(99, 1, "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.deleteCharAt(59);
assertSlaveContents(buffer.toString());
}
-
+
public void test8_12() {
// test corner case manipulation of the projected regions of the master document
// replace at the end of a projected region of the master document
// -> slave document changed
-
+
createProjectionA();
try {
fMasterDocument.replace(99, 1, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.replace(59, 60, "~");
assertSlaveContents(buffer.toString());
}
-
+
public void test9_1() {
// test corner case manipulation of the unprojected regions of the master document
// insert at the beginning of an unprojected region
// -> slave document unchanged
-
+
createProjectionA();
try {
fMasterDocument.replace(100, 0, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents(getProjectionASlaveContents());
}
-
+
public void test9_2() {
// test corner case manipulation of the unprojected regions of the master document
// delete at the beginning of an unprojected region
- // -> slave document unchanged
-
+ // -> slave document unchanged
+
createProjectionA();
try {
fMasterDocument.replace(100, 1, "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents(getProjectionASlaveContents());
}
-
+
public void test9_3() {
// test corner case manipulation of the unprojected regions of the master document
// replace at the beginning of an unprojected region
// -> slave document unchanged
-
+
createProjectionA();
try {
fMasterDocument.replace(100, 1, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents(getProjectionASlaveContents());
}
-
+
public void test9_4() {
// test corner case manipulation of the unprojected regions of the master document
- // insert at the end of an unprojected region
+ // insert at the end of an unprojected region
// -> slave document changed, as this is interpreted as "beginning of a projected region"
-
+
test8_7();
}
-
+
public void test9_5() {
// test corner case manipulation of the unprojected regions of the master document
// delete at the end of an unprojected region
// -> slave document unchanged
-
+
createProjectionA();
try {
fMasterDocument.replace(79, 1, "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents(getProjectionASlaveContents());
}
-
+
public void test9_6() {
// test corner case manipulation of the unprojected regions of the master document
// replace at the end of an unprojected region
// -> slave document unchanged
-
+
createProjectionA();
try {
fMasterDocument.replace(79, 1, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents(getProjectionASlaveContents());
}
-
+
public void test9_7() {
// test corner case manipulation of the unprojected regions of the master document
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=51594
if (!LINES)
return;
-
+
try {
int startOffset= fMasterDocument.getLineOffset(4);
assertEquals(80, startOffset);
int endOffset= fMasterDocument.getLineOffset(7);
assertEquals(140, endOffset);
fSlaveDocument.addMasterDocumentRange(startOffset, endOffset - startOffset);
-
+
assertSlaveContents(getOriginalMasterContents().substring(80, 140));
-
+
fMasterDocument.replace(endOffset, 1, "x");
assertLineInformationConsistency(fSlaveDocument);
} catch (BadLocationException e) {
assertTrue(false);
}
}
-
+
public void test10_1() {
// test manipulations overlapping projected and unprojected regions of the master document
// delete range overlapping from a projected into an unprojected region
-
+
createProjectionA();
try {
fMasterDocument.replace(50, 20, "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(30, 40);
assertSlaveContents(buffer.toString());
}
-
+
public void test10_2() {
// test manipulations overlapping projected and unprojected regions of the master document
// replace range overlapping from a projected into an unprojected region
// => replaced range will appear in slave document because of auto expansion of slave document in case of overlapping events
-
+
createProjectionA();
try {
fMasterDocument.replace(50, 20, "~~~~~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 15),
@@ -698,12 +698,12 @@ public class ProjectionDocumentTest extends TestCase {
new Position(145, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.replace(30, 40, "~~~~~");
assertSlaveContents(buffer.toString());
}
-
+
public void test10_3() {
// test manipulations overlapping projected and unprojected regions of the master document
// delete range overlapping from an unprojected into a projected region
@@ -714,12 +714,12 @@ public class ProjectionDocumentTest extends TestCase {
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(40, 50);
assertSlaveContents(buffer.toString());
}
-
+
public void test10_4() {
// test manipulations overlapping projected and unprojected regions of the master document
// replace range overlapping from an unprojected into a projected region
@@ -731,7 +731,7 @@ public class ProjectionDocumentTest extends TestCase {
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 20),
@@ -740,15 +740,15 @@ public class ProjectionDocumentTest extends TestCase {
new Position(145, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.replace(40, 50, "~~~~~");
assertSlaveContents(buffer.toString());
}
-
+
public void test11() {
// test deleting an unprojected region of the master document
-
+
createProjectionA();
try {
fMasterDocument.replace(60, 20, "");
@@ -763,20 +763,20 @@ public class ProjectionDocumentTest extends TestCase {
new Position(140, 20)
};
assertFragmentation(expected);
-
+
assertSlaveContents(getProjectionASlaveContents());
}
-
+
public void test12() {
// test deleting a projected region of the master document
-
+
createProjectionA();
try {
fMasterDocument.replace(80, 20, "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 20),
@@ -785,25 +785,25 @@ public class ProjectionDocumentTest extends TestCase {
};
assertFragmentation(expected);
}
-
+
public void test13() {
// test complete replace of the contents of the slave document in identical projection
-
+
createIdenticalProjection();
-
+
try {
fSlaveDocument.replace(0, fSlaveDocument.getLength(), "~~~~~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents("~~~~~");
assertMasterContents("~~~~~");
}
-
+
public void test14_1() {
// test complete replace of the contents of the slave document in standard projection A
-
+
createProjectionA();
try {
fSlaveDocument.replace(0, fSlaveDocument.getLength(), "~~~~~");
@@ -816,7 +816,7 @@ public class ProjectionDocumentTest extends TestCase {
public void test14_2() {
// test complete replace of the contents of the slave document in standard projection B
-
+
createProjectionB();
try {
fSlaveDocument.replace(0, fSlaveDocument.getLength(), "~~~~~");
@@ -828,10 +828,10 @@ public class ProjectionDocumentTest extends TestCase {
buffer.replace(20, 160, "~~~~~");
assertMasterContents(buffer.toString());
}
-
+
public void test15() {
// test modifying the segments of the slave document
-
+
createProjectionA();
try {
fSlaveDocument.replace(90, 5, "~");
@@ -842,7 +842,7 @@ public class ProjectionDocumentTest extends TestCase {
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.replace(90, 95, "~");
buffer.replace(70, 75, "~");
@@ -850,7 +850,7 @@ public class ProjectionDocumentTest extends TestCase {
buffer.replace(30, 35, "~");
buffer.replace(10, 15, "~");
assertSlaveContents(buffer.toString());
-
+
buffer= new StringBuffer(getOriginalMasterContents());
buffer.replace(170, 175, "~");
buffer.replace(130, 135, "~");
@@ -859,10 +859,10 @@ public class ProjectionDocumentTest extends TestCase {
buffer.replace(10, 15, "~");
assertMasterContents(buffer.toString());
}
-
+
public void test16() {
// test replacing the contents of the segments of the slave document
-
+
createProjectionA();
try {
fSlaveDocument.replace(80, 20, "~");
@@ -873,7 +873,7 @@ public class ProjectionDocumentTest extends TestCase {
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
assertSlaveContents("~~~~~");
StringBuffer buffer= new StringBuffer(getOriginalMasterContents());
buffer.replace(160, 180, "~");
@@ -883,29 +883,29 @@ public class ProjectionDocumentTest extends TestCase {
buffer.replace(0, 20, "~");
assertMasterContents(buffer.toString());
}
-
+
public void test17_1() {
// test corner case manipulation of the segments of the slave document
// insert at the beginning of a segment of the slave document
-
+
createProjectionA();
try {
fSlaveDocument.replace(20, 0, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.insert(20, '~');
assertSlaveContents(buffer.toString());
-
+
buffer= new StringBuffer(getOriginalMasterContents());
buffer.insert(40, '~');
assertMasterContents(buffer.toString());
}
public void test17_2() {
- // test corner case manipulation of the segments of the slave document
+ // test corner case manipulation of the segments of the slave document
// delete at the beginning of a segment of the slave document
createProjectionA();
@@ -914,96 +914,96 @@ public class ProjectionDocumentTest extends TestCase {
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.deleteCharAt(20);
assertSlaveContents(buffer.toString());
-
+
buffer= new StringBuffer(getOriginalMasterContents());
buffer.deleteCharAt(40);
assertMasterContents(buffer.toString());
}
-
+
public void test17_3() {
- // test corner case manipulation of the segments of the slave document
+ // test corner case manipulation of the segments of the slave document
// replace at the beginning of a segment of the slave document
-
+
createProjectionA();
try {
fSlaveDocument.replace(20, 1, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.replace(20, 21, "~");
assertSlaveContents(buffer.toString());
-
+
buffer= new StringBuffer(getOriginalMasterContents());
buffer.replace(40, 41, "~");
assertMasterContents(buffer.toString());
}
-
+
public void test17_4() {
- // test corner case manipulation of the segments of the slave document
+ // test corner case manipulation of the segments of the slave document
// insert at the end of a segment of the slave document
// interpreted as "insert at the beginning of the next segment"
-
+
test17_1();
}
-
+
public void test17_5() {
- // test corner case manipulation of the segments of the slave document
+ // test corner case manipulation of the segments of the slave document
// delete at the end of a segment of the slave document
-
+
createProjectionA();
try {
fSlaveDocument.replace(39, 1, "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.deleteCharAt(39);
assertSlaveContents(buffer.toString());
-
+
buffer= new StringBuffer(getOriginalMasterContents());
buffer.deleteCharAt(59);
assertMasterContents(buffer.toString());
}
-
+
public void test17_6() {
- // test corner case manipulation of the segments of the slave document
+ // test corner case manipulation of the segments of the slave document
// replace at the end of a segment of the slave document
-
+
createProjectionA();
try {
fSlaveDocument.replace(39, 1, "~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.replace(39, 40, "~");
assertSlaveContents(buffer.toString());
-
+
buffer= new StringBuffer(getOriginalMasterContents());
buffer.replace(59, 60, "~");
assertMasterContents(buffer.toString());
}
-
+
public void test18_1() {
// test manipulations overlapping multiple segments of the slave document
// delete range overlapping two neighboring segments
-
+
createProjectionA();
-
+
try {
fSlaveDocument.replace(30, 20, "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 20),
@@ -1011,11 +1011,11 @@ public class ProjectionDocumentTest extends TestCase {
new Position(120, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(30, 50);
assertSlaveContents(buffer.toString());
-
+
buffer= new StringBuffer(getOriginalMasterContents());
buffer.delete(50, 90);
assertMasterContents(buffer.toString());
@@ -1026,13 +1026,13 @@ public class ProjectionDocumentTest extends TestCase {
// replace range overlapping two neighboring segments
createProjectionA();
-
+
try {
fSlaveDocument.replace(30, 20, "~~~~~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 25),
@@ -1040,35 +1040,35 @@ public class ProjectionDocumentTest extends TestCase {
new Position(125, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.replace(30, 50, "~~~~~");
assertSlaveContents(buffer.toString());
-
+
buffer= new StringBuffer(getOriginalMasterContents());
buffer.replace(50, 90, "~~~~~");
assertMasterContents(buffer.toString());
}
-
+
public void test19() {
// test deleting the contents of a segment of the slave document
-
+
createProjectionA();
-
+
try {
fSlaveDocument.replace(20, 20, "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(20, 40);
assertSlaveContents(buffer.toString());
-
+
buffer= new StringBuffer(getOriginalMasterContents());
buffer.delete(40, 60);
assertMasterContents(buffer.toString());
-
+
Position[] expected= {
new Position(0, 20),
new Position(60, 20),
@@ -1077,18 +1077,18 @@ public class ProjectionDocumentTest extends TestCase {
};
assertFragmentation(expected);
}
-
+
public void test20_1() {
// test adding a range to the slave document at the beginning of a segment gap
-
+
createProjectionA();
-
+
try {
fSlaveDocument.addMasterDocumentRange(60, 10);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 30),
@@ -1097,7 +1097,7 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
String addition= getOriginalMasterContents().substring(60, 70);
buffer.insert(40, addition);
@@ -1106,15 +1106,15 @@ public class ProjectionDocumentTest extends TestCase {
public void test20_2() {
// test adding a range to the slave document at the end of a segment gap
-
+
createProjectionA();
-
+
try {
fSlaveDocument.addMasterDocumentRange(70, 10);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 20),
@@ -1123,7 +1123,7 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
String addition= getOriginalMasterContents().substring(70, 80);
buffer.insert(40, addition);
@@ -1132,15 +1132,15 @@ public class ProjectionDocumentTest extends TestCase {
public void test20_3() {
// test adding a range to the slave document that is in the middle of a segment gap
-
+
createProjectionA();
-
+
try {
fSlaveDocument.addMasterDocumentRange(65, 10);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 20),
@@ -1156,18 +1156,18 @@ public class ProjectionDocumentTest extends TestCase {
buffer.insert(40, addition);
assertSlaveContents(buffer.toString());
}
-
+
public void test20_4() {
// test adding a range to the slave document that is a segment gap
-
+
createProjectionA();
-
+
try {
fSlaveDocument.addMasterDocumentRange(60, 20);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 60),
@@ -1184,15 +1184,15 @@ public class ProjectionDocumentTest extends TestCase {
public void test20_5() {
// test adding a range to the slave document beginning in a segment gap and ending in a segment
-
+
createProjectionA();
-
+
try {
fSlaveDocument.addMasterDocumentRange(70, 20);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 20),
@@ -1210,15 +1210,15 @@ public class ProjectionDocumentTest extends TestCase {
public void test20_6() {
// test adding a range to the slave document beginning in a segment and ending in a segment gap
-
+
createProjectionA();
-
+
try {
fSlaveDocument.addMasterDocumentRange(50, 20);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 30),
@@ -1236,15 +1236,15 @@ public class ProjectionDocumentTest extends TestCase {
public void test20_7() {
// test adding a range to the slave document beginning in a segment and ending in a segment
-
+
createProjectionA();
-
+
try {
fSlaveDocument.addMasterDocumentRange(50, 40);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 60),
@@ -1261,15 +1261,15 @@ public class ProjectionDocumentTest extends TestCase {
public void test20_8() {
// test adding a range to the slave document beginning in a segment gap and ending in a segment gap
-
+
createProjectionA();
-
+
try {
fSlaveDocument.addMasterDocumentRange(70, 40);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 20),
@@ -1286,18 +1286,18 @@ public class ProjectionDocumentTest extends TestCase {
buffer.insert(40, addition);
assertSlaveContents(buffer.toString());
}
-
+
public void test21_1() {
// test removing a range from the slave document at the beginning of a segment
-
+
createProjectionA();
-
+
try {
fSlaveDocument.removeMasterDocumentRange(40, 10);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(50, 10),
@@ -1306,7 +1306,7 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(20, 30);
assertSlaveContents(buffer.toString());
@@ -1314,15 +1314,15 @@ public class ProjectionDocumentTest extends TestCase {
public void test21_2() {
// test removing a range from the slave document at the end of a segment
-
+
createProjectionA();
-
+
try {
fSlaveDocument.removeMasterDocumentRange(50, 10);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 10),
@@ -1331,7 +1331,7 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(30, 40);
assertSlaveContents(buffer.toString());
@@ -1339,15 +1339,15 @@ public class ProjectionDocumentTest extends TestCase {
public void test21_3() {
// test removing a range from the slave document that is in the middle of a segment
-
+
createProjectionA();
-
+
try {
fSlaveDocument.removeMasterDocumentRange(85, 10);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 20),
@@ -1357,23 +1357,23 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(45, 55);
assertSlaveContents(buffer.toString());
}
-
+
public void test21_4() {
// test removing a range from the slave document that is a segment
-
+
createProjectionA();
-
+
try {
fSlaveDocument.removeMasterDocumentRange(40, 20);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(80, 20),
@@ -1381,23 +1381,23 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(20, 40);
assertSlaveContents(buffer.toString());
}
-
+
public void test21_5() {
// test removing a range from the slave document beginning in a segment and ending in a segment gap
-
+
createProjectionA();
-
+
try {
fSlaveDocument.removeMasterDocumentRange(50, 20);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 10),
@@ -1406,7 +1406,7 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(30, 40);
assertSlaveContents(buffer.toString());
@@ -1414,15 +1414,15 @@ public class ProjectionDocumentTest extends TestCase {
public void test21_6() {
// test removing a range from the slave document beginning in a segment gap and ending in a segment
-
+
createProjectionA();
-
+
try {
fSlaveDocument.removeMasterDocumentRange(70, 20);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 20),
@@ -1431,7 +1431,7 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(40, 50);
assertSlaveContents(buffer.toString());
@@ -1439,15 +1439,15 @@ public class ProjectionDocumentTest extends TestCase {
public void test21_7() {
// test removing a range from the slave document beginning in a segment gap and ending in a segment gap
-
+
createProjectionA();
-
+
try {
fSlaveDocument.removeMasterDocumentRange(70, 40);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 20),
@@ -1455,7 +1455,7 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(40, 60);
assertSlaveContents(buffer.toString());
@@ -1463,15 +1463,15 @@ public class ProjectionDocumentTest extends TestCase {
public void test21_8() {
// test removing a range from the slave document beginning in a segment and ending in a segment
-
+
createProjectionA();
-
+
try {
fSlaveDocument.removeMasterDocumentRange(50, 40);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 20),
new Position(40, 10),
@@ -1480,7 +1480,7 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getProjectionASlaveContents());
buffer.delete(30, 50);
assertSlaveContents(buffer.toString());
@@ -1488,26 +1488,26 @@ public class ProjectionDocumentTest extends TestCase {
public void test21_9() {
// test removing a range from the slave document using identical projection
-
+
createIdenticalProjection();
-
+
try {
fSlaveDocument.removeMasterDocumentRange(50, 40);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 50),
new Position(90, 90)
};
assertFragmentation(expected);
-
+
StringBuffer buffer= new StringBuffer(getOriginalMasterContents());
buffer.delete(50, 90);
assertSlaveContents(buffer.toString());
}
-
+
private void assertEquals(DocumentEvent expected, DocumentEvent received) {
assertSame(expected.getDocument(), received.getDocument());
assertEquals(expected.getOffset(), received.getOffset());
@@ -1517,34 +1517,34 @@ public class ProjectionDocumentTest extends TestCase {
else
assertEquals(expected.getText(), received.getText());
}
-
+
private void assertSlaveEvents(DocumentEvent[] expected, DocumentEvent[] received) {
if (expected == null)
assertNull(received);
-
+
assertTrue(expected.length == received.length);
-
+
for (int i= 0; i < received.length; i++)
assertEquals(received[i], expected[i]);
}
-
+
public void test22() {
// test document events sent out by the slave document when adding segments
-
+
final List receivedEvents= new ArrayList();
-
+
IDocumentListener listener= new IDocumentListener() {
public void documentAboutToBeChanged(DocumentEvent event) {}
public void documentChanged(DocumentEvent event) {
receivedEvents.add(event);
}
};
-
+
fSlaveDocument.addDocumentListener(listener);
createProjectionA();
DocumentEvent[] actual= new DocumentEvent[receivedEvents.size()];
receivedEvents.toArray(actual);
-
+
StringBuffer buffer= new StringBuffer(getOriginalMasterContents());
DocumentEvent[] expected= new DocumentEvent[] {
new DocumentEvent(fSlaveDocument, 0, 0, buffer.substring(0, 20)),
@@ -1558,45 +1558,45 @@ public class ProjectionDocumentTest extends TestCase {
public void test23() {
// test document events sent out by the slave document when removing segments
-
+
final List receivedEvents= new ArrayList();
-
+
IDocumentListener listener= new IDocumentListener() {
public void documentAboutToBeChanged(DocumentEvent event) {}
public void documentChanged(DocumentEvent event) {
receivedEvents.add(event);
}
};
-
+
createProjectionA();
-
+
fSlaveDocument.addDocumentListener(listener);
try {
fSlaveDocument.removeMasterDocumentRange(40, 20);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
DocumentEvent[] actual= new DocumentEvent[receivedEvents.size()];
receivedEvents.toArray(actual);
DocumentEvent[] expected= new DocumentEvent[] { new DocumentEvent(fSlaveDocument, 20, 20, "") };
assertSlaveEvents(expected, actual);
}
-
+
public void test24_1() {
// test auto expand mode when manipulating the master document
// master event completely left of slave document
-
+
createProjectionB();
fSlaveDocument.setAutoExpandMode(true);
-
+
try {
DocumentEvent event= new DocumentEvent(fMasterDocument, 5, 10, "~");
fSlaveDocument.adaptProjectionToMasterChange2(event);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(5, 10),
new Position(20, 20),
@@ -1606,21 +1606,21 @@ public class ProjectionDocumentTest extends TestCase {
};
assertFragmentation(expected);
}
-
+
public void test24_2() {
// test auto expand mode when manipulating the master document
// master event completely right of slave document
-
+
createProjectionB();
fSlaveDocument.setAutoExpandMode(true);
-
+
try {
DocumentEvent event= new DocumentEvent(fMasterDocument, 165, 10, "~");
fSlaveDocument.adaptProjectionToMasterChange2(event);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(20,20),
new Position(60, 20),
@@ -1630,21 +1630,21 @@ public class ProjectionDocumentTest extends TestCase {
};
assertFragmentation(expected);
}
-
+
public void test24_3() {
// test auto expand mode when manipulating the master document
// master event completely left of fragment
-
+
createProjectionB();
fSlaveDocument.setAutoExpandMode(true);
-
+
try {
DocumentEvent event= new DocumentEvent(fMasterDocument, 45, 10, "~");
fSlaveDocument.adaptProjectionToMasterChange2(event);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(20, 20),
new Position(45, 10),
@@ -1654,22 +1654,22 @@ public class ProjectionDocumentTest extends TestCase {
};
assertFragmentation(expected);
}
-
+
public void test24_4() {
// test auto expand mode when manipulating the master document
// master event completely right of fragment
// -> is also left of the fragment in this setup
-
+
createProjectionB();
fSlaveDocument.setAutoExpandMode(true);
-
+
try {
DocumentEvent event= new DocumentEvent(fMasterDocument, 85, 10, "~");
fSlaveDocument.adaptProjectionToMasterChange2(event);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(20, 20),
new Position(60, 20),
@@ -1679,21 +1679,21 @@ public class ProjectionDocumentTest extends TestCase {
};
assertFragmentation(expected);
}
-
+
public void test24_5() {
// test auto expand mode when manipulating the master document
// master event starts left of fragment and ends inside of a fragment
-
+
createProjectionB();
fSlaveDocument.setAutoExpandMode(true);
-
+
try {
DocumentEvent event= new DocumentEvent(fMasterDocument, 50, 20, "~");
fSlaveDocument.adaptProjectionToMasterChange2(event);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(20, 20),
new Position(50, 30),
@@ -1702,21 +1702,21 @@ public class ProjectionDocumentTest extends TestCase {
};
assertFragmentation(expected);
}
-
+
public void test24_6() {
// test auto expand mode when manipulating the master document
// master event starts inside of a fragment and ends right of a fragment
-
+
createProjectionB();
fSlaveDocument.setAutoExpandMode(true);
-
+
try {
DocumentEvent event= new DocumentEvent(fMasterDocument, 70, 20, "~");
fSlaveDocument.adaptProjectionToMasterChange2(event);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(20, 20),
new Position(60, 30),
@@ -1725,21 +1725,21 @@ public class ProjectionDocumentTest extends TestCase {
};
assertFragmentation(expected);
}
-
+
public void test24_7() {
// test auto expand mode when manipulating the master document
// master event starts left of a fragment and ends right of a fragment
-
+
createProjectionB();
fSlaveDocument.setAutoExpandMode(true);
-
+
try {
DocumentEvent event= new DocumentEvent(fMasterDocument, 50, 40, "~");
fSlaveDocument.adaptProjectionToMasterChange2(event);
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(20, 20),
new Position(50, 40),
@@ -1748,63 +1748,63 @@ public class ProjectionDocumentTest extends TestCase {
};
assertFragmentation(expected);
}
-
+
public void test24_8() {
// test auto expand mode when manipulating the master document
// complete replace of master document
-
+
createProjectionB();
fSlaveDocument.setAutoExpandMode(true);
-
+
try {
DocumentEvent event= new DocumentEvent(fMasterDocument, 0, fMasterDocument.getLength(), "x" + getOriginalMasterContents() + "y");
fSlaveDocument.adaptProjectionToMasterChange2(event);
} catch (BadLocationException x) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, fMasterDocument.getLength())
};
assertFragmentation(expected);
}
-
+
public void test25() {
// test auto expand mode when manipulating the slave document
-
+
try {
fSlaveDocument.isUpdating= true;
fSlaveDocument.adaptProjectionToMasterChange2(new DocumentEvent(fSlaveDocument, 0, 0, "~"));
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(0, 0)
};
assertFragmentation(expected, false);
}
-
+
public void test26() {
// test multiple slave documents for the same master document
-
+
createIdenticalProjection();
ProjectionDocument slave2= (ProjectionDocument) fSlaveDocumentManager.createSlaveDocument(fMasterDocument);
createProjectionA(slave2);
ProjectionDocument slave3= (ProjectionDocument) fSlaveDocumentManager.createSlaveDocument(fMasterDocument);
createProjectionB(slave3);
-
+
assertContents(getOriginalMasterContents(), fSlaveDocument);
assertContents(getProjectionASlaveContents(), slave2);
assertContents(getProjectionBSlaveContents(), slave3);
-
+
fSlaveDocumentManager.freeSlaveDocument(slave3);
fSlaveDocumentManager.freeSlaveDocument(slave2);
}
-
+
public void test27() {
// test changing the projection until identical projection is reached
-
+
createProjectionA();
Position[] expected= {
@@ -1815,7 +1815,7 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
try {
fSlaveDocument.addMasterDocumentRange(20, 20);
} catch (BadLocationException e) {
@@ -1842,7 +1842,7 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
try {
fSlaveDocument.addMasterDocumentRange(100, 20);
} catch (BadLocationException e) {
@@ -1854,7 +1854,7 @@ public class ProjectionDocumentTest extends TestCase {
new Position(160, 20)
};
assertFragmentation(expected);
-
+
try {
fSlaveDocument.addMasterDocumentRange(140, 20);
} catch (BadLocationException e) {
@@ -1866,7 +1866,7 @@ public class ProjectionDocumentTest extends TestCase {
};
assertFragmentation(expected);
}
-
+
public void test28_1() {
// delete slave content and check fragmentation, need to keep a single fragment as anchor
createProjectionB();
@@ -1879,50 +1879,50 @@ public class ProjectionDocumentTest extends TestCase {
StringBuffer buffer= new StringBuffer(getOriginalMasterContents());
buffer.delete(20, 160);
assertMasterContents(buffer.toString());
-
+
Position[] expected= {
new Position(20, 0)
};
assertFragmentation(expected);
}
-
+
public void test28_2() {
// test step wise version of the complete replace
// delete whole content of slave, followed by inserting text
-
+
createProjectionB();
try {
fSlaveDocument.replace(0, fSlaveDocument.getLength(), "");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
try {
fSlaveDocument.replace(0, 0, "~~~~~");
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
Position[] expected= {
new Position(20, 5)
};
assertFragmentation(expected);
-
+
assertSlaveContents("~~~~~");
StringBuffer buffer= new StringBuffer(getOriginalMasterContents());
buffer.replace(20, 160, "~~~~~");
- assertMasterContents(buffer.toString());
+ assertMasterContents(buffer.toString());
}
-
+
public void _test29() {
// test computation of unprojected master regions
-
+
// spanning no fragment
// left of fragment
// left of fragment, touching border of fragment
// right of fragment, touching border to fragment
// right of fragment
-
+
// spanning one fragment
// left of fragment, reaching into fragment
// inside fragment, touching left border
@@ -1931,7 +1931,7 @@ public class ProjectionDocumentTest extends TestCase {
// right of fragment, reaching into fragment
// being identical to a fragment
// starting left of fragment, ending right of fragment
-
+
// spanning multiple fragments
// starting left of fragment
// ending left of fragment
@@ -1964,18 +1964,18 @@ public class ProjectionDocumentTest extends TestCase {
// ending touching right fragment border
// ending right of fragment
}
-
+
private String print(IRegion p) {
return "[" + p.getOffset() + "," + p.getLength() + "]";
}
-
+
private void assertRegions(IRegion[] expected, IRegion[] actual) {
-
+
if (expected == null) {
assertNull(actual);
return;
}
-
+
if (actual == null) {
assertNull(expected);
return;
@@ -1985,7 +1985,7 @@ public class ProjectionDocumentTest extends TestCase {
for (int i= 0; i < expected.length; i++)
assertEquals(print(actual[i]) + " != " + print(expected[i]), expected[i], actual[i]);
}
-
+
private void assertUnprojectedMasterRegions(IRegion[] expected, int offsetInMaster, int lengthInMaster) {
createProjectionB();
try {
@@ -1993,42 +1993,42 @@ public class ProjectionDocumentTest extends TestCase {
assertRegions(expected, regions);
} catch (BadLocationException e) {
assertTrue(false);
- }
+ }
}
-
+
public void test29_1() {
// test computation of unprojected master regions
// spanning no fragment
// left of fragment
-
+
IRegion[] expected= {
new Region(45, 10)
};
assertUnprojectedMasterRegions(expected, 45, 10);
}
-
+
public void test29_2() {
// test computation of unprojected master regions
// spanning no fragment
// left of fragment, touching border of fragment
-
+
IRegion[] expected= {
new Region(45, 15)
};
assertUnprojectedMasterRegions(expected, 45, 15);
}
-
+
public void test29_3() {
// test computation of unprojected master regions
// spanning no fragment
// right of fragment, touching border to fragment
-
+
IRegion[] expected= {
new Region(80, 15)
};
assertUnprojectedMasterRegions(expected, 80, 15);
}
-
+
public void test29_4() {
// test computation of unprojected master regions
// spanning no fragment
@@ -2039,18 +2039,18 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 85, 10);
}
-
+
public void test29_5() {
// test computation of unprojected master regions
// spanning one fragment
// left of fragment, reaching into fragment
-
+
IRegion[] expected= {
new Region(50, 10)
};
assertUnprojectedMasterRegions(expected, 50, 20);
}
-
+
public void test29_6() {
// test computation of unprojected master regions
// spanning one fragment
@@ -2058,60 +2058,60 @@ public class ProjectionDocumentTest extends TestCase {
assertUnprojectedMasterRegions(new IRegion[] {}, 60, 10);
}
-
+
public void test29_7() {
// test computation of unprojected master regions
// spanning one fragment
// inside fragment
-
+
assertUnprojectedMasterRegions(new IRegion[] {}, 65, 10);
}
-
+
public void test29_8() {
// test computation of unprojected master regions
// spanning one fragment
// inside fragment, touching right border
-
+
assertUnprojectedMasterRegions(new IRegion[] {}, 65, 15);
}
-
+
public void test29_9() {
// test computation of unprojected master regions
// spanning one fragment
// right of fragment, reaching into fragment
-
+
IRegion[] expected= {
new Region(80, 10)
};
assertUnprojectedMasterRegions(expected, 70, 20);
}
-
+
public void test29_10() {
// test computation of unprojected master regions
// spanning one fragment
// being identical to a fragment
-
+
assertUnprojectedMasterRegions(new IRegion[] {}, 60, 20);
}
-
+
public void test29_11() {
// test computation of unprojected master regions
// spanning one fragment
// starting left of fragment, ending right of fragment
-
+
IRegion[] expected= {
new Region(50, 10),
new Region(80, 10)
};
assertUnprojectedMasterRegions(expected, 50, 40);
}
-
+
public void test29_12() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting left of fragment
// ending left of fragment
-
+
IRegion[] expected= {
new Region(50, 10),
new Region(80, 20),
@@ -2119,13 +2119,13 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 50, 80);
}
-
+
public void test29_13() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting left of fragment
// ending touching left fragment border
-
+
IRegion[] expected= {
new Region(50, 10),
new Region(80, 20),
@@ -2133,26 +2133,26 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 50, 90);
}
-
+
public void test29_14() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting left of fragment
// ending inside fragment
-
+
IRegion[] expected= {
new Region(50, 10),
new Region(80, 20)
};
assertUnprojectedMasterRegions(expected, 50, 60);
}
-
+
public void test29_15() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting left of fragment
// ending touching right fragment border
-
+
IRegion[] expected= {
new Region(50, 10),
new Region(80, 20),
@@ -2160,7 +2160,7 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 50, 110);
}
-
+
public void test29_16() {
// test computation of unprojected master regions
// spanning multiple fragments
@@ -2174,20 +2174,20 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 50, 80);
}
-
+
public void test29_17() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting touching left fragment border
// ending left of fragment
-
+
IRegion[] expected= {
new Region(80, 20),
new Region(120, 10)
};
assertUnprojectedMasterRegions(expected, 60, 70);
}
-
+
public void test29_18() {
// test computation of unprojected master regions
// spanning multiple fragments
@@ -2200,19 +2200,19 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 60, 80);
}
-
+
public void test29_19() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting touching left fragment border
// ending inside fragment
-
+
IRegion[] expected= {
new Region(80, 20)
};
assertUnprojectedMasterRegions(expected, 60, 50);
}
-
+
public void test29_20() {
// test computation of unprojected master regions
// spanning multiple fragments
@@ -2225,7 +2225,7 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 60, 100);
}
-
+
public void test29_21() {
// test computation of unprojected master regions
// spanning multiple fragments
@@ -2238,71 +2238,71 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 60, 70);
}
-
+
public void test29_22() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting inside fragment
// ending left of fragment
-
+
IRegion[] expected= {
new Region(80, 20),
new Region(120, 10)
};
assertUnprojectedMasterRegions(expected, 70, 60);
}
-
+
public void test29_23() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting inside fragment
// ending touching left fragment border
-
+
IRegion[] expected= {
new Region(80, 20),
new Region(120, 20)
};
assertUnprojectedMasterRegions(expected, 70, 70);
}
-
+
public void test29_24() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting inside fragment
// ending inside fragment
-
+
IRegion[] expected= {
new Region(80, 20)
};
assertUnprojectedMasterRegions(expected, 70, 40);
}
-
+
public void test29_25() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting inside fragment
// ending touching right fragment border
-
+
IRegion[] expected= {
new Region(80, 20),
new Region(120, 20)
};
assertUnprojectedMasterRegions(expected, 70, 90);
}
-
+
public void test29_26() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting inside fragment
// ending right of fragment
-
+
IRegion[] expected= {
new Region(80, 20),
new Region(120, 10)
};
assertUnprojectedMasterRegions(expected, 70, 60);
}
-
+
public void test29_27() {
// test computation of unprojected master regions
// spanning multiple fragments
@@ -2316,13 +2316,13 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 40, 90);
}
-
+
public void test29_28() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting touching right fragment border
// ending touching left fragment border
-
+
IRegion[] expected= {
new Region(40, 20),
new Region(80, 20),
@@ -2330,20 +2330,20 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 40, 100);
}
-
+
public void test29_29() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting touching right fragment border
// ending inside fragment
-
+
IRegion[] expected= {
new Region(40, 20),
new Region(80, 20)
};
assertUnprojectedMasterRegions(expected, 40, 70);
}
-
+
public void test29_30() {
// test computation of unprojected master regions
// spanning multiple fragments
@@ -2357,13 +2357,13 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 40, 120);
}
-
+
public void test29_31() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting touching right fragment border
// ending right of fragment
-
+
IRegion[] expected= {
new Region(40, 20),
new Region(80, 20),
@@ -2371,13 +2371,13 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 40, 90);
}
-
+
public void test29_32() {
// test computation of unprojected master regions
// spanning multiple fragments
// starting right of fragment
// ending left of fragment
-
+
IRegion[] expected= {
new Region(50, 10),
new Region(80, 20),
@@ -2385,7 +2385,7 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 50, 80);
}
-
+
public void test29_33() {
// test computation of unprojected master regions
// spanning multiple fragments
@@ -2399,7 +2399,7 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 50, 90);
}
-
+
public void test29_34() {
// test computation of unprojected master regions
// spanning multiple fragments
@@ -2412,7 +2412,7 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 50, 60);
}
-
+
public void test29_35() {
// test computation of unprojected master regions
// spanning multiple fragments
@@ -2426,7 +2426,7 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 50, 110);
}
-
+
public void test29_36() {
// test computation of unprojected master regions
// spanning multiple fragments
@@ -2440,10 +2440,10 @@ public class ProjectionDocumentTest extends TestCase {
};
assertUnprojectedMasterRegions(expected, 50, 80);
}
-
+
public void test29_37() {
// test computation of unprojected master regions
-
+
createProjectionB();
try {
IRegion[] regions= fSlaveDocument.computeUnprojectedMasterRegions(0, 180);
@@ -2457,9 +2457,9 @@ public class ProjectionDocumentTest extends TestCase {
assertRegions(expected, regions);
} catch (BadLocationException e) {
assertTrue(false);
- }
+ }
}
-
+
public void test29_38() {
// test computation of unprojected master regions
createProjectionA();
@@ -2474,6 +2474,6 @@ public class ProjectionDocumentTest extends TestCase {
assertRegions(expected, regions);
} catch (BadLocationException e) {
assertTrue(false);
- }
+ }
}
}
diff --git a/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionMappingTest.java b/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionMappingTest.java
index de309fb7a13..273b964940c 100644
--- a/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionMappingTest.java
+++ b/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionMappingTest.java
@@ -26,20 +26,20 @@ import org.eclipse.jface.text.projection.Segment;
* @since 3.0
*/
public class ProjectionMappingTest extends TestCase {
-
+
private IDocument fMasterDocument;
private IDocument fSlaveDocument;
private String fFragmentsCategory;
private String fSegmentsCategory;
private ProjectionMapping fProjectionMapping;
-
-
+
+
public ProjectionMappingTest(String name) {
super(name);
}
-
+
private String getOriginalMasterContent() {
- return
+ return
"1111111111111111111\n" +
"2222222222222222222\n" +
"3333333333333333333\n" +
@@ -50,7 +50,7 @@ public class ProjectionMappingTest extends TestCase {
"8888888888888888888\n" +
"99999999999999999999";
}
-
+
private String getOriginalSlaveContent() {
StringBuffer buffer= new StringBuffer(getOriginalMasterContent());
buffer.delete(80, 180);
@@ -58,7 +58,7 @@ public class ProjectionMappingTest extends TestCase {
buffer.delete(0, 20);
return buffer.toString();
}
-
+
private String getLineWrappingSlaveContent() {
StringBuffer buffer= new StringBuffer(getOriginalMasterContent());
buffer.delete(80, 180);
@@ -66,7 +66,7 @@ public class ProjectionMappingTest extends TestCase {
buffer.delete(10, 30); // ...111222...
return buffer.toString(); // "1111111111222222222\n3333333333444444444\n"
}
-
+
private void addProjection(int fragmentOffset, int segmentOffset, int length) {
Fragment fragment= new Fragment(fragmentOffset, length);
Segment segment= new Segment(segmentOffset, length);
@@ -81,7 +81,7 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
private void createStandardProjection() {
fMasterDocument.set(getOriginalMasterContent());
fSlaveDocument.set(getOriginalSlaveContent());
@@ -94,7 +94,7 @@ public class ProjectionMappingTest extends TestCase {
fSlaveDocument.set(getOriginalMasterContent());
addProjection(0, 0, fMasterDocument.getLength());
}
-
+
private void createLineWrappingProjection() {
fMasterDocument.set(getOriginalMasterContent());
fSlaveDocument.set(getLineWrappingSlaveContent());
@@ -102,7 +102,7 @@ public class ProjectionMappingTest extends TestCase {
addProjection(30, 10, 20);
addProjection(70, 30, 10);
}
-
+
/*
* @see junit.framework.TestCase#setUp()
*/
@@ -113,9 +113,9 @@ public class ProjectionMappingTest extends TestCase {
fSegmentsCategory= "_segments" + fMasterDocument.hashCode();
fMasterDocument.addPositionCategory(fFragmentsCategory);
fSlaveDocument.addPositionCategory(fSegmentsCategory);
- fProjectionMapping= new ProjectionMapping(fMasterDocument, fFragmentsCategory, fSlaveDocument, fSegmentsCategory);
+ fProjectionMapping= new ProjectionMapping(fMasterDocument, fFragmentsCategory, fSlaveDocument, fSegmentsCategory);
}
-
+
/*
* @see junit.framework.TestCase#tearDown()
@@ -127,19 +127,19 @@ public class ProjectionMappingTest extends TestCase {
fSegmentsCategory= null;
fProjectionMapping= null;
}
-
+
public void test1() {
// test getCoverage
-
+
createStandardProjection();
IRegion coverage= fProjectionMapping.getCoverage();
assertTrue(coverage.getOffset() == 20);
assertTrue(coverage.getLength() == 60);
}
-
+
public void test2() {
// test toOriginOffset
-
+
createStandardProjection();
try {
assertEquals(20, fProjectionMapping.toOriginOffset(0));
@@ -150,19 +150,19 @@ public class ProjectionMappingTest extends TestCase {
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
try {
fProjectionMapping.toOriginOffset(41);
assertTrue(false);
} catch (BadLocationException e) {
}
}
-
-
+
+
public void test3a() {
// test toOriginRegion
// image region inside segment
-
+
createStandardProjection();
try {
IRegion origin= fProjectionMapping.toOriginRegion(new Region(5, 10));
@@ -173,11 +173,11 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test3b() {
// test toOriginRegion
// image region is segment
-
+
createStandardProjection();
try {
IRegion origin= fProjectionMapping.toOriginRegion(new Region(0, 20));
@@ -188,7 +188,7 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test3c() {
// test toOriginRegion
// image region overlapping segments
@@ -200,9 +200,9 @@ public class ProjectionMappingTest extends TestCase {
assertEquals(new Region(20, 60), origin);
} catch (BadLocationException e) {
assertTrue(false);
- }
+ }
}
-
+
public void test3d() {
// test toOriginRegion
// test null projection
@@ -213,7 +213,7 @@ public class ProjectionMappingTest extends TestCase {
} catch (BadLocationException e) {
assertTrue(false);
}
-
+
try {
fProjectionMapping.toOriginRegion(new Region(0, 2));
assertTrue(false);
@@ -226,11 +226,11 @@ public class ProjectionMappingTest extends TestCase {
} catch (BadLocationException e) {
}
}
-
+
public void test3e() {
// test toOriginRegion
// identical projection
-
+
createIdenticalProjection();
try {
IRegion origin= fProjectionMapping.toOriginRegion(new Region(0, 0));
@@ -245,29 +245,29 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test3f() {
- // test toOriginRegion
+ // test toOriginRegion
// test empty slave document
-
+
fMasterDocument.set("abc\n");
fSlaveDocument.set("");
addProjection(4, 0, 0);
-
+
try {
IRegion origin= fProjectionMapping.toOriginRegion(new Region(0, 0));
assertEquals(new Region(4, 0), origin); // fails, origin is (0, 4)
} catch (BadLocationException e) {
assertTrue(false);
- }
+ }
}
-
+
public void test4() {
// test toOriginLines
-
+
createLineWrappingProjection();
assertEquals(3, fSlaveDocument.getNumberOfLines());
-
+
try {
IRegion lines= fProjectionMapping.toOriginLines(0);
assertEquals(new Region(0,2), lines);
@@ -279,14 +279,14 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test5a() {
// test toOriginLine
// test projection with no wrapped line
-
+
createStandardProjection();
assertEquals(3, fSlaveDocument.getNumberOfLines());
-
+
try {
assertEquals(1, fProjectionMapping.toOriginLine(0));
assertEquals(3, fProjectionMapping.toOriginLine(1));
@@ -295,13 +295,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test5b() {
// test toOriginLine
// test line wrapping projection
-
+
createLineWrappingProjection();
-
+
try {
assertEquals(-1, fProjectionMapping.toOriginLine(0));
assertEquals(-1, fProjectionMapping.toOriginLine(1));
@@ -310,12 +310,12 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test6() {
// test toImageOffset
-
+
createStandardProjection();
-
+
try {
// test begin of slave document
assertEquals(0, fProjectionMapping.toImageOffset(20));
@@ -335,15 +335,15 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
private IRegion computeImageRegion(IRegion region, boolean exact) throws BadLocationException {
if (exact)
return fProjectionMapping.toExactImageRegion(region);
return fProjectionMapping.toImageRegion(region);
}
-
+
private void commonSubSection_toImageRegion(boolean exact) {
-
+
try {
// test a region contained by a fragment
IRegion imageRegion= computeImageRegion(new Region(25, 10), exact);
@@ -369,18 +369,18 @@ public class ProjectionMappingTest extends TestCase {
// test a region at the end of the last fragment
imageRegion= computeImageRegion(new Region(80, 10), exact);
assertEquals(null, imageRegion);
-
+
} catch (BadLocationException e) {
assertTrue(false);
- }
+ }
}
public void test7() {
// test toExactImageRegion
-
+
createStandardProjection();
commonSubSection_toImageRegion(true);
-
+
try {
// test a region surrounded by two fragments
IRegion imageRegion= fProjectionMapping.toExactImageRegion(new Region(40, 20));
@@ -397,18 +397,18 @@ public class ProjectionMappingTest extends TestCase {
// test a region starting outside a fragment and ending outside a fragment (covering two)
imageRegion= fProjectionMapping.toExactImageRegion(new Region(15, 70));
assertEquals(null, imageRegion);
-
+
} catch (BadLocationException e) {
assertTrue(false);
}
}
-
+
public void test8() {
// test toImageRegion
-
+
createStandardProjection();
commonSubSection_toImageRegion(false);
-
+
try {
// test a region surrounded by two fragments
IRegion imageRegion= fProjectionMapping.toImageRegion(new Region(40, 20));
@@ -425,7 +425,7 @@ public class ProjectionMappingTest extends TestCase {
// test a region starting outside a fragment and ending outside a fragment (covering two)
imageRegion= fProjectionMapping.toImageRegion(new Region(15, 70));
assertEquals(new Region(0, 40), imageRegion);
-
+
} catch (BadLocationException e) {
assertTrue(false);
}
@@ -433,9 +433,9 @@ public class ProjectionMappingTest extends TestCase {
public void test8b() {
// test toImageRegion
-
+
createStandardProjection();
-
+
try {
// test a region contained by a fragment
IRegion imageRegion= fProjectionMapping.toClosestImageRegion(new Region(25, 10));
@@ -479,16 +479,16 @@ public class ProjectionMappingTest extends TestCase {
// test a region starting outside a fragment and ending outside a fragment (covering two)
imageRegion= fProjectionMapping.toClosestImageRegion(new Region(15, 70));
assertEquals(new Region(0, 40), imageRegion);
-
+
} catch (BadLocationException e) {
assertTrue(false);
}
}
-
+
public void test9a() {
// test toImageLine
// test standard line wrapping projection
-
+
createLineWrappingProjection();
try {
assertEquals( 0, fProjectionMapping.toImageLine(0));
@@ -509,15 +509,15 @@ public class ProjectionMappingTest extends TestCase {
public void test9b() {
// test toImageLine
// test non-line wrapping, well distributed projection of empty lines
-
+
fMasterDocument.set("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
fSlaveDocument.set("\n\n\n\n\n\n");
addProjection(3, 0, 3);
addProjection(9, 3, 3);
-
+
assertEquals(16, fMasterDocument.getNumberOfLines());
assertEquals(7, fSlaveDocument.getNumberOfLines());
-
+
try {
assertEquals(-1, fProjectionMapping.toImageLine(0));
assertEquals(-1, fProjectionMapping.toImageLine(1));
@@ -537,13 +537,13 @@ public class ProjectionMappingTest extends TestCase {
assertEquals(-1, fProjectionMapping.toImageLine(15));
} catch (BadLocationException e) {
assertTrue(false);
- }
+ }
}
public void test10a() {
// test toClosestImageLine
// test standard line wrapping projection
-
+
createLineWrappingProjection();
try {
assertEquals(0, fProjectionMapping.toClosestImageLine(0));
@@ -558,33 +558,33 @@ public class ProjectionMappingTest extends TestCase {
assertEquals(2, fProjectionMapping.toClosestImageLine(9));
} catch (BadLocationException e) {
assertTrue(false);
- }
+ }
}
-
+
public void test10b() {
// test toClosestImageLine
// test empty projection
-
+
try {
assertEquals(-1, fProjectionMapping.toClosestImageLine(0));
} catch (BadLocationException e) {
assertTrue(false);
}
}
-
+
public void test10c() {
// test toClosestImageLine
// test non-line wrapping, well distributed projection of empty lines
-
+
fMasterDocument.set("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
// fSlaveDocument.set(" \n\n\n \n\n\n ");
fSlaveDocument.set("\n\n\n\n\n\n");
addProjection(3, 0, 3);
addProjection(9, 3, 3);
-
+
assertEquals(16, fMasterDocument.getNumberOfLines());
assertEquals(7, fSlaveDocument.getNumberOfLines());
-
+
try {
assertEquals(0, fProjectionMapping.toClosestImageLine(0));
assertEquals(0, fProjectionMapping.toClosestImageLine(1));
@@ -604,21 +604,21 @@ public class ProjectionMappingTest extends TestCase {
assertEquals(6, fProjectionMapping.toClosestImageLine(15));
} catch (BadLocationException e) {
assertTrue(false);
- }
+ }
}
-
+
private void assertRegions(IRegion[] expected, IRegion[] actual) {
assertTrue("invalid number of regions", expected.length == actual.length);
for (int i= 0; i < expected.length; i++)
assertEquals(expected[i], actual[i]);
}
-
+
public void test11a() {
// test toExactOriginRegions
// test the whole slave document
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactOriginRegions(new Region(0, fSlaveDocument.getLength()));
IRegion[] expected= new IRegion[] {
@@ -630,13 +630,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test11b() {
// test toExactOriginRegions
// test a region completely comprised by a segment
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactOriginRegions(new Region(5, 10));
IRegion[] expected= new IRegion[] {
@@ -647,13 +647,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test11c() {
// test toExactOriginRegions
// test a region completely comprised by a segment at the beginning of a segment
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactOriginRegions(new Region(0, 10));
IRegion[] expected= new IRegion[] {
@@ -668,9 +668,9 @@ public class ProjectionMappingTest extends TestCase {
public void test11d() {
// test toExactOriginRegions
// test a region completely comprised by a segment at the end of a segment
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactOriginRegions(new Region(10, 10));
IRegion[] expected= new IRegion[] {
@@ -681,13 +681,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test11e() {
// test toExactOriginRegions
// test a complete segment
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactOriginRegions(new Region(0, 20));
IRegion[] expected= new IRegion[] {
@@ -698,13 +698,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test11f() {
- // test toExactOriginRegions
+ // test toExactOriginRegions
// test zero-length regions
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactOriginRegions(new Region(0, 0));
IRegion[] expected= new IRegion[] {
@@ -723,18 +723,18 @@ public class ProjectionMappingTest extends TestCase {
new Region(80, 0)
};
assertRegions(expected, actual);
-
+
} catch (BadLocationException e) {
assertTrue(false);
}
}
public void test11g() {
- // test toExactOriginRegions
+ // test toExactOriginRegions
// test a region starting in the middle of a segment and ending in the middle of another fragment
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactOriginRegions(new Region(10, 20));
IRegion[] expected= new IRegion[] {
@@ -746,13 +746,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test11h() {
// test toExactOriginRegions
// test a region completely comprised by a segment at the end of a segment, not the first segment
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactOriginRegions(new Region(30, 10));
IRegion[] expected= new IRegion[] {
@@ -763,13 +763,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test11i() {
// test toExactOriginRegions
// test a single region in the identical projection
-
+
createIdenticalProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactOriginRegions(new Region(30, 10));
IRegion[] expected= new IRegion[] {
@@ -778,16 +778,16 @@ public class ProjectionMappingTest extends TestCase {
assertRegions(expected, actual);
} catch (BadLocationException e) {
assertTrue(false);
- }
-
+ }
+
}
-
+
public void test12a() {
// test toExactImageRegions
// test the whole master document
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactImageRegions(new Region(0, fMasterDocument.getLength()));
IRegion[] expected= new IRegion[] {
@@ -799,13 +799,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test12b() {
// test toExactImageRegions
// test a region completely comprised by a fragment
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactImageRegions(new Region(25, 10));
IRegion[] expected= new IRegion[] {
@@ -816,13 +816,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test12c() {
// test toExactImageRegions
// test a region completely comprised by a fragment at the beginning of a fragment
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactImageRegions(new Region(20, 10));
IRegion[] expected= new IRegion[] {
@@ -837,9 +837,9 @@ public class ProjectionMappingTest extends TestCase {
public void test12d() {
// test toExactImageRegions
// test a region completely comprised by a fragment at the end of a fragment
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactImageRegions(new Region(30, 10));
IRegion[] expected= new IRegion[] {
@@ -850,13 +850,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test12e() {
// test toExactImageRegions
// test a complete fragment
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactImageRegions(new Region(20, 20));
IRegion[] expected= new IRegion[] {
@@ -867,13 +867,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test12f() {
- // test toExactImageRegions
+ // test toExactImageRegions
// test zero-length regions
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactImageRegions(new Region(20, 0));
IRegion[] expected= new IRegion[] {
@@ -892,18 +892,18 @@ public class ProjectionMappingTest extends TestCase {
new Region(40, 0)
};
assertRegions(expected, actual);
-
+
} catch (BadLocationException e) {
assertTrue(false);
}
}
public void test12g() {
- // test toExactImageRegions
+ // test toExactImageRegions
// test a region starting in the middle of a fragment and ending in the middle of another fragment
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactImageRegions(new Region(30, 40));
IRegion[] expected= new IRegion[] {
@@ -915,13 +915,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test12h() {
// test toExactImageRegions
// test a region completely comprised by a fragment at the end of a fragment, not the first fragment
-
+
createStandardProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactImageRegions(new Region(70, 10));
IRegion[] expected= new IRegion[] {
@@ -932,13 +932,13 @@ public class ProjectionMappingTest extends TestCase {
assertTrue(false);
}
}
-
+
public void test12i() {
// test toExactImageRegions
// test a single region in the identical projection
-
+
createIdenticalProjection();
-
+
try {
IRegion[] actual= fProjectionMapping.toExactImageRegions(new Region(30, 10));
IRegion[] expected= new IRegion[] {
@@ -947,34 +947,34 @@ public class ProjectionMappingTest extends TestCase {
assertRegions(expected, actual);
} catch (BadLocationException e) {
assertTrue(false);
- }
-
+ }
+
}
-
+
public void test13a() {
// test getImageLength
// empty projection
assertEquals(0, fProjectionMapping.getImageLength());
}
-
+
public void test13b() {
// test getImageLength
// identical projection
createIdenticalProjection();
assertEquals(fSlaveDocument.getLength(), fProjectionMapping.getImageLength());
}
-
+
public void test13c() {
// test getImageLength
// standard projection
createStandardProjection();
- assertEquals(fSlaveDocument.getLength(), fProjectionMapping.getImageLength());
+ assertEquals(fSlaveDocument.getLength(), fProjectionMapping.getImageLength());
}
public void test13d() {
// test getImageLength
// line wrapping projection
createLineWrappingProjection();
- assertEquals(fSlaveDocument.getLength(), fProjectionMapping.getImageLength());
+ assertEquals(fSlaveDocument.getLength(), fProjectionMapping.getImageLength());
}
}
diff --git a/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionTestSuite.java b/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionTestSuite.java
index c220f6e5371..cd3bad23972 100644
--- a/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionTestSuite.java
+++ b/org.eclipse.text.tests/projection/org/eclipse/text/tests/ProjectionTestSuite.java
@@ -16,7 +16,7 @@ import junit.framework.TestSuite;
/**
- *
+ *
* @since 3.0
*/
public class ProjectionTestSuite {
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/AbstractGapTextTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/AbstractGapTextTest.java
index 632142bb466..00d9e35ce65 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/AbstractGapTextTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/AbstractGapTextTest.java
@@ -16,7 +16,7 @@ import org.eclipse.jface.text.GapTextStore;
/**
* A test specifically testing the gap property of a gap text store.
- *
+ *
* @since 3.3
*/
public class AbstractGapTextTest extends TestCase {
@@ -24,7 +24,7 @@ public class AbstractGapTextTest extends TestCase {
/**
* Creates a new empty text store using the specified low and high watermarks.
- *
+ *
* @param lowWatermark unused - at the lower bound, the array is only resized when the
* content does not fit
* @param highWatermark if the gap is ever larger than this, it will automatically be
@@ -34,7 +34,7 @@ public class AbstractGapTextTest extends TestCase {
public GapText(int lowWatermark, int highWatermark) {
super(lowWatermark, highWatermark);
}
-
+
public GapText(int min, int max, float maxGapFactor) {
super(min, max, maxGapFactor);
}
@@ -55,21 +55,21 @@ public class AbstractGapTextTest extends TestCase {
return super.getContentAsString().length();
}
}
-
+
protected GapText fText;
-
+
private String printGap() {
return printGap(fText.getGapStart(), fText.getGapEnd());
}
-
+
private String printGap(int start, int end) {
return "[" + start + "," + end + "]";
}
-
+
protected void assertGap(int start, int end) {
assertTrue("Invalid gap. Expected: " + printGap(start, end) + " actual:" + printGap() , fText.getGapStart() == start && fText.getGapEnd() == end);
}
-
+
protected void assertContents(String expected) {
assertEquals(expected, fText.get(0, fText.getLength()));
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/AbstractLineTrackerTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/AbstractLineTrackerTest.java
index 2bd5eaeac6e..32e0d34c9b7 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/AbstractLineTrackerTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/AbstractLineTrackerTest.java
@@ -18,20 +18,20 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextStore;
/**
- *
+ *
* @since 3.2
*/
public abstract class AbstractLineTrackerTest extends TestCase {
protected ITextStore fText;
protected ILineTracker fTracker;
-
+
protected AbstractLineTrackerTest(String name) {
super(name);
}
-
+
protected final void checkLines(int[] lines) throws BadLocationException {
assertEquals("number of lines", lines.length, fTracker.getNumberOfLines());
-
+
for (int i= 0; i < lines.length; i++) {
IRegion line= fTracker.getLineInformation(i);
@@ -47,10 +47,10 @@ public abstract class AbstractLineTrackerTest extends TestCase {
fTracker.replace(offset, length, text);
fText.replace(offset, length, text);
}
-
+
protected final void set(String string) {
fText.set(string);
fTracker.set(string);
}
-
+
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java
index b143899c273..d24a7395d2d 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java
@@ -22,11 +22,11 @@ import org.eclipse.core.runtime.Assert;
* Helper class for accessing classes and members which cannot
* be accessed using standard Java access control like private
* or package visible elements.
- *
+ *
* @since 3.1
*/
public class Accessor {
-
+
/** The class to access. */
private Class fClass;
/** The instance to access. */
@@ -36,7 +36,7 @@ public class Accessor {
* Creates an accessor for the given <code>instance</code> and
* <code>class</code>. Only non-inherited members that particular
* <code>class</code> can be accessed.
- *
+ *
* @param instance the instance
* @param clazz the class
*/
@@ -46,12 +46,12 @@ public class Accessor {
fInstance= instance;
fClass= clazz;
}
-
+
/**
* Creates an accessor for the given <code>instance</code> and
* <code>class</code>. Only non-inherited members that particular
* <code>class</code> can be accessed.
- *
+ *
* @param instance the instance
* @param className the name of the class
* @param classLoader the class loader to use i.e. <code>getClass().getClassLoader()</code>
@@ -69,7 +69,7 @@ public class Accessor {
fail();
}
}
-
+
/**
* Creates an accessor for the given class.
* <p>
@@ -77,7 +77,7 @@ public class Accessor {
* arguments they must all be instanceof Object. Use
* {@link #Accessor(String, ClassLoader, Class[], Object[])} if this
* is not the case.</p>
- *
+ *
* @param className the name of the class
* @param classLoader the class loader to use i.e. <code>getClass().getClassLoader()</code>
* @param constructorArgs the constructor arguments which must all be instance of Object
@@ -85,10 +85,10 @@ public class Accessor {
public Accessor(String className, ClassLoader classLoader, Object[] constructorArgs) {
this(className, classLoader, getTypes(constructorArgs), constructorArgs);
}
-
+
/**
* Creates an accessor for the given class.
- *
+ *
* @param className the name of the class
* @param classLoader the class loader to use i.e. <code>getClass().getClassLoader()</code>
* @param constructorTypes the types of the constructor arguments
@@ -124,13 +124,13 @@ public class Accessor {
fail();
}
}
-
+
/**
* Creates an accessor for the given class.
* <p>
* This constructor is used to access static stuff.
* </p>
- *
+ *
* @param className the name of the class
* @param classLoader the class loader to use i.e. <code>getClass().getClassLoader()</code>
*/
@@ -151,7 +151,7 @@ public class Accessor {
* arguments all those arguments must be instance of Object. Use
* {@link #invoke(String, Class[], Object[])} if this
* is not the case.</p>
- *
+ *
* @param methodName the method name
* @param arguments the method arguments which must all be instance of Object
* @return the method return value
@@ -159,10 +159,10 @@ public class Accessor {
public Object invoke(String methodName, Object[] arguments) {
return invoke(methodName, getTypes(arguments), arguments);
}
-
+
/**
* Invokes the method with the given method name and arguments.
- *
+ *
* @param methodName the method name
* @param types the argument types
* @param arguments the method arguments
@@ -190,10 +190,10 @@ public class Accessor {
}
return null;
}
-
+
/**
- * Assigns the given value to the field with the given name.
- *
+ * Assigns the given value to the field with the given name.
+ *
* @param fieldName the field name
* @param value the value to assign to the field
*/
@@ -207,10 +207,10 @@ public class Accessor {
fail();
}
}
-
+
/**
- * Assigns the given value to the field with the given name.
- *
+ * Assigns the given value to the field with the given name.
+ *
* @param fieldName the field name
* @param value the value to assign to the field
*/
@@ -224,10 +224,10 @@ public class Accessor {
fail();
}
}
-
+
/**
- * Assigns the given value to the field with the given name.
- *
+ * Assigns the given value to the field with the given name.
+ *
* @param fieldName the field name
* @param value the value to assign to the field
*/
@@ -241,10 +241,10 @@ public class Accessor {
fail();
}
}
-
+
/**
- * Returns the value of the field with the given name.
- *
+ * Returns the value of the field with the given name.
+ *
* @param fieldName the field name
* @return the value of the field
*/
@@ -260,10 +260,10 @@ public class Accessor {
// Unreachable code
return null;
}
-
+
/**
- * Returns the value of the field with the given name.
- *
+ * Returns the value of the field with the given name.
+ *
* @param fieldName the field name
* @return the value of the field
*/
@@ -279,10 +279,10 @@ public class Accessor {
// Unreachable code
return false;
}
-
+
/**
- * Returns the value of the field with the given name.
- *
+ * Returns the value of the field with the given name.
+ *
* @param fieldName the field name
* @return the value of the field
*/
@@ -298,7 +298,7 @@ public class Accessor {
// Unreachable code
return 0;
}
-
+
private Field getField(String fieldName) {
Field field= null;
try {
@@ -311,11 +311,11 @@ public class Accessor {
field.setAccessible(true);
return field;
}
-
+
private static Class[] getTypes(Object[] objects) {
if (objects == null)
return null;
-
+
int length= objects.length;
Class[] classes= new Class[length];
for (int i= 0; i < length; i++) {
@@ -324,7 +324,7 @@ public class Accessor {
}
return classes;
}
-
+
private void fail() {
Assert.isTrue(false);
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/AdaptiveGapTextTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/AdaptiveGapTextTest.java
index 1ba9effed37..4bb68b26957 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/AdaptiveGapTextTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/AdaptiveGapTextTest.java
@@ -19,19 +19,19 @@ public class AdaptiveGapTextTest extends AbstractGapTextTest {
fText= new GapText(2, 10, 0.5f);
fText.set("xxxxx");
}
-
+
public static Test suite() {
- return new TestSuite(AdaptiveGapTextTest.class);
+ return new TestSuite(AdaptiveGapTextTest.class);
}
-
+
protected void tearDown () {
fText= null;
}
-
+
public void testSet() {
assertGap(5, 7);
}
-
+
public void testGetText1() {
String[] expected= {
"xyxxxx",
@@ -40,14 +40,14 @@ public class AdaptiveGapTextTest extends AbstractGapTextTest {
"xyxyxyxyx",
"xyxyxyxyxy"
};
-
+
for (int i= 1; i < 5; i++) {
fText.replace(2 * i - 1, 0, "y");
assertContents(expected[i - 1]);
}
-
+
}
-
+
public void testGetText2() {
String[] expected= {
"yxxxxx",
@@ -56,24 +56,24 @@ public class AdaptiveGapTextTest extends AbstractGapTextTest {
"yxyxyxyxx",
"yxyxyxyxyx"
};
-
+
for (int i= 1; i < 5; i++) {
fText.replace(2 * (i - 1), 0, "y");
assertContents(expected[i - 1]);
}
-
+
}
-
+
public void testInsert() {
fText.replace(2, 0, "y");
assertGap(3, 4);
-
-
+
+
for (int i= 1; i <= 1; i++) {
fText.replace(2 + i, 0, "y");
assertGap(3 + i, 4);
}
-
+
fText.replace(7, 0, "y");
assertGap(8, 10);
}
@@ -81,39 +81,39 @@ public class AdaptiveGapTextTest extends AbstractGapTextTest {
public void testRemoveGapOverlapping() {
fText.replace(2, 2, null);
assertGap(2, 6);
-
+
fText.replace(1, 2, null);
assertGap(1, 3);
}
-
+
public void testRemoveGapOverlapping2() {
fText.replace(0, 0, "aaaaazzzzzyyyyy");
assertGap(15, 21);
assertContents("aaaaazzzzzyyyyyxxxxx");
-
-
+
+
fText.replace(5, 12, null);
assertGap(5, 7);
assertContents("aaaaaxxx");
}
-
+
public void testRemoveRemoteFromGap() {
fText.replace(0, 0, "aaaaazzzzzyyyyy");
assertGap(15, 21);
assertContents("aaaaazzzzzyyyyyxxxxx");
-
+
// before gap
fText.replace(5, 2, null);
assertGap(5, 13);
assertContents("aaaaazzzyyyyyxxxxx");
-
+
// after gap
fText.replace(7, 10, null);
assertGap(7, 9);
assertContents("aaaaazzx");
-
+
}
-
+
public void testRemoveAtLeftGapEdge() {
fText.replace(4, 0, "xxx");
assertGap(7, 9);
@@ -122,7 +122,7 @@ public class AdaptiveGapTextTest extends AbstractGapTextTest {
fText.replace(6, 1, null);
assertGap(6, 8);
}
-
+
public void testRemoveAtRightGapEdge() {
fText.replace(4, 0, "xxx");
assertGap(7, 9);
@@ -131,23 +131,23 @@ public class AdaptiveGapTextTest extends AbstractGapTextTest {
fText.replace(7, 1, null);
assertGap(7, 9);
}
-
+
public void testReplace() {
fText.replace(2, 2, "yy");
assertGap(4, 6);
-
+
fText.replace(2, 1, "yyyyyyyyyyyy");
assertGap(14, 19);
-
+
fText.replace(14, 0, "yyy");
assertGap(17, 19);
}
-
+
public void testRemoveReallocateBeforeGap() throws Exception {
fText.replace(0, 0, "yyyyyzzzzz");
assertGap(10, 15);
assertContents("yyyyyzzzzzxxxxx");
-
+
fText.replace(2, 6, null);
assertGap(2, 5);
assertContents("yyzzxxxxx");
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/AnnotationModelExtension2Test.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/AnnotationModelExtension2Test.java
index e83986ca638..0c8c5a3035e 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/AnnotationModelExtension2Test.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/AnnotationModelExtension2Test.java
@@ -31,55 +31,55 @@ import org.eclipse.jface.text.source.IAnnotationModelListener;
/**
* Tests the {@link org.eclipse.jface.text.source.IAnnotationModelExtension2}.
- *
+ *
* @since 3.4
*/
public class AnnotationModelExtension2Test extends TestCase {
public class OldAnnotationModel implements IAnnotationModel {
-
+
private final HashMap fAnnotations= new HashMap();
-
+
public void addAnnotation(Annotation annotation, Position position) {
fAnnotations.put(annotation, position);
}
-
+
public void addAnnotationModelListener(IAnnotationModelListener listener) {
}
-
+
public void connect(IDocument document) {
}
-
+
public void disconnect(IDocument document) {
}
-
+
public Iterator getAnnotationIterator() {
return fAnnotations.keySet().iterator();
}
-
+
public Position getPosition(Annotation annotation) {
return (Position) fAnnotations.get(annotation);
}
-
+
public void removeAnnotation(Annotation annotation) {
fAnnotations.remove(annotation);
}
-
+
public void removeAnnotationModelListener(IAnnotationModelListener listener) {
}
-
+
public void removeAllAnnotations() {
fAnnotations.clear();
}
}
-
+
private static final int MODEL_COUNT= 3;
-
+
private Document fDocument;
private AnnotationModel fAnnotationModel;
private AnnotationModel fNewInnerModel;
private OldAnnotationModel fOldInnerModel;
-
+
private Annotation fInside;
private Annotation fBefore;
private Annotation fAfter;
@@ -89,47 +89,47 @@ public class AnnotationModelExtension2Test extends TestCase {
private Annotation fBoforeOut;
private Annotation fAfterIn;
private Annotation fAfterOut;
-
+
public static Test suite() {
return new TestSuite(AnnotationModelExtension2Test.class);
}
-
+
/**
* {@inheritDoc}
*/
protected void setUp() throws Exception {
fDocument= new Document("How much wood\nwould a woodchuck chuck\nif a woodchuck\ncould chuck wood?\n42");
-
+
fAnnotationModel= new AnnotationModel();
-
+
fNewInnerModel= new AnnotationModel();
fAnnotationModel.addAnnotationModel("model1", fNewInnerModel);
-
+
fOldInnerModel= new OldAnnotationModel();
fAnnotationModel.addAnnotationModel("model2", fOldInnerModel);
-
+
fInside= new Annotation(false);
fInsideIn= new Annotation(false);
fInsideOut= new Annotation(false);
-
+
fBefore= new Annotation(false);
fBeforeIn= new Annotation(false);
fBoforeOut= new Annotation(false);
-
+
fAfter= new Annotation(false);
fAfterIn= new Annotation(false);
fAfterOut= new Annotation(false);
-
+
fAnnotationModel.connect(fDocument);
}
-
+
/**
* {@inheritDoc}
*/
protected void tearDown() throws Exception {
fAnnotationModel.disconnect(fDocument);
}
-
+
private void assertEquals(Annotation[] expected, Annotation[] actual, IAnnotationModel insideModel, IAnnotationModel beforeModel, IAnnotationModel afterModel) {
HashSet expectedSet= new HashSet(Arrays.asList(expected));
for (int i= 0; i < actual.length; i++) {
@@ -139,7 +139,7 @@ public class AnnotationModelExtension2Test extends TestCase {
}
expectedSet.remove(actual[i]);
}
-
+
if (!expectedSet.isEmpty()) {
String message= "Missing annotations in result with models [" + getAnnotationModelNames(insideModel, beforeModel, afterModel) + "]";
for (Iterator iterator= expectedSet.iterator(); iterator.hasNext();) {
@@ -149,11 +149,11 @@ public class AnnotationModelExtension2Test extends TestCase {
assertTrue(message, false);
}
}
-
+
private String getAnnotationModelNames(IAnnotationModel insideModel, IAnnotationModel beforeModel, IAnnotationModel afterModel) {
return "inside: " + getAnnotationModelName(insideModel) + " before: " + getAnnotationModelName(beforeModel) + " after: " + getAnnotationModelName(afterModel);
}
-
+
private String getAnnotationModelName(IAnnotationModel model) {
if (model == fAnnotationModel) {
return "'Top'";
@@ -162,7 +162,7 @@ public class AnnotationModelExtension2Test extends TestCase {
} else if (model == fOldInnerModel) {
return "'Old inner'";
}
-
+
return "'Unknown'";
}
@@ -174,13 +174,13 @@ public class AnnotationModelExtension2Test extends TestCase {
/*
* The annotations are added to the annotations models
* as following:
- *
+ *
* 0-beforeout-9 21-afterout--30
* 0--beforein---11 19---afterin---30
* 0--before----10 20--after-----30
- *
+ *
* 10--region----20
- *
+ *
* 10--inside----20
* 11-insidein-19
* 9---insideout---21
@@ -189,11 +189,11 @@ public class AnnotationModelExtension2Test extends TestCase {
insideModel.addAnnotation(fInside, new Position(10, 11));
insideModel.addAnnotation(fInsideIn, new Position(11, 9));
insideModel.addAnnotation(fInsideOut, new Position(9, 13));
-
+
beforeModel.addAnnotation(fBefore, new Position(0, 11));
beforeModel.addAnnotation(fBeforeIn, new Position(0, 12));
beforeModel.addAnnotation(fBoforeOut, new Position(0, 10));
-
+
afterModel.addAnnotation(fAfter, new Position(20, 11));
afterModel.addAnnotation(fAfterIn, new Position(19, 12));
afterModel.addAnnotation(fAfterOut, new Position(21, 10));
@@ -204,18 +204,18 @@ public class AnnotationModelExtension2Test extends TestCase {
fNewInnerModel.removeAllAnnotations();
fOldInnerModel.removeAllAnnotations();
}
-
+
private Annotation[] getAnnotations(boolean lookAhead, boolean lookBehind) {
Iterator iterator= fAnnotationModel.getAnnotationIterator(10, 11, lookAhead, lookBehind);
-
+
ArrayList result= new ArrayList();
while (iterator.hasNext()) {
result.add(iterator.next());
}
-
+
return (Annotation[]) result.toArray(new Annotation[result.size()]);
}
-
+
private void assertPermutations(boolean lookAhead, boolean lookBehind, Annotation[] expected) {
for (int i= 0; i < MODEL_COUNT; i++) {
for (int j= 0; j < MODEL_COUNT; j++) {
@@ -223,18 +223,18 @@ public class AnnotationModelExtension2Test extends TestCase {
IAnnotationModel insideModel= getModel(i);
IAnnotationModel beforeModel= getModel(j);
IAnnotationModel afterModel= getModel(k);
-
+
addAnnotations(insideModel, beforeModel, afterModel);
-
+
Annotation[] actual= getAnnotations(lookAhead, lookBehind);
assertEquals(expected, actual, insideModel, beforeModel, afterModel);
-
+
removeAnnotations();
}
}
}
}
-
+
private IAnnotationModel getModel(int number) {
switch (number) {
case 0:
@@ -246,25 +246,25 @@ public class AnnotationModelExtension2Test extends TestCase {
}
return null;
}
-
+
public void testInside() throws Exception {
Annotation[] expected= new Annotation[] { fInside, fInsideIn };
assertPermutations(false, false, expected);
}
-
+
public void testAhead() throws Exception {
Annotation[] expected= new Annotation[] { fInside, fInsideIn, fBefore, fBeforeIn };
assertPermutations(true, false, expected);
}
-
+
public void testBehind() throws Exception {
Annotation[] expected= new Annotation[] { fInside, fInsideIn, fAfter, fAfterIn };
assertPermutations(false, true, expected);
}
-
+
public void testAheadBehind() throws Exception {
Annotation[] expected= new Annotation[] { fInside, fInsideIn, fInsideOut, fAfter, fAfterIn, fBefore, fBeforeIn };
assertPermutations(true, true, expected);
}
-
+
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/AnnotationModelStressTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/AnnotationModelStressTest.java
index 7c0a88f305a..8a99cd2a6d7 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/AnnotationModelStressTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/AnnotationModelStressTest.java
@@ -29,7 +29,7 @@ import org.eclipse.jface.text.source.IAnnotationModel;
* @since 3.4
*/
public class AnnotationModelStressTest extends TestCase {
-
+
private static final String RANDOM_CONTENT= "UENTXRXNMRXSTNVZFACSMTQYVGOLEPGRXRH\n" +
"BCQCYH\n" +
"ZSJRPJZIVPLESNNZXJKZXKATUOPEB\n" +
@@ -1027,7 +1027,7 @@ public class AnnotationModelStressTest extends TestCase {
"VTRPDYUXBYCTZY\n" +
"XBW\n" +
"KMFEPXDJRSZRARZKCFCNZKDRNMKIMKVDQBVTSFFUBPTSAVYMKJSOGEFR";
-
+
private static final AnnotationData[] RANDOM_ANNOTATIONS= new AnnotationData[] { new AnnotationData(507, 230, 1), new AnnotationData(11323, 55, 0), new AnnotationData(12543, 96, 0),
new AnnotationData(9964, 112, 2), new AnnotationData(579, 137, 1), new AnnotationData(15508, 198, 2), new AnnotationData(3356, 93, 1), new AnnotationData(5225, 6, 2),
new AnnotationData(11802, 284, 2), new AnnotationData(7848, 21, 2), new AnnotationData(10495, 145, 1), new AnnotationData(1535, 292, 0), new AnnotationData(12764, 271, 0),
@@ -1189,55 +1189,55 @@ public class AnnotationModelStressTest extends TestCase {
new AnnotationData(16241, 56, 1), new AnnotationData(8140, 267, 0), new AnnotationData(16417, 142, 0), new AnnotationData(16331, 194, 0), new AnnotationData(20352, 44, 2),
new AnnotationData(6477, 116, 1), new AnnotationData(11115, 228, 1), new AnnotationData(9387, 200, 2), new AnnotationData(18207, 141, 2), new AnnotationData(17578, 349, 0),
new AnnotationData(11019, 217, 1), new AnnotationData(9321, 317, 1) };
-
+
private static final class AnnotationData {
public final int offset;
public final int length;
public int annotationNumber;
-
+
public Annotation annotation;
public Position position;
-
+
public AnnotationData(int offset, int length, int annotationNumber) {
this.offset= offset;
this.length= length;
this.annotationNumber= annotationNumber;
}
}
-
+
private Document fDocument;
private AnnotationModel fAnnotationModel;
private AnnotationModel fInnerModel1;
private AnnotationModel fInnerModel2;
-
+
public static Test suite() {
return new TestSuite(AnnotationModelStressTest.class);
}
-
+
/**
* {@inheritDoc}
*/
protected void setUp() throws Exception {
fDocument= new Document(RANDOM_CONTENT);
-
+
fAnnotationModel= new AnnotationModel();
-
+
fInnerModel1= new AnnotationModel();
fAnnotationModel.addAnnotationModel("model1", fInnerModel1);
-
+
fInnerModel2= new AnnotationModel();
fAnnotationModel.addAnnotationModel("model2", fInnerModel2);
-
+
fAnnotationModel.connect(fDocument);
}
-
+
/**
* {@inheritDoc}
*/
protected void tearDown() throws Exception {
fAnnotationModel.disconnect(fDocument);
}
-
+
private IAnnotationModel getModel(int number) {
switch (number) {
case 0:
@@ -1249,66 +1249,66 @@ public class AnnotationModelStressTest extends TestCase {
}
return null;
}
-
+
private void assertRemove(ArrayList added) {
AnnotationData first= (AnnotationData) added.remove(0);
IAnnotationModel model= getModel(first.annotationNumber);
assertTrue(model.getPosition(first.annotation) == first.position);
-
+
model.removeAnnotation(first.annotation);
assertTrue(model.getPosition(first.annotation) == null);
}
-
+
private void assertAdd(AnnotationData data, ArrayList added) {
Annotation annotation= new Annotation(false);
Position position= new Position(data.offset, data.length);
IAnnotationModel model= getModel(data.annotationNumber);
-
+
model.addAnnotation(annotation, position);
assertTrue(model.getPosition(annotation) == position);
-
+
data.annotation= annotation;
data.position= position;
-
+
added.add(data);
}
-
+
private void assertExist(ArrayList added) {
for (int i= 0, size= added.size(); i < size; i++) {
AnnotationData data= (AnnotationData) added.get(i);
IAnnotationModel model= getModel(data.annotationNumber);
assertTrue(model.getPosition(data.annotation) == data.position);
}
-
+
ArrayList annotations= getAllAnnotations();
assertEquals(added.size(), annotations.size());
-
+
for (int i= 0, size= annotations.size(); i < size; i++) {
Annotation annotation= (Annotation) annotations.get(i);
-
+
AnnotationData data= getAnnotationData(added, annotation);
assertNotNull(data);
-
+
assertTrue(fAnnotationModel.getPosition(annotation) == data.position);
}
}
-
+
private void assertExistNew(ArrayList added) {
for (int i= 0, size= added.size(); i < size; i++) {
AnnotationData data= (AnnotationData) added.get(i);
IAnnotationModel model= getModel(data.annotationNumber);
assertTrue(model.getPosition(data.annotation) == data.position);
}
-
+
ArrayList annotations= getAllAnnotationsNew();
assertEquals(added.size(), annotations.size());
-
+
for (int i= 0, size= annotations.size(); i < size; i++) {
Annotation annotation= (Annotation) annotations.get(i);
-
+
AnnotationData data= getAnnotationData(added, annotation);
assertNotNull(data);
-
+
assertTrue(fAnnotationModel.getPosition(annotation) == data.position);
}
}
@@ -1324,148 +1324,148 @@ public class AnnotationModelStressTest extends TestCase {
private ArrayList getAllAnnotations() {
ArrayList result= new ArrayList();
-
+
Iterator iterator= fAnnotationModel.getAnnotationIterator();
while (iterator.hasNext()) {
result.add(iterator.next());
}
-
+
return result;
}
-
+
private ArrayList getAllAnnotationsNew() {
ArrayList result= new ArrayList();
-
+
Iterator iterator= fAnnotationModel.getAnnotationIterator(0, fDocument.getLength(), true, true);
while (iterator.hasNext()) {
result.add(iterator.next());
}
-
+
return result;
}
-
+
public void testStressTestPlainOld() throws Exception {
ArrayList added= new ArrayList();
int i= 0;
while (i < 20) {
AnnotationData data= RANDOM_ANNOTATIONS[i];
assertAdd(data, added);
-
+
assertExist(added);
-
+
i++;
}
-
+
while (i < RANDOM_ANNOTATIONS.length) {
-
+
assertRemove(added);
-
+
AnnotationData data= RANDOM_ANNOTATIONS[i];
assertAdd(data, added);
-
+
assertExist(added);
-
+
i++;
}
-
+
while (added.size() > 0) {
assertRemove(added);
assertExist(added);
}
}
-
+
public void testStressTestPlainNew() throws Exception {
ArrayList added= new ArrayList();
int i= 0;
while (i < 20) {
AnnotationData data= RANDOM_ANNOTATIONS[i];
assertAdd(data, added);
-
+
assertExistNew(added);
-
+
i++;
}
-
+
while (i < RANDOM_ANNOTATIONS.length) {
-
+
assertRemove(added);
-
+
AnnotationData data= RANDOM_ANNOTATIONS[i];
assertAdd(data, added);
-
+
assertExistNew(added);
-
+
i++;
}
-
+
while (added.size() > 0) {
assertRemove(added);
assertExistNew(added);
}
}
-
+
public void testStressTestMoveOld() throws Exception {
ArrayList added= new ArrayList();
int i= 0;
while (i < 20) {
AnnotationData data= RANDOM_ANNOTATIONS[i];
assertAdd(data, added);
-
+
assertExist(added);
-
+
i++;
}
-
+
Random ran= new Random(4711);
-
+
while (i < RANDOM_ANNOTATIONS.length) {
-
+
assertRemove(added);
-
+
fDocument.replace(ran.nextInt(fDocument.getLength() - 1), 0, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
-
+
AnnotationData data= RANDOM_ANNOTATIONS[i];
assertAdd(data, added);
-
+
assertExist(added);
-
+
i++;
}
-
+
while (added.size() > 0) {
assertRemove(added);
assertExist(added);
}
}
-
+
public void testStressTestMoveNew() throws Exception {
ArrayList added= new ArrayList();
int i= 0;
while (i < 20) {
AnnotationData data= RANDOM_ANNOTATIONS[i];
assertAdd(data, added);
-
+
assertExistNew(added);
-
+
i++;
}
-
+
Random ran= new Random(4711);
-
+
while (i < RANDOM_ANNOTATIONS.length) {
-
+
assertRemove(added);
-
+
fDocument.replace(ran.nextInt(fDocument.getLength() - 1), 0, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
AnnotationData data= RANDOM_ANNOTATIONS[i];
assertAdd(data, added);
-
+
assertExistNew(added);
-
+
i++;
}
-
+
while (added.size() > 0) {
assertRemove(added);
assertExist(added);
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/ChildDocumentTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/ChildDocumentTest.java
index ae409b63849..0fb6a315dc4 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/ChildDocumentTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/ChildDocumentTest.java
@@ -25,57 +25,57 @@ import org.eclipse.jface.text.projection.ChildDocument;
import org.eclipse.jface.text.projection.ChildDocumentManager;
public class ChildDocumentTest extends TestCase {
-
+
private IDocument fDocument;
private Document fParent;
private ChildDocumentManager fManager;
-
-
+
+
public ChildDocumentTest(String name) {
super(name);
}
-
-
+
+
protected void checkPositions(Position[] positions) {
-
+
try {
-
+
Position[] v= fDocument.getPositions(IDocument.DEFAULT_CATEGORY);
assertTrue("invalid number of positions", v.length == positions.length);
-
+
for (int i= 0; i < positions.length; i++) {
assertEquals(print(v[i]) + " != " + print(positions[i]), positions[i], v[i]);
}
-
+
} catch (BadPositionCategoryException x) {
assertTrue("BadPositionCategoryException thrown", false);
}
-
+
}
-
+
protected void checkPositions(Position[] expected, Position[] actual) {
-
+
assertTrue("invalid number of positions", expected.length == actual.length);
-
+
for (int i= 0; i < expected.length; i++) {
assertEquals(print(actual[i]) + " != " + print(expected[i]), expected[i], actual[i]);
}
-
+
}
-
+
protected String print(Position p) {
return "[" + p.getOffset() + "," + p.getLength() + "]";
}
-
+
protected void checkLineInformationConsistency() {
DefaultLineTracker textTracker= new DefaultLineTracker();
textTracker.set(fDocument.get());
-
+
int textLines= textTracker.getNumberOfLines();
int trackerLines= fDocument.getNumberOfLines();
-
+
assertEquals("Child document store and child line tracker are inconsistent", trackerLines, textLines);
-
+
for (int i= 0; i < trackerLines; i++) {
IRegion trackerLine= null;
IRegion textLine= null;
@@ -91,10 +91,10 @@ public class ChildDocumentTest extends TestCase {
}
protected void setUp() {
-
+
fParent= new Document();
-
- String text=
+
+ String text=
"package TestPackage;\n" +
"/*\n" +
"* comment\n" +
@@ -107,8 +107,8 @@ public class ChildDocumentTest extends TestCase {
" public void method2() {\n" +
" }\n" +
" }\n";
-
- fParent.set(text);
+
+ fParent.set(text);
fManager= new ChildDocumentManager();
try {
fDocument= fManager.createSlaveDocument(fParent);
@@ -119,9 +119,9 @@ public class ChildDocumentTest extends TestCase {
} catch (BadLocationException x) {
assertTrue(false);
}
-
+
try {
-
+
fDocument.addPosition(new Position( 0, 20));
fDocument.addPosition(new Position( 21, 15));
fDocument.addPosition(new Position( 38, 111));
@@ -129,30 +129,30 @@ public class ChildDocumentTest extends TestCase {
fDocument.addPosition(new Position( 75, 27));
fDocument.addPosition(new Position(105, 12));
fDocument.addPosition(new Position(119, 27));
-
+
} catch (BadLocationException x) {
assertTrue("initilization failed", false);
}
}
-
+
public static Test suite() {
- return new TestSuite(ChildDocumentTest.class);
+ return new TestSuite(ChildDocumentTest.class);
}
-
+
protected void tearDown () {
fDocument= null;
}
-
+
public void testDelete1() {
-
+
try {
-
+
fDocument.replace(21, 16, "");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 0),
@@ -162,50 +162,50 @@ public class ChildDocumentTest extends TestCase {
new Position( 89, 12),
new Position(103, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testEditScript1() {
-
+
// 1. step
-
+
try {
-
+
fDocument.replace(0, fDocument.getLength(), "");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 0)
};
-
+
checkPositions(positions);
-
-
+
+
// 2. step
try {
-
+
fDocument.replace(0, 0, "\t");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
positions= new Position[] {
new Position( 1, 0)
};
-
+
checkPositions(positions);
-
+
}
-
+
public void testFindPositions() {
-
+
try {
-
+
fDocument.addPosition(new Position( 21, 13));
fDocument.addPosition(new Position( 0, 19));
fDocument.addPosition(new Position( 21, 14));
@@ -214,12 +214,12 @@ public class ChildDocumentTest extends TestCase {
fDocument.addPosition(new Position( 104, 1));
fDocument.addPosition(new Position( 120, 1));
fDocument.addPosition(new Position( 119, 1));
-
+
} catch (BadLocationException x) {
assertTrue("initilization failed", false);
}
-
-
+
+
Position[] positions= new Position[] {
new Position( 0, 0),
new Position( 0, 19),
@@ -237,21 +237,21 @@ public class ChildDocumentTest extends TestCase {
new Position(119, 27),
new Position(120, 1)
};
-
+
checkPositions(positions);
-
+
}
-
+
public void testInsert1() {
-
+
try {
-
+
fDocument.replace(0, 0, "//comment\n");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 10, 20),
new Position( 31, 15),
@@ -261,20 +261,20 @@ public class ChildDocumentTest extends TestCase {
new Position(115, 12),
new Position(129, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testInsert2() {
-
+
try {
-
+
fDocument.replace(61, 0, "//comment\n");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 15),
@@ -284,20 +284,20 @@ public class ChildDocumentTest extends TestCase {
new Position(115, 12),
new Position(129, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testInsert3() {
-
+
try {
-
+
fDocument.replace(101, 0, "//comment\n");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 15),
@@ -307,22 +307,22 @@ public class ChildDocumentTest extends TestCase {
new Position(115, 12),
new Position(129, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testInsert4() {
-
+
try {
-
+
fDocument.replace(20, 0, "// comment");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
System.out.print(fDocument.get());
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 31, 15),
@@ -332,20 +332,20 @@ public class ChildDocumentTest extends TestCase {
new Position(115, 12),
new Position(129, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testReplace1() {
-
+
try {
-
+
fDocument.replace(8, 11, "pkg1");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 13),
new Position( 14, 15),
@@ -355,20 +355,20 @@ public class ChildDocumentTest extends TestCase {
new Position( 98, 12),
new Position(112, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testReplace2() {
-
+
try {
-
+
fDocument.replace(21, 16, "//comment\n");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 10),
@@ -378,35 +378,35 @@ public class ChildDocumentTest extends TestCase {
new Position( 99, 12),
new Position(113, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testReplace3() {
-
+
Position[] actual= new Position[] {
new Position(0, 150),
};
-
+
try {
-
+
fDocument.addPosition(actual[0]);
fDocument.replace(0, 150, "xxxxxxxxxx");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] expected= new Position[] {
new Position(0, 10)
};
-
+
checkPositions(expected, actual);
}
-
+
/*
* Replace in the parent document at the end offset of the child document
- *
+ *
* [formatting] IllegalArgumentException when formatting comment code snippet in segmented mode
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=51594
*/
@@ -422,43 +422,43 @@ public class ChildDocumentTest extends TestCase {
assertTrue("BadLocationException thrown", false);
}
}
-
+
public void testAppend() {
-
+
Position[] actual= new Position[] {
new Position(0, 2),
};
-
+
try {
-
+
fDocument.replace(0, 150, "");
fDocument.replace(fDocument.getLength(), 0, "xx");
fDocument.addPosition(actual[0]);
fDocument.replace(fDocument.getLength(), 0, "xxxxxxxx");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] expected= new Position[] {
new Position(0, 2)
};
-
+
checkPositions(expected, actual);
}
-
+
public void testShiftLeft() {
-
+
try {
-
+
fDocument.replace(73, 1, "");
fDocument.replace(98, 1, "");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 15),
@@ -468,21 +468,21 @@ public class ChildDocumentTest extends TestCase {
new Position(103, 12),
new Position(117, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testShiftRight() {
-
+
try {
-
+
fDocument.replace( 73, 0, "\t");
fDocument.replace(100, 0, "\t");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 15),
@@ -492,7 +492,7 @@ public class ChildDocumentTest extends TestCase {
new Position(107, 12),
new Position(121, 27)
};
-
+
checkPositions(positions);
}
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/CopyOnWriteTextStoreTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/CopyOnWriteTextStoreTest.java
index 93a39e88340..0c877c434ae 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/CopyOnWriteTextStoreTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/CopyOnWriteTextStoreTest.java
@@ -37,33 +37,33 @@ public class CopyOnWriteTextStoreTest extends TestCase {
return get(0, getLength());
}
}
-
+
private static final String INITIAL_CONTENT= "xxxxx";
-
+
private COWTextStore fText;
-
-
+
+
public CopyOnWriteTextStoreTest(String name) {
super(name);
}
-
+
protected void setUp() {
-
+
fText= new COWTextStore();
fText.set(INITIAL_CONTENT);
}
-
+
public static Test suite() {
- return new TestSuite(CopyOnWriteTextStoreTest.class);
+ return new TestSuite(CopyOnWriteTextStoreTest.class);
}
-
+
protected void tearDown () {
fText= null;
}
public void testInitialContent() {
-
+
assertEquals(INITIAL_CONTENT, fText.get());
// check that underlying text store is not modifiable
boolean failed= false;
@@ -77,14 +77,14 @@ public class CopyOnWriteTextStoreTest extends TestCase {
}
public void testFirstModification() {
-
+
checkReplace(1, 1, "y");
assertEquals(GapTextStore.class, fText.getStore().getClass());
}
public void testSet() {
-
+
fText.replace(1, 1, "y");
fText.set(INITIAL_CONTENT);
assertEquals(INITIAL_CONTENT, fText.get());
@@ -99,52 +99,52 @@ public class CopyOnWriteTextStoreTest extends TestCase {
}
public void testInsert1() {
-
+
for (int i= 1; i < 5; i++) {
checkReplace(2 * i - 1, 0, "y");
}
-
+
}
public void testInsert2() {
-
+
for (int i= 1; i < 5; i++) {
checkReplace(2 * (i - 1), 0, "y");
}
-
+
}
public void testDelete1() {
-
+
for (int i= 1; i < 5; i++) {
checkReplace(0, 1, "");
}
-
+
}
public void testDelete2() {
-
+
for (int i= 1; i < 5; i++) {
checkReplace(fText.getLength()-1, 1, "");
}
-
+
}
public void testAppend() {
-
+
for (int i= 1; i < 5; i++) {
checkReplace(fText.getLength(), 0, "y");
}
-
+
}
private void checkReplace(int offset, int length, String text) {
-
+
StringBuffer buf= new StringBuffer(fText.get());
buf.replace(offset, offset + length, text);
fText.replace(offset, length, text);
assertEquals(buf.toString(), fText.get());
-
+
}
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/DefaultLineTrackerTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/DefaultLineTrackerTest.java
index 92df3556eba..219ab11609b 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/DefaultLineTrackerTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/DefaultLineTrackerTest.java
@@ -20,29 +20,29 @@ import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
public class DefaultLineTrackerTest extends TestCase {
-
+
public DefaultLineTrackerTest(String name) {
super(name);
}
-
+
public static Test suite() {
- return new TestSuite(DefaultLineTrackerTest.class);
+ return new TestSuite(DefaultLineTrackerTest.class);
}
-
+
public void testLineDelimiter() {
IDocument document= new Document("abc\r\n123\r\nxyz");
Assert.assertTrue(document.getNumberOfLines() == 3);
-
+
try {
-
+
for (int i= 0; i < 2; i++) {
Assert.assertTrue(document.getLineLength(i) == 5);
Assert.assertEquals(document.getLineDelimiter(i), "\r\n");
}
-
+
Assert.assertTrue(document.getLineLength(2) == 3);
Assert.assertEquals(document.getLineDelimiter(2), null);
-
+
} catch (BadLocationException x) {
Assert.fail();
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentExtensionTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentExtensionTest.java
index b091746cbcd..f19de0f1791 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentExtensionTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentExtensionTest.java
@@ -30,24 +30,24 @@ import org.eclipse.jface.text.projection.ChildDocumentManager;
public class DocumentExtensionTest extends TestCase {
-
-
+
+
static class Listener implements IDocumentListener {
-
+
int fRepetitions= 1;
private int fInvocations= 0;
-
+
public void documentAboutToBeChanged(DocumentEvent e) {
++ fInvocations;
}
-
+
public void documentChanged(DocumentEvent e) {
-
+
if (fInvocations > fRepetitions) {
fInvocations= 0;
return;
}
-
+
if (e.getDocument() instanceof IDocumentExtension) {
IDocumentExtension extension= (IDocumentExtension) e.getDocument();
Replace replace= getReplace(e);
@@ -55,10 +55,10 @@ public class DocumentExtensionTest extends TestCase {
extension.registerPostNotificationReplace(this, replace);
}
}
-
+
/**
* Returns the replace.
- *
+ *
* @param e the document event
* @return the replace
*/
@@ -66,16 +66,16 @@ public class DocumentExtensionTest extends TestCase {
return null;
}
}
-
+
static class Replace implements IDocumentExtension.IReplace {
-
+
int fOffset;
int fLength;
String fText;
-
+
public Replace() {
}
-
+
/*
* @see IReplace#perform(IDocument, IDocumentListener)
*/
@@ -87,13 +87,13 @@ public class DocumentExtensionTest extends TestCase {
}
}
}
-
+
static class TestDocumentEvent extends DocumentEvent {
-
+
public TestDocumentEvent(IDocument document, int offset, int length, String text) {
super(document, offset, length, text);
}
-
+
public boolean isSameAs(DocumentEvent e) {
return (e.getDocument() == getDocument() &&
e.getOffset() == getOffset() &&
@@ -101,52 +101,52 @@ public class DocumentExtensionTest extends TestCase {
((e.getText() == null && getText() == null) || e.getText().equals(getText())));
}
}
-
+
static class TestDocumentListener implements IDocumentListener {
-
+
private IDocument fDocument1;
private List fTrace1;
private TestDocumentEvent fExpected1;
-
+
private List fTrace2;
private TestDocumentEvent fExpected2;
-
+
private boolean fPopped= false;
-
+
public TestDocumentListener(IDocument d1, List t1, List t2) {
fDocument1= d1;
fTrace1= t1;
fTrace2= t2;
}
-
+
public void documentAboutToBeChanged(DocumentEvent received) {
if (!fPopped) {
fPopped= true;
fExpected1= (TestDocumentEvent) fTrace1.remove(0);
fExpected2= (TestDocumentEvent) fTrace2.remove(0);
}
-
+
TestDocumentEvent e= (received.getDocument() == fDocument1 ? fExpected1 : fExpected2);
assertTrue(e.isSameAs(received));
}
-
+
public void documentChanged(DocumentEvent received) {
TestDocumentEvent e= (received.getDocument() == fDocument1 ? fExpected1 : fExpected2);
assertTrue(e.isSameAs(received));
fPopped= false;
}
}
-
-
+
+
public DocumentExtensionTest(String name) {
super(name);
}
-
-
+
+
public static Test suite() {
return new TestSuite(DocumentExtensionTest.class);
}
-
+
public void testAppend() {
Listener listener= new Listener() {
protected Replace getReplace(DocumentEvent e) {
@@ -161,10 +161,10 @@ public class DocumentExtensionTest extends TestCase {
return null;
}
};
-
+
IDocument document= new Document();
document.addDocumentListener(listener);
-
+
try {
document.replace(0, 0, "c");
document.replace(0, 0, "b");
@@ -172,10 +172,10 @@ public class DocumentExtensionTest extends TestCase {
} catch (BadLocationException x) {
assertTrue(false);
}
-
+
assertTrue("axbxcx".equals(document.get()));
}
-
+
public void testRemove() {
Listener listener= new Listener() {
protected Replace getReplace(DocumentEvent e) {
@@ -190,10 +190,10 @@ public class DocumentExtensionTest extends TestCase {
return null;
}
};
-
+
IDocument document= new Document("abc");
document.addDocumentListener(listener);
-
+
try {
document.replace(2, 1, "");
document.replace(1, 1, "");
@@ -201,10 +201,10 @@ public class DocumentExtensionTest extends TestCase {
} catch (BadLocationException x) {
assertTrue(false);
}
-
+
assertTrue("yyy".equals(document.get()));
}
-
+
public void testRepeatedAppend() {
Listener listener= new Listener() {
protected Replace getReplace(DocumentEvent e) {
@@ -220,10 +220,10 @@ public class DocumentExtensionTest extends TestCase {
}
};
listener.fRepetitions= 5;
-
+
IDocument document= new Document();
document.addDocumentListener(listener);
-
+
try {
document.replace(0, 0, "c");
document.replace(0, 0, "b");
@@ -231,31 +231,31 @@ public class DocumentExtensionTest extends TestCase {
} catch (BadLocationException x) {
assertTrue(false);
}
-
+
assertTrue("axxxxxbxxxxxcxxxxx".equals(document.get()));
}
-
+
private List createTrace(IDocument document, int repetitions) {
int i;
List trace= new ArrayList();
-
+
trace.add(new TestDocumentEvent(document, 0, 0, "c"));
for (i= 0; i < repetitions; i++)
trace.add(new TestDocumentEvent(document, 1 + i, 0, "x"));
-
+
trace.add(new TestDocumentEvent(document, 0, 0, "b"));
for (i= 0; i < repetitions; i++)
trace.add(new TestDocumentEvent(document, 1 + i, 0, "x"));
-
+
trace.add(new TestDocumentEvent(document, 0, 0, "a"));
for (i= 0; i < repetitions; i++)
trace.add(new TestDocumentEvent(document, 1 + i, 0, "x"));
-
+
return trace;
}
-
+
private void internalTestChildDocument(boolean modifyParent, boolean postModifyParent, int repetitions) {
-
+
IDocument childDocument= null;
IDocument parentDocument= new Document();
ChildDocumentManager manager= new ChildDocumentManager();
@@ -268,11 +268,11 @@ public class DocumentExtensionTest extends TestCase {
} catch (BadLocationException x) {
assertTrue(false);
}
-
+
TestDocumentListener l= new TestDocumentListener(parentDocument, createTrace(parentDocument, repetitions), createTrace(childDocument, repetitions));
parentDocument.addDocumentListener(l);
childDocument.addDocumentListener(l);
-
+
Listener modifier= new Listener() {
protected Replace getReplace(DocumentEvent e) {
String t= e.getText();
@@ -287,12 +287,12 @@ public class DocumentExtensionTest extends TestCase {
}
};
modifier.fRepetitions= repetitions;
-
+
IDocument document= postModifyParent ? parentDocument : childDocument;
document.addDocumentListener(modifier);
-
+
document= modifyParent ? parentDocument : childDocument;
-
+
try {
document.replace(0, 0, "c");
document.replace(0, 0, "b");
@@ -301,11 +301,11 @@ public class DocumentExtensionTest extends TestCase {
assertTrue(false);
}
}
-
+
public void testChildDocumentPP() {
internalTestChildDocument(true, true, 1);
}
-
+
public void testChildDocumentCC() {
try {
internalTestChildDocument(false, false, 1);
@@ -313,18 +313,18 @@ public class DocumentExtensionTest extends TestCase {
}
}
-
+
public void testChildDocumentRepeatedPP() {
internalTestChildDocument(true, true, 5);
}
-
+
public void testChildDocumentRepeatedCC() {
try {
internalTestChildDocument(false, false, 5);
} catch (UnsupportedOperationException e) {
}
}
-
+
public void testChildDocumentPC() {
try {
internalTestChildDocument(true, false, 1);
@@ -332,11 +332,11 @@ public class DocumentExtensionTest extends TestCase {
} catch (UnsupportedOperationException x) {
}
}
-
+
public void testChildDocumentCP() {
internalTestChildDocument(false, true, 1);
}
-
+
public void testChildDocumentRepeatedPC() {
try {
internalTestChildDocument(true, false, 5);
@@ -344,7 +344,7 @@ public class DocumentExtensionTest extends TestCase {
} catch (UnsupportedOperationException x) {
}
}
-
+
public void testChildDocumentRepeatedCP() {
internalTestChildDocument(false, true, 5);
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentTest.java
index c3019d3ff91..9ad77a77fe5 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentTest.java
@@ -22,51 +22,51 @@ import org.eclipse.jface.text.Position;
public class DocumentTest extends TestCase {
-
+
private Document fDocument;
-
-
+
+
public DocumentTest(String name) {
super(name);
}
-
-
+
+
protected void checkPositions(Position[] expected) {
-
+
try {
-
+
Position[] actual= fDocument.getPositions(IDocument.DEFAULT_CATEGORY);
assertTrue("invalid number of positions", actual.length == expected.length);
-
+
for (int i= 0; i < expected.length; i++) {
assertEquals(print(actual[i]) + " != " + print(expected[i]), expected[i], actual[i]);
}
-
+
} catch (BadPositionCategoryException x) {
assertTrue("BadPositionCategoryException thrown", false);
}
-
+
}
-
+
protected void checkPositions(Position[] expected, Position[] actual) {
-
+
assertTrue("invalid number of positions", expected.length == actual.length);
-
+
for (int i= 0; i < expected.length; i++) {
assertEquals(print(actual[i]) + " != " + print(expected[i]), expected[i], actual[i]);
}
-
+
}
-
+
protected String print(Position p) {
return "[" + p.getOffset() + "," + p.getLength() + "]";
}
-
+
protected void setUp() {
-
+
fDocument= new Document();
-
- String text=
+
+ String text=
"package TestPackage;\n" +
"/*\n" +
"* comment\n" +
@@ -79,11 +79,11 @@ public class DocumentTest extends TestCase {
" public void method2() {\n" +
" }\n" +
" }\n";
-
+
fDocument.set(text);
-
+
try {
-
+
fDocument.addPosition(new Position( 0, 20));
fDocument.addPosition(new Position( 21, 15));
fDocument.addPosition(new Position( 38, 111));
@@ -91,30 +91,30 @@ public class DocumentTest extends TestCase {
fDocument.addPosition(new Position( 75, 27));
fDocument.addPosition(new Position(105, 12));
fDocument.addPosition(new Position(119, 27));
-
+
} catch (BadLocationException x) {
assertTrue("initilization failed", false);
}
}
-
+
public static Test suite() {
- return new TestSuite(DocumentTest.class);
+ return new TestSuite(DocumentTest.class);
}
-
+
protected void tearDown () {
fDocument= null;
}
-
+
public void testDelete1() {
-
+
try {
-
+
fDocument.replace(21, 16, "");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 0),
@@ -124,50 +124,50 @@ public class DocumentTest extends TestCase {
new Position( 89, 12),
new Position(103, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testEditScript1() {
-
+
// 1. step
-
+
try {
-
+
fDocument.replace(0, fDocument.getLength(), "");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 0)
};
-
+
checkPositions(positions);
-
-
+
+
// 2. step
try {
-
+
fDocument.replace(0, 0, "\t");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
positions= new Position[] {
new Position( 1, 0)
};
-
+
checkPositions(positions);
-
+
}
-
+
public void testFindPositions() {
-
+
try {
-
+
fDocument.addPosition(new Position( 21, 13));
fDocument.addPosition(new Position( 0, 19));
fDocument.addPosition(new Position( 21, 14));
@@ -176,12 +176,12 @@ public class DocumentTest extends TestCase {
fDocument.addPosition(new Position( 104, 1));
fDocument.addPosition(new Position( 120, 1));
fDocument.addPosition(new Position( 119, 1));
-
+
} catch (BadLocationException x) {
assertTrue("initilization failed", false);
}
-
-
+
+
Position[] positions= new Position[] {
new Position( 0, 0),
new Position( 0, 19),
@@ -199,21 +199,21 @@ public class DocumentTest extends TestCase {
new Position(119, 27),
new Position(120, 1)
};
-
+
checkPositions(positions);
-
+
}
-
+
public void testInsert1() {
-
+
try {
-
+
fDocument.replace(0, 0, "//comment\n");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 10, 20),
new Position( 31, 15),
@@ -223,20 +223,20 @@ public class DocumentTest extends TestCase {
new Position(115, 12),
new Position(129, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testInsert2() {
-
+
try {
-
+
fDocument.replace(61, 0, "//comment\n");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 15),
@@ -246,20 +246,20 @@ public class DocumentTest extends TestCase {
new Position(115, 12),
new Position(129, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testInsert3() {
-
+
try {
-
+
fDocument.replace(101, 0, "//comment\n");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 15),
@@ -269,22 +269,22 @@ public class DocumentTest extends TestCase {
new Position(115, 12),
new Position(129, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testInsert4() {
-
+
try {
-
+
fDocument.replace(20, 0, "// comment");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
System.out.print(fDocument.get());
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 31, 15),
@@ -294,20 +294,20 @@ public class DocumentTest extends TestCase {
new Position(115, 12),
new Position(129, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testReplace1() {
-
+
try {
-
+
fDocument.replace(8, 11, "pkg1");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 13),
new Position( 14, 15),
@@ -317,20 +317,20 @@ public class DocumentTest extends TestCase {
new Position( 98, 12),
new Position(112, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testReplace2() {
-
+
try {
-
+
fDocument.replace(21, 16, "//comment\n");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 10),
@@ -340,42 +340,42 @@ public class DocumentTest extends TestCase {
new Position( 99, 12),
new Position(113, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testReplace3() {
-
+
Position[] actual= new Position[] {
new Position(0, 150),
};
-
+
try {
-
+
fDocument.addPosition(actual[0]);
fDocument.replace(0, 150, "xxxxxxxxxx");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] expected= new Position[] {
new Position(0, 10)
};
-
+
checkPositions(expected, actual);
}
-
+
public void testReplace4() {
-
+
try {
-
+
fDocument.replace(19, 1, "xxxxx;");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 19),
new Position( 26, 15),
@@ -385,46 +385,46 @@ public class DocumentTest extends TestCase {
new Position(110, 12),
new Position(124, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testAppend() {
-
+
Position[] actual= new Position[] {
new Position(0, 2),
};
-
+
try {
-
+
fDocument.replace(0, 150, "");
fDocument.replace(fDocument.getLength(), 0, "xx");
fDocument.addPosition(actual[0]);
fDocument.replace(fDocument.getLength(), 0, "xxxxxxxx");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] expected= new Position[] {
new Position(0, 2)
};
-
+
checkPositions(expected, actual);
}
-
+
public void testShiftLeft() {
-
+
try {
-
+
fDocument.replace(73, 1, "");
fDocument.replace(98, 1, "");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 15),
@@ -434,21 +434,21 @@ public class DocumentTest extends TestCase {
new Position(103, 12),
new Position(117, 27)
};
-
+
checkPositions(positions);
}
-
+
public void testShiftRight() {
-
+
try {
-
+
fDocument.replace( 73, 0, "\t");
fDocument.replace(100, 0, "\t");
-
+
} catch (BadLocationException x) {
assertTrue("BadLocationException thrown", false);
}
-
+
Position[] positions= new Position[] {
new Position( 0, 20),
new Position( 21, 15),
@@ -458,7 +458,7 @@ public class DocumentTest extends TestCase {
new Position(107, 12),
new Position(121, 27)
};
-
+
checkPositions(positions);
}
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/EclipseTextTestSuite.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/EclipseTextTestSuite.java
index 57ee68b940d..ced70cd9966 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/EclipseTextTestSuite.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/EclipseTextTestSuite.java
@@ -19,7 +19,7 @@ import org.eclipse.text.tests.templates.TemplatesTestSuite;
/**
* Test Suite for org.eclipse.text.
- *
+ *
* @since 3.0
*/
public class EclipseTextTestSuite {
@@ -47,7 +47,7 @@ public class EclipseTextTestSuite {
suite.addTest(AnnotationModelExtension2Test.suite());
suite.addTest(TemplatesTestSuite.suite());
//$JUnit-END$
-
+
return suite;
}
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/ExclusivePositionUpdaterTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/ExclusivePositionUpdaterTest.java
index f70c37282cf..b2401e3a261 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/ExclusivePositionUpdaterTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/ExclusivePositionUpdaterTest.java
@@ -45,7 +45,7 @@ public class ExclusivePositionUpdaterTest extends TestCase {
fDoc.addPositionCategory(CATEGORY);
fDoc.addPosition(CATEGORY, fPos);
}
-
+
/*
* @see junit.framework.TestCase#tearDown()
*/
@@ -59,13 +59,13 @@ public class ExclusivePositionUpdaterTest extends TestCase {
Assert.assertEquals(5, fPos.offset);
Assert.assertEquals(5, fPos.length);
}
-
+
public void testAddAfter() throws BadLocationException {
fDoc.replace(20, 0, "yy");
Assert.assertEquals(5, fPos.offset);
Assert.assertEquals(5, fPos.length);
}
-
+
public void testDeleteBefore() throws BadLocationException {
fDoc.replace(2, 2, "");
Assert.assertEquals(3, fPos.offset);
@@ -137,7 +137,7 @@ public class ExclusivePositionUpdaterTest extends TestCase {
Assert.assertEquals(5, fPos.offset);
Assert.assertEquals(4, fPos.length);
}
-
+
public void testDeleted() throws BadLocationException {
fDoc.replace(4, 7, "");
Assert.assertTrue(fPos.isDeleted);
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java
index 4fb46ddedac..f0585cb50ec 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java
@@ -28,23 +28,23 @@ import org.eclipse.jface.text.Region;
/**
* Tests the FindReplaceDocumentAdapter.
- *
+ *
* @since 3.1
*/
public class FindReplaceDocumentAdapterTest extends TestCase {
-
+
private Document fDocument;
-
-
+
+
public FindReplaceDocumentAdapterTest(String name) {
super(name);
}
-
-
+
+
protected void setUp() {
-
+
fDocument= new Document();
-
+
String text;
text= "package TestPackage;\n" + //$NON-NLS-1$
"/*\n" + //$NON-NLS-1$
@@ -59,83 +59,83 @@ public class FindReplaceDocumentAdapterTest extends TestCase {
" }\n" + //$NON-NLS-1$
" }\n" + //$NON-NLS-1$S
"// Gel\u00F6st"; //$NON-NLS-1$S
-
+
fDocument.set(text);
}
-
+
public static Test suite() {
return new TestSuite(FindReplaceDocumentAdapterTest.class);
}
-
+
protected void tearDown () {
fDocument= null;
}
-
+
public void testFind() {
FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
try {
IRegion result= new Region(8, 11);
-
+
// Find case-sensitive
IRegion r= findReplaceDocumentAdapter.find(0, "TestPackage", true, true, false, false); //$NON-NLS-1$
assertEquals(result, r);
r= findReplaceDocumentAdapter.find(0, "testpackage", true, true, false, false); //$NON-NLS-1$
assertNull(r);
-
+
// Find non-case-sensitive
r= findReplaceDocumentAdapter.find(0, "TestPackage", true, false, false, false); //$NON-NLS-1$
assertEquals(r, result);
r= findReplaceDocumentAdapter.find(0, "testpackage", true, false, false, false); //$NON-NLS-1$
assertEquals(r, result);
-
+
} catch (BadLocationException e) {
Assert.assertTrue(false);
}
}
-
+
public void testFindCaretInMiddleOfWord() {
FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
try {
-
+
// Find forward when caret is inside word
IRegion r= findReplaceDocumentAdapter.find(12, "TestPackage", true, false, false, false); //$NON-NLS-1$
assertNull(r);
-
+
// Find backward when caret is inside word
r= findReplaceDocumentAdapter.find(12, "TestPackage", false, false, false, false); //$NON-NLS-1$
assertNull(r);
-
+
} catch (BadLocationException e) {
Assert.assertTrue(false);
}
}
-
+
public void testFindCaretAtWordStart() {
FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
try {
-
+
// Find forward when caret is just before a word
IRegion r= findReplaceDocumentAdapter.find(8, "TestPackage", true, false, false, false); //$NON-NLS-1$
assertEquals(new Region(8, 11), r);
-
+
} catch (BadLocationException e) {
Assert.assertTrue(false);
}
}
-
+
public void testFindCaretAtEndStart() {
FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
try {
-
+
// Find forward when caret is just before a word
IRegion r= findReplaceDocumentAdapter.find(19, "TestPackage", false, false, false, false); //$NON-NLS-1$
assertEquals(new Region(8, 11), r);
-
+
} catch (BadLocationException e) {
Assert.assertTrue(false);
}
}
-
+
/**
* Test case for: https://bugs.eclipse.org/bugs/show_bug.cgi?id=74993
*/
@@ -144,49 +144,49 @@ public class FindReplaceDocumentAdapterTest extends TestCase {
try {
IRegion r= findReplaceDocumentAdapter.find(12, "\\w+", false, false, false, true); //$NON-NLS-1$
assertEquals(new Region(6, 1), r);
-
+
} catch (BadLocationException e) {
Assert.assertTrue(false);
}
}
-
+
public void testUTF8Pattern() {
FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
try {
IRegion result= new Region(153, 6);
-
+
// Find case-sensitive
IRegion r= findReplaceDocumentAdapter.find(0, "Gel\u00F6st", true, true, false, false); //$NON-NLS-1$
assertEquals(result, r);
r= findReplaceDocumentAdapter.find(0, "Gel\u00F6st", true, true, false, false); //$NON-NLS-1$
assertEquals(result, r);
-
+
// Find non-case-sensitive
r= findReplaceDocumentAdapter.find(0, "Gel\u00D6st", true, false, false, false); //$NON-NLS-1$
assertEquals(result, r);
r= findReplaceDocumentAdapter.find(0, "Gel\u00D6st", true, false, false, false); //$NON-NLS-1$
assertEquals(result, r);
-
+
} catch (BadLocationException e) {
Assert.assertTrue(false);
}
}
-
+
public void testReplace() {
FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
try {
findReplaceDocumentAdapter.find(0, "public", true, true, false, false); //$NON-NLS-1$
IRegion r= findReplaceDocumentAdapter.replace("private", false); //$NON-NLS-1$
assertNotNull(r);
-
+
findReplaceDocumentAdapter.find(0, "public", true, true, false, false); //$NON-NLS-1$
r= findReplaceDocumentAdapter.replace("private", false); //$NON-NLS-1$
assertNotNull(r);
-
+
findReplaceDocumentAdapter.find(0, "public", true, true, false, false); //$NON-NLS-1$
r= findReplaceDocumentAdapter.replace("private", false); //$NON-NLS-1$
assertNotNull(r);
-
+
// Search again: there will be no match
findReplaceDocumentAdapter.find(0, "public", true, true, false, false); //$NON-NLS-1$
try {
@@ -194,7 +194,7 @@ public class FindReplaceDocumentAdapterTest extends TestCase {
} catch (IllegalStateException e) {
assertTrue(true);
}
-
+
String text=
"package TestPackage;\n" + //$NON-NLS-1$
"/*\n" + //$NON-NLS-1$
@@ -210,12 +210,12 @@ public class FindReplaceDocumentAdapterTest extends TestCase {
" }\n" + //$NON-NLS-1$
"// Gel\u00f6st"; //$NON-NLS-1$S
assertEquals(text, fDocument.get());
-
+
} catch (BadLocationException e) {
Assert.assertTrue(false);
}
}
-
+
public void _testRegexReplace() throws Exception {
fDocument.set(
"UnixWindowsMacInferred\n" +
@@ -227,101 +227,101 @@ public class FindReplaceDocumentAdapterTest extends TestCase {
regexReplace("(M)ac", "\\0\\r", findReplaceDocumentAdapter);
regexReplace("(Inferred)", "\\1\\R", findReplaceDocumentAdapter);
regexReplace("Chars", "\\\\, \\xF6, \\u00F6, \\t, \\n, \\r, \\f, \\a, \\e, \\cF", findReplaceDocumentAdapter);
-
+
String text= "Unix\nWindows\r\nMac\rInferred\n\n\\, \u00F6, \u00F6, \t, \n, \r, \f, \u0007, \u001B, \u0006";
assertEquals(text, fDocument.get());
}
-
+
public void testRegexReplace2() throws Exception {
FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
-
+
fDocument.set("foo");
regexReplace("foo", "\\00", findReplaceDocumentAdapter);
assertEquals("foo0", fDocument.get());
-
+
fDocument.set("foo");
regexReplace("foo", "\\010", findReplaceDocumentAdapter);
assertEquals("foo10", fDocument.get());
-
+
fDocument.set("foo");
regexReplace("foo", "$00", findReplaceDocumentAdapter);
assertEquals("foo0", fDocument.get());
-
+
fDocument.set("foo");
regexReplace("foo", "$010", findReplaceDocumentAdapter);
assertEquals("foo10", fDocument.get());
}
-
+
public void testRegexReplace3() throws Exception {
FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
-
+
fDocument.set("foo");
regexReplace("(f)oo", "\\10", findReplaceDocumentAdapter);
assertEquals("f0", fDocument.get());
-
+
fDocument.set("foo");
regexReplace("(f)oo", "$10", findReplaceDocumentAdapter);
assertEquals("f0", fDocument.get());
}
-
+
/*
* @since 3.4
*/
public void testRegexRetainCase() throws Exception {
FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
-
+
fDocument.set("foo");
regexReplace("foo", "xyz\\Cbar\\Cfar", findReplaceDocumentAdapter);
assertEquals("xyzbarfar", fDocument.get());
-
+
fDocument.set("FOO");
regexReplace("FOO", "xyz\\Cbar\\Cfar", findReplaceDocumentAdapter);
assertEquals("xyzBARFAR", fDocument.get());
-
+
fDocument.set("Foo");
regexReplace("Foo", "xyz\\Cbar\\Cfar", findReplaceDocumentAdapter);
assertEquals("xyzBarFar", fDocument.get());
-
+
/* Current behavior - may seem strange but it's expected
* Retain case does not apply inside groups for now.
*/
fDocument.set("Foox");
regexReplace("F(oo)x", "\\C$1", findReplaceDocumentAdapter);
assertEquals("oo", fDocument.get());
-
+
fDocument.set("Foo");
regexReplace("Foo", "xyz\\Cna\\u00EFve\\xFF\\C\\xFF", findReplaceDocumentAdapter);
assertEquals("xyzNa\u00EFve\u00FF\u0178", fDocument.get());
-
+
fDocument.set("FOO");
regexReplace("FOO", "xyz\\Cna\\u00EFve\\xFF", findReplaceDocumentAdapter);
assertEquals("xyzNA\u00CFVE\u0178", fDocument.get());
}
-
+
private void regexReplace(String find, String replace, FindReplaceDocumentAdapter findReplaceDocumentAdapter) throws BadLocationException {
findReplaceDocumentAdapter.find(0, find, true, true, false, true);
IRegion r= findReplaceDocumentAdapter.replace(replace, true);
assertNotNull(r);
}
-
+
public void testRegexFindLinebreak() throws Exception {
FindReplaceDocumentAdapter adapter= new FindReplaceDocumentAdapter(fDocument);
String contents= "Unix\nWindows\r\nMac\rEnd";
fDocument.set(contents);
-
+
int n= contents.indexOf("\n");
int rn= contents.indexOf("\r\n");
int r= contents.indexOf("\rEnd");
-
+
IRegion region= adapter.find(0, "\\R", true, false, false, true);
assertEquals(new Region(n, 1), region);
-
+
region= adapter.find(n + 1, "\\R", true, false, false, true);
assertEquals(new Region(rn, 2), region);
-
+
region= adapter.find(rn + 2, "\\R", true, false, false, true);
assertEquals(new Region(r, 1), region);
-
+
region= adapter.find(r + 1, "\\R", true, false, false, true);
assertNull(region);
}
@@ -346,45 +346,45 @@ public class FindReplaceDocumentAdapterTest extends TestCase {
}
fail();
}
-
+
public void _testRegexFindLinebreak2() throws Exception {
FindReplaceDocumentAdapter adapter= new FindReplaceDocumentAdapter(fDocument);
String contents= "+[\\R]\\R\r\n";
fDocument.set(contents);
-
+
int n= contents.indexOf("[");
int rn= contents.indexOf("\r\n");
-
+
IRegion region= adapter.find(0, "[a-zA-Z\\t{\\\\R}]*\\{?\\R", true, false, false, true);
assertEquals(new Region(0, n - 1), region);
-
+
region= adapter.find(n, "\\Q[\\R]\\R\\E{0,1}(\\R)", true, false, false, true);
assertEquals(new Region(n, rn + 2 - n), region);
adapter.replace("Win\\1$1", true);
assertEquals("+Win\r\n\r\n", fDocument.get());
}
-
+
public void testRegexFindLinebreak3() throws Exception {
FindReplaceDocumentAdapter adapter= new FindReplaceDocumentAdapter(fDocument);
String contents= "One\r\nTwo\r\n\r\nEnd";
fDocument.set(contents);
-
+
int two= contents.indexOf("Two");
int end= contents.indexOf("End");
-
+
IRegion region= adapter.find(0, "[a-zA-Z]+\\R", true, false, false, true);
assertEquals(new Region(0, two), region);
region= adapter.find(two, "[a-zA-Z]+\\R", true, false, false, true);
assertEquals(new Region(two, 3 + 2), region);
-
+
region= adapter.find(0, "[a-zA-Z]+\\R{2}", true, false, false, true);
assertEquals(new Region(two, end - two), region);
}
-
+
public void testRegexFindLinebreakIllegal() throws Exception {
FindReplaceDocumentAdapter adapter= new FindReplaceDocumentAdapter(fDocument);
fDocument.set("\n");
-
+
IRegion region= null;
try {
region= adapter.find(0, "[\\R]", true, false, false, true);
@@ -392,14 +392,14 @@ public class FindReplaceDocumentAdapterTest extends TestCase {
//expected
}
assertNull(region);
-
+
try {
region= adapter.find(0, "[\\s&&[^\\R]]", true, false, false, true);
} catch (PatternSyntaxException e) {
//expected
}
assertNull(region);
-
+
try {
region= adapter.find(0, "\\p{\\R}", true, false, false, true);
} catch (PatternSyntaxException e) {
@@ -417,7 +417,7 @@ public class FindReplaceDocumentAdapterTest extends TestCase {
} catch (BadLocationException e) {
Assert.assertTrue(false);
}
-
+
findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
try {
findReplaceDocumentAdapter.replace("TestPackage", true); //$NON-NLS-1$
@@ -427,18 +427,18 @@ public class FindReplaceDocumentAdapterTest extends TestCase {
Assert.assertTrue(false);
}
}
-
+
public void testRegexFindStackOverflow_fail() throws Exception {
// test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=102699
FindReplaceDocumentAdapter adapter= new FindReplaceDocumentAdapter(fDocument);
-
+
int len= 100000;
char[] chars= new char[len];
Arrays.fill(chars, '\n');
chars[0]= '{';
chars[len - 1]= '}';
fDocument.set(new String(chars));
-
+
try {
adapter.find(0, "\\{(.|[\\r\\n])*\\}", true, false, false, true);
} catch (PatternSyntaxException ex) {
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/GapTextStoreTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/GapTextStoreTest.java
index b2b5973df83..9762be6daff 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/GapTextStoreTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/GapTextStoreTest.java
@@ -19,9 +19,9 @@ import org.eclipse.jface.text.ITextStore;
public class GapTextStoreTest extends TextStoreTest {
public static Test suite() {
- return new TestSuite(GapTextStoreTest.class);
+ return new TestSuite(GapTextStoreTest.class);
}
-
+
protected ITextStore createTextStore() {
return new GapTextStore(256, 4096, 0.1f);
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/GapTextTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/GapTextTest.java
index 6f340f3e27a..19e4b8ad612 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/GapTextTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/GapTextTest.java
@@ -21,19 +21,19 @@ public class GapTextTest extends AbstractGapTextTest {
fText= new GapText(5, 10);
fText.set("xxxxx");
}
-
+
public static Test suite() {
- return new TestSuite(GapTextTest.class);
+ return new TestSuite(GapTextTest.class);
}
-
+
protected void tearDown () {
fText= null;
}
-
+
public void testSet() {
assertGap(5, 10);
}
-
+
public void testGetText1() {
String[] expected= {
"xyxxxx",
@@ -42,14 +42,14 @@ public class GapTextTest extends AbstractGapTextTest {
"xyxyxyxyx",
"xyxyxyxyxy"
};
-
+
for (int i= 1; i < 5; i++) {
fText.replace(2 * i - 1, 0, "y");
assertContents(expected[i - 1]);
}
-
+
}
-
+
public void testGetText2() {
String[] expected= {
"yxxxxx",
@@ -58,24 +58,24 @@ public class GapTextTest extends AbstractGapTextTest {
"yxyxyxyxx",
"yxyxyxyxyx"
};
-
+
for (int i= 1; i < 5; i++) {
fText.replace(2 * (i - 1), 0, "y");
assertContents(expected[i - 1]);
}
-
+
}
-
+
public void testInsert() {
fText.replace(2, 0, "y");
assertGap(3, 7);
-
-
+
+
for (int i= 1; i <= 4; i++) {
fText.replace(2 + i, 0, "y");
assertGap(3 + i, 7);
}
-
+
fText.replace(7, 0, "y");
assertGap(8, 13);
}
@@ -83,39 +83,39 @@ public class GapTextTest extends AbstractGapTextTest {
public void testRemoveGapOverlapping() {
fText.replace(2, 2, null);
assertGap(2, 9);
-
+
fText.replace(1, 2, null);
assertGap(1, 10);
}
-
+
public void testRemoveGapOverlapping2() {
fText.replace(0, 0, "aaaaazzzzzyyyyy");
assertGap(15, 20);
assertContents("aaaaazzzzzyyyyyxxxxx");
-
-
+
+
fText.replace(5, 12, null);
assertGap(5, 10);
assertContents("aaaaaxxx");
}
-
+
public void testRemoveRemoteFromGap() {
fText.replace(0, 0, "aaaaazzzzzyyyyy");
assertGap(15, 20);
assertContents("aaaaazzzzzyyyyyxxxxx");
-
+
// before gap
fText.replace(5, 2, null);
assertGap(5, 12);
assertContents("aaaaazzzyyyyyxxxxx");
-
+
// after gap
fText.replace(7, 10, null);
assertGap(7, 12);
assertContents("aaaaazzx");
-
+
}
-
+
public void testRemoveAtLeftGapEdge() {
fText.replace(4, 0, "xxx");
assertGap(7, 9);
@@ -124,7 +124,7 @@ public class GapTextTest extends AbstractGapTextTest {
fText.replace(6, 1, null);
assertGap(6, 8);
}
-
+
public void testRemoveAtRightGapEdge() {
fText.replace(4, 0, "xxx");
assertGap(7, 9);
@@ -133,23 +133,23 @@ public class GapTextTest extends AbstractGapTextTest {
fText.replace(7, 1, null);
assertGap(7, 9);
}
-
+
public void testReplace() {
fText.replace(2, 2, "yy");
assertGap(4, 9);
-
+
fText.replace(2, 1, "yyyyyyyyyyyy");
assertGap(14, 19);
-
+
fText.replace(14, 0, "yyy");
assertGap(17, 19);
}
-
+
public void testRemoveReallocateBeforeGap() throws Exception {
fText.replace(0, 0, "yyyyyzzzzz");
assertGap(10, 15);
assertContents("yyyyyzzzzzxxxxx");
-
+
fText.replace(2, 6, null);
assertGap(2, 7);
assertContents("yyzzxxxxx");
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/LineTrackerTest3.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/LineTrackerTest3.java
index 109fd0770c8..2b7766ebbc5 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/LineTrackerTest3.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/LineTrackerTest3.java
@@ -38,7 +38,7 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
fTracker= null;
fText= null;
}
-
+
protected int getLineOffset(int line, int[] lines) {
int offset= 0;
for (int i= 0; i < line; i++)
@@ -242,32 +242,32 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
assertTrue(line == 5);
}
-
+
public void testDeleteEmptyLine() throws Exception {
set("x\nx\n\nx\n\n");
-
+
int[] lengths= new int[] { 1, 1, 0, 1, 0, 0 };
checkLines(lengths);
for (int line= lengths.length - 1; line >= 0; line--)
fTracker.replace(fTracker.getLineOffset(line), fTracker.getLineLength(line), null);
-
+
}
-
+
public void testDeleteLinesFromEnd() throws Exception {
set("x\nx\n\nx\n\n");
-
+
int[] lengths= new int[] { 1, 1, 0, 1, 0, 0 };
checkLines(lengths);
for (int line= lengths.length - 1; line >= 0; line--)
fTracker.replace(fTracker.getLineOffset(line), fTracker.getLineLength(line), null);
-
+
}
-
+
public void testDeleteLines() throws Exception {
String content= "";
for (int i= 0; i < 50; i++) {
fTracker.set(content + "x\nx\n\nx\n\n");
-
+
int lines= fTracker.getNumberOfLines();
for (int line= 0; line < lines; line++)
fTracker.replace(fTracker.getLineOffset(0), fTracker.getLineLength(0), null);
@@ -275,13 +275,13 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
content= "";
for (int i= 0; i < 50; i++) {
fTracker.set(content + "x\nx\n\nx\n\n");
-
+
int lines= fTracker.getNumberOfLines();
for (int line= lines - 1; line >= 0; line--)
fTracker.replace(fTracker.getLineOffset(line), fTracker.getLineLength(line), null);
}
}
-
+
public void testSet() throws Exception {
String content= "";
for (int i= 0; i < 35; i++) {
@@ -290,20 +290,20 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
lenghts[j]= j;
for (int j= 0; j < i; j++)
content += "x";
-
+
set(content);
checkLines(lenghts);
-
+
content += "\n";
}
}
-
+
public void testFunnyLastLineCompatibility() throws Exception {
/* empty last line */
set("x\n");
int[] offsets= { 0, 2 };
int[] lengths= { 1, 0 };
-
+
assertEquals("invalid number of lines, ", lengths.length, fTracker.getNumberOfLines());
assertEquals("invalid number of lines, ", lengths.length, fTracker.getNumberOfLines(0, fText.getLength()));
for (int i= 0; i < lengths.length; i++) {
@@ -316,7 +316,7 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
fail();
} catch (Exception e) {
}
-
+
try {
fTracker.getLineInformationOfOffset(offsets[offsets.length] + 1);
fail();
@@ -336,22 +336,22 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
int offset= offsets[i];
assertEquals("length of line: " + i, len, line.getLength());
assertEquals("offset of line: " + i, offset, line.getOffset());
-
+
line= fTracker.getLineInformationOfOffset(offset);
if ( i == lengths.length - 1) { // phantom line cannot be queried by offset
len= lengths[i - 1];
offset= offsets[i - 1];
- }
+ }
assertEquals("length of line: " + i, len, line.getLength());
assertEquals("offset of line: " + i, offset, line.getOffset());
}
-
+
try {
fTracker.getLineInformation(lengths.length);
fail();
} catch (Exception e) {
}
-
+
try {
fTracker.getLineInformationOfOffset(offsets[offsets.length] + 1);
fail();
@@ -359,23 +359,23 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
}
}
-
+
public void testNoDelimiterLine() throws Exception {
set("abcef");
checkLines(new int[] { 5 });
-
+
replace(0, 0, ""); // switch to TreeLineTracker
checkLines(new int[] { 5 });
}
-
+
public void testFunnyLastLineCompatibility2() throws Exception {
/* empty last line */
set("x\n");
replace(0, 2, "x\n");
-
+
int[] offsets= { 0, 2 };
int[] lengths= { 1, 0 };
-
+
assertEquals("invalid number of lines, ", lengths.length, fTracker.getNumberOfLines());
assertEquals("invalid number of lines, ", lengths.length, fTracker.getNumberOfLines(0, fText.getLength()));
for (int i= 0; i < lengths.length; i++) {
@@ -388,14 +388,14 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
fail();
} catch (Exception e) {
}
-
+
try {
fTracker.getLineInformationOfOffset(offsets[offsets.length] + 1);
fail();
} catch (Exception e) {
}
-
-
+
+
/* phantom last line when the last line is not empty */
set("x\nx");
offsets= new int[] { 0, 2, 3 };
@@ -408,30 +408,30 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
int offset= offsets[i];
assertEquals("length of line: " + i, len, line.getLength());
assertEquals("offset of line: " + i, offset, line.getOffset());
-
+
line= fTracker.getLineInformationOfOffset(offset);
if ( i == lengths.length - 1) { // phantom line cannot be queried by offset
len= lengths[i - 1];
offset= offsets[i - 1];
- }
+ }
assertEquals("length of line: " + i, len, line.getLength());
assertEquals("offset of line: " + i, offset, line.getOffset());
}
-
+
try {
fTracker.getLineInformation(lengths.length);
fail();
} catch (Exception e) {
}
-
+
try {
fTracker.getLineInformationOfOffset(offsets[offsets.length] + 1);
fail();
} catch (Exception e) {
}
-
+
}
-
+
public void testNegativeOffset() throws Exception {
try {
assertEquals(-1, fTracker.getLineNumberOfOffset(-1));
@@ -443,7 +443,7 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
fail();
} catch (BadLocationException e) {
}
-
+
try {
assertEquals(-1, fTracker.getLineNumberOfOffset(-1000));
fail();
@@ -453,28 +453,28 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
fTracker.getLineInformationOfOffset(-1000);
fail();
} catch (BadLocationException e) {
- }
-
+ }
+
try {
fTracker.getLineInformationOfOffset(1000);
fail();
} catch (BadLocationException e) {
- }
+ }
try {
fTracker.getLineNumberOfOffset(1000);
fail();
} catch (BadLocationException e) {
- }
+ }
try {
fTracker.getLineOffset(-1000);
fail();
} catch (BadLocationException e) {
- }
+ }
try {
fTracker.getLineInformation(-1000);
fail();
} catch (BadLocationException e) {
- }
+ }
}
public void testNegativeOffset2() throws Exception {
replace(0, 0, "x");
@@ -488,7 +488,7 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
fail();
} catch (BadLocationException e) {
}
-
+
try {
assertEquals(-1, fTracker.getLineNumberOfOffset(-1000));
fail();
@@ -498,27 +498,27 @@ public class LineTrackerTest3 extends AbstractLineTrackerTest {
fTracker.getLineInformationOfOffset(-1000);
fail();
} catch (BadLocationException e) {
- }
-
+ }
+
try {
fTracker.getLineInformationOfOffset(1000);
fail();
} catch (BadLocationException e) {
- }
+ }
try {
fTracker.getLineNumberOfOffset(1000);
fail();
} catch (BadLocationException e) {
- }
+ }
try {
fTracker.getLineOffset(-1000);
fail();
} catch (BadLocationException e) {
- }
+ }
try {
fTracker.getLineInformation(-1000);
fail();
} catch (BadLocationException e) {
- }
+ }
}
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/LineTrackerTest4.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/LineTrackerTest4.java
index c7a0a0e499e..61cd2b800a5 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/LineTrackerTest4.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/LineTrackerTest4.java
@@ -37,7 +37,7 @@ public class LineTrackerTest4 extends AbstractLineTrackerTest {
fTracker= null;
fText= null;
}
-
+
protected int getLineOffset(int line, int[] lines) {
int offset= 0;
for (int i= 0; i < line; i++)
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/TextEditTests.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/TextEditTests.java
index e9a38e80745..23beddc4f1f 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/TextEditTests.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/TextEditTests.java
@@ -41,10 +41,10 @@ import org.eclipse.jface.text.IRegion;
public class TextEditTests extends TestCase {
private static final Class THIS= TextEditTests.class;
-
+
private IDocument fDocument;
private MultiTextEdit fRoot;
-
+
public TextEditTests(String name) {
super(name);
}
@@ -65,29 +65,29 @@ public class TextEditTests extends TestCase {
}
return result;
}
-
+
protected void setUp() throws Exception {
fDocument= new Document("0123456789");
fRoot= new MultiTextEdit();
}
-
+
protected void tearDown() throws Exception {
fRoot= null;
fRoot= null;
}
-
+
public void testCovers1() throws Exception {
InsertEdit insert= new InsertEdit(1, "");
DeleteEdit delete= new DeleteEdit(2, 2);
assertEquals(false, insert.covers(delete));
}
-
+
public void testCovers2() throws Exception {
MultiTextEdit multi= new MultiTextEdit(0,0);
MultiTextEdit child= new MultiTextEdit(0,0);
assertEquals(true, multi.covers(child));
}
-
+
public void testOverlap1() throws Exception {
// [ [ ] ]
fRoot.addChild(new ReplaceEdit(0, 2, "01"));
@@ -99,7 +99,7 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testOverlap2() throws Exception {
// [[ ] ]
fRoot.addChild(new ReplaceEdit(0, 2, "01"));
@@ -111,7 +111,7 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testOverlap3() throws Exception {
// [ [ ]]
fRoot.addChild(new ReplaceEdit(0, 2, "01"));
@@ -123,7 +123,7 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testOverlap4() throws Exception {
// [ [ ] ]
fRoot.addChild(new ReplaceEdit(0, 3, "012"));
@@ -135,7 +135,7 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testOverlap5() throws Exception {
// [ [] ]
fRoot.addChild(new ReplaceEdit(0, 3, "012"));
@@ -147,7 +147,7 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testOverlap6() throws Exception {
// [ [] ]
fRoot.addChild(new ReplaceEdit(0, 3, "012"));
@@ -159,7 +159,7 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testOverlap7() throws Exception {
MoveSourceEdit source= new MoveSourceEdit(2, 5);
MoveTargetEdit target= new MoveTargetEdit(3, source);
@@ -172,7 +172,7 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testOverlap8() throws Exception {
MoveSourceEdit source= new MoveSourceEdit(2, 5);
MoveTargetEdit target= new MoveTargetEdit(6, source);
@@ -185,7 +185,7 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testOverlap9() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(3, 1);
MoveTargetEdit t1= new MoveTargetEdit(7, s1);
@@ -202,24 +202,24 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testUndefinedMultiEdit1() throws Exception {
MultiTextEdit m1= new MultiTextEdit();
m1.addChild(new InsertEdit(0,""));
fRoot.addChild(m1);
-
+
MultiTextEdit m2= new MultiTextEdit();
m2.addChild(new InsertEdit(2, ""));
fRoot.addChild(m2);
}
-
+
public void testUndefinedMultiEdit2() throws Exception {
MultiTextEdit m1= new MultiTextEdit();
MultiTextEdit m2= new MultiTextEdit();
assertTrue(m1.covers(m2));
assertTrue(m2.covers(m1));
}
-
+
public void testUndefinedMultiEdit3() throws Exception {
MultiTextEdit m2= new MultiTextEdit();
assertEquals(0, m2.getOffset());
@@ -228,7 +228,7 @@ public class TextEditTests extends TestCase {
assertEquals(1, m2.getOffset());
assertEquals(3, m2.getLength());
}
-
+
public void testUndefinedMultiEdit4() throws Exception {
MultiTextEdit m2= new MultiTextEdit();
m2.addChild(new DeleteEdit(1,3));
@@ -236,7 +236,7 @@ public class TextEditTests extends TestCase {
assertEquals(1, m2.getOffset());
assertEquals(5, m2.getLength());
}
-
+
public void testUndefinedMultiEdit5() throws Exception {
MultiTextEdit m2= new MultiTextEdit();
m2.addChild(new DeleteEdit(4, 2));
@@ -244,13 +244,13 @@ public class TextEditTests extends TestCase {
assertEquals(1, m2.getOffset());
assertEquals(5, m2.getLength());
}
-
+
public void testUndefinedMultiEdit6() throws Exception {
DeleteEdit d1= new DeleteEdit(1,3);
MultiTextEdit m2= new MultiTextEdit();
assertTrue(d1.covers(m2));
}
-
+
public void testUnconnected1() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(3, 1);
boolean exception= false;
@@ -262,7 +262,7 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testBufferLength() throws Exception {
MultiTextEdit edit= new MultiTextEdit(0, fDocument.getLength() + 1);
boolean exception= false;
@@ -274,7 +274,7 @@ public class TextEditTests extends TestCase {
assertTrue(exception);
}
}
-
+
public void testCopy1() throws Exception {
MultiTextEdit root= new MultiTextEdit();
TextEdit e1= new InsertEdit(2, "yy");
@@ -286,7 +286,7 @@ public class TextEditTests extends TestCase {
List copy= flatten(copier.perform());
compare(org, copy);
}
-
+
public void testCopy2() throws Exception {
MultiTextEdit root= new MultiTextEdit();
CopySourceEdit s1= new CopySourceEdit(5, 2);
@@ -302,13 +302,13 @@ public class TextEditTests extends TestCase {
List copy= flatten(copier.perform());
compare(org, copy);
}
-
+
private List flatten(TextEdit edit) {
List result= new ArrayList();
flatten(result, edit);
return result;
}
-
+
private static void flatten(List result, TextEdit edit) {
result.add(edit);
TextEdit[] children= edit.getChildren();
@@ -316,7 +316,7 @@ public class TextEditTests extends TestCase {
flatten(result, children[i]);
}
}
-
+
private static void compare(List org, List copy) {
assertTrue("Same length", org.size() == copy.size());
for (Iterator iter= copy.iterator(); iter.hasNext();) {
@@ -341,7 +341,7 @@ public class TextEditTests extends TestCase {
}
}
}
-
+
public void testInsert1() throws Exception {
// [][ ]
TextEdit e1= new InsertEdit(2, "yy");
@@ -355,7 +355,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "01yy345656789", fDocument.get());
doUndoRedo(undo, "01yy345656789");
}
-
+
public void testInsert2() throws Exception {
// [][]
TextEdit e1= new InsertEdit(2, "yy");
@@ -369,7 +369,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "01yyxx23456789", fDocument.get());
doUndoRedo(undo, "01yyxx23456789");
}
-
+
public void testInsert3() throws Exception {
// [ ][][ ]
TextEdit e1= new ReplaceEdit(0, 2, "011");
@@ -386,7 +386,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "011xx2456789", fDocument.get());
doUndoRedo(undo, "011xx2456789");
}
-
+
public void testInsert4() throws Exception {
TextEdit e1= new InsertEdit(0, "xx");
fRoot.addChild(e1);
@@ -397,7 +397,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "xx0123456789", fDocument.get());
doUndoRedo(undo, "xx0123456789");
}
-
+
public void testInsert5() throws Exception {
TextEdit e1= new InsertEdit(10, "xx");
fRoot.addChild(e1);
@@ -408,7 +408,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "0123456789xx", fDocument.get());
doUndoRedo(undo, "0123456789xx");
}
-
+
public void testInsertReplace1() throws Exception {
TextEdit e1= new ReplaceEdit(2, 1, "y");
TextEdit e2= new InsertEdit(2, "xx");
@@ -421,7 +421,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "01xxy3456789", fDocument.get());
doUndoRedo(undo, "01xxy3456789");
}
-
+
public void testDelete1() throws Exception {
TextEdit e1= new DeleteEdit(3, 1);
fRoot.addChild(e1);
@@ -431,7 +431,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "012456789", fDocument.get());
doUndoRedo(undo, "012456789");
}
-
+
public void testDelete2() throws Exception {
TextEdit e1= new DeleteEdit(4, 1);
TextEdit e2= new DeleteEdit(3, 1);
@@ -447,7 +447,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "0126789", fDocument.get());
doUndoRedo(undo, "0126789");
}
-
+
public void testDelete3() throws Exception {
TextEdit e1= new InsertEdit(3, "x");
TextEdit e2= new DeleteEdit(3, 1);
@@ -460,7 +460,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "012x456789", fDocument.get());
doUndoRedo(undo, "012x456789");
}
-
+
public void testDeleteWithChildren() throws Exception {
TextEdit e1= new DeleteEdit(2, 6);
MultiTextEdit e2= new MultiTextEdit(3, 3);
@@ -479,7 +479,7 @@ public class TextEditTests extends TestCase {
assertTrue(e4.isDeleted());
doUndoRedo(undo, "0189");
}
-
+
public void testTreeUpdate1() throws Exception {
MultiTextEdit m1= new MultiTextEdit();
TextEdit e1= new InsertEdit(2, "aa");
@@ -506,7 +506,7 @@ public class TextEditTests extends TestCase {
assertEquals(fRoot, 2, 14);
doUndoRedo(undo, "01aa23bb45cc67dd89");
}
-
+
/* Disabled due to a problem with this check in AST rewrite
public void testDifferentTree1() throws Exception {
MultiTextEdit root2= new MultiTextEdit();
@@ -523,7 +523,7 @@ public class TextEditTests extends TestCase {
assertTrue(exception);
}
*/
-
+
public void testMove1() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(2, 2);
MoveTargetEdit t1= new MoveTargetEdit(5, s1);
@@ -535,7 +535,7 @@ public class TextEditTests extends TestCase {
assertEquals(t1, 3, 2);
doUndoRedo(undo, "0142356789");
}
-
+
public void testMove2() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(5, 2);
MoveTargetEdit t1= new MoveTargetEdit(2, s1);
@@ -562,7 +562,7 @@ public class TextEditTests extends TestCase {
assertEquals(e2, 2, 1);
doUndoRedo(undo, "01x5623789");
}
-
+
public void testMove4() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(7, 2);
MoveTargetEdit t1= new MoveTargetEdit(2, s1);
@@ -577,7 +577,7 @@ public class TextEditTests extends TestCase {
assertEquals(e2, 7, 1);
doUndoRedo(undo, "0178234x69");
}
-
+
public void testMove5() throws Exception {
// Move onto itself
MoveSourceEdit s1= new MoveSourceEdit(2, 1);
@@ -593,7 +593,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "01x3456789", fDocument.get());
doUndoRedo(undo, "01x3456789");
}
-
+
public void testMove6() throws Exception {
// Move onto itself
MoveSourceEdit s1= new MoveSourceEdit(2, 1);
@@ -609,7 +609,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "01x3456789", fDocument.get());
doUndoRedo(undo,"01x3456789");
}
-
+
public void testMove7() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(2, 3);
MoveTargetEdit t1= new MoveTargetEdit(7, s1);
@@ -624,7 +624,7 @@ public class TextEditTests extends TestCase {
assertEquals(e2, 5, 1);
doUndoRedo(undo, "01562x4789");
}
-
+
public void testMove8() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(5, 3);
MoveTargetEdit t1= new MoveTargetEdit(1, s1);
@@ -639,39 +639,39 @@ public class TextEditTests extends TestCase {
assertEquals(e2, 2, 1);
doUndoRedo(undo, "05x7123489");
}
-
+
public void testMove9() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(1, 3);
MoveTargetEdit t1= new MoveTargetEdit(5, s1);
-
+
MoveSourceEdit s2= new MoveSourceEdit(1, 1);
MoveTargetEdit t2= new MoveTargetEdit(3, s2);
s1.addChild(s2);
s1.addChild(t2);
-
+
fRoot.addChild(s1);
fRoot.addChild(t1);
UndoEdit undo= fRoot.apply(fDocument);
assertEquals(s1, 1, 0);
assertEquals(t1, 2, 3);
-
+
assertEquals(s2, 2, 0);
assertEquals(t2, 3, 1);
assertEquals("Buffer content", "0421356789", fDocument.get());
doUndoRedo(undo, "0421356789");
}
-
+
public void testMove10() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(2, 2);
MoveTargetEdit t1= new MoveTargetEdit(8, s1);
MoveSourceEdit s2= new MoveSourceEdit(5, 2);
MoveTargetEdit t2= new MoveTargetEdit(1, s2);
-
+
fRoot.addChild(s1);
fRoot.addChild(t1);
fRoot.addChild(s2);
fRoot.addChild(t2);
-
+
UndoEdit undo= fRoot.apply(fDocument);
assertEquals(s1, 4, 0);
assertEquals(t1, 6, 2);
@@ -680,17 +680,17 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", "0561472389", fDocument.get());
doUndoRedo(undo, "0561472389");
}
-
+
public void testMoveWithRangeMarker() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(2, 2);
MoveTargetEdit t1= new MoveTargetEdit(5, s1);
-
+
RangeMarker marker= new RangeMarker(2, 2);
s1.addChild(marker);
-
+
fRoot.addChild(s1);
fRoot.addChild(t1);
-
+
UndoEdit undo= fRoot.apply(fDocument);
assertEquals("Buffer content", "0142356789", fDocument.get());
assertEquals(s1, 2, 0);
@@ -698,7 +698,7 @@ public class TextEditTests extends TestCase {
assertEquals(marker, 3, 2);
doUndoRedo(undo, "0142356789");
}
-
+
public void testMoveWithTargetDelete() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(2, 3);
MoveTargetEdit t1= new MoveTargetEdit(7, s1);
@@ -713,20 +713,20 @@ public class TextEditTests extends TestCase {
assertEquals(e2, 3, 0);
doUndoRedo(undo, "01589");
}
-
+
public void testMoveUpWithSourceDelete() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(5, 2);
MoveTargetEdit t1= new MoveTargetEdit(2, s1);
-
+
TextEdit d1= new DeleteEdit(5, 2);
d1.addChild(s1);
-
+
RangeMarker marker= new RangeMarker(5, 2);
s1.addChild(marker);
-
+
fRoot.addChild(d1);
fRoot.addChild(t1);
-
+
UndoEdit undo= fRoot.apply(fDocument);
assertEquals("Buffer content", "0156234789", fDocument.get());
assertEquals(t1, 2, 2);
@@ -735,21 +735,21 @@ public class TextEditTests extends TestCase {
assertEquals(d1, 7, 0);
doUndoRedo(undo, "0156234789");
}
-
+
public void testMoveDown() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(2, 2);
TextEdit i1= new InsertEdit(5, "x");
MoveTargetEdit t1= new MoveTargetEdit(7, s1);
TextEdit d1= new DeleteEdit(9, 1);
-
+
RangeMarker m1= new RangeMarker(2, 2);
s1.addChild(m1);
-
+
fRoot.addChild(s1);
fRoot.addChild(i1);
fRoot.addChild(t1);
fRoot.addChild(d1);
-
+
UndoEdit undo= fRoot.apply(fDocument);
assertEquals("Buffer content", "014x562378", fDocument.get());
assertEquals(s1, 2, 0);
@@ -759,21 +759,21 @@ public class TextEditTests extends TestCase {
assertEquals(d1, 10, 0);
doUndoRedo(undo, "014x562378");
}
-
+
public void testMoveUp() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(7, 2);
MoveTargetEdit t1= new MoveTargetEdit(2, s1);
TextEdit i1= new InsertEdit(5, "x");
TextEdit d1= new DeleteEdit(9, 1);
-
+
RangeMarker m1= new RangeMarker(7, 2);
s1.addChild(m1);
-
+
fRoot.addChild(s1);
fRoot.addChild(i1);
fRoot.addChild(t1);
fRoot.addChild(d1);
-
+
UndoEdit undo= fRoot.apply(fDocument);
assertEquals("Buffer content", "0178234x56", fDocument.get());
assertEquals(s1, 10, 0);
@@ -783,20 +783,20 @@ public class TextEditTests extends TestCase {
assertEquals(d1, 10, 0);
doUndoRedo(undo, "0178234x56");
}
-
+
public void testMoveDownWithSourceDelete() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(2, 2);
MoveTargetEdit t1= new MoveTargetEdit(7, s1);
-
+
TextEdit d1= new DeleteEdit(2, 2);
d1.addChild(s1);
-
+
RangeMarker m1= new RangeMarker(2, 2);
s1.addChild(m1);
-
+
fRoot.addChild(t1);
fRoot.addChild(d1);
-
+
UndoEdit undo= fRoot.apply(fDocument);
assertEquals("Buffer content", "0145623789", fDocument.get());
assertEquals(d1, 2, 0);
@@ -805,7 +805,7 @@ public class TextEditTests extends TestCase {
assertEquals(m1, 5, 2);
doUndoRedo(undo, "0145623789");
}
-
+
public void testMoveUpWithInnerMark() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(7, 2);
MoveTargetEdit t1= new MoveTargetEdit(2, s1);
@@ -820,7 +820,7 @@ public class TextEditTests extends TestCase {
assertEquals(m, 6, 2);
doUndoRedo(undo, "017823yy569");
}
-
+
public void testMoveDownWithInnerMark() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(2, 2);
MoveTargetEdit t1= new MoveTargetEdit(7, s1);
@@ -835,7 +835,7 @@ public class TextEditTests extends TestCase {
assertEquals(m, 2, 2);
doUndoRedo(undo, "01yy5623789");
}
-
+
public void testMoveUpWithParentMark() throws Exception {
RangeMarker m= new RangeMarker(2, 6);
MoveSourceEdit s1= new MoveSourceEdit(4, 2);
@@ -850,7 +850,7 @@ public class TextEditTests extends TestCase {
assertEquals(s1, 6, 0);
doUndoRedo(undo, "0124536789");
}
-
+
public void testMoveDownWithParentMark() throws Exception {
RangeMarker m= new RangeMarker(2, 6);
MoveSourceEdit s1= new MoveSourceEdit(2, 2);
@@ -865,7 +865,7 @@ public class TextEditTests extends TestCase {
assertEquals(s1, 2, 0);
doUndoRedo(undo, "0142356789");
}
-
+
public void testNestedMoveSource() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(1, 5);
MoveSourceEdit s2= new MoveSourceEdit(2, 3);
@@ -890,7 +890,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
doUndoRedo(undo, result);
}
-
+
public void testNestedMoveSourceWithInsert() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(1, 5);
MoveSourceEdit s2= new MoveSourceEdit(2, 3);
@@ -918,7 +918,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
doUndoRedo(undo, result);
}
-
+
public void testNestedMoveTarget() throws Exception {
MoveSourceEdit s1= new MoveSourceEdit(1, 2);
MoveSourceEdit s2= new MoveSourceEdit(5, 3);
@@ -937,11 +937,11 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
doUndoRedo(undo, result);
}
-
+
public void testCopyDown() throws Exception {
CopySourceEdit s1= new CopySourceEdit(2, 3);
CopyTargetEdit t1= new CopyTargetEdit(8, s1);
-
+
fRoot.addChild(s1);
fRoot.addChild(t1);
UndoEdit undo= fRoot.apply(fDocument);
@@ -951,11 +951,11 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
doUndoRedo(undo, result);
}
-
+
public void testCopyUp() throws Exception {
CopySourceEdit s1= new CopySourceEdit(7, 2);
CopyTargetEdit t1= new CopyTargetEdit(3, s1);
-
+
fRoot.addChild(s1);
fRoot.addChild(t1);
UndoEdit undo= fRoot.apply(fDocument);
@@ -965,14 +965,14 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
doUndoRedo(undo, result);
}
-
+
public void testDoubleCopy() throws Exception {
CopySourceEdit s1= new CopySourceEdit(5, 2);
CopyTargetEdit t1= new CopyTargetEdit(8, s1);
CopySourceEdit s2= new CopySourceEdit(5, 2);
CopyTargetEdit t2= new CopyTargetEdit(2, s2);
s1.addChild(s2);
-
+
fRoot.addChild(s1);
fRoot.addChild(t1);
fRoot.addChild(t2);
@@ -985,7 +985,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
doUndoRedo(undo, result);
}
-
+
public void testNestedCopySource() throws Exception {
CopySourceEdit s1= new CopySourceEdit(1, 5);
CopySourceEdit s2= new CopySourceEdit(2, 3);
@@ -1010,7 +1010,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
doUndoRedo(undo, result);
}
-
+
public void testNestedCopySourceWithInsert() throws Exception {
CopySourceEdit s1= new CopySourceEdit(1, 5);
CopySourceEdit s2= new CopySourceEdit(2, 3);
@@ -1038,7 +1038,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
doUndoRedo(undo, result);
}
-
+
public void testNestedCopyTarget() throws Exception {
CopySourceEdit s1= new CopySourceEdit(1, 2);
CopySourceEdit s2= new CopySourceEdit(5, 3);
@@ -1057,18 +1057,18 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
doUndoRedo(undo, result);
}
-
+
public void testSwap1() throws Exception {
IDocument document= new Document("foo(1, 2), 3");
-
+
MultiTextEdit root= new MultiTextEdit();
{
CopySourceEdit innerRoot= new CopySourceEdit(0, 9);
-
+
TextEdit e1= new ReplaceEdit(0, 9, "");
e1.addChild(innerRoot);
CopyTargetEdit t1= new CopyTargetEdit(11, innerRoot);
-
+
TextEdit e2= new ReplaceEdit(11, 1, "");
CopySourceEdit s2= new CopySourceEdit(11, 1);
e2.addChild(s2);
@@ -1079,55 +1079,55 @@ public class TextEditTests extends TestCase {
root.addChild(e2);
root.addChild(t1);
}
-
+
root.apply(document);
String result= "3, foo(1, 2)";
assertEquals("Buffer content", result, document.get());
}
-
+
public void testSwap2() throws Exception {
IDocument document= new Document("foo(1, 2), 3");
-
+
MultiTextEdit root= new MultiTextEdit();
{
TextEdit e1= new ReplaceEdit(4, 1, "");
CopySourceEdit s1= new CopySourceEdit(4, 1);
e1.addChild(s1);
CopyTargetEdit t1= new CopyTargetEdit(7, s1);
-
+
TextEdit e2= new ReplaceEdit(7, 1, "");
CopySourceEdit s2= new CopySourceEdit(7, 1);
e2.addChild(s2);
CopyTargetEdit t2= new CopyTargetEdit(4, s2);
-
+
root.addChild(e1);
root.addChild(t2);
root.addChild(e2);
root.addChild(t1);
}
-
+
root.apply(document);
String result= "foo(2, 1), 3";
assertEquals("Buffer content", result, document.get());
}
-
+
public void testSwap2InSwap1() throws Exception {
IDocument document= new Document("foo(1, 2), 3");
-
+
CopySourceEdit innerRoot= new CopySourceEdit(0, 9);
{
TextEdit e1= new ReplaceEdit(4, 1, "");
CopySourceEdit s1= new CopySourceEdit(4, 1);
e1.addChild(s1);
CopyTargetEdit t1= new CopyTargetEdit(7, s1);
-
+
TextEdit e2= new ReplaceEdit(7, 1, "");
CopySourceEdit s2= new CopySourceEdit(7, 1);
e2.addChild(s2);
CopyTargetEdit t2= new CopyTargetEdit(4, s2);
-
+
innerRoot.addChild(e1);
innerRoot.addChild(t2);
innerRoot.addChild(e2);
@@ -1138,7 +1138,7 @@ public class TextEditTests extends TestCase {
TextEdit e1= new ReplaceEdit(0, 9, "");
e1.addChild(innerRoot);
CopyTargetEdit t1= new CopyTargetEdit(11, innerRoot);
-
+
TextEdit e2= new ReplaceEdit(11, 1, "");
CopySourceEdit s2= new CopySourceEdit(11, 1);
e2.addChild(s2);
@@ -1155,7 +1155,7 @@ public class TextEditTests extends TestCase {
String result= "3, foo(2, 1)";
assertEquals("Buffer content", result, document.get());
}
-
+
public void testMoveTree1() {
TextEdit root= new MultiTextEdit();
TextEdit e1= new ReplaceEdit(0, 1, "");
@@ -1170,7 +1170,7 @@ public class TextEditTests extends TestCase {
assertEquals(5, e2.getOffset());
assertEquals(2, e2.getLength());
}
-
+
public void testMoveTree2() {
TextEdit root= new MultiTextEdit();
TextEdit e1= new ReplaceEdit(3, 1, "");
@@ -1185,7 +1185,7 @@ public class TextEditTests extends TestCase {
assertEquals(2, e2.getOffset());
assertEquals(2, e2.getLength());
}
-
+
public void testMoveTree3() {
boolean exception= false;
try {
@@ -1196,7 +1196,7 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testMoveTree4() {
boolean exception= false;
try {
@@ -1209,16 +1209,16 @@ public class TextEditTests extends TestCase {
}
assertTrue(exception);
}
-
+
public void testComparator() throws Exception {
DeleteEdit d1= new DeleteEdit(1,3);
Accessor accessor= new Accessor(d1, TextEdit.class);
Comparator comparator= (Comparator)accessor.get("INSERTION_COMPARATOR");
-
+
TextEdit edit1= new InsertEdit(1, "test");
TextEdit edit2= new InsertEdit(1, "test");
TextEdit edit3= new InsertEdit(57, "test3");
-
+
assertTrue(edit1.equals(edit1));
assertEquals(0, comparator.compare(edit1, edit1));
assertEquals(0, comparator.compare(edit1, edit2));
@@ -1247,7 +1247,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
assertEquals(r1, 6, 3);
}
-
+
// Regression test for 108672 [quick fix] Exception when applying Convert to enhanced for loop
public void testSourceTranformationMultipleCovers() throws Exception {
MoveSourceEdit ms= new MoveSourceEdit(2, 4);
@@ -1275,7 +1275,7 @@ public class TextEditTests extends TestCase {
assertTrue(r2.isDeleted());
assertEquals(r3, 7, 2);
}
-
+
public void testSourceTranformationSplit1() throws Exception {
MoveSourceEdit ms= new MoveSourceEdit(2, 4);
MoveTargetEdit mt= new MoveTargetEdit(9, ms);
@@ -1296,7 +1296,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
assertEquals(r1, 7, 1);
}
-
+
public void testSourceTranformationSplit2() throws Exception {
MoveSourceEdit ms= new MoveSourceEdit(2, 4);
MoveTargetEdit mt= new MoveTargetEdit(9, ms);
@@ -1317,7 +1317,7 @@ public class TextEditTests extends TestCase {
assertEquals("Buffer content", result, fDocument.get());
assertEquals(r1, 6, 3);
}
-
+
public void testIntersect() throws Exception {
IRegion result= MoveSourceEdit.intersect(new RangeMarker(0,1), new RangeMarker(2,1));
assertNull(result);
@@ -1340,7 +1340,7 @@ public class TextEditTests extends TestCase {
assertNotNull(result);
assertEquals(result, 2, 1);
}
-
+
private void doUndoRedo(UndoEdit undo, String redoResult) throws Exception {
UndoEdit redo= undo.apply(fDocument);
assertBufferContent();
@@ -1349,17 +1349,17 @@ public class TextEditTests extends TestCase {
undo.apply(fDocument);
assertBufferContent();
}
-
+
private void assertEquals(TextEdit edit, int offset, int length) {
assertEquals("Offset", offset, edit.getOffset());
assertEquals("Length", length, edit.getLength());
}
-
+
private void assertEquals(IRegion region, int offset, int length) {
assertEquals("Offset", offset, region.getOffset());
assertEquals("Length", length, region.getLength());
}
-
+
private void assertBufferContent() {
assertEquals("Buffer content restored", "0123456789", fDocument.get());
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/TextStoreTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/TextStoreTest.java
index 39b5c570535..ac3351e4394 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/TextStoreTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/TextStoreTest.java
@@ -20,7 +20,7 @@ import org.eclipse.jface.text.ITextStore;
/**
* Correctness tests for {@link ITextStore} implementations.
- *
+ *
* @since 3.3
*/
public abstract class TextStoreTest extends TestCase {
@@ -38,12 +38,12 @@ public abstract class TextStoreTest extends TestCase {
protected ILineTracker createTracker() {
return new ConfigurableLineTracker(new String[]{"\n"});
}
-
+
protected final void replace(int offset, int length, String text) throws BadLocationException {
fTextStore.replace(offset, length, text);
fTracker.replace(offset, length, text);
}
-
+
protected final void set(String text) {
fTextStore.set(text);
fTracker.set(text);
@@ -132,7 +132,7 @@ public abstract class TextStoreTest extends TestCase {
replace(13, 0, "y");
assertTextStoreContents("x\nxyyyy\nxy\ny\ny\nx\nx\n");
-
+
replace(11, 5, "y\nxyz");
assertTextStoreContents("x\nxyyyy\nxy\ny\nxyz\nx\n");
}
@@ -248,7 +248,7 @@ public abstract class TextStoreTest extends TestCase {
public void testDeleteEmptyLine() throws Exception {
set("x\nx\n\nx\n\n");
assertTextStoreContents("x\nx\n\nx\n\n");
-
+
String[] expected= {
"",
"x\n",
@@ -287,7 +287,7 @@ public abstract class TextStoreTest extends TestCase {
for (int i= 0; i < 50; i++) {
content += "x\nx\n\nx\n\n";
set(content);
-
+
String expected= content;
int lines= fTracker.getNumberOfLines();
for (int line= lines - 1; line >= 0; line--) {
@@ -305,7 +305,7 @@ public abstract class TextStoreTest extends TestCase {
for (int i= 0; i < 50; i++) {
content += "xxxxxxxxxxxxxx";
set(content);
-
+
String expected= content;
int lines= fTracker.getNumberOfLines();
for (int line= 0; line < lines; line++) {
@@ -320,7 +320,7 @@ public abstract class TextStoreTest extends TestCase {
for (int i= 0; i < 50; i++) {
content += "xxxxxxxxxxxxxx";
set(content);
-
+
String expected= content;
int lines= fTracker.getNumberOfLines();
for (int line= lines - 1; line >= 0; line--) {
@@ -332,7 +332,7 @@ public abstract class TextStoreTest extends TestCase {
}
}
}
-
+
public void testSet() throws Exception {
String content= "";
for (int i= 0; i < 35; i++) {
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/TextUtilitiesTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/TextUtilitiesTest.java
index b6b576446aa..85e2c20eedf 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/TextUtilitiesTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/TextUtilitiesTest.java
@@ -41,36 +41,36 @@ public class TextUtilitiesTest extends TestCase {
* Implementation uses old document state.
*/
private static class LazilyMirroredDocument extends Document {
-
+
private final class DocumentListener implements IDocumentListener {
public void documentAboutToBeChanged(DocumentEvent event) {}
public void documentChanged(DocumentEvent event) {
fEvents.add(event);
}
}
-
+
/** The document listener. */
private final DocumentListener fDocumentListener= new DocumentListener();
-
+
/** The buffered events. */
private final List fEvents= new ArrayList();
-
+
public LazilyMirroredDocument(IDocument document) {
document.addDocumentListener(fDocumentListener);
}
-
+
private void flush() throws BadLocationException {
DocumentEvent event= TextUtilities.mergeUnprocessedDocumentEvents(this, fEvents);
if (event == null)
return;
-
+
replace(event.getOffset(), event.getLength(), event.getText());
fEvents.clear();
}
/*
* Should override all other getXXX() methods as well, but it's sufficient for the test.
- *
+ *
* @see org.eclipse.jface.text.IDocument#get()
*/
public String get() {
@@ -88,7 +88,7 @@ public class TextUtilitiesTest extends TestCase {
* Implementation uses new document state.
*/
private static class LazilyMirroredDocument2 extends Document {
-
+
private final class DocumentListener implements IDocumentListener {
public void documentAboutToBeChanged(DocumentEvent event) {}
public void documentChanged(DocumentEvent event) {
@@ -96,29 +96,29 @@ public class TextUtilitiesTest extends TestCase {
fEvents.add(event);
}
}
-
+
/** The document listener. */
private final DocumentListener fDocumentListener= new DocumentListener();
-
+
/** The buffered events. */
private final List fEvents= new ArrayList();
-
+
public LazilyMirroredDocument2(IDocument document) {
document.addDocumentListener(fDocumentListener);
}
-
+
private void flush() throws BadLocationException {
DocumentEvent event= TextUtilities.mergeProcessedDocumentEvents(fEvents);
if (event == null)
return;
-
+
replace(event.getOffset(), event.getLength(), event.getText());
fEvents.clear();
}
-
+
/*
* Should override all other getXXX() methods as well, but it's sufficient for the test.
- *
+ *
* @see org.eclipse.jface.text.IDocument#get()
*/
public String get() {
@@ -131,7 +131,7 @@ public class TextUtilitiesTest extends TestCase {
}
}
-
+
/**
* Constructor for UtilitiesTest.
* @param name
@@ -139,15 +139,15 @@ public class TextUtilitiesTest extends TestCase {
public TextUtilitiesTest(String name) {
super(name);
}
-
+
private static DocumentEvent createRandomEvent(IDocument document, int maxLength, char character) {
-
+
int index0= (int) (Math.random() * (maxLength + 1));
int index1= (int) (Math.random() * (maxLength + 1));
-
+
int offset= Math.min(index0, index1);
int length= Math.max(index0, index1) - offset;
-
+
int stringLength= (int) (Math.random() * 10);
StringBuffer buffer= new StringBuffer(stringLength);
for (int i= 0; i < stringLength; ++i)
@@ -155,7 +155,7 @@ public class TextUtilitiesTest extends TestCase {
return new DocumentEvent(document, offset, length, buffer.toString());
}
-
+
public void testMergeEvents1() {
IDocument reference= new Document();
LazilyMirroredDocument testee= new LazilyMirroredDocument(reference);
@@ -178,10 +178,10 @@ public class TextUtilitiesTest extends TestCase {
LazilyMirroredDocument testee= new LazilyMirroredDocument(reference);
try {
-
+
List events= new ArrayList();
int currentLength= 0;
-
+
events.add(new DocumentEvent(reference, 0, 0, "foo bar goo haa"));
events.add(new DocumentEvent(reference, 0, "foo bar goo haa".length(), "foo bar goo haa"));
events.add(new DocumentEvent(reference, 4, 4, "xxxx"));
@@ -194,19 +194,19 @@ public class TextUtilitiesTest extends TestCase {
DocumentEvent event= (DocumentEvent) iterator.next();
currentLength += event.getText().length() - event.getLength();
}
-
+
for (int i= 0; i < 500; i++) {
char character= (char) (32 + i % 95);
DocumentEvent event= createRandomEvent(reference, currentLength, character);
currentLength += event.getText().length() - event.getLength();
events.add(event);
}
-
+
for (Iterator iterator= events.iterator(); iterator.hasNext();) {
DocumentEvent event= (DocumentEvent) iterator.next();
// System.err.println(event.getOffset() + ", " + event.getLength() + ", [" + event.getText() + "]") ;
-
+
reference.replace(event.getOffset(), event.getLength(), event.getText());
if (Math.random() < 0.3) {
// System.err.println("check");
@@ -214,7 +214,7 @@ public class TextUtilitiesTest extends TestCase {
// System.err.println("length= " + reference.getLength());
}
}
-
+
check(reference, testee);
// System.out.println("[" + reference.get() + "]");
@@ -230,10 +230,10 @@ public class TextUtilitiesTest extends TestCase {
LazilyMirroredDocument2 testee= new LazilyMirroredDocument2(reference);
try {
-
+
List events= new ArrayList();
int currentLength= 0;
-
+
events.add(new DocumentEvent(reference, 0, 0, "foo bar goo haa"));
events.add(new DocumentEvent(reference, 0, "foo bar goo haa".length(), "foo bar goo haa"));
events.add(new DocumentEvent(reference, 4, 4, "xxxx"));
@@ -246,14 +246,14 @@ public class TextUtilitiesTest extends TestCase {
DocumentEvent event= (DocumentEvent) iterator.next();
currentLength += event.getText().length() - event.getLength();
}
-
+
for (int i= 0; i < 500; i++) {
char character= (char) (32 + i % 95);
DocumentEvent event= createRandomEvent(reference, currentLength, character);
currentLength += event.getText().length() - event.getLength();
events.add(event);
}
-
+
for (Iterator iterator= events.iterator(); iterator.hasNext();) {
DocumentEvent event= (DocumentEvent) iterator.next();
@@ -262,24 +262,24 @@ public class TextUtilitiesTest extends TestCase {
check(reference, testee);
}
}
-
+
check(reference, testee);
} catch (BadLocationException e) {
Assert.fail("bad location exception");
}
}
-
+
private static void check(IDocument reference, IDocument testee) {
Assert.assertEquals(reference.get(), testee.get());
}
-
+
public void testIndexOf() {
int[] result;
result= TextUtilities.indexOf(new String[] {"a", "ab", "abc"}, "xxxxxxxxxx", 0);
assertEquals(-1, result[0]);
assertEquals(-1, result[1]);
-
+
result= TextUtilities.indexOf(new String[] {"a", "ab", "abc"}, "foobarabcd", 0);
assertEquals(4, result[0]);
assertEquals(0, result[1]);
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/link/InclusivePositionUpdaterTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/link/InclusivePositionUpdaterTest.java
index 0a81d98ce3a..39402be2ac9 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/link/InclusivePositionUpdaterTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/link/InclusivePositionUpdaterTest.java
@@ -21,7 +21,7 @@ import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.link.InclusivePositionUpdater;
public class InclusivePositionUpdaterTest extends TestCase {
-
+
private IPositionUpdater fUpdater;
private static final String CATEGORY= "testcategory";
private Position fPos;
@@ -37,7 +37,7 @@ public class InclusivePositionUpdaterTest extends TestCase {
fDoc.addPositionCategory(CATEGORY);
fDoc.addPosition(CATEGORY, fPos);
}
-
+
/*
* @see junit.framework.TestCase#tearDown()
*/
@@ -51,13 +51,13 @@ public class InclusivePositionUpdaterTest extends TestCase {
Assert.assertEquals(5, fPos.offset);
Assert.assertEquals(5, fPos.length);
}
-
+
public void testAddAfter() throws BadLocationException {
fDoc.replace(20, 0, "yy");
Assert.assertEquals(5, fPos.offset);
Assert.assertEquals(5, fPos.length);
}
-
+
public void testDeleteBefore() throws BadLocationException {
fDoc.replace(2, 2, "");
Assert.assertEquals(3, fPos.offset);
@@ -129,7 +129,7 @@ public class InclusivePositionUpdaterTest extends TestCase {
Assert.assertEquals(5, fPos.offset);
Assert.assertEquals(4, fPos.length);
}
-
+
public void testDeleted() throws BadLocationException {
fDoc.replace(4, 7, "");
Assert.assertTrue(fPos.isDeleted);
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkTestSuite.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkTestSuite.java
index 6ed5aee0fee..118bdbb9130 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkTestSuite.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkTestSuite.java
@@ -17,7 +17,7 @@ import junit.framework.TestSuite;
/**
* Test Suite org.eclipse.text.tests.link.
- *
+ *
* @since 3.0
*/
public class LinkTestSuite {
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedModeModelTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedModeModelTest.java
index 356d9e14292..a4c987528b4 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedModeModelTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedModeModelTest.java
@@ -29,48 +29,48 @@ import org.eclipse.jface.text.link.LinkedPositionGroup;
public class LinkedModeModelTest extends TestCase {
-
+
private List fPositions= new LinkedList();
private List fDocumentMap= new ArrayList();
public void testUpdate() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
LinkedModeModel env= new LinkedModeModel();
env.addGroup(group1);
env.forceInstall();
-
+
// edit the document
doc1.replace(1, 9, "GRETCHEN");
-
+
assertEquals(group1, "GRETCHEN");
assertUnchanged(group1);
}
-
+
public void testUpdateTwoGroups() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
-
+
LinkedPositionGroup group2= new LinkedPositionGroup();
createLinkedPositions(group2, doc1, "FAUST");
-
+
LinkedModeModel env= new LinkedModeModel();
env.addGroup(group1);
env.addGroup(group2);
-
+
env.forceInstall();
-
-
+
+
// edit the document
doc1.replace(7, 3, "INE");
-
+
assertEquals(group1, "MARGARINE");
assertEquals(group2, "FAUST");
assertUnchanged(group1, group2);
@@ -78,72 +78,72 @@ public class LinkedModeModelTest extends TestCase {
public void testUpdateMultipleGroups() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
-
+
LinkedPositionGroup group2= new LinkedPositionGroup();
createLinkedPositions(group2, doc1, "FAUST");
-
+
LinkedModeModel env= new LinkedModeModel();
env.addGroup(group1);
env.addGroup(group2);
-
+
env.forceInstall();
-
-
+
+
// edit the document
doc1.replace(7, 3, "INE");
doc1.replace(42, 1, "");
doc1.replace(44, 2, "GE");
-
+
assertEquals(group1, "MARGARINE");
assertEquals(group2, "AUGE");
assertUnchanged(group1, group2);
}
-
+
public void testUpdateMultiDocument() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
IDocument doc2= new Document(GARTEN2);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
createLinkedPositions(group1, doc2, "MARGARETE");
-
+
LinkedPositionGroup group2= new LinkedPositionGroup();
createLinkedPositions(group2, doc1, "FAUST");
createLinkedPositions(group2, doc2, "FAUST");
-
+
LinkedModeModel env= new LinkedModeModel();
env.addGroup(group1);
env.addGroup(group2);
-
+
env.forceInstall();
-
-
+
+
// edit the document
doc1.replace(7, 3, "INE");
doc1.replace(42, 1, "");
doc1.replace(44, 2, "GE");
-
+
assertEquals(group1, "MARGARINE");
assertEquals(group2, "AUGE");
assertUnchanged(group1, group2);
-
+
}
public void testAddCompatibleGroups() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
-
+
LinkedPositionGroup group2= new LinkedPositionGroup();
createLinkedPositions(group2, doc1, "FAUST");
-
+
LinkedModeModel env= new LinkedModeModel();
try {
env.addGroup(group1);
@@ -152,19 +152,19 @@ public class LinkedModeModelTest extends TestCase {
assertFalse(true);
}
assertUnchanged(group1, group2);
-
+
}
public void testAddIncompatibleGroups() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
-
+
LinkedPositionGroup group2= new LinkedPositionGroup();
createLinkedPositions(group2, doc1, "MARGA");
-
+
LinkedModeModel env= new LinkedModeModel();
try {
env.addGroup(group1);
@@ -174,7 +174,7 @@ public class LinkedModeModelTest extends TestCase {
}
assertFalse(true);
}
-
+
public void testAddNullGroup() throws BadLocationException {
LinkedModeModel env= new LinkedModeModel();
try {
@@ -182,13 +182,13 @@ public class LinkedModeModelTest extends TestCase {
} catch (IllegalArgumentException e) {
return;
}
-
+
assertFalse(true);
}
-
+
public void testAddGroupWhenSealed() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
@@ -203,170 +203,170 @@ public class LinkedModeModelTest extends TestCase {
} catch (IllegalStateException e) {
return;
}
-
+
assertFalse(true);
}
public void testDoubleInstall() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
LinkedModeModel env= new LinkedModeModel();
env.addGroup(group1);
-
+
env.forceInstall();
-
+
try {
env.forceInstall();
} catch (IllegalStateException e) {
return;
}
-
+
assertFalse(true);
}
-
+
public void testEmptyInstall() throws BadLocationException {
LinkedModeModel env= new LinkedModeModel();
-
+
try {
env.forceInstall();
} catch (IllegalStateException e) {
return;
}
-
+
assertFalse(true);
}
-
+
public void testNestedUpdate() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
-
+
LinkedPositionGroup group2= new LinkedPositionGroup();
createLinkedPositions(group2, doc1, "FAUST");
-
+
LinkedModeModel env= new LinkedModeModel();
env.addGroup(group1);
env.addGroup(group2);
-
+
env.forceInstall();
-
+
// second level
-
+
LinkedPositionGroup group1_2= new LinkedPositionGroup();
group1_2.addPosition(new LinkedPosition(doc1, 7, 3, LinkedPositionGroup.NO_STOP));
-
-
+
+
LinkedModeModel childEnv= new LinkedModeModel();
childEnv.addGroup(group1_2);
childEnv.forceInstall();
-
+
assertTrue(childEnv.isNested());
assertFalse(env.isNested());
-
-
+
+
// edit the document
doc1.replace(7, 3, "INE");
-
+
assertEquals(group1_2, "INE");
assertEquals(group1, "MARGARINE");
assertEquals(group2, "FAUST");
assertUnchanged(group1, group2);
}
-
+
public void testNestedForceInstall() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
-
+
LinkedPositionGroup group2= new LinkedPositionGroup();
createLinkedPositions(group2, doc1, "FAUST");
-
+
LinkedModeModel env= new LinkedModeModel();
env.addGroup(group1);
env.addGroup(group2);
-
+
final boolean[] isExit= { false } ;
env.addLinkingListener(new LinkedAdapter() {
public void left(LinkedModeModel environment, int flags) {
isExit[0]= true;
}
});
-
+
env.forceInstall();
-
-
+
+
// second level
-
+
LinkedPositionGroup group1_2= new LinkedPositionGroup();
-
+
group1_2.addPosition(new LinkedPosition(doc1, 12, 3, LinkedPositionGroup.NO_STOP));
-
+
LinkedModeModel childEnv= new LinkedModeModel();
childEnv.addGroup(group1_2);
childEnv.forceInstall();
-
+
assertFalse(childEnv.isNested());
assertTrue(isExit[0]);
-
-
+
+
// edit the document
doc1.replace(12, 3, "INE");
-
+
assertEquals(group1_2, "INE");
}
-
+
public void testNestedTryInstall() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
-
+
LinkedPositionGroup group2= new LinkedPositionGroup();
createLinkedPositions(group2, doc1, "FAUST");
-
+
LinkedModeModel env= new LinkedModeModel();
env.addGroup(group1);
env.addGroup(group2);
env.forceInstall();
-
-
+
+
// second level
-
+
LinkedPositionGroup group1_2= new LinkedPositionGroup();
group1_2.addPosition(new LinkedPosition(doc1, 12, 3, LinkedPositionGroup.NO_STOP));
-
+
LinkedModeModel childEnv= new LinkedModeModel();
childEnv.addGroup(group1_2);
-
+
final boolean[] isExit= { false } ;
env.addLinkingListener(new LinkedAdapter() {
public void left(LinkedModeModel environment, int flags) {
isExit[0]= true;
}
});
-
+
assertFalse(childEnv.tryInstall());
assertFalse(childEnv.isNested());
-
-
+
+
// edit the document
doc1.replace(7, 3, "INE");
-
+
assertEquals(group1, "MARGARINE");
assertUnchanged(group1, group2);
}
-
+
public void testOutsideUpdate() throws BadLocationException {
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
@@ -379,21 +379,21 @@ public class LinkedModeModelTest extends TestCase {
});
env.addGroup(group1);
env.forceInstall();
-
+
// edit the document
doc1.replace(16, 2, "b");
-
+
assertEquals(group1, "MARGARETE");
assertFalse(isExit[0]);
assertEquals(" MARGARETE:\n" +
" Verbrich mir, Heinrich!", doc1.get(0, 36));
// assertUnchanged(group1); // would fail, since it was changed outside
}
-
+
public void testOverlappingUpdate() throws BadLocationException {
// a change partially touches a linked position, but also "in-between" text
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
@@ -406,21 +406,21 @@ public class LinkedModeModelTest extends TestCase {
});
env.addGroup(group1);
env.forceInstall();
-
+
// edit the document
doc1.replace(7, 6, "INE-PLANTA");
-
+
assertEquals(group1, "MARGARINE-PLANTA");
assertFalse(isExit[0]);
assertEquals(" MARGARINE-PLANTA" +
"Versprich mir, Heinrich!", doc1.get(0, 41));
// assertUnchanged(group1); // would fail, since it was changed outside
}
-
+
public void testOverlappingDelete() throws BadLocationException {
// a change partially touches a linked position, but also "in-between" text
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
@@ -433,24 +433,24 @@ public class LinkedModeModelTest extends TestCase {
});
env.addGroup(group1);
env.forceInstall();
-
+
// edit the document
doc1.replace(7, 6, "");
-
+
assertEquals(group1, "MARGAR");
assertFalse(isExit[0]);
assertEquals(" MARGAR" +
"Versprich mir, Heinrich!", doc1.get(0, 31));
// assertUnchanged(group1); // would fail, since it was changed outside
}
-
+
public void testIllegalChange1() throws BadLocationException {
// linked mode does not exit if the documents change outside the linked
// positions, but it does exit if a change invalidates the constraints
// on the positions (complete disjointness, no touching positions)
-
+
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
@@ -464,20 +464,20 @@ public class LinkedModeModelTest extends TestCase {
});
env.addGroup(group1);
env.forceInstall();
-
+
// edit the document
doc1.replace(1, 73, "");
-
+
assertTrue(isExit[0]);
}
-
+
public void testIllegalChange2() throws BadLocationException {
// linked mode does not exit if the documents change outside the linked
// positions, but it does exit if a change invalidates the constraints
// on the positions (complete disjointness, no touching positions)
-
+
IDocument doc1= new Document(GARTEN1);
-
+
// set up linked mode
LinkedPositionGroup group1= new LinkedPositionGroup();
createLinkedPositions(group1, doc1, "MARGARETE");
@@ -495,13 +495,13 @@ public class LinkedModeModelTest extends TestCase {
env.addGroup(group1);
env.addGroup(group2);
env.forceInstall();
-
+
// edit the document
doc1.replace(9, 35, "");
-
+
assertTrue(isExit[0]);
}
-
+
private void assertEquals(LinkedPositionGroup group, String expected) throws BadLocationException {
LinkedPosition[] positions= group.getPositions();
for (int i= 0; i < positions.length; i++) {
@@ -510,11 +510,11 @@ public class LinkedModeModelTest extends TestCase {
assertEquals(expected, pos.getContent());
}
}
-
+
private void assertUnchanged(LinkedPositionGroup actual1) throws BadLocationException {
assertUnchanged(actual1, new LinkedPositionGroup());
}
-
+
private void assertUnchanged(LinkedPositionGroup actual1, LinkedPositionGroup actual2) throws BadLocationException {
LinkedPosition[] exp= (LinkedPosition[]) fPositions.toArray(new LinkedPosition[0]);
LinkedPosition[] act1= actual1.getPositions();
@@ -524,14 +524,14 @@ public class LinkedModeModelTest extends TestCase {
System.arraycopy(act2, 0, act, act1.length, act2.length);
Arrays.sort(act, new PositionComparator());
Arrays.sort(exp, new PositionComparator());
-
+
assertEquals(exp.length, act.length);
-
+
LinkedPosition e_prev= null, a_prev= null;
for (int i= 0; i <= exp.length; i++) {
LinkedPosition e_next= i == exp.length ? null : exp[i];
LinkedPosition a_next= i == exp.length ? null : act[i];
-
+
IDocument e_doc= e_prev != null ? e_prev.getDocument() : e_next.getDocument();
if (e_next != null && e_next.getDocument() != e_doc) {
// split at document boundaries
@@ -540,30 +540,30 @@ public class LinkedModeModelTest extends TestCase {
} else {
assertEquals(getContentBetweenPositions(e_prev, e_next), getContentBetweenPositions(a_prev, a_next));
}
-
+
e_prev= e_next;
a_prev= a_next;
}
}
-
+
private String getContentBetweenPositions(LinkedPosition p1, LinkedPosition p2) throws BadLocationException {
if (p1 == null && p2 == null)
return null;
if (p1 == null)
p1= new LinkedPosition(p2.getDocument(), 0, 0);
-
+
if (p2 == null)
p2= new LinkedPosition(p1.getDocument(), p1.getDocument().getLength(), 0);
-
+
IDocument document= p1.getDocument();
-
+
int offset= p1.getOffset() + p1.getLength();
int length= p2.getOffset() - offset;
-
+
return document.get(offset, length);
}
-
-
+
+
/**
* {@inheritDoc}
*/
@@ -571,25 +571,25 @@ public class LinkedModeModelTest extends TestCase {
fPositions.clear();
fDocumentMap.clear();
}
-
+
/*
* Returns a test group on a copy of the document
*/
private void createLinkedPositions(LinkedPositionGroup group, IDocument doc, String substring) throws BadLocationException {
String text= doc.get();
-
+
IDocument original= getOriginal(doc);
if (original == null) {
original= new Document(text);
putOriginal(doc, original);
}
-
-
+
+
for (int offset= text.indexOf(substring); offset != -1; offset= text.indexOf(substring, offset + 1)) {
group.addPosition(new LinkedPosition(doc, offset, substring.length(), LinkedPositionGroup.NO_STOP));
fPositions.add(new LinkedPosition(original, offset, substring.length()));
}
-
+
}
private void putOriginal(IDocument doc, IDocument original) {
@@ -676,7 +676,7 @@ public class LinkedModeModelTest extends TestCase {
" Dafur! Gefuhl ist alles;\n" +
" Name ist Schall und Rauch,\n" +
" Umnebelnd Himmelsglut.\n";
-
+
private static final String GARTEN2=
" MARGARETE:\n" +
" Das ist alles recht schon und gut;\n" +
@@ -793,10 +793,10 @@ public class LinkedModeModelTest extends TestCase {
public int compare(Object o1, Object o2) {
LinkedPosition p1= (LinkedPosition) o1;
LinkedPosition p2= (LinkedPosition) o2;
-
+
IDocument d1= p1.getDocument();
IDocument d2= p2.getDocument();
-
+
if (d1 == d2)
// sort by offset inside the same document
return p1.getOffset() - p2.getOffset();
@@ -813,5 +813,5 @@ public class LinkedModeModelTest extends TestCase {
return -1;
}
}
-
+
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedPositionGroupTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedPositionGroupTest.java
index 844a0f4b40c..6ac7ea37cbf 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedPositionGroupTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedPositionGroupTest.java
@@ -51,17 +51,17 @@ public class LinkedPositionGroupTest extends TestCase {
LinkedPositionGroup group= new LinkedPositionGroup();
LinkedModeModel env= new LinkedModeModel();
env.addGroup(group);
-
+
LinkedPosition p= new LinkedPosition(new Document(), 0, 0);
try {
group.addPosition(p);
} catch (IllegalStateException e) {
return;
}
-
+
assertFalse(true);
}
-
+
public void testAddBadLocation() throws BadLocationException {
LinkedPositionGroup group= new LinkedPositionGroup();
IDocument doc= new Document(GARTEN);
@@ -71,10 +71,10 @@ public class LinkedPositionGroupTest extends TestCase {
} catch (BadLocationException e) {
return;
}
-
+
assertFalse(true);
}
-
+
public void testAddEqualContent() {
LinkedPositionGroup group= new LinkedPositionGroup();
IDocument doc= new Document(GARTEN);
@@ -85,7 +85,7 @@ public class LinkedPositionGroupTest extends TestCase {
assertFalse(true);
}
}
-
+
public void testAddNotEqualContent() {
LinkedPositionGroup group= new LinkedPositionGroup();
IDocument doc= new Document(GARTEN);
@@ -97,76 +97,76 @@ public class LinkedPositionGroupTest extends TestCase {
}
assertFalse(true);
}
-
- private static final String GARTEN=
- " MARGARETE:\n" +
- " Versprich mir, Heinrich!\n" +
- " \n" +
- " FAUST:\n" +
- " Was ich kann!\n" +
- " \n" +
- " MARGARETE:\n" +
- " Nun sag, wie hast du\'s mit der Religion?\n" +
- " Du bist ein herzlich guter Mann,\n" +
- " Allein ich glaub, du haeltst nicht viel davon.\n" +
- " \n" +
- " FAUST:\n" +
- " Lass das, mein Kind! Du fuehlst, ich bin dir gut;\n" +
- " Fuer meine Lieben liess\' ich Leib und Blut,\n" +
- " Will niemand sein Gefuehl und seine Kirche rauben.\n" +
- " \n" +
- " MARGARETE:\n" +
- " Das ist nicht recht, man muss dran glauben.\n" +
- " \n" +
- " FAUST:\n" +
- " Muss man?\n" +
- " \n" +
- " MARGARETE:\n" +
- " Ach! wenn ich etwas auf dich konnte! Du ehrst auch nicht die heil\'gen Sakramente.\n" +
- " \n" +
- " FAUST:\n" +
- " Ich ehre sie.\n" +
- " \n" +
- " MARGARETE:\n" +
- " Doch ohne Verlangen. Zur Messe, zur Beichte bist du lange nicht gegangen.\n" +
- " Glaubst du an Gott?\n" +
- " \n" +
- " FAUST:\n" +
- " Mein Liebchen, wer darf sagen: Ich glaub an Gott?\n" +
- " Magst Priester oder Weise fragen,\n" +
- " Und ihre Antwort scheint nur Spott\n" +
- " Ueber den Frager zu sein.\n" +
- " \n" +
- " MARGARETE:\n" +
- " So glaubst du nicht?\n" +
- " \n" +
- " FAUST:\n" +
- " Misshoer mich nicht, du holdes Angesicht!\n" +
- " Wer darf ihn nennen?\n" +
- " Und wer bekennen:\n" +
- " \"Ich glaub ihn!\"?\n" +
- " Wer empfinden,\n" +
- " Und sich unterwinden\n" +
- " Zu sagen: \"Ich glaub ihn nicht!\"?\n" +
- " Der Allumfasser,\n" +
- " Der Allerhalter,\n" +
- " Fasst und erhaelt er nicht\n" +
- " Dich, mich, sich selbst?\n" +
- " Woelbt sich der Himmel nicht da droben?\n" +
- " Liegt die Erde nicht hier unten fest?\n" +
- " Und steigen freundlich blickend\n" +
- " Ewige Sterne nicht herauf?\n" +
- " Schau ich nicht Aug in Auge dir,\n" +
- " Und draengt nicht alles\n" +
- " Nach Haupt und Herzen dir,\n" +
- " Und webt in ewigem Geheimnis\n" +
- " Unsichtbar sichtbar neben dir?\n" +
- " Erfuell davon dein Herz, so gross es ist,\n" +
- " Und wenn du ganz in dem Gefuehle selig bist,\n" +
- " Nenn es dann, wie du willst,\n" +
- " Nenn\'s Glueck! Herz! Liebe! Gott\n" +
- " Ich habe keinen Namen\n" +
- " Dafuer! Gefuehl ist alles;\n" +
- " Name ist Schall und Rauch,\n" +
+
+ private static final String GARTEN=
+ " MARGARETE:\n" +
+ " Versprich mir, Heinrich!\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Was ich kann!\n" +
+ " \n" +
+ " MARGARETE:\n" +
+ " Nun sag, wie hast du\'s mit der Religion?\n" +
+ " Du bist ein herzlich guter Mann,\n" +
+ " Allein ich glaub, du haeltst nicht viel davon.\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Lass das, mein Kind! Du fuehlst, ich bin dir gut;\n" +
+ " Fuer meine Lieben liess\' ich Leib und Blut,\n" +
+ " Will niemand sein Gefuehl und seine Kirche rauben.\n" +
+ " \n" +
+ " MARGARETE:\n" +
+ " Das ist nicht recht, man muss dran glauben.\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Muss man?\n" +
+ " \n" +
+ " MARGARETE:\n" +
+ " Ach! wenn ich etwas auf dich konnte! Du ehrst auch nicht die heil\'gen Sakramente.\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Ich ehre sie.\n" +
+ " \n" +
+ " MARGARETE:\n" +
+ " Doch ohne Verlangen. Zur Messe, zur Beichte bist du lange nicht gegangen.\n" +
+ " Glaubst du an Gott?\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Mein Liebchen, wer darf sagen: Ich glaub an Gott?\n" +
+ " Magst Priester oder Weise fragen,\n" +
+ " Und ihre Antwort scheint nur Spott\n" +
+ " Ueber den Frager zu sein.\n" +
+ " \n" +
+ " MARGARETE:\n" +
+ " So glaubst du nicht?\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Misshoer mich nicht, du holdes Angesicht!\n" +
+ " Wer darf ihn nennen?\n" +
+ " Und wer bekennen:\n" +
+ " \"Ich glaub ihn!\"?\n" +
+ " Wer empfinden,\n" +
+ " Und sich unterwinden\n" +
+ " Zu sagen: \"Ich glaub ihn nicht!\"?\n" +
+ " Der Allumfasser,\n" +
+ " Der Allerhalter,\n" +
+ " Fasst und erhaelt er nicht\n" +
+ " Dich, mich, sich selbst?\n" +
+ " Woelbt sich der Himmel nicht da droben?\n" +
+ " Liegt die Erde nicht hier unten fest?\n" +
+ " Und steigen freundlich blickend\n" +
+ " Ewige Sterne nicht herauf?\n" +
+ " Schau ich nicht Aug in Auge dir,\n" +
+ " Und draengt nicht alles\n" +
+ " Nach Haupt und Herzen dir,\n" +
+ " Und webt in ewigem Geheimnis\n" +
+ " Unsichtbar sichtbar neben dir?\n" +
+ " Erfuell davon dein Herz, so gross es ist,\n" +
+ " Und wenn du ganz in dem Gefuehle selig bist,\n" +
+ " Nenn es dann, wie du willst,\n" +
+ " Nenn\'s Glueck! Herz! Liebe! Gott\n" +
+ " Ich habe keinen Namen\n" +
+ " Dafuer! Gefuehl ist alles;\n" +
+ " Name ist Schall und Rauch,\n" +
" Umnebelnd Himmelsglut.\n";
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedPositionTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedPositionTest.java
index 6b2fd72dd2e..1fb90c5c403 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedPositionTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/link/LinkedPositionTest.java
@@ -27,12 +27,12 @@ public class LinkedPositionTest extends TestCase {
fDoc= new Document(GARTEN1);
fPos= new LinkedPosition(fDoc, 3, 10);
}
-
+
public void testCreate() {
new LinkedPosition(fDoc, 1, 9);
new LinkedPosition(new Document(), 123, 234);
}
-
+
public void testNullCreate() {
try {
new LinkedPosition(null, 1, 9);
@@ -63,28 +63,28 @@ public class LinkedPositionTest extends TestCase {
public void testOverlapsWithLinkedPosition() {
LinkedPosition pos= new LinkedPosition(fDoc, 0, 2);
assertEquals(false, fPos.overlapsWith(pos));
-
+
pos= new LinkedPosition(fDoc, 0, 3);
assertEquals(false, fPos.overlapsWith(pos));
-
+
pos= new LinkedPosition(fDoc, 1, 4);
assertEquals(true, fPos.overlapsWith(pos));
-
+
pos= new LinkedPosition(fDoc, 3, 5);
assertEquals(true, fPos.overlapsWith(pos));
-
+
pos= new LinkedPosition(fDoc, 5, 7);
assertEquals(true, fPos.overlapsWith(pos));
-
+
pos= new LinkedPosition(fDoc, 7, 6);
assertEquals(true, fPos.overlapsWith(pos));
-
+
pos= new LinkedPosition(fDoc, 7, 7);
assertEquals(true, fPos.overlapsWith(pos));
-
+
pos= new LinkedPosition(fDoc, 13, 1);
assertEquals(false, fPos.overlapsWith(pos));
-
+
pos= new LinkedPosition(fDoc, 14, 4);
assertEquals(false, fPos.overlapsWith(pos));
}
@@ -95,28 +95,28 @@ public class LinkedPositionTest extends TestCase {
public void testIncludesDocumentEvent() {
DocumentEvent de= new DocumentEvent(fDoc, 0, 2, "ignore");
assertEquals(false, fPos.includes(de));
-
+
de= new DocumentEvent(fDoc, 0, 3, "ignore");
assertEquals(false, fPos.includes(de));
-
+
de= new DocumentEvent(fDoc, 1, 4, "ignore");
assertEquals(false, fPos.includes(de));
-
+
de= new DocumentEvent(fDoc, 3, 5, "ignore");
assertEquals(true, fPos.includes(de));
-
+
de= new DocumentEvent(fDoc, 5, 7, "ignore");
assertEquals(true, fPos.includes(de));
-
+
de= new DocumentEvent(fDoc, 7, 6, "ignore");
assertEquals(true, fPos.includes(de));
-
+
de= new DocumentEvent(fDoc, 7, 7, "ignore");
assertEquals(false, fPos.includes(de));
-
+
de= new DocumentEvent(fDoc, 13, 1, "ignore");
assertEquals(false, fPos.includes(de));
-
+
de= new DocumentEvent(fDoc, 14, 4, "ignore");
assertEquals(false, fPos.includes(de));
}
@@ -127,28 +127,28 @@ public class LinkedPositionTest extends TestCase {
public void testIncludesLinkedPosition() {
LinkedPosition pos= new LinkedPosition(fDoc, 0, 2);
assertEquals(false, fPos.includes(pos));
-
+
pos= new LinkedPosition(fDoc, 0, 3);
assertEquals(false, fPos.includes(pos));
-
+
pos= new LinkedPosition(fDoc, 1, 4);
assertEquals(false, fPos.includes(pos));
-
+
pos= new LinkedPosition(fDoc, 3, 5);
assertEquals(true, fPos.includes(pos));
-
+
pos= new LinkedPosition(fDoc, 5, 7);
assertEquals(true, fPos.includes(pos));
-
+
pos= new LinkedPosition(fDoc, 7, 6);
assertEquals(true, fPos.includes(pos));
-
+
pos= new LinkedPosition(fDoc, 7, 7);
assertEquals(false, fPos.includes(pos));
-
+
pos= new LinkedPosition(fDoc, 13, 1);
assertEquals(false, fPos.includes(pos));
-
+
pos= new LinkedPosition(fDoc, 14, 4);
assertEquals(false, fPos.includes(pos));
}
@@ -156,17 +156,17 @@ public class LinkedPositionTest extends TestCase {
public void testGetContent() throws BadLocationException {
LinkedPosition p= new LinkedPosition(fDoc, 1, 9);
assertEquals("MARGARETE", p.getContent());
-
+
p= new LinkedPosition(fDoc, 42, 5);
assertEquals("FAUST", p.getContent());
-
+
fDoc.replace(42, 2, "");
assertEquals("UST:\n", p.getContent()); // not linked!
-
+
fDoc.set(GARTEN1);
assertEquals("FAUST", p.getContent());
}
-
+
public void testBadLocationContent() {
LinkedPosition p= new LinkedPosition(new Document(), 23, 3);
try {
@@ -175,7 +175,7 @@ public class LinkedPositionTest extends TestCase {
return;
}
assertFalse(true);
-
+
p= new LinkedPosition(fDoc, 23, 3);
fDoc.set("");
try {
@@ -189,7 +189,7 @@ public class LinkedPositionTest extends TestCase {
public void testGetSequenceNumber() {
LinkedPosition p= new LinkedPosition(fDoc, 1, 9);
assertEquals(LinkedPositionGroup.NO_STOP, p.getSequenceNumber());
-
+
p= new LinkedPosition(fDoc, 1, 9, 18);
assertEquals(18, p.getSequenceNumber());
}
@@ -198,114 +198,114 @@ public class LinkedPositionTest extends TestCase {
fPos.setSequenceNumber(28);
assertEquals(28, fPos.getSequenceNumber());
}
-
+
public void testEquals() {
LinkedPosition p1= new LinkedPosition(fDoc, 1, 9);
LinkedPosition p2= new LinkedPosition(fDoc, 1, 9);
-
+
assertEquals(p1, p2);
}
-
+
public void testNotEquals() {
LinkedPosition p1= new LinkedPosition(fDoc, 1, 9);
LinkedPosition p2= new LinkedPosition(fDoc, 1, 10);
-
+
assertFalse(p1.equals(p2));
}
-
+
public void testNotEqualsPosition() {
LinkedPosition p1= new LinkedPosition(fDoc, 1, 9);
Position p2= new Position(1, 9);
-
+
assertFalse(p1.equals(p2));
}
-
+
public void testNotEqualsPositionSymmetry() {
// LinkedPosition p1= new LinkedPosition(fDoc, 1, 9);
// Position p2= new Position(1, 9);
-//
+//
// // breaking equals contract
// assertFalse(p2.equals(p1));
}
-
+
public void testNotEqualsDifferentDoc() {
LinkedPosition p1= new LinkedPosition(fDoc, 1, 9);
IDocument doc= new Document();
LinkedPosition p2= new LinkedPosition(doc, 1, 9);
-
+
assertFalse(p1.equals(p2));
}
-
- private static final String GARTEN1=
- " MARGARETE:\n" +
- " Versprich mir, Heinrich!\n" +
- " \n" +
- " FAUST:\n" +
- " Was ich kann!\n" +
- " \n" +
- " MARGARETE:\n" +
- " Nun sag, wie hast du\'s mit der Religion?\n" +
- " Du bist ein herzlich guter Mann,\n" +
- " Allein ich glaub, du haltst nicht viel davon.\n" +
- " \n" +
- " FAUST:\n" +
- " Las das, mein Kind! Du fuhlst, ich bin dir gut;\n" +
- " Fur meine Lieben lies\' ich Leib und Blut,\n" +
- " Will niemand sein Gefuhl und seine Kirche rauben.\n" +
- " \n" +
- " MARGARETE:\n" +
- " Das ist nicht recht, man mus dran glauben.\n" +
- " \n" +
- " FAUST:\n" +
- " Mus man?\n" +
- " \n" +
- " MARGARETE:\n" +
- " Ach! wenn ich etwas auf dich konnte! Du ehrst auch nicht die heil\'gen Sakramente.\n" +
- " \n" +
- " FAUST:\n" +
- " Ich ehre sie.\n" +
- " \n" +
- " MARGARETE:\n" +
- " Doch ohne Verlangen. Zur Messe, zur Beichte bist du lange nicht gegangen.\n" +
- " Glaubst du an Gott?\n" +
- " \n" +
- " FAUST:\n" +
- " Mein Liebchen, wer darf sagen: Ich glaub an Gott?\n" +
- " Magst Priester oder Weise fragen,\n" +
- " Und ihre Antwort scheint nur Spott\n" +
- " uber den Frager zu sein.\n" +
- " \n" +
- " MARGARETE:\n" +
- " So glaubst du nicht?\n" +
- " \n" +
- " FAUST:\n" +
- " Mishor mich nicht, du holdes Angesicht!\n" +
- " Wer darf ihn nennen?\n" +
- " Und wer bekennen:\n" +
- " \"Ich glaub ihn!\"?\n" +
- " Wer empfinden,\n" +
- " Und sich unterwinden\n" +
- " Zu sagen: \"Ich glaub ihn nicht!\"?\n" +
- " Der Allumfasser,\n" +
- " Der Allerhalter,\n" +
- " Fast und erhalt er nicht\n" +
- " Dich, mich, sich selbst?\n" +
- " Wolbt sich der Himmel nicht da droben?\n" +
- " Liegt die Erde nicht hier unten fest?\n" +
- " Und steigen freundlich blickend\n" +
- " Ewige Sterne nicht herauf?\n" +
- " Schau ich nicht Aug in Auge dir,\n" +
- " Und drangt nicht alles\n" +
- " Nach Haupt und Herzen dir,\n" +
- " Und webt in ewigem Geheimnis\n" +
- " Unsichtbar sichtbar neben dir?\n" +
- " Erfull davon dein Herz, so gros es ist,\n" +
- " Und wenn du ganz in dem Gefuhle selig bist,\n" +
- " Nenn es dann, wie du willst,\n" +
- " Nenn\'s Gluck! Herz! Liebe! Gott\n" +
- " Ich habe keinen Namen\n" +
- " Dafur! Gefuhl ist alles;\n" +
- " Name ist Schall und Rauch,\n" +
+
+ private static final String GARTEN1=
+ " MARGARETE:\n" +
+ " Versprich mir, Heinrich!\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Was ich kann!\n" +
+ " \n" +
+ " MARGARETE:\n" +
+ " Nun sag, wie hast du\'s mit der Religion?\n" +
+ " Du bist ein herzlich guter Mann,\n" +
+ " Allein ich glaub, du haltst nicht viel davon.\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Las das, mein Kind! Du fuhlst, ich bin dir gut;\n" +
+ " Fur meine Lieben lies\' ich Leib und Blut,\n" +
+ " Will niemand sein Gefuhl und seine Kirche rauben.\n" +
+ " \n" +
+ " MARGARETE:\n" +
+ " Das ist nicht recht, man mus dran glauben.\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Mus man?\n" +
+ " \n" +
+ " MARGARETE:\n" +
+ " Ach! wenn ich etwas auf dich konnte! Du ehrst auch nicht die heil\'gen Sakramente.\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Ich ehre sie.\n" +
+ " \n" +
+ " MARGARETE:\n" +
+ " Doch ohne Verlangen. Zur Messe, zur Beichte bist du lange nicht gegangen.\n" +
+ " Glaubst du an Gott?\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Mein Liebchen, wer darf sagen: Ich glaub an Gott?\n" +
+ " Magst Priester oder Weise fragen,\n" +
+ " Und ihre Antwort scheint nur Spott\n" +
+ " uber den Frager zu sein.\n" +
+ " \n" +
+ " MARGARETE:\n" +
+ " So glaubst du nicht?\n" +
+ " \n" +
+ " FAUST:\n" +
+ " Mishor mich nicht, du holdes Angesicht!\n" +
+ " Wer darf ihn nennen?\n" +
+ " Und wer bekennen:\n" +
+ " \"Ich glaub ihn!\"?\n" +
+ " Wer empfinden,\n" +
+ " Und sich unterwinden\n" +
+ " Zu sagen: \"Ich glaub ihn nicht!\"?\n" +
+ " Der Allumfasser,\n" +
+ " Der Allerhalter,\n" +
+ " Fast und erhalt er nicht\n" +
+ " Dich, mich, sich selbst?\n" +
+ " Wolbt sich der Himmel nicht da droben?\n" +
+ " Liegt die Erde nicht hier unten fest?\n" +
+ " Und steigen freundlich blickend\n" +
+ " Ewige Sterne nicht herauf?\n" +
+ " Schau ich nicht Aug in Auge dir,\n" +
+ " Und drangt nicht alles\n" +
+ " Nach Haupt und Herzen dir,\n" +
+ " Und webt in ewigem Geheimnis\n" +
+ " Unsichtbar sichtbar neben dir?\n" +
+ " Erfull davon dein Herz, so gros es ist,\n" +
+ " Und wenn du ganz in dem Gefuhle selig bist,\n" +
+ " Nenn es dann, wie du willst,\n" +
+ " Nenn\'s Gluck! Herz! Liebe! Gott\n" +
+ " Ich habe keinen Namen\n" +
+ " Dafur! Gefuhl ist alles;\n" +
+ " Name ist Schall und Rauch,\n" +
" Umnebelnd Himmelsglut.\n";
private IDocument fDoc;
private LinkedPosition fPos;
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/templates/TemplateTranslatorTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/templates/TemplateTranslatorTest.java
index 2b67fd9e626..b90979de75e 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/templates/TemplateTranslatorTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/templates/TemplateTranslatorTest.java
@@ -201,7 +201,7 @@ public class TemplateTranslatorTest extends TestCase {
assertEquals("type", vars[0].getType());
assertEquals(Collections.singletonList("param"), vars[0].getVariableType().getParams());
}
-
+
public void testMultiParameterizedTypeTemplate2() throws Exception {
TemplateBuffer buffer= fTranslator.translate("foo ${var:type(param)} bar ${var} end");
assertNull(fTranslator.getErrorMessage());
@@ -220,12 +220,12 @@ public class TemplateTranslatorTest extends TestCase {
assertEquals("type", vars[0].getType());
assertEquals(Collections.singletonList("param"), vars[0].getVariableType().getParams());
}
-
+
public void testIllegallyParameterizedTypeTemplate() throws Exception {
ensureFailure("foo ${var:type(param)} bar ${var:type(other)} end");
ensureFailure("foo ${var:type(param)} bar ${var:type} end");
}
-
+
public void testParameterizedTypeTemplateWithWhitespace() throws Exception {
TemplateBuffer buffer= fTranslator.translate("foo ${ var : type ( param1 , param2 , param3 ) } bar");
assertNull(fTranslator.getErrorMessage());
@@ -247,7 +247,7 @@ public class TemplateTranslatorTest extends TestCase {
params.add("param3");
assertEquals(params, vars[0].getVariableType().getParams());
}
-
+
public void testQualifiedTypeTemplate() throws Exception {
TemplateBuffer buffer= fTranslator.translate("foo ${ var : qual.type ( qual.param1, qual.param2 ) } bar");
assertNull(fTranslator.getErrorMessage());
@@ -268,7 +268,7 @@ public class TemplateTranslatorTest extends TestCase {
params.add("qual.param2");
assertEquals(params, vars[0].getVariableType().getParams());
}
-
+
public void testTextParameterTemplate() throws Exception {
TemplateBuffer buffer= fTranslator.translate("foo ${ var : qual.type ( 'a parameter 1', qual.param2, 'a parameter ''3' ) } bar");
assertNull(fTranslator.getErrorMessage());
@@ -290,7 +290,7 @@ public class TemplateTranslatorTest extends TestCase {
params.add("a parameter '3");
assertEquals(params, vars[0].getVariableType().getParams());
}
-
+
public void testIllegalSyntax4() throws Exception {
ensureFailure("foo ${var:} bar");
}
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/templates/TemplatesTestSuite.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/templates/TemplatesTestSuite.java
index 203e225689f..f807be159a3 100755
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/templates/TemplatesTestSuite.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/templates/TemplatesTestSuite.java
@@ -17,7 +17,7 @@ import junit.framework.TestSuite;
/**
* Test Suite for org.eclipse.text.
- *
+ *
* @since 3.3
*/
public class TemplatesTestSuite {
@@ -27,7 +27,7 @@ public class TemplatesTestSuite {
//$JUnit-BEGIN$
suite.addTest(TemplateTranslatorTest.suite());
//$JUnit-END$
-
+
return suite;
}
}
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/FragmentUpdater.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/FragmentUpdater.java
index 8da7b43a7a1..9012d3b15a5 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/FragmentUpdater.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/FragmentUpdater.java
@@ -102,7 +102,7 @@ class FragmentUpdater extends DefaultPositionUpdater {
* Returns whether this updater considers any position affected by the given document event. A
* position is affected if <code>event</code> {@link Position#overlapsWith(int, int) overlaps}
* with it but not if the position is only shifted.
- *
+ *
* @param event the event
* @return <code>true</code> if there is any affected position, <code>false</code> otherwise
*/
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocument.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocument.java
index 0dddce7b2d6..d7b84365893 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocument.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocument.java
@@ -183,17 +183,17 @@ public class ProjectionDocument extends AbstractDocument {
/**
* Returns the projection mapping used by this document.
- *
+ *
* @return the projection mapping used by this document
* @deprecated As of 3.4, replaced by {@link #getDocumentInformationMapping()}
*/
public ProjectionMapping getProjectionMapping(){
return fMapping;
}
-
+
/**
* Returns the projection mapping used by this document.
- *
+ *
* @return the projection mapping used by this document
* @since 3.4
*/
@@ -209,7 +209,7 @@ public class ProjectionDocument extends AbstractDocument {
public IDocument getMasterDocument() {
return fMasterDocument;
}
-
+
/*
* @see org.eclipse.jface.text.IDocumentExtension4#getDefaultLineDelimiter()
* @since 3.1
@@ -217,7 +217,7 @@ public class ProjectionDocument extends AbstractDocument {
public String getDefaultLineDelimiter() {
return TextUtilities.getDefaultLineDelimiter(fMasterDocument);
}
-
+
/**
* Initializes the projection document from the master document based on
* the master's fragments.
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java b/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
index 47a98113025..0d27f20e707 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
@@ -359,7 +359,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
if (list == null)
throw new BadPositionCategoryException();
list.add(computeIndexInPositionList(list, position.offset), position);
-
+
List endPositions= (List) fEndPositions.get(category);
if (endPositions == null)
throw new BadPositionCategoryException();
@@ -452,7 +452,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
protected int computeIndexInPositionList(List positions, int offset) {
return computeIndexInPositionList(positions, offset, true);
}
-
+
/**
* Computes the index in the list of positions at which a position with the given
* position would be inserted. The position to insert is supposed to become the first
@@ -551,7 +551,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
protected void fireDocumentPartitioningChanged() {
if (fDocumentPartitioningListeners == null)
return;
-
+
Object[] listeners= fDocumentPartitioningListeners.getListeners();
for (int i= 0; i < listeners.length; i++)
((IDocumentPartitioningListener)listeners[i]).documentPartitioningChanged(this);
@@ -572,7 +572,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
protected void fireDocumentPartitioningChanged(IRegion region) {
if (fDocumentPartitioningListeners == null)
return;
-
+
Object[] listeners= fDocumentPartitioningListeners.getListeners();
for (int i= 0; i < listeners.length; i++) {
IDocumentPartitioningListener l= (IDocumentPartitioningListener)listeners[i];
@@ -639,7 +639,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
Object[] listeners= fPrenotifiedDocumentListeners.getListeners();
for (int i= 0; i < listeners.length; i++)
((IDocumentListener)listeners[i]).documentAboutToBeChanged(event);
-
+
listeners= fDocumentListeners.getListeners();
for (int i= 0; i < listeners.length; i++)
((IDocumentListener)listeners[i]).documentAboutToBeChanged(event);
@@ -821,20 +821,20 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
public String[] getLegalLineDelimiters() {
return getTracker().getLegalLineDelimiters();
}
-
+
/*
* @see org.eclipse.jface.text.IDocumentExtension4#getDefaultLineDelimiter()
* @since 3.1
*/
public String getDefaultLineDelimiter() {
-
+
String lineDelimiter= null;
-
+
try {
lineDelimiter= getLineDelimiter(0);
} catch (BadLocationException x) {
}
-
+
if (lineDelimiter != null)
return lineDelimiter;
@@ -850,14 +850,14 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
break;
}
}
-
+
if (lineDelimiter == null)
lineDelimiter= delimiters[0];
-
+
return lineDelimiter;
-
+
}
-
+
/*
* @see org.eclipse.jface.text.IDocumentExtension4#setInitialLineDelimiter(java.lang.String)
* @since 3.1
@@ -1036,7 +1036,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
if (c == null)
throw new BadPositionCategoryException();
removeFromPositionsList(c, position, true);
-
+
List endPositions= (List) fEndPositions.get(category);
if (endPositions == null)
throw new BadPositionCategoryException();
@@ -1053,14 +1053,14 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
*/
private void removeFromPositionsList(List positions, Position position, boolean orderedByOffset) {
int size= positions.size();
-
+
//Assume position is somewhere near it was before
int index= computeIndexInPositionList(positions, orderedByOffset ? position.offset : position.offset + position.length - 1, orderedByOffset);
if (index < size && positions.get(index) == position) {
positions.remove(index);
return;
}
-
+
int back= index - 1;
int forth= index + 1;
while (back >= 0 || forth < size) {
@@ -1071,7 +1071,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
}
back--;
}
-
+
if (forth < size) {
if (position == positions.get(forth)) {
positions.remove(forth);
@@ -1159,7 +1159,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public boolean isLineInformationRepairNeeded(int offset, int length, String text) throws BadLocationException {
@@ -1182,7 +1182,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
public void set(String text) {
set(text, getNextModificationStamp());
}
-
+
/*
* @see org.eclipse.jface.text.IDocumentExtension4#set(java.lang.String, long)
* @since 3.1
@@ -1222,7 +1222,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
/**
* {@inheritDoc}
- *
+ *
* @deprecated as of 3.0 search is provided by {@link FindReplaceDocumentAdapter}
*/
public int search(int startPosition, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord) throws BadLocationException {
@@ -1330,7 +1330,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
/**
* {@inheritDoc}
- *
+ *
* @since 2.0
* @deprecated since 3.1. Use
* {@link IDocumentExtension4#startRewriteSession(DocumentRewriteSessionType)}
@@ -1341,7 +1341,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
/**
* {@inheritDoc}
- *
+ *
* @since 2.0
* @deprecated As of 3.1, replaced by {@link IDocumentExtension4#stopRewriteSession(DocumentRewriteSession)}
*/
@@ -1679,10 +1679,10 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
fireDocumentPartitioningChanged(event);
}
}
-
+
/**
* Returns all positions of the given category that are inside the given region.
- *
+ *
* @param category the position category
* @param offset the start position of the region, must be >= 0
* @param length the length of the region, must be >= 0
@@ -1706,18 +1706,18 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
} else {
documentPositions= getStartingPositions(category, offset, length);
}
-
+
ArrayList list= new ArrayList(documentPositions.size());
-
+
Position region= new Position(offset, length);
-
+
for (Iterator iterator= documentPositions.iterator(); iterator.hasNext();) {
Position position= (Position) iterator.next();
if (isWithinRegion(region, position, canStartBefore, canEndAfter)) {
list.add(position);
}
}
-
+
Position[] positions= new Position[list.size()];
list.toArray(positions);
return positions;
@@ -1728,14 +1728,14 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
return positions;
} else {
Assert.isLegal(canEndAfter && !canStartBefore);
-
+
List list= getStartingPositions(category, offset, length);
Position[] positions= new Position[list.size()];
list.toArray(positions);
return positions;
}
}
-
+
/*
* @since 3.4
*/
@@ -1751,11 +1751,11 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
return region.includes(start) && region.includes(start + position.getLength() - 1);
}
}
-
+
/**
* A list of positions in the given category with an offset inside the given
* region. The order of the positions is arbitrary.
- *
+ *
* @param category the position category
* @param offset the offset of the region
* @param length the length of the region
@@ -1767,17 +1767,17 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
List positions= (List) fPositions.get(category);
if (positions == null)
throw new BadPositionCategoryException();
-
+
int indexStart= computeIndexInPositionList(positions, offset, true);
int indexEnd= computeIndexInPositionList(positions, offset + length, true);
-
+
return positions.subList(indexStart, indexEnd);
}
/**
* A list of positions in the given category with an end position inside
* the given region. The order of the positions is arbitrary.
- *
+ *
* @param category the position category
* @param offset the offset of the region
* @param length the length of the region
@@ -1789,10 +1789,10 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
List positions= (List) fEndPositions.get(category);
if (positions == null)
throw new BadPositionCategoryException();
-
+
int indexStart= computeIndexInPositionList(positions, offset, false);
int indexEnd= computeIndexInPositionList(positions, offset + length, false);
-
+
return positions.subList(indexStart, indexEnd);
}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/AbstractLineTracker.java b/org.eclipse.text/src/org/eclipse/jface/text/AbstractLineTracker.java
index 8ac9561b19f..d2766372e3e 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/AbstractLineTracker.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/AbstractLineTracker.java
@@ -34,7 +34,7 @@ public abstract class AbstractLineTracker implements ILineTracker, ILineTrackerE
/**
* Tells whether this class is in debug mode.
- *
+ *
* @since 3.1
*/
private static final boolean DEBUG= false;
@@ -52,7 +52,7 @@ public abstract class AbstractLineTracker implements ILineTracker, ILineTrackerE
/**
* Representation of replace and set requests.
- *
+ *
* @since 3.1
*/
protected static class Request {
@@ -79,19 +79,19 @@ public abstract class AbstractLineTracker implements ILineTracker, ILineTrackerE
/**
* The active rewrite session.
- *
+ *
* @since 3.1
*/
private DocumentRewriteSession fActiveRewriteSession;
/**
* The list of pending requests.
- *
+ *
* @since 3.1
*/
private List fPendingRequests;
/**
* The implementation that this tracker delegates to.
- *
+ *
* @since 3.2
*/
private ILineTracker fDelegate= new ListLineTracker() {
@@ -218,7 +218,7 @@ public abstract class AbstractLineTracker implements ILineTracker, ILineTrackerE
/**
* Converts the implementation to be a {@link TreeLineTracker} if it isn't yet.
- *
+ *
* @since 3.2
*/
private void checkImplementation() {
@@ -239,7 +239,7 @@ public abstract class AbstractLineTracker implements ILineTracker, ILineTrackerE
/**
* Returns the information about 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 information of the first found delimiter or <code>null</code>
@@ -271,7 +271,7 @@ public abstract class AbstractLineTracker implements ILineTracker, ILineTrackerE
/**
* Tells whether there's an active rewrite session.
- *
+ *
* @return <code>true</code> if there is an active rewrite session, <code>false</code>
* otherwise
* @since 3.1
@@ -282,7 +282,7 @@ public abstract class AbstractLineTracker implements ILineTracker, ILineTrackerE
/**
* Flushes the active rewrite session.
- *
+ *
* @throws BadLocationException in case the recorded requests cannot be processed correctly
* @since 3.1
*/
@@ -306,7 +306,7 @@ public abstract class AbstractLineTracker implements ILineTracker, ILineTrackerE
/**
* Checks the presence of a rewrite session and flushes it.
- *
+ *
* @throws BadLocationException in case flushing does not succeed
* @since 3.1
*/
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/Assert.java b/org.eclipse.text/src/org/eclipse/jface/text/Assert.java
index c0a1a8fad07..52391bbd48d 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/Assert.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/Assert.java
@@ -27,7 +27,7 @@ package org.eclipse.jface.text;
* 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>
- *
+ *
* @deprecated As of 3.3, replaced by {@link org.eclipse.core.runtime.Assert}
* @noinstantiate This class is not intended to be instantiated by clients.
*/
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/CopyOnWriteTextStore.java b/org.eclipse.text/src/org/eclipse/jface/text/CopyOnWriteTextStore.java
index fd5f3584000..7e4aadb9d42 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/CopyOnWriteTextStore.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/CopyOnWriteTextStore.java
@@ -23,7 +23,7 @@ import org.eclipse.core.runtime.Assert;
* <p>
* This class is not intended to be subclassed.
* </p>
- *
+ *
* @since 3.2
* @noextend This class is not intended to be subclassed by clients.
*/
@@ -48,7 +48,7 @@ public class CopyOnWriteTextStore implements ITextStore {
/**
* Create a text store with initial content.
- *
+ *
* @param text the initial content
*/
private StringTextStore(String text) {
@@ -103,7 +103,7 @@ public class CopyOnWriteTextStore implements ITextStore {
/**
* Creates an empty text store. The given text store will be used upon first modification
* attempt.
- *
+ *
* @param modifiableTextStore a modifiable <code>ITextStore</code> instance, may not be
* <code>null</code>
*/
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/Document.java b/org.eclipse.text/src/org/eclipse/jface/text/Document.java
index b6a27ed1351..14e2f9b817e 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/Document.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/Document.java
@@ -32,7 +32,7 @@ package org.eclipse.jface.text;
* See {@link GapTextStore} and <code>TreeLineTracker</code> for algorithmic behavior of the used
* document structures.
* </p>
- *
+ *
* @see org.eclipse.jface.text.GapTextStore
* @see org.eclipse.jface.text.CopyOnWriteTextStore
*/
@@ -74,7 +74,7 @@ public class Document extends AbstractDocument {
/**
* Checks whether the line information needs to be repaired.
- *
+ *
* @param text the text to check
* @return <code>true</code> if the line information must be repaired
* @since 3.4
@@ -104,7 +104,7 @@ public class Document extends AbstractDocument {
if (defaultLD == null)
return false;
-
+
defaultLD= getDefaultLineDelimiter();
if (defaultLD.length() == 1) {
@@ -114,8 +114,8 @@ public class Document extends AbstractDocument {
return true;
} else if (defaultLD.length() == 2)
return rIndex == -1 || nIndex - rIndex != 1;
-
+
return false;
}
-
+
}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java b/org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java
index 68e26c48fcd..2b6e563156a 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/DocumentEvent.java
@@ -23,12 +23,12 @@ import org.eclipse.core.runtime.Assert;
* @see org.eclipse.jface.text.IDocument
*/
public class DocumentEvent {
-
+
/**
* Debug option for asserting that text is not null.
* If the <code>org.eclipse.text/debug/DocumentEvent/assertTextNotNull</code>
* system property is <code>true</code>
- *
+ *
* @since 3.3
*/
private static final boolean ASSERT_TEXT_NOT_NULL= Boolean.getBoolean("org.eclipse.text/debug/DocumentEvent/assertTextNotNull"); //$NON-NLS-1$
@@ -128,7 +128,7 @@ public class DocumentEvent {
public long getModificationStamp() {
return fModificationStamp;
}
-
+
/*
* @see java.lang.Object#toString()
* @since 3.4
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/DocumentRewriteSessionType.java b/org.eclipse.text/src/org/eclipse/jface/text/DocumentRewriteSessionType.java
index 09d70d13ae1..757c816bc9f 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/DocumentRewriteSessionType.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/DocumentRewriteSessionType.java
@@ -39,7 +39,7 @@ public class DocumentRewriteSessionType {
/**
* An small unrestricted rewrite session is a short sequence of unrestricted replace operations.
* This should be used for changes that touch less than about fifty lines.
- *
+ *
* @since 3.3
*/
public final static DocumentRewriteSessionType UNRESTRICTED_SMALL= new DocumentRewriteSessionType();
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java b/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java
index 2e59a8e9eb2..966852b6e6f 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java
@@ -71,7 +71,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
* The match offset from the last findReplace call.
*/
private int fFindReplaceMatchOffset;
-
+
/**
* Retain case mode
*/
@@ -220,16 +220,16 @@ public class FindReplaceDocumentAdapter implements CharSequence {
if (operationCode != REPLACE) {
try {
if (forwardSearch) {
-
+
boolean found= false;
if (operationCode == FIND_FIRST)
found= fFindReplaceMatcher.find(startOffset);
else
found= fFindReplaceMatcher.find();
-
+
if (operationCode == REPLACE_FIND_NEXT)
fFindReplaceState= FIND_NEXT;
-
+
if (found && fFindReplaceMatcher.group().length() > 0)
return new Region(fFindReplaceMatcher.start(), fFindReplaceMatcher.group().length());
return null;
@@ -261,7 +261,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
/**
* Substitutes \R in a regex find pattern with (?>\r\n?|\n)
- *
+ *
* @param findString the original find pattern
* @return the transformed find pattern
* @throws PatternSyntaxException if \R is added at an illegal position (e.g. in a character set)
@@ -270,7 +270,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
private String substituteLinebreak(String findString) throws PatternSyntaxException {
int length= findString.length();
StringBuffer buf= new StringBuffer(length);
-
+
int inCharGroup= 0;
int inBraces= 0;
boolean inQuote= false;
@@ -282,25 +282,25 @@ public class FindReplaceDocumentAdapter implements CharSequence {
if (! inQuote)
inCharGroup++;
break;
-
+
case ']':
buf.append(ch);
if (! inQuote)
inCharGroup--;
break;
-
+
case '{':
buf.append(ch);
if (! inQuote && inCharGroup == 0)
inBraces++;
break;
-
+
case '}':
buf.append(ch);
if (! inQuote && inCharGroup == 0)
inBraces--;
break;
-
+
case '\\':
if (i + 1 < length) {
char ch1= findString.charAt(i + 1);
@@ -309,7 +309,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
inQuote= false;
buf.append(ch).append(ch1);
i++;
-
+
} else if (ch1 == 'R') {
if (inCharGroup > 0 || inBraces > 0) {
String msg= TextMessages.getString("FindReplaceDocumentAdapter.illegalLinebreak"); //$NON-NLS-1$
@@ -317,7 +317,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
}
buf.append("(?>\\r\\n?|\\n)"); //$NON-NLS-1$
i++;
-
+
} else {
if (ch1 == 'Q') {
inQuote= true;
@@ -329,20 +329,20 @@ public class FindReplaceDocumentAdapter implements CharSequence {
buf.append(ch);
}
break;
-
+
default:
buf.append(ch);
break;
}
-
+
}
return buf.toString();
}
-
+
/**
* Interprets current Retain Case mode (all upper-case,all lower-case,capitalized or mixed)
* and appends the character <code>ch</code> to <code>buf</code> after processing.
- *
+ *
* @param buf the output buffer
* @param ch the character to process
* @since 3.4
@@ -361,7 +361,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
/**
* Interprets escaped characters in the given replace pattern.
- *
+ *
* @param replaceText the replace pattern
* @param foundText the found pattern to be replaced
* @return a replace pattern with escaped characters substituted by the respective characters
@@ -371,21 +371,21 @@ public class FindReplaceDocumentAdapter implements CharSequence {
int length= replaceText.length();
boolean inEscape= false;
StringBuffer buf= new StringBuffer(length);
-
+
/* every string we did not check looks mixed at first
* so initialize retain case mode with RC_MIXED
*/
fRetainCaseMode= RC_MIXED;
-
+
for (int i= 0; i < length; i++) {
final char ch= replaceText.charAt(i);
if (inEscape) {
i= interpretReplaceEscape(ch, i, buf, replaceText, foundText);
inEscape= false;
-
+
} else if (ch == '\\') {
inEscape= true;
-
+
} else if (ch == '$') {
buf.append(ch);
@@ -411,7 +411,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
interpretRetainCase(buf, ch);
}
}
-
+
if (inEscape) {
// '\' as last character is invalid, but we still add it to get an error message
buf.append('\\');
@@ -422,7 +422,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
/**
* Interprets the escaped character <code>ch</code> at offset <code>i</code>
* of the <code>replaceText</code> and appends the interpretation to <code>buf</code>.
- *
+ *
* @param ch the escaped character
* @param i the offset
* @param buf the output buffer
@@ -472,7 +472,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
}
}
break;
-
+
case '1':
case '2':
case '3':
@@ -495,7 +495,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
throw new PatternSyntaxException(msg, replaceText, i);
}
break;
-
+
case 'x':
if (i + 2 < length) {
int parsedInt;
@@ -514,7 +514,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
throw new PatternSyntaxException(msg, replaceText, i);
}
break;
-
+
case 'u':
if (i + 4 < length) {
int parsedInt;
@@ -533,7 +533,7 @@ public class FindReplaceDocumentAdapter implements CharSequence {
throw new PatternSyntaxException(msg, replaceText, i);
}
break;
-
+
case 'C':
if(foundText.toUpperCase().equals(foundText)) // is whole match upper-case?
fRetainCaseMode= RC_UPPER;
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java b/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
index 7104ce71228..4102107caae 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
@@ -32,7 +32,7 @@ import org.eclipse.core.runtime.Assert;
* <p>
* This class is not intended to be subclassed.
* </p>
- *
+ *
* @see CopyOnWriteTextStore for a copy-on-write text store wrapper
* @noextend This class is not intended to be subclassed by clients.
*/
@@ -50,7 +50,7 @@ public class GapTextStore implements ITextStore {
/**
* The multiplier to compute the array size from the content length
* (1&nbsp;&lt;=&nbsp;fSizeMultiplier&nbsp;&lt;=&nbsp;2).
- *
+ *
* @since 3.3
*/
private final float fSizeMultiplier;
@@ -70,7 +70,7 @@ public class GapTextStore implements ITextStore {
/**
* Creates a new empty text store using the specified low and high watermarks.
- *
+ *
* @param lowWatermark unused - at the lower bound, the array is only resized when the content
* does not fit
* @param highWatermark if the gap is ever larger than this, it will automatically be shrunken
@@ -93,11 +93,11 @@ public class GapTextStore implements ITextStore {
*/
this(highWatermark / 2, highWatermark / 2, 0f);
}
-
+
/**
* Equivalent to
* {@linkplain GapTextStore#GapTextStore(int, int, float) new GapTextStore(256, 4096, 0.1f)}.
- *
+ *
* @since 3.3
*/
public GapTextStore() {
@@ -122,7 +122,7 @@ public class GapTextStore implements ITextStore {
* documents. Use <code>maxSize</code> to avoid a huge gap being allocated for large
* documents.
* </p>
- *
+ *
* @param minSize the minimum gap size to allocate (&gt;=&nbsp;0; use 0 for no minimum)
* @param maxSize the maximum gap size to allocate (&gt;=&nbsp;minSize; use
* {@link Integer#MAX_VALUE} for no maximum)
@@ -204,7 +204,7 @@ public class GapTextStore implements ITextStore {
* <code>offset + remove</code> behind the gap. The gap size is kept between 0 and
* {@link #fThreshold}, leading to re-allocation if needed. The content between
* <code>offset</code> and <code>offset + add</code> is undefined after this operation.
- *
+ *
* @param offset the offset at which a change happens
* @param remove the number of character which are removed or overwritten at <code>offset</code>
* @param add the number of character which are inserted or overwriting at <code>offset</code>
@@ -228,7 +228,7 @@ public class GapTextStore implements ITextStore {
/**
* Moves the gap to <code>newGapStart</code>.
- *
+ *
* @param offset the change offset
* @param remove the number of removed / overwritten characters
* @param oldGapSize the old gap size
@@ -260,7 +260,7 @@ public class GapTextStore implements ITextStore {
/**
* Reallocates a new array and copies the data from the previous one.
- *
+ *
* @param offset the change offset
* @param remove the number of removed / overwritten characters
* @param oldGapSize the old gap size
@@ -330,7 +330,7 @@ public class GapTextStore implements ITextStore {
/**
* Allocates a new <code>char[size]</code>.
- *
+ *
* @param size the length of the new array.
* @return a newly allocated char array
* @since 3.3
@@ -351,7 +351,7 @@ public class GapTextStore implements ITextStore {
/**
* Returns the gap size.
- *
+ *
* @return the gap size
* @since 3.3
*/
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java
index f5ea22972a7..485f4657e2b 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java
@@ -92,7 +92,7 @@ package org.eclipse.jface.text;
* <p>
* Clients may implement this interface and its extension interfaces or use the default
* implementation provided by <code>AbstractDocument</code> and <code>Document</code>.</p>
- *
+ *
* @see org.eclipse.jface.text.IDocumentExtension
* @see org.eclipse.jface.text.IDocumentExtension2
* @see org.eclipse.jface.text.IDocumentExtension3
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension4.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension4.java
index a7566e040f3..9a394c6b30a 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension4.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentExtension4.java
@@ -15,12 +15,12 @@ package org.eclipse.jface.text;
* following concepts:
* <ul>
* <li>Rewrite sessions. A rewrite session is a sequence of replace operations
- * that form a semantic unit.</li>
+ * that form a semantic unit.</li>
* <li>A modification stamp on the document</li>
* <li>The ability to set the initial line delimiter and to query the default
* line delimiter</li>
* </ul>
- *
+ *
* @since 3.1
*/
public interface IDocumentExtension4 {
@@ -131,17 +131,17 @@ public interface IDocumentExtension4 {
* @return the modification stamp of this document or <code>UNKNOWN_MODIFICATION_STAMP</code>
*/
long getModificationStamp();
-
+
/**
* Returns this document's default line delimiter.
* <p>
* This default line delimiter should be used by clients who
- * want unique delimiters (e.g. 'CR's) in the document.</p>
+ * want unique delimiters (e.g. 'CR's) in the document.</p>
*
* @return the default line delimiter or <code>null</code> if none
*/
String getDefaultLineDelimiter();
-
+
/**
* Sets this document's initial line delimiter i.e. the one
* which is returned by <code>getDefaultLineDelimiter</code>
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocument.java b/org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocument.java
index fb448f3b6b1..2805d78ef9c 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocument.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocument.java
@@ -23,8 +23,8 @@ package org.eclipse.jface.text;
* <li> {@link org.eclipse.jface.text.IRepairableDocumentExtension} since version 3.4
* adds the ability to query whether the repairable document needs to be repaired.</li>
* </ul>
- *
- *
+ *
+ *
* @see org.eclipse.jface.text.IDocument
* @see org.eclipse.jface.text.IRepairableDocumentExtension
* @since 3.0
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocumentExtension.java b/org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocumentExtension.java
index dec89ce7bbd..41c1b2edd52 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocumentExtension.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/IRepairableDocumentExtension.java
@@ -16,7 +16,7 @@ package org.eclipse.jface.text;
* <p>
* Adds the ability to query whether the repairable document needs to be
* repaired.
- *
+ *
* @see org.eclipse.jface.text.IRepairableDocument
* @since 3.4
*/
@@ -25,7 +25,7 @@ public interface IRepairableDocumentExtension {
/**
* Tells whether the line information of the document implementing this
* interface needs to be repaired.
- *
+ *
* @param offset the document offset
* @param length the length of the specified range
* @param text the substitution text to check
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/ListLineTracker.java b/org.eclipse.text/src/org/eclipse/jface/text/ListLineTracker.java
index 1e3e4ed3d44..47b63101f26 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/ListLineTracker.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/ListLineTracker.java
@@ -28,7 +28,7 @@ import org.eclipse.jface.text.AbstractLineTracker.DelimiterInfo;
* <li> "a\nbc\n" -> [0,2], [2,3], [5,0]
* </ul>
* This class must be subclassed.
- *
+ *
* @since 3.2
*/
abstract class ListLineTracker implements ILineTracker {
@@ -46,7 +46,7 @@ abstract class ListLineTracker implements ILineTracker {
/**
* Binary search for the line at a given offset.
- *
+ *
* @param offset the offset whose line should be found
* @return the line of the offset
*/
@@ -88,7 +88,7 @@ abstract class ListLineTracker implements ILineTracker {
/**
* 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
@@ -278,7 +278,7 @@ abstract class ListLineTracker implements ILineTracker {
/**
* Returns the information about 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 information of the first found delimiter or <code>null</code>
@@ -288,7 +288,7 @@ abstract class ListLineTracker implements ILineTracker {
/**
* 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
@@ -352,7 +352,7 @@ abstract class ListLineTracker implements ILineTracker {
/**
* Returns the internal data structure, a {@link List} of {@link Line}s. Used only by
* {@link TreeLineTracker#TreeLineTracker(ListLineTracker)}.
- *
+ *
* @return the internal list of lines.
*/
final List getLines() {
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/Region.java b/org.eclipse.text/src/org/eclipse/jface/text/Region.java
index 4216f713e46..0c9b7774119 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/Region.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/Region.java
@@ -63,7 +63,7 @@ public class Region implements IRegion {
public int hashCode() {
return (fOffset << 24) | (fLength << 16);
}
-
+
/*
* @see java.lang.Object#toString()
*/
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/RewriteSessionEditProcessor.java b/org.eclipse.text/src/org/eclipse/jface/text/RewriteSessionEditProcessor.java
index 128ad91243e..71412aa98da 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/RewriteSessionEditProcessor.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/RewriteSessionEditProcessor.java
@@ -23,7 +23,7 @@ import org.eclipse.text.edits.UndoEdit;
/**
* A text edit processor that brackets the application of edits into a document rewrite session.
- *
+ *
* @since 3.3
*/
public final class RewriteSessionEditProcessor extends TextEditProcessor {
@@ -64,7 +64,7 @@ public final class RewriteSessionEditProcessor extends TextEditProcessor {
/**
* Constructs a new edit processor for the given document.
- *
+ *
* @param document the document to manipulate
* @param root the root of the text edit tree describing the modifications. By passing a text
* edit a a text edit processor the ownership of the edit is transfered to the text edit
@@ -75,7 +75,7 @@ public final class RewriteSessionEditProcessor extends TextEditProcessor {
public RewriteSessionEditProcessor(IDocument document, TextEdit root, int style) {
super(document, root, style);
}
-
+
/*
* @see org.eclipse.text.edits.TextEditProcessor#performEdits()
*/
@@ -99,7 +99,7 @@ public final class RewriteSessionEditProcessor extends TextEditProcessor {
/**
* Returns <code>true</code> if the passed edit is considered <em>large</em>,
* <code>false</code> otherwise.
- *
+ *
* @param edit the edit to check
* @return <code>true</code> if <code>edit</code> is considered <em>large</em>,
* <code>false</code> otherwise
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/TextMessages.java b/org.eclipse.text/src/org/eclipse/jface/text/TextMessages.java
index 5972617e899..d7b8f7a71aa 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/TextMessages.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/TextMessages.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -18,7 +18,7 @@ import com.ibm.icu.text.MessageFormat;
/**
* Helper class to get NLSed messages.
- *
+ *
* @since 3.4
*/
class TextMessages {
@@ -36,7 +36,7 @@ class TextMessages {
return '!' + key + '!';
}
}
-
+
public static String getFormattedString(String key, Object arg) {
return getFormattedString(key, new Object[] { arg });
}
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java b/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
index f94506770cc..ef474e5882b 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/TextUtilities.java
@@ -479,11 +479,11 @@ public class TextUtilities {
*/
public static String getDefaultLineDelimiter(IDocument document) {
- if (document instanceof IDocumentExtension4)
+ if (document instanceof IDocumentExtension4)
return ((IDocumentExtension4)document).getDefaultLineDelimiter();
-
+
String lineDelimiter= null;
-
+
try {
lineDelimiter= document.getLineDelimiter(0);
} catch (BadLocationException x) {
@@ -491,7 +491,7 @@ public class TextUtilities {
if (lineDelimiter != null)
return lineDelimiter;
-
+
String sysLineDelimiter= System.getProperty("line.separator"); //$NON-NLS-1$
String[] delimiters= document.getLegalLineDelimiters();
Assert.isTrue(delimiters.length > 0);
@@ -501,7 +501,7 @@ public class TextUtilities {
break;
}
}
-
+
if (lineDelimiter == null)
lineDelimiter= delimiters[0];
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.java b/org.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.java
index 73ff0a1b7c7..03edfbe4378 100755
--- a/org.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/TreeLineTracker.java
@@ -40,23 +40,23 @@ import org.eclipse.jface.text.AbstractLineTracker.DelimiterInfo;
* log n)</i> where <var>n</var> is the number of lines in the document and <var>l</var> is the
* sum of the number of removed, added or modified lines.
* </p>
- *
+ *
* @since 3.2
*/
abstract class TreeLineTracker implements ILineTracker {
/*
* Differential Balanced Binary Tree
- *
+ *
* Assumption: lines cannot overlap => there exists a total ordering of the lines by their offset,
* which is the same as the ordering by line number
- *
+ *
* Base idea: store lines in a binary search tree
* - the key is the line number / line offset
* -> lookup_line is O(log n)
* -> lookup_offset is O(log n)
* - a change in a line somewhere will change any succeeding line numbers / line offsets
* -> replace is O(n)
- *
+ *
* Differential tree: instead of storing the key (line number, line offset) directly, every node
* stores the difference between its key and its parent's key
* - the sort key is still the line number / line offset, but it remains "virtual"
@@ -68,23 +68,23 @@ abstract class TreeLineTracker implements ILineTracker {
* -> line offsets and line numbers have to be computed when walking the tree from the root /
* from a node
* -> still O(log n)
- *
+ *
* The balancing algorithm chosen does not depend on the differential tree property. An AVL tree
* implementation has been chosen for simplicity.
*/
-
+
/*
* Turns assertions on/off. Don't make this a a debug option for performance reasons - this way
* the compiler can optimize the asserts away.
*/
private static final boolean ASSERT= false;
-
+
/**
* The empty delimiter of the last line. The last line and only the last line must have this
* zero-length delimiter.
*/
private static final String NO_DELIM= ""; //$NON-NLS-1$
-
+
/**
* A node represents one line. Its character and line offsets are 0-based and relative to the
* subtree covered by the node. All nodes under the left subtree represent lines before, all
@@ -117,7 +117,7 @@ abstract class TreeLineTracker implements ILineTracker {
Node right;
/** The balance factor. */
byte balance;
-
+
/*
* @see java.lang.Object#toString()
*/
@@ -147,7 +147,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Returns the pure (without the line delimiter) length of this line.
- *
+ *
* @return the pure line length
*/
int pureLength() {
@@ -168,7 +168,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Package visible constructor for creating a tree tracker from a list tracker.
- *
+ *
* @param tracker the list line tracker
*/
TreeLineTracker(ListLineTracker tracker) {
@@ -176,7 +176,7 @@ abstract class TreeLineTracker implements ILineTracker {
final int n= lines.size();
if (n == 0)
return;
-
+
Line line= (Line) lines.get(0);
String delim= line.delimiter;
if (delim == null)
@@ -184,7 +184,7 @@ abstract class TreeLineTracker implements ILineTracker {
int length= line.length;
fRoot= new Node(length, delim);
Node node= fRoot;
-
+
for (int i= 1; i < n; i++) {
line= (Line) lines.get(i);
delim= line.delimiter;
@@ -193,10 +193,10 @@ abstract class TreeLineTracker implements ILineTracker {
length= line.length;
node= insertAfter(node, length, delim);
}
-
+
if (node.delimiter != NO_DELIM)
insertAfter(node, 0, NO_DELIM);
-
+
if (ASSERT) checkTree();
}
@@ -215,7 +215,7 @@ abstract class TreeLineTracker implements ILineTracker {
* <p>
* <code>offset= line.offset + line.length</code>.
* </p>
- *
+ *
* @param offset a document offset
* @return the line starting at or containing <code>offset</code>
* @throws BadLocationException if the offset is invalid
@@ -227,11 +227,11 @@ abstract class TreeLineTracker implements ILineTracker {
int remaining= offset;
Node node= fRoot;
int line= 0;
-
+
while (true) {
if (node == null)
fail(offset);
-
+
if (remaining < node.offset) {
node= node.left;
} else {
@@ -246,14 +246,14 @@ abstract class TreeLineTracker implements ILineTracker {
node= node.right;
}
}
-
+
return node;
}
/**
* Returns the line number for the given offset. If the offset is between two lines, the line
* starting at <code>offset</code> is returned. The last line is returned if
* <code>offset</code> is equal to the document length.
- *
+ *
* @param offset a document offset
* @return the line number starting at or containing <code>offset</code>
* @throws BadLocationException if the offset is invalid
@@ -265,11 +265,11 @@ abstract class TreeLineTracker implements ILineTracker {
int remaining= offset;
Node node= fRoot;
int line= 0;
-
+
while (true) {
if (node == null)
fail(offset);
-
+
if (remaining < node.offset) {
node= node.left;
} else {
@@ -284,11 +284,11 @@ abstract class TreeLineTracker implements ILineTracker {
}
}
}
-
+
/**
* Returns the node (line) with the given line number. Note that the last line is always
* incomplete, i.e. has the {@link #NO_DELIM} delimiter.
- *
+ *
* @param line a line number
* @return the line with the given line number
* @throws BadLocationException if the line is invalid
@@ -300,11 +300,11 @@ abstract class TreeLineTracker implements ILineTracker {
int remaining= line;
int offset= 0;
Node node= fRoot;
-
+
while (true) {
if (node == null)
fail(line);
-
+
if (remaining == node.line)
break;
if (remaining < node.line) {
@@ -315,14 +315,14 @@ abstract class TreeLineTracker implements ILineTracker {
node= node.right;
}
}
-
+
return node;
}
-
+
/**
* Returns the offset for the given line number. Note that the
* last line is always incomplete, i.e. has the {@link #NO_DELIM} delimiter.
- *
+ *
* @param line a line number
* @return the line offset with the given line number
* @throws BadLocationException if the line is invalid
@@ -334,11 +334,11 @@ abstract class TreeLineTracker implements ILineTracker {
int remaining= line;
int offset= 0;
Node node= fRoot;
-
+
while (true) {
if (node == null)
fail(line);
-
+
if (remaining == node.line)
return offset + node.offset;
@@ -351,11 +351,11 @@ abstract class TreeLineTracker implements ILineTracker {
}
}
}
-
+
/**
* Left rotation - the given node is rotated down, its right child is rotated up, taking the
* previous structural position of <code>node</code>.
- *
+ *
* @param node the node to rotate around
*/
private void rotateLeft(Node node) {
@@ -363,13 +363,13 @@ abstract class TreeLineTracker implements ILineTracker {
Node child= node.right;
if (ASSERT) Assert.isNotNull(child);
boolean leftChild= node.parent == null || node == node.parent.left;
-
+
// restructure
setChild(node.parent, child, leftChild);
-
+
setChild(node, child.left, false);
setChild(child, node, true);
-
+
// update relative info
// child becomes the new parent, its line and offset counts increase as the former parent
// moves under child's left subtree
@@ -380,7 +380,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Right rotation - the given node is rotated down, its left child is rotated up, taking the
* previous structural position of <code>node</code>.
- *
+ *
* @param node the node to rotate around
*/
private void rotateRight(Node node) {
@@ -388,12 +388,12 @@ abstract class TreeLineTracker implements ILineTracker {
Node child= node.left;
if (ASSERT) Assert.isNotNull(child);
boolean leftChild= node.parent == null || node == node.parent.left;
-
+
setChild(node.parent, child, leftChild);
-
+
setChild(node, child.right, true);
setChild(child, node, false);
-
+
// update relative info
// node loses its left subtree, except for what it keeps in its new subtree
// this is exactly the amount in child
@@ -403,7 +403,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Helper method for moving a child, ensuring that parent pointers are set correctly.
- *
+ *
* @param parent the new parent of <code>child</code>, <code>null</code> to replace the
* root node
* @param child the new child of <code>parent</code>, may be <code>null</code>
@@ -426,11 +426,11 @@ abstract class TreeLineTracker implements ILineTracker {
if (child != null)
child.parent= parent;
}
-
+
/**
* A left rotation around <code>parent</code>, whose structural position is replaced by
* <code>node</code>.
- *
+ *
* @param node the node moving up and left
* @param parent the node moving left and down
*/
@@ -443,7 +443,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* A right rotation around <code>parent</code>, whose structural position is replaced by
* <code>node</code>.
- *
+ *
* @param node the node moving up and right
* @param parent the node moving right and down
*/
@@ -456,7 +456,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* A double left rotation, first rotating right around <code>node</code>, then left around
* <code>parent</code>.
- *
+ *
* @param node the node that will be rotated right
* @param parent the node moving left and down
*/
@@ -481,7 +481,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* A double right rotation, first rotating left around <code>node</code>, then right around
* <code>parent</code>.
- *
+ *
* @param node the node that will be rotated left
* @param parent the node moving right and down
*/
@@ -505,7 +505,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Inserts a line with the given length and delimiter after <code>node</code>.
- *
+ *
* @param node the predecessor of the inserted node
* @param length the line length of the inserted node
* @param delimiter the delimiter of the inserted node
@@ -518,23 +518,23 @@ abstract class TreeLineTracker implements ILineTracker {
* of the predecessor node, or the left child of the successor node.
*/
Node added= new Node(length, delimiter);
-
+
if (node.right == null)
setChild(node, added, false);
else
setChild(successorDown(node.right), added, true);
-
+
// parent chain update
updateParentChain(added, length, 1);
updateParentBalanceAfterInsertion(added);
-
+
return added;
}
-
+
/**
* Updates the balance information in the parent chain of node until it reaches the root or
* finds a node whose balance violates the AVL constraint, which is the re-balanced.
- *
+ *
* @param node the child of the first node that needs balance updating
*/
private void updateParentBalanceAfterInsertion(Node node) {
@@ -566,10 +566,10 @@ abstract class TreeLineTracker implements ILineTracker {
return;
}
}
-
+
/**
* Re-balances a node whose parent has a double positive balance.
- *
+ *
* @param node the node to re-balance
*/
private void rebalanceAfterInsertionRight(Node node) {
@@ -585,7 +585,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Re-balances a node whose parent has a double negative balance.
- *
+ *
* @param node the node to re-balance
*/
private void rebalanceAfterInsertionLeft(Node node) {
@@ -604,16 +604,16 @@ abstract class TreeLineTracker implements ILineTracker {
*/
public final void replace(int offset, int length, String text) throws BadLocationException {
if (ASSERT) checkTree();
-
+
// Inlined nodeByOffset as we need both node and offset
int remaining= offset;
Node first= fRoot;
final int firstNodeOffset;
-
+
while (true) {
if (first == null)
fail(offset);
-
+
if (remaining < first.offset) {
first= first.left;
} else {
@@ -629,14 +629,14 @@ abstract class TreeLineTracker implements ILineTracker {
}
// Inline nodeByOffset end
if (ASSERT) Assert.isTrue(first != null);
-
+
Node last;
if (offset + length < firstNodeOffset + first.length)
last= first;
else
last= nodeByOffset(offset + length);
if (ASSERT) Assert.isTrue(last != null);
-
+
int firstLineDelta= firstNodeOffset + first.length - offset;
if (first == last)
replaceInternal(first, text, length, firstLineDelta);
@@ -648,7 +648,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Replace happening inside a single line.
- *
+ *
* @param node the affected node
* @param text the added text
* @param length the replace length, &lt; <code>firstLineDelta</code>
@@ -657,7 +657,7 @@ abstract class TreeLineTracker implements ILineTracker {
*/
private void replaceInternal(Node node, String text, int length, int firstLineDelta) {
// 1) modification on a single line
-
+
DelimiterInfo info= text == null ? null : nextDelimiterInfo(text, 0);
if (info == null || info.delimiter == null) {
@@ -669,7 +669,7 @@ abstract class TreeLineTracker implements ILineTracker {
// remember what we split off the first line
int remainder= firstLineDelta - length;
String remDelim= node.delimiter;
-
+
// join the first line with the first added
int consumed= info.delimiterIndex + info.delimiterLength;
int delta= consumed - firstLineDelta;
@@ -690,10 +690,10 @@ abstract class TreeLineTracker implements ILineTracker {
insertAfter(node, remainder + text.length() - consumed, remDelim);
}
}
-
+
/**
* Replace spanning from one node to another.
- *
+ *
* @param node the first affected node
* @param last the last affected node
* @param text the added text
@@ -703,7 +703,7 @@ abstract class TreeLineTracker implements ILineTracker {
*/
private void replaceFromTo(Node node, Node last, String text, int length, int firstLineDelta) {
// 2) modification covers several lines
-
+
// delete intermediate nodes
// TODO could be further optimized: replace intermediate lines with intermediate added lines
// to reduce re-balancing
@@ -722,9 +722,9 @@ abstract class TreeLineTracker implements ILineTracker {
// join the two lines if there are no lines added
join(node, last, added - length);
-
+
} else {
-
+
// join the first line with the first added
int consumed= info.delimiterIndex + info.delimiterLength;
updateLength(node, consumed - firstLineDelta);
@@ -740,7 +740,7 @@ abstract class TreeLineTracker implements ILineTracker {
info= nextDelimiterInfo(text, consumed);
}
// Inline addLines end
-
+
updateLength(last, text.length() - consumed - length);
}
}
@@ -748,7 +748,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Joins two consecutive node lines, additionally adjusting the resulting length of the combined
* line by <code>delta</code>. The first node gets deleted.
- *
+ *
* @param one the first node to join
* @param two the second node to join
* @param delta the delta to apply to the remaining single node
@@ -758,21 +758,21 @@ abstract class TreeLineTracker implements ILineTracker {
updateLength(one, -oneLength);
updateLength(two, oneLength + delta);
}
-
+
/**
* Adjusts the length of a node by <code>delta</code>, also adjusting the parent chain of
* <code>node</code>. If the node's length becomes zero and is not the last (incomplete)
* node, it is deleted after the update.
- *
+ *
* @param node the node to adjust
* @param delta the character delta to add to the node's length
*/
private void updateLength(Node node, int delta) {
if (ASSERT) Assert.isTrue(node.length + delta >= 0);
-
+
// update the node itself
node.length += delta;
-
+
// check deletion
final int lineDelta;
boolean delete= node.length == 0 && node.delimiter != NO_DELIM;
@@ -780,11 +780,11 @@ abstract class TreeLineTracker implements ILineTracker {
lineDelta= -1;
else
lineDelta= 0;
-
+
// update parent chain
if (delta != 0 || lineDelta != 0)
updateParentChain(node, delta, lineDelta);
-
+
if (delete)
delete(node);
}
@@ -792,7 +792,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Updates the differential indices following the parent chain. All nodes from
* <code>from.parent</code> to the root are updated.
- *
+ *
* @param node the child of the first node to update
* @param deltaLength the character delta
* @param deltaLines the line delta
@@ -800,11 +800,11 @@ abstract class TreeLineTracker implements ILineTracker {
private void updateParentChain(Node node, int deltaLength, int deltaLines) {
updateParentChain(node, null, deltaLength, deltaLines);
}
-
+
/**
* Updates the differential indices following the parent chain. All nodes from
* <code>from.parent</code> to <code>to</code> (exclusive) are updated.
- *
+ *
* @param from the child of the first node to update
* @param to the first node not to update
* @param deltaLength the character delta
@@ -828,18 +828,18 @@ abstract class TreeLineTracker implements ILineTracker {
* node's parent chain have to be updated in advance to calling this method. Generally, don't
* call <code>delete</code> directly, but call <code>update_length(node, -node.length)</code> to
* properly remove a node.
- *
+ *
* @param node the node to delete.
*/
private void delete(Node node) {
if (ASSERT) Assert.isTrue(node != null);
if (ASSERT) Assert.isTrue(node.length == 0);
-
+
Node parent= node.parent;
Node toUpdate; // the parent of the node that lost a child
boolean lostLeftChild;
boolean isLeftChild= parent == null || node == parent.left;
-
+
if (node.left == null || node.right == null) {
// 1) node has one child at max - replace parent's pointer with the only child
// also handles the trivial case of no children
@@ -870,7 +870,7 @@ abstract class TreeLineTracker implements ILineTracker {
} else {
// 3) hard case - replace node with its successor
Node successor= successor(node);
-
+
// successor exists (otherwise node would not have right child, case 1)
if (ASSERT) Assert.isNotNull(successor);
// successor has no left child (a left child would be the real successor of node)
@@ -887,29 +887,29 @@ abstract class TreeLineTracker implements ILineTracker {
// update relative indices
updateParentChain(successor, node, -successor.length, -1);
-
+
// delete successor from its current place - like 1)
setChild(toUpdate, successor.right, true);
// move node's subtrees to its successor
setChild(successor, node.right, false);
setChild(successor, node.left, true);
-
+
// replace node by successor in its parent
setChild(parent, successor, isLeftChild);
-
+
// update the successor
successor.line= node.line;
successor.offset= node.offset;
successor.balance= node.balance;
}
-
+
updateParentBalanceAfterDeletion(toUpdate, lostLeftChild);
}
-
+
/**
* Updates the balance information in the parent chain of node.
- *
+ *
* @param node the first node that needs balance updating
* @param wasLeftChild <code>true</code> if the deletion happened on <code>node</code>'s
* left subtree, <code>false</code> if it occurred on <code>node</code>'s right
@@ -921,7 +921,7 @@ abstract class TreeLineTracker implements ILineTracker {
node.balance++;
else
node.balance--;
-
+
Node parent= node.parent;
if (parent != null)
wasLeftChild= node == parent.left;
@@ -944,14 +944,14 @@ abstract class TreeLineTracker implements ILineTracker {
if (ASSERT)
Assert.isTrue(false);
}
-
+
node= parent;
}
}
-
+
/**
* Re-balances a node whose parent has a double positive balance.
- *
+ *
* @param node the node to re-balance
* @return <code>true</code> if the re-balancement leaves the height at
* <code>node.parent</code> constant, <code>false</code> if the height changed
@@ -977,7 +977,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Re-balances a node whose parent has a double negative balance.
- *
+ *
* @param node the node to re-balance
* @return <code>true</code> if the re-balancement leaves the height at
* <code>node.parent</code> constant, <code>false</code> if the height changed
@@ -1003,20 +1003,20 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Returns the successor of a node, <code>null</code> if node is the last node.
- *
+ *
* @param node a node
* @return the successor of <code>node</code>, <code>null</code> if there is none
*/
private Node successor(Node node) {
if (node.right != null)
return successorDown(node.right);
-
+
return successorUp(node);
}
-
+
/**
* Searches the successor of <code>node</code> in its parent chain.
- *
+ *
* @param node a node
* @return the first node in <code>node</code>'s parent chain that is reached from its left
* subtree, <code>null</code> if there is none
@@ -1036,7 +1036,7 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Searches the left-most node in a given subtree.
- *
+ *
* @param node a node
* @return the left-most node in the given subtree
*/
@@ -1053,14 +1053,14 @@ abstract class TreeLineTracker implements ILineTracker {
/**
* Throws an exception.
- *
+ *
* @param offset the illegal character or line offset that caused the exception
* @throws BadLocationException always
*/
private void fail(int offset) throws BadLocationException {
throw new BadLocationException();
}
-
+
/**
* Returns the information about the first delimiter found in the given
* text starting at the given offset.
@@ -1070,7 +1070,7 @@ abstract class TreeLineTracker implements ILineTracker {
* @return the information of the first found delimiter or <code>null</code>
*/
protected abstract DelimiterInfo nextDelimiterInfo(String text, int offset);
-
+
/*
* @see org.eclipse.jface.text.ILineTracker#getLineDelimiter(int)
*/
@@ -1117,7 +1117,7 @@ abstract class TreeLineTracker implements ILineTracker {
int startLine= lineByOffset(offset);
int endLine= lineByOffset(offset + length);
-
+
return endLine - startLine + 1;
}
@@ -1151,11 +1151,11 @@ abstract class TreeLineTracker implements ILineTracker {
int remaining= offset;
Node node= fRoot;
final int lineOffset;
-
+
while (true) {
if (node == null)
fail(offset);
-
+
if (remaining < node.offset) {
node= node.left;
} else {
@@ -1182,11 +1182,11 @@ abstract class TreeLineTracker implements ILineTracker {
int remaining= line;
int offset= 0;
Node node= fRoot;
-
+
while (true) {
if (node == null)
fail(line);
-
+
if (remaining == node.line) {
offset += node.offset;
break;
@@ -1213,11 +1213,11 @@ abstract class TreeLineTracker implements ILineTracker {
int remaining= line;
int offset= 0;
Node node= fRoot;
-
+
while (true) {
if (node == null)
fail(line);
-
+
if (remaining == node.line) {
offset+= node.offset;
break;
@@ -1250,7 +1250,7 @@ abstract class TreeLineTracker implements ILineTracker {
throw new InternalError();
}
}
-
+
/*
* @see java.lang.Object#toString()
*/
@@ -1260,7 +1260,7 @@ abstract class TreeLineTracker implements ILineTracker {
int leaves= (int) Math.pow(2, depth - 1);
int width= WIDTH * leaves;
String empty= "."; //$NON-NLS-1$
-
+
List roots= new LinkedList();
roots.add(fRoot);
StringBuffer buf= new StringBuffer((width + 1) * depth);
@@ -1276,7 +1276,7 @@ abstract class TreeLineTracker implements ILineTracker {
for (ListIterator it= roots.listIterator(); it.hasNext();) {
// pad before
buf.append(space, 0, spaces);
-
+
Node node= (Node) it.next();
String box;
// replace the node with its children
@@ -1288,76 +1288,76 @@ abstract class TreeLineTracker implements ILineTracker {
it.add(node.right);
box= node.toString();
}
-
+
// draw the node, pad to WIDTH
int pad_left= (WIDTH - box.length() + 1) / 2;
int pad_right= WIDTH - box.length() - pad_left;
buf.append(space, 0, pad_left);
buf.append(box);
buf.append(space, 0, pad_right);
-
+
// pad after
buf.append(space, 0, spaces);
}
-
+
buf.append('\n');
nodes *= 2;
}
-
+
return buf.toString();
}
/**
* Recursively computes the depth of the tree. Only used by {@link #toString()}.
- *
+ *
* @param root the subtree to compute the depth of, may be <code>null</code>
* @return the depth of the given tree, 0 if it is <code>null</code>
*/
private byte computeDepth(Node root) {
if (root == null)
return 0;
-
+
return (byte) (Math.max(computeDepth(root.left), computeDepth(root.right)) + 1);
}
-
+
/**
* Debug-only method that checks the tree structure and the differential offsets.
*/
private void checkTree() {
checkTreeStructure(fRoot);
-
+
try {
checkTreeOffsets(nodeByOffset(0), new int[] {0, 0}, null);
} catch (BadLocationException x) {
throw new AssertionError();
}
}
-
+
/**
* Debug-only method that validates the tree structure below <code>node</code>. I.e. it
* checks whether all parent/child pointers are consistent and whether the AVL balance
* information is correct.
- *
+ *
* @param node the node to validate
* @return the depth of the tree under <code>node</code>
*/
private byte checkTreeStructure(Node node) {
if (node == null)
return 0;
-
+
byte leftDepth= checkTreeStructure(node.left);
byte rightDepth= checkTreeStructure(node.right);
Assert.isTrue(node.balance == rightDepth - leftDepth);
Assert.isTrue(node.left == null || node.left.parent == node);
Assert.isTrue(node.right == null || node.right.parent == node);
-
+
return (byte) (Math.max(rightDepth, leftDepth) + 1);
}
-
+
/**
* Debug-only method that checks the differential offsets of the tree, starting at
* <code>node</code> and continuing until <code>last</code>.
- *
+ *
* @param node the first <code>Node</code> to check, may be <code>null</code>
* @param offLen an array of length 2, with <code>offLen[0]</code> the expected offset of
* <code>node</code> and <code>offLen[1]</code> the expected line of
@@ -1370,16 +1370,16 @@ abstract class TreeLineTracker implements ILineTracker {
private int[] checkTreeOffsets(Node node, int[] offLen, Node last) {
if (node == last)
return offLen;
-
+
Assert.isTrue(node.offset == offLen[0]);
Assert.isTrue(node.line == offLen[1]);
-
+
if (node.right != null) {
int[] result= checkTreeOffsets(successorDown(node.right), new int[2], node);
offLen[0] += result[0];
offLen[1] += result[1];
}
-
+
offLen[0] += node.length;
offLen[1]++;
return checkTreeOffsets(node.parent, offLen, last);
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedModeManager.java b/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedModeManager.java
index d8a3c9502aa..16af314a0c3 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedModeManager.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedModeManager.java
@@ -143,7 +143,7 @@ class LinkedModeManager {
/**
* Notify the manager about a leaving model.
- *
+ *
* @param model the model to nest
* @param flags the reason and commands for leaving linked mode
*/
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedModeModel.java b/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedModeModel.java
index 9b68f66707f..f85439bf063 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedModeModel.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedModeModel.java
@@ -118,7 +118,7 @@ public class LinkedModeModel {
public static LinkedModeModel getModel(IDocument document, int offset) {
if (!hasInstalledModel(document))
return null;
-
+
LinkedModeManager mgr= LinkedModeManager.getLinkedManager(new IDocument[] {document}, false);
if (mgr != null)
return mgr.getTopEnvironment();
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedPositionGroup.java b/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedPositionGroup.java
index cdc78007e56..80c157d562c 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedPositionGroup.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedPositionGroup.java
@@ -263,7 +263,7 @@ public class LinkedPositionGroup {
return map;
} catch (MalformedTreeException x) {
- // may happen during undo, as LinkedModeModel does not know
+ // may happen during undo, as LinkedModeModel does not know
// that the changes technically originate from a parent environment
// if this happens, post notification changes are not accepted anyway and
// we can simply return null - any changes will be undone by the undo
@@ -380,7 +380,7 @@ public class LinkedPositionGroup {
public boolean isEmpty() {
return fPositions.size() == 0;
}
-
+
/**
* Returns whether this group contains any positions.
*
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/source/AnnotationModel.java b/org.eclipse.text/src/org/eclipse/jface/text/source/AnnotationModel.java
index 5f5b4756605..159c2cfb8de 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/source/AnnotationModel.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/source/AnnotationModel.java
@@ -43,26 +43,26 @@ public class AnnotationModel implements IAnnotationModel, IAnnotationModelExtens
/**
* Iterator that returns the annotations for a given region.
- *
+ *
* @since 3.4
* @see AnnotationModel.RegionIterator#RegionIterator(Iterator, IAnnotationModel, int, int, boolean, boolean)
*/
private static final class RegionIterator implements Iterator {
-
+
private final Iterator fParentIterator;
private final boolean fCanEndAfter;
private final boolean fCanStartBefore;
private final IAnnotationModel fModel;
private Object fNext;
private Position fRegion;
-
+
/**
* Iterator that returns all annotations from the parent iterator which
* have a position in the given model inside the given region.
* <p>
* See {@link IAnnotationModelExtension2} for a definition of inside.
* </p>
- *
+ *
* @param parentIterator iterator containing all annotations
* @param model the model to use to retrieve positions from for each
* annotation
@@ -80,33 +80,33 @@ public class AnnotationModel implements IAnnotationModel, IAnnotationModelExtens
fCanStartBefore= canStartBefore;
fNext= findNext();
}
-
+
/*
* @see java.util.Iterator#hasNext()
*/
public boolean hasNext() {
return fNext != null;
}
-
+
/*
* @see java.util.Iterator#next()
*/
public Object next() {
if (!hasNext())
throw new NoSuchElementException();
-
+
Object result= fNext;
fNext= findNext();
return result;
}
-
+
/*
* @see java.util.Iterator#remove()
*/
public void remove() {
throw new UnsupportedOperationException();
}
-
+
private Object findNext() {
while (fParentIterator.hasNext()) {
Annotation next= (Annotation) fParentIterator.next();
@@ -131,20 +131,20 @@ public class AnnotationModel implements IAnnotationModel, IAnnotationModelExtens
return fRegion.includes(start) && fRegion.includes(start + length - 1);
}
}
-
+
/**
* An iterator iteration over a Positions and mapping positions to
* annotations using a provided map if the provided map contains the element.
- *
+ *
* @since 3.4
*/
private static final class AnnotationsInterator implements Iterator {
-
+
private Object fNext;
private final Position[] fPositions;
private int fIndex;
private final Map fMap;
-
+
/**
* @param positions positions to iterate over
* @param map a map to map positions to annotations
@@ -155,14 +155,14 @@ public class AnnotationModel implements IAnnotationModel, IAnnotationModelExtens
fMap= map;
fNext= findNext();
}
-
+
/* (non-Javadoc)
* @see java.util.Iterator#hasNext()
*/
public boolean hasNext() {
return fNext != null;
}
-
+
/* (non-Javadoc)
* @see java.util.Iterator#next()
*/
@@ -171,14 +171,14 @@ public class AnnotationModel implements IAnnotationModel, IAnnotationModelExtens
fNext= findNext();
return result;
}
-
+
/* (non-Javadoc)
* @see java.util.Iterator#remove()
*/
public void remove() {
throw new UnsupportedOperationException();
}
-
+
private Object findNext() {
while (fIndex < fPositions.length) {
Position position= fPositions[fIndex];
@@ -186,7 +186,7 @@ public class AnnotationModel implements IAnnotationModel, IAnnotationModelExtens
if (fMap.containsKey(position))
return fMap.get(position);
}
-
+
return null;
}
}
@@ -694,15 +694,15 @@ public class AnnotationModel implements IAnnotationModel, IAnnotationModelExtens
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public Iterator getAnnotationIterator(int offset, int length, boolean canStartBefore, boolean canEndAfter) {
Iterator regionIterator= getRegionAnnotationIterator(offset, length, canStartBefore, canEndAfter);
-
+
if (fAttachments.isEmpty())
return regionIterator;
-
+
List iterators= new ArrayList(fAttachments.size() + 1);
iterators.add(regionIterator);
Iterator it= fAttachments.keySet().iterator();
@@ -713,13 +713,13 @@ public class AnnotationModel implements IAnnotationModel, IAnnotationModelExtens
else
iterators.add(new RegionIterator(attachment.getAnnotationIterator(), attachment, offset, length, canStartBefore, canEndAfter));
}
-
+
return new MetaIterator(iterators.iterator());
}
-
+
/**
* Returns an iterator as specified in {@link IAnnotationModelExtension2#getAnnotationIterator(int, int, boolean, boolean)}
- *
+ *
* @param offset region start
* @param length region length
* @param canStartBefore position can start before region
@@ -731,10 +731,10 @@ public class AnnotationModel implements IAnnotationModel, IAnnotationModelExtens
private Iterator getRegionAnnotationIterator(int offset, int length, boolean canStartBefore, boolean canEndAfter) {
if (!(fDocument instanceof AbstractDocument))
return new RegionIterator(getAnnotationIterator(true), this, offset, length, canStartBefore, canEndAfter);
-
+
AbstractDocument document= (AbstractDocument) fDocument;
cleanup(true);
-
+
try {
Position[] positions= document.getPositions(IDocument.DEFAULT_CATEGORY, offset, length, canStartBefore, canEndAfter);
return new AnnotationsInterator(positions, fPositions);
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/source/AnnotationModelEvent.java b/org.eclipse.text/src/org/eclipse/jface/text/source/AnnotationModelEvent.java
index 043a4bb7961..99d90500201 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/source/AnnotationModelEvent.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/source/AnnotationModelEvent.java
@@ -11,13 +11,13 @@
package org.eclipse.jface.text.source;
-import org.eclipse.jface.text.Position;
-
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import org.eclipse.jface.text.Position;
+
/**
* Specification of changes applied to annotation models. The event carries the
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/source/IAnnotationModelExtension2.java b/org.eclipse.text/src/org/eclipse/jface/text/source/IAnnotationModelExtension2.java
index e442c2eb5be..459306db9b6 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/source/IAnnotationModelExtension2.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/source/IAnnotationModelExtension2.java
@@ -24,7 +24,7 @@ public interface IAnnotationModelExtension2 {
/**
* Returns an iterator over all annotations managed by this model that are
* inside the given region.
- *
+ *
* @param offset the start position of the region, must be >= 0
* @param length the length of the region, must be >= 0
* @param canStartBefore if <code>true</code> then annotations are included
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/templates/Template.java b/org.eclipse.text/src/org/eclipse/jface/text/templates/Template.java
index f0c3572feff..9c6d5728ece 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/templates/Template.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/templates/Template.java
@@ -32,7 +32,7 @@ public class Template {
/** The template pattern. */
private /*final*/ String fPattern;
/**
- * The auto insertable property.
+ * The auto insertable property.
* @since 3.1
*/
private final boolean fIsAutoInsertable;
@@ -204,7 +204,7 @@ public class Template {
/**
* Returns the auto insertable property of the template.
- *
+ *
* @return the auto insertable property of the template
* @since 3.1
*/
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateContextType.java b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateContextType.java
index 8cc95b6ca9f..5de3cee352f 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateContextType.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateContextType.java
@@ -78,7 +78,7 @@ public class TemplateContextType {
/**
* Returns the id of the context type.
- *
+ *
* @return the id of the receiver
*/
public String getId() {
@@ -260,7 +260,7 @@ public class TemplateContextType {
/**
* Resolves a single variable in a context. Resolving is delegated to the registered resolver.
- *
+ *
* @param variable the variable to resolve
* @param context the context in which to resolve the variable
* @since 3.3
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java
index 2d123d9fd27..f1c6fe05dfd 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateTranslator.java
@@ -37,7 +37,7 @@ import java.util.regex.Pattern;
* <p>
* Clients may only replace the <code>createVariable</code> method of this class.
* </p>
- *
+ *
* @since 3.0
*/
public class TemplateTranslator {
@@ -95,7 +95,7 @@ public class TemplateTranslator {
SPACES +
")?" + //$NON-NLS-1$
"\\}|\\$"); // }|$ //$NON-NLS-1$
-
+
/**
* @since 3.3
*/
@@ -131,7 +131,7 @@ public class TemplateTranslator {
/**
* Returns an error message if an error occurred for the last translation, <code>null</code>
* otherwise.
- *
+ *
* @return the error message if an error occurred during the most recent translation,
* <code>null</code> otherwise
*/
@@ -142,7 +142,7 @@ public class TemplateTranslator {
/**
* Translates a template to a <code>TemplateBuffer</code>. <code>null</code> is returned if
* there was an error. <code>getErrorMessage()</code> retrieves the associated error message.
- *
+ *
* @param template the template to translate.
* @return returns the template buffer corresponding to the string
* @see #getErrorMessage()
@@ -156,7 +156,7 @@ public class TemplateTranslator {
* Translates a template string to <code>TemplateBuffer</code>. <code>null</code> is
* returned if there was an error. <code>getErrorMessage()</code> retrieves the associated
* error message.
- *
+ *
* @param string the string to translate.
* @return returns the template buffer corresponding to the string
* @see #getErrorMessage()
@@ -168,18 +168,18 @@ public class TemplateTranslator {
/**
* Internal parser.
- *
+ *
* @param string the string to parse
* @return the parsed <code>TemplateBuffer</code>
* @throws TemplateException if the string does not conform to the template format
*/
private TemplateBuffer parse(String string) throws TemplateException {
-
+
fErrorMessage= null;
final StringBuffer buffer= new StringBuffer(string.length());
final Matcher matcher= ESCAPE_PATTERN.matcher(string);
final Map variables= new LinkedHashMap();
-
+
int complete= 0;
while (matcher.find()) {
// append any verbatim text
@@ -197,9 +197,9 @@ public class TemplateTranslator {
String typeName= matcher.group(2);
String params= matcher.group(3);
TemplateVariableType type= createType(typeName, params);
-
+
updateOrCreateVariable(variables, name, type, buffer.length());
-
+
buffer.append(name);
}
complete= matcher.end();
@@ -242,7 +242,7 @@ public class TemplateTranslator {
* If there is no variable named <code>name</code>, a new variable with the given type, name
* and offset is created. If one exists, the offset is added to the variable and the type is
* merged with the existing type.
- *
+ *
* @param variables the variables by variable name
* @param name the name of the variable
* @param type the variable type, <code>null</code> for not defined
@@ -263,7 +263,7 @@ public class TemplateTranslator {
/**
* Creates proper {@link TemplateVariable}s from the variable descriptions.
- *
+ *
* @param variables the variable descriptions by variable name
* @return the corresponding variables
* @since 3.3
@@ -291,14 +291,14 @@ public class TemplateTranslator {
fCurrentType= null; // avoid dangling reference
return result;
}
-
+
/**
* Hook method to create new variables. Subclasses may override to supply their custom variable
* type.
* <p>
* Clients may replace this method.
* </p>
- *
+ *
* @param type the type of the new variable.
* @param name the name of the new variable.
* @param offsets the offsets where the variable occurs in the template
@@ -308,14 +308,14 @@ public class TemplateTranslator {
protected TemplateVariable createVariable(String type, String name, int[] offsets) {
return createVariable(fCurrentType, name, offsets);
}
-
+
/**
* Hook method to create new variables. Subclasses may override to supply their custom variable
* type.
* <p>
* Clients may replace this method.
* </p>
- *
+ *
* @param type the type of the new variable.
* @param name the name of the new variable.
* @param offsets the offsets where the variable occurs in the template
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateVariable.java b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateVariable.java
index 1a874162104..021d1b18d61 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateVariable.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateVariable.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.text.TextUtilities;
* <p>
* Clients may instantiate and extend this class.
* </p>
- *
+ *
* @see TemplateVariableResolver
* @see TemplateBuffer
* @since 3.0
@@ -86,7 +86,7 @@ public class TemplateVariable {
public TemplateVariable(TemplateVariableType type, String name, String defaultValue, int[] offsets) {
this(type, name, new String[] { defaultValue }, offsets);
}
-
+
/**
* Creates a template variable with multiple possible values. The type is
* used as the name of the template.
@@ -110,7 +110,7 @@ public class TemplateVariable {
public TemplateVariable(String type, String name, String[] values, int[] offsets) {
this(new TemplateVariableType(type), name, values, offsets);
}
-
+
/**
* Creates a template variable with multiple possible values.
*
@@ -150,7 +150,7 @@ public class TemplateVariable {
public TemplateVariableType getVariableType() {
return fType;
}
-
+
/**
* Returns the name of the variable.
*
@@ -173,7 +173,7 @@ public class TemplateVariable {
/**
* Returns the possible values for this variable. The returned array is owned by this variable
* and must not be modified. The array is not empty.
- *
+ *
* @return the possible values for this variable
*/
public String[] getValues() {
@@ -188,12 +188,12 @@ public class TemplateVariable {
public int getLength() {
return getDefaultValue().length();
}
-
+
/**
* Returns the initial length of the variable. The initial length is the lenght as it occurred
* in the template pattern and is used when resolving a template to update the pattern with the
* resolved values of the variable.
- *
+ *
* @return the initial length of the variable
* @since 3.3
*/
@@ -223,7 +223,7 @@ public class TemplateVariable {
/**
* Resolves the variable to a single value. This is a shortcut for
* <code>setValues(new String[] { value })</code>.
- *
+ *
* @param value the new default value
*/
public final void setValue(String value) {
@@ -233,7 +233,7 @@ public class TemplateVariable {
/**
* Resolves the variable to several possible values for this variable, with the first being the
* default value.
- *
+ *
* @param values a non-empty array of values
*/
public void setValues(String[] values) {
@@ -261,10 +261,10 @@ public class TemplateVariable {
public boolean isUnambiguous() {
return fIsUnambiguous;
}
-
+
/**
* Sets the <em>resolved</em> flag of the variable.
- *
+ *
* @param resolved the new <em>resolved</em> state
* @since 3.3
*/
@@ -275,7 +275,7 @@ public class TemplateVariable {
/**
* Returns <code>true</code> if the variable has been resolved, <code>false</code>
* otherwise.
- *
+ *
* @return <code>true</code> if the variable has been resolved, <code>false</code> otherwise
* @since 3.3
*/
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateVariableType.java b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateVariableType.java
index 268d8b1d95e..9d9b4ca5df5 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateVariableType.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/templates/TemplateVariableType.java
@@ -21,7 +21,7 @@ import org.eclipse.core.runtime.Assert;
/**
* Value object that represents the type of a template variable. A type is defined by its name and
* may have parameters.
- *
+ *
* @since 3.3
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@@ -45,7 +45,7 @@ public final class TemplateVariableType {
/**
* Returns the type name of this variable type.
- *
+ *
* @return the type name of this variable type
*/
public String getName() {
@@ -54,7 +54,7 @@ public final class TemplateVariableType {
/**
* Returns the unmodifiable and possibly empty list of parameters (element type: {@link String})
- *
+ *
* @return the list of parameters
*/
public List getParams() {
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/templates/TextTemplateMessages.java b/org.eclipse.text/src/org/eclipse/jface/text/templates/TextTemplateMessages.java
index 7e34525dfad..b35e82879ae 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/templates/TextTemplateMessages.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/templates/TextTemplateMessages.java
@@ -10,10 +10,11 @@
*******************************************************************************/
package org.eclipse.jface.text.templates;
-import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import com.ibm.icu.text.MessageFormat;
+
/*
* @since 3.0
*/
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java b/org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java
index fa271f70e1e..872256385c4 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/EditDocument.java
@@ -196,7 +196,7 @@ class EditDocument implements IDocument {
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 3.0 search is provided by {@link FindReplaceDocumentAdapter}
*/
public int search(int startOffset, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord) throws BadLocationException {
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java
index 98c8f534798..9498cdfc5da 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/MoveSourceEdit.java
@@ -375,7 +375,7 @@ public final class MoveSourceEdit extends TextEdit {
int end2= offset2 + length2 - 1;
if (end2 < offset1)
return null;
-
+
int end= Math.min(end1, end2);
if (offset1 < offset2) {
return new Region(offset2, end - offset2 + 1);
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java b/org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java
index b63e4bd0430..c304a12270f 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/TextEdit.java
@@ -478,7 +478,7 @@ public abstract class TextEdit {
/**
* Hook called before this edit gets added to the passed parent.
- *
+ *
* @param parent the parent text edit
*/
void aboutToBeAdded(TextEdit parent) {
@@ -525,7 +525,7 @@ public abstract class TextEdit {
/**
* Adds the string representation of this text edit without
* children information to the given string buffer.
- *
+ *
* @param buffer the string buffer
* @param indent the indent level in number of spaces
* @since 3.3
@@ -557,7 +557,7 @@ public abstract class TextEdit {
/**
* Adds the string representation for this text edit
* and its children to the given string buffer.
- *
+ *
* @param buffer the string buffer
* @param indent the indent level in number of spaces
* @since 3.3
@@ -572,7 +572,7 @@ public abstract class TextEdit {
}
}
}
-
+
//---- Copying -------------------------------------------------------------
/**
@@ -877,7 +877,7 @@ public abstract class TextEdit {
/**
* Performs the consistency check.
- *
+ *
* @param processor the text edit processor
* @param document the document to be manipulated
*/
@@ -886,7 +886,7 @@ public abstract class TextEdit {
/**
* Traverses the source computation.
- *
+ *
* @param processor the text edit processor
* @param document the document to be manipulated
*/
@@ -895,7 +895,7 @@ public abstract class TextEdit {
/**
* Performs the source computation.
- *
+ *
* @param processor the text edit processor
* @param document the document to be manipulated
*/
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/TextEditGroup.java b/org.eclipse.text/src/org/eclipse/text/edits/TextEditGroup.java
index b16280aea60..881accc8a13 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/TextEditGroup.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/TextEditGroup.java
@@ -98,7 +98,7 @@ public class TextEditGroup {
public void addTextEdit(TextEdit edit) {
fEdits.add(edit);
}
-
+
/**
* Removes the given {@link TextEdit} from this group.
*
@@ -119,7 +119,7 @@ public class TextEditGroup {
fEdits.clear();
}
-
+
/**
* Returns <code>true</code> if the list of managed
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/TextEditMessages.java b/org.eclipse.text/src/org/eclipse/text/edits/TextEditMessages.java
index 9d3b123ea33..624f98b9d6f 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/TextEditMessages.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/TextEditMessages.java
@@ -10,10 +10,11 @@
*******************************************************************************/
package org.eclipse.text.edits;
-import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import com.ibm.icu.text.MessageFormat;
+
class TextEditMessages {
private static final String BUNDLE_NAME= "org.eclipse.text.edits.Messages"; //$NON-NLS-1$
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/TextEditProcessor.java b/org.eclipse.text/src/org/eclipse/text/edits/TextEditProcessor.java
index 3bfb5c4b555..77e29af6a44 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/TextEditProcessor.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/TextEditProcessor.java
@@ -161,7 +161,7 @@ public class TextEditProcessor {
* <p>
* Note that this class isn't intended to be subclassed.
* </p>
- *
+ *
* @param edit the text edit
* @return <code>true</code> if this processor considers the given edit
*/
diff --git a/org.eclipse.text/src/org/eclipse/text/edits/UndoCollector.java b/org.eclipse.text/src/org/eclipse/text/edits/UndoCollector.java
index dbffd6c618d..94e45f2b207 100644
--- a/org.eclipse.text/src/org/eclipse/text/edits/UndoCollector.java
+++ b/org.eclipse.text/src/org/eclipse/text/edits/UndoCollector.java
@@ -23,7 +23,7 @@ class UndoCollector implements IDocumentListener {
protected UndoEdit undo;
private int fOffset;
private int fLength;
-
+
/**
* @since 3.1
*/
@@ -64,7 +64,7 @@ class UndoCollector implements IDocumentListener {
} catch (BadLocationException cannotHappen) {
Assert.isTrue(false, "Can't happen"); //$NON-NLS-1$
}
-
+
/*
* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=93634
* If the same string is replaced on many documents (e.g. rename
diff --git a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoEvent.java b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoEvent.java
index 641b064eed5..03a65de0573 100644
--- a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoEvent.java
+++ b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoEvent.java
@@ -20,7 +20,7 @@ import org.eclipse.jface.text.IDocument;
* <p>
* Clients are not supposed to subclass or create instances of this class.
* </p>
- *
+ *
* @see IDocumentUndoManager
* @see IDocumentUndoListener
* @since 3.2
@@ -77,7 +77,7 @@ public class DocumentUndoEvent {
/**
* Creates a new document event.
- *
+ *
* @param doc the changed document
* @param offset the offset of the replaced text
* @param text the substitution text
@@ -100,7 +100,7 @@ public class DocumentUndoEvent {
/**
* Returns the changed document.
- *
+ *
* @return the changed document
*/
public IDocument getDocument() {
@@ -109,7 +109,7 @@ public class DocumentUndoEvent {
/**
* Returns the offset of the change.
- *
+ *
* @return the offset of the change
*/
public int getOffset() {
@@ -118,7 +118,7 @@ public class DocumentUndoEvent {
/**
* Returns the text that has been inserted.
- *
+ *
* @return the text that has been inserted
*/
public String getText() {
@@ -127,7 +127,7 @@ public class DocumentUndoEvent {
/**
* Returns the text that has been replaced.
- *
+ *
* @return the text that has been replaced
*/
public String getPreservedText() {
@@ -136,7 +136,7 @@ public class DocumentUndoEvent {
/**
* Returns the type of event that is occurring.
- *
+ *
* @return the bit mask that indicates the type (or types) of the event
*/
public int getEventType() {
@@ -145,7 +145,7 @@ public class DocumentUndoEvent {
/**
* Returns the source that triggered this event.
- *
+ *
* @return the source that triggered this event.
*/
public Object getSource() {
@@ -154,7 +154,7 @@ public class DocumentUndoEvent {
/**
* Returns whether the change was a compound change or not.
- *
+ *
* @return <code>true</code> if the undo or redo change is a
* compound change, <code>false</code> if it is not
*/
diff --git a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java
index dd14f412a65..b28b7d1bc75 100644
--- a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java
+++ b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java
@@ -53,7 +53,7 @@ import org.eclipse.jface.text.TextUtilities;
* <p>
* This class is not intended to be subclassed.
* </p>
- *
+ *
* @see IDocumentUndoManager
* @see DocumentUndoManagerRegistry
* @see IDocumentUndoListener
@@ -62,8 +62,8 @@ import org.eclipse.jface.text.TextUtilities;
* @noextend This class is not intended to be subclassed by clients.
*/
public class DocumentUndoManager implements IDocumentUndoManager {
-
-
+
+
/**
* Represents an undo-able text change, described as the
* replacement of some preserved text with new text.
@@ -96,7 +96,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Creates a new text change.
- *
+ *
* @param manager the undo manager for this change
*/
UndoableTextChange(DocumentUndoManager manager) {
@@ -117,7 +117,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Sets the start and the end index of this change.
- *
+ *
* @param start the start index
* @param end the end index
*/
@@ -285,7 +285,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Re-applies the change described by this change that was previously
* undone. Also notifies clients about the redo.
- *
+ *
* @param monitor the progress monitor to use if necessary
* @param uiInfo an adaptable that can provide UI info if needed
* @return the status
@@ -315,7 +315,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Creates a new uncommitted text change depending on whether a compound
* change is currently being executed.
- *
+ *
* @return a new, uncommitted text change or a compound text change
*/
protected UndoableTextChange createCurrent() {
@@ -355,7 +355,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Attempt a commit of this change and answer true if a new fCurrent was
* created as a result of the commit.
- *
+ *
* @return <code>true</code> if the change was committed and created
* a new <code>fCurrent</code>, <code>false</code> if not
*/
@@ -370,7 +370,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Checks whether this text change is valid for undo or redo.
- *
+ *
* @return <code>true</code> if the change is valid for undo or redo
*/
protected boolean isValid() {
@@ -407,7 +407,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Return the undo modification stamp
- *
+ *
* @return the undo modification stamp for this change
*/
protected long getUndoModificationStamp() {
@@ -416,15 +416,15 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Return the redo modification stamp
- *
+ *
* @return the redo modification stamp for this change
*/
protected long getRedoModificationStamp() {
return fRedoModificationStamp;
}
}
-
-
+
+
/**
* Represents an undo-able text change consisting of several individual
* changes.
@@ -436,7 +436,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Creates a new compound text change.
- *
+ *
* @param manager the undo manager for this change
*/
UndoableCompoundTextChange(DocumentUndoManager manager) {
@@ -445,7 +445,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Adds a new individual change to this compound change.
- *
+ *
* @param change the change to be added
*/
protected void add(UndoableTextChange change) {
@@ -541,7 +541,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
fDocumentUndoManager.fCurrent= createCurrent();
fDocumentUndoManager.resetProcessChangeState();
}
-
+
/*
* @see org.eclipse.text.undo.UndoableTextChange#isValid()
*/
@@ -575,7 +575,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
return fRedoModificationStamp;
}
}
-
+
/**
* Internal listener to document changes.
@@ -643,7 +643,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
* @see IOperationHistoryListener
*/
private class HistoryListener implements IOperationHistoryListener {
-
+
private IUndoableOperation fOperation;
public void historyNotification(final OperationHistoryEvent event) {
@@ -770,9 +770,9 @@ public class DocumentUndoManager implements IDocumentUndoManager {
private List fConnected;
/**
- *
+ *
* Create a DocumentUndoManager for the given document.
- *
+ *
* @param document the document whose undo history is being managed.
*/
public DocumentUndoManager(IDocument document) {
@@ -820,7 +820,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
}
fCurrent.commit();
}
-
+
/*
* @see org.eclipse.text.undo.IDocumentUndoManager#reset()
*/
@@ -912,7 +912,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Fires a document undo event to all registered document undo listeners.
* Uses a robust iterator.
- *
+ *
* @param offset the document offset
* @param text the text that was inserted
* @param preservedText the text being replaced
@@ -951,7 +951,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Adds the given text edit to the operation history if it is not part of a compound change.
- *
+ *
* @param edit the edit to be added
*/
private void addToOperationHistory(UndoableTextChange edit) {
@@ -981,7 +981,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Checks whether the given text starts with a line delimiter and
* subsequently contains a white space only.
- *
+ *
* @param text the text to check
* @return <code>true</code> if the text is a line delimiter followed by
* whitespace, <code>false</code> otherwise
@@ -1009,7 +1009,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* 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) {
@@ -1199,10 +1199,10 @@ public class DocumentUndoManager implements IDocumentUndoManager {
addListeners();
}
-
+
/**
* Reset processChange state.
- *
+ *
* @since 3.2
*/
private void resetProcessChangeState() {
@@ -1227,7 +1227,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
/**
* Return whether or not any clients are connected to the receiver.
- *
+ *
* @return <code>true</code> if the receiver is connected to
* clients, <code>false</code> if it is not
*/
@@ -1258,11 +1258,11 @@ public class DocumentUndoManager implements IDocumentUndoManager {
((UndoableTextChange)op).fDocumentUndoManager= this;
}
}
-
+
IUndoableOperation op= OperationHistoryFactory.getOperationHistory().getUndoOperation(getUndoContext());
if (op != null && !(op instanceof UndoableTextChange))
return;
-
+
// Record the transfer itself as an undoable change.
// If the transfer results from some open operation, recording this change will
// cause our undo context to be added to the outer operation. If there is no
@@ -1279,5 +1279,5 @@ public class DocumentUndoManager implements IDocumentUndoManager {
addToOperationHistory(cmd);
}
-
+
}
diff --git a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManagerRegistry.java b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManagerRegistry.java
index 3168f66a21a..5a1cf42cc36 100644
--- a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManagerRegistry.java
+++ b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManagerRegistry.java
@@ -34,7 +34,7 @@ import org.eclipse.jface.text.IDocument;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public final class DocumentUndoManagerRegistry {
-
+
private static final class Record {
public Record(IDocument document) {
count= 0;
@@ -43,14 +43,14 @@ public final class DocumentUndoManagerRegistry {
private int count;
private IDocumentUndoManager undoManager;
}
-
+
private static Map fgFactory= new HashMap();
-
+
private DocumentUndoManagerRegistry() {
- // Do not instantiate
+ // Do not instantiate
}
-
+
/**
* Connects the file at the given location to this manager. After that call
* successfully completed it is guaranteed that each call to <code>getFileBuffer</code>
@@ -81,7 +81,7 @@ public final class DocumentUndoManagerRegistry {
record.count--;
if (record.count == 0)
fgFactory.remove(document);
-
+
}
/**
diff --git a/org.eclipse.text/src/org/eclipse/text/undo/IDocumentUndoListener.java b/org.eclipse.text/src/org/eclipse/text/undo/IDocumentUndoListener.java
index aecf1b4e783..2c332eeafda 100644
--- a/org.eclipse.text/src/org/eclipse/text/undo/IDocumentUndoListener.java
+++ b/org.eclipse.text/src/org/eclipse/text/undo/IDocumentUndoListener.java
@@ -22,15 +22,15 @@ package org.eclipse.text.undo;
* <p>
* Clients may implement this interface.
* </p>
- *
+ *
* @since 3.2
*/
public interface IDocumentUndoListener {
-
+
/**
- * The document is involved in an undo-related change. Notify listeners
+ * The document is involved in an undo-related change. Notify listeners
* with an event describing the change.
- *
+ *
* @param event the document undo event that describes the particular notification
*/
void documentUndoNotification(DocumentUndoEvent event);
diff --git a/org.eclipse.text/src/org/eclipse/text/undo/IDocumentUndoManager.java b/org.eclipse.text/src/org/eclipse/text/undo/IDocumentUndoManager.java
index 09356cc32e8..a45214a6f5b 100644
--- a/org.eclipse.text/src/org/eclipse/text/undo/IDocumentUndoManager.java
+++ b/org.eclipse.text/src/org/eclipse/text/undo/IDocumentUndoManager.java
@@ -30,7 +30,7 @@ import org.eclipse.core.commands.operations.IUndoContext;
* <p>
* Clients may implement this interface.
* </p>
- *
+ *
* @see DocumentUndoManagerRegistry
* @see IDocumentUndoListener
* @see org.eclipse.jface.text.IDocument
@@ -52,7 +52,7 @@ public interface IDocumentUndoManager {
* background thread. Any UI access occurring inside the implementation must
* be properly synchronized using the techniques specified by the client's
* widget library.</p>
- *
+ *
* @param listener the document undo listener to be added as a listener
*/
void addDocumentUndoListener(IDocumentUndoListener listener);
@@ -62,14 +62,14 @@ public interface IDocumentUndoManager {
* <p>
* Removing a listener which is not registered has no effect
* </p>
- *
+ *
* @param listener the document undo listener to be removed
*/
void removeDocumentUndoListener(IDocumentUndoListener listener);
/**
* Returns the undo context registered for this document
- *
+ *
* @return the undo context registered for this document
*/
IUndoContext getUndoContext();
@@ -83,7 +83,7 @@ public interface IDocumentUndoManager {
* Connects to the undo manager. Used to signify that a client is monitoring
* the history kept by the undo manager. This message has no effect if the
* client is already connected.
- *
+ *
* @param client the object connecting to the undo manager
*/
void connect(Object client);
@@ -93,7 +93,7 @@ public interface IDocumentUndoManager {
* longer monitoring the history kept by the undo manager. If all clients
* have disconnected from the undo manager, the undo history will be
* deleted.
- *
+ *
* @param client the object disconnecting from the undo manager
*/
void disconnect(Object client);
@@ -114,11 +114,11 @@ public interface IDocumentUndoManager {
/**
* Sets the limit of the undo history to the specified value. The provided
* limit will supersede any previously set limit.
- *
+ *
* @param undoLimit the length of this undo manager's history
*/
void setMaximalUndoLevel(int undoLimit);
-
+
/**
* Resets the history of the undo manager. After that call,
* there aren't any undo-able or redo-able text changes.
@@ -142,27 +142,27 @@ public interface IDocumentUndoManager {
/**
* Rolls back the most recently executed text change.
- *
+ *
* @throws ExecutionException if an exception occurred during undo
*/
void undo() throws ExecutionException;
/**
* Repeats the most recently rolled back text change.
- *
+ *
* @throws ExecutionException if an exception occurred during redo
*/
void redo() throws ExecutionException;
/**
* Transfers the undo history from the specified document undo manager to
- * this undo manager. This message should only be used when it is known
+ * this undo manager. This message should only be used when it is known
* that the content of the document of the original undo manager when the
- * last undo operation was recorded is the same as this undo manager's
+ * last undo operation was recorded is the same as this undo manager's
* current document content, since the undo history is based on document
- * indexes. It is the responsibility of the caller
- * to ensure that this call is used correctly.
- *
+ * indexes. It is the responsibility of the caller
+ * to ensure that this call is used correctly.
+ *
* @param manager the document undo manger whose history is to be transferred to the receiver
*/
public void transferUndoHistory(IDocumentUndoManager manager);
diff --git a/org.eclipse.text/src/org/eclipse/text/undo/UndoMessages.java b/org.eclipse.text/src/org/eclipse/text/undo/UndoMessages.java
index c9388d604b2..0a5fa822219 100644
--- a/org.eclipse.text/src/org/eclipse/text/undo/UndoMessages.java
+++ b/org.eclipse.text/src/org/eclipse/text/undo/UndoMessages.java
@@ -10,10 +10,11 @@
*******************************************************************************/
package org.eclipse.text.undo;
-import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import com.ibm.icu.text.MessageFormat;
+
/**
* Helper class to get NLSed messages.
*
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/ChainedPreferenceStoreTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/ChainedPreferenceStoreTest.java
index a484c9b254e..62efc825156 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/ChainedPreferenceStoreTest.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/ChainedPreferenceStoreTest.java
@@ -36,7 +36,7 @@ public class ChainedPreferenceStoreTest extends TestCase {
private List fEvents= new ArrayList();
private PropertyChangeListener fPropertyChangeListener= new PropertyChangeListener();
-
+
private static final String PROPERTY= "some.property";
private static final String VALUE= "8";
private static final String DEFAULT_VALUE= "4";
@@ -45,7 +45,7 @@ public class ChainedPreferenceStoreTest extends TestCase {
public static Test suite() {
return new TestSuite(ChainedPreferenceStoreTest.class);
}
-
+
/**
* [implementation] ChainedPreferenceStore
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=69419
@@ -55,11 +55,11 @@ public class ChainedPreferenceStoreTest extends TestCase {
IPreferenceStore store2= new PreferenceStore();
IPreferenceStore chainedStore= new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
store2.setDefault(PROPERTY, DEFAULT_VALUE);
-
+
chainedStore.addPropertyChangeListener(fPropertyChangeListener);
store1.firePropertyChangeEvent(PROPERTY, VALUE, DEFAULT_DEFAULT_VALUE); // simulated removal with newValue != null
chainedStore.removePropertyChangeListener(fPropertyChangeListener);
-
+
assertEquals(1, fEvents.size());
PropertyChangeEvent event= (PropertyChangeEvent) fEvents.get(0);
assertEquals(chainedStore, event.getSource());
@@ -67,7 +67,7 @@ public class ChainedPreferenceStoreTest extends TestCase {
assertEquals(VALUE, event.getOldValue());
assertEquals(DEFAULT_VALUE, event.getNewValue());
}
-
+
/**
* Assertion failed in ChainedPreferenceStore.handlePropertyChangeEvent(..)
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=52827
@@ -76,11 +76,11 @@ public class ChainedPreferenceStoreTest extends TestCase {
IPreferenceStore store1= new PreferenceStore();
IPreferenceStore store2= new PreferenceStore();
IPreferenceStore chainedStore= new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
-
+
chainedStore.addPropertyChangeListener(fPropertyChangeListener);
store1.firePropertyChangeEvent(PROPERTY, VALUE, DEFAULT_DEFAULT_VALUE); // simulated removal with newValue != null
chainedStore.removePropertyChangeListener(fPropertyChangeListener);
-
+
assertEquals(1, fEvents.size());
PropertyChangeEvent event= (PropertyChangeEvent) fEvents.get(0);
assertEquals(store1, event.getSource());
@@ -97,11 +97,11 @@ public class ChainedPreferenceStoreTest extends TestCase {
IPreferenceStore store2= new PreferenceStore();
IPreferenceStore chainedStore= new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
store1.setValue(PROPERTY, VALUE);
-
+
chainedStore.addPropertyChangeListener(fPropertyChangeListener);
store1.firePropertyChangeEvent(PROPERTY, DEFAULT_VALUE, null); // simulated change with newValue == null
chainedStore.removePropertyChangeListener(fPropertyChangeListener);
-
+
assertEquals(1, fEvents.size());
PropertyChangeEvent event= (PropertyChangeEvent) fEvents.get(0);
assertEquals(store1, event.getSource());
@@ -118,11 +118,11 @@ public class ChainedPreferenceStoreTest extends TestCase {
IPreferenceStore store2= new PreferenceStore();
IPreferenceStore chainedStore= new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
store2.setDefault(PROPERTY, DEFAULT_VALUE);
-
+
chainedStore.addPropertyChangeListener(fPropertyChangeListener);
store1.firePropertyChangeEvent(PROPERTY, null, null); // simulated removal with oldValue == null
chainedStore.removePropertyChangeListener(fPropertyChangeListener);
-
+
assertEquals(1, fEvents.size());
PropertyChangeEvent event= (PropertyChangeEvent) fEvents.get(0);
assertEquals(chainedStore, event.getSource());
@@ -130,7 +130,7 @@ public class ChainedPreferenceStoreTest extends TestCase {
assertEquals(null, event.getOldValue());
assertEquals(DEFAULT_VALUE, event.getNewValue());
}
-
+
// /**
// * Case where the old value cannot be determined. (Not handled by the current implementation.)
// */
@@ -139,11 +139,11 @@ public class ChainedPreferenceStoreTest extends TestCase {
// IPreferenceStore store2= new PreferenceStore();
// IPreferenceStore chainedStore= new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
// store2.setDefault(PROPERTY, DEFAULT_VALUE);
-//
+//
// chainedStore.addPropertyChangeListener(fPropertyChangeListener);
// store1.setValue(PROPERTY, VALUE);
// chainedStore.removePropertyChangeListener(fPropertyChangeListener);
-//
+//
// assertEquals(1, fEvents.size());
// PropertyChangeEvent event= (PropertyChangeEvent) fEvents.get(0);
// assertEquals(PROPERTY, event.getProperty());
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EditorsTestSuite.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EditorsTestSuite.java
index 9aeed58a696..f0c3b73046c 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EditorsTestSuite.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EditorsTestSuite.java
@@ -15,7 +15,7 @@ import junit.framework.TestSuite;
/**
* Test Suite for org.eclipse.ui.editors.
- *
+ *
* @since 3.0
*/
public class EditorsTestSuite extends TestSuite {
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EncodingChangeTests.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EncodingChangeTests.java
index 33a534676b9..70d13ddf986 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EncodingChangeTests.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EncodingChangeTests.java
@@ -48,29 +48,29 @@ import org.eclipse.ui.editors.text.TextEditor;
/**
* Tests changing of encoding via IFile and via encoding support.
- *
+ *
* @since 3.1
*/
public class EncodingChangeTests extends TestCase {
-
+
private static final String ORIGINAL_CONTENT= "line1\nline2\nline3";
-
+
public static Test suite() {
return new TestSuite(EncodingChangeTests.class);
}
-
+
public static void closeEditor(IEditorPart editor) {
IWorkbenchPartSite site;
IWorkbenchPage page;
if (editor != null && (site= editor.getSite()) != null && (page= site.getPage()) != null)
page.closeEditor(editor, false);
}
-
-
+
+
private IFile fFile;
private IEditorPart fEditor;
private int fCount;
-
+
private String getOriginalContent() {
return ORIGINAL_CONTENT;
}
@@ -84,7 +84,7 @@ public class EncodingChangeTests extends TestCase {
fFile.setCharset(null, null);
fCount++;
}
-
+
/*
* @see junit.framework.TestCase#tearDown()
*/
@@ -94,7 +94,7 @@ public class EncodingChangeTests extends TestCase {
fFile= null;
ResourceHelper.deleteProject("EncodingChangeTestProject");
}
-
+
public void testChangeEncodingViaFile() {
IWorkbench workbench= PlatformUI.getWorkbench();
IWorkbenchPage page= workbench.getActiveWorkbenchWindow().getActivePage();
@@ -114,14 +114,14 @@ public class EncodingChangeTests extends TestCase {
assertNull(composite);
DefaultEncodingSupport encodingSupport= (DefaultEncodingSupport)editor.getAdapter(IEncodingSupport.class);
assertEquals("US-ASCII", encodingSupport.getEncoding());
-
+
} else
fail();
} catch (PartInitException e) {
fail();
}
}
-
+
public void testChangeEncodingViaEncodingSupport() {
IWorkbench workbench= PlatformUI.getWorkbench();
IWorkbenchPage page= workbench.getActiveWorkbenchWindow().getActivePage();
@@ -151,7 +151,7 @@ public class EncodingChangeTests extends TestCase {
fail();
}
}
-
+
public void testAInvalidEncoding() {
IWorkbench workbench= PlatformUI.getWorkbench();
IWorkbenchPage page= workbench.getActiveWorkbenchWindow().getActivePage();
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/GotoLineTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/GotoLineTest.java
index fe4b08c0148..832fa54cb3d 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/GotoLineTest.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/GotoLineTest.java
@@ -35,25 +35,26 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
+
import org.eclipse.ui.texteditor.GotoLineAction;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
/**
* Tests the GotoLineAction.
- *
+ *
* @since 3.1
*/
public class GotoLineTest extends TestCase {
-
- private static final String ORIGINAL_CONTENT= "line1\nline2\nline3";
-
+
+ private static final String ORIGINAL_CONTENT= "line1\nline2\nline3";
+
public static Test suite() {
return new TestSuite(GotoLineTest.class);
}
-
+
private IFile fFile;
-
+
private String getOriginalContent() {
return ORIGINAL_CONTENT;
}
@@ -65,7 +66,7 @@ public class GotoLineTest extends TestCase {
IFolder folder= ResourceHelper.createFolder("GoToLineTestProject/goToLineTests/");
fFile= ResourceHelper.createFile(folder, "file.txt", getOriginalContent());
}
-
+
/*
* @see junit.framework.TestCase#tearDown()
*/
@@ -73,27 +74,27 @@ public class GotoLineTest extends TestCase {
ResourceHelper.deleteProject("GoToLineTestProject");
fFile= null;
}
-
+
public void testGoToFirstLine() {
goToLine(0, 0);
}
-
+
public void testGoToLastLine() {
goToLine(2, 2);
}
-
+
public void testGoToInvalidLine() {
goToLine(1, 1);
goToLine(-1, 1);
goToLine(3, 1);
}
-
+
private void goToLine(int line, int expectedResult) {
IWorkbench workbench= PlatformUI.getWorkbench();
IWorkbenchPage page= workbench.getActiveWorkbenchWindow().getActivePage();
try {
IEditorPart part= IDE.openEditor(page, fFile);
-
+
if (part instanceof ITextEditor) {
ITextEditor editor= (ITextEditor) part;
IAction action= editor.getAction(ITextEditorActionConstants.GOTO_LINE);
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/SegmentedModeTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/SegmentedModeTest.java
index 6fa7e992fca..aaddbf1866e 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/SegmentedModeTest.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/SegmentedModeTest.java
@@ -30,19 +30,20 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
+
import org.eclipse.ui.texteditor.ITextEditor;
public class SegmentedModeTest extends TestCase {
-
- private static final String ORIGINAL_CONTENT= "this\nis\nthe\ncontent\nof\nthe\nfile";
-
+
+ private static final String ORIGINAL_CONTENT= "this\nis\nthe\ncontent\nof\nthe\nfile";
+
public static Test suite() {
return new TestSuite(SegmentedModeTest.class);
}
-
+
private IFile fFile;
-
+
private String getOriginalContent() {
return ORIGINAL_CONTENT;
}
@@ -54,14 +55,14 @@ public class SegmentedModeTest extends TestCase {
IFolder folder= ResourceHelper.createFolder("project/folderA/folderB/");
fFile= ResourceHelper.createFile(folder, "file.txt", getOriginalContent());
}
-
+
/*
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
ResourceHelper.deleteProject("project");
}
-
+
/*
* @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=70934
*/
@@ -70,20 +71,20 @@ public class SegmentedModeTest extends TestCase {
IWorkbenchPage page= workbench.getActiveWorkbenchWindow().getActivePage();
try {
IEditorPart part= IDE.openEditor(page, fFile);
-
+
try {
if (part instanceof ITextEditor) {
ITextEditor editor= (ITextEditor) part;
-
+
editor.showHighlightRangeOnly(true);
editor.setHighlightRange(5, 0, true);
-
+
Control control= (Control) part.getAdapter(Control.class);
if (control instanceof StyledText) {
StyledText styledText= (StyledText) control;
int caret= styledText.getCaretOffset();
styledText.replaceTextRange(caret, 0, "really ");
-
+
StringBuffer buffer= new StringBuffer(getOriginalContent());
buffer.insert(5, "really ");
IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput());
@@ -93,7 +94,7 @@ public class SegmentedModeTest extends TestCase {
} finally {
page.saveEditor(part, false);
}
-
+
} catch (PartInitException e) {
assertTrue(false);
}
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
index 52313cb7e35..504b243716a 100644
--- 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
@@ -36,6 +36,7 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.editors.text.NLSUtility;
+
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.texteditor.StatusTextEditor;
@@ -305,7 +306,7 @@ public class DefaultEncodingSupport implements IEncodingSupport {
/**
* Returns the shell of the active workbench window.
- *
+ *
* @return the shell of the active workbench window or <code>null</code> if none
* @since 3.2
*/
@@ -313,7 +314,7 @@ public class DefaultEncodingSupport implements IEncodingSupport {
IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null)
return window.getShell();
-
+
return null;
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EditorsUI.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EditorsUI.java
index 11d1984577a..db55e0eb9e3 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EditorsUI.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EditorsUI.java
@@ -27,6 +27,7 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
import org.eclipse.ui.internal.editors.text.NLSUtility;
import org.eclipse.ui.keys.IBindingService;
+
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.AnnotationPreferenceLookup;
import org.eclipse.ui.texteditor.AnnotationTypeLookup;
@@ -180,7 +181,7 @@ public final class EditorsUI {
* Returns the registry that contains the hyperlink detectors contributed
* by the <code>org.eclipse.ui.workbench.texteditor.hyperlinkDetectors</code>
* extension point.
- *
+ *
* @return the hyperlink detector registry
* @since 3.3
*/
@@ -189,8 +190,8 @@ public final class EditorsUI {
}
// --------------- Status codes for this plug-in ---------------
-
- // NOTE: See also IEditorsStatusConstants
+
+ // NOTE: See also IEditorsStatusConstants
/**
* Editor UI plug-in status code indicating that an operation failed
@@ -198,7 +199,7 @@ public final class EditorsUI {
* charset.
* <p>
* Value: {@value}</p>
- *
+ *
* @see UnmappableCharacterException
* @since 3.2
*/
@@ -209,7 +210,7 @@ public final class EditorsUI {
* validation failed.
* <p>
* Value: {@value}</p>
- *
+ *
* @see IFileBuffer#validateState(org.eclipse.core.runtime.IProgressMonitor, Object)
* @since 3.3
*/
@@ -220,12 +221,12 @@ public final class EditorsUI {
* a resource is marked derived.
* <p>
* Value: {@value}</p>
- *
+ *
* @see IResource#isDerived()
* @since 3.3
*/
public static final int DERIVED_FILE= IFileBufferStatusCodes.DERIVED_FILE;
-
+
/**
* Returns the tool tip affordance string.
*
@@ -237,7 +238,7 @@ public final class EditorsUI {
public static final String getTooltipAffordanceString() {
if (!getPreferenceStore().getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE))
return null;
-
+
IBindingService bindingService= (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class);
if (bindingService == null)
return null;
@@ -245,7 +246,7 @@ public final class EditorsUI {
String keySequence= bindingService.getBestActiveBindingFormattedFor(ITextEditorActionDefinitionIds.SHOW_INFORMATION);
if (keySequence == null)
return ""; //$NON-NLS-1$
-
+
return NLSUtility.format(TextEditorMessages.Editor_toolTip_affordance, keySequence);
}
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
index e8efe7f4a66..63d61d94a4a 100644
--- 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
@@ -15,10 +15,11 @@ import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.core.resources.IFile;
+
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -34,6 +35,7 @@ import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.internal.editors.text.NLSUtility;
+
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.IUpdate;
import org.eclipse.ui.texteditor.ResourceAction;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationAction.java
index 3094f66fa02..a6dc509b8ee 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationAction.java
@@ -105,7 +105,7 @@ public class FileBufferOperationAction extends Action implements IWorkbenchWindo
}
}
}
-
+
if (selection instanceof ITextSelection) {
IWorkbenchWindow window= getWorkbenchWindow();
if (window != null) {
@@ -222,7 +222,7 @@ public class FileBufferOperationAction extends Action implements IWorkbenchWindo
/**
* Tells whether this action accepts the given location.
- *
+ *
* @param location the location
* @return <code>true</code> if the given location is acceptable
*/
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationHandler.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationHandler.java
index 88b0adc5ff7..2fdd1a36a5d 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationHandler.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileBufferOperationHandler.java
@@ -65,7 +65,7 @@ public class FileBufferOperationHandler extends AbstractHandler {
/**
* Creates a new file buffer operation handler.
- *
+ *
* @param fileBufferOperation the file buffer operation
*/
public FileBufferOperationHandler(IFileBufferOperation fileBufferOperation) {
@@ -142,7 +142,7 @@ public class FileBufferOperationHandler extends AbstractHandler {
/**
* Returns the selection of the active workbench window.
- *
+ *
* @return the current selection in the active workbench window or <code>null</code>
*/
protected final ISelection getSelection() {
@@ -154,7 +154,7 @@ public class FileBufferOperationHandler extends AbstractHandler {
/**
* Returns the active workbench window.
- *
+ *
* @return the active workbench window or <code>null</code> if not available
*/
protected final IWorkbenchWindow getWorkbenchWindow() {
@@ -165,7 +165,7 @@ public class FileBufferOperationHandler extends AbstractHandler {
/**
* Collects the files out of the given resources.
- *
+ *
* @param resources the resources from which to get the files
* @return an array of files
*/
@@ -181,7 +181,7 @@ public class FileBufferOperationHandler extends AbstractHandler {
/**
* Runs the given operation.
- *
+ *
* @param files the file on which to run this operation
* @param location the file buffer location
* @param fileBufferOperation the operation to run
@@ -227,7 +227,7 @@ public class FileBufferOperationHandler extends AbstractHandler {
/**
* Returns the shell of the active workbench window.
- *
+ *
* @return the shell
*/
protected final Shell getShell() {
@@ -237,7 +237,7 @@ public class FileBufferOperationHandler extends AbstractHandler {
/**
* Generates the file buffer locations out of the given files.
- *
+ *
* @param files an array of files
* @param progressMonitor the progress monitor
* @return an array with the generated locations
@@ -261,7 +261,7 @@ public class FileBufferOperationHandler extends AbstractHandler {
/**
* Tells whether the given location is accepted by this handler.
- *
+ *
* @param location a file buffer location
* @return <code>true</code> if the given location is acceptable
*/
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
index a0d3732052a..568fe753d73 100644
--- 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
@@ -738,7 +738,7 @@ public class FileDocumentProvider extends StorageDocumentProvider {
s= x.getStatus();
d= createEmptyDocument();
}
-
+
// Set the initial line delimiter
if (d instanceof IDocumentExtension4) {
String initalLineDelimiter= getLineDelimiterPreference(input.getFile());
@@ -769,10 +769,10 @@ public class FileDocumentProvider extends StorageDocumentProvider {
return super.createElementInfo(element);
}
-
+
/**
* Returns the default line delimiter preference for the given file.
- *
+ *
* @param file the file
* @return the default line delimiter
* @since 3.1
@@ -923,7 +923,7 @@ public class FileDocumentProvider extends StorageDocumentProvider {
super.doValidateState(element, computationContext);
}
-
+
/*
*
* @see IResource#isDerived()
@@ -976,7 +976,7 @@ public class FileDocumentProvider extends StorageDocumentProvider {
/**
* Refreshes the given file resource.
- *
+ *
* @param file the file
* @throws CoreException if the refresh fails
* @since 2.1
@@ -1237,7 +1237,7 @@ public class FileDocumentProvider extends StorageDocumentProvider {
}
}
}
-
+
/**
* Computes the scheduling rule needed to create or modify a resource. If
* the resource exists, its modify rule is returned. If it does not, the
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IFoldingCommandIds.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IFoldingCommandIds.java
index f5bbb0d7c30..aa0d7a43e03 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IFoldingCommandIds.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/IFoldingCommandIds.java
@@ -18,7 +18,7 @@ package org.eclipse.ui.editors.text;
* This interface contains constants only; it is not intended to be
* implemented.
* </p>
- *
+ *
* @since 3.0
* @noimplement This interface is not intended to be implemented by clients.
*/
@@ -56,16 +56,16 @@ public interface IFoldingCommandIds {
* Identifier of the "collapse all folded regions" command.
* <p>
* Value: {@value}.</p>
- *
+ *
* @since 3.2
*/
String FOLDING_COLLAPSE_ALL = "org.eclipse.ui.edit.text.folding.collapse_all"; //$NON-NLS-1$
-
+
/**
* Identifier of the "restore folding structure" command.
* <p>
* Value: {@value}.</p>
- *
+ *
* @since 3.2
*/
String FOLDING_RESTORE= "org.eclipse.ui.edit.text.folding.restore"; //$NON-NLS-1$
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
index 2c539821609..717ff9726c5 100644
--- 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
@@ -11,6 +11,7 @@
package org.eclipse.ui.editors.text;
import org.eclipse.ui.ide.IDEActionFactory;
+
import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
@@ -28,7 +29,7 @@ public interface ITextEditorHelpContextIds extends IAbstractTextEditorHelpContex
* 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$
-
+
/**
* Help context id for the Spelling preference page.
* Value: <code>"org.eclipse.ui.spelling_preference_page_context"</code>.
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
index 95fa44aee99..f3773df519d 100644
--- 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
@@ -46,6 +46,7 @@ import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
import org.eclipse.ui.internal.editors.text.NLSUtility;
+
import org.eclipse.ui.texteditor.AbstractDocumentProvider;
@@ -348,13 +349,13 @@ public class StorageDocumentProvider extends AbstractDocumentProvider implements
* @since 3.2
*/
public boolean isNotSynchronizedException(Object element, CoreException ex) {
- IStatus status= ex.getStatus();
+ IStatus status= ex.getStatus();
if (status == null || status instanceof MultiStatus)
return false;
-
+
if (status.getException() != null)
return false;
-
+
return status.getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL;
}
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
index cd940c39628..83638b3e4d5 100644
--- 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
@@ -21,6 +21,7 @@ import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.ISourceViewerExtension2;
import org.eclipse.ui.IEditorInput;
+
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.texteditor.IUpdate;
@@ -186,7 +187,7 @@ public class TextEditor extends AbstractDecoratedTextEditor {
if (fEncodingSupport != null)
fEncodingSupport.reset();
}
-
+
/*
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent)
* @since 3.3
@@ -194,21 +195,21 @@ public class TextEditor extends AbstractDecoratedTextEditor {
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
ISourceViewer viewer= getSourceViewer();
-
+
if (!(viewer instanceof ISourceViewerExtension2))
return; // cannot unconfigure - do nothing
// XXX: this is pretty heavy-weight
((ISourceViewerExtension2)viewer).unconfigure();
viewer.configure(getSourceViewerConfiguration());
-
+
if (Boolean.FALSE.equals(event.getNewValue()))
SpellingProblem.removeAll(getSourceViewer(), null);
-
+
IAction quickAssistAction= getAction(ITextEditorActionConstants.QUICK_ASSIST);
if (quickAssistAction instanceof IUpdate)
((IUpdate)quickAssistAction).update();
-
+
return;
}
super.handlePreferenceStoreChanged(event);
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
index 35ef3949b79..e7a10780329 100644
--- 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
@@ -19,6 +19,7 @@ import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.ide.IDEActionFactory;
+
import org.eclipse.ui.texteditor.BasicTextEditorActionContributor;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
@@ -56,7 +57,7 @@ public class TextEditorActionContributor extends BasicTextEditorActionContributo
* @since 3.3
*/
private IContributionItem fQuickAssistMenuEntry;
-
+
private RetargetTextEditorAction fRetargetShowInformationAction;
/**
@@ -67,7 +68,7 @@ public class TextEditorActionContributor extends BasicTextEditorActionContributo
fQuickAssistAction= new RetargetTextEditorAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.QuickAssist."); //$NON-NLS-1$
fQuickAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST);
fQuickAssistMenuEntry= new ActionContributionItem(fQuickAssistAction);
-
+
fRetargetShowInformationAction= new RetargetTextEditorAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ShowInformation."); //$NON-NLS-1$
fRetargetShowInformationAction.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_INFORMATION);
}
@@ -86,10 +87,10 @@ public class TextEditorActionContributor extends BasicTextEditorActionContributo
/** The global actions to be connected with editor actions */
IActionBars actionBars= getActionBars();
-
+
actionBars.setGlobalActionHandler(IDEActionFactory.ADD_TASK.getId(), getAction(textEditor, IDEActionFactory.ADD_TASK.getId()));
actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(textEditor, IDEActionFactory.BOOKMARK.getId()));
-
+
IAction action= getAction(textEditor, ITextEditorActionConstants.NEXT);
actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_NEXT_ANNOTATION, action);
actionBars.setGlobalActionHandler(ITextEditorActionConstants.NEXT, action);
@@ -101,32 +102,32 @@ public class TextEditorActionContributor extends BasicTextEditorActionContributo
actionBars.setGlobalActionHandler(ITextEditorActionConstants.REFRESH, action);
fChangeEncodingAction.setAction(getAction(textEditor, ITextEditorActionConstants.CHANGE_ENCODING));
-
+
IAction quickAssistAction= getAction(textEditor, ITextEditorActionConstants.QUICK_ASSIST);
fQuickAssistAction.setAction(quickAssistAction);
if (textEditor == null)
return;
-
+
// Update Quick Assist menu entry - for now don't show disabled entry
IMenuManager menuMgr= textEditor.getEditorSite().getActionBars().getMenuManager();
IMenuManager editMenu= menuMgr.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
- if (editMenu != null) {
+ if (editMenu != null) {
boolean isEnabled= quickAssistAction != null && quickAssistAction.isEnabled();
fQuickAssistMenuEntry.setVisible(isEnabled);
editMenu.update(true);
}
-
+
fRetargetShowInformationAction.setAction(getAction(textEditor, ITextEditorActionConstants.SHOW_INFORMATION));
}
-
+
/*
* @see org.eclipse.ui.texteditor.BasicTextEditorActionContributor#contributeToMenu(org.eclipse.jface.action.IMenuManager)
* @since 3.3
*/
public void contributeToMenu(IMenuManager menu) {
super.contributeToMenu(menu);
-
+
IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (editMenu != null) {
editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, fQuickAssistMenuEntry);
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
index 266a7b1c646..558162c31d2 100644
--- 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
@@ -30,6 +30,7 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+
import org.eclipse.ui.texteditor.AbstractTextEditor;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java
index 83df3da97fc..5712b33a806 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java
@@ -117,7 +117,7 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPro
/**
* The actual functionality of this operation.
- *
+ *
* @param monitor the progress monitor
* @throws CoreException if the execution fails
*/
@@ -186,13 +186,13 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPro
public Object fElement;
public int fCount;
public ITextFileBuffer fTextFileBuffer;
-
+
/**
* The file buffer location kind.
* @since 3.4
*/
public LocationKind fTextFileBufferLocationKind;
-
+
public IAnnotationModel fModel;
public boolean fCachedReadOnlyState;
}
@@ -545,12 +545,12 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPro
if (!(element instanceof IAdaptable))
return null;
IAdaptable adaptable= (IAdaptable) element;
-
+
IFile file= null;
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
ITextFileBuffer fileBuffer= null;
LocationKind locationKind= null;
-
+
file= (IFile)adaptable.getAdapter(IFile.class);
if (file != null) {
IPath location= file.getFullPath();
@@ -602,14 +602,14 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPro
/**
* Sets up the synchronization for the document
* and the annotation mode.
- *
+ *
* @param info the file info
* @since 3.2
*/
protected void setUpSynchronization(FileInfo info) {
if (info == null || info.fTextFileBuffer == null)
return;
-
+
IDocument document= info.fTextFileBuffer.getDocument();
IAnnotationModel model= info.fModel;
@@ -856,7 +856,7 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPro
*/
protected void commitFileBuffer(IProgressMonitor monitor, FileInfo info, boolean overwrite) throws CoreException {
Assert.isNotNull(info);
-
+
/* https://bugs.eclipse.org/bugs/show_bug.cgi?id=98327
* Make sure file gets save in commit() if the underlying file has been deleted */
if (info.fElement instanceof IFileEditorInput) {
@@ -865,7 +865,7 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPro
if (!resource.isSynchronized(IResource.DEPTH_ZERO) && isDeleted(input))
info.fTextFileBuffer.setDirty(true);
}
-
+
info.fTextFileBuffer.commit(monitor, overwrite);
if (info.fModel instanceof AbstractMarkerAnnotationModel) {
AbstractMarkerAnnotationModel model= (AbstractMarkerAnnotationModel) info.fModel;
@@ -1198,7 +1198,7 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPro
return info.fTextFileBuffer.isSynchronized();
return ((IDocumentProviderExtension3) getParentProvider()).isSynchronized(element);
}
-
+
/*
* @see org.eclipse.ui.texteditor.IDocumentProviderExtension5#isNotSynchronizedException(Object, CoreException)
* @since 3.2
@@ -1207,10 +1207,10 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPro
IStatus status= ex.getStatus();
if (status == null || status instanceof MultiStatus)
return false;
-
+
if (status.getException() != null)
return false;
-
+
return status.getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL;
}
@@ -1280,7 +1280,7 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPro
protected IFileStore getFileStore(FileInfo info) {
return info.fTextFileBuffer.getFileStore();
}
-
+
/**
* Returns the system file denoted by the given info.
*
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java
index 128067c6347..37390688dcb 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java
@@ -16,15 +16,16 @@ import java.util.Map;
import java.util.StringTokenizer;
import java.util.Map.Entry;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.preference.IPreferenceStore;
+
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.DefaultTextHover;
import org.eclipse.jface.text.IInformationControl;
@@ -49,6 +50,7 @@ import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
+
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.AnnotationPreference;
import org.eclipse.ui.texteditor.HyperlinkDetectorRegistry;
@@ -111,7 +113,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
// backward compatibility
if (key != null && !fPreferenceStore.getBoolean(key))
return false;
-
+
return true;
}
@@ -138,7 +140,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
String key= preference.getOverviewRulerPreferenceKey();
if (key == null || !fPreferenceStore.getBoolean(key))
return false;
-
+
return true;
}
@@ -177,7 +179,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
}
return true;
}
-
+
/**
* Returns the annotation preference for the given annotation.
*
@@ -230,7 +232,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
if (!fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
return null;
-
+
return getRegisteredHyperlinkDetectors(sourceViewer);
}
@@ -247,7 +249,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
Map targets= getHyperlinkDetectorTargets(sourceViewer);
Assert.isNotNull(targets);
-
+
IHyperlinkDetector[] result= null;
Iterator iter= targets.entrySet().iterator();
while (iter.hasNext()) {
@@ -265,7 +267,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
* <p>
* Subclasses are allowed to modify the returned map.
* </p>
- *
+ *
* @param sourceViewer the source viewer to be configured by this configuration
* @return the hyperlink detector targets with target id (<code>String</code>) as key
* and the target context (<code>IAdaptable</code>) as value
@@ -372,7 +374,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
* This implementation currently returns a {@link MonoReconciler} which
* is responsible for spell checking. In the future a different reconciler
* taking over more responsibilities might be returned.</p>
- *
+ *
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
* @since 3.3
*/
@@ -383,7 +385,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
SpellingService spellingService= EditorsUI.getSpellingService();
if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null)
return null;
-
+
IReconcilingStrategy strategy= new SpellingReconcileStrategy(sourceViewer, spellingService);
MonoReconciler reconciler= new MonoReconciler(strategy, false);
reconciler.setDelay(500);
@@ -401,7 +403,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
IQuickAssistAssistant assistant= new QuickAssistAssistant();
assistant.setQuickAssistProcessor(new SpellingCorrectionProcessor());
assistant.setInformationControlCreator(getQuickAssistAssistantInformationControlCreator());
-
+
return assistant;
}
@@ -421,7 +423,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Helper method to merge two {@link IHyperlinkDetector} arrays.
- *
+ *
* @param array1 an array of hyperlink detectors or <code>null</code>
* @param array2 an array of hyperlink detectors or <code>null</code>
* @return an array with the merged hyperlink detectors or <code>null</code> if both given arrays are <code>null</code>
@@ -447,7 +449,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration {
/**
* Text hover with custom control creator that
* can show the tool tip affordance.
- *
+ *
* @since 3.3
*/
private final class TextHover extends DefaultTextHover implements ITextHoverExtension {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionContextTypeRegistry.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionContextTypeRegistry.java
index 8bf4cbad3b0..fecd0114621 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionContextTypeRegistry.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionContextTypeRegistry.java
@@ -24,10 +24,10 @@ import org.eclipse.jface.text.templates.ContextTypeRegistry;
import org.eclipse.jface.text.templates.TemplateContextType;
import org.eclipse.jface.text.templates.TemplateVariableResolver;
-import org.eclipse.ui.editors.text.EditorsUI;
-
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
+import org.eclipse.ui.editors.text.EditorsUI;
+
/**
* A registry for context types. Editor implementors will usually instantiate a
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java
index 52250c96155..c8e265c69c5 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java
@@ -240,7 +240,7 @@ public class ContributionTemplateStore extends TemplateStore {
bAutoInsert= true;
else
bAutoInsert= Boolean.valueOf(autoInsert).booleanValue();
-
+
Template template= new Template(name, desc, contextTypeId, pattern, bAutoInsert);
TemplatePersistenceData data= new TemplatePersistenceData(template, true, id);
if (validateTemplate(template))
@@ -254,7 +254,7 @@ public class ContributionTemplateStore extends TemplateStore {
private static boolean isValidTemplateId(String id) {
return id != null && id.trim().length() != 0; // TODO test validity?
}
-
+
/*
* @see org.eclipse.jface.text.templates.persistence.TemplateStore#handleException(java.io.IOException)
* @since 3.2
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/CompositeRevertAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/CompositeRevertAction.java
index 734885f7570..70a337ad83b 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/CompositeRevertAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/CompositeRevertAction.java
@@ -39,7 +39,7 @@ public final class CompositeRevertAction extends Action implements IUpdate, ISel
/**
* Creates an action combining the two given actions.
*
- * @param editor the editor
+ * @param editor the editor
* @param actions the list of actions
*/
public CompositeRevertAction(ITextEditor editor, IAction[] actions) {
@@ -48,11 +48,11 @@ public final class CompositeRevertAction extends Action implements IUpdate, ISel
Assert.isNotNull(actions[i]);
System.arraycopy(actions, 0, fActions, 0, actions.length);
-
+
ISelectionProvider selectionProvider= editor.getSelectionProvider();
if (selectionProvider instanceof IPostSelectionProvider)
((IPostSelectionProvider)selectionProvider).addPostSelectionChangedListener(this);
-
+
update();
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java
index e3cb9abb7da..aa7993875bb 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/LastSaveReferenceProvider.java
@@ -104,9 +104,9 @@ public class LastSaveReferenceProvider implements IQuickDiffReferenceProvider, I
/**
* Calls {@link LastSaveReferenceProvider#readDocument(IProgressMonitor, boolean)} and
* returns {@link Status#OK_STATUS}.
- *
+ *
* {@inheritDoc}
- *
+ *
* @param monitor {@inheritDoc}
* @return {@link Status#OK_STATUS}
*/
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/QuickDiffRestoreAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/QuickDiffRestoreAction.java
index a5de39761e2..42b7f136958 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/QuickDiffRestoreAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/QuickDiffRestoreAction.java
@@ -98,7 +98,7 @@ public abstract class QuickDiffRestoreAction extends TextEditorAction implements
setEnabled(computeEnablement());
}
-
+
/*
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
* @since 3.3
@@ -153,7 +153,7 @@ public abstract class QuickDiffRestoreAction extends TextEditorAction implements
/**
* Returns the active line
- *
+ *
* @param useRulerInfo <code>true</code> if the ruler info should be used
* @return the line of interest.
* @since 3.1
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/RestoreAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/RestoreAction.java
index ab57eef755d..8d27ae9ada0 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/RestoreAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/quickdiff/RestoreAction.java
@@ -16,6 +16,7 @@ import org.eclipse.jface.text.source.ILineDiffInfo;
import org.eclipse.jface.text.source.ILineDiffer;
import org.eclipse.ui.internal.editors.text.NLSUtility;
+
import org.eclipse.ui.texteditor.ITextEditor;
/**
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java
index 9d68588de97..ed274821dd3 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java
@@ -39,15 +39,15 @@ import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.preference.PreferencePage;
-
-import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
-
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.editors.text.AccessibilityPreferencePage.EnumeratedDomain.EnumValue;
+
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
+
/**
* The preference page for setting the editor options.
* <p>
@@ -424,7 +424,7 @@ public class AccessibilityPreferencePage extends PreferencePage implements IWork
fOverlayStore.start();
fContents= createAppearancePage(parent);
-
+
initialize();
Dialog.applyDialogFont(fContents);
return fContents;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java
index 7f5a3b04673..3a2cb96a7ee 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java
@@ -55,6 +55,7 @@ import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
+
import org.eclipse.ui.texteditor.AnnotationPreference;
import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
@@ -101,7 +102,7 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock {
}
}
-
+
private final class ItemLabelProvider extends LabelProvider {
public String getText(Object element) {
@@ -114,7 +115,7 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock {
}
}
-
+
private static class ArrayLabelProvider extends LabelProvider {
public String getText(Object element) {
return ((String[]) element)[0].toString();
@@ -248,7 +249,7 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock {
gd.horizontalAlignment= GridData.BEGINNING;
gd.horizontalIndent= 20;
fShowInTextCheckBox.setLayoutData(gd);
-
+
fDecorationViewer= new ComboViewer(optionsComposite, SWT.READ_ONLY);
fDecorationViewer.setContentProvider(new ArrayContentProvider());
@@ -382,7 +383,7 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock {
/**
* Applies the given data.
- *
+ *
* @param data the annotation type to select in the list or <code>null</code>
* @see org.eclipse.ui.internal.editors.text.IPreferenceConfigurationBlock#applyData(java.lang.Object)
* @since 3.4
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ConvertLineDelimitersAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ConvertLineDelimitersAction.java
index 852b621490c..a4d37ebe015 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ConvertLineDelimitersAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/ConvertLineDelimitersAction.java
@@ -29,10 +29,10 @@ import org.eclipse.jface.window.Window;
import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.ui.editors.text.FileBufferOperationAction;
-
import org.eclipse.ui.internal.editors.text.SelectResourcesDialog.IFilter;
+import org.eclipse.ui.editors.text.FileBufferOperationAction;
+
/**
* A file buffer operation action that changes the line delimiters to a specified
@@ -64,7 +64,7 @@ public class ConvertLineDelimitersAction extends FileBufferOperationAction {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
return location != null && manager.isTextFileLocation(location, fStrictCheckIfTextLocation);
}
-
+
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
fStrictCheckIfTextLocation= !(selection instanceof ITextSelection);
@@ -99,7 +99,7 @@ public class ConvertLineDelimitersAction extends FileBufferOperationAction {
/**
* Checks whether the given resources array contains
* only files.
- *
+ *
* @param resources the array with the resources
* @return <code>true</code> if there array only contains <code>IFiles</code>s
* @since 3.2
@@ -112,10 +112,10 @@ public class ConvertLineDelimitersAction extends FileBufferOperationAction {
}
return true;
}
-
+
/**
* Filters the unacceptable files.
- *
+ *
* @param files the files to filter
* @return an array of files
* @since 3.2
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
index 60d57a28a48..5362bdba9ec 100644
--- 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
@@ -11,28 +11,31 @@
*******************************************************************************/
package org.eclipse.ui.internal.editors.text;
+import org.osgi.framework.BundleContext;
+
import org.eclipse.core.runtime.Assert;
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.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.text.source.ISharedTextColors;
+
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.internal.texteditor.AnnotationTypeHierarchy;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.themes.IThemeManager;
+
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.AnnotationPreferenceLookup;
import org.eclipse.ui.texteditor.AnnotationTypeLookup;
import org.eclipse.ui.texteditor.HyperlinkDetectorRegistry;
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
import org.eclipse.ui.texteditor.spelling.SpellingService;
-import org.eclipse.ui.themes.IThemeManager;
-import org.osgi.framework.BundleContext;
+import org.eclipse.ui.editors.text.EditorsUI;
/**
* Represents the editors plug-in. It provides a series of convenience methods such as
@@ -97,7 +100,7 @@ public class EditorsPlugin extends AbstractUIPlugin {
* @since 3.1
*/
private SpellingService fSpellingService;
-
+
/**
* The hyperlink detector registry.
* @since 3.3
@@ -156,7 +159,7 @@ public class EditorsPlugin extends AbstractUIPlugin {
fAnnotationTypeHierarchy= new AnnotationTypeHierarchy();
return fAnnotationTypeHierarchy;
}
-
+
/**
* Sets the marker annotation preferences.
* <p>
@@ -170,7 +173,7 @@ public class EditorsPlugin extends AbstractUIPlugin {
Assert.isTrue(fMarkerAnnotationPreferences == null);
fMarkerAnnotationPreferences= markerAnnotationPreferences;
}
-
+
/**
* Tells whether the marker annotation preferences are initialized.
*
@@ -192,14 +195,14 @@ public class EditorsPlugin extends AbstractUIPlugin {
new MarkerAnnotationPreferences().getAnnotationPreferences(); // force creation of shared preferences
return fMarkerAnnotationPreferences;
}
-
+
/*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
* @since 3.3
*/
public void start(BundleContext context) throws Exception {
super.start(context);
-
+
if (PlatformUI.isWorkbenchRunning()) {
fThemeListener= new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
@@ -226,7 +229,7 @@ public class EditorsPlugin extends AbstractUIPlugin {
PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(fThemeListener);
fThemeListener= null;
}
-
+
fAnnotationTypeLookup= null;
fAnnotationPreferenceLookup= null;
fAnnotationTypeHierarchy= null;
@@ -252,7 +255,7 @@ public class EditorsPlugin extends AbstractUIPlugin {
* Returns the registry that contains the hyperlink detectors contributed
* by the <code>org.eclipse.ui.workbench.texteditor.hyperlinkDetectors</code>
* extension point.
- *
+ *
* @return the hyperlink detector registry
* @since 3.3
*/
@@ -261,7 +264,7 @@ public class EditorsPlugin extends AbstractUIPlugin {
fHyperlinkDetectorRegistry= new HyperlinkDetectorRegistry(getPreferenceStore());
return fHyperlinkDetectorRegistry;
}
-
+
/**
* Returns the content assist additional info focus affordance string.
*
@@ -274,8 +277,8 @@ public class EditorsPlugin extends AbstractUIPlugin {
public static final String getAdditionalInfoAffordanceString() {
if (!EditorsUI.getPreferenceStore().getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE))
return null;
-
+
return TextEditorMessages.EditorsPlugin_additionalInfo_affordance;
}
-
+
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPluginPreferenceInitializer.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPluginPreferenceInitializer.java
index 87e5e2fe1a1..1a4050a09cf 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPluginPreferenceInitializer.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/EditorsPluginPreferenceInitializer.java
@@ -18,13 +18,14 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ColorRegistry;
-import org.eclipse.ui.editors.text.TextEditorPreferenceConstants;
-
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.texteditor.ITextEditorThemeConstants;
+
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.AbstractTextEditor;
+import org.eclipse.ui.editors.text.TextEditorPreferenceConstants;
+
/**
* Preference initializer for Editors UI plug-in.
@@ -63,11 +64,11 @@ public class EditorsPluginPreferenceInitializer extends AbstractPreferenceInitia
setDefault(store,
AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND,
findRGB(registry, ITextEditorThemeConstants.PREFERENCE_COLOR_BACKGROUND, new RGB(255, 255, 255)), fireEvent);
-
+
setDefault(store,
AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND,
findRGB(registry, ITextEditorThemeConstants.PREFERENCE_COLOR_FOREGROUND, new RGB(0,0,0)), fireEvent);
-
+
setDefault(store,
AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_COLOR,
findRGB(registry,ITextEditorThemeConstants.HYPERLINK_COLOR, new RGB(0, 0, 255)), fireEvent);
@@ -75,13 +76,13 @@ public class EditorsPluginPreferenceInitializer extends AbstractPreferenceInitia
setDefault(store,
AbstractTextEditor.PREFERENCE_COLOR_FIND_SCOPE,
findRGB(registry, ITextEditorThemeConstants.FIND_SCOPE_COLOR, new RGB(185, 176 , 180)), fireEvent);
-
+
}
/**
* Sets the default value and fires a property
* change event if necessary.
- *
+ *
* @param store the preference store
* @param key the preference key
* @param newValue the new value
@@ -106,7 +107,7 @@ public class EditorsPluginPreferenceInitializer extends AbstractPreferenceInitia
/**
* Returns the RGB for the given key in the given color registry.
- *
+ *
* @param registry the color registry
* @param key the key for the constant in the registry
* @param defaultRGB the default RGB if no entry is found
@@ -116,14 +117,14 @@ public class EditorsPluginPreferenceInitializer extends AbstractPreferenceInitia
private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) {
if (registry == null)
return defaultRGB;
-
+
RGB rgb= registry.getRGB(key);
if (rgb != null)
return rgb;
-
+
return defaultRGB;
}
-
+
/**
* Migrates the overview ruler preference by re-enabling it.
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/FileEditorInputAdapterFactory.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/FileEditorInputAdapterFactory.java
index 68cde71007d..9f9b2225200 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/FileEditorInputAdapterFactory.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/FileEditorInputAdapterFactory.java
@@ -11,11 +11,13 @@
package org.eclipse.ui.internal.editors.text;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.resources.IFile;
+
import org.eclipse.ui.IFileEditorInput;
+
import org.eclipse.ui.editors.text.ILocationProvider;
/**
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java
index 4ea69468946..c32cb1b4589 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java
@@ -70,8 +70,8 @@ import org.eclipse.ui.editors.text.EditorsUI;
* @since 3.3
*/
class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBlock {
-
-
+
+
private static final class ListItem {
final String id;
final String name;
@@ -93,7 +93,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
}
}
-
+
private static final class ItemContentProvider implements IStructuredContentProvider {
public Object[] getElements(Object inputElement) {
@@ -106,10 +106,10 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}
-
+
private final class ItemLabelProvider implements ITableLabelProvider {
-
+
/*
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
*/
@@ -163,7 +163,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
}
}
-
+
private static final String MODIFIER_DELIMITER= TextEditorMessages.HyperlinkKeyModifier_delimiter;
@@ -172,7 +172,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
private CheckboxTableViewer fHyperlinkDetectorsViewer;
private ListItem[] fListModel;
private final HyperlinkDetectorDescriptor[] fHyperlinkDetectorDescriptors;
-
+
private Text fHyperlinkDefaultKeyModifierText;
private Text fHyperlinkKeyModifierText;
private Button fHyperlinksEnabledCheckBox;
@@ -193,12 +193,12 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
ArrayList overlayKeys= new ArrayList();
-
+
for (int i= 0; i < fHyperlinkDetectorDescriptors.length; i++) {
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, fHyperlinkDetectorDescriptors[i].getId()));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, fHyperlinkDetectorDescriptors[i].getId() + HyperlinkDetectorDescriptor.STATE_MASK_POSTFIX));
}
-
+
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_KEY_MODIFIER));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED));
@@ -220,7 +220,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
layout.marginHeight= 0;
layout.marginWidth= 0;
composite.setLayout(layout);
-
+
addFiller(composite, 2);
String label= TextEditorMessages.HyperlinksEnabled_label;
@@ -284,25 +284,25 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
handleHyperlinkDefaultKeyModifierModified();
}
});
-
+
addFiller(composite, 2);
Composite editorComposite= new Composite(composite, SWT.NONE);
GridData gd;
-
+
gd= new GridData(SWT.FILL, SWT.TOP, true, false);
gd.horizontalSpan= 2;
gd.horizontalIndent= 20;
editorComposite.setLayoutData(gd);
TableColumnLayout tableColumnlayout= new TableColumnLayout();
editorComposite.setLayout(tableColumnlayout);
-
+
// Hyperlink detector table
Table hyperlinkDetectorTable= new Table(editorComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK);
hyperlinkDetectorTable.setHeaderVisible(true);
hyperlinkDetectorTable.setLinesVisible(true);
hyperlinkDetectorTable.setFont(parent.getFont());
-
+
hyperlinkDetectorTable.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
handleListSelection();
@@ -310,24 +310,24 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
public void widgetDefaultSelected(SelectionEvent e) {
}
});
-
+
ColumnLayoutData columnLayoutData= new ColumnWeightData(1);
-
+
TableColumn nameColumn= new TableColumn(hyperlinkDetectorTable, SWT.NONE, 0);
nameColumn.setText(TextEditorMessages.HyperlinkDetectorTable_nameColumn);
tableColumnlayout.setColumnData(nameColumn, columnLayoutData);
-
+
TableColumn modifierKeysColumn= new TableColumn(hyperlinkDetectorTable, SWT.NONE, 1);
modifierKeysColumn.setText(TextEditorMessages.HyperlinkDetectorTable_modifierKeysColumn);
tableColumnlayout.setColumnData(modifierKeysColumn, columnLayoutData);
-
+
TableColumn targetNameColumn= new TableColumn(hyperlinkDetectorTable, SWT.NONE, 2);
targetNameColumn.setText(TextEditorMessages.HyperlinkDetectorTable_targetNameColumn);
tableColumnlayout.setColumnData(targetNameColumn, columnLayoutData);
fHyperlinkDetectorsViewer= new CheckboxTableViewer(hyperlinkDetectorTable);
fHyperlinkDetectorsViewer.setUseHashlookup(true);
-
+
fHyperlinkDetectorsViewer.addCheckStateListener(new ICheckStateListener() {
/*
* @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
@@ -339,15 +339,15 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
fStore.setValue(id, !event.getChecked());
}
});
-
+
fHyperlinkDetectorsViewer.setLabelProvider(new ItemLabelProvider());
fHyperlinkDetectorsViewer.setContentProvider(new ItemContentProvider());
gd= new GridData(SWT.FILL, SWT.FILL, true , false);
gd.heightHint= pixelConverter.convertHeightInCharsToPixels(10);
fHyperlinkDetectorsViewer.getControl().setLayoutData(gd);
-
+
// addFiller(composite, 2);
-
+
// Text field for modifier string
label= TextEditorMessages.HyperlinkKeyModifier_label;
fHyperlinkKeyModifierText= (Text)addTextField(composite, label, null, 15, 20, pixelConverter)[1];
@@ -395,17 +395,17 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
handleHyperlinkKeyModifierModified();
}
});
-
+
return composite;
}
-
+
/*
* @see org.eclipse.ui.internal.editors.text.IPreferenceConfigurationBlock#applyData(java.lang.Object)
* @since 3.4
*/
public void applyData(Object data) {
}
-
+
private void addFiller(Composite composite, int horizontalSpan) {
PixelConverter pixelConverter= new PixelConverter(composite);
Label filler= new Label(composite, SWT.LEFT );
@@ -498,7 +498,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
if (text == null)
text= fHyperlinkDefaultKeyModifierText.getText();
fHyperlinkKeyModifierText.setText(text);
-
+
}
public void initialize() {
@@ -516,7 +516,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
fHyperlinksEnabledCheckBox.setSelection(isEnabled);
fHyperlinkKeyModifierText.setEnabled(isEnabled);
fHyperlinkDefaultKeyModifierText.setEnabled(isEnabled);
-
+
fListModel= createListModel();
fHyperlinkDetectorsViewer.setInput(fListModel);
fHyperlinkDetectorsViewer.setAllChecked(false);
@@ -533,10 +533,10 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
for (int i= 0; i < fHyperlinkDetectorDescriptors.length; i++) {
HyperlinkDetectorDescriptor desc= fHyperlinkDetectorDescriptors[i];
HyperlinkDetectorTargetDescriptor target= desc.getTarget();
-
+
int stateMask= fStore.getInt(desc.getId() + HyperlinkDetectorDescriptor.STATE_MASK_POSTFIX);
String modifierKeys= getModifierString(stateMask);
-
+
listModelItems.add(new ListItem(
desc.getId(), desc.getName(), desc.getDescription(), desc.getTargetId(), target.getName(), target.getDescription(), modifierKeys));
}
@@ -571,7 +571,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
private void handleHyperlinkKeyModifierModified() {
String modifiers= fHyperlinkKeyModifierText.getText();
-
+
int stateMask= computeStateMask(modifiers);
if (fHyperlinksEnabledCheckBox.getSelection() && (stateMask == -1 || (stateMask & SWT.SHIFT) != 0)) {
@@ -594,12 +594,12 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
applyToStatusLine(fHyperlinkKeyModifierStatus);
}
}
-
+
private void handleHyperlinkDefaultKeyModifierModified() {
String modifiers= fHyperlinkDefaultKeyModifierText.getText();
-
+
int stateMask= computeStateMask(modifiers);
-
+
if (fHyperlinksEnabledCheckBox.getSelection() && (stateMask == -1 || (stateMask & SWT.SHIFT) != 0)) {
if (stateMask == -1)
fHyperlinkKeyModifierStatus= new StatusInfo(IStatus.ERROR, NLSUtility.format(TextEditorMessages.HyperlinkKeyModifier_error_modifierIsNotValid, modifiers));
@@ -680,7 +680,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl
private static final String getModifierString(int stateMask) {
if (stateMask == -1)
return null;
-
+
String modifierString= ""; //$NON-NLS-1$
if ((stateMask & SWT.CTRL) == SWT.CTRL)
modifierString= appendModifierString(modifierString, SWT.CTRL);
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IPreferenceConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IPreferenceConfigurationBlock.java
index 999435c6fba..58d5e8f5594 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IPreferenceConfigurationBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IPreferenceConfigurationBlock.java
@@ -81,7 +81,7 @@ interface IPreferenceConfigurationBlock {
* It is up to the implementor to define whether it supports this and which
* kind of data it accepts.
* </p>
- *
+ *
* @param data the data which is specified by each configuration block
* @see PreferencePage#applyData(Object)
* @since 3.4
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IURIEditorInputAdapterFactory.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IURIEditorInputAdapterFactory.java
index f5cced5a3cf..ee8558b794e 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IURIEditorInputAdapterFactory.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/IURIEditorInputAdapterFactory.java
@@ -17,15 +17,15 @@ import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.ui.IURIEditorInput;
+
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.ui.editors.text.ILocationProviderExtension;
-import org.eclipse.ui.IURIEditorInput;
-
/**
* Adapter factory for <code>IURIEditorInput</code>.
- *
+ *
* @since 3.3
*/
public class IURIEditorInputAdapterFactory implements IAdapterFactory {
@@ -40,7 +40,7 @@ public class IURIEditorInputAdapterFactory implements IAdapterFactory {
return URIUtil.toPath(uri);
return null;
}
-
+
/*
* @see org.eclipse.ui.editors.text.ILocationProviderExtension#getURI(java.lang.Object)
*/
@@ -53,7 +53,7 @@ public class IURIEditorInputAdapterFactory implements IAdapterFactory {
}
}
-
+
/** The list of provided adapters. */
private static final Class[] ADAPTER_LIST= new Class[] { ILocationProvider.class };
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LanguageEditorPreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LanguageEditorPreferencePage.java
index c17261b87bd..ca0674b975e 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LanguageEditorPreferencePage.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LanguageEditorPreferencePage.java
@@ -18,12 +18,12 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
-
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
+
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java
index f1bdb144ec8..2bd1a2e61ed 100755
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java
@@ -64,7 +64,7 @@ import org.eclipse.ui.editors.text.EditorsUI;
* Configures the linked mode preferences. The preferences belong to
* org.eclipse.ui.editors. However, as they are chiefly used in the java editor,
* we keep the preferences here for the time being.
- *
+ *
* @since 3.2 (in jdt.ui since 3.1)
*/
class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
@@ -97,7 +97,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
this.validStyles= validStyles;
}
}
-
+
private static final class ItemContentProvider implements IStructuredContentProvider {
public Object[] getElements(Object inputElement) {
@@ -110,20 +110,20 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}
-
+
private final class ItemLabelProvider extends LabelProvider {
-
+
public String getText(Object element) {
return ((ListItem) element).label;
}
}
-
+
private static class ArrayLabelProvider extends LabelProvider {
public String getText(Object element) {
return ((String[]) element)[0].toString();
}
}
-
+
final static String[] HIGHLIGHT= new String[] {TextEditorMessages.LinkedModeConfigurationBlock_HIGHLIGHT, "unused"}; //$NON-NLS-1$
final static String[] UNDERLINE= new String[] {TextEditorMessages.LinkedModeConfigurationBlock_UNDERLINE, AnnotationPreference.STYLE_UNDERLINE};
final static String[] BOX= new String[] {TextEditorMessages.LinkedModeConfigurationBlock_BOX, AnnotationPreference.STYLE_BOX};
@@ -134,7 +134,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
private ColorSelector fAnnotationForegroundColorEditor;
private Button fShowInTextCheckBox;
-
+
private StructuredViewer fAnnotationTypeViewer;
private final ListItem[] fListModel;
@@ -142,13 +142,13 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
private FontMetrics fFontMetrics;
protected static final int INDENT= 20;
private OverlayPreferenceStore fStore;
-
+
private ArrayList fMasterSlaveListeners= new ArrayList();
-
+
private OverlayPreferenceStore getPreferenceStore() {
return fStore;
}
-
+
public LinkedModeConfigurationBlock(OverlayPreferenceStore store) {
fStore= store;
final MarkerAnnotationPreferences prefs= EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
@@ -162,7 +162,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
Iterator e= preferences.getAnnotationPreferences().iterator();
while (e.hasNext()) {
AnnotationPreference info= (AnnotationPreference) e.next();
-
+
if (isLinkedModeAnnotation(info)) {
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey()));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey()));
@@ -170,7 +170,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getHighlightPreferenceKey()));
}
}
-
+
OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
overlayKeys.toArray(keys);
return keys;
@@ -183,11 +183,11 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
|| (type.equals(TARGET))
|| (type.equals(EXIT));
}
-
+
private ListItem[] createAnnotationTypeListModel(MarkerAnnotationPreferences preferences) {
ArrayList listModelItems= new ArrayList();
Iterator e= preferences.getAnnotationPreferences().iterator();
-
+
while (e.hasNext()) {
AnnotationPreference info= (AnnotationPreference) e.next();
if (isLinkedModeAnnotation(info)) {
@@ -196,12 +196,12 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
listModelItems.add(new ListItem(label, null, info.getColorPreferenceKey(), info.getTextPreferenceKey(), info.getOverviewRulerPreferenceKey(), info.getHighlightPreferenceKey(), info.getVerticalRulerPreferenceKey(), info.getTextStylePreferenceKey(), styles));
}
}
-
+
ListItem[] items= new ListItem[listModelItems.size()];
listModelItems.toArray(items);
return items;
}
-
+
private List getStyles(Object type) {
if (type.equals(MASTER))
@@ -217,7 +217,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
/**
* Creates page for hover preferences.
- *
+ *
* @param parent the parent composite
* @return the control for the preference page
*/
@@ -225,7 +225,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
OverlayPreferenceStore store= getPreferenceStore();
store.load();
store.start();
-
+
initializeDialogUnits(parent);
Composite composite= new Composite(parent, SWT.NONE);
@@ -254,7 +254,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
gd= new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
gd.heightHint= convertHeightInCharsToPixels(5);
fAnnotationTypeViewer.getControl().setLayoutData(gd);
-
+
Composite optionsComposite= new Composite(editorComposite, SWT.NONE);
layout= new GridLayout();
layout.marginHeight= 0;
@@ -262,15 +262,15 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
layout.numColumns= 2;
optionsComposite.setLayout(layout);
optionsComposite.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
-
+
// we only allow to set either "show in text" or "highlight in text", but not both
-
+
fShowInTextCheckBox= new Button(optionsComposite, SWT.CHECK);
fShowInTextCheckBox.setText(TextEditorMessages.LinkedModeConfigurationBlock_labels_showIn);
gd= new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment= GridData.BEGINNING;
fShowInTextCheckBox.setLayoutData(gd);
-
+
fDecorationViewer= new ComboViewer(optionsComposite, SWT.READ_ONLY);
fDecorationViewer.setContentProvider(new ArrayContentProvider());
fDecorationViewer.setLabelProvider(new ArrayLabelProvider());
@@ -280,7 +280,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
gd.horizontalAlignment= GridData.BEGINNING;
fDecorationViewer.getControl().setLayoutData(gd);
fDecorationViewer.setInput(new Object[] {HIGHLIGHT, SQUIGGLES, BOX, DASHED_BOX, UNDERLINE, IBEAM});
-
+
label= new Label(optionsComposite, SWT.LEFT);
label.setText(TextEditorMessages.LinkedModeConfigurationBlock_color);
gd= new GridData();
@@ -292,7 +292,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
gd= new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment= GridData.BEGINNING;
foregroundColorButton.setLayoutData(gd);
-
+
createDependency(fShowInTextCheckBox, new Control[] {label, foregroundColorButton});
fAnnotationTypeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@@ -300,12 +300,12 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
handleAnnotationListSelection();
}
});
-
+
fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
}
-
+
public void widgetSelected(SelectionEvent e) {
ListItem item= getSelectedItem();
final boolean value= fShowInTextCheckBox.getSelection();
@@ -325,18 +325,18 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
updateDecorationViewer(item, false);
}
});
-
+
foregroundColorButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
}
-
+
public void widgetSelected(SelectionEvent e) {
ListItem item= getSelectedItem();
PreferenceConverter.setValue(getPreferenceStore(), item.colorKey, fAnnotationForegroundColorEditor.getColorValue());
}
});
-
+
fDecorationViewer.addSelectionChangedListener(new ISelectionChangedListener() {
/*
@@ -345,7 +345,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
public void selectionChanged(SelectionChangedEvent event) {
String[] decoration= (String[]) ((IStructuredSelection) fDecorationViewer.getSelection()).getFirstElement();
ListItem item= getSelectedItem();
-
+
if (fShowInTextCheckBox.getSelection()) {
if (HIGHLIGHT.equals(decoration)) {
getPreferenceStore().setValue(item.highlightKey, true);
@@ -359,11 +359,11 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
}
}
});
-
+
return composite;
}
-
+
/*
* @see org.eclipse.ui.internal.editors.text.IPreferenceConfigurationBlock#applyData(java.lang.Object)
* @since 3.4
@@ -379,7 +379,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
* <p>
* Clients may call this framework method, but should not override it.
* </p>
- *
+ *
* @param chars the number of characters
* @return the number of pixels
*/
@@ -398,7 +398,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
* <p>
* Clients may call this framework method, but should not override it.
* </p>
- *
+ *
* @param chars the number of characters
* @return the number of pixels
*/
@@ -415,7 +415,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
* <p>
* This method must be called before any of the dialog unit based conversion methods are called.
* </p>
- *
+ *
* @param testControl a control from which to obtain the current font
*/
protected void initializeDialogUnits(Control testControl) {
@@ -425,26 +425,26 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
fFontMetrics = gc.getFontMetrics();
gc.dispose();
}
-
+
private void handleAnnotationListSelection() {
ListItem item= getSelectedItem();
-
+
RGB rgb= PreferenceConverter.getColor(getPreferenceStore(), item.colorKey);
fAnnotationForegroundColorEditor.setColorValue(rgb);
-
+
boolean highlight= item.highlightKey == null ? false : getPreferenceStore().getBoolean(item.highlightKey);
boolean showInText = item.textKey == null ? false : getPreferenceStore().getBoolean(item.textKey);
fShowInTextCheckBox.setSelection(showInText || highlight);
-
+
updateDecorationViewer(item, true);
}
-
+
/*
* @see org.eclipse.jdt.internal.ui.preferences.IPreferenceConfigurationBlock#initialize()
*/
public void initialize() {
initializeFields();
-
+
fAnnotationTypeViewer.setInput(fListModel);
fAnnotationTypeViewer.getControl().getDisplay().asyncExec(new Runnable() {
public void run() {
@@ -465,16 +465,16 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
// only one case where the combo is not enabled: if both the highlight and textStyle keys are null
final boolean enabled= fShowInTextCheckBox.getSelection() && !(item.highlightKey == null && item.textStyleKey == null);
fDecorationViewer.getControl().setEnabled(enabled);
-
+
if (changed) {
String[] selection= null;
ArrayList list= new ArrayList();
-
+
list.addAll(item.validStyles);
-
+
if (getPreferenceStore().getBoolean(item.highlightKey))
selection= HIGHLIGHT;
-
+
// set selection
if (selection == null) {
String val= getPreferenceStore().getString(item.textStyleKey);
@@ -486,29 +486,29 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
}
}
}
-
+
fDecorationViewer.setInput(list.toArray(new Object[list.size()]));
if (selection == null)
selection= (String[]) list.get(0);
fDecorationViewer.setSelection(new StructuredSelection((Object) selection), true);
}
}
-
-
+
+
public void performOk() {
getPreferenceStore().propagate();
-
+
try {
Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(EditorsUI.PLUGIN_ID).flush();
} catch (BackingStoreException e) {
EditorsPlugin.log(e);
}
}
-
-
+
+
public void performDefaults() {
getPreferenceStore().loadDefaults();
-
+
/*
* Only call super after updating fShowInTextCheckBox, so that
* the master-slave dependencies get properly updated.
@@ -517,7 +517,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
initializeFields();
}
-
+
public void dispose() {
OverlayPreferenceStore store= getPreferenceStore();
if (store != null) {
@@ -528,7 +528,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
protected void createDependency(final Button master, final Control slave) {
createDependency(master, new Control[] {slave});
}
-
+
protected void createDependency(final Button master, final Control[] slaves) {
Assert.isTrue(slaves.length > 0);
indent(slaves[0]);
@@ -551,7 +551,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock {
}
private void initializeFields() {
-
+
// Update slaves
Iterator iter= fMasterSlaveListeners.iterator();
while (iter.hasNext()) {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModePreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModePreferencePage.java
index 9b930a84757..ccd52c8b983 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModePreferencePage.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModePreferencePage.java
@@ -20,11 +20,11 @@ import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
/**
* The page for setting the editor options.
- *
+ *
* @since 3.2
*/
public final class LinkedModePreferencePage extends AbstractConfigurationBlockPreferencePage {
-
+
/*
* @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
*/
@@ -36,18 +36,18 @@ public final class LinkedModePreferencePage extends AbstractConfigurationBlockPr
* @see org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
*/
protected void setDescription() {
- String description= TextEditorMessages.LinkedModeConfigurationBlock_linking_title;
+ String description= TextEditorMessages.LinkedModeConfigurationBlock_linking_title;
setDescription(description);
}
-
+
/*
* @see org.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setPreferenceStore()
*/
protected void setPreferenceStore() {
setPreferenceStore(EditorsUI.getPreferenceStore());
}
-
-
+
+
protected Label createDescriptionLabel(Composite parent) {
return null; // no description for new look.
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPreviousPulldownActionDelegate.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPreviousPulldownActionDelegate.java
index 33587319f65..7db883e0894 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPreviousPulldownActionDelegate.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NextPreviousPulldownActionDelegate.java
@@ -11,11 +11,12 @@
package org.eclipse.ui.internal.editors.text;
-import com.ibm.icu.text.Collator;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
+import com.ibm.icu.text.Collator;
+
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
@@ -28,6 +29,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
+
import org.eclipse.ui.texteditor.AnnotationPreference;
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
@@ -52,7 +54,7 @@ public abstract class NextPreviousPulldownActionDelegate extends Action implemen
/** The preference key for the value in the store. */
private String fKey;
-
+
/**
* The display string.
* @since 3.2
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NonExistingFileEditorInput.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NonExistingFileEditorInput.java
index 8487d167a2f..bd6a80ecdc9 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NonExistingFileEditorInput.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NonExistingFileEditorInput.java
@@ -20,12 +20,11 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.ui.editors.text.ILocationProvider;
-
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.editors.text.ILocationProvider;
+
/**
* @since 3.1
*/
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
index 4de30d45b5e..99e57d289e5 100644
--- 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
@@ -523,7 +523,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
* <p>
* Note: This method must be called before {@link #load()} is called.
* </p>
- *
+ *
* @param keys an array with overlay keys
* @since 3.0
*/
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
index 446e6b67704..2760a1ff611 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/QuickDiffConfigurationBlock.java
@@ -93,7 +93,7 @@ class QuickDiffConfigurationBlock implements IPreferenceConfigurationBlock {
*/
private Button fEnablementCheckbox;
-
+
public QuickDiffConfigurationBlock(OverlayPreferenceStore store) {
Assert.isNotNull(store);
fStore= store;
@@ -197,7 +197,7 @@ class QuickDiffConfigurationBlock implements IPreferenceConfigurationBlock {
public void widgetDefaultSelected(SelectionEvent e) {
}
});
-
+
addFiller(composite);
label= TextEditorMessages.QuickDiffConfigurationBlock_showInOverviewRuler;
@@ -308,7 +308,7 @@ class QuickDiffConfigurationBlock implements IPreferenceConfigurationBlock {
return composite;
}
-
+
/*
* @see org.eclipse.ui.internal.editors.text.IPreferenceConfigurationBlock#applyData(java.lang.Object)
* @since 3.4
@@ -318,14 +318,14 @@ class QuickDiffConfigurationBlock implements IPreferenceConfigurationBlock {
private void addFiller(Composite composite) {
PixelConverter pixelConverter= new PixelConverter(composite);
-
+
Label filler= new Label(composite, SWT.LEFT );
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan= 2;
gd.heightHint= pixelConverter.convertHeightInCharsToPixels(1) / 2;
filler.setLayoutData(gd);
}
-
+
private void updateEnablement() {
final boolean enabled= fEnablementCheckbox.getSelection();
fQuickDiffOverviewRulerCheckBox.setEnabled(enabled);
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RefreshEditorAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RefreshEditorAction.java
index 0b798eea404..48d69da3ec9 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RefreshEditorAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RefreshEditorAction.java
@@ -22,7 +22,7 @@ import org.eclipse.ui.texteditor.IUpdate;
/**
* Refresh text editor action.
- *
+ *
* @since 3.3
*/
public class RefreshEditorAction extends RefreshAction implements IUpdate {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RemoveTrailingWhitespaceHandler.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RemoveTrailingWhitespaceHandler.java
index 38255421f9a..22045262acd 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RemoveTrailingWhitespaceHandler.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/RemoveTrailingWhitespaceHandler.java
@@ -13,9 +13,10 @@ package org.eclipse.ui.internal.editors.text;
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.core.runtime.IPath;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
@@ -23,10 +24,10 @@ import org.eclipse.core.filebuffers.manipulation.RemoveTrailingWhitespaceOperati
import org.eclipse.jface.window.Window;
-import org.eclipse.ui.editors.text.FileBufferOperationHandler;
-
import org.eclipse.ui.internal.editors.text.SelectResourcesDialog.IFilter;
+import org.eclipse.ui.editors.text.FileBufferOperationHandler;
+
/**
* A file buffer operation action that removes trailing whitespace.
@@ -71,11 +72,11 @@ public class RemoveTrailingWhitespaceHandler extends FileBufferOperationHandler
}
return null;
}
-
+
/**
* Checks whether the given resources array contains
* only files.
- *
+ *
* @param resources the array with the resources
* @return <code>true</code> if there array only contains <code>IFiles</code>s
* @since 3.2
@@ -88,10 +89,10 @@ public class RemoveTrailingWhitespaceHandler extends FileBufferOperationHandler
}
return true;
}
-
+
/**
* Filters the unacceptable files.
- *
+ *
* @param files the files to filter
* @return an array of files
* @since 3.2
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
index 65158a10f2a..8f8f0d9677a 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
@@ -106,7 +106,7 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList
* Create an instance of this class. Use this constructor if you wish to specify the width
* and/or height of the combined widget (to only hard code one of the sizing dimensions, specify
* the other dimension's value as -1)
- *
+ *
* @param parent the parent composite
* @param rootObject the root object
* @param treeContentProvider the tree content provider
@@ -322,7 +322,7 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList
private void findAllSelectedListElements(Object treeElement, String parentLabel, boolean addAll, IElementFilter filter) throws InterruptedException {
String fullLabel= null;
-
+
if (addAll)
filter.filterElements(listContentProvider.getElements(treeElement));
else { //Add what we have stored
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java
index 5bfccf6af15..0763997ea52 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java
@@ -99,7 +99,7 @@ class SelectResourcesDialog extends Dialog {
*/
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
-
+
if (fTitle != null)
newShell.setText(fTitle);
}
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
index 014b94e9261..fe8bc230092 100644
--- 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
@@ -72,16 +72,16 @@ class SharedTextColors implements ISharedTextColors {
public void dispose() {
if (fDisplayTable == null)
return;
-
+
Iterator iter= fDisplayTable.values().iterator();
while (iter.hasNext())
dispose((Map)iter.next());
fDisplayTable= null;
}
-
+
/**
* Disposes the colors for the given display.
- *
+ *
* @param display the display for which to dispose the colors
* @since 3.3
*/
@@ -89,21 +89,21 @@ class SharedTextColors implements ISharedTextColors {
if (fDisplayTable != null)
dispose((Map)fDisplayTable.remove(display));
}
-
+
/**
* Disposes the given color table.
- *
+ *
* @param colorTable the color table that maps <code>RGB</code> to <code>Color</code>
* @since 3.3
*/
private void dispose(Map colorTable) {
if (colorTable == null)
return;
-
+
Iterator iter= colorTable.values().iterator();
while (iter.hasNext())
((Color) iter.next()).dispose();
-
+
colorTable.clear();
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingConfigurationBlock.java
index 4e6e9d29ddb..4a0ef29449a 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingConfigurationBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingConfigurationBlock.java
@@ -155,7 +155,7 @@ class SpellingConfigurationBlock implements IPreferenceConfigurationBlock {
/**
* Initializes with the given status monitor to which status changes are forwarded.
- *
+ *
* @param forwardedMonitor the status monitor to which changes are forwarded
*/
public ForwardingStatusMonitor(IPreferenceStatusMonitor forwardedMonitor) {
@@ -248,11 +248,11 @@ class SpellingConfigurationBlock implements IPreferenceConfigurationBlock {
layout.numColumns= 2;
layout.marginHeight= 0;
layout.marginWidth= 0;
-
+
PixelConverter pc= new PixelConverter(composite);
layout.verticalSpacing= pc.convertHeightInCharsToPixels(1) / 2;
composite.setLayout(layout);
-
+
if (EditorsUI.getSpellingService().getSpellingEngineDescriptors().length == 0) {
Label label= new Label(composite, SWT.NONE);
label.setText(TextEditorMessages.SpellingConfigurationBlock_error_not_installed);
@@ -278,7 +278,7 @@ class SpellingConfigurationBlock implements IPreferenceConfigurationBlock {
Label label= new Label(composite, SWT.CENTER);
gd= new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
label.setLayoutData(gd);
-
+
if (fProviderDescriptors.size() > 1) {
fComboGroup= new Composite(composite, SWT.NONE);
gd= new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
@@ -573,7 +573,7 @@ class SpellingConfigurationBlock implements IPreferenceConfigurationBlock {
private void restoreFromPreferences() {
if (fEnablementCheckbox == null)
return;
-
+
boolean enabled= fStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED);
fEnablementCheckbox.setSelection(enabled);
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingPreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingPreferencePage.java
index 350cdec9b2c..da720acce2e 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingPreferencePage.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingPreferencePage.java
@@ -12,10 +12,10 @@ package org.eclipse.ui.internal.editors.text;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
-
import org.eclipse.ui.texteditor.spelling.IPreferenceStatusMonitor;
+import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
+
/**
* Spelling preference page.
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
index f827218ee03..df32bbd71d7 100644
--- 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
@@ -13,7 +13,6 @@ package org.eclipse.ui.internal.editors.text;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
-
import org.eclipse.ui.editors.text.EditorsUI;
/**
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java
index 2a70e296c47..44c4489f062 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java
@@ -47,16 +47,17 @@ import org.eclipse.jface.preference.ColorSelector;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
-
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.internal.editors.text.TextEditorDefaultsPreferencePage.EnumeratedDomain.EnumValue;
+
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.AbstractTextEditor;
+import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
+
/**
* The preference page for setting the editor options.
@@ -395,7 +396,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
private java.util.List fInitializers= new ArrayList();
private InitializerFactory fInitializerFactory= new InitializerFactory();
-
+
private Map fDomains= new HashMap();
@@ -410,7 +411,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
ArrayList overlayKeys= new ArrayList();
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractTextEditor.PREFERENCE_COLOR_FIND_SCOPE));
-
+
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE));
@@ -493,67 +494,67 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
}
private Control createAppearancePage(Composite parent) {
-
+
Composite appearanceComposite= new Composite(parent, SWT.NONE);
GridLayout layout= new GridLayout();
layout.numColumns= 2;
layout.marginHeight= 0;
layout.marginWidth= 0;
-
+
appearanceComposite.setLayout(layout);
-
+
String label= TextEditorMessages.TextEditorPreferencePage_undoHistorySize;
Preference undoHistorySize= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_UNDO_HISTORY_SIZE, label, null);
IntegerDomain undoHistorySizeDomain= new IntegerDomain(0, 99999);
addTextField(appearanceComposite, undoHistorySize, undoHistorySizeDomain, 15, 0);
-
+
label= TextEditorMessages.TextEditorPreferencePage_displayedTabWidth;
Preference tabWidth= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, label, null);
IntegerDomain tabWidthDomain= new IntegerDomain(1, 16);
addTextField(appearanceComposite, tabWidth, tabWidthDomain, 15, 0);
-
+
label= TextEditorMessages.TextEditorPreferencePage_convertTabsToSpaces;
Preference spacesForTabs= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, label, null);
addCheckBox(appearanceComposite, spacesForTabs, new BooleanDomain(), 0);
-
-
+
+
label= TextEditorMessages.TextEditorPreferencePage_highlightCurrentLine;
Preference highlightCurrentLine= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, label, null);
addCheckBox(appearanceComposite, highlightCurrentLine, new BooleanDomain(), 0);
-
+
label= TextEditorMessages.TextEditorPreferencePage_showPrintMargin;
Preference showPrintMargin= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, label, null);
final Button showPrintMarginButton= addCheckBox(appearanceComposite, showPrintMargin, new BooleanDomain(), 0);
-
-
+
+
label= TextEditorMessages.TextEditorPreferencePage_printMarginColumn;
Preference printMarginColumn= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, label, null);
final IntegerDomain printMarginDomain= new IntegerDomain(20, 200);
final Control[] printMarginControls= addTextField(appearanceComposite, printMarginColumn, printMarginDomain, 15, 20);
createDependency(showPrintMarginButton, showPrintMargin, printMarginControls);
-
+
showPrintMarginButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateStatus(printMarginDomain);
}
});
-
+
label= TextEditorMessages.TextEditorPreferencePage_showLineNumbers;
Preference showLineNumbers= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, label, null);
addCheckBox(appearanceComposite, showLineNumbers, new BooleanDomain(), 0);
-
+
label= TextEditorMessages.TextEditorDefaultsPreferencePage_range_indicator;
Preference showMagnet= new Preference(AbstractDecoratedTextEditorPreferenceConstants.SHOW_RANGE_INDICATOR, label, null);
addCheckBox(appearanceComposite, showMagnet, new BooleanDomain(), 0);
-
+
label= TextEditorMessages.TextEditorDefaultsPreferencePage_showWhitespaceCharacters;
Preference showWhitespaceCharacters= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_WHITESPACE_CHARACTERS, label, null);
addCheckBox(appearanceComposite, showWhitespaceCharacters, new BooleanDomain(), 0);
-
+
label= TextEditorMessages.TextEditorPreferencePage_showAffordance;
Preference showAffordance= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE, label, null);
addCheckBox(appearanceComposite, showAffordance, new BooleanDomain(), 0);
-
+
label= TextEditorMessages.TextEditorDefaultsPreferencePage_enrichHoverMode;
Preference hoverReplace= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HOVER_ENRICH_MODE, label, null);
EnumeratedDomain hoverReplaceDomain= new EnumeratedDomain();
@@ -562,32 +563,32 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
hoverReplaceDomain.addValue(new EnumValue(0, TextEditorMessages.TextEditorDefaultsPreferencePage_enrichHover_afterDelay));
hoverReplaceDomain.addValue(new EnumValue(2, TextEditorMessages.TextEditorDefaultsPreferencePage_enrichHover_onClick));
addCombo(appearanceComposite, hoverReplace, hoverReplaceDomain, 0);
-
+
label= TextEditorMessages.TextEditorDefaultsPreferencePage_textDragAndDrop;
Preference textDragAndDrop= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TEXT_DRAG_AND_DROP_ENABLED, label, null);
addCheckBox(appearanceComposite, textDragAndDrop, new BooleanDomain(), 0);
-
+
label= TextEditorMessages.TextEditorDefaultsPreferencePage_warn_if_derived;
Preference warnIfDerived= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WARN_IF_INPUT_DERIVED, label, null);
addCheckBox(appearanceComposite, warnIfDerived, new BooleanDomain(), 0);
-
+
label= TextEditorMessages.TextEditorDefaultsPreferencePage_smartHomeEnd;
Preference smartHomeEnd= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SMART_HOME_END, label, null);
addCheckBox(appearanceComposite, smartHomeEnd, new BooleanDomain(), 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.TextEditorPreferencePage_appearanceOptions);
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;
@@ -597,12 +598,12 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
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_BOTH);
gd.heightHint= fAppearanceColorList.getItemHeight() * 8;
fAppearanceColorList.setLayoutData(gd);
-
+
Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
layout= new GridLayout();
layout.marginHeight= 0;
@@ -610,35 +611,35 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
layout.numColumns= 2;
stylesComposite.setLayout(layout);
stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
l= new Label(stylesComposite, SWT.LEFT);
l.setText(TextEditorMessages.TextEditorPreferencePage_color);
gd= new GridData();
gd.horizontalAlignment= GridData.BEGINNING;
l.setLayoutData(gd);
-
+
fAppearanceColorEditor= new ColorSelector(stylesComposite);
Button foregroundColorButton= fAppearanceColorEditor.getButton();
gd= new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment= GridData.BEGINNING;
foregroundColorButton.setLayoutData(gd);
-
+
SelectionListener colorDefaultSelectionListener= new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
boolean systemDefault= fAppearanceColorDefault.getSelection();
fAppearanceColorEditor.getButton().setEnabled(!systemDefault);
-
+
int i= fAppearanceColorList.getSelectionIndex();
if (i == -1)
return;
-
+
String key= fAppearanceColorListModel[i][2];
if (key != null)
fOverlayStore.setValue(key, systemDefault);
}
public void widgetDefaultSelected(SelectionEvent e) {}
};
-
+
fAppearanceColorDefault= new Button(stylesComposite, SWT.CHECK);
fAppearanceColorDefault.setText(TextEditorMessages.TextEditorPreferencePage_systemDefault);
gd= new GridData(GridData.FILL_HORIZONTAL);
@@ -647,7 +648,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
fAppearanceColorDefault.setLayoutData(gd);
fAppearanceColorDefault.setVisible(false);
fAppearanceColorDefault.addSelectionListener(colorDefaultSelectionListener);
-
+
fAppearanceColorList.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
@@ -664,12 +665,12 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
int i= fAppearanceColorList.getSelectionIndex();
if (i == -1)
return;
-
+
String key= fAppearanceColorListModel[i][1];
PreferenceConverter.setValue(fOverlayStore, key, fAppearanceColorEditor.getColorValue());
}
});
-
+
Link link= new Link(appearanceComposite, SWT.NONE);
link.setText(TextEditorMessages.TextEditorPreferencePage_colorsAndFonts_link);
link.addSelectionListener(new SelectionAdapter() {
@@ -680,16 +681,16 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
// TODO replace by link-specific tooltips when
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88866 gets fixed
link.setToolTipText(TextEditorMessages.TextEditorPreferencePage_colorsAndFonts_link_tooltip);
-
+
GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
gridData.widthHint= 150; // only expand further if anyone else requires it
gridData.horizontalSpan= 2;
link.setLayoutData(gridData);
-
+
addFiller(appearanceComposite, 2);
-
+
appearanceComposite.layout();
-
+
return appearanceComposite;
}
@@ -940,7 +941,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
}
fInitializers.add(fInitializerFactory.create(preference, textControl));
-
+
fDomains.put(domain, textControl);
return new Control[] {labelControl, textControl};
@@ -980,14 +981,14 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
setValid(!status.matches(IStatus.ERROR));
applyToStatusLine(this, status);
}
-
+
void updateStatus(Domain checkedDomain) {
if (!fFieldsInitialized)
return;
-
+
if (updateStatusOnError(checkedDomain))
return;
-
+
Iterator iter= fDomains.keySet().iterator();
while (iter.hasNext()) {
Domain domain= (Domain)iter.next();
@@ -998,7 +999,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements
}
updateStatus(new StatusInfo());
}
-
+
private boolean updateStatusOnError(Domain domain) {
Text textWidget= (Text)fDomains.get(domain);
if (textWidget.isEnabled()) {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UISynchronizationContext.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UISynchronizationContext.java
index 97955f22102..724f2366a97 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UISynchronizationContext.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UISynchronizationContext.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.ui.internal.editors.text;
-import org.eclipse.core.filebuffers.ISynchronizationContext;
-
import org.eclipse.swt.widgets.Display;
+import org.eclipse.core.filebuffers.ISynchronizationContext;
+
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/URLHyperlink.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/URLHyperlink.java
index e2df401fa7e..2ca11abc24f 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/URLHyperlink.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/URLHyperlink.java
@@ -31,14 +31,14 @@ final class URLHyperlink extends org.eclipse.jface.text.hyperlink.URLHyperlink {
/**
* Creates a new URL hyperlink.
- *
+ *
* @param region the region
* @param urlString the URL string
*/
public URLHyperlink(IRegion region, String urlString) {
super(region, urlString);
}
-
+
/*
* @see org.eclipse.jface.text.hyperlink.URLHyperlink#open()
* @since 3.1
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/URLHyperlinkDetector.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/URLHyperlinkDetector.java
index be065bb26e7..7657d8b358b 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/URLHyperlinkDetector.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/URLHyperlinkDetector.java
@@ -17,7 +17,7 @@ import org.eclipse.jface.text.hyperlink.IHyperlink;
/**
* URL hyperlink detector.
- *
+ *
* @since 3.1
*/
public class URLHyperlinkDetector extends org.eclipse.jface.text.hyperlink.URLHyperlinkDetector {
@@ -29,9 +29,9 @@ public class URLHyperlinkDetector extends org.eclipse.jface.text.hyperlink.URLHy
IHyperlink[] result= super.detectHyperlinks(textViewer, region, canShowMultipleHyperlinks);
if (result == null)
return null;
-
+
for (int i= 0; i < result.length; i++) {
- org.eclipse.jface.text.hyperlink.URLHyperlink hyperlink= (org.eclipse.jface.text.hyperlink.URLHyperlink)result[i];
+ org.eclipse.jface.text.hyperlink.URLHyperlink hyperlink= (org.eclipse.jface.text.hyperlink.URLHyperlink)result[i];
result[i]= new URLHyperlink(hyperlink.getHyperlinkRegion(), hyperlink.getURLString());
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UntitledTextFileWizard.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UntitledTextFileWizard.java
index 83aefa2d743..36626dffb2a 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UntitledTextFileWizard.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UntitledTextFileWizard.java
@@ -18,8 +18,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.editors.text.EditorsUI;
-
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorRegistry;
@@ -29,10 +27,12 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.editors.text.EditorsUI;
+
/**
* Wizard with no page that creates the untitled text file
* and opens the text editor.
- *
+ *
* @since 3.1
*/
public class UntitledTextFileWizard extends Wizard implements INewWizard {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationColumn.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationColumn.java
index 7ead82b4d44..54efed5e851 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationColumn.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationColumn.java
@@ -32,22 +32,23 @@ import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.jface.text.source.IVerticalRulerInfoExtension;
import org.eclipse.jface.text.source.IVerticalRulerListener;
-import org.eclipse.ui.editors.text.EditorsUI;
-
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
+
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
import org.eclipse.ui.texteditor.AnnotationPreference;
import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
import org.eclipse.ui.texteditor.rulers.AbstractContributedRulerColumn;
+import org.eclipse.ui.editors.text.EditorsUI;
+
/**
* The annotation ruler contribution. Encapsulates an {@link AnnotationRulerColumn} as a
* contribution to the <code>rulerColumns</code> extension point. Instead of instantiating the
* delegate itself, it {@link AbstractDecoratedTextEditor} creates it using its
* <code>createAnnotationRulerColumn()</code> method and sets it via
* {@link #setDelegate(IVerticalRulerColumn)}.
- *
+ *
* @since 3.3
*/
public class AnnotationColumn extends AbstractContributedRulerColumn implements IVerticalRulerInfo, IVerticalRulerInfoExtension {
@@ -56,7 +57,7 @@ public class AnnotationColumn extends AbstractContributedRulerColumn implements
/** The width of the vertical ruler. */
private final static int VERTICAL_RULER_WIDTH= 12;
-
+
private IVerticalRulerColumn fDelegate;
private final MarkerAnnotationPreferences fAnnotationPreferences= EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
private IPropertyChangeListener fPropertyListener;
@@ -137,7 +138,7 @@ public class AnnotationColumn extends AbstractContributedRulerColumn implements
column.addAnnotationType(preference.getAnnotationType());
}
column.addAnnotationType(Annotation.TYPE_UNKNOWN);
-
+
// link to preference store
fPropertyListener= new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
@@ -156,7 +157,7 @@ public class AnnotationColumn extends AbstractContributedRulerColumn implements
store.addPropertyChangeListener(fPropertyListener);
}
}
-
+
/**
* Returns the annotation preference for which the given
* preference matches a vertical ruler preference key.
@@ -183,7 +184,7 @@ public class AnnotationColumn extends AbstractContributedRulerColumn implements
/**
* Sets the compatibility delegate. Called by {@link AbstractDecoratedTextEditor}.
- *
+ *
* @param column the delegate column implementation
*/
public void setDelegate(IVerticalRulerColumn column) {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationType.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationType.java
index 6b3256698db..b2d4f199592 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationType.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationType.java
@@ -11,6 +11,7 @@
package org.eclipse.ui.internal.texteditor;
import org.eclipse.jface.text.TextUtilities;
+
import org.eclipse.ui.texteditor.AnnotationPreference;
/**
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/BooleanPreferenceToggleAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/BooleanPreferenceToggleAction.java
index c936c7731cc..1e4d53a76ce 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/BooleanPreferenceToggleAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/BooleanPreferenceToggleAction.java
@@ -15,11 +15,12 @@ import java.util.ResourceBundle;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.preference.IPreferenceStore;
+
import org.eclipse.ui.texteditor.IUpdate;
import org.eclipse.ui.texteditor.ResourceAction;
/**
- *
+ *
* @since 3.3
*/
public class BooleanPreferenceToggleAction extends ResourceAction implements IUpdate {
@@ -33,7 +34,7 @@ public class BooleanPreferenceToggleAction extends ResourceAction implements IUp
Assert.isLegal(key != null);
fPreferences= preferences;
fKey= key;
-
+
update();
}
@@ -43,7 +44,7 @@ public class BooleanPreferenceToggleAction extends ResourceAction implements IUp
public void update() {
setChecked(fPreferences.getBoolean(fKey));
}
-
+
/*
* @see org.eclipse.jface.action.Action#run()
*/
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/DelegatingAnnotationPreference.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/DelegatingAnnotationPreference.java
index 1962184478b..fd8afb4d9d9 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/DelegatingAnnotationPreference.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/DelegatingAnnotationPreference.java
@@ -18,6 +18,7 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.text.source.IAnnotationAccessExtension;
+
import org.eclipse.ui.texteditor.AnnotationPreference;
import org.eclipse.ui.texteditor.AnnotationPreferenceLookup;
import org.eclipse.ui.texteditor.IAnnotationImageProvider;
@@ -139,7 +140,7 @@ public class DelegatingAnnotationPreference extends AnnotationPreference {
public ImageDescriptor getImageDescriptor() {
return (ImageDescriptor) getAttributeValue(IMAGE_DESCRIPTOR);
}
-
+
/*
* @see org.eclipse.ui.texteditor.AnnotationPreference#getQuickFixImageDescriptor()
*/
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/ITextEditorThemeConstants.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/ITextEditorThemeConstants.java
index 80eda85afa3..a64882007f6 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/ITextEditorThemeConstants.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/ITextEditorThemeConstants.java
@@ -14,7 +14,7 @@ package org.eclipse.ui.internal.texteditor;
/**
* Defines the constants used in the <code>org.eclipse.ui.themes</code>
* extension contributed by this plug-in.
- *
+ *
* @since 3.3
*/
public interface ITextEditorThemeConstants {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/LineNumberColumn.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/LineNumberColumn.java
index 5bd753697bf..fab3d4b0e62 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/LineNumberColumn.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/LineNumberColumn.java
@@ -52,9 +52,8 @@ import org.eclipse.jface.text.source.IVerticalRulerListener;
import org.eclipse.jface.text.source.LineNumberChangeRulerColumn;
import org.eclipse.jface.text.source.LineNumberRulerColumn;
-import org.eclipse.ui.editors.text.EditorsUI;
-
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
+
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.AbstractTextEditor;
@@ -66,13 +65,15 @@ import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
import org.eclipse.ui.texteditor.quickdiff.QuickDiff;
import org.eclipse.ui.texteditor.rulers.AbstractContributedRulerColumn;
+import org.eclipse.ui.editors.text.EditorsUI;
+
/**
* The line number ruler contribution. Encapsulates a {@link LineNumberChangeRulerColumn} as a
* contribution to the <code>rulerColumns</code> extension point. Instead of instantiating the
* delegate itself, it calls <code>createLineNumberRulerColumn()</code> in
* {@link AbstractDecoratedTextEditor} via {@link ICompatibilityForwarder} to maintain compatibility
* with previous releases.
- *
+ *
* @since 3.3
*/
public class LineNumberColumn extends AbstractContributedRulerColumn implements IVerticalRulerInfo, IVerticalRulerInfoExtension {
@@ -85,7 +86,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
boolean isQuickDiffEnabled();
boolean isLineNumberRulerVisible();
}
-
+
/** The contribution id of the line number / change ruler. */
public static final String ID= "org.eclipse.ui.editors.columns.linenumbers"; //$NON-NLS-1$
@@ -160,7 +161,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
if (getQuickDiffPreference())
fDelegate.setModel(model);
}
-
+
/*
* @see org.eclipse.jface.text.source.IVerticalRulerInfo#getLineOfLastMouseButtonActivity()
*/
@@ -242,7 +243,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
// initial set up
updateForegroundColor(store, fDelegate);
updateBackgroundColor(store, fDelegate);
-
+
updateLineNumbersVisibility(fDelegate);
updateQuickDiffVisibility(fDelegate);
updateCharacterMode(store, fDelegate);
@@ -296,19 +297,19 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
updateRevisionRenderingMode(store, fDelegate);
}
});
-
+
fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_AUTHOR, new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
updateRevisionAuthorVisibility(store, fDelegate);
}
});
-
+
fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_REVISION, new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
updateRevisionIdVisibility(store, fDelegate);
}
});
-
+
fDispatcher.addPropertyChangeListener(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON, new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
updateQuickDiffVisibility(fDelegate);
@@ -351,7 +352,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
}
return annotationPrefs;
}
-
+
private void updateForegroundColor(IPreferenceStore store, IVerticalRulerColumn column) {
RGB rgb= getColorFromStore(store, FG_COLOR_KEY);
if (rgb == null)
@@ -360,7 +361,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
if (column instanceof LineNumberRulerColumn)
((LineNumberRulerColumn) column).setForeground(sharedColors.getColor(rgb));
}
-
+
private void updateBackgroundColor(IPreferenceStore store, IVerticalRulerColumn column) {
// background color: same as editor, or system default
RGB rgb;
@@ -386,14 +387,14 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
((IChangeRulerColumn) column).setAddedColor(getSharedColors().getColor(rgb));
}
}
-
+
private void updateDeletedColor(AnnotationPreference pref, IPreferenceStore store, IVerticalRulerColumn column) {
if (pref != null && column instanceof IChangeRulerColumn) {
RGB rgb= getColorFromAnnotationPreference(store, pref);
((IChangeRulerColumn) column).setDeletedColor(getSharedColors().getColor(rgb));
}
}
-
+
private void updateCharacterMode(IPreferenceStore store, IVerticalRulerColumn column) {
if (column instanceof LineNumberChangeRulerColumn) {
LineNumberChangeRulerColumn lncrc= (LineNumberChangeRulerColumn) column;
@@ -405,7 +406,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
if (column instanceof LineNumberChangeRulerColumn)
((LineNumberChangeRulerColumn) column).showLineNumbers(getLineNumberPreference());
}
-
+
private void updateRevisionRenderingMode(IPreferenceStore store, IVerticalRulerColumn column) {
if (column instanceof IRevisionRulerColumnExtension) {
String option= store.getString(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_RENDERING_MODE);
@@ -418,32 +419,32 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
}
}
}
-
+
private void updateRevisionAuthorVisibility(IPreferenceStore store, IVerticalRulerColumn column) {
if (column instanceof IRevisionRulerColumnExtension) {
boolean show= store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_AUTHOR);
((IRevisionRulerColumnExtension) column).showRevisionAuthor(show);
}
}
-
+
private void updateRevisionIdVisibility(IPreferenceStore store, IVerticalRulerColumn column) {
if (column instanceof IRevisionRulerColumnExtension) {
boolean show= store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_REVISION);
((IRevisionRulerColumnExtension) column).showRevisionId(show);
}
}
-
+
private void updateQuickDiffVisibility(IVerticalRulerColumn column) {
boolean show= getQuickDiffPreference();
if (show == isShowingChangeInformation())
return;
-
+
if (show)
installChangeRulerModel(column);
else
uninstallChangeRulerModel(column);
}
-
+
/**
* Returns whether the line number ruler column should be
* visible according to the preference store settings. Subclasses may override this
@@ -457,7 +458,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
IPreferenceStore store= getPreferenceStore();
return store != null ? store.getBoolean(LINE_NUMBER_KEY) : false;
}
-
+
/**
* Returns whether quick diff info should be visible upon opening an editor
* according to the preference store settings.
@@ -471,7 +472,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
boolean setting= store != null ? store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON) : false;
if (!setting)
return false;
-
+
boolean modifiable;
ITextEditor editor= getEditor();
if (editor instanceof ITextEditorExtension2) {
@@ -515,7 +516,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
rgb= pref.getColorPreferenceValue();
return rgb;
}
-
+
private static RGB getColorFromStore(IPreferenceStore store, String key) {
RGB rgb= null;
if (store.contains(key)) {
@@ -526,12 +527,12 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
}
return rgb;
}
-
+
/**
* Ensures that quick diff information is displayed and the quick diff provider is the one with
* the specified id. If a different quick diff provider is in use, the user may be asked whether
* he wants to switch.
- *
+ *
* @param diffProviderId the quick diff provider id to use
* @return <code>true</code> if quick diff could be enabled for the given id,
* <code>false</code> otherwise
@@ -539,7 +540,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
private boolean ensureQuickDiffProvider(String diffProviderId) {
if (!isShowingChangeInformation())
installChangeRulerModel(fDelegate); // FIXME pass provider id
-
+
IAnnotationModel annotationModel= fViewer.getAnnotationModel();
IAnnotationModel oldDiffer= getDiffer();
if (oldDiffer == null && annotationModel != null)
@@ -565,7 +566,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
((ILineDifferExtension) oldDiffer).resume();
return true;
}
-
+
// quick diff is showing with the wrong provider - ask the user whether he wants to switch
IPreferenceStore store= EditorsUI.getPreferenceStore();
if (oldDiffer != null && !store.getString(REVISION_ASK_BEFORE_QUICKDIFF_SWITCH_KEY).equals(MessageDialogWithToggle.ALWAYS)) {
@@ -580,22 +581,22 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
if (toggleDialog.getReturnCode() != Window.OK)
return false;
}
-
+
IAnnotationModelExtension modelExtension=(IAnnotationModelExtension) annotationModel;
modelExtension.removeAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID);
-
+
modelExtension.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, newDiffer);
-
+
if (fDelegate instanceof IChangeRulerColumn)
((IChangeRulerColumn) fDelegate).setModel(annotationModel); // picks up the new model attachment
-
+
return true;
}
/**
* Installs the differ annotation model with the current quick diff display.
- *
+ *
* @param column the column to install the model on
*/
private void installChangeRulerModel(IVerticalRulerColumn column) {
@@ -612,7 +613,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
/**
* Uninstalls the differ annotation model from the current quick diff display.
- *
+ *
* @param column the column to remove the model from
*/
private void uninstallChangeRulerModel(IVerticalRulerColumn column) {
@@ -640,12 +641,12 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
ISourceViewer viewer= fViewer;
if (viewer == null)
return null;
-
+
IAnnotationModel m= viewer.getAnnotationModel();
IAnnotationModelExtension model= null;
if (m instanceof IAnnotationModelExtension)
model= (IAnnotationModelExtension) m;
-
+
IAnnotationModel differ= getDiffer();
// create diff model if it doesn't
if (differ == null) {
@@ -665,7 +666,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
} else if (differ instanceof ILineDifferExtension) {
((ILineDifferExtension) differ).resume();
}
-
+
return (IAnnotationModel)model;
}
@@ -684,10 +685,10 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
IAnnotationModel m= viewer.getAnnotationModel();
if (m == null && fDelegate instanceof IChangeRulerColumn)
m= ((IChangeRulerColumn)fDelegate).getModel();
-
+
if (!(m instanceof IAnnotationModelExtension))
return null;
-
+
IAnnotationModelExtension model= (IAnnotationModelExtension)m;
// get diff model if it exists already
@@ -697,7 +698,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
/**
* Sets the forwarder. Used by {@link AbstractDecoratedTextEditor} to maintain the contract of
* its {@link AbstractDecoratedTextEditor#createLineNumberRulerColumn} method.
- *
+ *
* @param forwarder the forwarder
*/
public void setForwarder(ICompatibilityForwarder forwarder) {
@@ -723,17 +724,17 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
/**
* Returns <code>true</code> if the ruler is showing line numbers, <code>false</code> if it
* is only showing change information.
- *
+ *
* @return <code>true</code> if line numbers are shown, <code>false</code> otherwise
*/
public boolean isShowingLineNumbers() {
return fDelegate instanceof LineNumberChangeRulerColumn && ((LineNumberChangeRulerColumn) fDelegate).isShowingLineNumbers();
}
-
+
/**
* Returns <code>true</code> if the ruler is showing change information, <code>false</code>
* if it is only showing line numbers.
- *
+ *
* @return <code>true</code> if change information is shown, <code>false</code> otherwise
*/
public boolean isShowingChangeInformation() {
@@ -742,7 +743,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
/**
* Shows revision information on the receiver.
- *
+ *
* @param info the revision information to show
* @param quickDiffProviderId the id of the corresponding quick diff provider
*/
@@ -761,11 +762,11 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
if (fDelegate instanceof IRevisionRulerColumn)
((IRevisionRulerColumn) fDelegate).setRevisionInformation(null);
}
-
+
/**
* Returns <code>true</code> if the ruler is showing revision information, <code>false</code>
* if it is only showing line numbers.
- *
+ *
* @return <code>true</code> if revision information is shown, <code>false</code> otherwise
*/
public boolean isShowingRevisionInformation() {
@@ -777,7 +778,7 @@ public class LineNumberColumn extends AbstractContributedRulerColumn implements
/**
* Returns the selection provider of the revision column, <code>null</code> if none is
* available.
- *
+ *
* @return the revision selection provider
*/
public ISelectionProvider getRevisionSelectionProvider() {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/RulerMessages.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/RulerMessages.java
index 0ad4f14d8bb..4d0e214a896 100755
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/RulerMessages.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/RulerMessages.java
@@ -26,7 +26,7 @@ final class RulerMessages extends NLS {
public static String AbstractDecoratedTextEditor_revision_quickdiff_switch_title;
public static String AbstractDecoratedTextEditor_revision_quickdiff_switch_message;
public static String AbstractDecoratedTextEditor_revision_quickdiff_switch_rememberquestion;
-
+
static {
NLS.initializeMessages(BUNDLE_NAME, RulerMessages.class);
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java
index 2c51cbb577d..0c6c559827c 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java
@@ -44,10 +44,10 @@ import org.eclipse.jface.text.IInformationControlExtension5;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
-
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
+import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
+
/**
* Source viewer based implementation of <code>IInformationControl</code>.
* Displays information in a source viewer configured with the text editor
@@ -97,7 +97,7 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
public SourceViewerInformationControl(Shell parent,boolean isResizable, String symbolicFontName, String statusFieldText) {
GridLayout layout;
GridData gd;
-
+
int shellStyle= SWT.TOOL | SWT.ON_TOP | (isResizable ? SWT.RESIZE : 0);
int textStyle= isResizable ? SWT.V_SCROLL | SWT.H_SCROLL : SWT.NONE;
@@ -197,7 +197,7 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
IDocument doc= new Document(content);
fViewer.setInput(doc);
-
+
// ensure that we can scroll enough
ensureScrollable();
@@ -357,7 +357,7 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
scrollIndex= Math.max(0, scrollIndex);
fHorizontalScrollPixel= scrollIndex;
}
-
+
/**
* Ensures that the control can be scrolled at least to
* <code>fHorizontalScrollPixel</code> and adjusts <code>fMaxWidth</code>
@@ -400,8 +400,8 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
// but never more than the configured max size (viewport size).
fMaxWidth= Math.max(0, Math.min(fMaxWidth, maxWidth - fHorizontalScrollPixel + 8));
}
-
-
+
+
/*
* @see org.eclipse.jface.text.IInformationControlExtension3#computeTrim()
* @since 3.4
@@ -414,7 +414,7 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
/**
* Adds the internal trimmings to the given trim of the shell.
- *
+ *
* @param trim the shell's trim, will be updated
* @since 3.4
*/
@@ -483,7 +483,7 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
public boolean isVisible() {
return fShell != null && !fShell.isDisposed() && fShell.isVisible();
}
-
+
/*
* @see org.eclipse.jface.text.IInformationControlExtension5#computeSizeConstraints(int, int)
* @since 3.4
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/TextChangeHover.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/TextChangeHover.java
index ce0be325848..b5b5190e369 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/TextChangeHover.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/TextChangeHover.java
@@ -61,7 +61,7 @@ public class TextChangeHover extends LineChangeHover {
}
};
}
-
+
/*
* @see org.eclipse.jface.text.information.IInformationProviderExtension2#getInformationPresenterControlCreator()
* @since 3.3
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java
index 4abd8098d4d..1cae1a27c07 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java
@@ -188,7 +188,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
private final static String DISABLE_OVERWRITE_MODE= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE;
/**
* Menu id for the overview ruler context menu.
- *
+ *
* @since 3.4
*/
public final static String DEFAULT_OVERVIEW_RULER_CONTEXT_MENU_ID= "#OverviewRulerContext"; //$NON-NLS-1$
@@ -207,7 +207,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
* The annotation preferences.
*/
private MarkerAnnotationPreferences fAnnotationPreferences;
-
+
/**
* The overview ruler of this editor.
*
@@ -218,11 +218,11 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
protected IOverviewRuler fOverviewRuler;
/**
* The overview ruler's context menu id.
- *
+ *
* @since 3.4
*/
private String fOverviewRulerContextMenuId;
-
+
/**
* Helper for accessing annotation from the perspective of this editor.
*
@@ -277,7 +277,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
*/
private boolean fIsDerivedStateValidated= false;
-
+
/*
* Workaround for IllegalAccessError thrown because we are accessing
* a protected method in a different bundle from an inner class.
@@ -286,7 +286,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
private IVerticalRuler internalGetVerticalRuler() {
return getVerticalRuler();
}
-
+
/**
* Creates a new text editor.
*/
@@ -327,10 +327,10 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
fAnnotationAccess= null;
fAnnotationPreferences= null;
-
+
fLineNumberRulerColumn= null;
fLineColumn= null;
-
+
super.dispose();
}
@@ -355,7 +355,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
protected IOverviewRuler createOverviewRuler(ISharedTextColors sharedColors) {
IOverviewRuler ruler= new OverviewRuler(getAnnotationAccess(), VERTICAL_RULER_WIDTH, sharedColors);
-
+
Iterator e= fAnnotationPreferences.getAnnotationPreferences().iterator();
while (e.hasNext()) {
AnnotationPreference preference= (AnnotationPreference) e.next();
@@ -400,7 +400,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
fSourceViewerDecorationSupport.install(getPreferenceStore());
IColumnSupport columnSupport= (IColumnSupport)getAdapter(IColumnSupport.class);
-
+
if (isLineNumberRulerVisible()) {
RulerColumnDescriptor lineNumberColumnDescriptor= RulerColumnRegistry.getDefault().getColumnDescriptor(LineNumberColumn.ID);
if (lineNumberColumnDescriptor != null)
@@ -431,16 +431,16 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
* <p>
* Subclasses may extend or replace this method.
* </p>
- *
+ *
* @since 3.4
*/
protected void createOverviewRulerContextMenu() {
if (fOverviewRulerContextMenuId == null)
fOverviewRulerContextMenuId= DEFAULT_OVERVIEW_RULER_CONTEXT_MENU_ID;
-
+
if (fOverviewRuler == null || fOverviewRuler.getControl() == null)
return;
-
+
MenuManager menuManager= new MenuManager(fOverviewRulerContextMenuId, fOverviewRulerContextMenuId);
menuManager.setRemoveAllWhenShown(true);
menuManager.addMenuListener(getContextMenuListener());
@@ -537,7 +537,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
return;
IColumnSupport columnSupport= (IColumnSupport)getAdapter(IColumnSupport.class);
-
+
// only handle visibility of the combined column, but not the number/change only state
if (show && fLineColumn == null) {
RulerColumnDescriptor lineNumberColumnDescriptor= RulerColumnRegistry.getDefault().getColumnDescriptor(LineNumberColumn.ID);
@@ -548,14 +548,14 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
fLineColumn= null;
}
}
-
+
/*
* @see org.eclipse.ui.texteditor.ITextEditorExtension3#isChangeInformationShowing()
*/
public boolean isChangeInformationShowing() {
return fLineColumn != null && fLineColumn.isShowingChangeInformation();
}
-
+
/*
* @see org.eclipse.ui.texteditor.ITextEditorExtension4#showRevisionInformation(org.eclipse.jface.text.revisions.RevisionInformation, java.lang.String)
* @since 3.2
@@ -565,7 +565,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
info.setHoverControlCreator(new RevisionHoverInformationControlCreator(false));
if (info.getInformationPresenterControlCreator() == null)
info.setInformationPresenterControlCreator(new RevisionHoverInformationControlCreator(true));
-
+
showChangeInformation(true);
if (fLineColumn != null)
fLineColumn.showRevisionInformation(info, quickDiffProviderId);
@@ -608,7 +608,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
IPreferenceStore store= getPreferenceStore();
return store != null ? store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.SHOW_RANGE_INDICATOR) : true;
}
-
+
/**
* Returns whether quick diff info should be visible upon opening an editor
* according to the preference store settings.
@@ -687,7 +687,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
protected IVerticalRuler createVerticalRuler() {
return createCompositeRuler();
}
-
+
/**
* Creates a composite ruler to be used as the vertical ruler by this editor.
@@ -699,10 +699,10 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
return new CompositeRuler();
}
-
+
/**
* Creates the annotation ruler column. Subclasses may re-implement or extend.
- *
+ *
* @param ruler the composite ruler that the column will be added
* @return an annotation ruler column
* @since 3.2
@@ -808,7 +808,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
}
return;
}
-
+
if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS.equals(property)) {
if (isTabsToSpacesConversionEnabled())
installTabsToSpacesConverter();
@@ -940,13 +940,13 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
public void gotoMarker(IMarker marker) {
if (fIsUpdatingMarkerViews)
return;
-
+
if (getSourceViewer() == null)
return;
int start= MarkerUtilities.getCharStart(marker);
int end= MarkerUtilities.getCharEnd(marker);
-
+
boolean selectLine= start < 0 || end < 0;
// look up the current range of the marker when the document has been edited
@@ -990,7 +990,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
if (end - 1 < length && start < length)
selectAndReveal(start, end - start);
}
-
+
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#isEditable()
* @since 3.3
@@ -1017,7 +1017,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
* If the given input is derived then this method
* can show a dialog asking whether to edit the
* derived file.
- *
+ *
* @return <code>true</code> if the input is OK for editing, <code>false</code> otherwise
* @since 3.3
*/
@@ -1038,7 +1038,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
IPreferenceStore store= getPreferenceStore();
if (!store.getBoolean(warnKey))
return true;
-
+
MessageDialogWithToggle toggleDialog= MessageDialogWithToggle.openYesNoQuestion(
getSite().getShell(),
TextEditorMessages.AbstractDecoratedTextEditor_warning_derived_title,
@@ -1047,7 +1047,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
false,
null,
null);
-
+
EditorsUI.getPreferenceStore().setValue(warnKey, !toggleDialog.getToggleState());
fIsDerivedStateValidated= true;
return fIsEditingDerivedFileAllowed= toggleDialog.getReturnCode() == IDialogConstants.YES_ID;
@@ -1056,29 +1056,29 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
/*
* For an explanation why we override this method see:
* bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=42230
- *
+ *
* @see org.eclipse.ui.texteditor.StatusTextEditor#isErrorStatus(org.eclipse.core.runtime.IStatus)
*/
protected boolean isErrorStatus(IStatus status) {
if (!super.isErrorStatus(status))
return false;
-
+
if (!status.isMultiStatus())
return !isReadOnlyLocalStatus(status);
-
+
IStatus[] childrenStatus= status.getChildren();
for (int i= 0; i < childrenStatus.length; i++) {
if (childrenStatus[i].getSeverity() == IStatus.ERROR && !isReadOnlyLocalStatus(childrenStatus[i]))
return true;
}
-
+
return false;
}
/**
* Check whether the given status is a <code>IResourceStatus.READ_ONLY_LOCAL</code>
* error.
- *
+ *
* @param status the status to be checked
* @return <code>true</code> if the given status is a <code>IResourceStatus.READ_ONLY_LOCAL</code> error
* @since 3.3
@@ -1145,7 +1145,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
getAction(ITextEditorActionConstants.QUICKDIFF_REVERTLINE)});
action2.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICKDIFF_REVERT);
setAction(ITextEditorActionConstants.QUICKDIFF_REVERT, action2);
-
+
action= new ResourceAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.HideRevisionInformationAction.") { //$NON-NLS-1$
public void run() {
if (fLineColumn != null)
@@ -1171,15 +1171,15 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
};
action.setActionDefinitionId(ITextEditorActionDefinitionIds.REVISION_RENDERING_CYCLE);
setAction(ITextEditorActionConstants.REVISION_RENDERING_CYCLE, action);
-
+
action= new BooleanPreferenceToggleAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ToggleRevisionAuthorAction.", IAction.AS_CHECK_BOX, EditorsUI.getPreferenceStore(), AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_AUTHOR); //$NON-NLS-1$
action.setActionDefinitionId(ITextEditorActionDefinitionIds.REVISION_AUTHOR_TOGGLE);
setAction(ITextEditorActionConstants.REVISION_SHOW_AUTHOR_TOGGLE, action);
-
+
action= new BooleanPreferenceToggleAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ToggleRevisionIdAction.", IAction.AS_CHECK_BOX, EditorsUI.getPreferenceStore(), AbstractDecoratedTextEditorPreferenceConstants.REVISION_RULER_SHOW_REVISION); //$NON-NLS-1$
action.setActionDefinitionId(ITextEditorActionDefinitionIds.REVISION_ID_TOGGLE);
setAction(ITextEditorActionConstants.REVISION_SHOW_ID_TOGGLE, action);
-
+
final Shell shell;
if (getSourceViewer() != null)
shell= getSourceViewer().getTextWidget().getShell();
@@ -1207,10 +1207,10 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
IAction showWhitespaceCharactersAction= getAction(ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS);
if (showWhitespaceCharactersAction instanceof ShowWhitespaceCharactersAction)
((ShowWhitespaceCharactersAction)showWhitespaceCharactersAction).setPreferenceStore(EditorsUI.getPreferenceStore());
-
+
setAction(ITextEditorActionConstants.REFRESH, new RefreshEditorAction(this));
markAsPropertyDependentAction(ITextEditorActionConstants.REFRESH, true);
-
+
// Override print action to provide additional options
if (getAction(ITextEditorActionConstants.PRINT).isEnabled() && getSourceViewer() instanceof ITextViewerExtension8)
createPrintAction();
@@ -1218,7 +1218,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
/**
* Creates and registers the print action.
- *
+ *
* @since 3.4
*/
private void createPrintAction() {
@@ -1242,7 +1242,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
for (int i= 0; i < options.lineLabels.length; i++)
options.lineLabels[i]= String.valueOf(JFaceTextUtil.widgetLine2ModelLine(viewer, i) + 1);
}
-
+
((ITextViewerExtension8)viewer).print(options);
}
};
@@ -1277,7 +1277,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
}
return super.getAdapter(adapter);
-
+
}
/*
@@ -1322,19 +1322,19 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
protected void doSetInput(IEditorInput input) throws CoreException {
fIsDerivedStateValidated= false;
fIsEditingDerivedFileAllowed= true;
-
+
if (fLineColumn != null)
fLineColumn.hideRevisionInformation();
super.doSetInput(input);
-
+
RulerColumnDescriptor lineNumberColumnDescriptor= RulerColumnRegistry.getDefault().getColumnDescriptor(LineNumberColumn.ID);
if (lineNumberColumnDescriptor != null) {
IColumnSupport columnSupport= (IColumnSupport)getAdapter(IColumnSupport.class);
columnSupport.setColumnVisible(lineNumberColumnDescriptor, isLineNumberRulerVisible() || isPrefQuickDiffAlwaysOn());
}
}
-
+
/**
* This implementation asks the user for the workspace path of a file resource and saves the document there.
*
@@ -1347,7 +1347,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
IDocumentProvider provider= getDocumentProvider();
final IEditorInput newInput;
-
+
if (input instanceof IURIEditorInput && !(input instanceof IFileEditorInput)) {
FileDialog dialog= new FileDialog(shell, SWT.SAVE);
IPath oldPath= URIUtil.toPath(((IURIEditorInput)input).getURI());
@@ -1355,7 +1355,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
dialog.setFileName(oldPath.lastSegment());
dialog.setFilterPath(oldPath.toOSString());
}
-
+
String path= dialog.open();
if (path == null) {
if (progressMonitor != null)
@@ -1392,13 +1392,13 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
MessageDialog.openError(shell, title, msg);
return;
}
-
+
IFile file= getWorkspaceFile(fileStore);
if (file != null)
newInput= new FileEditorInput(file);
else
newInput= new FileStoreEditorInput(fileStore);
-
+
} else {
SaveAsDialog dialog= new SaveAsDialog(shell);
@@ -1419,20 +1419,20 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
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);
newInput= new FileEditorInput(file);
}
-
+
if (provider == null) {
// editor has programmatically been closed while the dialog was open
return;
@@ -1466,7 +1466,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
* Checks whether there given file store points
* to a file in the workspace. Only returns a
* workspace file if there's a single match.
- *
+ *
* @param fileStore the file store
* @return the <code>IFile</code> that matches the given file store
* @since 3.2
@@ -1481,7 +1481,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
/**
* Sets the ruler's overview context menu id.
- *
+ *
* @param contextMenuId the overview ruler context menu id
* @since 3.4
*/
@@ -1493,7 +1493,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
/**
* Returns the ruler's overview context menu id. May return
* <code>null</code> before the editor's part has been created.
- *
+ *
* @return the ruler's context menu id which may be <code>null</code>
* @since 3.4
*/
@@ -1506,7 +1506,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
* <p>
* Subclasses may extend to add other actions.
* </p>
- *
+ *
* @param menu the menu
* @since 3.4
*/
@@ -1539,7 +1539,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
if (p.getOffset() == selection.x && p.getLength() == selection.y)
break;
}
-
+
if (annotation != null) {
AnnotationPreference ap= getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
if (ap != null)
@@ -1568,7 +1568,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
menu.add(new Separator(ITextEditorActionConstants.GROUP_REST));
super.rulerContextMenuAboutToShow(menu);
-
+
addRulerContributionActions(menu);
/* quick diff */
@@ -1599,16 +1599,16 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
menu.appendToGroup(ITextEditorActionConstants.GROUP_RESTORE, revertDeletion);
}
}
-
+
// revision info
if (fLineColumn != null && fLineColumn.isShowingRevisionInformation()) {
IMenuManager revisionMenu= new MenuManager(TextEditorMessages.AbstractDecoratedTextEditor_revisions_menu);
menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, revisionMenu);
-
+
IAction hideRevisionInfoAction= getAction(ITextEditorActionConstants.REVISION_HIDE_INFO);
revisionMenu.add(hideRevisionInfoAction);
revisionMenu.add(new Separator());
-
+
String[] labels= { TextEditorMessages.AbstractDecoratedTextEditor_revision_colors_option_by_date, TextEditorMessages.AbstractDecoratedTextEditor_revision_colors_option_by_author, TextEditorMessages.AbstractDecoratedTextEditor_revision_colors_option_by_author_and_date };
final RenderingMode[] modes= { IRevisionRulerColumnExtension.AGE, IRevisionRulerColumnExtension.AUTHOR, IRevisionRulerColumnExtension.AUTHOR_SHADED_BY_AGE};
final IPreferenceStore uiStore= EditorsUI.getPreferenceStore();
@@ -1624,7 +1624,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
action.setChecked(mode.equals(current));
revisionMenu.add(action);
}
-
+
revisionMenu.add(new Separator());
revisionMenu.add(getAction(ITextEditorActionConstants.REVISION_SHOW_AUTHOR_TOGGLE));
@@ -1639,10 +1639,10 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, new Separator(ITextEditorActionConstants.GROUP_SETTINGS));
menu.appendToGroup(ITextEditorActionConstants.GROUP_SETTINGS, preferencesAction);
}
-
+
/**
* Adds "show" actions for all contributed rulers that support it.
- *
+ *
* @param menu the ruler context menu
* @since 3.3
*/
@@ -1672,7 +1672,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, action);
}
}
-
+
/**
* Toggles the line number global preference and shows the line number ruler
* accordingly.
@@ -1712,7 +1712,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
IAction preferencesAction= getAction(ITextEditorActionConstants.CONTEXT_PREFERENCES);
menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator(ITextEditorActionConstants.GROUP_SETTINGS));
menu.appendToGroup(ITextEditorActionConstants.GROUP_SETTINGS, preferencesAction);
-
+
menu.appendToGroup(ITextEditorActionConstants.GROUP_SAVE, new Separator(ITextEditorActionConstants.GROUP_OPEN));
MenuManager showInSubMenu= new MenuManager(getShowInMenuLabel());
showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN.create(getEditorSite().getWorkbenchWindow()));
@@ -1721,20 +1721,20 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
/**
* Returns the menu label for 'Show In' together with its key binding string.
- *
+ *
* @return the 'Show In' menu label
* @since 3.2
*/
private String getShowInMenuLabel() {
String keyBinding= null;
-
+
IBindingService bindingService= (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class);
if (bindingService != null)
keyBinding= bindingService.getBestActiveBindingFormattedFor("org.eclipse.ui.navigate.showInQuickMenu"); //$NON-NLS-1$
-
+
if (keyBinding == null)
keyBinding= ""; //$NON-NLS-1$
-
+
return NLSUtility.format(TextEditorMessages.AbstractDecoratedTextEditor_showIn_menu, keyBinding);
}
@@ -1776,7 +1776,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
protected String[] collectRulerMenuPreferencePages() {
return collectContextMenuPreferencePages();
}
-
+
/**
* Returns the preference page ids of the preference pages to be shown when
* executing the preferences action from the editor overview ruler context menu.
@@ -1797,7 +1797,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
"org.eclipse.ui.editors.preferencePages.QuickDiff" //$NON-NLS-1$
};
}
-
+
/*
* @see AbstractTextEditor#getUndoRedoOperationApprover(IUndoContext)
* @since 3.1
@@ -1808,7 +1808,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
return new NonLocalUndoUserApprover(undoContext, this, new Object [] { input }, IResource.class);
return super.getUndoRedoOperationApprover(undoContext);
}
-
+
/**
* Returns whether the given annotation is configured as a target for the
* "Go to Next/Previous Annotation" actions.
@@ -1828,7 +1828,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
String key= preference == null ? null : preference.getIsGoToNextNavigationTargetKey();
return (key != null && getPreferenceStore().getBoolean(key));
}
-
+
/**
* {@inheritDoc}
* <p>
@@ -1850,7 +1850,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
* If the given annotation can be associated with a marker then this method tries select the
* this marker in views that show markers.
* </p>
- *
+ *
* @param annotation the annotation
* @since 3.2
*/
@@ -1858,7 +1858,7 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor {
IMarker marker= null;
if (annotation instanceof MarkerAnnotation)
marker= ((MarkerAnnotation)annotation).getMarker();
-
+
if (marker != null) {
try {
fIsUpdatingMarkerViews= true;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java
index e14099f8b2e..e0fb8c71a74 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java
@@ -22,12 +22,13 @@ import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter;
import org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension;
-import org.eclipse.ui.editors.text.EditorsUI;
-
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
import org.eclipse.ui.internal.editors.text.EditorsPluginPreferenceInitializer;
+
import org.eclipse.ui.texteditor.spelling.SpellingService;
+import org.eclipse.ui.editors.text.EditorsUI;
+
/**
* Preference constants used in the extended text editor preference store.
@@ -356,7 +357,7 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
* @since 3.1
*/
public static final String EDITOR_DISABLE_OVERWRITE_MODE= "disable_overwrite_mode"; //$NON-NLS-1$
-
+
/**
* A named preference that controls whether a confirmation
* dialog is shown before editing derived input.
@@ -367,7 +368,7 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
* @since 3.3
*/
public static final String EDITOR_WARN_IF_INPUT_DERIVED= "warn_if_input_derived"; //$NON-NLS-1$
-
+
/**
* A named preference that controls if smart home/end navigation is on or off
* <p>
@@ -404,7 +405,7 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
* <p>
* Value is of type <code>String</code>.
* </p>
- *
+ *
* @since 3.2
*/
public static final String REVISION_ASK_BEFORE_QUICKDIFF_SWITCH= "quickdiff.nowarn.before.switch"; //$NON-NLS-1$
@@ -415,7 +416,7 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
* Value is of type <code>String</code> and should contain the name of a
* {@link org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension.RenderingMode}.
* </p>
- *
+ *
* @since 3.3
*/
public static final String REVISION_RULER_RENDERING_MODE= "revisionRulerRenderingMode"; //$NON-NLS-1$
@@ -425,7 +426,7 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
* <p>
* Value is of type <code>Boolean</code>.
* </p>
- *
+ *
* @since 3.3
*/
public static final String REVISION_RULER_SHOW_AUTHOR= "revisionRulerShowAuthor"; //$NON-NLS-1$
@@ -435,11 +436,11 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
* <p>
* Value is of type <code>Boolean</code>.
* </p>
- *
+ *
* @since 3.3
*/
public static final String REVISION_RULER_SHOW_REVISION= "revisionRulerShowRevision"; //$NON-NLS-1$
-
+
/**
* A named preference that controls whether text drag and drop is enabled.
* <p>
@@ -449,13 +450,13 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
* @since 3.3
*/
public static final String EDITOR_TEXT_DRAG_AND_DROP_ENABLED= AbstractTextEditor.PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED;
-
+
/**
* A named preference that defines whether the hint to make hover sticky should be shown.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
- *
+ *
* @since 3.3
*/
public static final String EDITOR_SHOW_TEXT_HOVER_AFFORDANCE= "showTextHoverAffordance"; //$NON-NLS-1$
@@ -473,11 +474,11 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
* <li>1: {@link org.eclipse.jface.text.ITextViewerExtension8.EnrichMode#IMMEDIATELY},</li>
* <li>2: {@link org.eclipse.jface.text.ITextViewerExtension8.EnrichMode#ON_CLICK}.</li>
* </ul>
- *
+ *
* @since 3.4
*/
public static final String EDITOR_HOVER_ENRICH_MODE= AbstractTextEditor.PREFERENCE_HOVER_ENRICH_MODE;
-
+
/**
* Initializes the given preference store with the default values.
*
@@ -496,7 +497,7 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, false);
store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 80);
-
+
store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, false);
if (!store.getBoolean(USE_QUICK_DIFF_PREFERENCE_PAGE)) {
@@ -518,14 +519,14 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_DEFAULT_COLOR, true);
store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true);
-
+
store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, true);
-
+
String mod1Name= Action.findModifierString(SWT.MOD1); // SWT.COMMAND on MAC; SWT.CONTROL elsewhere
store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED, true);
store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_KEY_MODIFIER, mod1Name);
store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_KEY_MODIFIER_MASK, SWT.MOD1);
-
+
HyperlinkDetectorDescriptor[] descriptors= EditorsUI.getHyperlinkDetectorRegistry().getHyperlinkDetectorDescriptors();
for (int i= 0; i < descriptors.length; i++) {
int stateMask= computeStateMask(descriptors[i].getModifierKeys());
@@ -545,10 +546,10 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
boolean isInstalled= EditorsUI.getSpellingService().getSpellingEngineDescriptors().length > 0;
store.setDefault(SpellingService.PREFERENCE_SPELLING_ENABLED, !isInTestMode && isInstalled);
store.setDefault(SpellingService.PREFERENCE_SPELLING_ENGINE, ""); //$NON-NLS-1$
-
+
store.setDefault(SHOW_RANGE_INDICATOR, true);
store.setDefault(REVISION_ASK_BEFORE_QUICKDIFF_SWITCH, ""); //$NON-NLS-1$
-
+
store.setDefault(AbstractTextEditor.PREFERENCE_RULER_CONTRIBUTIONS, ""); //$NON-NLS-1$
store.setDefault(REVISION_RULER_RENDERING_MODE, IRevisionRulerColumnExtension.AGE.name());
store.setDefault(REVISION_RULER_SHOW_AUTHOR, false);
@@ -560,12 +561,12 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
store.setDefault(EDITOR_TEXT_DRAG_AND_DROP_ENABLED, true);
store.setDefault(EDITOR_SHOW_TEXT_HOVER_AFFORDANCE, true);
store.setDefault(EDITOR_HOVER_ENRICH_MODE, 0);
-
+
MarkerAnnotationPreferences.initializeDefaultValues(store);
-
+
EditorsPluginPreferenceInitializer.setThemeBasedPreferences(store, false);
}
-
+
/**
* Computes the state mask out of the given modifiers string.
*
@@ -622,5 +623,5 @@ public class AbstractDecoratedTextEditorPreferenceConstants {
return SWT.NONE;
}
-
+
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java
index c858c82760f..f30cad5216a 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java
@@ -16,9 +16,6 @@ import java.util.List;
import org.osgi.framework.Bundle;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResourceStatus;
-
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -28,6 +25,9 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResourceStatus;
+
import org.eclipse.core.filebuffers.IPersistableAnnotationModel;
import org.eclipse.jface.text.BadLocationException;
@@ -37,10 +37,10 @@ import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationModel;
import org.eclipse.jface.text.source.IAnnotationMap;
-import org.eclipse.ui.editors.text.EditorsUI;
-
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.editors.text.EditorsUI;
+
/**
* Abstract implementation of a marker-based annotation model.
@@ -477,7 +477,7 @@ public abstract class AbstractMarkerAnnotationModel extends AnnotationModel impl
* <p>
* <strong>Note:</strong> This implementation queries the registered
* {@linkplain IMarkerUpdater}s. If any of these updaters returns
- * <code>false</code> this method also returns <code>false</code>.
+ * <code>false</code> this method also returns <code>false</code>.
* </p>
*
* @param marker the marker to be updated
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java
index 73d27ba1300..e9fb07a03e9 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java
@@ -130,10 +130,10 @@ public class AddMarkerAction extends TextEditorAction {
if (!askForLabel(attributes))
return;
}
-
+
String name= getToolTipText();
name= name == null ? TextEditorMessages.AddMarkerAction_addMarker : name;
-
+
final Shell shell= getTextEditor().getSite().getShell();
IAdaptable context= new IAdaptable() {
public Object getAdapter(Class adapter) {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationPreferenceLookup.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationPreferenceLookup.java
index c80e4eb6c7c..92cabad1709 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationPreferenceLookup.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationPreferenceLookup.java
@@ -17,7 +17,9 @@ import java.util.Map;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
-import org.eclipse.ui.internal.texteditor.*;
+import org.eclipse.ui.internal.texteditor.AnnotationType;
+import org.eclipse.ui.internal.texteditor.AnnotationTypeHierarchy;
+import org.eclipse.ui.internal.texteditor.DelegatingAnnotationPreference;
/**
* Provides the strategy for finding the annotation preference for a given
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java
index eebc259dddf..d0ae78514f8 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java
@@ -15,11 +15,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.resources.IMarker;
+
import org.eclipse.jface.resource.StringConverter;
import org.eclipse.ui.editors.text.EditorsUI;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BasicMarkerUpdater.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BasicMarkerUpdater.java
index c48fcf516d6..84e1e208e43 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BasicMarkerUpdater.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/BasicMarkerUpdater.java
@@ -10,12 +10,12 @@
*******************************************************************************/
package org.eclipse.ui.texteditor;
+import org.eclipse.core.resources.IMarker;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
-import org.eclipse.core.resources.IMarker;
-
/**
* Updates a marker's positional attributes which are
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChangeEncodingAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChangeEncodingAction.java
index 87d6c238efb..84dd3997763 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChangeEncodingAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChangeEncodingAction.java
@@ -30,12 +30,12 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceStore;
-import org.eclipse.ui.editors.text.IEncodingSupport;
-
import org.eclipse.ui.ide.dialogs.AbstractEncodingFieldEditor;
import org.eclipse.ui.ide.dialogs.EncodingFieldEditor;
import org.eclipse.ui.ide.dialogs.ResourceEncodingFieldEditor;
+import org.eclipse.ui.editors.text.IEncodingSupport;
+
/**
* Action for changing the encoding of the editor's
* input element.
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultMarkerAnnotationAccess.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultMarkerAnnotationAccess.java
index ab3bf90338e..1485f1222e8 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultMarkerAnnotationAccess.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DefaultMarkerAnnotationAccess.java
@@ -119,14 +119,14 @@ public class DefaultMarkerAnnotationAccess implements IAnnotationAccess, IAnnota
/**
* An optional quick assist processor.
- *
+ *
* @since 3.2
*/
private IQuickAssistAssistant fQuickAssistAssistant;
/**
* Returns a new default marker annotation access with the given preferences.
- *
+ *
* @param markerAnnotationPreferences the marker annotation preference
* @deprecated As of 3.0, replaced by
* {@link org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess#DefaultMarkerAnnotationAccess()}
@@ -178,17 +178,17 @@ public class DefaultMarkerAnnotationAccess implements IAnnotationAccess, IAnnota
/**
* {@inheritDoc}
- *
+ *
* @deprecated use <code>Annotation.getType()</code>
*/
-
+
public Object getType(Annotation annotation) {
return annotation.getType();
}
/**
* {@inheritDoc}
- *
+ *
* @deprecated assumed to always return <code>true</code>
*/
public boolean isMultiLine(Annotation annotation) {
@@ -197,7 +197,7 @@ public class DefaultMarkerAnnotationAccess implements IAnnotationAccess, IAnnota
/**
* {@inheritDoc}
- *
+ *
* @deprecated assumed to always return <code>true</code>
*/
public boolean isTemporary(Annotation annotation) {
@@ -222,11 +222,11 @@ public class DefaultMarkerAnnotationAccess implements IAnnotationAccess, IAnnota
IAnnotationPresentation presentation= (IAnnotationPresentation) annotation;
return presentation.getLayer();
}
-
+
AnnotationPreference preference= getAnnotationPreference(annotation);
if (preference != null)
return preference.getPresentationLayer();
-
+
// backward compatibility, ignore exceptions, just return default layer
try {
@@ -332,7 +332,7 @@ public class DefaultMarkerAnnotationAccess implements IAnnotationAccess, IAnnota
* defined in {@link org.eclipse.ui.ISharedImages}.
* <p>
* The symbolic image name must be one of the
- *
+ *
* @param symbolicImageName the symbolic image name, which must be one of
* the valid values defined for the <code>symbolicIcon</code>
* attribute in the
@@ -423,7 +423,7 @@ public class DefaultMarkerAnnotationAccess implements IAnnotationAccess, IAnnota
* Checks whether there's a quick assist assistant and if so,
* whether the assistant has a possible fix for the given
* annotation.
- *
+ *
* @param annotation the annotation
* @return <code>true</code> if there is quick fix
* @since 3.2
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DocumentProviderRegistry.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DocumentProviderRegistry.java
index 0c36b998be6..f37a93a5729 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DocumentProviderRegistry.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/DocumentProviderRegistry.java
@@ -22,7 +22,6 @@ import java.util.StringTokenizer;
import org.osgi.framework.Bundle;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
@@ -31,12 +30,14 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.core.resources.IFile;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.editors.text.NLSUtility;
+import org.eclipse.ui.editors.text.EditorsUI;
+
/**
* This registry manages shared document providers. Document
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/IMarkerUpdater.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/IMarkerUpdater.java
index b97a8d99a62..aff37359f48 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/IMarkerUpdater.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/IMarkerUpdater.java
@@ -10,11 +10,11 @@
*******************************************************************************/
package org.eclipse.ui.texteditor;
+import org.eclipse.core.resources.IMarker;
+
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
-import org.eclipse.core.resources.IMarker;
-
/**
* A marker updater is responsible for saving changes to markers.
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java
index 94a0e6eb98b..3a90c7c03be 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotation.java
@@ -129,7 +129,7 @@ public class MarkerAnnotation extends SimpleMarkerAnnotation implements IQuickFi
*/
private boolean fIsQuickFixableStateSet;
-
+
/**
* Creates a new annotation for the given marker.
*
@@ -325,7 +325,7 @@ public class MarkerAnnotation extends SimpleMarkerAnnotation implements IQuickFi
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public void setQuickFixable(boolean state) {
@@ -335,7 +335,7 @@ public class MarkerAnnotation extends SimpleMarkerAnnotation implements IQuickFi
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public boolean isQuickFixableStateSet() {
@@ -344,7 +344,7 @@ public class MarkerAnnotation extends SimpleMarkerAnnotation implements IQuickFi
/**
* {@inheritDoc}
- *
+ *
* @since 3.4
*/
public boolean isQuickFixable() {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java
index fb04331518a..b28583e11be 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java
@@ -36,10 +36,10 @@ import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.StringConverter;
-import org.eclipse.ui.editors.text.EditorsUI;
-
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
+import org.eclipse.ui.editors.text.EditorsUI;
+
/**
* Objects of this class provide access to all extensions declared for the <code>markerAnnotationSpecification</code> extension point.
@@ -230,7 +230,7 @@ public class MarkerAnnotationPreferences {
* Creates a new marker annotation preferences to access
* marker annotation preferences.
* @param initFromPreferences tells this instance to initialize itself from the preferences
- *
+ *
* @since 3.2
*/
private MarkerAnnotationPreferences(boolean initFromPreferences) {
@@ -275,7 +275,7 @@ public class MarkerAnnotationPreferences {
fFragments= cloneAnnotationPreferences(sharedPrefs.fFragments);
fPreferences= cloneAnnotationPreferences(sharedPrefs.fPreferences);
}
-
+
/**
* Reads all extensions provided for the <code>markerAnnotationSpecification</code> extension point and
* translates them into <code>AnnotationPreference</code> objects.
@@ -327,10 +327,10 @@ public class MarkerAnnotationPreferences {
}
});
}
-
+
/**
* Deeply clones the given list of <code>AnnotationPreference</code>.
- *
+ *
* @param annotationPreferences a list of <code>AnnotationPreference</code>
* @return the cloned list of cloned annotation preferences
* @since 3.1
@@ -344,10 +344,10 @@ public class MarkerAnnotationPreferences {
clone.add(clone(((AnnotationPreference)iter.next())));
return clone;
}
-
+
/**
* Clones the given annotation preference.
- *
+ *
* @param annotationPreference the annotation preference to clone
* @return the cloned annotation preference
* @since 3.1
@@ -355,13 +355,13 @@ public class MarkerAnnotationPreferences {
private AnnotationPreference clone(AnnotationPreference annotationPreference) {
if (annotationPreference == null)
return null;
-
+
AnnotationPreference clone= new AnnotationPreference();
if (annotationPreference.getAnnotationType() != null) {
clone.setAnnotationType(annotationPreference.getAnnotationType());
clone.merge(annotationPreference);
}
-
+
return clone;
}
@@ -512,7 +512,7 @@ public class MarkerAnnotationPreferences {
s= element.getAttribute("icon"); //$NON-NLS-1$
if (s != null && s.trim().length() > 0)
info.setImageDescriptor(getImageDescriptor(s, element));
-
+
s= element.getAttribute("quickFixIcon"); //$NON-NLS-1$
if (s != null && s.trim().length() > 0)
info.setQuickFixImageDescriptor(getImageDescriptor(s, element));
@@ -544,7 +544,7 @@ public class MarkerAnnotationPreferences {
info.setIncludeOnPreferencePage(s == null || StringConverter.asBoolean(s, true));
info.markReadOnly();
-
+
return info;
}
@@ -566,7 +566,7 @@ public class MarkerAnnotationPreferences {
URL url= FileLocator.find(bundle, new Path(iconPath), null);
if (url != null)
return ImageDescriptor.createFromURL(url);
-
+
return ImageDescriptor.getMissingImageDescriptor();
}
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java
index 26f76756e9a..884247a1622 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java
@@ -107,7 +107,7 @@ public class MarkerRulerAction extends ResourceAction implements IUpdate {
public MarkerRulerAction(ResourceBundle bundle, String prefix, ITextEditor editor, IVerticalRulerInfo ruler, String markerType, boolean askForLabel) {
super(bundle, prefix);
Assert.isLegal(editor != null);
-
+
fRuler= ruler;
fTextEditor= editor;
fMarkerType= markerType;
@@ -207,7 +207,7 @@ public class MarkerRulerAction extends ResourceAction implements IUpdate {
/**
* Returns whether the given markers are all editable by the user.
- *
+ *
* @param markers the list of markers to test
* @return boolean <code>true</code> if they are all editable
* @since 3.2
@@ -223,7 +223,7 @@ public class MarkerRulerAction extends ResourceAction implements IUpdate {
/**
* Returns whether the given marker is editable by the user.
- *
+ *
* @param marker the marker to test
* @return boolean <code>true</code> if it is editable
* @since 3.2
@@ -488,7 +488,7 @@ public class MarkerRulerAction extends ResourceAction implements IUpdate {
/**
* Returns the name to be used for the operation.
- *
+ *
* @return the operation name
* @since 3.3
*/
@@ -499,7 +499,7 @@ public class MarkerRulerAction extends ResourceAction implements IUpdate {
/**
* Execute the specified undoable operation.
- *
+ *
* @param operation the operation to execute
* @since 3.3
*/
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerInfoAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerInfoAction.java
index 3b5a7285ad3..6cf7951d755 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerInfoAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerInfoAction.java
@@ -11,6 +11,7 @@
package org.eclipse.ui.texteditor;
import java.util.ResourceBundle;
+
import org.eclipse.jface.text.source.IVerticalRulerInfo;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java
index 2395d26ecc4..6f397a2f6b7 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java
@@ -17,11 +17,6 @@ import java.util.Map;
import org.osgi.framework.Bundle;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
@@ -30,6 +25,12 @@ import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+
import org.eclipse.ui.PlatformUI;
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MessageRegion.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MessageRegion.java
index 7369f13d6ac..0ac361633e0 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MessageRegion.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MessageRegion.java
@@ -58,7 +58,7 @@ class MessageRegion {
/**
* Create the contents for the receiver.
- *
+ *
* @param parent the Composite that the children will be created in
*/
public void createContents(Composite parent) {
@@ -97,7 +97,7 @@ class MessageRegion {
/**
* Set the layoutData for the messageArea. In most cases this will be a copy of the layoutData
* used in setTitleLayoutData.
- *
+ *
* @param layoutData the layoutData for the message area composite.
*/
public void setMessageLayoutData(Object layoutData) {
@@ -107,7 +107,7 @@ class MessageRegion {
/**
* Show the new message in the message text and update the image. Base the background color on
* whether or not there are errors.
- *
+ *
* @param newMessage The new value for the message
* @param newType One of the IMessageProvider constants. If newType is IMessageProvider.NONE
* show the title.
@@ -170,7 +170,7 @@ class MessageRegion {
/**
* Set the colors of the message area.
- *
+ *
* @param color the color to be use in the message area.
*/
private void setMessageColors(Color color) {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ReadOnlyAnnotationPreference.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ReadOnlyAnnotationPreference.java
index 81267b4bfde..56b30686fe7 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ReadOnlyAnnotationPreference.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ReadOnlyAnnotationPreference.java
@@ -22,9 +22,9 @@ import org.eclipse.jface.resource.ImageDescriptor;
* is allowed.
* <p>
* In the read-only state a {@link UnsupportedOperationException}
- * is thrown by methods that modify the preference.
+ * is thrown by methods that modify the preference.
* </p>
- *
+ *
* @since 3.2
*/
class ReadOnlyAnnotationPreference extends AnnotationPreference {
@@ -239,5 +239,5 @@ class ReadOnlyAnnotationPreference extends AnnotationPreference {
public void markReadOnly() {
fIsReadOnly= true;
}
-
+
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java
index e88b11c012a..3cf258bd20b 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ResourceMarkerAnnotationModel.java
@@ -94,7 +94,7 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
if (markerDeltas.length == 0)
return;
-
+
if (markerDeltas.length == 1) {
IMarkerDelta delta= markerDeltas[0];
switch (delta.getKind()) {
@@ -110,7 +110,7 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
}
} else
batchedUpdate(markerDeltas);
-
+
fireModelChanged();
}
@@ -140,14 +140,14 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
if (modifiedMarkers.isEmpty() && removedMarkers.isEmpty())
return;
-
+
Iterator e= getAnnotationIterator(false);
while (e.hasNext()) {
Object o= e.next();
if (o instanceof MarkerAnnotation) {
MarkerAnnotation a= (MarkerAnnotation)o;
IMarker marker= a.getMarker();
-
+
if (removedMarkers.remove(marker))
removeAnnotation(a, false);
@@ -158,10 +158,10 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
modifyAnnotationPosition(a, p, false);
}
}
-
+
if (modifiedMarkers.isEmpty() && removedMarkers.isEmpty())
return;
-
+
}
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/RevisionHoverInformationControlCreator.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/RevisionHoverInformationControlCreator.java
index f4ad4a4b8b6..f5baea48dd6 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/RevisionHoverInformationControlCreator.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/RevisionHoverInformationControlCreator.java
@@ -26,7 +26,7 @@ import org.eclipse.ui.editors.text.EditorsUI;
/**
* The revision information control creator that can show the tool tip affordance.
- *
+ *
* @since 3.3
*/
class RevisionHoverInformationControlCreator extends AbstractReusableInformationControlCreator {
@@ -62,8 +62,8 @@ class RevisionHoverInformationControlCreator extends AbstractReusableInformation
"var { font-style: italic }\n" + //$NON-NLS-1$
"th { font-weight: bold }\n" + //$NON-NLS-1$
""; //$NON-NLS-1$
-
-
+
+
private static final class RevisionInformationControl extends BrowserInformationControl {
public RevisionInformationControl(Shell parent, String statusFieldText) {
@@ -76,7 +76,7 @@ class RevisionHoverInformationControlCreator extends AbstractReusableInformation
/**
* {@inheritDoc}
- *
+ *
* @deprecated use {@link #setInput(Object)}
*/
public void setInformation(String content) {
@@ -87,7 +87,7 @@ class RevisionHoverInformationControlCreator extends AbstractReusableInformation
/**
* Adds a HTML header and CSS info if <code>html</code> is only an HTML fragment (has no
* &lt;html&gt; section).
- *
+ *
* @param html the html / text produced by a revision
* @return modified html
*/
@@ -104,11 +104,11 @@ class RevisionHoverInformationControlCreator extends AbstractReusableInformation
return info.toString();
}
}
-
+
private boolean fIsFocusable;
-
+
public RevisionHoverInformationControlCreator(boolean isFocusable) {
fIsFocusable= isFocusable;
}
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
index 13034a09f4c..162fa1b642c 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SelectMarkerRulerAction.java
@@ -124,27 +124,27 @@ public class SelectMarkerRulerAction extends ResourceAction implements IUpdate {
IWorkbenchPage page= fTextEditor.getSite().getPage();
MarkerViewUtil.showMarker(page, marker, false);
-
+
gotoMarker(marker);
}
-
+
private void gotoMarker(IMarker marker) {
-
+
// Use the provided adapter if any
IGotoMarker gotoMarkerAdapter= (IGotoMarker)fTextEditor.getAdapter(IGotoMarker.class);
if (gotoMarkerAdapter != null) {
gotoMarkerAdapter.gotoMarker(marker);
return;
}
-
+
int start= MarkerUtilities.getCharStart(marker);
int end= MarkerUtilities.getCharEnd(marker);
-
- boolean selectLine= start < 0 || end < 0;
+
+ boolean selectLine= start < 0 || end < 0;
IDocumentProvider documentProvider= fTextEditor.getDocumentProvider();
IEditorInput editorInput= fTextEditor.getEditorInput();
-
+
// look up the current range of the marker when the document has been edited
IAnnotationModel model= documentProvider.getAnnotationModel(editorInput);
if (model instanceof AbstractMarkerAnnotationModel) {
@@ -185,7 +185,7 @@ public class SelectMarkerRulerAction extends ResourceAction implements IUpdate {
if (end - 1 < length && start < length)
fTextEditor.selectAndReveal(start, end - start);
}
-
+
/**
* Chooses the marker with the highest layer. If there are multiple
@@ -353,7 +353,7 @@ public class SelectMarkerRulerAction extends ResourceAction implements IUpdate {
/**
* Log status.
- *
+ *
* @param status the status to log
* @since 3.4
*/
@@ -396,7 +396,7 @@ public class SelectMarkerRulerAction extends ResourceAction implements IUpdate {
final int activeLine= fRuler.getLineOfLastMouseButtonActivity();
if (activeLine == -1)
return Collections.EMPTY_LIST;
-
+
Iterator it;
try {
IRegion line= document.getLineInformation(activeLine);
@@ -404,10 +404,10 @@ public class SelectMarkerRulerAction extends ResourceAction implements IUpdate {
} catch (BadLocationException e) {
Bundle bundle= Platform.getBundle(PlatformUI.PLUGIN_ID);
Platform.getLog(bundle).log(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, e.getLocalizedMessage(), e));
-
+
it= model.getAnnotationIterator();
}
-
+
List markers= null;
while (it.hasNext()) {
Annotation annotation= (Annotation) it.next();
@@ -462,7 +462,7 @@ public class SelectMarkerRulerAction extends ResourceAction implements IUpdate {
final int activeLine= fRuler.getLineOfLastMouseButtonActivity();
if (activeLine == -1)
return false;
-
+
Iterator it;
try {
IRegion line= document.getLineInformation(activeLine);
@@ -471,7 +471,7 @@ public class SelectMarkerRulerAction extends ResourceAction implements IUpdate {
logException(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, e.getLocalizedMessage(), e));
it= model.getAnnotationIterator();
}
-
+
while (it.hasNext()) {
Annotation annotation= (Annotation) it.next();
if (annotation instanceof MarkerAnnotation) {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SimpleMarkerAnnotation.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SimpleMarkerAnnotation.java
index be969742f38..4529cd26a4a 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SimpleMarkerAnnotation.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/SimpleMarkerAnnotation.java
@@ -13,7 +13,9 @@ package org.eclipse.ui.texteditor;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.resources.IMarker;
+
import org.eclipse.jface.text.source.Annotation;
+
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
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
index 5a268f1fdaf..0088a298d5f 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TaskRulerAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TaskRulerAction.java
@@ -19,6 +19,7 @@ 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;
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
index 8a27619319f..ca0de82a3cb 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/TextEditorMessages.java
@@ -66,11 +66,11 @@ final class TextEditorMessages extends NLS {
public static String AbstractDecoratedTextEditor_warning_derived_title;
public static String AbstractDecoratedTextEditor_warning_derived_message;
public static String AbstractDecoratedTextEditor_warning_derived_dontShowAgain;
-
+
public static String AbstractDecoratedTextEditor_showIn_menu;
public static String AbstractDecoratedTextEditor_printPageNumber;
-
-
+
+
static {
NLS.initializeMessages(BUNDLE_NAME, TextEditorMessages.class);
}
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
index 6f49c19f21b..5a1d0badb54 100644
--- 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
@@ -11,10 +11,20 @@
package org.eclipse.ui.examples.javaeditor;
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.*;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchActionConstants;
+
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+import org.eclipse.ui.texteditor.RetargetTextEditorAction;
+import org.eclipse.ui.texteditor.TextEditorAction;
+
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.
@@ -31,33 +41,33 @@ public class JavaActionContributor extends TextEditorActionContributor {
public JavaActionContributor() {
super();
fContentAssistProposal= new RetargetTextEditorAction(JavaEditorMessages.getResourceBundle(), "ContentAssistProposal."); //$NON-NLS-1$
- fContentAssistProposal.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ 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);
@@ -71,7 +81,7 @@ public class JavaActionContributor extends TextEditorActionContributor {
fTogglePresentation.setEditor(editor);
fTogglePresentation.update();
}
-
+
/*
* @see IEditorActionBarContributor#setActiveEditor(IEditorPart)
*/
@@ -79,7 +89,7 @@ public class JavaActionContributor extends TextEditorActionContributor {
super.setActiveEditor(part);
doSetActiveEditor(part);
}
-
+
/*
* @see IEditorActionBarContributor#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
index 3ad829e77c2..511478a74c6 100644
--- 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
@@ -11,14 +11,16 @@
package org.eclipse.ui.examples.javaeditor;
-import org.eclipse.jface.text.*;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
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)
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
index 2cc0bb7a5c4..1bb39e25765 100644
--- 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
@@ -15,13 +15,28 @@ 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.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.BadPositionCategoryException;
+import org.eclipse.jface.text.DefaultPositionUpdater;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IPositionUpdater;
+import org.eclipse.jface.text.Position;
+
+import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+
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
@@ -165,7 +180,7 @@ public class JavaContentOutlinePage extends ContentOutlinePage {
/**
* Creates a content outline page using the given provider and the given editor.
- *
+ *
* @param provider the document provider
* @param editor the editor
*/
@@ -174,7 +189,7 @@ public class JavaContentOutlinePage extends ContentOutlinePage {
fDocumentProvider= provider;
fTextEditor= editor;
}
-
+
/* (non-Javadoc)
* Method declared on ContentOutlinePage
*/
@@ -190,7 +205,7 @@ public class JavaContentOutlinePage extends ContentOutlinePage {
if (fInput != null)
viewer.setInput(fInput);
}
-
+
/* (non-Javadoc)
* Method declared on ContentOutlinePage
*/
@@ -212,17 +227,17 @@ public class JavaContentOutlinePage extends ContentOutlinePage {
}
}
}
-
+
/**
* Sets the input of the outline page
- *
+ *
* @param input the input of this outline page
*/
public void setInput(Object input) {
fInput= input;
update();
}
-
+
/**
* Updates the outline page.
*/
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentSetupParticipant.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentSetupParticipant.java
index 84586ca81b8..ceb1564dc8d 100644
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentSetupParticipant.java
+++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentSetupParticipant.java
@@ -18,10 +18,10 @@ import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.rules.FastPartitioner;
/**
- *
+ *
*/
public class JavaDocumentSetupParticipant implements IDocumentSetupParticipant {
-
+
/**
*/
public JavaDocumentSetupParticipant() {
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
index 62783e1672b..53de941520e 100644
--- 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
@@ -13,11 +13,11 @@ package org.eclipse.ui.examples.javaeditor;
import java.util.ResourceBundle;
+import org.eclipse.swt.widgets.Composite;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.widgets.Composite;
-
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.ISelection;
@@ -37,30 +37,32 @@ import org.eclipse.jface.text.source.projection.ProjectionSupport;
import org.eclipse.jface.text.source.projection.ProjectionViewer;
import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.TextEditorAction;
import org.eclipse.ui.texteditor.TextOperationAction;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+import org.eclipse.ui.editors.text.TextEditor;
/**
* Java specific text editor.
*/
public class JavaEditor extends TextEditor {
-
-
+
+
private class DefineFoldingRegionAction extends TextEditorAction {
public DefineFoldingRegionAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
super(bundle, prefix, editor);
}
-
+
private IAnnotationModel getAnnotationModel(ITextEditor editor) {
return (IAnnotationModel) editor.getAdapter(ProjectionAnnotationModel.class);
}
-
+
/*
* @see org.eclipse.jface.action.Action#run()
*/
@@ -72,10 +74,10 @@ public class JavaEditor extends TextEditor {
if (!textSelection.isEmpty()) {
IAnnotationModel model= getAnnotationModel(editor);
if (model != null) {
-
+
int start= textSelection.getStartLine();
int end= textSelection.getEndLine();
-
+
try {
IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput());
int offset= document.getLineOffset(start);
@@ -102,28 +104,28 @@ public class JavaEditor extends TextEditor {
public JavaEditor() {
super();
}
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method extend the
+
+ /** 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$
-
+
a= new DefineFoldingRegionAction(JavaEditorMessages.getResourceBundle(), "DefineFoldingRegion.", this); //$NON-NLS-1$
setAction("DefineFoldingRegion", a); //$NON-NLS-1$
}
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method performs any extra
+
+ /** The <code>JavaEditor</code> implementation of this
+ * <code>AbstractTextEditor</code> method performs any extra
* disposal actions required by the java editor.
*/
public void dispose() {
@@ -131,9 +133,9 @@ public class JavaEditor extends TextEditor {
fOutlinePage.setInput(null);
super.dispose();
}
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method performs any extra
+
+ /** The <code>JavaEditor</code> implementation of this
+ * <code>AbstractTextEditor</code> method performs any extra
* revert behavior required by the java editor.
*/
public void doRevertToSaved() {
@@ -141,11 +143,11 @@ public class JavaEditor extends TextEditor {
if (fOutlinePage != null)
fOutlinePage.update();
}
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method performs any extra
+
+ /** The <code>JavaEditor</code> implementation of this
+ * <code>AbstractTextEditor</code> method performs any extra
* save behavior required by the java editor.
- *
+ *
* @param monitor the progress monitor
*/
public void doSave(IProgressMonitor monitor) {
@@ -153,9 +155,9 @@ public class JavaEditor extends TextEditor {
if (fOutlinePage != null)
fOutlinePage.update();
}
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method performs any extra
+
+ /** 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() {
@@ -163,20 +165,20 @@ public class JavaEditor extends TextEditor {
if (fOutlinePage != null)
fOutlinePage.update();
}
-
- /** The <code>JavaEditor</code> implementation of this
- * <code>AbstractTextEditor</code> method performs sets the
+
+ /** The <code>JavaEditor</code> implementation of this
+ * <code>AbstractTextEditor</code> method performs sets the
* input of the outline page after AbstractTextEditor has set input.
- *
+ *
* @param input the editor input
* @throws CoreException in case the input can not be set
- */
+ */
public void doSetInput(IEditorInput input) throws CoreException {
super.doSetInput(input);
if (fOutlinePage != null)
fOutlinePage.setInput(input);
}
-
+
/*
* @see org.eclipse.ui.texteditor.ExtendedTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
*/
@@ -186,15 +188,15 @@ public class JavaEditor extends TextEditor {
addAction(menu, "ContentAssistTip"); //$NON-NLS-1$
addAction(menu, "DefineFoldingRegion"); //$NON-NLS-1$
}
-
- /** The <code>JavaEditor</code> implementation of this
+
+ /** The <code>JavaEditor</code> implementation of this
* <code>AbstractTextEditor</code> method performs gets
- * the java content outline page if request is for a an
+ * the java content outline page if request is for a an
* outline page.
- *
+ *
* @param required the required type
* @return an adapter for the required type or <code>null</code>
- */
+ */
public Object getAdapter(Class required) {
if (IContentOutlinePage.class.equals(required)) {
if (fOutlinePage == null) {
@@ -204,16 +206,16 @@ public class JavaEditor extends TextEditor {
}
return fOutlinePage;
}
-
+
if (fProjectionSupport != null) {
Object adapter= fProjectionSupport.getAdapter(getSourceViewer(), required);
if (adapter != null)
return adapter;
}
-
+
return super.getAdapter(required);
}
-
+
/* (non-Javadoc)
* Method declared on AbstractTextEditor
*/
@@ -221,22 +223,22 @@ public class JavaEditor extends TextEditor {
super.initializeEditor();
setSourceViewerConfiguration(new JavaSourceViewerConfiguration());
}
-
+
/*
* @see org.eclipse.ui.texteditor.ExtendedTextEditor#createSourceViewer(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.source.IVerticalRuler, int)
*/
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
-
+
fAnnotationAccess= createAnnotationAccess();
fOverviewRuler= createOverviewRuler(getSharedColors());
-
+
ISourceViewer viewer= new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
// ensure decoration support has been created and configured.
getSourceViewerDecorationSupport(viewer);
-
+
return viewer;
}
-
+
/*
* @see org.eclipse.ui.texteditor.ExtendedTextEditor#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@@ -249,7 +251,7 @@ public class JavaEditor extends TextEditor {
fProjectionSupport.install();
viewer.doOperation(ProjectionViewer.TOGGLE);
}
-
+
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#adjustHighlightRange(int, int)
*/
diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java
index 79f9bcdb999..60d0aa98496 100644
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java
+++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditorExamplePlugin.java
@@ -19,13 +19,13 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
* The example java editor plug-in class.
- *
+ *
* @since 3.0
*/
public class JavaEditorExamplePlugin extends AbstractUIPlugin {
-
+
public final static String JAVA_PARTITIONING= "__java_example_partitioning"; //$NON-NLS-1$
-
+
private static JavaEditorExamplePlugin fgInstance;
private JavaPartitionScanner fPartitionScanner;
private JavaColorProvider fColorProvider;
@@ -38,19 +38,19 @@ public class JavaEditorExamplePlugin extends AbstractUIPlugin {
public JavaEditorExamplePlugin() {
fgInstance= this;
}
-
+
/**
* Returns the default plug-in instance.
- *
+ *
* @return the default plug-in instance
*/
public static JavaEditorExamplePlugin getDefault() {
return fgInstance;
}
-
+
/**
* Return a scanner for creating Java partitions.
- *
+ *
* @return a scanner for creating Java partitions
*/
public JavaPartitionScanner getJavaPartitionScanner() {
@@ -58,10 +58,10 @@ public class JavaEditorExamplePlugin extends AbstractUIPlugin {
fPartitionScanner= new JavaPartitionScanner();
return fPartitionScanner;
}
-
+
/**
* Returns the singleton Java code scanner.
- *
+ *
* @return the singleton Java code scanner
*/
public RuleBasedScanner getJavaCodeScanner() {
@@ -69,10 +69,10 @@ public class JavaEditorExamplePlugin extends AbstractUIPlugin {
fCodeScanner= new JavaCodeScanner(getJavaColorProvider());
return fCodeScanner;
}
-
+
/**
* Returns the singleton Java color provider.
- *
+ *
* @return the singleton Java color provider
*/
public JavaColorProvider getJavaColorProvider() {
@@ -80,10 +80,10 @@ public class JavaEditorExamplePlugin extends AbstractUIPlugin {
fColorProvider= new JavaColorProvider();
return fColorProvider;
}
-
+
/**
* Returns the singleton Javadoc scanner.
- *
+ *
* @return the singleton Javadoc scanner
*/
public RuleBasedScanner getJavaDocScanner() {
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
index e76e3d9f96e..7f807d7eb0b 100644
--- 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
@@ -29,7 +29,7 @@ public class JavaEditorMessages {
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/JavaPartitionScanner.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaPartitionScanner.java
index 1eebdba32e9..c6db157774d 100644
--- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaPartitionScanner.java
+++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaPartitionScanner.java
@@ -14,7 +14,16 @@ package org.eclipse.ui.examples.javaeditor;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.jface.text.rules.*;
+import org.eclipse.jface.text.rules.EndOfLineRule;
+import org.eclipse.jface.text.rules.ICharacterScanner;
+import org.eclipse.jface.text.rules.IPredicateRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.IWordDetector;
+import org.eclipse.jface.text.rules.MultiLineRule;
+import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WordRule;
/**
* This scanner recognizes the JavaDoc comments and Java multi line comments.
@@ -44,20 +53,20 @@ public class JavaPartitionScanner extends RuleBasedPartitionScanner {
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)
*/
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
index 4110ffee650..54ca2cff577 100644
--- 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
@@ -40,8 +40,8 @@ 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.
*/
@@ -50,21 +50,21 @@ public class JavaSourceViewerConfiguration extends SourceViewerConfiguration {
setDefaultReturnToken(new Token(attribute));
}
}
-
+
/**
* Default constructor.
*/
public JavaSourceViewerConfiguration() {
}
-
+
/* (non-Javadoc)
* Method declared on SourceViewerConfiguration
*/
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
return new JavaAnnotationHover();
}
-
+
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
*/
@@ -72,21 +72,21 @@ public class JavaSourceViewerConfiguration extends SourceViewerConfiguration {
IAutoEditStrategy strategy= (IDocument.DEFAULT_CONTENT_TYPE.equals(contentType) ? new JavaAutoIndentStrategy() : new DefaultIndentLineAutoEditStrategy());
return new IAutoEditStrategy[] { strategy };
}
-
+
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer)
*/
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
return JavaEditorExamplePlugin.JAVA_PARTITIONING;
}
-
+
/* (non-Javadoc)
* Method declared on SourceViewerConfiguration
*/
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
return new String[] { IDocument.DEFAULT_CONTENT_TYPE, JavaPartitionScanner.JAVA_DOC, JavaPartitionScanner.JAVA_MULTILINE_COMMENT };
}
-
+
/* (non-Javadoc)
* Method declared on SourceViewerConfiguration
*/
@@ -105,28 +105,28 @@ public class JavaSourceViewerConfiguration extends SourceViewerConfiguration {
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
*/
@@ -135,11 +135,11 @@ public class JavaSourceViewerConfiguration extends SourceViewerConfiguration {
JavaColorProvider provider= JavaEditorExamplePlugin.getDefault().getJavaColorProvider();
PresentationReconciler reconciler= new PresentationReconciler();
reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
-
+
DefaultDamagerRepairer dr= new DefaultDamagerRepairer(JavaEditorExamplePlugin.getDefault().getJavaCodeScanner());
reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
-
+
dr= new DefaultDamagerRepairer(JavaEditorExamplePlugin.getDefault().getJavaDocScanner());
reconciler.setDamager(dr, JavaPartitionScanner.JAVA_DOC);
reconciler.setRepairer(dr, JavaPartitionScanner.JAVA_DOC);
@@ -150,14 +150,14 @@ public class JavaSourceViewerConfiguration extends SourceViewerConfiguration {
return reconciler;
}
-
+
/* (non-Javadoc)
* Method declared on SourceViewerConfiguration
*/
public int getTabWidth(ISourceViewer sourceViewer) {
return 4;
}
-
+
/* (non-Javadoc)
* Method declared on SourceViewerConfiguration
*/
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
index 53f4930f0dc..1600b8e356c 100644
--- 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
@@ -11,9 +11,14 @@
package org.eclipse.ui.examples.javaeditor;
-import org.eclipse.jface.text.*;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.Region;
+
/**
* Example implementation for an <code>ITextHover</code> which hovers over Java code.
*/
@@ -32,7 +37,7 @@ public class JavaTextHover implements ITextHover {
}
return JavaEditorMessages.getString("JavaTextHover.emptySelection"); //$NON-NLS-1$
}
-
+
/* (non-Javadoc)
* Method declared on ITextHover
*/
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
index 8ec3bd55aa0..f508ea029a5 100644
--- 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
@@ -28,7 +28,7 @@ public class PresentationAction extends TextEditorAction {
super(JavaEditorMessages.getResourceBundle(), "TogglePresentation.", null); //$NON-NLS-1$
update();
}
-
+
/* (non-Javadoc)
* Method declared on IAction
*/
@@ -41,7 +41,7 @@ public class PresentationAction extends TextEditorAction {
setChecked(!show);
editor.showHighlightRangeOnly(!show);
}
-
+
/* (non-Javadoc)
* Method declared on TextEditorAction
*/
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
index 4f82ef0c9e1..73cab6b2975 100644
--- 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
@@ -24,7 +24,7 @@ public class JavaAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
public JavaAutoIndentStrategy() {
}
-
+
/* (non-Javadoc)
* Method declared on IAutoIndentStrategy
*/
@@ -35,10 +35,10 @@ public class JavaAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
smartInsertAfterBracket(d, c);
}
}
-
+
/**
* Returns whether or not the given text ends with one of the documents legal line delimiters.
- *
+ *
* @param d the document
* @param txt the text
* @return <code>true</code> if <code>txt</code> ends with one of the document's line delimiters, <code>false</code> otherwise
@@ -49,10 +49,10 @@ public class JavaAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
return TextUtilities.endsWith(delimiters, txt) > -1;
return false;
}
-
+
/**
* Returns the line number of the next 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
@@ -65,7 +65,7 @@ public class JavaAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
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,
+ // 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--;
@@ -78,11 +78,11 @@ public class JavaAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
}
return line;
}
-
+
/**
- * Returns the bracket value of a section of text. Closing brackets have a value of -1 and
+ * Returns the bracket value of a section of text. Closing brackets have a value of -1 and
* open brackets have a value of 1.
- *
+ *
* @param document - the document being parsed
* @param start - the start position for the search
* @param end - the end position for the search
@@ -105,7 +105,7 @@ public class JavaAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
// 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
+ // '//'-comment: nothing to do anymore on this line
begin= end;
}
}
@@ -138,10 +138,10 @@ public class JavaAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
}
return bracketcount;
}
-
+
/**
* Returns the end position of a comment starting at the given <code>position</code>.
- *
+ *
* @param document - the document being parsed
* @param position - the start position for the search
* @param end - the end position for the search
@@ -161,10 +161,10 @@ public class JavaAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
}
return end;
}
-
+
/**
* Returns the content of the given line without the leading whitespace.
- *
+ *
* @param document - the document being parsed
* @param line - the line being searched
* @return the content of the given line without the leading whitespace
@@ -179,10 +179,10 @@ public class JavaAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
}
return ""; //$NON-NLS-1$
}
-
+
/**
* Returns the position of the <code>character</code> in the <code>document</code> after <code>position</code>.
- *
+ *
* @param document - the document being parsed
* @param position - the position to start searching from
* @param end - the end of the document
@@ -204,7 +204,7 @@ public class JavaAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
}
return end;
}
-
+
/**
* Set the indent of a new line based on the command provided in the supplied document.
* @param document - the document being parsed
@@ -241,7 +241,7 @@ public class JavaAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
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
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
index b5656b513b4..2e811094c13 100644
--- 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
@@ -15,8 +15,18 @@ 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.*;
+import org.eclipse.jface.text.rules.EndOfLineRule;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WhitespaceRule;
+import org.eclipse.jface.text.rules.WordRule;
+
+import org.eclipse.ui.examples.javaeditor.util.JavaColorProvider;
+import org.eclipse.ui.examples.javaeditor.util.JavaWhitespaceDetector;
+import org.eclipse.ui.examples.javaeditor.util.JavaWordDetector;
/**
* A Java code scanner.
@@ -31,7 +41,7 @@ public class JavaCodeScanner extends RuleBasedScanner {
/**
* Creates a Java code scanner with the given color provider.
- *
+ *
* @param provider the color provider
*/
public JavaCodeScanner(JavaColorProvider provider) {
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
index 12ad2bfc8a9..4a8fb808869 100644
--- 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
@@ -15,7 +15,13 @@ import java.text.MessageFormat;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.jface.text.contentassist.*;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ContextInformation;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationPresenter;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
/**
* Example Java completion processor.
@@ -43,7 +49,7 @@ public class JavaCompletionProcessor implements IContentAssistProcessor {
public void install(IContextInformation info, ITextViewer viewer, int offset) {
fInstallOffset= offset;
}
-
+
/*
* @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int, TextPresentation)
*/
@@ -68,7 +74,7 @@ public class JavaCompletionProcessor implements IContentAssistProcessor {
}
return result;
}
-
+
/* (non-Javadoc)
* Method declared on IContentAssistProcessor
*/
@@ -80,28 +86,28 @@ public class JavaCompletionProcessor implements IContentAssistProcessor {
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
*/
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
index 8fe3fcfc0a8..77d86c1592f 100644
--- 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
@@ -28,13 +28,13 @@ public class JavaDoubleClickSelector implements ITextDoubleClickStrategy {
protected static char[] fgBrackets= { '{', '}', '(', ')', '[', ']', '"', '"' };
- /*
+ /*
* Create a JavaDoubleClickSelector.
*/
public JavaDoubleClickSelector() {
super();
}
-
+
/* (non-Javadoc)
* Method declared on ITextDoubleClickStrategy
*/
@@ -50,11 +50,11 @@ public class JavaDoubleClickSelector implements ITextDoubleClickStrategy {
if (!selectBracketBlock())
selectWord();
}
-
+
/**
* Match the brackets at the current selection. Return <code>true</code> if successful,
* <code>false</code> otherwise.
- *
+ *
* @return <code>true</code> if brackets match, <code>false</code> otherwise
*/
protected boolean matchBracketsAt() {
@@ -107,11 +107,11 @@ public class JavaDoubleClickSelector implements ITextDoubleClickStrategy {
return false;
}
-
+
/**
* Select the word at the current selection location. Return <code>true</code> if successful,
* <code>false</code> otherwise.
- *
+ *
* @return <code>true</code> if a word can be found at the current selection location, <code>false</code> otherwise
*/
protected boolean matchWord() {
@@ -151,10 +151,10 @@ public class JavaDoubleClickSelector implements ITextDoubleClickStrategy {
return false;
}
-
+
/**
* Returns the position of the closing bracket after <code>startPosition</code>.
- *
+ *
* @param startPosition - the beginning position
* @param openBracket - the character that represents the open bracket
* @param closeBracket - the character that represents the close bracket
@@ -182,10 +182,10 @@ public class JavaDoubleClickSelector implements ITextDoubleClickStrategy {
return -1;
}
-
+
/**
* Returns the position of the open bracket before <code>startPosition</code>.
- *
+ *
* @param startPosition - the beginning position
* @param openBracket - the character that represents the open bracket
* @param closeBracket - the character that represents the close bracket
@@ -211,10 +211,10 @@ public class JavaDoubleClickSelector implements ITextDoubleClickStrategy {
return openPos + 1;
return -1;
}
-
+
/**
* Select the area between the selected bracket and the closing bracket.
- *
+ *
* @return <code>true</code> if selection was successful, <code>false</code> otherwise
*/
protected boolean selectBracketBlock() {
@@ -229,9 +229,9 @@ public class JavaDoubleClickSelector implements ITextDoubleClickStrategy {
}
return false;
}
-
+
/**
- * Select the word at the current selection.
+ * Select the word at the current selection.
*/
protected void selectWord() {
if (matchWord()) {
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
index dc022407e59..48146f962de 100644
--- 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
@@ -12,7 +12,11 @@ package org.eclipse.ui.examples.javaeditor.javadoc;
import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.*;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
/**
* Example Java doc completion processor.
@@ -30,35 +34,35 @@ public class JavaDocCompletionProcessor implements IContentAssistProcessor {
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
*/
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
index ea2e4b28422..35f36b24acd 100644
--- 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
@@ -15,7 +15,15 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.*;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.IWordDetector;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WhitespaceRule;
+import org.eclipse.jface.text.rules.WordRule;
+
import org.eclipse.ui.examples.javaeditor.util.JavaColorProvider;
import org.eclipse.ui.examples.javaeditor.util.JavaWhitespaceDetector;
@@ -48,7 +56,7 @@ public class JavaDocScanner extends RuleBasedScanner {
/**
* Create a new javadoc scanner for the given color provider.
- *
+ *
* @param provider the color provider
*/
public JavaDocScanner(JavaColorProvider provider) {
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
index 5142b09b8a6..91d5f463ad2 100644
--- 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
@@ -11,7 +11,9 @@
package org.eclipse.ui.examples.javaeditor.util;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
@@ -37,17 +39,17 @@ public class JavaColorProvider {
/**
* 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 under the given RGB
* value.
- *
+ *
* @param rgb the RGB value
* @return the color stored in the color table for the given RGB value
*/
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
index 50b5e6f8a16..7261da3e2a3 100644
--- 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
@@ -24,7 +24,7 @@ public class JavaWordDetector implements IWordDetector {
public boolean isWordPart(char character) {
return Character.isJavaIdentifierPart(character);
}
-
+
/* (non-Javadoc)
* Method declared on IWordDetector.
*/
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/NonRuleBasedDamagerRepairer.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/NonRuleBasedDamagerRepairer.java
index e230b9f9607..611b3981583 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/NonRuleBasedDamagerRepairer.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/NonRuleBasedDamagerRepairer.java
@@ -10,6 +10,10 @@
*******************************************************************************/
package org.eclipse.ui.examples.templateeditor.editors;
+import org.eclipse.swt.custom.StyleRange;
+
+import org.eclipse.core.runtime.Assert;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
@@ -20,9 +24,6 @@ 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;
-import org.eclipse.swt.custom.StyleRange;
-
-import org.eclipse.core.runtime.Assert;
public class NonRuleBasedDamagerRepairer implements IPresentationDamager, IPresentationRepairer {
@@ -30,10 +31,10 @@ public class NonRuleBasedDamagerRepairer implements IPresentationDamager, IPrese
protected IDocument fDocument;
/** The default text attribute if non is returned as data by the current token */
protected TextAttribute fDefaultTextAttribute;
-
+
/**
* Creates a new damager/repairer.
- *
+ *
* @param defaultTextAttribute the default text attribute for all detected regions
*/
public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) {
@@ -52,7 +53,7 @@ public class NonRuleBasedDamagerRepairer implements IPresentationDamager, IPrese
* 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
@@ -108,7 +109,7 @@ public class NonRuleBasedDamagerRepairer implements IPresentationDamager, IPrese
/**
* 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
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TagRule.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TagRule.java
index a99f94751ab..71d37dabb74 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TagRule.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TagRule.java
@@ -10,7 +10,9 @@
*******************************************************************************/
package org.eclipse.ui.examples.templateeditor.editors;
-import org.eclipse.jface.text.rules.*;
+import org.eclipse.jface.text.rules.ICharacterScanner;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.MultiLineRule;
public class TagRule extends MultiLineRule {
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditor.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditor.java
index 21f442a3a5d..3dd22ce2656 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditor.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditor.java
@@ -35,12 +35,12 @@ public class TemplateEditor extends AbstractDecoratedTextEditor {
setSourceViewerConfiguration(new XMLConfiguration(colorManager));
setDocumentProvider(new XMLDocumentProvider());
}
-
+
public void dispose() {
colorManager.dispose();
super.dispose();
}
-
+
protected void createActions() {
super.createActions();
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditorUI.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditorUI.java
index 4c57bad0022..bfc93fe66ed 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditorUI.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateEditorUI.java
@@ -23,33 +23,34 @@ import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.text.templates.ContextTypeRegistry;
import org.eclipse.jface.text.templates.persistence.TemplateStore;
-import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
-import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
import org.eclipse.ui.examples.javaeditor.JavaEditorExamplePlugin;
import org.eclipse.ui.examples.templateeditor.template.XMLContextType;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
+import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
+
/**
* The main plugin class to be used in the desktop.
*/
public class TemplateEditorUI {
/** Key to store custom templates. */
private static final String CUSTOM_TEMPLATES_KEY= "org.eclipse.ui.examples.templateeditor.customtemplates"; //$NON-NLS-1$
-
+
/** The shared instance. */
private static TemplateEditorUI fInstance;
-
+
/** The template store. */
private TemplateStore fStore;
/** The context type registry. */
private ContributionContextTypeRegistry fRegistry;
-
+
private TemplateEditorUI() {
}
/**
* Returns the shared instance.
- *
+ *
* @return the shared instance
*/
public static TemplateEditorUI getDefault() {
@@ -60,7 +61,7 @@ public class TemplateEditorUI {
/**
* Returns this plug-in's template store.
- *
+ *
* @return the template store of this plug-in instance
*/
public TemplateStore getTemplateStore() {
@@ -77,7 +78,7 @@ public class TemplateEditorUI {
/**
* Returns this plug-in's context type registry.
- *
+ *
* @return the context type registry for this plug-in instance
*/
public ContextTypeRegistry getContextTypeRegistry() {
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateMessages.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateMessages.java
index 8518478f418..ddec60614eb 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateMessages.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/TemplateMessages.java
@@ -29,7 +29,7 @@ class TemplateMessages {
return '!' + key + '!';
}
}
-
+
public static String getFormattedString(String key, Object arg) {
return MessageFormat.format(getString(key), new Object[] { arg });
}
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLConfiguration.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLConfiguration.java
index caffd1feaf5..7412ae6e394 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLConfiguration.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLConfiguration.java
@@ -22,9 +22,10 @@ import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
import org.eclipse.ui.examples.templateeditor.template.XMLCompletionProcessor;
+import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
+
public class XMLConfiguration extends TextSourceViewerConfiguration {
private XMLDoubleClickStrategy doubleClickStrategy;
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLDocumentProvider.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLDocumentProvider.java
index d82549485af..7da5d25bfe2 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLDocumentProvider.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLDocumentProvider.java
@@ -11,9 +11,11 @@
package org.eclipse.ui.examples.templateeditor.editors;
import org.eclipse.core.runtime.CoreException;
+
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.rules.FastPartitioner;
+
import org.eclipse.ui.editors.text.FileDocumentProvider;
public class XMLDocumentProvider extends FileDocumentProvider {
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLDoubleClickStrategy.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLDoubleClickStrategy.java
index 181718c42af..df908f15794 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLDoubleClickStrategy.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLDoubleClickStrategy.java
@@ -10,7 +10,10 @@
*******************************************************************************/
package org.eclipse.ui.examples.templateeditor.editors;
-import org.eclipse.jface.text.*;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.ITextViewer;
public class XMLDoubleClickStrategy implements ITextDoubleClickStrategy {
protected ITextViewer fText;
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLPartitionScanner.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLPartitionScanner.java
index 40a7cbb17c3..bad178ff745 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLPartitionScanner.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLPartitionScanner.java
@@ -10,7 +10,11 @@
*******************************************************************************/
package org.eclipse.ui.examples.templateeditor.editors;
-import org.eclipse.jface.text.rules.*;
+import org.eclipse.jface.text.rules.IPredicateRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.MultiLineRule;
+import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
+import org.eclipse.jface.text.rules.Token;
public class XMLPartitionScanner extends RuleBasedPartitionScanner {
public final static String XML_DEFAULT = "__xml_default"; //$NON-NLS-1$
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLScanner.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLScanner.java
index 66e861af237..c2cf7f5f6b3 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLScanner.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLScanner.java
@@ -10,8 +10,13 @@
*******************************************************************************/
package org.eclipse.ui.examples.templateeditor.editors;
-import org.eclipse.jface.text.rules.*;
-import org.eclipse.jface.text.*;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WhitespaceRule;
public class XMLScanner extends RuleBasedScanner {
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLTagScanner.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLTagScanner.java
index 904171e3c91..d5216b1e4a9 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLTagScanner.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/editors/XMLTagScanner.java
@@ -10,8 +10,13 @@
*******************************************************************************/
package org.eclipse.ui.examples.templateeditor.editors;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.rules.*;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WhitespaceRule;
public class XMLTagScanner extends RuleBasedScanner {
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/preferences/TemplatesPreferencePage.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/preferences/TemplatesPreferencePage.java
index 868c77dce47..2f81df98f1b 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/preferences/TemplatesPreferencePage.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/preferences/TemplatesPreferencePage.java
@@ -12,13 +12,14 @@ package org.eclipse.ui.examples.templateeditor.preferences;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.examples.templateeditor.editors.TemplateEditorUI;
+
import org.eclipse.ui.texteditor.templates.TemplatePreferencePage;
/**
* @see org.eclipse.jface.preference.PreferencePage
*/
public class TemplatesPreferencePage extends TemplatePreferencePage implements IWorkbenchPreferencePage {
-
+
public TemplatesPreferencePage() {
setPreferenceStore(TemplateEditorUI.getDefault().getPreferenceStore());
setTemplateStore(TemplateEditorUI.getDefault().getTemplateStore());
@@ -28,13 +29,13 @@ public class TemplatesPreferencePage extends TemplatePreferencePage implements I
protected boolean isShowFormatterSetting() {
return false;
}
-
-
+
+
public boolean performOk() {
boolean ok= super.performOk();
-
+
TemplateEditorUI.getDefault().savePluginPreferences();
-
+
return ok;
}
}
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/AntVariableResolver.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/AntVariableResolver.java
index f625d56e58b..7213a81bcad 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/AntVariableResolver.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/AntVariableResolver.java
@@ -17,7 +17,7 @@ import org.eclipse.jface.text.templates.TemplateContext;
import org.eclipse.jface.text.templates.TemplateVariableResolver;
/**
- * Looks up existing ant variables and proposes them. The proposals are sorted by
+ * Looks up existing ant variables and proposes them. The proposals are sorted by
* their prefix-likeness with the variable type.
*/
public class AntVariableResolver extends TemplateVariableResolver {
@@ -26,7 +26,7 @@ public class AntVariableResolver extends TemplateVariableResolver {
*/
protected String[] resolveAll(TemplateContext context) {
String[] proposals= new String[] { "${srcDir}", "${dstDir}" }; //$NON-NLS-1$ //$NON-NLS-2$
-
+
Arrays.sort(proposals, new Comparator() {
public int compare(Object o1, Object o2) {
@@ -44,7 +44,7 @@ public class AntVariableResolver extends TemplateVariableResolver {
return i;
}
});
-
+
return proposals;
}
}
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLCompletionProcessor.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLCompletionProcessor.java
index b3d9d47d930..bc7de458fc1 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLCompletionProcessor.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLCompletionProcessor.java
@@ -19,9 +19,9 @@ 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.templates.TemplateContextType;
import org.eclipse.jface.text.templates.Template;
import org.eclipse.jface.text.templates.TemplateCompletionProcessor;
+import org.eclipse.jface.text.templates.TemplateContextType;
import org.eclipse.ui.examples.templateeditor.editors.TemplateEditorUI;
@@ -35,7 +35,7 @@ public class XMLCompletionProcessor extends TemplateCompletionProcessor {
/**
* We watch for angular brackets since those are often part of XML
* templates.
- *
+ *
* @param viewer the viewer
* @param offset the offset left of which the prefix is detected
* @return the detected prefix
@@ -45,7 +45,7 @@ public class XMLCompletionProcessor extends TemplateCompletionProcessor {
int i= offset;
if (i > document.getLength())
return ""; //$NON-NLS-1$
-
+
try {
while (i > 0) {
char ch= document.getChar(i - 1);
@@ -62,7 +62,7 @@ public class XMLCompletionProcessor extends TemplateCompletionProcessor {
/**
* Cut out angular brackets for relevance sorting, since the template name
* does not contain the brackets.
- *
+ *
* @param template the template
* @param prefix the prefix
* @return the relevance of the <code>template</code> for the given <code>prefix</code>
@@ -77,7 +77,7 @@ public class XMLCompletionProcessor extends TemplateCompletionProcessor {
/**
* Simply return all templates.
- *
+ *
* @param contextTypeId the context type, ignored in this implementation
* @return all templates
*/
@@ -87,7 +87,7 @@ public class XMLCompletionProcessor extends TemplateCompletionProcessor {
/**
* Return the XML context type that is supported by this plug-in.
- *
+ *
* @param viewer the viewer, ignored in this implementation
* @param region the region, ignored in this implementation
* @return the supported XML context type
@@ -98,7 +98,7 @@ public class XMLCompletionProcessor extends TemplateCompletionProcessor {
/**
* Always return the default image.
- *
+ *
* @param template the template, ignored in this implementation
* @return the default template image
*/
diff --git a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLContextType.java b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLContextType.java
index fdef5ec4ee2..6e19e8e5462 100644
--- a/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLContextType.java
+++ b/org.eclipse.ui.examples.javaeditor/Template Editor Example/org/eclipse/ui/examples/templateeditor/template/XMLContextType.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.ui.examples.templateeditor.template;
-import org.eclipse.jface.text.templates.TemplateContextType;
import org.eclipse.jface.text.templates.GlobalTemplateVariables;
+import org.eclipse.jface.text.templates.TemplateContextType;
/**
@@ -23,7 +23,7 @@ public class XMLContextType extends TemplateContextType {
public static final String XML_CONTEXT_TYPE= "org.eclipse.ui.examples.templateeditor.xml"; //$NON-NLS-1$
/**
- * Creates a new XML context type.
+ * Creates a new XML context type.
*/
public XMLContextType() {
addGlobalResolvers();
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/LevenshteinTest.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/LevenshteinTest.java
index 59d6810166b..c6db2b740da 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/LevenshteinTest.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/LevenshteinTest.java
@@ -13,10 +13,9 @@ package org.eclipse.ui.workbench.texteditor.quickdiff.tests;
import java.util.Arrays;
-import org.eclipse.core.runtime.Assert;
-
import junit.framework.TestCase;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.IRangeComparator;
import org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.Levenshtein;
@@ -28,8 +27,8 @@ import org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.Ran
* @since 3.1
*/
public class LevenshteinTest extends TestCase {
-
-
+
+
protected void setUp() throws Exception {
System.out.println();
}
@@ -46,7 +45,7 @@ public class LevenshteinTest extends TestCase {
assertEditDistance(2, "a", "bb");
assertEditDistance(2, "abcdefghijklmnopqrstuvwxyz", "abcdefhijklmnogpqrstuvwxyz");
-
+
assertEditDistance(16, "abcdefghijklmnopqrstuvwxyz", "abcdefwxyz");
assertEditDistance(28, "abcdefghijklmnopqrstuvwxyz", "abcdefghijklm0000000000000000000000000000nopqrstuvwxyz");
@@ -56,13 +55,13 @@ public class LevenshteinTest extends TestCase {
assertEditDistance(0, "abcdefghijklm0000000000000000000000000000nopqrstuvwxyz", "abcdefghijklm0000000000000000000000000000nopqrstuvwxyz");
assertEditDistance(54, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
-
+
assertEditDistance(51, "abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc", "abc");
assertEditDistance(25, "abcdefgxxxxxxxxxxxabcabcdefgxxxxxxx", "abcabcdefg");
}
-
+
public void testEditDistanceHirschberg() {
assertEditDistanceHirschberg(0, "", "");
@@ -75,7 +74,7 @@ public class LevenshteinTest extends TestCase {
assertEditDistanceHirschberg(2, "a", "bb");
assertEditDistanceHirschberg(2, "abcdefghijklmnopqrstuvwxyz", "abcdefhijklmnogpqrstuvwxyz");
-
+
assertEditDistanceHirschberg(16, "abcdefghijklmnopqrstuvwxyz", "abcdefwxyz");
assertEditDistanceHirschberg(28, "abcdefghijklmnopqrstuvwxyz", "abcdefghijklm0000000000000000000000000000nopqrstuvwxyz");
@@ -85,13 +84,13 @@ public class LevenshteinTest extends TestCase {
assertEditDistanceHirschberg(0, "abcdefghijklm0000000000000000000000000000nopqrstuvwxyz", "abcdefghijklm0000000000000000000000000000nopqrstuvwxyz");
assertEditDistanceHirschberg(54, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
-
+
assertEditDistanceHirschberg(51, "abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc", "abc");
assertEditDistanceHirschberg(25, "abcdefgxxxxxxxxxxxabcabcdefgxxxxxxx", "abcabcdefg");
}
-
+
public void testEditScript() {
assertEditScript("", "");
@@ -104,7 +103,7 @@ public class LevenshteinTest extends TestCase {
assertEditScript("a", "bb");
assertEditScript("abcdefghijklmnopqrstuvwxyz", "abcdefhijklmnogpqrstuvwxyz");
-
+
assertEditScript("abcdefghijklmnopqrstuvwxyz", "abcdefwxyz");
assertEditScript("abcdefghijklmnopqrstuvwxyz", "abcdefghijklm0000000000000000000000000000nopqrstuvwxyz");
@@ -114,21 +113,21 @@ public class LevenshteinTest extends TestCase {
assertEditScript("abcdefghijklm0000000000000000000000000000nopqrstuvwxyz", "abcdefghijklm0000000000000000000000000000nopqrstuvwxyz");
assertEditScript("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
-
+
assertEditScript("abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc", "abc");
assertEditScript("abcdefgxxxxxxxxxxxabcabcdefgxxxxxxx", "abcabcdefg");
}
-
+
public void testInternalEditDistance() {
- IRangeComparator c1= new SequenceComparator("abcd");
+ IRangeComparator c1= new SequenceComparator("abcd");
IRangeComparator c2= new SequenceComparator("abcd");
-
+
Levenshtein levenshtein= createLevenshtein(c1, c2);
LevenshteinTestHelper helper= new LevenshteinTestHelper(levenshtein);
helper.initRows();
-
+
// full compare
helper.internalEditDistance(1, 4, 1, 4);
assertTrue(Arrays.equals(new int[] { 4, 3, 2, 1, 0 }, helper.getPreviousRow()));
@@ -136,29 +135,29 @@ public class LevenshteinTest extends TestCase {
// partial compare
helper.internalEditDistance(1, 2, 1, 4);
assertTrue(Arrays.equals(new int[] { 2, 1, 0, 1, 2 }, helper.getPreviousRow()));
-
+
helper.internalEditDistance(3, 4, 1, 4);
assertTrue(Arrays.equals(new int[] { 2, 2, 2, 3, 2 }, helper.getPreviousRow()));
-
+
helper.internalEditDistance(1, 4, 1, 2);
assertEquals(4, helper.getPreviousRow()[0]);
assertEquals(3, helper.getPreviousRow()[1]);
assertEquals(2, helper.getPreviousRow()[2]);
-
+
// empty right
helper.internalEditDistance(1, 0, 1, 4);
assertTrue(Arrays.equals(new int[] { 0, 1, 2, 3, 4 }, helper.getPreviousRow()));
-
+
// empty left
helper.internalEditDistance(1, 4, 1, 0);
assertEquals(4, helper.getPreviousRow()[0]);
-
+
// empty both
helper.internalEditDistance(1, 0, 1, 0);
assertEquals(0, helper.getPreviousRow()[0]);
-
+
// test insertion
- c1= new SequenceComparator("a");
+ c1= new SequenceComparator("a");
c2= new SequenceComparator("ab");
levenshtein= createLevenshtein(c1, c2);
helper= new LevenshteinTestHelper(levenshtein);
@@ -170,19 +169,19 @@ public class LevenshteinTest extends TestCase {
helper.internalEditDistance(2, 2, 1, 1);
assertTrue(Arrays.equals(new int[] { 1, 1 }, helper.getPreviousRow()));
}
-
+
protected Levenshtein createLevenshtein(IRangeComparator left, IRangeComparator right) {
return new Levenshtein(left, right);
}
public void testInternalReverseEditDistance() {
- IRangeComparator c1= new SequenceComparator("abcd");
+ IRangeComparator c1= new SequenceComparator("abcd");
IRangeComparator c2= new SequenceComparator("abcd");
-
+
Levenshtein levenshtein= createLevenshtein(c1, c2);
LevenshteinTestHelper helper= new LevenshteinTestHelper(levenshtein);
helper.initRows();
-
+
// full compare
helper.internalReverseEditDistance(1, 4, 1, 4);
assertTrue(Arrays.equals(new int[] { 0, 1, 2, 3, 4 }, helper.getPreviousRow()));
@@ -190,31 +189,31 @@ public class LevenshteinTest extends TestCase {
// partial compare
helper.internalReverseEditDistance(1, 2, 1, 4);
assertTrue(Arrays.equals(new int[] { 2, 3, 2, 2, 2 }, helper.getPreviousRow()));
-
+
helper.internalReverseEditDistance(3, 4, 1, 4);
assertTrue(Arrays.equals(new int[] { 2, 1, 0, 1, 2 }, helper.getPreviousRow()));
-
+
helper.internalReverseEditDistance(1, 4, 1, 2);
assertEquals(4, helper.getPreviousRow()[2]);
assertEquals(3, helper.getPreviousRow()[1]);
assertEquals(2, helper.getPreviousRow()[0]);
-
+
// empty right
helper.internalReverseEditDistance(1, 0, 1, 4);
assertTrue(Arrays.equals(new int[] { 4, 3, 2, 1, 0 }, helper.getPreviousRow()));
-
+
// empty left
helper.internalReverseEditDistance(1, 4, 5, 4);
assertEquals(4, helper.getPreviousRow()[4]);
helper.internalReverseEditDistance(1, 4, 1, 0);
assertEquals(4, helper.getPreviousRow()[0]);
-
+
// empty both
helper.internalReverseEditDistance(1, 0, 1, 0);
assertEquals(0, helper.getPreviousRow()[0]);
// test insertion
- c1= new SequenceComparator("a");
+ c1= new SequenceComparator("a");
c2= new SequenceComparator("ab");
levenshtein= createLevenshtein(c1, c2);
helper= new LevenshteinTestHelper(levenshtein);
@@ -226,12 +225,12 @@ public class LevenshteinTest extends TestCase {
helper.internalReverseEditDistance(2, 2, 1, 1);
assertTrue(Arrays.equals(new int[] { 1, 1 }, helper.getPreviousRow()));
}
-
+
public void testEditScriptHirschberg() {
assertEditScriptHirschberg("abc", "abc");
-
+
assertEditScriptHirschberg("a", "b");
-
+
assertEditScriptHirschberg("", "");
assertEditScriptHirschberg("a", "");
@@ -241,7 +240,7 @@ public class LevenshteinTest extends TestCase {
assertEditScriptHirschberg("a", "bb");
assertEditScriptHirschberg("abcdefghijklmnopqrstuvwxyz", "abcdefhijklmnogpqrstuvwxyz");
-
+
assertEditScriptHirschberg("abcdefghijklmnopqrstuvwxyz", "abcdefwxyz");
assertEditScriptHirschberg("abcdefghijklmnopqrstuvwxyz", "abcdefghijklm0000000000000000000000000000nopqrstuvwxyz");
@@ -251,20 +250,20 @@ public class LevenshteinTest extends TestCase {
assertEditScriptHirschberg("abcdefghijklm0000000000000000000000000000nopqrstuvwxyz", "abcdefghijklm0000000000000000000000000000nopqrstuvwxyz");
assertEditScriptHirschberg("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
-
+
assertEditScriptHirschberg("abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc", "abc");
assertEditScriptHirschberg("abcdefgxxxxxxxxxxxabcabcdefgxxxxxxx", "abcabcdefg");
}
-
+
private void assertEditScript(String s1, String s2) {
SequenceComparator sc1= new SequenceComparator(s1);
SequenceComparator sc2= new SequenceComparator(s2);
RangeDifference[] expected= RangeDifferencer.findDifferences(sc1, sc2);
Levenshtein levenshtein= createLevenshtein(sc1,sc2);
RangeDifference[] tested= levenshtein.editScript();
-
+
assertTrue(Arrays.equals(expected, tested));
}
@@ -274,7 +273,7 @@ public class LevenshteinTest extends TestCase {
RangeDifference[] expected= RangeDifferencer.findDifferences(sc1, sc2);
Levenshtein levenshtein= createLevenshtein(sc1,sc2);
RangeDifference[] tested= levenshtein.editScriptHirschberg();
-
+
assertTrue(Arrays.equals(expected, tested));
}
@@ -309,8 +308,8 @@ public class LevenshteinTest extends TestCase {
class SequenceComparator implements IRangeComparator {
private final CharSequence fSequence;
-
-
+
+
public SequenceComparator(CharSequence string) {
Assert.isNotNull(string);
fSequence= string;
@@ -327,9 +326,9 @@ class SequenceComparator implements IRangeComparator {
public boolean skipRangeComparison(int length, int maxLength, IRangeComparator other) {
return false;
}
-
+
public String toString() {
return "SequenceComparator [" + fSequence + "]";
}
-
+
}
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/LevenshteinTestHelper.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/LevenshteinTestHelper.java
index fee8b4bda44..10f14ad50c3 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/LevenshteinTestHelper.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/LevenshteinTestHelper.java
@@ -17,7 +17,7 @@ import org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.Lev
/**
* Accessor for package private methods in Levenshtein.
- *
+ *
* @since 3.1
*/
public final class LevenshteinTestHelper {
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/OptimizedLevenshteinTest.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/OptimizedLevenshteinTest.java
index 2d4a3ee0481..ac6eda3200a 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/OptimizedLevenshteinTest.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/quickdiff/tests/OptimizedLevenshteinTest.java
@@ -30,15 +30,15 @@ public class OptimizedLevenshteinTest extends TestCase {
helper.setOptimizedCellComputer();
return ls;
}
-
+
public void testInternalEditDistance() {
- IRangeComparator c1= new SequenceComparator("abcd");
+ IRangeComparator c1= new SequenceComparator("abcd");
IRangeComparator c2= new SequenceComparator("abcd");
-
+
Levenshtein levenshtein= createLevenshtein(c1, c2);
LevenshteinTestHelper helper= new LevenshteinTestHelper(levenshtein);
helper.initRows();
-
+
// full compare
helper.internalEditDistance(1, 4, 1, 4);
assertTrue(Arrays.equals(new int[] { SKIP, SKIP, SKIP, SKIP, 0 }, helper.getPreviousRow()));
@@ -46,29 +46,29 @@ public class OptimizedLevenshteinTest extends TestCase {
// partial compare
helper.internalEditDistance(1, 2, 1, 4);
assertTrue(Arrays.equals(new int[] { SKIP, SKIP, 0, 1, 2 }, helper.getPreviousRow()));
-
+
helper.internalEditDistance(3, 4, 1, 4);
assertTrue(Arrays.equals(new int[] { SKIP, SKIP, SKIP, SKIP, 2 }, helper.getPreviousRow()));
-
+
helper.internalEditDistance(1, 4, 1, 2);
assertEquals(SKIP, helper.getPreviousRow()[0]);
assertEquals(SKIP, helper.getPreviousRow()[1]);
assertEquals(2, helper.getPreviousRow()[2]);
-
+
// empty right
helper.internalEditDistance(1, 0, 1, 4);
assertTrue(Arrays.equals(new int[] { 0, 1, 2, 3, 4 }, helper.getPreviousRow()));
-
+
// empty left
helper.internalEditDistance(1, 4, 1, 0);
assertEquals(4, helper.getPreviousRow()[0]);
-
+
// empty both
helper.internalEditDistance(1, 0, 1, 0);
assertEquals(0, helper.getPreviousRow()[0]);
-
+
// test insertion
- c1= new SequenceComparator("a");
+ c1= new SequenceComparator("a");
c2= new SequenceComparator("ab");
levenshtein= createLevenshtein(c1, c2);
helper= new LevenshteinTestHelper(levenshtein);
@@ -80,15 +80,15 @@ public class OptimizedLevenshteinTest extends TestCase {
helper.internalEditDistance(2, 2, 1, 1);
assertTrue(Arrays.equals(new int[] { SKIP, 1 }, helper.getPreviousRow()));
}
-
+
public void testInternalReverseEditDistance() {
- IRangeComparator c1= new SequenceComparator("abcd");
+ IRangeComparator c1= new SequenceComparator("abcd");
IRangeComparator c2= new SequenceComparator("abcd");
-
+
Levenshtein levenshtein= createLevenshtein(c1, c2);
LevenshteinTestHelper helper= new LevenshteinTestHelper(levenshtein);
helper.initRows();
-
+
// full compare
helper.internalReverseEditDistance(1, 4, 1, 4);
assertTrue(Arrays.equals(new int[] { 0, SKIP, SKIP, SKIP, SKIP }, helper.getPreviousRow()));
@@ -96,31 +96,31 @@ public class OptimizedLevenshteinTest extends TestCase {
// partial compare
helper.internalReverseEditDistance(1, 2, 1, 4);
assertTrue(Arrays.equals(new int[] { 2, SKIP, SKIP, SKIP, SKIP }, helper.getPreviousRow()));
-
+
helper.internalReverseEditDistance(3, 4, 1, 4);
assertTrue(Arrays.equals(new int[] { 2, 1, 0, SKIP, SKIP }, helper.getPreviousRow()));
-
+
helper.internalReverseEditDistance(1, 4, 1, 2);
assertEquals(SKIP, helper.getPreviousRow()[2]);
assertEquals(SKIP, helper.getPreviousRow()[1]);
assertEquals(2, helper.getPreviousRow()[0]);
-
+
// empty right
helper.internalReverseEditDistance(1, 0, 1, 4);
assertTrue(Arrays.equals(new int[] { 4, 3, 2, 1, 0 }, helper.getPreviousRow()));
-
+
// empty left
helper.internalReverseEditDistance(1, 4, 5, 4);
assertEquals(4, helper.getPreviousRow()[4]);
helper.internalReverseEditDistance(1, 4, 1, 0);
assertEquals(4, helper.getPreviousRow()[0]);
-
+
// empty both
helper.internalReverseEditDistance(1, 0, 1, 0);
assertEquals(0, helper.getPreviousRow()[0]);
// test insertion
- c1= new SequenceComparator("a");
+ c1= new SequenceComparator("a");
c2= new SequenceComparator("ab");
levenshtein= createLevenshtein(c1, c2);
helper= new LevenshteinTestHelper(levenshtein);
@@ -132,7 +132,7 @@ public class OptimizedLevenshteinTest extends TestCase {
helper.internalReverseEditDistance(2, 2, 1, 1);
assertTrue(Arrays.equals(new int[] { 1, SKIP }, helper.getPreviousRow()));
}
-
+
}
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java
index 1f06ec9e577..99875b0c829 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java
@@ -24,25 +24,25 @@ import org.eclipse.ui.PlatformUI;
/**
* Tests the FindReplaceDialog.
- *
+ *
* @since 3.1
*/
public class FindReplaceDialogTest extends TestCase {
-
+
private Accessor fFindReplaceDialog;
-
-
+
+
public FindReplaceDialogTest(String name) {
super(name);
}
-
-
+
+
protected void setUp() {
Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
fFindReplaceDialog= new Accessor("org.eclipse.ui.texteditor.FindReplaceDialog", getClass().getClassLoader(), new Object[] {shell});
fFindReplaceDialog.invoke("create", null);
}
-
+
public static Test suite() {
TestSuite suite= new TestSuite();
suite.addTest(new FindReplaceDialogTest("testInitialButtonState"));
@@ -50,12 +50,12 @@ public class FindReplaceDialogTest extends TestCase {
suite.addTest(new FindReplaceDialogTest("testDisableWholeWordIfNotWord"));
return suite;
}
-
+
protected void tearDown () {
fFindReplaceDialog.invoke("close", null);
fFindReplaceDialog= null;
}
-
+
public void testInitialButtonState() {
Boolean value;
value= (Boolean)fFindReplaceDialog.invoke("isWholeWordSearch", null);
@@ -73,7 +73,7 @@ public class FindReplaceDialogTest extends TestCase {
checkbox= (Button)fFindReplaceDialog.get("fWholeWordCheckBox");
assertFalse(checkbox.isEnabled()); // there's no word in the Find field
}
-
+
public void testDisableWholeWordIfRegEx() {
Combo findField= (Combo)fFindReplaceDialog.get("fFindField");
findField.setText("word");
@@ -83,7 +83,7 @@ public class FindReplaceDialogTest extends TestCase {
assertTrue(isRegExCheckBox.isEnabled());
assertTrue(wholeWordCheckbox.isEnabled());
-
+
fFindReplaceDialog.set("fIsTargetSupportingRegEx", true);
isRegExCheckBox.setSelection(true);
wholeWordCheckbox.setSelection(true);
@@ -91,11 +91,11 @@ public class FindReplaceDialogTest extends TestCase {
assertTrue(isRegExCheckBox.isEnabled());
assertFalse(wholeWordCheckbox.isEnabled());
-
+
// XXX: enable once https://bugs.eclipse.org/bugs/show_bug.cgi?id=72462 has been fixed
// assertFalse(wholeWordCheckbox.getSelection());
}
-
+
public void testDisableWholeWordIfNotWord() {
Combo findField= (Combo)fFindReplaceDialog.get("fFindField");
Button isRegExCheckBox= (Button)fFindReplaceDialog.get("fIsRegExCheckBox");
@@ -105,7 +105,7 @@ public class FindReplaceDialogTest extends TestCase {
isRegExCheckBox.setSelection(false);
wholeWordCheckbox.setSelection(true);
fFindReplaceDialog.invoke("updateButtonState", null);
-
+
findField.setText("word");
assertTrue(isRegExCheckBox.isEnabled());
assertTrue(wholeWordCheckbox.isEnabled());
@@ -114,7 +114,7 @@ public class FindReplaceDialogTest extends TestCase {
findField.setText("no word");
assertTrue(isRegExCheckBox.isEnabled());
assertFalse(wholeWordCheckbox.isEnabled());
-
+
// XXX: enable once https://bugs.eclipse.org/bugs/show_bug.cgi?id=72462 has been fixed
// assertFalse(wholeWordCheckbox.getSelection());
}
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java
index 612cd4ca01f..46b27d159f5 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java
@@ -27,82 +27,82 @@ import org.eclipse.ui.internal.texteditor.HippieCompletionEngine;
/**
* Tests for the Hippie completion action of the text editor.
- *
+ *
* @author Genady Beryozkin, me@genady.org
*/
public class HippieCompletionTest extends TestCase {
-
+
IDocument[] documents;
private HippieCompletionEngine fEngine;
-
+
public HippieCompletionTest(String name) {
super(name);
}
-
+
/*
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
documents= new IDocument[5];
- documents[0]= new Document("package ui.TestPackage;\n" +
- "\n" +
- "/**\n" +
+ documents[0]= new Document("package ui.TestPackage;\n" +
+ "\n" +
+ "/**\n" +
" * This is a testing class that tests the hippie completion engine.\n" +
- " * it has a simple main with a print method\n" +
- " */\n" +
- "public class TestClass1 {\n" +
- "\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(\"I will be printing Hello world!\");\n" +
- " }\n" +
+ " * it has a simple main with a print method\n" +
+ " */\n" +
+ "public class TestClass1 {\n" +
+ "\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(\"I will be printing Hello world!\");\n" +
+ " }\n" +
"}");
- documents[1]= new Document("This is a simple text file\n" +
+ documents[1]= new Document("This is a simple text file\n" +
"with some testssome test that is also used in the completion engine tests");
-
- documents[2]= new Document("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<plugin\n" +
- " id=\"org.eclipse.ui.workbench.texteditor.tests\"\n" +
- " name=\"%Plugin.name\"\n" +
- " version=\"3.1.0\"\n" +
- " provider-name=\"%Plugin.providerName\">\n" +
- "\n" +
- " <runtime>\n" +
- " <library name=\"workbenchtexteditortests.jar\">\n" +
- " <export name=\"*\"/>\n" +
- " </library>\n" +
- " </runtime>\n" +
- " \n" +
- " <requires>\n" +
- " <import plugin=\"org.eclipse.core.runtime.compatibility\"/>\n" +
- " <import plugin=\"org.junit\"/>\n" +
- " <import plugin=\"org.eclipse.text.tests\"/>\n" +
- " <import plugin=\"org.eclipse.jface.text\"/>\n" +
- " <import plugin=\"org.eclipse.ui.workbench.texteditor\"/>\n" +
- " <import plugin=\"org.eclipse.ui\"/>\n" +
- " </requires>\n" +
- " \n" +
- "</plugin>\n" +
+
+ documents[2]= new Document("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<plugin\n" +
+ " id=\"org.eclipse.ui.workbench.texteditor.tests\"\n" +
+ " name=\"%Plugin.name\"\n" +
+ " version=\"3.1.0\"\n" +
+ " provider-name=\"%Plugin.providerName\">\n" +
+ "\n" +
+ " <runtime>\n" +
+ " <library name=\"workbenchtexteditortests.jar\">\n" +
+ " <export name=\"*\"/>\n" +
+ " </library>\n" +
+ " </runtime>\n" +
+ " \n" +
+ " <requires>\n" +
+ " <import plugin=\"org.eclipse.core.runtime.compatibility\"/>\n" +
+ " <import plugin=\"org.junit\"/>\n" +
+ " <import plugin=\"org.eclipse.text.tests\"/>\n" +
+ " <import plugin=\"org.eclipse.jface.text\"/>\n" +
+ " <import plugin=\"org.eclipse.ui.workbench.texteditor\"/>\n" +
+ " <import plugin=\"org.eclipse.ui\"/>\n" +
+ " </requires>\n" +
+ " \n" +
+ "</plugin>\n" +
"");
-
- documents[3]= new Document("###############################################################################\n" +
- "# Copyright (c) 2000, 2004 IBM Corporation and others.\n" +
- "# All rights reserved. This program and the accompanying materials \n" +
- "# are made available under the terms of the Eclipse Public License v1.0\n" +
- "# which accompanies this distribution, and is available at\n" +
- "# http://www.eclipse.org/legal/epl-v10.html\n" +
- "# \n" +
- "# Contributors:\n" +
- "# IBM Corporation - initial API and implementation\n" +
- "###############################################################################\n" +
- "bin.includes= plugin.xml,\\\n" +
- " plugin.properties,\\\n" +
- " test.xml,\\\n" +
- " about.html,\\\n" +
- " *.jar\n" +
- "\n" +
- "src.includes= about.html\n" +
- " \n" +
- "source.workbenchtexteditortests.jar= src/\n" +
+
+ documents[3]= new Document("###############################################################################\n" +
+ "# Copyright (c) 2000, 2004 IBM Corporation and others.\n" +
+ "# All rights reserved. This program and the accompanying materials \n" +
+ "# are made available under the terms of the Eclipse Public License v1.0\n" +
+ "# which accompanies this distribution, and is available at\n" +
+ "# http://www.eclipse.org/legal/epl-v10.html\n" +
+ "# \n" +
+ "# Contributors:\n" +
+ "# IBM Corporation - initial API and implementation\n" +
+ "###############################################################################\n" +
+ "bin.includes= plugin.xml,\\\n" +
+ " plugin.properties,\\\n" +
+ " test.xml,\\\n" +
+ " about.html,\\\n" +
+ " *.jar\n" +
+ "\n" +
+ "src.includes= about.html\n" +
+ " \n" +
+ "source.workbenchtexteditortests.jar= src/\n" +
"");
documents[4]= new Document("/**\n" +
" * This class tests the hippie completion functionality.\n" +
@@ -120,40 +120,40 @@ public class HippieCompletionTest extends TestCase {
"\t\tString $arabic\u20AAWord= \"\u0628\u064E\u0627\u0628\u0650\";\n" + // shekel (israeli) currency symbol + arabic word
"\t\tString \u0628\u0627\u0628= \"\u044D\u0442\";\n" + // arabic var, russian string
"\t\tint \u20A31= 3;\n" + // frank currency symbol
- "\t\tint \u00A3\u0661\u0662\u0663= \u20A31 + \u05DE\u05D7;\n" + // pound, arabic digits 1-3, partial hebrew word
+ "\t\tint \u00A3\u0661\u0662\u0663= \u20A31 + \u05DE\u05D7;\n" + // pound, arabic digits 1-3, partial hebrew word
"\t\tint a\u0300\u0301b= 18;\n" + // combining diactritical marks
"\t\t}\n" +
"\t\t\n" +
"\tpublic void \u05D4\u05D4\u05E9(int \u0441\u0430\u043C) {\n" + // hebrew word prexif, russian word prefix
"\t\tString \u043B\u0443\u0447\u0448= \"\u05D1\u05D5\u05D3\u05E7\";\n" +
- "\t\tchar \u20AA129;\n" + // shekel (israeli) currency
+ "\t\tchar \u20AA129;\n" + // shekel (israeli) currency
"\t}\n" +
"}");
-
+
fEngine= new HippieCompletionEngine();
}
-
+
public void testSearchBackwards1() {
try {
- List list= fEngine.getCompletionsBackwards(documents[0],
+ List list= fEngine.getCompletionsBackwards(documents[0],
"pri", documents[0].get().indexOf("println") + 10);
assertEquals(list.size(), 2);
assertEquals(list.get(0), "ntln");
assertEquals(list.get(1), "nt");
-
- list= fEngine.getCompletionsBackwards(documents[0],
+
+ list= fEngine.getCompletionsBackwards(documents[0],
"pri", documents[0].getLength());
assertEquals(list.size(), 3);
assertEquals(list.get(0), "nting");
assertEquals(list.get(1), "ntln");
assertEquals(list.get(2), "nt");
-
- list= fEngine.getCompletionsBackwards(documents[0],
+
+ list= fEngine.getCompletionsBackwards(documents[0],
"pri", documents[0].get().indexOf("println") + 1);
assertEquals(list.size(), 1);
assertEquals(list.get(0), "nt");
- list= fEngine.getCompletionsBackwards(documents[0],
+ list= fEngine.getCompletionsBackwards(documents[0],
"pa", 2);
assertEquals(list.size(), 0);
@@ -161,52 +161,52 @@ public class HippieCompletionTest extends TestCase {
assertTrue("Got out of document bounds", false);
}
}
-
+
public void testSearchBackwards2() {
try {
- List list= fEngine.getCompletionsBackwards(documents[2],
+ List list= fEngine.getCompletionsBackwards(documents[2],
"plugi", documents[2].getLength());
assertEquals(8, list.size());
list= fEngine.makeUnique(list);
assertEquals(1, list.size());
assertEquals("n", list.get(0));
-
- list= fEngine.getCompletionsBackwards(documents[2],
+
+ list= fEngine.getCompletionsBackwards(documents[2],
"plugin", documents[2].getLength());
assertEquals(0, list.size()); // empty completions discarded
-
+
} catch (BadLocationException e) {
assertTrue("Got out of document bounds", false);
}
}
-
+
public void testSearchBackwards3() {
try {
- List list= fEngine.getCompletionsBackwards(documents[1],
+ List list= fEngine.getCompletionsBackwards(documents[1],
"test", documents[1].getLength());
assertEquals("Number of backwards suggestions does not match", 2, list.size());
- list= fEngine.getCompletionsBackwards(documents[1],
+ list= fEngine.getCompletionsBackwards(documents[1],
"tests", documents[1].getLength());
assertEquals("Number of backwards suggestions does not match", 1, list.size());
- list= fEngine.getCompletionsBackwards(documents[1],
+ list= fEngine.getCompletionsBackwards(documents[1],
"test", documents[1].getLength() - 1);
assertEquals("Number of backwards suggestions does not match", 1, list.size());
} catch (BadLocationException e) {
assertTrue("Got out of document bounds", false);
}
}
-
+
public void testSearch() {
ArrayList docsList= new ArrayList(Arrays.asList(this.documents));
List result= createSuggestions("te", docsList);
assertEquals("Number of completions does not match", 15, result.size());
result= fEngine.makeUnique(result);
assertEquals("Number of completions does not match", 7, result.size());
-
+
result= createSuggestions("Plug", docsList);
assertEquals("Number of completions does not match", 2, result.size());
-
+
result= createSuggestions("p", docsList);
assertEquals("Number of completions does not match", 23, result.size());
result= fEngine.makeUnique(result);
@@ -222,58 +222,58 @@ public class HippieCompletionTest extends TestCase {
assertEquals("Incorrect completion", "rogram", result.get(8));
assertEquals("Incorrect completion", "roperties", result.get(9));
}
-
+
public void testSearch2() {
ArrayList docsList= new ArrayList(Arrays.asList(this.documents));
List result= createSuggestions("printe", docsList);
assertEquals("Number of completions does not match", 0, result.size());
-
+
result= createSuggestions("s", docsList);
assertEquals("Number of completions does not match", 8, result.size());
-
+
result= createSuggestions("pack", documents[0]);
assertEquals("Number of completions does not match", 1, result.size());
}
-
-
+
+
public void testForwardSearch() {
try {
- List result= fEngine.getCompletionsForward(documents[0],
+ List result= fEngine.getCompletionsForward(documents[0],
"cl", documents[0].get().indexOf("cl"), true);
assertEquals(2, result.size());
-
- result= fEngine.getCompletionsForward(documents[0],
+
+ result= fEngine.getCompletionsForward(documents[0],
"cl", documents[0].get().indexOf("cl") + 1, true);
assertEquals(1, result.size());
- result= fEngine.getCompletionsForward(documents[1],
+ result= fEngine.getCompletionsForward(documents[1],
"Thi", 0, true);
assertEquals(1, result.size());
- result= fEngine.getCompletionsForward(documents[1],
+ result= fEngine.getCompletionsForward(documents[1],
"Thi", 1, true);
assertEquals(0, result.size());
} catch (BadLocationException e) {
assertTrue("Got out of document bounds", false);
}
}
-
+
public void testForwardSearchInternational() {
List result;
try {
- result= fEngine.getCompletionsForward(documents[4],
+ result= fEngine.getCompletionsForward(documents[4],
"$", documents[4].get().indexOf('$'), true);
- assertEquals(2, result.size());
+ assertEquals(2, result.size());
assertEquals("arabic\u20AAWord", result.get(0));
assertEquals("arabic\u20ACDigits", result.get(1));
- result= fEngine.getCompletionsForward(documents[4],
+ result= fEngine.getCompletionsForward(documents[4],
"$", documents[4].get().indexOf('$'), false);
- assertEquals(2, result.size());
+ assertEquals(2, result.size());
assertEquals("arabic\u20ACDigits", result.get(0));
assertEquals("arabic\u20AAWord", result.get(1));
- result= fEngine.getCompletionsForward(documents[4],
+ result= fEngine.getCompletionsForward(documents[4],
"$", documents[4].get().indexOf('$') + 1, true);
assertEquals(1, result.size());
assertEquals("arabic\u20AAWord", result.get(0));
@@ -281,23 +281,23 @@ public class HippieCompletionTest extends TestCase {
assertTrue("Got out of document bounds", false);
}
}
-
-
+
+
public void testPrefix() {
try {
- String prefix= fEngine.getPrefixString(documents[0],
+ String prefix= fEngine.getPrefixString(documents[0],
documents[0].get().indexOf("testing") + 3);
assertEquals(prefix, "tes");
-
- prefix= fEngine.getPrefixString(documents[0],
+
+ prefix= fEngine.getPrefixString(documents[0],
documents[0].get().indexOf("public") + 4);
assertEquals(prefix, "publ");
- prefix= fEngine.getPrefixString(documents[0],
+ prefix= fEngine.getPrefixString(documents[0],
documents[0].get().indexOf("println") + 7);
assertEquals(prefix, "println");
- prefix= fEngine.getPrefixString(documents[0],
+ prefix= fEngine.getPrefixString(documents[0],
documents[0].get().indexOf("println") + 8);
assertEquals(prefix, null);
@@ -309,50 +309,50 @@ public class HippieCompletionTest extends TestCase {
prefix= fEngine.getPrefixString(documents[1], documents[1].getLength());
assertEquals(prefix, "tests");
-
- prefix= fEngine.getPrefixString(documents[3],
+
+ prefix= fEngine.getPrefixString(documents[3],
documents[3].get().indexOf("Copyright") - 2);
assertEquals(prefix, null);
-
- prefix= fEngine.getPrefixString(documents[4],
+
+ prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("IDE") + 2);
assertEquals(prefix, "ID");
- prefix= fEngine.getPrefixString(documents[4],
+ prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("$arabic\u20ACDigits") + 8);
assertEquals(prefix, "$arabic\u20AC");
-
- prefix= fEngine.getPrefixString(documents[4],
+
+ prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("$arabic\u20AAWord") + 8);
assertEquals(prefix, "$arabic\u20AA");
-
- prefix= fEngine.getPrefixString(documents[4],
+
+ prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("\u00A3\u0661\u0662\u0663") + 3);
assertEquals(prefix, "\u00A3\u0661\u0662");
-
- prefix= fEngine.getPrefixString(documents[4],
+
+ prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("a\u0300\u0301b") + 3);
assertEquals(prefix, "a\u0300\u0301");
- prefix= fEngine.getPrefixString(documents[4],
+ prefix= fEngine.getPrefixString(documents[4],
documents[4].get().indexOf("\u0667\u0668\u0669\u0660") + 2);
assertEquals(prefix, "\u0667\u0668");
-
+
} catch (BadLocationException e) {
assertTrue("Got out of document bounds", false);
}
}
-
+
public void testInternational() {
IDocument intlDoc= documents[4];
-
+
List result= createSuggestions("\u05D4", intlDoc); // hebrew letter heh
assertEquals("Number of completions does not match", 4, result.size());
assertEquals(result.get(0), "\u05DE\u05D7\u05DC\u05E7\u05D4");
assertEquals(result.get(1), "\u05D6\u05D5");
assertEquals(result.get(2), "\u05D4\u05E9\u05DC\u05DE\u05D5\u05EA");
assertEquals(result.get(3), "\u05D4\u05E9");
-
+
result= createSuggestions("\u0661", intlDoc); // arabic digit "1"
assertEquals("Number of completions does not match", 1, result.size());
assertEquals(result.get(0), "\u0662\u0663\u0664\u0665\u0666");
@@ -380,7 +380,7 @@ public class HippieCompletionTest extends TestCase {
assertEquals(result.get(0), "\u05D3\u05E7\u05EA");
assertEquals(result.get(1), "\u05D3\u05E7");
- result= createSuggestions("a", intlDoc);
+ result= createSuggestions("a", intlDoc);
assertEquals("Number of completions does not match", 4, result.size());
assertEquals(result.get(0), "n");
assertEquals(result.get(1), "rabic");
@@ -404,45 +404,45 @@ public class HippieCompletionTest extends TestCase {
result= createSuggestions("\u00A3", intlDoc); // pound currency sign
assertEquals("Number of completions does not match", 1, result.size());
assertEquals(result.get(0), "\u0661\u0662\u0663");
-
+
result= createSuggestions("\u00A5", intlDoc); // yen currency sign
- assertEquals("Number of completions does not match", 0, result.size());
+ assertEquals("Number of completions does not match", 0, result.size());
}
-
-
+
+
public void testInternationalBackwards() {
IDocument intlDoc= documents[4];
try {
- List list= fEngine.getCompletionsBackwards(intlDoc,
+ List list= fEngine.getCompletionsBackwards(intlDoc,
"\u043B\u0443", intlDoc.get().indexOf("129"));
assertEquals(2, list.size());
assertEquals(list.get(0), "\u0447\u0448");
assertEquals(list.get(1), "\u0447\u0448\u0438\u0439");
- list= fEngine.getCompletionsBackwards(intlDoc,
+ list= fEngine.getCompletionsBackwards(intlDoc,
"\u05DE", intlDoc.get().lastIndexOf('+'));
assertEquals(2, list.size());
assertEquals(list.get(0), "\u05D7");
assertEquals(list.get(1), "\u05E0\u05D2\u05E0\u05D5\u05DF");
- list= fEngine.getCompletionsBackwards(intlDoc,
+ list= fEngine.getCompletionsBackwards(intlDoc,
"\u0667", intlDoc.get().indexOf("\u2021\u0667") + 1);
assertEquals(0, list.size());
-
- list= fEngine.getCompletionsBackwards(intlDoc,
+
+ list= fEngine.getCompletionsBackwards(intlDoc,
"\u0628", intlDoc.get().lastIndexOf("\u0628"));
assertEquals(1, list.size());
assertEquals(list.get(0), "\u064E\u0627\u0628\u0650");
-
+
} catch (BadLocationException e) {
assertTrue("Got out of document bounds", false);
}
}
-
+
public static Test suite() {
- return new TestSuite(HippieCompletionTest.class);
+ return new TestSuite(HippieCompletionTest.class);
}
-
+
private List createSuggestions(String prefix, IDocument doc) {
return createSuggestions(prefix, Arrays.asList(new IDocument[]{doc}));
}
@@ -459,5 +459,5 @@ public class HippieCompletionTest extends TestCase {
}
return results;
}
-
+
}
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/WorkbenchTextEditorTestSuite.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/WorkbenchTextEditorTestSuite.java
index 86867e2e561..ab0f0cc251f 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/WorkbenchTextEditorTestSuite.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/WorkbenchTextEditorTestSuite.java
@@ -21,7 +21,7 @@ import org.eclipse.ui.workbench.texteditor.tests.rulers.RulerTestSuite;
/**
* Test Suite for org.eclipse.ui.workbench.texteditor.
- *
+ *
* @since 3.0
*/
public class WorkbenchTextEditorTestSuite extends TestSuite {
@@ -36,7 +36,7 @@ public class WorkbenchTextEditorTestSuite extends TestSuite {
suite.addTest(ChangeRegionTest.suite());
suite.addTest(RulerTestSuite.suite());
suite.addTest(HunkComputerTest.suite());
-
+
//$JUnit-END$
return suite;
}
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java
index 2dc179925fc..639ef54924a 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java
@@ -19,20 +19,20 @@ import junit.framework.TestSuite;
import org.eclipse.swt.graphics.RGB;
+import org.eclipse.jface.internal.text.revisions.ChangeRegion;
+import org.eclipse.jface.internal.text.revisions.Hunk;
+
import org.eclipse.jface.text.revisions.Revision;
import org.eclipse.jface.text.source.ILineRange;
import org.eclipse.jface.text.source.LineRange;
-import org.eclipse.jface.internal.text.revisions.ChangeRegion;
-import org.eclipse.jface.internal.text.revisions.Hunk;
-
/**
- *
+ *
* @since 3.2
*/
public class ChangeRegionTest extends TestCase {
public static Test suite() {
- return new TestSuite(ChangeRegionTest.class);
+ return new TestSuite(ChangeRegionTest.class);
}
public static final class TestRevision extends Revision {
@@ -54,7 +54,7 @@ public class ChangeRegionTest extends TestCase {
}
private Revision fRevision;
-
+
/*
* @see junit.framework.TestCase#setUp()
*/
@@ -68,32 +68,32 @@ public class ChangeRegionTest extends TestCase {
fail();
} catch (Exception e) {
}
-
+
try {
new ChangeRegion(null, new LineRange(12, 3));
fail();
} catch (Exception e) {
}
-
+
try {
new ChangeRegion(null, null);
fail();
} catch (Exception e) {
}
-
+
ChangeRegion r= new ChangeRegion(fRevision, new LineRange(12, 3));
assertEquals(fRevision, r.getRevision());
RangeUtil.assertEqualRange(new LineRange(12, 3), (ILineRange) r.getAdjustedRanges().get(0));
RangeUtil.assertEqualRange(new LineRange(12, 3), r.getAdjustedCoverage());
}
-
+
public void testHunkAfter() throws Exception {
ChangeRegion r= new ChangeRegion(fRevision, new LineRange(12, 3));
List before= RangeUtil.deepClone(r.getAdjustedRanges());
r.adjustTo(new Hunk(16, 3, 2));
RangeUtil.assertEqualRanges(before, r.getAdjustedRanges());
RangeUtil.assertEqualRange((ILineRange) before.get(0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 3));
before= RangeUtil.deepClone(r.getAdjustedRanges());
r.adjustTo(new Hunk(16, -33, 2));
@@ -107,27 +107,27 @@ public class ChangeRegionTest extends TestCase {
r.adjustTo(new Hunk(15, 3, 2));
RangeUtil.assertEqualRanges(before, r.getAdjustedRanges());
RangeUtil.assertEqualRange((ILineRange) before.get(0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 3));
before= RangeUtil.deepClone(r.getAdjustedRanges());
r.adjustTo(new Hunk(15, -3, 2));
RangeUtil.assertEqualRanges(before, r.getAdjustedRanges());
RangeUtil.assertEqualRange((ILineRange) before.get(0), r.getAdjustedCoverage());
}
-
+
public void testHunkBefore() throws Exception {
ChangeRegion r;
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(5, 3, 2));
RangeUtil.assertEqualSingleRange(new LineRange(15, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 3), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(5, 3, 0));
RangeUtil.assertEqualSingleRange(new LineRange(15, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 3), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(5, -3, 0));
RangeUtil.assertEqualSingleRange(new LineRange(9, 3), r.getAdjustedRanges());
@@ -137,36 +137,36 @@ public class ChangeRegionTest extends TestCase {
r.adjustTo(new Hunk(5, 3, 3));
RangeUtil.assertEqualSingleRange(new LineRange(15, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 3), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(5, -3, 2));
RangeUtil.assertEqualSingleRange(new LineRange(9, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(9, 3), r.getAdjustedCoverage());
}
-
+
public void testHunkRightBefore() throws Exception {
ChangeRegion r;
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(10, 0 , 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 3), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(10, 2 , 2));
RangeUtil.assertEqualSingleRange(new LineRange(14, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(14, 3), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(9, -3, 0));
RangeUtil.assertEqualSingleRange(new LineRange(9, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(9, 3), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(9, -1, 2));
RangeUtil.assertEqualSingleRange(new LineRange(11, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(11, 3), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 3));
r.adjustTo(new Hunk(9, 3, 3));
RangeUtil.assertEqualSingleRange(new LineRange(15, 3), r.getAdjustedRanges());
@@ -177,216 +177,216 @@ public class ChangeRegionTest extends TestCase {
RangeUtil.assertEqualSingleRange(new LineRange(15, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 3), r.getAdjustedCoverage());
}
-
+
public void testHunkAtStart() throws Exception {
ChangeRegion r;
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, 0 , 2));
RangeUtil.assertEqualSingleRange(new LineRange(14, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(14, 5), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, -2, 0));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, -2, 1));
RangeUtil.assertEqualSingleRange(new LineRange(13, 4), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(13, 4), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, 3, 0));
RangeUtil.assertEqualSingleRange(new LineRange(15, 7), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 7), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, 3, 2));
RangeUtil.assertEqualSingleRange(new LineRange(17, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(17, 5), r.getAdjustedCoverage());
}
-
+
public void testHunkAtEnd() throws Exception {
ChangeRegion r;
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, 0, 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, 2, 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(15, -2, 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 3), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 3), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, -2, 0));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
}
-
+
public void testHunkOverStart() throws Exception {
ChangeRegion r;
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(11, 0 , 2));
RangeUtil.assertEqualSingleRange(new LineRange(13, 6), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(13, 6), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(11, 2, 2));
RangeUtil.assertEqualSingleRange(new LineRange(15, 6), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(15, 6), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(11, -2, 2));
RangeUtil.assertEqualSingleRange(new LineRange(13, 4), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(13, 4), r.getAdjustedCoverage());
}
-
+
public void testHunkOverEnd() throws Exception {
ChangeRegion r;
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(18, 0 , 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 6), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 6), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(18, -2, 0));
RangeUtil.assertEqualSingleRange(new LineRange(12, 6), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 6), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(18, -2, 2));
RangeUtil.assertEqualSingleRange(new LineRange(12, 6), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 6), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, -2, 1));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, -2, 3));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(17, 2, 3));
RangeUtil.assertEqualSingleRange(new LineRange(12, 5), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
}
-
+
public void testHunkCovering() throws Exception {
ChangeRegion r;
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, 0 , 7));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(11, 0 , 8));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(11, 0 , 9));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, 0 , 9));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, -7, 0));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(12, -8, 0));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(11, -8, 0));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(11, -9, 0));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(8, -9, 6));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(8, -4, 8));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(8, -3, 9));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(8, -12, 5));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(8, -12, 20));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(8, 12, 20));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(8, -3, 8));
assertTrue(r.getAdjustedRanges().isEmpty());
RangeUtil.assertEqualRange(new LineRange(12, 0), r.getAdjustedCoverage());
}
-
+
public void testHunkInBetween() throws Exception {
// TODO require merging of adjacent ranges?
ChangeRegion r;
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(15, -2, 0));
RangeUtil.assertEqualRanges(new LineRange(12, 3), new LineRange(15, 2), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 5), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(15, 2, 0));
RangeUtil.assertEqualRanges(new LineRange(12, 3), new LineRange(17, 4), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 9), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(15, 0, 2));
RangeUtil.assertEqualRanges(new LineRange(12, 3), new LineRange(17, 2), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 7), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(15, -1, 2));
RangeUtil.assertEqualRanges(new LineRange(12, 3), new LineRange(17, 1), r.getAdjustedRanges());
RangeUtil.assertEqualRange(new LineRange(12, 6), r.getAdjustedCoverage());
-
+
r= new ChangeRegion(fRevision, new LineRange(12, 7));
r.adjustTo(new Hunk(15, 2, 2));
RangeUtil.assertEqualRanges(new LineRange(12, 3), new LineRange(19, 2), r.getAdjustedRanges());
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java
index 408902c41f4..f538c36738f 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java
@@ -14,13 +14,13 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.eclipse.jface.internal.text.revisions.Hunk;
+import org.eclipse.jface.internal.text.revisions.HunkComputer;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.source.ILineDiffInfo;
import org.eclipse.jface.text.source.ILineDiffer;
-import org.eclipse.jface.internal.text.revisions.Hunk;
-import org.eclipse.jface.internal.text.revisions.HunkComputer;
-
/**
* Tests {@link HunkComputer}.
*
@@ -28,13 +28,13 @@ import org.eclipse.jface.internal.text.revisions.HunkComputer;
*/
public class HunkComputerTest extends TestCase {
public static Test suite() {
- return new TestSuite(HunkComputerTest.class);
+ return new TestSuite(HunkComputerTest.class);
}
private static final int A= ILineDiffInfo.ADDED;
private static final int C= ILineDiffInfo.CHANGED;
private static final int U= ILineDiffInfo.UNCHANGED;
-
+
private int[] fDiffInformation;
private ILineDiffer fDiffer= new ILineDiffer() {
@@ -83,128 +83,128 @@ public class HunkComputerTest extends TestCase {
};
private int[] fRemovedBelow;
-
+
public void testNoDiff() throws Exception {
int[] diffInfo= new int[] {U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, };
int[] expected= {};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testShiftOne() throws Exception {
int[] diffInfo= new int[] {C, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, };
int[] expected= {0, 0, 1};
-
+
assertHunks(diffInfo, expected);
}
public void testRemoveFirstLine() throws Exception {
int[] diffInfo= new int[] {U, 1, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, };
int[] expected= {0, -1, 0};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testRemoveSecondLine() throws Exception {
int[] diffInfo= new int[] {U, 0, U, 1, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, };
int[] expected= {1, -1, 0};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testAddFirstLine() throws Exception {
int[] diffInfo= new int[] {A, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, };
int[] expected= {0, 1, 0};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testAddSecondLine() throws Exception {
int[] diffInfo= new int[] {U, 0, A, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, };
int[] expected= {1, 1, 0};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testAddThirdLine() throws Exception {
int[] diffInfo= new int[] {U, 0, U, 0, A, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, };
int[] expected= {2, 1, 0};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testRemoveFirstRegion() throws Exception {
int[] diffInfo= new int[] {U, 2, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, };
int[] expected= {0, -2, 0};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testReplaceFirstRegion() throws Exception {
int[] diffInfo= new int[] {C, 0, C, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, };
int[] expected= {0, 0, 2};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testRemoveOverlappingRegion() throws Exception {
int[] diffInfo= new int[] {U, 0, U, 2, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, };
int[] expected= {1, -2, 0};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testReplaceOverlappingRegion() throws Exception {
int[] diffInfo= new int[] {U, 0, C, 0, C, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, };
int[] expected= {1, 0, 2};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testRemoveInnerLines() throws Exception {
int[] diffInfo= new int[] {U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 2, };
int[] expected= {8, -2, 0};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testReplaceInnerLines() throws Exception {
int[] diffInfo= new int[] {U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, C, 0, C, 0, U, 0, };
int[] expected= {8, 0, 2};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testAddInnerLines() throws Exception {
int[] diffInfo= new int[] {U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, A, 0, A, 0, U, 0, U, 0, U, 0, };
int[] expected= {8, +2, 0};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testRemoveLastLine() throws Exception {
int[] diffInfo= new int[] {U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0};
fRemovedBelow= new int[10];
fRemovedBelow[9]= 1;
int[] expected= {10, -1, 0};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testReplaceLastLine() throws Exception {
int[] diffInfo= new int[] {U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, C, 0, };
int[] expected= {10, 0, 1};
-
+
assertHunks(diffInfo, expected);
}
-
+
public void testAddLastLine() throws Exception {
int[] diffInfo= new int[] {U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, U, 0, A, 0, };
int[] expected= {12, 1, 0};
-
+
assertHunks(diffInfo, expected);
}
-
+
private void assertHunks(int[] diffInfo, int[] expected) {
fDiffInformation= diffInfo;
assertEquals(0, diffInfo.length % 2);
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java
index 9819e99c5e4..aba3b9d3f6e 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java
@@ -14,14 +14,14 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.eclipse.jface.text.source.LineRange;
-
import org.eclipse.jface.internal.text.revisions.LineIndexOutOfBoundsException;
import org.eclipse.jface.internal.text.revisions.Range;
+import org.eclipse.jface.text.source.LineRange;
+
public class RangeTest extends TestCase {
public static Test suite() {
- return new TestSuite(RangeTest.class);
+ return new TestSuite(RangeTest.class);
}
public void testLegalOperations() {
@@ -29,22 +29,22 @@ public class RangeTest extends TestCase {
assertEquals(0, r.start());
assertEquals(1, r.length());
assertConsistency(r);
-
+
r= Range.createAbsolute(5, 6);
assertEquals(5, r.start());
assertEquals(1, r.length());
assertConsistency(r);
-
+
r= Range.copy(new LineRange(5, 1));
assertEquals(5, r.start());
assertEquals(1, r.length());
assertConsistency(r);
-
+
r= Range.createRelative(5, 1);
assertEquals(5, r.start());
assertEquals(1, r.length());
assertConsistency(r);
-
+
r.moveBy(10);
assertEquals(15, r.start());
assertEquals(1, r.length());
@@ -54,149 +54,149 @@ public class RangeTest extends TestCase {
assertEquals(7, r.start());
assertEquals(1, r.length());
assertConsistency(r);
-
+
r.moveTo(12);
assertEquals(12, r.start());
assertEquals(1, r.length());
assertConsistency(r);
-
+
r.resizeBy(4);
assertEquals(12, r.start());
assertEquals(5, r.length());
assertConsistency(r);
-
+
r.resizeAndMoveBy(3);
assertEquals(15, r.start());
assertEquals(2, r.length());
assertConsistency(r);
-
+
r.resizeAndMoveBy(-3);
assertEquals(12, r.start());
assertEquals(5, r.length());
assertConsistency(r);
-
+
r.setLength(3);
assertEquals(12, r.start());
assertEquals(3, r.length());
assertConsistency(r);
-
+
r.resizeBy(13);
assertEquals(12, r.start());
assertEquals(16, r.length());
assertConsistency(r);
-
+
r.resizeBy(-4);
assertEquals(12, r.start());
assertEquals(12, r.length());
assertConsistency(r);
-
+
r.setEnd(18);
assertEquals(12, r.start());
assertEquals(6, r.length());
assertConsistency(r);
-
+
r.moveEndTo(13);
assertEquals(7, r.start());
assertEquals(6, r.length());
assertConsistency(r);
-
+
r.setLengthAndMove(3);
assertEquals(10, r.start());
assertEquals(3, r.length());
assertConsistency(r);
-
+
r.setStart(7);
assertEquals(7, r.start());
assertEquals(6, r.length());
assertConsistency(r);
}
-
+
public void testSplit() throws Exception {
Range r= Range.createRelative(12, 18);
Range second= r.split(8);
assertEquals(12, r.start());
assertEquals(8, r.length());
assertConsistency(r);
-
+
assertEquals(20, second.start());
assertEquals(10, second.length());
assertConsistency(second);
}
-
+
public void testIllegalOperations() throws Exception {
-
+
try {
Range.copy(null);
fail();
} catch (NullPointerException e) {
}
-
+
try {
Range.createRelative(0, 0);
fail();
} catch (LineIndexOutOfBoundsException e) {
}
-
+
try {
Range.createRelative(0, -1);
fail();
} catch (LineIndexOutOfBoundsException e) {
}
-
+
try {
Range.createRelative(-1, 0);
fail();
} catch (LineIndexOutOfBoundsException e) {
}
-
+
try {
Range.createRelative(-1, -1);
fail();
} catch (LineIndexOutOfBoundsException e) {
}
-
+
try {
Range.createAbsolute(0, 0);
fail();
} catch (LineIndexOutOfBoundsException e) {
}
-
+
try {
Range.createAbsolute(0, -1);
fail();
} catch (LineIndexOutOfBoundsException e) {
}
-
+
try {
Range.createAbsolute(-1, 0);
fail();
} catch (LineIndexOutOfBoundsException e) {
}
-
+
try {
Range.createAbsolute(-1, 12);
fail();
} catch (LineIndexOutOfBoundsException e) {
}
-
+
try {
Range.createAbsolute(10, 10);
fail();
} catch (LineIndexOutOfBoundsException e) {
}
-
+
try {
Range.createAbsolute(12, 10);
fail();
} catch (LineIndexOutOfBoundsException e) {
}
-
+
try {
Range.createAbsolute(12, -3);
fail();
} catch (LineIndexOutOfBoundsException e) {
}
-
+
Range r= Range.createRelative(5, 10);
try {
@@ -218,7 +218,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.resizeBy(-11);
fail();
@@ -236,7 +236,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.resizeAndMoveBy(10);
fail();
@@ -245,7 +245,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.resizeAndMoveBy(11);
fail();
@@ -254,7 +254,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.resizeAndMoveBy(20);
fail();
@@ -263,7 +263,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.setLength(0);
fail();
@@ -272,7 +272,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.setLength(-1);
fail();
@@ -281,7 +281,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.moveTo(-1);
fail();
@@ -290,7 +290,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.setEnd(5);
fail();
@@ -299,7 +299,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.setEnd(3);
fail();
@@ -308,7 +308,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.setEnd(-5);
fail();
@@ -317,7 +317,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.setStart(18);
fail();
@@ -326,7 +326,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.moveEndTo(9);
fail();
@@ -335,7 +335,7 @@ public class RangeTest extends TestCase {
assertEquals(10, r.length());
assertConsistency(r);
}
-
+
try {
r.setLengthAndMove(16);
fail();
@@ -345,10 +345,10 @@ public class RangeTest extends TestCase {
assertConsistency(r);
}
}
-
+
public void testIllegalSplit() throws Exception {
Range r= Range.createRelative(12, 18);
-
+
try {
r.split(-1);
} catch (LineIndexOutOfBoundsException e) {
@@ -356,7 +356,7 @@ public class RangeTest extends TestCase {
assertEquals(18, r.length());
assertConsistency(r);
}
-
+
try {
r.split(0);
} catch (LineIndexOutOfBoundsException e) {
@@ -364,7 +364,7 @@ public class RangeTest extends TestCase {
assertEquals(18, r.length());
assertConsistency(r);
}
-
+
try {
r.split(18);
} catch (LineIndexOutOfBoundsException e) {
@@ -372,7 +372,7 @@ public class RangeTest extends TestCase {
assertEquals(18, r.length());
assertConsistency(r);
}
-
+
try {
r.split(20);
} catch (LineIndexOutOfBoundsException e) {
@@ -381,7 +381,7 @@ public class RangeTest extends TestCase {
assertConsistency(r);
}
}
-
+
private static void assertConsistency(Range r) {
assertEquals(r, r);
assertTrue(r.equalRange(Range.copy(r)));
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java
index f04f7f7c2b6..a232d63d265 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java
@@ -16,10 +16,10 @@ import java.util.List;
import junit.framework.Assert;
-import org.eclipse.jface.text.source.ILineRange;
-
import org.eclipse.jface.internal.text.revisions.Range;
+import org.eclipse.jface.text.source.ILineRange;
+
class RangeUtil extends Assert {
private RangeUtil() {}
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java
index bf140cfaf4e..34200e55441 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java
@@ -34,15 +34,15 @@ public class DAGTest extends TestCase {
private static final Set CD= new LinkedHashSet(Arrays.asList(new Object[] { C, D }));
private static final Set ACD= new LinkedHashSet(Arrays.asList(new Object[] { A, C, D }));
private static final Set BD= new LinkedHashSet(Arrays.asList(new Object[] { B, D }));
-
+
private DAG fDag= new DAG();
-
+
public void testEmpty() throws Exception {
assertTrue(fDag.getChildren(new Object()).isEmpty());
assertTrue(fDag.getSources().isEmpty());
assertTrue(fDag.getSinks().isEmpty());
}
-
+
public void testIllegal() throws Exception {
assertFalse(fDag.addEdge(A, A));
try {
@@ -66,7 +66,7 @@ public class DAGTest extends TestCase {
} catch (RuntimeException x) {
}
}
-
+
public void testDag() throws Exception {
assertTrue(fDag.addEdge(A, B));
assertEquals(AS, fDag.getSources());
@@ -78,7 +78,7 @@ public class DAGTest extends TestCase {
assertTrue(fDag.getChildren(B).isEmpty());
assertTrue(fDag.getChildren(C).isEmpty());
assertTrue(fDag.getChildren(D).isEmpty());
-
+
assertTrue(fDag.addEdge(B, C));
assertEquals(AS, fDag.getSources());
assertEquals(CS, fDag.getSinks());
@@ -86,7 +86,7 @@ public class DAGTest extends TestCase {
assertEquals(CS, fDag.getChildren(B));
assertTrue(fDag.getChildren(C).isEmpty());
assertTrue(fDag.getChildren(D).isEmpty());
-
+
fDag.addVertex(C);
assertEquals(AS, fDag.getSources());
assertEquals(CS, fDag.getSinks());
@@ -94,7 +94,7 @@ public class DAGTest extends TestCase {
assertEquals(CS, fDag.getChildren(B));
assertTrue(fDag.getChildren(C).isEmpty());
assertTrue(fDag.getChildren(D).isEmpty());
-
+
fDag.addVertex(D);
assertEquals(AD, fDag.getSources());
assertEquals(CD, fDag.getSinks());
@@ -102,7 +102,7 @@ public class DAGTest extends TestCase {
assertEquals(CS, fDag.getChildren(B));
assertTrue(fDag.getChildren(C).isEmpty());
assertTrue(fDag.getChildren(D).isEmpty());
-
+
fDag.removeVertex(A);
assertEquals(BD, fDag.getSources());
assertEquals(CD, fDag.getSinks());
@@ -110,7 +110,7 @@ public class DAGTest extends TestCase {
assertEquals(CS, fDag.getChildren(B));
assertTrue(fDag.getChildren(C).isEmpty());
assertTrue(fDag.getChildren(D).isEmpty());
-
+
assertTrue(fDag.addEdge(A, B));
assertTrue(fDag.addEdge(D, B));
assertEquals(AD, fDag.getSources());
@@ -119,7 +119,7 @@ public class DAGTest extends TestCase {
assertEquals(CS, fDag.getChildren(B));
assertTrue(fDag.getChildren(C).isEmpty());
assertEquals(BS, fDag.getChildren(D));
-
+
fDag.removeVertex(B);
assertEquals(ACD, fDag.getSources());
assertEquals(ACD, fDag.getSinks());
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistHandler.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistHandler.java
index f6129d50755..dc47e55eaff 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistHandler.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/contentassist/ContentAssistHandler.java
@@ -36,6 +36,7 @@ import org.eclipse.ui.handlers.IHandlerActivation;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.internal.texteditor.NLSUtility;
import org.eclipse.ui.keys.IBindingService;
+
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
@@ -212,7 +213,7 @@ public class ContentAssistHandler {
IHandlerService handlerService= (IHandlerService)PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
if (handlerService == null)
return;
-
+
IHandler handler= new AbstractHandler() {
public Object execute(ExecutionEvent event) throws ExecutionException {
if (ContentAssistHandler.this.isEnabled()) // don't call AbstractHandler#isEnabled()!
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/CompoundEditExitStrategy.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/CompoundEditExitStrategy.java
index f4f20178890..8b0709fab27 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/CompoundEditExitStrategy.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/CompoundEditExitStrategy.java
@@ -49,7 +49,7 @@ import org.eclipse.ui.commands.ICommandService;
* If the end of a compound edit is detected, any registered {@link ICompoundEditListener}s are
* notified and the strategy is disarmed (spring-loaded).
* </p>
- *
+ *
* @since 3.1
*/
public final class CompoundEditExitStrategy {
@@ -113,7 +113,7 @@ public final class CompoundEditExitStrategy {
if ((event.keyCode & SWT.MODIFIER_MASK) == 0 && (event.stateMask & maskWithoutShift) == 0)
fireEndCompoundEdit();
}
-
+
}
private final String[] fCommandIds;
@@ -126,7 +126,7 @@ public final class CompoundEditExitStrategy {
/**
* Creates a new strategy, equivalent to calling
* {@linkplain #CompoundEditExitStrategy(String[]) CompoundEditExitStrategy(new String[] &#x7b; commandId &#x7d;)}.
- *
+ *
* @param commandId the command id of the repeatable command
*/
public CompoundEditExitStrategy(String commandId) {
@@ -134,11 +134,11 @@ public final class CompoundEditExitStrategy {
throw new NullPointerException("commandId"); //$NON-NLS-1$
fCommandIds= new String[] {commandId};
}
-
+
/**
* Creates a new strategy, ending upon execution of any command other than the ones
* specified.
- *
+ *
* @param commandIds the ids of the repeatable commands
*/
public CompoundEditExitStrategy(String[] commandIds) {
@@ -149,11 +149,11 @@ public final class CompoundEditExitStrategy {
fCommandIds= new String[commandIds.length];
System.arraycopy(commandIds, 0, fCommandIds, 0, commandIds.length);
}
-
+
/**
* Installs the receiver on <code>viewer</code> and arms it. After this call returns, any
* registered listeners will be notified if a compound edit ends.
- *
+ *
* @param viewer the viewer to install on
*/
public void arm(ITextViewer viewer) {
@@ -163,7 +163,7 @@ public final class CompoundEditExitStrategy {
fViewer= viewer;
addListeners(fViewer);
}
-
+
/**
* Disarms the receiver. After this call returns, any registered listeners will be not be
* notified any more until <code>install</code> is called again. Note that the listeners are
@@ -192,12 +192,12 @@ public final class CompoundEditExitStrategy {
if (commandService != null)
commandService.addExecutionListener(fEventListener);
}
-
+
private void removeListeners() {
ICommandService commandService= (ICommandService)PlatformUI.getWorkbench().getAdapter(ICommandService.class);
if (commandService != null)
commandService.removeExecutionListener(fEventListener);
-
+
if (fWidgetEventSource != null) {
fWidgetEventSource.removeFocusListener(fEventListener);
fWidgetEventSource.removeMouseListener(fEventListener);
@@ -209,7 +209,7 @@ public final class CompoundEditExitStrategy {
private boolean isInstalled() {
return fViewer != null;
}
-
+
private void fireEndCompoundEdit() {
disarm();
Object[] listeners= fListenerList.getListeners();
@@ -223,26 +223,26 @@ public final class CompoundEditExitStrategy {
}
}
}
-
+
/**
* Adds a compound edit listener. Multiple registration is possible. Note that the receiver is
* automatically disarmed before the listeners are notified.
- *
+ *
* @param listener the new listener
*/
public void addCompoundListener(ICompoundEditListener listener) {
fListenerList.add(listener);
}
-
+
/**
* Removes a compound edit listener. If <code>listener</code> is registered multiple times, an
* arbitrary instance is removed. If <code>listener</code> is not currently registered,
* nothing happens.
- *
+ *
* @param listener the listener to be removed.
*/
public void removeCompoundListener(ICompoundEditListener listener) {
fListenerList.remove(listener);
}
-
+
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/GotoLastEditPositionAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/GotoLastEditPositionAction.java
index ac3f517ec60..5f376ae4b2f 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/GotoLastEditPositionAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/GotoLastEditPositionAction.java
@@ -25,6 +25,7 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+
import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/HippieCompletionEngine.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/HippieCompletionEngine.java
index 83816a2b91b..545b8e6b909 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/HippieCompletionEngine.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/HippieCompletionEngine.java
@@ -47,21 +47,21 @@ public final class HippieCompletionEngine {
private static final String COMPLETION_WORD_REGEX= "[\\p{L}[\\p{Mn}[\\p{Pc}[\\p{Nd}[\\p{Nl}[\\p{Sc}]]]]]]+"; //$NON-NLS-1$
/**
* The pre-compiled word pattern.
- *
+ *
* @since 3.2
*/
private static final Pattern COMPLETION_WORD_PATTERN= Pattern.compile(COMPLETION_WORD_REGEX);
-
+
/**
* Word boundary pattern that does not allow searching at the beginning of the document.
- *
+ *
* @since 3.2
*/
private static final String NON_EMPTY_COMPLETION_BOUNDARY= "[\\s\\p{Z}[\\p{P}&&[\\P{Pc}]][\\p{S}&&[\\P{Sc}]]]+"; //$NON-NLS-1$
-
+
/**
* The word boundary pattern string.
- *
+ *
* @since 3.2
*/
private static final String COMPLETION_BOUNDARY= "(^|" + NON_EMPTY_COMPLETION_BOUNDARY + ")"; //$NON-NLS-1$ //$NON-NLS-2$
@@ -120,7 +120,7 @@ public final class HippieCompletionEngine {
/**
* Return the list of completion suggestions that correspond to the
* provided prefix.
- *
+ *
* @param document the document to be scanned
* @param prefix the prefix to search for
* @param firstPosition the initial position in the document that
@@ -129,17 +129,17 @@ public final class HippieCompletionEngine {
* @param currentWordLast if <code>true</code> the word at caret position
* should be that last completion. <code>true</code> is good
* for searching in the currently open document and <code>false</code>
- * is good for searching in other documents.
+ * is good for searching in other documents.
* @return a {@link List} of possible completions (as {@link String}s),
* excluding the common prefix
* @throws BadLocationException if there is some error scanning the
* document.
*/
- public List getCompletionsForward(IDocument document, CharSequence prefix,
+ public List getCompletionsForward(IDocument document, CharSequence prefix,
int firstPosition, boolean currentWordLast) throws BadLocationException {
ArrayList res= new ArrayList();
String currentWordCompletion= null; // fix bug 132533
-
+
if (firstPosition == document.getLength()) {
return res;
}
@@ -154,13 +154,13 @@ public final class HippieCompletionEngine {
// because the boundary pattern has the (....)+ form.
// see HippieCompletionTest#testForwardSearch().
if (firstPosition > 0) {
- firstPosition--;
+ firstPosition--;
// empty spacing is not permitted now.
searchPattern= NON_EMPTY_COMPLETION_BOUNDARY + asRegPattern(prefix);
} else {
searchPattern= COMPLETION_BOUNDARY + asRegPattern(prefix);
}
-
+
IRegion reg= searcher.find(firstPosition, searchPattern, true, CASE_SENSITIVE, false, true);
while (reg != null) {
// since the boundary may be of nonzero length
@@ -182,7 +182,7 @@ public final class HippieCompletionEngine {
}
reg= searcher.find(nextPos, searchPattern, true, CASE_SENSITIVE, false, true);
}
-
+
// the word at caret position goes last (bug 132533).
if (currentWordCompletion != null) {
res.add(currentWordCompletion);
@@ -216,7 +216,7 @@ public final class HippieCompletionEngine {
FindReplaceDocumentAdapter searcher= new FindReplaceDocumentAdapter(document);
// search only at word boundaries
- String searchPattern= COMPLETION_BOUNDARY + asRegPattern(prefix);
+ String searchPattern= COMPLETION_BOUNDARY + asRegPattern(prefix);
IRegion reg= searcher.find(0, searchPattern, true, CASE_SENSITIVE, false, true);
while (reg != null) {
@@ -244,7 +244,7 @@ public final class HippieCompletionEngine {
/**
* Returns the text between the provided position and the preceding word boundary.
- *
+ *
* @param doc the document that will be scanned.
* @param pos the caret position.
* @return the text if found, or null.
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/ICompoundEditListener.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/ICompoundEditListener.java
index b490767aefb..25cd6b3c833 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/ICompoundEditListener.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/ICompoundEditListener.java
@@ -13,7 +13,7 @@ package org.eclipse.ui.internal.texteditor;
/**
* <code>ICompoundEditListener</code>s can be registered with a
* {@link CompoundEditExitStrategy} to be notified if a compound edit session is ended.
- *
+ *
* @since 3.1
*/
public interface ICompoundEditListener {
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/PixelConverter.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/PixelConverter.java
index a25e1138a1d..7581b00a164 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/PixelConverter.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/PixelConverter.java
@@ -20,13 +20,13 @@ import org.eclipse.jface.dialogs.Dialog;
/**
* Helper class to convert from various
* dimensions into pixels.
- *
+ *
* @since 3.3
*/
public class PixelConverter {
-
+
private FontMetrics fFontMetrics;
-
+
public PixelConverter(Control control) {
GC gc = new GC(control);
gc.setFont(control.getFont());
@@ -54,12 +54,12 @@ public class PixelConverter {
public int convertVerticalDLUsToPixels(int dlus) {
return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
}
-
+
/*
* @see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int)
*/
public int convertWidthInCharsToPixels(int chars) {
return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);
- }
+ }
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/SWTUtil.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/SWTUtil.java
index 3df8282a639..f03b7a511f0 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/SWTUtil.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/SWTUtil.java
@@ -22,15 +22,15 @@ import org.eclipse.jface.resource.JFaceResources;
/**
* Utility class to simplify access to some SWT resources.
- *
+ *
* @since 3.3
*/
public class SWTUtil {
/**
* Returns a width hint for the given button.
- *
- * @param button the button
+ *
+ * @param button the button
* @return the width hint for the button
*/
public static int getButtonWidthHint(Button button) {
@@ -44,15 +44,15 @@ public class SWTUtil {
* 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 button 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).widthHint= getButtonWidthHint(button);
- ((GridData)gd).horizontalAlignment = GridData.FILL;
+ ((GridData)gd).widthHint= getButtonWidthHint(button);
+ ((GridData)gd).horizontalAlignment = GridData.FILL;
}
}
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/TextEditorPlugin.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/TextEditorPlugin.java
index bc3063105eb..8068b4765dc 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/TextEditorPlugin.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/TextEditorPlugin.java
@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.IAction;
-
import org.eclipse.ui.internal.texteditor.quickdiff.QuickDiffExtensionsRegistry;
import org.eclipse.ui.internal.texteditor.spelling.SpellingEngineRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DiffRegion.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DiffRegion.java
index 762bc4c33db..60ec1132c48 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DiffRegion.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DiffRegion.java
@@ -40,7 +40,7 @@ public final class DiffRegion extends Annotation implements ILineDiffInfo {
/**
* Creates a new diff region.
- *
+ *
* @param difference the range difference
* @param offset the offset
* @param differences the list of diffrences
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DocumentLineDiffer.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DocumentLineDiffer.java
index 50e63568d2a..e9a89aac3fb 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DocumentLineDiffer.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DocumentLineDiffer.java
@@ -60,6 +60,7 @@ import org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.IRa
import org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.RangeDifference;
import org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.RangeDifferencer;
import org.eclipse.ui.progress.IProgressConstants;
+
import org.eclipse.ui.texteditor.quickdiff.IQuickDiffReferenceProvider;
/**
@@ -438,7 +439,7 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
/**
* (Re-)initializes the differ using the current reference and <code>DiffInitializer</code>.
- *
+ *
* @since 3.2 protected for testing reasons, package visible before
*/
protected synchronized void initialize() {
@@ -536,21 +537,21 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
// accessing the reference document from a different thread - reference providers need
// to be able to deal with this.
left.addDocumentListener(DocumentLineDiffer.this);
-
+
// create the reference copy - note that any changes on the
// reference will trigger re-initialization anyway
reference= createCopy(left);
if (reference == null)
return Status.CANCEL_STATUS;
-
+
// create the actual copy
-
+
Object lock= null;
if (right instanceof ISynchronizable)
lock= ((ISynchronizable) right).getLockObject();
-
+
if (lock != null) {
- // a) if we can, acquire locks in proper order and copy
+ // a) if we can, acquire locks in proper order and copy
// the document
synchronized (lock) {
synchronized (DocumentLineDiffer.this) {
@@ -572,18 +573,18 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
// this is an arbitrary emergency exit in case a referenced document goes nuts
if (i++ == 100)
return new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.OK, NLSUtility.format(QuickDiffMessages.quickdiff_error_getting_document_content, new Object[] {left.getClass(), right.getClass()}), null);
-
+
synchronized (DocumentLineDiffer.this) {
if (isCanceled(monitor))
return Status.CANCEL_STATUS;
-
+
fStoredEvents.clear();
}
-
+
// access documents non synchronized:
// get an exclusive copy of the actual document
actual= createCopy(right);
-
+
synchronized (DocumentLineDiffer.this) {
if (isCanceled(monitor))
return Status.CANCEL_STATUS;
@@ -593,11 +594,11 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
} while (true);
}
- IHashFunction hash= new DJBHashFunction();
+ IHashFunction hash= new DJBHashFunction();
DocumentEquivalenceClass leftEquivalent= new DocumentEquivalenceClass(reference, hash);
fLeftEquivalent= leftEquivalent;
IRangeComparator ref= new DocEquivalenceComparator(leftEquivalent, null);
-
+
DocumentEquivalenceClass rightEquivalent= new DocumentEquivalenceClass(actual, hash);
fRightEquivalent= rightEquivalent;
IRangeComparator act= new DocEquivalenceComparator(rightEquivalent, null);
@@ -635,7 +636,7 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
event= (DocumentEvent) fStoredEvents.remove(0);
}
-
+
// access documents non synchronized:
IDocument copy= null;
if (event.fDocument == right)
@@ -644,15 +645,15 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
copy= reference;
else
Assert.isTrue(false);
-
+
// copy the event to inject it into our diff copies
// don't modify the original event! See https://bugs.eclipse.org/bugs/show_bug.cgi?id=134227
event= new DocumentEvent(copy, event.fOffset, event.fLength, event.fText);
handleAboutToBeChanged(event);
-
+
// inject the event into our private copy
actual.replace(event.fOffset, event.fLength, event.fText);
-
+
handleChanged(event);
} while (true);
@@ -731,7 +732,7 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
initialize();
return;
}
-
+
// if a initialization is going on, we just store the events in the meantime
if (!isInitialized()) {
if (fInitializationJob != null)
@@ -774,7 +775,7 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
void handleAboutToBeChanged(DocumentEvent event) throws BadLocationException {
Assert.isTrue(fThread == null);
fThread= Thread.currentThread();
-
+
IDocument doc= event.getDocument();
DocumentEquivalenceClass rightEquivalent= fRightEquivalent;
@@ -793,7 +794,7 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
public synchronized void documentChanged(DocumentEvent event) {
final Thread lastCurrentThread= fThread;
fThread= null;
-
+
if (fIgnoreDocumentEvents)
return;
@@ -804,7 +805,7 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
initialize();
return;
}
-
+
if (event != fLastUIEvent) {
fLastUIEvent= null;
return;
@@ -813,7 +814,7 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
if (!isInitialized())
return;
-
+
try {
fThread= lastCurrentThread;
handleChanged(event);
@@ -878,20 +879,20 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
void handleChanged(DocumentEvent event) throws BadLocationException {
Assert.isTrue(fThread == Thread.currentThread());
fThread= null;
-
+
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=132125
IDocument left= fLeftDocument;
DocumentEquivalenceClass leftEquivalent= fLeftEquivalent;
DocumentEquivalenceClass rightEquivalent= fRightEquivalent;
if (left == null || leftEquivalent == null || rightEquivalent == null)
return;
-
+
// documents: left, right; modified and unchanged are either of both
IDocument right= event.getDocument(); // TODO two-side
IDocument modified= event.getDocument();
if (modified != left && modified != right)
Assert.isTrue(false);
-
+
boolean leftToRight= modified == left;
String insertion= event.getText();
@@ -1097,7 +1098,7 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
current.shiftLeft(leftShift);
current.shiftRight(rightShift);
}
-
+
fUpdateNeeded= changed;
}
@@ -1415,7 +1416,7 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
}
fRightDocument= null;
fRightEquivalent= null;
-
+
fDifferences.clear();
}
@@ -1517,7 +1518,7 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
Job job= fInitializationJob;
if (job != null)
job.cancel();
-
+
synchronized (this) {
fInitializationJob= null;
if (fRightDocument != null)
@@ -1526,13 +1527,13 @@ public class DocumentLineDiffer implements ILineDiffer, IDocumentListener, IAnno
fLeftDocument.removeDocumentListener(this);
fLeftDocument= null;
fLeftEquivalent= null;
-
+
fLastDifference= null;
fStoredEvents.clear();
fDifferences.clear();
-
+
fState= SUSPENDED;
-
+
fireModelChanged();
}
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffExtensionsRegistry.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffExtensionsRegistry.java
index e5aca4acfde..d6db1bbcbb7 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffExtensionsRegistry.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffExtensionsRegistry.java
@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
+
import org.eclipse.ui.texteditor.quickdiff.ReferenceProviderDescriptor;
/**
@@ -87,7 +88,7 @@ public class QuickDiffExtensionsRegistry {
fDefaultDescriptor= desc;
list.add(desc);
}
-
+
// make sure the default is the first one in the list
if (fDefaultDescriptor != null) {
list.remove(fDefaultDescriptor);
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffRestoreAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffRestoreAction.java
index 2345f6ceffc..80728e44689 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffRestoreAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/QuickDiffRestoreAction.java
@@ -150,7 +150,7 @@ public abstract class QuickDiffRestoreAction extends TextEditorAction implements
/**
* Returns the active line.
- *
+ *
* @param useRulerInfo <code>true</code> if ruler info should be used
* @return the line of interest.
* @since 3.1
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/ReferenceSelectionAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/ReferenceSelectionAction.java
index 0e3d1fcce6b..40207bb3037 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/ReferenceSelectionAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/ReferenceSelectionAction.java
@@ -20,12 +20,13 @@ import org.eclipse.jface.text.source.IAnnotationModelExtension;
import org.eclipse.jface.text.source.IChangeRulerColumn;
import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.texteditor.quickdiff.IQuickDiffReferenceProvider;
-import org.eclipse.ui.texteditor.quickdiff.ReferenceProviderDescriptor;
+
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorExtension3;
import org.eclipse.ui.texteditor.IUpdate;
+import org.eclipse.ui.texteditor.quickdiff.IQuickDiffReferenceProvider;
+import org.eclipse.ui.texteditor.quickdiff.ReferenceProviderDescriptor;
/**
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RestoreAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RestoreAction.java
index d4241f2809c..a3b622d5251 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RestoreAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/RestoreAction.java
@@ -16,6 +16,7 @@ import org.eclipse.jface.text.source.ILineDiffInfo;
import org.eclipse.jface.text.source.ILineDiffer;
import org.eclipse.ui.internal.texteditor.NLSUtility;
+
import org.eclipse.ui.texteditor.ITextEditor;
/**
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DJBHashFunction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DJBHashFunction.java
index 524c6698764..466d61b745b 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DJBHashFunction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DJBHashFunction.java
@@ -11,7 +11,7 @@
package org.eclipse.ui.internal.texteditor.quickdiff.compare.equivalence;
/**
- *
+ *
* @since 3.2
*/
public final class DJBHashFunction implements IHashFunction {
@@ -19,7 +19,7 @@ public final class DJBHashFunction implements IHashFunction {
public Hash computeHash(CharSequence string) {
return new IntHash(hash(string));
}
-
+
private int hash(CharSequence seq){
int hash = 5381;
int len= seq.length();
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DocEquivalenceComparator.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DocEquivalenceComparator.java
index fd996f82535..63ac29ff44e 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DocEquivalenceComparator.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DocEquivalenceComparator.java
@@ -35,7 +35,7 @@ public final class DocEquivalenceComparator implements IRangeComparator {
private final int fLines;
private boolean fSkip= false;
-
+
public DocEquivalenceComparator(DocumentEquivalenceClass equivalenceClass, ILineRange range) {
fEquivalenceClass= equivalenceClass;
if (range == null) {
@@ -82,7 +82,7 @@ public final class DocEquivalenceComparator implements IRangeComparator {
}
return false;
}
-
+
Hash getHash(int index) {
return fEquivalenceClass.getHash(fLineOffset + index);
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DocumentEquivalenceClass.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DocumentEquivalenceClass.java
index 851ce11d1d0..3019e900233 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DocumentEquivalenceClass.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/DocumentEquivalenceClass.java
@@ -28,15 +28,15 @@ import org.eclipse.jface.text.IRegion;
public final class DocumentEquivalenceClass {
private static final boolean DEBUG= false;
-
+
private final ArrayList fHashes;
private IDocument fDocument;
private final IHashFunction fHashFunction;
-
+
public DocumentEquivalenceClass(IDocument document) {
this(document, new DJBHashFunction());
}
-
+
public DocumentEquivalenceClass(IDocument document, IHashFunction hashFunction) {
fDocument= document;
Object[] nulls= new Object[fDocument.getNumberOfLines()];
@@ -46,10 +46,10 @@ public final class DocumentEquivalenceClass {
throw new NullPointerException("hashFunction"); //$NON-NLS-1$
fHashFunction= hashFunction;
}
-
+
/**
* Returns the equivalence hash for line <code>line</code>.
- *
+ *
* @param line the line for which to get the equivalent hash
* @return the hash in the equivalence class defined by the hash
* function
@@ -71,13 +71,13 @@ public final class DocumentEquivalenceClass {
if (hash == null) {
if (fDocument == null)
throw new AssertionError("hash cannot be null after loadAndForget"); //$NON-NLS-1$
-
+
IRegion lineRegion= fDocument.getLineInformation(line);
String lineContents= fDocument.get(lineRegion.getOffset(), lineRegion.getLength());
hash= fHashFunction.computeHash(lineContents);
fHashes.set(line, hash);
}
-
+
return hash;
}
@@ -85,7 +85,7 @@ public final class DocumentEquivalenceClass {
* Cleanses the lines affected by the document event from the
* internal hash cache. Must be called before the document is
* modified (in documentAboutToBeChanged).
- *
+ *
* @param event the document event
*/
public void update(DocumentEvent event) {
@@ -97,16 +97,16 @@ public final class DocumentEquivalenceClass {
throw new ConcurrentModificationException();
}
}
-
+
private void internalUpdate(DocumentEvent event) throws BadLocationException {
int linesBefore= fDocument.getNumberOfLines(event.getOffset(), event.getLength());
String text= event.getText();
int linesAfter= (text == null ? 0 : fDocument.computeNumberOfLines(text)) + 1;
int firstLine= fDocument.getLineOfOffset(event.getOffset());
-
+
int delta= linesAfter - linesBefore;
int changed= Math.min(linesAfter, linesBefore);
-
+
if (delta > 0) {
Object[] nulls= new Object[delta];
fHashes.addAll(firstLine + changed, Arrays.asList(nulls));
@@ -138,7 +138,7 @@ public final class DocumentEquivalenceClass {
int count= getCount();
for (int line= 0; line < count; line++)
getHash(line);
-
+
fDocument= null;
}
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/Hash.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/Hash.java
index aad327b400c..2d82319f90c 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/Hash.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/Hash.java
@@ -13,11 +13,11 @@ package org.eclipse.ui.internal.texteditor.quickdiff.compare.equivalence;
/**
* Value objects. Subclasses must override <code>equals</code> and are
* typically <code>final</code>.
- *
+ *
* @since 3.2
*/
public abstract class Hash implements Cloneable {
-
+
public Object clone() {
try {
return super.clone();
@@ -25,11 +25,11 @@ public abstract class Hash implements Cloneable {
throw new AssertionError(x);
}
}
-
+
/**
* Returns <code>true</code> if the two hashes are equal,
* <code>false</code> if not. Subclasses must override.
- *
+ *
* @param obj {@inheritDoc}
* @return <code>true</code> if the receiver is equal to <code>obj</code>
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/IntHash.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/IntHash.java
index 2e4111159ce..fb2e7ef5063 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/IntHash.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/equivalence/IntHash.java
@@ -26,7 +26,7 @@ public final class IntHash extends Hash {
if (obj instanceof IntHash) {
return fHash == ((IntHash) obj).fHash;
}
-
+
return false;
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/Levenshtein.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/Levenshtein.java
index f9146960f97..f005cfcb149 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/Levenshtein.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/Levenshtein.java
@@ -32,7 +32,7 @@ public final class Levenshtein {
/* debug output */
private static final boolean DEBUG= false;
private static final boolean MATRIX= false;
-
+
/*
* asserts - enable conditional compilation by not making this a trace option.
* @since 3.2
@@ -419,7 +419,7 @@ public final class Levenshtein {
if (fProgressMonitor.isCanceled())
return;
-
+
fProgressMonitor.worked(1);
for (int col= fColStart; col <= fColEnd; col += fStep) { // for every column
@@ -455,7 +455,7 @@ public final class Levenshtein {
if (fProgressMonitor.isCanceled())
return;
-
+
fProgressMonitor.worked(1);
for (int col= fColStart; col >= fColEnd; col += fStep) { // for every column
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/LinkedRangeFactory.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/LinkedRangeFactory.java
index 9af38bc9600..bfbe6634eca 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/LinkedRangeFactory.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/LinkedRangeFactory.java
@@ -90,7 +90,7 @@ public class LinkedRangeFactory {
/**
* Create a new linked range difference with the given next range and operation.
- *
+ *
* @param next the next linked range difference
* @param operation the operation
* @return the new linked range difference
@@ -105,7 +105,7 @@ public class LinkedRangeFactory {
* After <code>CHECK_INTERVAL</code> calls check whether at least a fraction of
* <code>THRESHOLD</code> of the maximal available memory is free, otherwise throw an
* {@link LowMemoryException}.
- *
+ *
* @throws LowMemoryException if we hit a low memory condition
*/
private void check() throws LowMemoryException {
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifference.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifference.java
index c0f604a4f38..e4f23b1904c 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifference.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifference.java
@@ -295,7 +295,7 @@ public class RangeDifference {
fRegion= new DiffRegion(this, 0, differences, source);
return fRegion;
}
-
+
/*
* @since 3.2
*/
@@ -323,11 +323,11 @@ public class RangeDifference {
default:
break;
}
-
+
buf.append(", Left: [" + fLeftStart + "+" + fLeftLength + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
buf.append(", Right: [" + fRightStart + "+" + fRightLength + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
buf.append("]"); //$NON-NLS-1$
-
+
return buf.toString();
}
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifferencer.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifferencer.java
index fb7450dbd36..ada0869d62d 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifferencer.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/compare/rangedifferencer/RangeDifferencer.java
@@ -17,7 +17,6 @@ import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
-
import org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.LinkedRangeFactory.LowMemoryException;
/**
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/DAG.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/DAG.java
index 1e5d56d530f..a8c19f0e0b5 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/DAG.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/DAG.java
@@ -21,7 +21,7 @@ import org.eclipse.core.runtime.Assert;
/**
* A directed acyclic graph. See http://en.wikipedia.org/wiki/Directed_acyclic_graph
- *
+ *
* @since 3.3
*/
public final class DAG {
@@ -35,7 +35,7 @@ public final class DAG {
* Adds <code>val</code> to the values mapped to by <code>key</code>. If
* <code>val</code> is <code>null</code>, <code>key</code> is added to the key set of
* the multimap.
- *
+ *
* @param key the key
* @param val the value
*/
@@ -51,7 +51,7 @@ public final class DAG {
/**
* Returns all mappings for the given key, an empty set if there are no mappings.
- *
+ *
* @param key the key
* @return the mappings for <code>key</code>
*/
@@ -67,7 +67,7 @@ public final class DAG {
/**
* Removes all mappings for <code>key</code> and removes <code>key</code> from the key
* set.
- *
+ *
* @param key the key to remove
* @return the removed mappings
*/
@@ -79,7 +79,7 @@ public final class DAG {
/**
* Removes a mapping from the multimap, but does not remove the <code>key</code> from the
* key set.
- *
+ *
* @param key the key
* @param val the value
*/
@@ -88,7 +88,7 @@ public final class DAG {
if (values != null)
values.remove(val);
}
-
+
/*
* @see java.lang.Object#toString()
*/
@@ -104,7 +104,7 @@ public final class DAG {
* Adds a directed edge from <code>origin</code> to <code>target</code>. The vertices are not
* required to exist prior to this call - if they are not currently contained by the graph, they are
* automatically added.
- *
+ *
* @param origin the origin vertex of the dependency
* @param target the target vertex of the dependency
* @return <code>true</code> if the edge was added, <code>false</code> if the
@@ -128,7 +128,7 @@ public final class DAG {
/**
* Adds a vertex to the graph. If the vertex does not exist prior to this call, it is added with
* no incoming or outgoing edges. Nothing happens if the vertex already exists.
- *
+ *
* @param vertex the new vertex
*/
public void addVertex(Object vertex) {
@@ -154,7 +154,7 @@ public final class DAG {
/**
* Returns the sources of the receiver. A source is a vertex with no incoming edges. The
* returned set's iterator traverses the nodes in the order they were added to the graph.
- *
+ *
* @return the sources of the receiver
*/
public Set getSources() {
@@ -164,7 +164,7 @@ public final class DAG {
/**
* Returns the sinks of the receiver. A sink is a vertex with no outgoing edges. The returned
* set's iterator traverses the nodes in the order they were added to the graph.
- *
+ *
* @return the sinks of the receiver
*/
public Set getSinks() {
@@ -184,7 +184,7 @@ public final class DAG {
/**
* Returns the direct children of a vertex. The returned {@link Set} is unmodifiable.
- *
+ *
* @param vertex the parent vertex
* @return the direct children of <code>vertex</code>
*/
@@ -204,7 +204,7 @@ public final class DAG {
return true;
return false;
}
-
+
/*
* @see java.lang.Object#toString()
* @since 3.3
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/ExtensionPointHelper.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/ExtensionPointHelper.java
index 152f35e884a..c1cc22b6708 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/ExtensionPointHelper.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/ExtensionPointHelper.java
@@ -30,7 +30,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
public final class ExtensionPointHelper {
-
+
private final IConfigurationElement fElement;
private final String fName;
@@ -40,7 +40,7 @@ public final class ExtensionPointHelper {
fName= element.getName();
// see if we have a conventional 'id' attribute
}
-
+
public String getDefaultAttribute(String attribute, String dflt) throws InvalidRegistryObjectException {
String value= fElement.getAttribute(attribute);
return value == null ? dflt : value;
@@ -52,12 +52,12 @@ public final class ExtensionPointHelper {
fail(MessageFormat.format(RulerColumnMessages.ExtensionPointHelper_missing_attribute_msg, new Object[] {fName, attribute}));
return value;
}
-
+
public float getDefaultAttribute(String attribute, float dflt) throws CoreException {
String value= getDefaultAttribute(attribute, null);
if (value == null)
return dflt;
-
+
try {
return Float.valueOf(value).floatValue();
} catch (NumberFormatException x) {
@@ -70,7 +70,7 @@ public final class ExtensionPointHelper {
String value= getDefaultAttribute(attribute, null);
if (value == null)
return dflt;
-
+
try {
return Boolean.valueOf(value).booleanValue();
} catch (NumberFormatException x) {
@@ -78,7 +78,7 @@ public final class ExtensionPointHelper {
return dflt;
}
}
-
+
public void fail(String message) throws CoreException {
String id= findId(fElement);
String extensionPointId= fElement.getDeclaringExtension().getExtensionPointUniqueIdentifier();
@@ -88,7 +88,7 @@ public final class ExtensionPointHelper {
IStatus status= new Status(IStatus.WARNING, TextEditorPlugin.PLUGIN_ID, IStatus.OK, blame + message, null);
throw new CoreException(status);
}
-
+
public static String findId(IConfigurationElement element) {
String id= null;
while (element != null) {
@@ -120,7 +120,7 @@ public final class ExtensionPointHelper {
Path path= new Path(value);
return FileLocator.find(bundle, path, null);
}
-
+
private Bundle getBundle() {
String namespace= fElement.getDeclaringExtension().getContributor().getName();
Bundle bundle= Platform.getBundle(namespace);
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnPlacement.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnPlacement.java
index 083bfc60b20..feed84be7f2 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnPlacement.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnPlacement.java
@@ -22,7 +22,7 @@ import org.eclipse.core.runtime.InvalidRegistryObjectException;
/**
* Describes the placement specification of a contribution to the
* <code>org.eclipse.ui.texteditor.rulerColumns</code> extension point.
- *
+ *
* @since 3.3
*/
public final class RulerColumnPlacement {
@@ -48,7 +48,7 @@ public final class RulerColumnPlacement {
public RulerColumnPlacement(IConfigurationElement element) throws InvalidRegistryObjectException, CoreException {
Assert.isLegal(element != null);
ExtensionPointHelper helper= new ExtensionPointHelper(element);
-
+
fGravity= helper.getDefaultAttribute(GRAVITY, 1f);
if (fGravity < 0 || fGravity > 1)
helper.fail(RulerColumnMessages.RulerColumnPlacement_illegal_gravity_msg);
@@ -74,10 +74,10 @@ public final class RulerColumnPlacement {
}
return Collections.unmodifiableSet(constraints);
}
-
+
/**
* The gravity of the placement specification, a float in the range <code>[0, 1]</code>.
- *
+ *
* @return the gravity of the placement specification
*/
public float getGravity() {
@@ -86,7 +86,7 @@ public final class RulerColumnPlacement {
/**
* Returns the placement constraints in the order that they appear in the extension declaration.
- *
+ *
* @return the unmodifiable set of placement constraints in the order that they appear in the
* extension declaration
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnPlacementConstraint.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnPlacementConstraint.java
index 9b1331b3ea7..a1ebe8048d0 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnPlacementConstraint.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnPlacementConstraint.java
@@ -15,7 +15,7 @@ import org.eclipse.core.runtime.Assert;
/**
* Describes one placement constraint of a contribution to the
* <code>org.eclipse.ui.texteditor.rulerColumns</code> extension point.
- *
+ *
* @since 3.3
*/
public final class RulerColumnPlacementConstraint {
@@ -24,7 +24,7 @@ public final class RulerColumnPlacementConstraint {
/**
* Creates a new constraint.
- *
+ *
* @param id the id of the referenced contribution
* @param before <code>true</code> if the specifying should come <i>before</i>,
* <code>false</code> if it should come <i>after</i> the contribution referenced by
@@ -38,7 +38,7 @@ public final class RulerColumnPlacementConstraint {
/**
* Returns the identifier of the referenced column contribution.
- *
+ *
* @return the identifier of the referenced column contribution
*/
public String getId() {
@@ -48,7 +48,7 @@ public final class RulerColumnPlacementConstraint {
/**
* Returns <code>true</code> if the receiver is a <i>before</i> constraint,
* <code>false</code> if it is an <i>after</i> constraint.
- *
+ *
* @return <code>true</code> if the receiver is a <i>before</i> constraint,
* <code>false</code> if it is an <i>after</i> constraint
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnTarget.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnTarget.java
index eff7aa7b6eb..c3224973f10 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnTarget.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/RulerColumnTarget.java
@@ -17,7 +17,7 @@ import org.eclipse.core.runtime.content.IContentType;
/**
* Describes the target of a contribution to the <code>org.eclipse.ui.texteditor.rulerColumns</code>
* extension point.
- *
+ *
* @since 3.3
*/
public abstract class RulerColumnTarget {
@@ -147,7 +147,7 @@ final class ClassTarget extends RulerColumnTarget {
public boolean matchesClass(Class clazz) {
Assert.isLegal(clazz != null);
-
+
do {
if (clazz.getName().equals(fClassName))
return true;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/StringSetSerializer.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/StringSetSerializer.java
index 2c12c8c4fe6..6f9399ca974 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/StringSetSerializer.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/rulers/StringSetSerializer.java
@@ -32,7 +32,7 @@ public final class StringSetSerializer {
}
return buf.toString();
}
-
+
public static Set deserialize(String serialized) {
Assert.isLegal(serialized != null);
Set marked= new HashSet();
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/EmptySpellingPreferenceBlock.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/EmptySpellingPreferenceBlock.java
index 5688156a7a7..519c25e8f0c 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/EmptySpellingPreferenceBlock.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/EmptySpellingPreferenceBlock.java
@@ -17,8 +17,8 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock;
import org.eclipse.ui.texteditor.spelling.IPreferenceStatusMonitor;
+import org.eclipse.ui.texteditor.spelling.ISpellingPreferenceBlock;
/**
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/NoCompletionsProposal.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/NoCompletionsProposal.java
index 2a9f61a103c..021585aa6ce 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/NoCompletionsProposal.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/NoCompletionsProposal.java
@@ -22,7 +22,7 @@ import org.eclipse.jface.text.contentassist.IContextInformation;
* <p>
* Applying this proposal does nothing.
* </p>
- *
+ *
* @since 3.3
*/
public final class NoCompletionsProposal implements ICompletionProposal {
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/SpellingEngineRegistry.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/SpellingEngineRegistry.java
index 13ebd5845e3..6641ad170aa 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/SpellingEngineRegistry.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/SpellingEngineRegistry.java
@@ -20,6 +20,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
+
import org.eclipse.ui.texteditor.spelling.SpellingEngineDescriptor;
/**
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/SpellingMessages.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/SpellingMessages.java
index 5b3c9c046c3..3ff03ae621c 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/SpellingMessages.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/spelling/SpellingMessages.java
@@ -25,10 +25,10 @@ final class SpellingMessages extends NLS {
// Do not instantiate
}
-
+
public static String EmptySpellingPreferenceBlock_emptyCaption;
public static String NoCompletionsProposal_displayString;
-
+
static {
NLS.initializeMessages(BUNDLE_NAME, SpellingMessages.class);
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractDocumentProvider.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractDocumentProvider.java
index a7afb357541..02e64f4ce12 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractDocumentProvider.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractDocumentProvider.java
@@ -60,7 +60,7 @@ public abstract class AbstractDocumentProvider implements IDocumentProvider, IDo
/**
* The actual functionality of this operation.
- *
+ *
* @param monitor a progress monitor to track execution
* @throws CoreException if the execution fails
*/
@@ -500,7 +500,7 @@ public abstract class AbstractDocumentProvider implements IDocumentProvider, IDo
/**
* Executes the actual work of reseting the given elements document.
- *
+ *
* @param element the element
* @param monitor the progress monitor
* @throws CoreException if resetting fails
@@ -899,7 +899,7 @@ public abstract class AbstractDocumentProvider implements IDocumentProvider, IDo
/**
* Informs all registered element state listeners about a change in the state validation of the
* given element.
- *
+ *
* @param element the element
* @param isStateValidated the flag indicating whether state validation is done
* @see IElementStateListenerExtension#elementStateValidationChanged(Object, boolean)
@@ -1026,7 +1026,7 @@ public abstract class AbstractDocumentProvider implements IDocumentProvider, IDo
public boolean isSynchronized(Object element) {
return true;
}
-
+
/*
* @see org.eclipse.ui.texteditor.IDocumentProviderExtension5#isNotSynchronizedException(Object, CoreException)
* @since 3.2
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java
index 7c9848169c2..f255eba7a5d 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java
@@ -102,7 +102,7 @@ public abstract class AbstractRulerActionDelegate extends ActionDelegate impleme
if (fAction != null)
fAction.run();
}
-
+
/*
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
* @since 3.2
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
index 7b301621662..d20898610c9 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
@@ -248,18 +248,18 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* @since 2.0
*/
private static final String TAG_CONTRIBUTION_TYPE= "editorContribution"; //$NON-NLS-1$
-
+
/**
* Tags used in the {@link IMemento} when saving and
* restoring editor state.
- *
+ *
* @see #saveState(IMemento)
* @see #restoreState(IMemento)
* @since 3.3
*/
protected static final String TAG_SELECTION_OFFSET= "selectionOffset"; //$NON-NLS-1$
protected static final String TAG_SELECTION_LENGTH= "selectionLength"; //$NON-NLS-1$
-
+
/**
* The caret width for the wide (double) caret.
@@ -472,16 +472,16 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
previousContent= changed.get();
else
previousContent= null;
-
+
previousUndoManager= DocumentUndoManagerRegistry.getDocumentUndoManager(changed);
if (previousUndoManager != null)
previousUndoManager.connect(this);
}
else
previousContent= null;
-
+
setInput((IEditorInput) movedElement);
-
+
// The undo manager needs to be replaced with one for the new document.
// Transfer the undo history and then disconnect from the old undo manager.
if (previousUndoManager != null) {
@@ -1127,7 +1127,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Computes the offset of the line end position.
- *
+ *
* @param document the document where to compute the line end position
* @param line the line to determine the end position of
* @param length the length of the line
@@ -1140,7 +1140,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
while (index > -1 && Character.isWhitespace(line.charAt(index)))
index--;
index++;
-
+
LinkedModeModel model= LinkedModeModel.getModel(document, offset);
if (model != null) {
LinkedPosition linkedPosition= model.findPosition(new LinkedPosition(document, offset, 0));
@@ -1158,7 +1158,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
return index;
}
-
+
/*
* @see org.eclipse.jface.action.IAction#run()
*/
@@ -1278,7 +1278,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
int index= 0;
while (index < length && Character.isWhitespace(line.charAt(index)))
index++;
-
+
LinkedModeModel model= LinkedModeModel.getModel(document, offset);
if (model != null) {
LinkedPosition linkedPosition= model.findPosition(new LinkedPosition(document, offset, 0));
@@ -1337,9 +1337,9 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
// The new caret position
int newCaretOffset= -1;
-
+
if (isSmartHomeEndEnabled) {
-
+
// Compute the line start offset
int index= getLineStartPosition(document, line, lineLength, caretOffsetInDocument);
@@ -1405,7 +1405,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Editor specific selection provider which wraps the source viewer's selection provider.
- *
+ *
* @since 3.4 protected, was added in 2.1 as private class
*/
protected class SelectionProvider implements IPostSelectionProvider, ISelectionValidator {
@@ -1485,7 +1485,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* Installs this selection changed listener with the given selection provider. If the
* selection provider is a post selection provider, post selection changed events are the
* preferred choice, otherwise normal selection changed events are requested.
- *
+ *
* @param selectionProvider the selection provider
*/
public void install(ISelectionProvider selectionProvider) {
@@ -1590,14 +1590,14 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
super.uninstall(selectionProvider);
}
}
-
-
+
+
/**
* Implements the ruler column support of for the given editor.
* <p>
* This is currently only used to support vertical ruler columns.
* </p>
- *
+ *
* @since 3.3
*/
protected static class ColumnSupport implements IColumnSupport {
@@ -1608,7 +1608,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Creates a new column support for the given editor. Only the editor itself should normally
* create such an instance.
- *
+ *
* @param editor the editor
* @param registry the contribution registry to refer to
*/
@@ -1641,11 +1641,11 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
addColumn(ruler, descriptor);
}
}
-
+
private void addColumn(final CompositeRuler ruler, final RulerColumnDescriptor descriptor) {
-
+
final int idx= computeIndex(ruler, descriptor);
-
+
SafeRunnable runnable= new SafeRunnable() {
public void run() throws Exception {
IContributedRulerColumn column= descriptor.createColumn(fEditor);
@@ -1661,7 +1661,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* Hook to let subclasses initialize a newly created column.
* <p>
* Subclasses may extend this method.</p>
- *
+ *
* @param column the created column
*/
protected void initializeColumn(IContributedRulerColumn column) {
@@ -1670,7 +1670,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
private void removeColumn(final CompositeRuler ruler, final RulerColumnDescriptor descriptor) {
removeColumn(ruler, getVisibleColumn(ruler, descriptor));
}
-
+
private void removeColumn(final CompositeRuler ruler, final IContributedRulerColumn rulerColumn) {
if (rulerColumn != null) {
SafeRunnable runnable= new SafeRunnable() {
@@ -1687,7 +1687,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Returns the currently visible column matching <code>id</code>, <code>null</code> if
* none.
- *
+ *
* @param ruler the composite ruler to scan
* @param descriptor the descriptor of the column of interest
* @return the matching column or <code>null</code>
@@ -1707,7 +1707,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Computes the insertion index for a column contribution into the currently visible columns.
- *
+ *
* @param ruler the composite ruler into which to insert the column
* @param descriptor the descriptor to compute the index for
* @return the insertion index for a new column
@@ -1739,7 +1739,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
CompositeRuler ruler= getRuler();
return ruler != null && getVisibleColumn(ruler, descriptor) != null;
}
-
+
/*
* @see org.eclipse.ui.texteditor.IColumnSupport#isColumnSupported(java.lang.String)
*/
@@ -1747,17 +1747,17 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
Assert.isLegal(descriptor != null);
if (getRuler() == null)
return false;
-
+
if (descriptor == null)
return false;
-
+
return descriptor.matchesEditor(fEditor);
}
-
+
/**
* Returns the editor's vertical ruler, if it is a {@link CompositeRuler}, <code>null</code>
* otherwise.
- *
+ *
* @return the editor's {@link CompositeRuler} or <code>null</code>
*/
private CompositeRuler getRuler() {
@@ -1771,7 +1771,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* {@inheritDoc}
* <p>
* Subclasses may extend this method.</p>
- *
+ *
*/
public void dispose() {
for (Iterator iter= new ArrayList(fColumns).iterator(); iter.hasNext();)
@@ -1788,11 +1788,11 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* @since 3.3
*/
private static final class InformationProvider implements IInformationProvider, IInformationProviderExtension, IInformationProviderExtension2 {
-
+
private IRegion fHoverRegion;
private Object fHoverInfo;
private IInformationControlCreator fControlCreator;
-
+
InformationProvider(IRegion hoverRegion, Object hoverInfo, IInformationControlCreator controlCreator) {
fHoverRegion= hoverRegion;
fHoverInfo= hoverInfo;
@@ -1806,7 +1806,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
/**
* {@inheritDoc}
- *
+ *
* @deprecated As of 2.1, replaced by {@link IInformationProviderExtension#getInformation2(ITextViewer, IRegion)}
*/
public String getInformation(ITextViewer textViewer, IRegion subject) {
@@ -1826,13 +1826,13 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
return fControlCreator;
}
}
-
+
/**
* This action behaves in two different ways: If there is no current text
* hover, the javadoc is displayed using information presenter. If there is
* a current text hover, it is converted into a information presenter in
* order to make it sticky.
- *
+ *
* @since 3.3
*/
private final class InformationDispatchAction extends TextEditorAction {
@@ -1885,7 +1885,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
if (annotationHover != null && makeAnnotationHoverFocusable(sourceViewer, annotationHover))
return;
}
-
+
// otherwise, just run the action
if (fTextOperationAction.isEnabled())
fTextOperationAction.run();
@@ -1893,7 +1893,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Tries to make a text hover focusable (or "sticky").
- *
+ *
* @param sourceViewer the source viewer to display the hover over
* @param textHover the hover to make focusable
* @return <code>true</code> if successful, <code>false</code> otherwise
@@ -1903,7 +1903,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
int offset= computeOffsetAtLocation(sourceViewer, hoverEventLocation.x, hoverEventLocation.y);
if (offset == -1)
return false;
-
+
try {
IRegion hoverRegion= textHover.getHoverRegion(sourceViewer, offset);
if (hoverRegion == null)
@@ -1933,7 +1933,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Tries to make an annotation hover focusable (or "sticky").
- *
+ *
* @param sourceViewer the source viewer to display the hover over
* @param annotationHover the hover to make focusable
* @return <code>true</code> if successful, <code>false</code> otherwise
@@ -1958,7 +1958,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
} else {
hoverInfo= annotationHover.getHoverInfo(sourceViewer, line);
}
-
+
// hover region: the beginning of the concerned line to place the control right over the line
IDocument document= sourceViewer.getDocument();
int offset= document.getLineOffset(line);
@@ -1969,7 +1969,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
controlCreator= ((IInformationProviderExtension2) annotationHover).getInformationPresenterControlCreator();
else if (annotationHover instanceof IAnnotationHoverExtension)
controlCreator= ((IAnnotationHoverExtension) annotationHover).getHoverControlCreator();
-
+
IInformationProvider informationProvider= new InformationProvider(new Region(offset, 0), hoverInfo, controlCreator);
fInformationPresenter.setOffset(offset);
@@ -1999,7 +1999,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
Point p= styledText.getLocationAtOffset(widgetOffset);
if (p.x > x)
widgetOffset--;
-
+
if (textViewer instanceof ITextViewerExtension5) {
ITextViewerExtension5 extension= (ITextViewerExtension5) textViewer;
return extension.widgetOffset2ModelOffset(widgetOffset);
@@ -2012,8 +2012,8 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
}
-
-
+
+
/**
* Key used to look up font preference.
* Value: <code>"org.eclipse.jface.textfont"</code>
@@ -2165,11 +2165,11 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* <li>1: {@link org.eclipse.jface.text.ITextViewerExtension8.EnrichMode#IMMEDIATELY},</li>
* <li>2: {@link org.eclipse.jface.text.ITextViewerExtension8.EnrichMode#ON_CLICK}.</li>
* </ul>
- *
+ *
* @since 3.4
*/
public static final String PREFERENCE_HOVER_ENRICH_MODE= "hoverReplaceMode"; //$NON-NLS-1$
-
+
/** Menu id for the editor context menu. */
public static final String DEFAULT_EDITOR_CONTEXT_MENU_ID= "#EditorContext"; //$NON-NLS-1$
/** Menu id for the ruler context menu. */
@@ -2517,7 +2517,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* @since 3.3
*/
private InformationPresenter fInformationPresenter;
-
+
/**
* Tells whether this editor has been activated at least once.
* @since 3.3.2
@@ -2528,10 +2528,10 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* @since 3.4
*/
private KeyBindingSupportForAssistant fKeyBindingSupportForQuickAssistant;
-
+
/**
* Key binding support for the quick assist assistant.
- *
+ *
* @since 3.5
*/
private KeyBindingSupportForAssistant fKeyBindingSupportForContentAssistant;
@@ -2837,7 +2837,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Sets the given selection.
- *
+ *
* @param selection the selection
* @since 2.1
*/
@@ -2850,7 +2850,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Creates the listener on this editor's context menus.
- *
+ *
* @return the created menu listener
* @since 3.4
*/
@@ -2871,7 +2871,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Creates and returns the listener on this editor's context menus.
- *
+ *
* @return the menu listener
*/
protected final IMenuListener getContextMenuListener() {
@@ -2908,7 +2908,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
final int delay= fDoubleClickTime - (int)(System.currentTimeMillis() - fMouseUpDelta);
if (1 != e.button)
return;
-
+
Runnable runnable= new Runnable() {
public void run() {
if (!fDoubleClicked)
@@ -3092,12 +3092,12 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
protected IVerticalRuler createVerticalRuler() {
return new VerticalRuler(VERTICAL_RULER_WIDTH);
}
-
+
/**
* Adds enabled ruler contributions to the vertical ruler.
* <p>
* Clients may extend or replace.</p>
- *
+ *
* @param ruler the composite ruler to add contributions to
* @since 3.3
*/
@@ -3105,11 +3105,11 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
IColumnSupport support= (IColumnSupport)getAdapter(IColumnSupport.class);
if (support == null)
return;
-
+
RulerColumnPreferenceAdapter adapter= null;
if (fPreferenceStore != null)
adapter= new RulerColumnPreferenceAdapter(getPreferenceStore(), PREFERENCE_RULER_CONTRIBUTIONS);
-
+
RulerColumnRegistry registry= RulerColumnRegistry.getDefault();
List descriptors= registry.getColumnDescriptors();
for (Iterator it= descriptors.iterator(); it.hasNext();) {
@@ -3161,7 +3161,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
IDragAndDropService dndService= (IDragAndDropService)getSite().getService(IDragAndDropService.class);
if (dndService == null)
return;
-
+
ITextEditorDropTargetListener listener= (ITextEditorDropTargetListener) getAdapter(ITextEditorDropTargetListener.class);
if (listener == null) {
@@ -3382,7 +3382,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
createActions();
initializeSourceViewer(getEditorInput());
-
+
/* since 3.2 - undo redo actions should be created after
* the source viewer is initialized, so that the undo manager
* can obtain its undo context from its document.
@@ -3390,7 +3390,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
createUndoRedoActions();
JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener);
-
+
IVerticalRuler ruler= getVerticalRuler();
if (ruler instanceof CompositeRuler)
updateContributedRulerColumns((CompositeRuler) ruler);
@@ -3406,25 +3406,25 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
fInformationPresenter.setSizeConstraints(100, 12, true, true);
fInformationPresenter.install(getSourceViewer());
fInformationPresenter.setDocumentPartitioning(getSourceViewerConfiguration().getConfiguredDocumentPartitioning(getSourceViewer()));
-
+
}
/**
* Installs text drag and drop on the given source viewer.
- *
+ *
* @param viewer the viewer
* @since 3.3
*/
protected void installTextDragAndDrop(final ISourceViewer viewer) {
if (viewer == null || fIsTextDragAndDropInstalled)
return;
-
+
final IDragAndDropService dndService= (IDragAndDropService)getSite().getService(IDragAndDropService.class);
if (dndService == null)
return;
-
+
final StyledText st= viewer.getTextWidget();
-
+
// Install drag source
final ISelectionProvider selectionProvider= viewer.getSelectionProvider();
final DragSource source= new DragSource(st, DND.DROP_COPY | DND.DROP_MOVE);
@@ -3451,12 +3451,12 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
event.doit= false;
}
}
-
+
public void dragSetData(DragSourceEvent event) {
event.data= fSelectedText;
fTextDragAndDropToken= this; // Can be any non-null object
}
-
+
public void dragFinished(DragSourceEvent event) {
try {
if (event.detail == DND.DROP_MOVE && validateEditorInputState()) {
@@ -3466,26 +3466,26 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
if (newSelection.x < fSelection.x)
delta= length;
st.replaceTextRange(fSelection.x + delta, length, ""); //$NON-NLS-1$
-
+
if (fTextDragAndDropToken == null) {
// Move in same editor - end compound change
IRewriteTarget target= (IRewriteTarget)getAdapter(IRewriteTarget.class);
if (target != null)
target.endCompoundChange();
}
-
+
}
} finally {
fTextDragAndDropToken= null;
}
}
});
-
+
// Install drag target
DropTargetListener dropTargetListener= new DropTargetAdapter() {
-
+
private Point fSelection;
-
+
public void dragEnter(DropTargetEvent event) {
fTextDragAndDropToken= null;
fSelection= st.getSelection();
@@ -3499,7 +3499,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
}
}
-
+
public void dragOperationChanged(DropTargetEvent event) {
if (event.detail == DND.DROP_DEFAULT) {
if ((event.operations & DND.DROP_MOVE) != 0) {
@@ -3511,11 +3511,11 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
}
}
-
+
public void dragOver(DropTargetEvent event) {
event.feedback |= DND.FEEDBACK_SCROLL;
}
-
+
public void drop(DropTargetEvent event) {
try {
if (fTextDragAndDropToken != null && event.detail == DND.DROP_MOVE) {
@@ -3525,18 +3525,18 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
event.detail= DND.DROP_NONE;
return;
}
-
+
// Start compound change
IRewriteTarget target= (IRewriteTarget)getAdapter(IRewriteTarget.class);
if (target != null)
target.beginCompoundChange();
}
-
+
if (!validateEditorInputState()) {
event.detail= DND.DROP_NONE;
return;
}
-
+
String text= (String)event.data;
Point newSelection= st.getSelection();
try {
@@ -3558,7 +3558,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Uninstalls text drag and drop from the given source viewer.
- *
+ *
* @param viewer the viewer
* @since 3.3
*/
@@ -3572,7 +3572,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
StyledText st= viewer.getTextWidget();
dndService.removeMergedDropTarget(st);
-
+
DragSource dragSource= (DragSource)st.getData(DND.DRAG_SOURCE_KEY);
if (dragSource != null) {
dragSource.dispose();
@@ -3588,7 +3588,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* <p>
* This implementation always returns <code>true</code>.
* </p>
- *
+ *
* @return <code>true</code> if the editor input should be considered
* @since 3.2
*/
@@ -3845,10 +3845,10 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
if (fIsOverwriting)
fSourceViewer.getTextWidget().invokeAction(ST.TOGGLE_OVERWRITE);
handleInsertModeChanged();
-
+
if (isTabsToSpacesConversionEnabled())
installTabsToSpacesConverter();
-
+
if (fSourceViewer instanceof ITextViewerExtension8) {
IPreferenceStore store= getPreferenceStore();
EnrichMode mode= store != null ? convertEnrichModePreference(store.getInt(PREFERENCE_HOVER_ENRICH_MODE)) : EnrichMode.AFTER_DELAY;
@@ -3859,7 +3859,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Converts the {link #PREFERENCE_HOVER_ENRICH_MODE} preference value to
* {@link ITextViewerExtension8.EnrichMode}.
- *
+ *
* @param mode the preference value
* @return the enrich mode, can be <code>null</code>
* @since 3.4
@@ -3975,16 +3975,16 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
ISaveablesLifecycleListener listener= (ISaveablesLifecycleListener)getSite().getService(ISaveablesLifecycleListener.class);
if (listener == null)
fSavable= null;
-
+
if (input == null) {
close(isSaveOnCloseNeeded());
-
+
if (fSavable != null) {
listener.handleLifecycleEvent(new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_CLOSE, getSaveables(), false));
fSavable.disconnectEditor();
fSavable= null;
}
-
+
} else {
boolean mustSendLifeCycleEvent= false;
if (fSavable != null) {
@@ -4037,17 +4037,17 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
if (fSelectionListener != null)
fSelectionListener.setDocument(getDocumentProvider().getDocument(input));
-
+
IVerticalRuler ruler= getVerticalRuler();
if (ruler instanceof CompositeRuler)
updateContributedRulerColumns((CompositeRuler) ruler);
-
+
// Send savable life-cycle if needed.
if (mustSendLifeCycleEvent && listener != null)
listener.handleLifecycleEvent(new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_OPEN, getSaveables(), false));
-
+
}
-
+
}
/**
@@ -4064,7 +4064,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
return null;
}
-
+
/*
* @see org.eclipse.ui.part.EditorPart#setInputWithNotify(org.eclipse.ui.IEditorInput)
* @since 3.2
@@ -4089,14 +4089,14 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
ErrorDialog.openError(shell, title, msg, x.getStatus());
}
}
-
+
/*
* @see EditorPart#setInput(org.eclipse.ui.IEditorInput)
*/
public final void setInput(IEditorInput input) {
setInputWithNotify(input);
}
-
+
/*
* @see ITextEditor#close
*/
@@ -4194,7 +4194,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
fSavable.disconnectEditor();
fSavable= null;
}
-
+
disposeDocumentProvider();
if (fSourceViewer != null) {
@@ -4408,7 +4408,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
return;
}
-
+
if (PREFERENCE_RULER_CONTRIBUTIONS.equals(property)) {
String[] difference= StringSetSerializer.getDifference((String) event.getOldValue(), (String) event.getNewValue());
IColumnSupport support= (IColumnSupport) getAdapter(IColumnSupport.class);
@@ -4421,14 +4421,14 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
return;
}
-
+
if (PREFERENCE_SHOW_WHITESPACE_CHARACTERS.equals(property)) {
IAction action= getAction(ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS);
if (action instanceof IUpdate)
((IUpdate)action).update();
return;
}
-
+
if (PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED.equals(property)) {
IPreferenceStore store= getPreferenceStore();
if (store != null && store.getBoolean(PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED))
@@ -4447,7 +4447,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
return;
}
-
+
}
/**
@@ -4889,7 +4889,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* <p>
* Subclasses can decide to override the given title and message.
* </p>
- *
+ *
* @param title the dialog title
* @param message the message to display
* @param exception the exception to handle
@@ -4902,7 +4902,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Tells whether the given core exception is exactly the
* exception which is thrown for a non-synchronized element.
- *
+ *
* @param ex the core exception
* @return <code>true</code> iff the given core exception is exactly the
* exception which is thrown for a non-synchronized element
@@ -5006,7 +5006,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
fActivationCodeTrigger.registerActionForKeyActivation(action);
}
}
-
+
/**
* Sets this editor's actions into activated (default) or deactived state.
* <p>
@@ -5015,7 +5015,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
* breadcrumb might become a Platform UI feature during 3.5 and hence we can
* then delete this workaround.
* </p>
- *
+ *
* @param state <code>true</code> if activated
* @since 3.4
*/
@@ -5358,7 +5358,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
IUndoContext undoContext= getUndoContext();
if (undoContext != null) {
// Use actions provided by global undo/redo
-
+
// Create the undo action
OperationHistoryActionHandler undoAction= new UndoActionHandler(getEditorSite(), undoContext);
PlatformUI.getWorkbench().getHelpSystem().setHelp(undoAction, IAbstractTextEditorHelpContextIds.UNDO_ACTION);
@@ -5389,9 +5389,9 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
} else {
// Use text operation actions (pre 3.1 style)
-
+
ResourceAction action;
-
+
if (getAction(ITextEditorActionConstants.UNDO) == null) {
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Undo.", this, ITextOperationTarget.UNDO); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.UNDO_ACTION);
@@ -5407,13 +5407,13 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
}
}
-
+
/**
* Registers the given undo/redo action under the given ID and
* ensures that previously installed actions get disposed. It
* also takes care of re-registering the new action with the
* global action handler.
- *
+ *
* @param actionId the action id under which to register the action
* @param action the action to register
* @since 3.1
@@ -5424,7 +5424,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
((OperationHistoryActionHandler)oldAction).dispose();
setAction(actionId, action);
-
+
IActionBars actionBars= getEditorSite().getActionBars();
if (actionBars != null)
actionBars.setGlobalActionHandler(actionId, action);
@@ -5656,18 +5656,18 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
action.setHelpContextId(IAbstractTextEditorHelpContextIds.RECENTER_ACTION);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.RECENTER);
setAction(ITextEditorActionConstants.RECENTER, action);
-
+
action= new ShowWhitespaceCharactersAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ShowWhitespaceCharacters.", this, getPreferenceStore()); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.SHOW_WHITESPACE_CHARACTERS_ACTION);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_WHITESPACE_CHARACTERS);
setAction(ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS, action);
-
+
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ShowInformation.", this, ISourceViewer.INFORMATION, true); //$NON-NLS-1$
action= new InformationDispatchAction(EditorMessages.getBundleForConstructedKeys(), "Editor.ShowInformation.", (TextOperationAction) action); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.SHOW_INFORMATION_ACTION);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_INFORMATION);
setAction(ITextEditorActionConstants.SHOW_INFORMATION, action);
-
+
PropertyDialogAction openProperties= new PropertyDialogAction(
new IShellProvider() {
@@ -5710,7 +5710,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
markAsPropertyDependentAction(ITextEditorActionConstants.REDO, true);
markAsPropertyDependentAction(ITextEditorActionConstants.REVERT_TO_SAVED, true);
markAsPropertyDependentAction(ITextEditorActionConstants.SAVE, true);
-
+
markAsStateDependentAction(ITextEditorActionConstants.UNDO, true);
markAsStateDependentAction(ITextEditorActionConstants.REDO, true);
markAsStateDependentAction(ITextEditorActionConstants.CUT, true);
@@ -5799,7 +5799,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
addAction(menu, ITextEditorActionConstants.RULER_MANAGE_BOOKMARKS);
addAction(menu, ITextEditorActionConstants.RULER_MANAGE_TASKS);
}
-
+
/**
* Sets up this editor's context menu before it is made visible.
* <p>
@@ -5836,7 +5836,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Returns the status line manager of this editor.
- *
+ *
* @return the status line manager of this editor
* @since 2.0, protected since 3.3
*/
@@ -6244,11 +6244,11 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
// XXX this overwrite box is not proportional-font aware
// take 'a' as a medium sized character
Point charSize= gc.stringExtent("a"); //$NON-NLS-1$
-
+
// XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612
caret.setSize(charSize.x, styledText.getLineHeight());
caret.setFont(styledText.getFont());
-
+
gc.dispose();
return caret;
@@ -6260,7 +6260,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
// XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612
caret.setSize(getCaretWidthPreference(), styledText.getLineHeight());
caret.setFont(styledText.getFont());
-
+
return caret;
}
@@ -6269,7 +6269,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
PaletteData caretPalette= new PaletteData(new RGB[] {new RGB (0,0,0), new RGB (255,255,255)});
int width= getCaretWidthPreference();
int widthOffset= width - 1;
-
+
// XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612
ImageData imageData= new ImageData(4 + widthOffset, styledText.getLineHeight(), 1, caretPalette);
@@ -6396,7 +6396,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Updates the status fields for the given category.
- *
+ *
* @param category the category
* @since 2.0
*/
@@ -6621,7 +6621,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
public boolean isChangeInformationShowing() {
return false;
}
-
+
/**
* Sets the given message as error message to this editor's status line.
*
@@ -6645,7 +6645,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
if (statusLine != null)
statusLine.setMessage(false, message, null);
}
-
+
/**
* Jumps to the next annotation according to the given direction.
*
@@ -6661,14 +6661,14 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
Annotation annotation= findAnnotation(selection.getOffset(), selection.getLength(), forward, position);
setStatusLineErrorMessage(null);
setStatusLineMessage(null);
-
+
if (annotation != null) {
selectAndReveal(position.getOffset(), position.getLength());
setStatusLineMessage(annotation.getText());
}
return annotation;
}
-
+
/**
* Returns the annotation closest to the given range respecting the given
* direction. If an annotation is found, the annotations current position
@@ -6771,7 +6771,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
public void showRevisionInformation(RevisionInformation info, String quickDiffProviderId) {
// no implementation
}
-
+
/*
* @see org.eclipse.ui.IEditorPersistable#restoreState(org.eclipse.ui.IMemento)
* @since 3.3
@@ -6779,7 +6779,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
public void restoreState(IMemento memento) {
fMementoToRestore= memento;
}
-
+
/*
* @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento)
* @since 3.3
@@ -6791,12 +6791,12 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
memento.putInteger(TAG_SELECTION_LENGTH, ((ITextSelection)selection).getLength());
}
}
-
+
/**
* Returns whether the given memento contains saved state
* <p>
* Subclasses may extend or override this method.</p>
- *
+ *
* @param memento the saved state of this editor
* @return <code>true</code> if the given memento contains saved state
* @since 3.3
@@ -6804,12 +6804,12 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
protected boolean containsSavedState(IMemento memento) {
return memento.getInteger(TAG_SELECTION_OFFSET) != null && memento.getInteger(TAG_SELECTION_LENGTH) != null;
}
-
+
/**
* Restores this editor's state using the given memento.
* <p>
* Subclasses may extend or override this method.</p>
- *
+ *
* @param memento the saved state of this editor
* @since 3.3
*/
@@ -6817,14 +6817,14 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
Integer offset= memento.getInteger(TAG_SELECTION_OFFSET);
if (offset == null)
return;
-
+
Integer length= memento.getInteger(TAG_SELECTION_LENGTH);
if (length == null)
return;
-
+
doSetSelection(new TextSelection(offset.intValue(), length.intValue()));
}
-
+
/*
* @see org.eclipse.ui.ISaveablesSource#getSaveables()
* @since 3.3
@@ -6843,14 +6843,14 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
public Saveable[] getActiveSaveables() {
return getSaveables();
}
-
+
/**
* This text editor's savable.
- *
+ *
* @since 3.3
*/
protected static class TextEditorSavable extends Saveable {
-
+
/** The cached editor. */
private ITextEditor fTextEditor;
/** The cached editor input. */
@@ -6860,7 +6860,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Creates a new savable for this text editor.
- *
+ *
* @param textEditor the text editor
*/
public TextEditorSavable(ITextEditor textEditor) {
@@ -6934,23 +6934,23 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
public boolean equals(Object obj) {
if (this == obj)
return true;
-
+
if (!(obj instanceof Saveable))
return false;
-
+
Object thisDocument= getAdapter(IDocument.class);
Object otherDocument= ((Saveable)obj).getAdapter(IDocument.class);
-
+
if (thisDocument == null && otherDocument == null)
return true;
-
+
return thisDocument != null && thisDocument.equals(otherDocument);
}
/**
* Explicit comment needed to suppress wrong warning caused by
* http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4848177
- *
+ *
* @see org.eclipse.ui.Saveable#getAdapter(java.lang.Class)
*/
public Object getAdapter(Class adapter) {
@@ -6965,14 +6965,14 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
return super.getAdapter(adapter);
}
}
-
+
//---- Tabs to spaces conversion support ------------------
/**
* Installs a tabs to spaces converter.
- *
+ *
* <p>Subclasses may extend or override this method.</p>
- *
+ *
* @since 3.3
*/
protected void installTabsToSpacesConverter() {
@@ -6989,9 +6989,9 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Installs a tabs to spaces converter.
- *
+ *
* <p>Subclasses may extend or override this method.</p>
- *
+ *
* @since 3.3
*/
protected void uninstallTabsToSpacesConverter() {
@@ -7005,9 +7005,9 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Tells whether tabs should be converted to
* spaces while editing inside this editor.
- *
+ *
* <p>Subclasses may override this method.</p>
- *
+ *
* @return <code>true</code> if tabs should be converted to spaces
* @since 3.3
*/
@@ -7018,7 +7018,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
/**
* Updates the source viewer's indent prefixes with
* the values provided by the source viewer configuration.
- *
+ *
* @since 3.3
*/
protected final void updateIndentPrefixes() {
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java
index a4fab8edd3e..2e0edbad696 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java
@@ -105,13 +105,13 @@ public class AnnotationPreference {
* @since 3.0
*/
public static final String STYLE_BOX= "BOX"; //$NON-NLS-1$
-
+
/**
* Constant defining dashed box decoration for the show in text style preference.
* @since 3.3
*/
public static final String STYLE_DASHED_BOX= "DASHED_BOX"; //$NON-NLS-1$
-
+
/**
* Constant defining underline decoration for the show in text style preference.
* @since 3.0
@@ -1089,7 +1089,7 @@ public class AnnotationPreference {
public void setQuickFixImageDescriptor(ImageDescriptor descriptor) {
setValue(QUICK_FIX_IMAGE_DESCRIPTOR, descriptor);
}
-
+
/**
* Returns the Quick Fix image descriptor for the image to be drawn in the vertical ruler. The provided
* image is only used, if <code>getAnnotationImageProvider</code> returns <code>null</code>.
@@ -1100,5 +1100,5 @@ public class AnnotationPreference {
public ImageDescriptor getQuickFixImageDescriptor() {
return (ImageDescriptor) getValue(QUICK_FIX_IMAGE_DESCRIPTOR);
}
-
+
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java
index 8ca9e3f4f8d..b6be93e48df 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java
@@ -17,13 +17,13 @@ import java.util.Map;
import org.eclipse.core.runtime.Assert;
-
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.Separator;
+
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchActionConstants;
@@ -276,7 +276,7 @@ public class BasicTextEditorActionContributor extends EditorActionBarContributor
* <code>menu</code> if no item with the same id currently exists. If there already is an
* contribution item with the same id, the new item gets
* {@link IContributionManager#insertAfter(String, IContributionItem) inserted after} it.
- *
+ *
* @param menu the contribution manager
* @param item the contribution item
* @since 3.2
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConfigurationElementSorter.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConfigurationElementSorter.java
index 860cfc5d015..e929cd66e72 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConfigurationElementSorter.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConfigurationElementSorter.java
@@ -25,6 +25,8 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
+import org.eclipse.osgi.util.ManifestElement;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
@@ -32,9 +34,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.ManifestElement;
-
-
import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
/**
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConvertLineDelimitersAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConvertLineDelimitersAction.java
index 16d9c3d7c92..82fef74904c 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConvertLineDelimitersAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ConvertLineDelimitersAction.java
@@ -127,7 +127,7 @@ public class ConvertLineDelimitersAction extends TextEditorAction {
/**
* Returns a new runnable for converting all line delimiters in the
* <code>rewriteTarget</code> to <code>lineDelimter</code>.
- *
+ *
* @param rewriteTarget the rewrite target
* @param lineDelimiter the line delimiter
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java
index 77bfd104663..1b9cac43c5e 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java
@@ -149,7 +149,7 @@ public class DefaultRangeIndicator extends Annotation implements IAnnotationPres
/**
* Creates and returns a new color palette data.
- *
+ *
* @param display the display
* @return the new color palette data
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorStatusLine.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorStatusLine.java
index 3017c1decee..275a9ed19be 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorStatusLine.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/EditorStatusLine.java
@@ -15,7 +15,6 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.core.runtime.Assert;
-
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java
index ae36743ae54..72ae1d77de1 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindNextAction.java
@@ -143,7 +143,7 @@ public class FindNextAction extends ResourceAction implements IUpdate {
IEditorPart editor= fWorkbenchPart.getSite().getPage().getActiveEditor();
if (editor == null)
return null;
-
+
return editor.getEditorSite().getActionBars().getStatusLineManager();
}
@@ -186,7 +186,7 @@ public class FindNextAction extends ResourceAction implements IUpdate {
statusNotFound();
return;
}
-
+
boolean wholeWord= fWholeWordInit && !fRegExSearch && isWord(fFindString);
statusClear();
@@ -199,7 +199,7 @@ public class FindNextAction extends ResourceAction implements IUpdate {
/**
* Tests whether each character in the given string is a letter.
- *
+ *
* @param str the string to check
* @return <code>true</code> if the given string is a word
* @since 3.2
@@ -388,7 +388,7 @@ public class FindNextAction extends ResourceAction implements IUpdate {
/**
* Returns the first line of the given selection.
- *
+ *
* @param selection the selection
* @return the first line of the selection
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceAction.java
index a18d22a1116..0a23b0d1ff3 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceAction.java
@@ -7,7 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Max Weninger <max.weninger@windriver.com> - https://bugs.eclipse.org/bugs/show_bug.cgi?id=148898
+ * Max Weninger <max.weninger@windriver.com> - https://bugs.eclipse.org/bugs/show_bug.cgi?id=148898
*******************************************************************************/
package org.eclipse.ui.texteditor;
@@ -38,7 +38,7 @@ import org.eclipse.ui.IWorkbenchWindow;
* It can also be used without having an IWorkbenchPart e.g. for
* dialogs or wizards by just providing a {@link Shell} and an {@link IFindReplaceTarget}.
* <em>In this case the dialog won't be shared with the one
- * used for the active workbench part.</em>
+ * used for the active workbench part.</em>
* </p>
* <p>
* This class may be instantiated; it is not intended to be subclassed.
@@ -76,7 +76,7 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
/**
* Creates a new find/replace dialog accessor anchored at the given part site.
- *
+ *
* @param site the part site
*/
public FindReplaceDialogStub(IWorkbenchPartSite site) {
@@ -89,12 +89,12 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
/**
* Creates a new find/replace dialog accessor anchored at the given shell.
- *
+ *
* @param shell the shell if no site is used
* @since 3.3
*/
public FindReplaceDialogStub(Shell shell) {
- fDialog= new FindReplaceDialog(shell);
+ fDialog= new FindReplaceDialog(shell);
fDialog.create();
fDialog.getShell().addDisposeListener(this);
}
@@ -154,7 +154,7 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
if(fgFindReplaceDialogStubShell == this)
fgFindReplaceDialogStubShell= null;
-
+
if (fWindow != null) {
fWindow.getPartService().removePartListener(this);
fWindow= null;
@@ -179,7 +179,7 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
* @see IPartListener#partBroughtToTop(IWorkbenchPart)
*/
public void partBroughtToTop(IWorkbenchPart part) {}
-
+
/**
* Checks if the dialogs shell is the same as the
* given <code>shell</code> and if not clears the stub
@@ -195,9 +195,9 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
if(fgFindReplaceDialogStubShell == this)
fgFindReplaceDialogStubShell= null;
-
+
fDialog.close();
- }
+ }
}
}
@@ -208,7 +208,7 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
* This stub is shared amongst <code>IWorkbenchPart</code>s.</p>
*/
private static FindReplaceDialogStub fgFindReplaceDialogStub;
-
+
/** Listener for disabling the dialog on shell close.
* <p>
* This stub is shared amongst <code>Shell</code>s.</p>
@@ -264,7 +264,7 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
* @param target the IFindReplaceTarget to use
* @param shell the shell
* @see ResourceAction#ResourceAction(ResourceBundle, String)
- *
+ *
* @since 3.3
*/
public FindReplaceAction(ResourceBundle bundle, String prefix, Shell shell, IFindReplaceTarget target) {
@@ -274,7 +274,7 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
fShell= shell;
update();
}
-
+
/**
* Creates a new find/replace action for the given workbench window.
* The action configures its visual representation from the given
@@ -294,7 +294,7 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
fWorkbenchWindow= workbenchWindow;
update();
}
-
+
/*
* @see IAction#run()
*/
@@ -304,7 +304,7 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
final FindReplaceDialog dialog;
final boolean isEditable;
-
+
if(fShell == null) {
if (fgFindReplaceDialogStub != null) {
Shell shell= fWorkbenchPart.getSite().getShell();
@@ -317,7 +317,7 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
isEditable= ((ITextEditorExtension2) fWorkbenchPart).isEditorInputModifiable();
else
isEditable= fTarget.isEditable();
-
+
dialog= fgFindReplaceDialogStub.getDialog();
} else {
@@ -330,9 +330,9 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
isEditable= fTarget.isEditable();
dialog= fgFindReplaceDialogStubShell.getDialog();
}
-
+
dialog.updateTarget(fTarget, isEditable, true);
- dialog.open();
+ dialog.open();
}
/*
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
index 374aa1a3e1e..ff419b4d9b0 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
@@ -176,7 +176,7 @@ class FindReplaceDialog extends Dialog {
private Button fReplaceSelectionButton, fReplaceFindButton, fFindNextButton, fReplaceAllButton;
private Combo fFindField, fReplaceField;
-
+
/**
* Find and replace command adapters.
* @since 3.3
@@ -232,7 +232,7 @@ class FindReplaceDialog extends Dialog {
setShellStyle(getShellStyle() ^ SWT.APPLICATION_MODAL | SWT.MODELESS);
setBlockOnOpen(false);
}
-
+
/*
* @see org.eclipse.jface.dialogs.Dialog#isResizable()
* @since 3.4
@@ -289,7 +289,7 @@ class FindReplaceDialog extends Dialog {
shell.setText(EditorMessages.FindReplace_title);
// shell.setImage(null);
}
-
+
/**
* Create the button section of the find/replace dialog.
*
@@ -370,7 +370,7 @@ class FindReplaceDialog extends Dialog {
Composite directionGroup= createDirectionGroup(panel);
setGridData(directionGroup, SWT.FILL, true, SWT.FILL, false);
-
+
Composite scopeGroup= createScopeGroup(panel);
setGridData(scopeGroup, SWT.FILL, true, SWT.FILL, false);
@@ -581,7 +581,7 @@ class FindReplaceDialog extends Dialog {
Label findLabel= new Label(panel, SWT.LEFT);
findLabel.setText(EditorMessages.FindReplace_Find_label);
setGridData(findLabel, SWT.LEFT, false, SWT.CENTER, false);
-
+
// Create the find content assist field
ComboContentAdapter contentAdapter= new ComboContentAdapter();
FindReplaceDocumentAdapterContentProposalProvider findProposer= new FindReplaceDocumentAdapterContentProposalProvider(true);
@@ -929,7 +929,7 @@ class FindReplaceDialog extends Dialog {
/**
* Returns the first line of the given selection.
- *
+ *
* @param selection the selection
* @return the first line of the selection
*/
@@ -1046,7 +1046,7 @@ class FindReplaceDialog extends Dialog {
/**
* Escapes special characters in the string, such that the resulting pattern
* matches the given string.
- *
+ *
* @param string the string to escape
* @return a regex pattern that matches the given string
*/
@@ -1074,7 +1074,7 @@ class FindReplaceDialog extends Dialog {
case '|':
pattern.append('\\').append(ch);
break;
-
+
case '\n':
pattern.append("\\n"); //$NON-NLS-1$
break;
@@ -1512,7 +1512,7 @@ class FindReplaceDialog extends Dialog {
gd.verticalAlignment= verticalAlignment;
gd.grabExcessVerticalSpace= grabExcessVerticalSpace;
}
-
+
/**
* Adds enough space in the control's layout data margin for the content assist
* decoration.
@@ -1563,7 +1563,7 @@ class FindReplaceDialog extends Dialog {
/**
* Tests whether each character in the given string is a letter.
- *
+ *
* @param str the string to check
* @return <code>true</code> if the given string is a word
* @since 3.0
@@ -1729,7 +1729,7 @@ class FindReplaceDialog extends Dialog {
fDialogSettings= settings.addNewSection(getClass().getName());
return fDialogSettings;
}
-
+
/*
* @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings()
* @since 3.2
@@ -1742,7 +1742,7 @@ class FindReplaceDialog extends Dialog {
section= settings.addNewSection(sectionName);
return section;
}
-
+
/*
* @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsStrategy()
* @since 3.2
@@ -1792,7 +1792,7 @@ class FindReplaceDialog extends Dialog {
s.put("wholeword", fWholeWordInit); //$NON-NLS-1$
s.put("incremental", fIncrementalInit); //$NON-NLS-1$
s.put("isRegEx", fIsRegExInit); //$NON-NLS-1$
-
+
List history= getFindHistory();
String findString= getFindString();
if (findString.length() > 0)
@@ -1805,10 +1805,10 @@ class FindReplaceDialog extends Dialog {
history.add(0, replaceString);
writeHistory(history, s, "replacehistory"); //$NON-NLS-1$
}
-
+
/**
* Writes the given history into the given dialog store.
- *
+ *
* @param history the history
* @param settings the dialog settings
* @param sectionName the section name
@@ -1826,13 +1826,13 @@ class FindReplaceDialog extends Dialog {
distinctItems.add(item);
}
}
-
+
while (history.size() > 8)
history.remove(8);
-
+
String[] names= new String[history.size()];
history.toArray(names);
settings.put(sectionName, names);
-
+
}
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoAnnotationAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoAnnotationAction.java
index 8cadbee6021..a737c0c5ca0 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoAnnotationAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoAnnotationAction.java
@@ -22,7 +22,7 @@ import org.eclipse.jface.text.source.IAnnotationModel;
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
- *
+ *
* @since 3.2
* @noextend This class is not intended to be subclassed by clients.
*/
@@ -51,7 +51,7 @@ public class GotoAnnotationAction extends TextEditorAction {
fForward= forward;
setHelpContextId(fForward ? IAbstractTextEditorHelpContextIds.GOTO_NEXT_ANNOTATION_ACTION : IAbstractTextEditorHelpContextIds.GOTO_PREVIOUS_ANNOTATION_ACTION);
}
-
+
/**
* Creates a new action for the given text editor. The action configures its
* visual representation from the given resource bundle.
@@ -73,7 +73,7 @@ public class GotoAnnotationAction extends TextEditorAction {
if (editor instanceof ITextEditorExtension4)
((ITextEditorExtension4)editor).gotoAnnotation(fForward);
}
-
+
/*
* @see org.eclipse.ui.texteditor.TextEditorAction#setEditor(org.eclipse.ui.texteditor.ITextEditor)
* @since 3.2
@@ -93,7 +93,7 @@ public class GotoAnnotationAction extends TextEditorAction {
setEnabled(false);
return;
}
-
+
IAnnotationModel model= editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
setEnabled(model != null);
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java
index 3aef3f1f50f..a9c85401221 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java
@@ -81,7 +81,7 @@ public class GotoLineAction extends TextEditorAction {
/**
* Standard input dialog with custom dialog bounds
* strategy and settings.
- *
+ *
* @since 2.0
*/
static class GotoLineDialog extends InputDialog {
@@ -92,7 +92,7 @@ public class GotoLineAction extends TextEditorAction {
public GotoLineDialog(Shell parent, String title, String message, String initialValue, IInputValidator validator) {
super(parent, title, message, initialValue, validator);
}
-
+
/*
* @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings()
* @since 3.2
@@ -105,7 +105,7 @@ public class GotoLineAction extends TextEditorAction {
section= settings.addNewSection(sectionName);
return section;
}
-
+
/*
* @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsStrategy()
* @since 3.2
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieCompleteAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieCompleteAction.java
index b65d772932a..ca25d676487 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieCompleteAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieCompleteAction.java
@@ -15,15 +15,16 @@ import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRewriteTarget;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
@@ -110,7 +111,7 @@ final class HippieCompleteAction extends TextEditorAction {
/** The compound edit exit strategy. */
private final CompoundEditExitStrategy fExitStrategy= new CompoundEditExitStrategy(ITextEditorActionDefinitionIds.HIPPIE_COMPLETION);
-
+
/**
* Creates a new action.
*
@@ -137,7 +138,7 @@ final class HippieCompleteAction extends TextEditorAction {
fLastCompletion= null;
ITextEditor editor= getTextEditor();
-
+
if (editor != null) {
IRewriteTarget target= (IRewriteTarget) editor.getAdapter(IRewriteTarget.class);
if (target != null) {
@@ -161,15 +162,15 @@ final class HippieCompleteAction extends TextEditorAction {
clearState();
return;
}
-
+
// advance the suggestion state
fLastCompletion.advance();
-
+
// move the caret to the insertion point
ISourceViewer sourceViewer= ((AbstractTextEditor) getTextEditor()).getSourceViewer();
sourceViewer.setSelectedRange(fLastCompletion.startOffset + fLastCompletion.length, 0);
sourceViewer.revealRange(fLastCompletion.startOffset, fLastCompletion.length);
-
+
fExitStrategy.arm(((AbstractTextEditor) getTextEditor()).getSourceViewer());
}
@@ -360,7 +361,7 @@ final class HippieCompleteAction extends TextEditorAction {
IRewriteTarget target= (IRewriteTarget) getTextEditor().getAdapter(IRewriteTarget.class);
if (target != null)
target.beginCompoundChange();
-
+
fLastCompletion= new CompletionState(suggestions, getSelectionOffset());
}
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieProposalProcessor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieProposalProcessor.java
index 1797010053a..a2e2fd7a858 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieProposalProcessor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HippieProposalProcessor.java
@@ -44,7 +44,7 @@ import org.eclipse.ui.internal.texteditor.HippieCompletionEngine;
* <p>
* Clients may instantiate.
* </p>
- *
+ *
* @since 3.2
*/
public final class HippieProposalProcessor implements IContentAssistProcessor {
@@ -163,18 +163,18 @@ public final class HippieProposalProcessor implements IContentAssistProcessor {
String prefix= getPrefix(viewer, offset);
if (prefix == null || prefix.length() == 0)
return NO_PROPOSALS;
-
+
List suggestions= getSuggestions(viewer, offset, prefix);
-
+
List result= new ArrayList();
for (Iterator it= suggestions.iterator(); it.hasNext();) {
String string= (String) it.next();
if (string.length() > 0)
result.add(createProposal(string, prefix, offset));
}
-
+
return (ICompletionProposal[]) result.toArray(new ICompletionProposal[result.size()]);
-
+
} catch (BadLocationException x) {
// ignore and return no proposals
return NO_PROPOSALS;
@@ -185,11 +185,11 @@ public final class HippieProposalProcessor implements IContentAssistProcessor {
IDocument doc= viewer.getDocument();
if (doc == null || offset > doc.getLength())
return null;
-
+
int length= 0;
while (--offset >= 0 && Character.isJavaIdentifierPart(doc.getChar(offset)))
length++;
-
+
return doc.get(offset + 1, length);
}
@@ -204,21 +204,21 @@ public final class HippieProposalProcessor implements IContentAssistProcessor {
// no context informations for hippie completions
return NO_CONTEXTS;
}
-
+
/*
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
*/
public char[] getCompletionProposalAutoActivationCharacters() {
return null;
}
-
+
/*
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
*/
public char[] getContextInformationAutoActivationCharacters() {
return null;
}
-
+
/*
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
*/
@@ -229,7 +229,7 @@ public final class HippieProposalProcessor implements IContentAssistProcessor {
/**
* Return the list of suggestions from the current document. First the document is searched
* backwards from the caret position and then forwards.
- *
+ *
* @param offset the offset
* @param viewer the viewer
* @param prefix the completion prefix
@@ -248,7 +248,7 @@ public final class HippieProposalProcessor implements IContentAssistProcessor {
/**
* Create the array of suggestions. It scans all open text editors and prefers suggestions from
* the currently open editor. It also adds the empty suggestion at the end.
- *
+ *
* @param viewer the viewer
* @param offset the offset
* @param prefix the prefix to search for
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorDescriptor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorDescriptor.java
index bb17a4611f5..70233cda38f 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorDescriptor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorDescriptor.java
@@ -42,7 +42,7 @@ import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public final class HyperlinkDetectorDescriptor {
-
+
public static final String STATE_MASK_POSTFIX= "_stateMask"; //$NON-NLS-1$
private static final String HYPERLINK_DETECTORS_EXTENSION_POINT= "org.eclipse.ui.workbench.texteditor.hyperlinkDetectors"; //$NON-NLS-1$
@@ -73,8 +73,8 @@ public final class HyperlinkDetectorDescriptor {
/**
* Creates a new descriptor from the given configuration element.
- *
- * @param element the configuration element
+ *
+ * @param element the configuration element
*/
private HyperlinkDetectorDescriptor(IConfigurationElement element) {
Assert.isNotNull(element);
@@ -83,14 +83,14 @@ public final class HyperlinkDetectorDescriptor {
/**
* Creates a new {@link IHyperlinkDetector}.
- *
- * @return the hyperlink detector or <code>null</code> if the plug-in isn't loaded yet
+ *
+ * @return the hyperlink detector or <code>null</code> if the plug-in isn't loaded yet
* @throws CoreException if a failure occurred during creation
*/
public AbstractHyperlinkDetector createHyperlinkDetector() throws CoreException {
final Throwable[] exception= new Throwable[1];
final AbstractHyperlinkDetector[] result= new AbstractHyperlinkDetector[1];
- String message= NLSUtility.format(EditorMessages.Editor_error_HyperlinkDetector_couldNotCreate_message, new String[] { getId(), fElement.getContributor().getName() });
+ String message= NLSUtility.format(EditorMessages.Editor_error_HyperlinkDetector_couldNotCreate_message, new String[] { getId(), fElement.getContributor().getName() });
ISafeRunnable code= new SafeRunnable(message) {
/*
* @see org.eclipse.core.runtime.ISafeRunnable#run()
@@ -108,17 +108,17 @@ public final class HyperlinkDetectorDescriptor {
super.handleException(ex);
exception[0]= ex;
}
-
+
};
-
+
SafeRunner.run(code);
-
+
if (exception[0] == null)
return result[0];
throw new CoreException(new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.OK, message, exception[0]));
-
+
}
-
+
private boolean isValid(HyperlinkDetectorTargetDescriptor[] targets) {
if (getId() == null || getName() == null || getTargetId() == null)
return false;
@@ -138,8 +138,8 @@ public final class HyperlinkDetectorDescriptor {
/**
* Returns the hyperlink detector's id.
- *
- * @return the hyperlink detector's id
+ *
+ * @return the hyperlink detector's id
*/
public String getId() {
return fElement.getAttribute(ID_ATTRIBUTE);
@@ -147,26 +147,26 @@ public final class HyperlinkDetectorDescriptor {
/**
* Returns the hyperlink detector's name.
- *
- * @return the hyperlink detector's name
+ *
+ * @return the hyperlink detector's name
*/
public String getName() {
return fElement.getAttribute(NAME_ATTRIBUTE);
}
-
+
/**
* Returns the hyperlink detector's target descriptor.
- *
- * @return the hyperlink detector's target descriptor
+ *
+ * @return the hyperlink detector's target descriptor
*/
public HyperlinkDetectorTargetDescriptor getTarget() {
return fTarget;
}
-
+
/**
* Returns the hyperlink detector's target id.
- *
- * @return the hyperlink detector's target id
+ *
+ * @return the hyperlink detector's target id
*/
public String getTargetId() {
return fElement.getAttribute(TARGET_ID_ATTRIBUTE);
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorRegistry.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorRegistry.java
index e570e7431e0..3deae81621c 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorRegistry.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorRegistry.java
@@ -33,17 +33,17 @@ import org.eclipse.jface.text.hyperlink.IHyperlinkDetectorExtension2;
* Hyperlink detector registry that manages the detectors
* contributed by the <code>org.eclipse.ui.workbench.texteditor.hyperlinkDetectors</code> extension point for
* targets contributed by the <code>org.eclipse.ui.workbench.texteditor.hyperlinkDetectorTargets</code> extension point.
- *
+ *
* @since 3.3
*/
public final class HyperlinkDetectorRegistry {
-
-
+
+
/**
* Delegate for contributed hyperlink detectors.
*/
private class HyperlinkDetectorDelegate implements IHyperlinkDetector, IHyperlinkDetectorExtension, IHyperlinkDetectorExtension2 {
-
+
private HyperlinkDetectorDescriptor fHyperlinkDescriptor;
private AbstractHyperlinkDetector fHyperlinkDetector;
private boolean fFailedDuringCreation= false;
@@ -51,7 +51,7 @@ public final class HyperlinkDetectorRegistry {
private int fStateMask;
private boolean fIsEnabled;
-
+
private HyperlinkDetectorDelegate(HyperlinkDetectorDescriptor descriptor) {
fHyperlinkDescriptor= descriptor;
if (fPreferenceStore != null) {
@@ -66,7 +66,7 @@ public final class HyperlinkDetectorRegistry {
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
if (!isEnabled())
return null;
-
+
if (!fFailedDuringCreation && fHyperlinkDetector == null) {
try {
fHyperlinkDetector= fHyperlinkDescriptor.createHyperlinkDetector();
@@ -78,10 +78,10 @@ public final class HyperlinkDetectorRegistry {
}
if (fHyperlinkDetector != null)
return fHyperlinkDetector.detectHyperlinks(textViewer, region, canShowMultipleHyperlinks);
-
+
return null;
}
-
+
private boolean isEnabled() {
return fIsEnabled;
}
@@ -89,7 +89,7 @@ public final class HyperlinkDetectorRegistry {
private void setContext(IAdaptable context) {
fContext= context;
}
-
+
/*
* @see org.eclipse.jface.text.hyperlink.IHyperlinkDetectorExtension#dispose()
*/
@@ -101,7 +101,7 @@ public final class HyperlinkDetectorRegistry {
fHyperlinkDescriptor= null;
fContext= null;
}
-
+
/*
* @see org.eclipse.jface.text.hyperlink.IHyperlinkDetectorExtension#getStateMask()
* @since 3.3
@@ -109,38 +109,38 @@ public final class HyperlinkDetectorRegistry {
public int getStateMask() {
return fStateMask;
}
-
+
}
-
+
private HyperlinkDetectorDescriptor[] fHyperlinkDetectorDescriptors;
private IPreferenceStore fPreferenceStore;
-
+
/**
* Creates a new hyperlink detector registry.
*/
public HyperlinkDetectorRegistry() {
}
-
+
/**
* Creates a new hyperlink detector registry that controls
* hyperlink enablement via the given preference store.
* <p>
* The hyperlink detector id is used as preference key.
* The value is of type <code>Boolean</code> where
- * <code>false</code> means that the hyperlink detector is active.
+ * <code>false</code> means that the hyperlink detector is active.
* </p>
- *
+ *
* @param preferenceStore the preference store to be used
*/
public HyperlinkDetectorRegistry(IPreferenceStore preferenceStore) {
fPreferenceStore= preferenceStore;
}
-
+
/**
* Returns all hyperlink detectors contributed to the workbench.
- *
+ *
* @return an array of hyperlink detector descriptors
*/
public synchronized HyperlinkDetectorDescriptor[] getHyperlinkDetectorDescriptors() {
@@ -156,7 +156,7 @@ public final class HyperlinkDetectorRegistry {
private synchronized void initHyperlinkDetectorDescriptors() {
if (fHyperlinkDetectorDescriptors == null)
fHyperlinkDetectorDescriptors= HyperlinkDetectorDescriptor.getContributedHyperlinkDetectors();
- }
+ }
/*
* @see org.eclipse.jface.text.hyperlink.IHyperlinkDetectorRegistry#createHyperlinkDetectors(java.lang.String[], org.eclipse.core.runtime.IAdaptable)
@@ -164,7 +164,7 @@ public final class HyperlinkDetectorRegistry {
public IHyperlinkDetector[] createHyperlinkDetectors(String targetId, IAdaptable context) {
Assert.isLegal(targetId != null);
initHyperlinkDetectorDescriptors();
-
+
List result= new ArrayList();
for (int i= 0; i < fHyperlinkDetectorDescriptors.length; i++) {
if (targetId.equals(fHyperlinkDetectorDescriptors[i].getTargetId())) {
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorTargetDescriptor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorTargetDescriptor.java
index 53af00e0606..faf17489978 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorTargetDescriptor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/HyperlinkDetectorTargetDescriptor.java
@@ -58,8 +58,8 @@ public final class HyperlinkDetectorTargetDescriptor {
/**
* Creates a new descriptor from the given configuration element.
- *
- * @param element the configuration element
+ *
+ * @param element the configuration element
*/
private HyperlinkDetectorTargetDescriptor(IConfigurationElement element) {
Assert.isNotNull(element);
@@ -70,8 +70,8 @@ public final class HyperlinkDetectorTargetDescriptor {
/**
* Returns the hyperlink detector target's id.
- *
- * @return the hyperlink detector target's id
+ *
+ * @return the hyperlink detector target's id
*/
public String getId() {
return fElement.getAttribute(ID_ATTRIBUTE);
@@ -79,18 +79,18 @@ public final class HyperlinkDetectorTargetDescriptor {
/**
* Returns the hyperlink detector target's name.
- *
- * @return the hyperlink detector target's name
+ *
+ * @return the hyperlink detector target's name
*/
public String getName() {
return fElement.getAttribute(NAME_ATTRIBUTE);
}
-
+
/**
* Returns the types that the context of this
* hyperlink detector target supports.
- *
- * @return an array with type names that this target's context supports
+ *
+ * @return an array with type names that this target's context supports
*/
public String[] getTypes() {
IConfigurationElement[] contexts= fElement.getChildren(CONTEXT_ELEMENT);
@@ -136,11 +136,11 @@ public final class HyperlinkDetectorTargetDescriptor {
String message= NLSUtility.format(EditorMessages.Editor_error_HyperlinkDetectorTarget_invalidElementName_message, new String[] { element.getContributor().getName(), element.getName() });
TextEditorPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.OK, message, null));
}
-
+
}
return (HyperlinkDetectorTargetDescriptor[])result.toArray(new HyperlinkDetectorTargetDescriptor[result.size()]);
}
-
+
private boolean isValid() {
return getId() != null && getName() != null;
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAbstractTextEditorHelpContextIds.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAbstractTextEditorHelpContextIds.java
index a9bb57917a9..8f57d59a8ec 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAbstractTextEditorHelpContextIds.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IAbstractTextEditorHelpContextIds.java
@@ -190,14 +190,14 @@ public interface IAbstractTextEditorHelpContextIds {
* @since 3.2
*/
String GOTO_NEXT_ANNOTATION_ACTION= PREFIX + "goto_next_annotation" + ACTION_POSTFIX; //$NON-NLS-1$
-
+
/**
* Help context id for the action.
* Value: <code>"org.eclipse.ui.goto_previous_annotation_action_context"</code>
* @since 3.2
*/
String GOTO_PREVIOUS_ANNOTATION_ACTION= PREFIX + "goto_previous_annotation" + ACTION_POSTFIX; //$NON-NLS-1$
-
+
/**
* Help context id for the action.
* Value: <code>"org.eclipse.ui.FindIncremental_action_context"</code>
@@ -334,14 +334,14 @@ public interface IAbstractTextEditorHelpContextIds {
* @since 3.1
*/
String HIPPIE_COMPLETION_ACTION= PREFIX + "hippie_completion" + ACTION_POSTFIX; //$NON-NLS-1$
-
+
/**
* Help context id for the quick assist action.
* Value: <code>"org.eclipse.ui.quick_assist_action_context"</code>
* @since 3.2
*/
String QUICK_ASSIST_ACTION= PREFIX + "quick_assist" + ACTION_POSTFIX; //$NON-NLS-1$
-
+
/**
* Help context id for the recenter action.
* Value: <code>"org.eclipse.ui.recenter_action_context"</code>
@@ -355,7 +355,7 @@ public interface IAbstractTextEditorHelpContextIds {
* @since 3.3
*/
String SHOW_WHITESPACE_CHARACTERS_ACTION= PREFIX + "show_whitepsace_characters" + ACTION_POSTFIX; //$NON-NLS-1$
-
+
/**
* Help context id for the action that displays information
* for the current caret location in a sticky hover.
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDeleteLineTarget.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDeleteLineTarget.java
index b9982a94f68..bc229a65908 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDeleteLineTarget.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDeleteLineTarget.java
@@ -20,7 +20,7 @@ import org.eclipse.jface.text.IDocument;
* Clients can implements that interface or use the provided default
* implementation {@link TextViewerDeleteLineTarget}.
* </p>
- *
+ *
* @since 3.4
*/
interface IDeleteLineTarget {
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProvider.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProvider.java
index 98ad2367326..18cbece3383 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProvider.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProvider.java
@@ -10,12 +10,12 @@
*******************************************************************************/
package org.eclipse.ui.texteditor;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.IAnnotationModel;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.source.IAnnotationModel;
+
/**
* A document provider maps between domain elements and documents. A document provider has the
* following responsibilities:
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension2.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension2.java
index 29018795f1c..670fff497a1 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension2.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension2.java
@@ -26,7 +26,7 @@ public interface IDocumentProviderExtension2 {
/**
* Sets this providers progress monitor.
- *
+ *
* @param progressMonitor the progress monitor
*/
void setProgressMonitor(IProgressMonitor progressMonitor);
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension5.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension5.java
index 904c9626d58..622b5a935b4 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension5.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IDocumentProviderExtension5.java
@@ -27,7 +27,7 @@ public interface IDocumentProviderExtension5 {
/**
* Tells whether the given core exception is exactly the
* exception which is thrown for a non-synchronized element.
- *
+ *
* @param element the element
* @param ex the core exception
* @return <code>true</code> iff the given core exception is exactly the
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IReadOnlyDependent.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IReadOnlyDependent.java
index abddb9fa935..318b2009903 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IReadOnlyDependent.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IReadOnlyDependent.java
@@ -17,7 +17,7 @@ package org.eclipse.ui.texteditor;
* only manage an enable/disable state but also manage a "hypothetical"
* enable state, depending on whether the target they work on is writable
* or read-only.
- *
+ *
* @since 2.0
*/
public interface IReadOnlyDependent {
@@ -28,7 +28,7 @@ public interface IReadOnlyDependent {
* <code>isEnabled(boolean)</code> holds the following invariants: isEnabled() == false, if
* isEnabled(true) == false || isEnabled(false) == false isEnabled() == true, if isEnabled(true)
* == true || isEnabled(false) == true
- *
+ *
* @param isWritable the writable state
* @return the hypothetical enable state of the action
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditor.java
index 4eb389ba781..c2349d72e98 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditor.java
@@ -13,9 +13,10 @@ package org.eclipse.ui.texteditor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.text.IRegion;
+
import org.eclipse.ui.IEditorPart;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java
index e5b34de4db4..16c36160cb4 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java
@@ -446,7 +446,7 @@ public interface ITextEditorActionConstants extends IWorkbenchActionConstants {
* @see org.eclipse.ui.actions.ActionFactory#REVERT
*/
String REVERT= ActionFactory.REVERT.getId();
-
+
/**
* Name of standard Next global action in the Navigate menu.
* Value <code>"next"</code>
@@ -454,7 +454,7 @@ public interface ITextEditorActionConstants extends IWorkbenchActionConstants {
* @see org.eclipse.ui.actions.ActionFactory#NEXT
*/
String NEXT= ActionFactory.NEXT.getId();
-
+
/**
* Name of standard Previous global action in the Navigate menu.
* Value <code>"previous"</code>
@@ -462,7 +462,7 @@ public interface ITextEditorActionConstants extends IWorkbenchActionConstants {
* @see org.eclipse.ui.actions.ActionFactory#PREVIOUS
*/
String PREVIOUS= ActionFactory.PREVIOUS.getId();
-
+
/**
* Name of standard Refresh global action in the File menu.
* Value <code>"refresh"</code>
@@ -470,7 +470,7 @@ public interface ITextEditorActionConstants extends IWorkbenchActionConstants {
* @see org.eclipse.ui.actions.ActionFactory#REFRESH
*/
String REFRESH= ActionFactory.REFRESH.getId();
-
+
/**
* Name of the action for re-establishing the state after the
* most recent save operation.
@@ -617,7 +617,7 @@ public interface ITextEditorActionConstants extends IWorkbenchActionConstants {
* @since 3.3
*/
String REVISION_SHOW_AUTHOR_TOGGLE= "Revision.ShowAuthor.Toggle"; //$NON-NLS-1$
-
+
/**
* Name of the action for toggling the display of the revision id.
* Value: <code>"Revision.ShowId.Toggle"</code>
@@ -637,11 +637,11 @@ public interface ITextEditorActionConstants extends IWorkbenchActionConstants {
* @since 3.3
*/
String SHOW_WHITESPACE_CHARACTERS= "ShowWhitespaceCharacters"; //$NON-NLS-1$
-
+
/**
* Name of the action displaying information for the
* current caret location in a sticky hover.
- *
+ *
* Value: <code>"ShowInformation"</code>
* @see IInformationProvider
* @since 3.3
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java
index 4e142ecca79..4e71051dcbf 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java
@@ -22,7 +22,7 @@ import org.eclipse.jface.text.information.IInformationProvider;
* <p>
* This interface must not be implemented by clients.
* </p>
- *
+ *
* @since 2.0
* @noimplement This interface is not intended to be implemented by clients.
*/
@@ -457,14 +457,14 @@ public interface ITextEditorActionDefinitionIds extends IWorkbenchActionDefiniti
* @since 2.1
*/
String CONTENT_ASSIST_PROPOSALS= "org.eclipse.ui.edit.text.contentAssist.proposals"; //$NON-NLS-1$
-
+
/**
* Action definition ID of the edit -> content assist context information action
* Value: <code>"org.eclipse.ui.edit.text.contentAssist.contextInformation"</code>).
* @since 2.1
*/
String CONTENT_ASSIST_CONTEXT_INFORMATION= "org.eclipse.ui.edit.text.contentAssist.contextInformation"; //$NON-NLS-1$
-
+
/**
* Action definition ID of the edit -> quick assist proposal action
* <p>
@@ -530,21 +530,21 @@ public interface ITextEditorActionDefinitionIds extends IWorkbenchActionDefiniti
* @since 3.3
*/
String REVISION_RENDERING_CYCLE= "org.eclipse.ui.editors.revisions.rendering.cycle"; //$NON-NLS-1$
-
+
/**
* Command ID of the command to toggle the revision author display.
* Value: <code>"org.eclipse.ui.editors.revisions.author.toggle"</code>).
* @since 3.3
*/
String REVISION_AUTHOR_TOGGLE= "org.eclipse.ui.editors.revisions.author.toggle"; //$NON-NLS-1$
-
+
/**
* Command ID of the command to toggle the revision ID display.
* Value: <code>"org.eclipse.ui.editors.revisions.id.toggle"</code>).
* @since 3.3
*/
String REVISION_ID_TOGGLE= "org.eclipse.ui.editors.revisions.id.toggle"; //$NON-NLS-1$
-
+
/**
* Command ID of the recenter command.
* Value: <code>"org.eclipse.ui.edit.text.recenter"</code>).
@@ -558,7 +558,7 @@ public interface ITextEditorActionDefinitionIds extends IWorkbenchActionDefiniti
* @since 3.3
*/
String SHOW_WHITESPACE_CHARACTERS = "org.eclipse.ui.edit.text.toggleShowWhitespaceCharacters"; //$NON-NLS-1$
-
+
/**
* Command ID of the command to display information for the
* current caret location in a sticky hover.
@@ -567,5 +567,5 @@ public interface ITextEditorActionDefinitionIds extends IWorkbenchActionDefiniti
* @since 3.3
*/
String SHOW_INFORMATION= "org.eclipse.ui.edit.text.showInformation"; //$NON-NLS-1$
-
+
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension4.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension4.java
index 0ceec058f83..f9ee95c1621 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension4.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension4.java
@@ -39,7 +39,7 @@ public interface ITextEditorExtension4 {
/**
* Shows revision information in this editor.
- *
+ *
* @param info the revision information to display
* @param quickDiffProviderId the quick diff provider that matches the source of the revision
* information
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IWorkbenchActionDefinitionIds.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IWorkbenchActionDefinitionIds.java
index 71afa45c64f..3019fd17a74 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IWorkbenchActionDefinitionIds.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IWorkbenchActionDefinitionIds.java
@@ -16,7 +16,7 @@ package org.eclipse.ui.texteditor;
* <p>
* This interface must not be implemented by clients.
* </p>
- *
+ *
* @since 2.0
* @noimplement This interface is not intended to be implemented by clients.
*/
@@ -43,7 +43,7 @@ public interface IWorkbenchActionDefinitionIds {
* @deprecated As of 3.4, replaced by {@link #REVERT}
*/
public static final String REVERT_TO_SAVED= "org.eclipse.ui.edit.revertToSaved"; //$NON-NLS-1$
-
+
/**
* Action definition id of the file revert action.
* Value: <code>"org.eclipse.ui.file.revert"</code>
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindAction.java
index 2581d7136a7..e830a663aa0 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindAction.java
@@ -16,6 +16,7 @@ import java.util.ResourceBundle;
import org.eclipse.jface.text.IFindReplaceTarget;
import org.eclipse.jface.text.IFindReplaceTargetExtension;
+
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindTarget.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindTarget.java
index eb116cd9d47..941ff453a98 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindTarget.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/IncrementalFindTarget.java
@@ -365,7 +365,7 @@ class IncrementalFindTarget implements IFindReplaceTarget, IFindReplaceTargetExt
((ITextViewerExtension) fTextViewer).prependVerifyKeyListener(this);
else
text.addVerifyKeyListener(this);
-
+
ICommandService commandService= (ICommandService)PlatformUI.getWorkbench().getAdapter(ICommandService.class);
if (commandService != null)
commandService.addExecutionListener(this);
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java
index 0549813a4a4..387de38590a 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java
@@ -154,7 +154,7 @@ public class InfoForm {
/**
* Handles the property change.
- *
+ *
* @param event the property change event object describing which property changed and how
*/
protected void handlePropertyChange(PropertyChangeEvent event) {
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/JoinLinesAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/JoinLinesAction.java
index a4ba970c147..d4c0f7bbd38 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/JoinLinesAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/JoinLinesAction.java
@@ -25,17 +25,17 @@ import org.eclipse.jface.text.ITextSelection;
/**
* Action for joining two or more lines together by deleting the
* line delimiters and trimming the whitespace between them.
- *
+ *
* @since 3.3
*/
public class JoinLinesAction extends TextEditorAction {
private String fJoint= null;
-
-
+
+
/**
* Creates a line joining action.
- *
+ *
* @param bundle the resource bundle for UI strings
* @param prefix the prefix for the property keys into <code>bundle</code>
* @param editor the editor
@@ -52,7 +52,7 @@ public class JoinLinesAction extends TextEditorAction {
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
-
+
ITextEditor editor= getTextEditor();
if (editor == null)
return;
@@ -77,12 +77,12 @@ public class JoinLinesAction extends TextEditorAction {
} catch (BadLocationException e) {
// should not happen
}
-
+
}
/**
* Returns the editor's document.
- *
+ *
* @param editor the editor
* @return the editor's document
*/
@@ -101,7 +101,7 @@ public class JoinLinesAction extends TextEditorAction {
/**
* Returns the editor's selection.
- *
+ *
* @param editor the editor
* @return the editor's selection
*/
@@ -117,7 +117,7 @@ public class JoinLinesAction extends TextEditorAction {
return (ITextSelection) selection;
}
-
+
/*
* @see org.eclipse.ui.texteditor.TextEditorAction#update()
*/
@@ -137,7 +137,7 @@ public class JoinLinesAction extends TextEditorAction {
/**
* Joins several text lines to one line.
- *
+ *
* @param document the document
* @param startLine the start line
* @param endLine the end line
@@ -173,17 +173,17 @@ public class JoinLinesAction extends TextEditorAction {
lineLength= lineLength - getLineDelimiterLength(document, line);
if (!ignoreLeadingWhitespace)
return document.get(lineOffset, lineLength).trim();
-
+
while (lineLength > 0 && Character.isWhitespace(document.getChar(lineOffset + lineLength - 1)))
lineLength--;
-
+
return document.get(lineOffset, lineLength);
}
-
+
private int getLineDelimiterLength(IDocument document, int line) throws BadLocationException {
String lineDelimiter= document.getLineDelimiter(line);
return lineDelimiter != null ? lineDelimiter.length() : 0;
-
+
}
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/KeyBindingSupportForAssistant.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/KeyBindingSupportForAssistant.java
index 005435e91d5..d7cb8f0a717 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/KeyBindingSupportForAssistant.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/KeyBindingSupportForAssistant.java
@@ -39,7 +39,7 @@ import org.eclipse.ui.commands.ICommandService;
* Clients normally don't need to use that class as the setup is done by the
* framework.
* </p>
- *
+ *
* @since 3.4
*/
public final class KeyBindingSupportForAssistant implements ICompletionListener {
@@ -73,7 +73,7 @@ public final class KeyBindingSupportForAssistant implements ICompletionListener
}
}
}
-
+
private List fReplacedCommands;
private ContentAssistantFacade fContentAssistantFacade;
@@ -81,7 +81,7 @@ public final class KeyBindingSupportForAssistant implements ICompletionListener
/**
* Creates the support for a content assistant facade.
- *
+ *
* @param contentAssistFacade the content assist facade
* @deprecated As of 3.5, this is a NOP since the framework installs this now
*/
@@ -90,7 +90,7 @@ public final class KeyBindingSupportForAssistant implements ICompletionListener
/**
* Creates the support for a content assistant facade.
- *
+ *
* @param sourceViewerExtension the source viewer extension
* @since 3.5
*/
@@ -103,7 +103,7 @@ public final class KeyBindingSupportForAssistant implements ICompletionListener
/**
* Creates the support for a content assistant facade.
- *
+ *
* @param contentAssistant the content assist facade
* @deprecated As of 3.5, this is a NOP since the framework installs this now
*/
@@ -112,7 +112,7 @@ public final class KeyBindingSupportForAssistant implements ICompletionListener
/**
* Creates the support for a quick assist assistant.
- *
+ *
* @param quickAssistAssistant the quick assist assistant.
*/
public KeyBindingSupportForAssistant(IQuickAssistAssistant quickAssistAssistant) {
@@ -148,7 +148,7 @@ public final class KeyBindingSupportForAssistant implements ICompletionListener
* The same handler instance will be returned when called a more than once
* with the same command identifier.
* </p>
- *
+ *
* @param commandId the command identifier
* @return the handler for the given command identifier
*/
@@ -186,7 +186,7 @@ public final class KeyBindingSupportForAssistant implements ICompletionListener
fContentAssistantFacade.removeCompletionListener(this);
fContentAssistantFacade= null;
}
-
+
if (fQuickAssistAssistant != null) {
fQuickAssistAssistant.removeCompletionListener(this);
fQuickAssistAssistant= null;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkRegionTarget.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkRegionTarget.java
index fcb62691335..6f27c8e0d7f 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkRegionTarget.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MarkRegionTarget.java
@@ -15,6 +15,7 @@ package org.eclipse.ui.texteditor;
import org.eclipse.swt.graphics.Point;
import org.eclipse.jface.action.IStatusLineManager;
+
import org.eclipse.jface.text.IMarkRegionTarget;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MoveLinesAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MoveLinesAction.java
index 83b2571df36..3c8f199e919 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MoveLinesAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/MoveLinesAction.java
@@ -70,7 +70,7 @@ public class MoveLinesAction extends TextEditorAction {
/**
* Creates and initializes the action for the given text editor. The action configures its
* visual representation from the given resource bundle.
- *
+ *
* @param bundle the resource bundle
* @param prefix a prefix to be prepended to the various resource keys (described in
* <code>ResourceAction</code> constructor), or <code>null</code> if none
@@ -100,7 +100,7 @@ public class MoveLinesAction extends TextEditorAction {
/**
* Creates and initializes the action for the given text editor. The action configures its
* visual representation from the given resource bundle.
- *
+ *
* @param bundle the resource bundle
* @param prefix a prefix to be prepended to the various resource keys (described in
* <code>ResourceAction</code> constructor), or <code>null</code> if none
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RecenterAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RecenterAction.java
index e66b76d7acb..021743b6708 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RecenterAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/RecenterAction.java
@@ -12,9 +12,10 @@ package org.eclipse.ui.texteditor;
import java.util.ResourceBundle;
-import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.swt.custom.StyledText;
+import org.eclipse.jface.text.source.ISourceViewer;
+
/**
* An action to handle emacs-like recenter.
* This function scrolls the selected window to put the cursor at the middle of the screen.
@@ -22,7 +23,7 @@ import org.eclipse.swt.custom.StyledText;
* @since 3.3
*/
public class RecenterAction extends TextEditorAction {
-
+
/**
* Creates a new action for the given text editor. The action configures its
* visual representation from the given resource bundle.
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SaveAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SaveAction.java
index 0a9ad1071c8..7878abcb995 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SaveAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SaveAction.java
@@ -20,7 +20,7 @@ import java.util.ResourceBundle;
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @deprecated As of 3.5, replaced by {@link org.eclipse.ui.actions.ActionFactory#SAVE}
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SelectAnnotationRulerAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SelectAnnotationRulerAction.java
index e2e770626f6..a7480094fe3 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SelectAnnotationRulerAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SelectAnnotationRulerAction.java
@@ -19,10 +19,10 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IVerticalRulerListener;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.jface.text.source.IVerticalRulerInfoExtension;
+import org.eclipse.jface.text.source.IVerticalRulerListener;
import org.eclipse.jface.text.source.VerticalRulerEvent;
/**
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ShowWhitespaceCharactersAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ShowWhitespaceCharactersAction.java
index 3cc2574ecc3..71353aa0d3f 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ShowWhitespaceCharactersAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ShowWhitespaceCharactersAction.java
@@ -31,7 +31,7 @@ import org.eclipse.jface.text.WhitespaceCharacterPainter;
* <strong>Note:</strong> Currently this action only works if the given
* editor inherits from {@link AbstractTextEditor}.
* </p>
- *
+ *
* @since 3.3
*/
public class ShowWhitespaceCharactersAction extends TextEditorAction {
@@ -40,10 +40,10 @@ public class ShowWhitespaceCharactersAction extends TextEditorAction {
private IPreferenceStore fStore;
/** The painter. */
private IPainter fWhitespaceCharPainter;
-
+
/**
* Construct the action and initialize its state.
- *
+ *
* @param resourceBundle the resource bundle to construct label and tooltip from
* @param prefix the prefix to use for constructing resource bundle keys
* @param editor the editor this action is associated with
@@ -57,7 +57,7 @@ public class ShowWhitespaceCharactersAction extends TextEditorAction {
/**
* Sets the preference store of this action.
- *
+ *
* @param store the preference store
*/
public void setPreferenceStore(IPreferenceStore store) {
@@ -87,7 +87,7 @@ public class ShowWhitespaceCharactersAction extends TextEditorAction {
*/
private void installPainter() {
Assert.isTrue(fWhitespaceCharPainter == null);
-
+
ITextViewer viewer= getTextViewer();
if (viewer instanceof ITextViewerExtension2) {
fWhitespaceCharPainter= new WhitespaceCharacterPainter(viewer);
@@ -101,25 +101,25 @@ public class ShowWhitespaceCharactersAction extends TextEditorAction {
private void uninstallPainter() {
if (fWhitespaceCharPainter == null)
return;
-
+
ITextViewer viewer= getTextViewer();
if (viewer instanceof ITextViewerExtension2)
((ITextViewerExtension2)viewer).removePainter(fWhitespaceCharPainter);
-
+
fWhitespaceCharPainter.deactivate(true);
fWhitespaceCharPainter= null;
}
/**
* Get the <code>ITextViewer</code> from an <code>ITextEditor</code>.
- *
+ *
* @return the text viewer or <code>null</code>
*/
private ITextViewer getTextViewer() {
ITextEditor editor= getTextEditor();
if (editor instanceof AbstractTextEditor)
return ((AbstractTextEditor)editor).getSourceViewer();
-
+
return null;
}
@@ -130,7 +130,7 @@ public class ShowWhitespaceCharactersAction extends TextEditorAction {
boolean checked= false;
if (fStore != null)
checked= fStore.getBoolean(AbstractTextEditor.PREFERENCE_SHOW_WHITESPACE_CHARACTERS);
-
+
if (checked != isChecked()) {
setChecked(checked);
togglePainterState(checked);
@@ -139,8 +139,8 @@ public class ShowWhitespaceCharactersAction extends TextEditorAction {
/**
* Toggles the painter state.
- *
- * @param newState <code>true</code> if the painter should be installed
+ *
+ * @param newState <code>true</code> if the painter should be installed
*/
private void togglePainterState(boolean newState) {
if (newState)
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java
index b75271caf3e..26d2e8e1748 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java
@@ -120,7 +120,7 @@ public class SourceViewerDecorationSupport {
textWidget.redraw();
return;
}
-
+
char ch= textWidget.getTextRange(offset, 1).charAt(0);
if (ch == '\r' || ch == '\n') {
// at the end of a line, redraw up to the next line start
@@ -133,25 +133,25 @@ public class SourceViewerDecorationSupport {
textWidget.redraw();
return;
}
-
+
int nextLineOffset= textWidget.getOffsetAtLine(nextLine);
length= nextLineOffset - offset;
} else {
length= 1;
}
-
+
textWidget.redrawRange(offset, length, true);
}
}
}
-
+
/**
* The box drawing strategy.
* @since 3.0
*/
private static ITextStyleStrategy fgBoxStrategy= new AnnotationPainter.BoxStrategy(SWT.BORDER_SOLID);
-
+
/**
* The dashed box drawing strategy.
* @since 3.3
@@ -333,7 +333,7 @@ public class SourceViewerDecorationSupport {
private Object getAnnotationDecorationType(Object annotationType) {
if (areAnnotationsHighlighted(annotationType))
return null;
-
+
if (areAnnotationsShown(annotationType) && fPreferenceStore != null) {
AnnotationPreference info= (AnnotationPreference) fAnnotationTypeKeyMap.get(annotationType);
if (info != null) {
@@ -407,7 +407,7 @@ public class SourceViewerDecorationSupport {
/**
* Sets the character pair matcher for the matching character painter.
- *
+ *
* @param pairMatcher the character pair matcher
*/
public void setCharacterPairMatcher(ICharacterPairMatcher pairMatcher) {
@@ -473,7 +473,7 @@ public class SourceViewerDecorationSupport {
/**
* Sets the symbolic font name that is used for computing the margin width.
- *
+ *
* @param symbolicFontName the symbolic font name
*/
public void setSymbolicFontName(String symbolicFontName) {
@@ -883,10 +883,10 @@ public class SourceViewerDecorationSupport {
}
return false;
}
-
+
/**
* Tells whether annotations are highlighted in the source viewer for the given type.
- *
+ *
* @param annotationType the annotation type
* @return <code>true</code> if the annotations are highlighted
* @since 3.0
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusLineContributionItem.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusLineContributionItem.java
index b0dd13018ea..b09480e5650 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusLineContributionItem.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusLineContributionItem.java
@@ -137,7 +137,7 @@ public class StatusLineContributionItem extends ContributionItem implements ISta
fText= text;
updateMessageLabel();
}
-
+
/*
* @see IStatusField#setImage(Image)
*/
@@ -287,7 +287,7 @@ public class StatusLineContributionItem extends ContributionItem implements ISta
/**
* Escapes '&' with '&' in the given text.
- *
+ *
* @param text the text to escape
* @return the escaped string
* @since 3.4
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java
index aa8f368d9b9..44ebe693268 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusTextEditor.java
@@ -88,7 +88,7 @@ public class StatusTextEditor extends AbstractTextEditor {
updateStatusFields();
}
}
-
+
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#validateEditorInputState()
* @since 3.3
@@ -131,7 +131,7 @@ public class StatusTextEditor extends AbstractTextEditor {
/**
* Helper to get rid of deprecation warnings.
- *
+ *
* @param parent the parent
* @param status the status
* @return the control
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextOperationAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextOperationAction.java
index 7b3aca4898a..b2b44363c3b 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextOperationAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextOperationAction.java
@@ -142,7 +142,7 @@ public final class TextOperationAction extends TextEditorAction {
public void update() {
if (!fAllowUpdate)
return;
-
+
super.update();
if (!fRunsOnReadOnly && !canModifyEditor()) {
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextSelectionNavigationLocation.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextSelectionNavigationLocation.java
index 3c490273b65..09aeb81b3f9 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextSelectionNavigationLocation.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextSelectionNavigationLocation.java
@@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.ui.texteditor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DefaultPositionUpdater;
@@ -17,8 +20,6 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IPositionUpdater;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.Position;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IMemento;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextViewerDeleteLineTarget.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextViewerDeleteLineTarget.java
index 3939b4c4c2f..9f1057d04c0 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextViewerDeleteLineTarget.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/TextViewerDeleteLineTarget.java
@@ -44,7 +44,7 @@ import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
/**
* A delete line target.
- *
+ *
* @since 3.4
*/
public class TextViewerDeleteLineTarget implements IDeleteLineTarget {
@@ -256,7 +256,7 @@ public class TextViewerDeleteLineTarget implements IDeleteLineTarget {
/**
* Returns the document's delete region specified by position and type.
- *
+ *
* @param document the document
* @param offset the offset
* @param length the length
@@ -305,13 +305,13 @@ public class TextViewerDeleteLineTarget implements IDeleteLineTarget {
default:
throw new IllegalArgumentException();
}
-
+
return clipToVisibleRegion(resultOffset, resultOffset + resultLength);
}
/**
* Clips the given start and end offset to the visible viewer region.
- *
+ *
* @param startOffset the start offset
* @param endOffset the end offset
* @return the clipped region
@@ -327,7 +327,7 @@ public class TextViewerDeleteLineTarget implements IDeleteLineTarget {
int visibleStart= visibleRegion.getOffset();
int visibleLength= visibleRegion.getLength();
-
+
startOffset= Math.max(startOffset, visibleStart);
endOffset= Math.min(endOffset, visibleStart + visibleLength);
return new Region(startOffset, endOffset - startOffset);
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ValidateStateException.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ValidateStateException.java
index ebb2e6c1377..71efe868d42 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ValidateStateException.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ValidateStateException.java
@@ -20,7 +20,7 @@ import org.eclipse.core.runtime.IStatus;
* <p>
* This class is not intended to be serialized.
* </p>
- *
+ *
* @deprecated No longer used, create a {@link CoreException} instead
* @since 2.1
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/WorkbenchChainedTextFontFieldEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/WorkbenchChainedTextFontFieldEditor.java
index 8a33eadf1a7..015ef42c19d 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/WorkbenchChainedTextFontFieldEditor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/WorkbenchChainedTextFontFieldEditor.java
@@ -20,6 +20,7 @@ import org.eclipse.core.runtime.Plugin;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.JFaceResources;
+
import org.eclipse.jface.text.PropagatingFontFieldEditor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiff.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiff.java
index 10a18e4bfcf..57146ee777c 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiff.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiff.java
@@ -22,6 +22,7 @@ import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
import org.eclipse.ui.internal.texteditor.quickdiff.DocumentLineDiffer;
import org.eclipse.ui.internal.texteditor.quickdiff.QuickDiffExtensionsRegistry;
+
import org.eclipse.ui.texteditor.ITextEditor;
/**
@@ -105,7 +106,7 @@ public class QuickDiff {
}
}
}
-
+
for (ListIterator iter= descs.listIterator(descs.size()); iter.hasPrevious();) {
ReferenceProviderDescriptor desc= (ReferenceProviderDescriptor) iter.previous();
IQuickDiffReferenceProvider provider= desc.createProvider();
@@ -143,7 +144,7 @@ public class QuickDiff {
* Returns the identifier of the quick diff provider installed with the given diff annotation
* model, or the empty string if it is not a diff annotation model or has no configured diff
* provider.
- *
+ *
* @param differ a diff annotation model
* @return the reference provider id, or the empty string for none
* @since 3.2
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiffToggleAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiffToggleAction.java
index 27dcf3a2ebd..1510231459e 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiffToggleAction.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/quickdiff/QuickDiffToggleAction.java
@@ -24,11 +24,6 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorExtension;
-import org.eclipse.ui.texteditor.ITextEditorExtension3;
-import org.eclipse.ui.texteditor.IUpdate;
-
import org.eclipse.ui.internal.texteditor.quickdiff.QuickDiffMessages;
import org.eclipse.ui.internal.texteditor.quickdiff.QuickDiffRestoreAction;
import org.eclipse.ui.internal.texteditor.quickdiff.ReferenceSelectionAction;
@@ -37,6 +32,11 @@ import org.eclipse.ui.internal.texteditor.quickdiff.RevertBlockAction;
import org.eclipse.ui.internal.texteditor.quickdiff.RevertLineAction;
import org.eclipse.ui.internal.texteditor.quickdiff.RevertSelectionAction;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorExtension;
+import org.eclipse.ui.texteditor.ITextEditorExtension3;
+import org.eclipse.ui.texteditor.IUpdate;
+
/**
* Action to toggle the line number bar's quick diff display. When turned on, quick diff shows
* the changes relative to the saved version of the file.
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/AbstractContributedRulerColumn.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/AbstractContributedRulerColumn.java
index 5b81630ff85..43eaabb9096 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/AbstractContributedRulerColumn.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/AbstractContributedRulerColumn.java
@@ -22,7 +22,7 @@ import org.eclipse.ui.texteditor.ITextEditor;
* <p>
* Subclasses must have a zero-argument constructor so that they can be created by
* {@link IConfigurationElement#createExecutableExtension(String)}.</p>
- *
+ *
* @since 3.3
*/
public abstract class AbstractContributedRulerColumn implements IContributedRulerColumn {
@@ -31,7 +31,7 @@ public abstract class AbstractContributedRulerColumn implements IContributedRule
/** The target editor. */
private ITextEditor fEditor;
-
+
/*
* @see org.eclipse.ui.texteditor.rulers.IContributedRulerColumn#getDescriptor()
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/IColumnSupport.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/IColumnSupport.java
index 4765c88e007..0efcf35ed8d 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/IColumnSupport.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/IColumnSupport.java
@@ -17,7 +17,7 @@ package org.eclipse.ui.texteditor.rulers;
* <p>
* This interface must not be implemented by clients.
* </p>
- *
+ *
* @since 3.3
* @noimplement This interface is not intended to be implemented by clients.
*/
@@ -26,7 +26,7 @@ public interface IColumnSupport {
/**
* Returns <code>true</code> if the column described by <code>descriptor</code> is
* currently showing, <code>false</code> if not.
- *
+ *
* @param descriptor the column descriptor
* @return <code>true</code> if the specified column is currently visible
*/
@@ -36,7 +36,7 @@ public interface IColumnSupport {
* Attempts to set the visibility of the column described by <code>descriptor</code>. Nothing
* happens if the visibility is already as requested, or if the column is not supported by the
* editor.
- *
+ *
* @param descriptor the column descriptor
* @param visible <code>true</code> to show the column, <code>false</code> to hide it
*/
@@ -47,7 +47,7 @@ public interface IColumnSupport {
* supported by the receiver's editor, <code>false</code> if <code>id</code> is not the
* identifier of a known column contribution, if the column does not target the editor, or if
* the editor does not support contributed columns.
- *
+ *
* @param descriptor the column descriptor
* @return <code>true</code> if the specified column is supported
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/IContributedRulerColumn.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/IContributedRulerColumn.java
index 692ed60f67f..907c670cfa7 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/IContributedRulerColumn.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/IContributedRulerColumn.java
@@ -24,14 +24,14 @@ import org.eclipse.ui.texteditor.ITextEditor;
* <p>
* Implementors must have a zero-argument constructor so that they can be created
* by {@link IConfigurationElement#createExecutableExtension(String)}.</p>
- *
+ *
* @since 3.3
*/
public interface IContributedRulerColumn extends IVerticalRulerColumn {
/**
* Returns the extension point descriptor of this ruler.
- *
+ *
* @return descriptor the extension point descriptor of this ruler or <code>null</code> if called before {@link #columnCreated()}
*/
RulerColumnDescriptor getDescriptor();
@@ -41,7 +41,7 @@ public interface IContributedRulerColumn extends IVerticalRulerColumn {
* <p>
* <em>This method will be called by the framework and must not
* be called by clients.</em></p>
- *
+ *
* @param descriptor the extension point descriptor
*/
void setDescriptor(RulerColumnDescriptor descriptor);
@@ -51,14 +51,14 @@ public interface IContributedRulerColumn extends IVerticalRulerColumn {
* <p>
* <em>This method will be called by the framework and must not
* be called by clients.</em></p>
- *
+ *
* @param editor the editor targeted by this ruler instance
*/
void setEditor(ITextEditor editor);
/**
* Returns the editor targeted by this ruler instance.
- *
+ *
* @return the editor targeted by this ruler instance or <code>null</code> if called before {@link #columnCreated()}
*/
ITextEditor getEditor();
@@ -81,7 +81,7 @@ public interface IContributedRulerColumn extends IVerticalRulerColumn {
/**
* Hook method called after a column has been removed from the {@link org.eclipse.jface.text.source.CompositeRuler}.
* <p>
- * This happens when
+ * This happens when
* <ul>
* <li>the column is hidden by the user or programmatically</li>
* <li>the editor is closed</li>
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnDescriptor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnDescriptor.java
index 63814bf62bd..50726fb6102 100755
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnDescriptor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnDescriptor.java
@@ -26,6 +26,7 @@ import org.eclipse.ui.internal.texteditor.rulers.ExtensionPointHelper;
import org.eclipse.ui.internal.texteditor.rulers.RulerColumnMessages;
import org.eclipse.ui.internal.texteditor.rulers.RulerColumnPlacement;
import org.eclipse.ui.internal.texteditor.rulers.RulerColumnTarget;
+
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.IDocumentProviderExtension4;
import org.eclipse.ui.texteditor.ITextEditor;
@@ -35,7 +36,7 @@ import org.eclipse.ui.texteditor.ITextEditor;
* The description of an extension to the
* <code>org.eclipse.ui.workbench.texteditor.rulerColumns</code> extension point. Instances are
* immutable. Instances can be obtained from a {@link RulerColumnRegistry}.
- *
+ *
* @since 3.3
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@@ -84,7 +85,7 @@ public final class RulerColumnDescriptor {
/**
* Creates a new descriptor.
- *
+ *
* @param element the configuration element to read
* @param registry the computer registry creating this descriptor
* @throws InvalidRegistryObjectException if the configuration element is no longer valid
@@ -162,7 +163,7 @@ public final class RulerColumnDescriptor {
/**
* Returns the name of the described extension.
- *
+ *
* @return the name of the described extension
*/
public String getName() {
@@ -172,7 +173,7 @@ public final class RulerColumnDescriptor {
/**
* Returns the image descriptor of the described extension, <code>null</code> if it does not
* have an image.
- *
+ *
* @return the image descriptor of the described extension or <code>null</code> for no image
*/
public ImageDescriptor getIcon() {
@@ -190,7 +191,7 @@ public final class RulerColumnDescriptor {
/**
* Returns the default enablement of the described extension. Editors that support this
* contribution should typically enable the column by default.
- *
+ *
* @return the default enablement of the described extension
*/
public boolean getDefaultEnablement() {
@@ -202,7 +203,7 @@ public final class RulerColumnDescriptor {
* with the global property set to <code>true</code> should typically affect all matching
* editors. Changing the visibility of a column with the global property set to
* <code>false</code> should only affect the current editor.
- *
+ *
* @return the global property of the described extension
*/
public boolean isGlobal() {
@@ -212,7 +213,7 @@ public final class RulerColumnDescriptor {
/**
* Returns the menu inclusion property of the described extension. A toggle menu entry should be
* inluded in the ruler context menu for columns with this property set to <code>true</code>.
- *
+ *
* @return the menu inclusion property of the described extension
*/
public boolean isIncludedInMenu() {
@@ -221,7 +222,7 @@ public final class RulerColumnDescriptor {
/**
* Returns <code>true</code> if this contribution matches the passed editor, <code>false</code> if not.
- *
+ *
* @param editor the editor to check
* @return <code>true</code> if this contribution targets the passed editor
*/
@@ -232,7 +233,7 @@ public final class RulerColumnDescriptor {
IWorkbenchPartSite site= editor.getSite();
if (site != null && target.matchesEditorId(site.getId()))
return true;
-
+
if (target.matchesClass(editor.getClass()))
return true;
@@ -243,7 +244,7 @@ public final class RulerColumnDescriptor {
/**
* Creates a {@link IContributedRulerColumn} instance as described by the receiver. This may load the contributing plug-in.
- *
+ *
* @param editor the editor that loads the contributed column
* @return the instantiated column
* @throws CoreException as thrown by {@link IConfigurationElement#createExecutableExtension(String)}
@@ -302,7 +303,7 @@ public final class RulerColumnDescriptor {
/**
* Returns the content type of the editor's input, <code>null</code> if the editor input or
* the document provider is <code>null</code> or the content type cannot be determined.
- *
+ *
* @param editor the editor to get the content type from
* @return the content type of the editor's input, <code>null</code> if it cannot be
* determined
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnPreferenceAdapter.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnPreferenceAdapter.java
index 5c11e343407..0762ede8cec 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnPreferenceAdapter.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnPreferenceAdapter.java
@@ -15,11 +15,12 @@ import java.util.Set;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.preference.IPreferenceStore;
+
import org.eclipse.ui.internal.texteditor.rulers.StringSetSerializer;
/**
* Manages the preferences for ruler contributions stored in a preference store.
- *
+ *
* @since 3.3
*/
public final class RulerColumnPreferenceAdapter {
@@ -29,7 +30,7 @@ public final class RulerColumnPreferenceAdapter {
/**
* Creates a new preference adapter that will read and write under the specified key in the
* given preference store.
- *
+ *
* @param store the preference store
* @param key the key
*/
@@ -39,10 +40,10 @@ public final class RulerColumnPreferenceAdapter {
fStore= store;
fKey= key;
}
-
+
/**
* Returns the enablement state of the given ruler contribution.
- *
+ *
* @param descriptor a ruler contribution descriptor
* @return <code>true</code> if the ruler is enabled, <code>false</code> otherwise
*/
@@ -51,10 +52,10 @@ public final class RulerColumnPreferenceAdapter {
String preference= fStore.getString(fKey);
return StringSetSerializer.deserialize(preference).contains(descriptor.getId()) ^ descriptor.getDefaultEnablement();
}
-
+
/**
* Sets the enablement state of the given ruler contribution.
- *
+ *
* @param descriptor a ruler contribution descriptor
* @param enabled <code>true</code> to enable the contribution, <code>false</code> to
* disable it
@@ -74,10 +75,10 @@ public final class RulerColumnPreferenceAdapter {
fStore.setValue(fKey, StringSetSerializer.serialize(marked));
}
}
-
+
/**
* Toggles the enablement state of given the ruler contribution.
- *
+ *
* @param descriptor a ruler contribution descriptor
*/
public void toggle(RulerColumnDescriptor descriptor) {
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnRegistry.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnRegistry.java
index 108bedaae5d..bd92717cf7a 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnRegistry.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/rulers/RulerColumnRegistry.java
@@ -37,13 +37,14 @@ import org.eclipse.ui.internal.texteditor.rulers.DAG;
import org.eclipse.ui.internal.texteditor.rulers.ExtensionPointHelper;
import org.eclipse.ui.internal.texteditor.rulers.RulerColumnMessages;
import org.eclipse.ui.internal.texteditor.rulers.RulerColumnPlacementConstraint;
+
import org.eclipse.ui.texteditor.ConfigurationElementSorter;
/**
* A registry for all extensions to the
* <code>rulerColumns</code> extension point.
- *
+ *
* @since 3.3
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@@ -51,26 +52,26 @@ public final class RulerColumnRegistry {
private static final String EXTENSION_POINT= "rulerColumns"; //$NON-NLS-1$
private static final String QUALIFIED_EXTENSION_POINT= TextEditorPlugin.PLUGIN_ID + '.' + EXTENSION_POINT;
-
+
/** The singleton instance. */
private static RulerColumnRegistry fgSingleton= null;
-
+
/**
* Returns the default computer registry.
* <p>
* TODO keep this or add some other singleton, e.g. TextEditorPlugin?
* </p>
- *
+ *
* @return the singleton instance
*/
public static synchronized RulerColumnRegistry getDefault() {
if (fgSingleton == null) {
fgSingleton= new RulerColumnRegistry();
}
-
+
return fgSingleton;
}
-
+
/**
* All descriptors (element type:
* {@link RulerColumnDescriptor}).
@@ -80,7 +81,7 @@ public final class RulerColumnRegistry {
* All descriptors by id (element type: {@link RulerColumnDescriptor}).
*/
private Map fDescriptorMap= null;
-
+
/**
* <code>true</code> if this registry has been loaded.
*/
@@ -100,7 +101,7 @@ public final class RulerColumnRegistry {
* The returned list is unmodifiable and guaranteed to never change. Note that the set of
* descriptors may change over time due to dynamic plug-in removal or addition.
* </p>
- *
+ *
* @return the sorted list of extensions to the <code>rulerColumns</code> extension point
* (element type: {@link RulerColumnDescriptor})
*/
@@ -108,11 +109,11 @@ public final class RulerColumnRegistry {
ensureExtensionPointRead();
return fDescriptors;
}
-
+
/**
* Returns the {@link RulerColumnDescriptor} with the given identity, <code>null</code> if no
* such descriptor exists.
- *
+ *
* @param id the identity of the ruler contribution as given in the extension point xml.
* @return the {@link RulerColumnDescriptor} with the given identity, <code>null</code> if no
* such descriptor exists
@@ -147,10 +148,10 @@ public final class RulerColumnRegistry {
public void reload() {
IExtensionRegistry registry= Platform.getExtensionRegistry();
List elements= new ArrayList(Arrays.asList(registry.getConfigurationElementsFor(TextEditorPlugin.PLUGIN_ID, EXTENSION_POINT)));
-
+
List descriptors= new ArrayList();
Map descriptorMap= new HashMap();
-
+
for (Iterator iter= elements.iterator(); iter.hasNext();) {
IConfigurationElement element= (IConfigurationElement) iter.next();
try {
@@ -160,7 +161,7 @@ public final class RulerColumnRegistry {
noteDuplicateId(desc);
continue;
}
-
+
descriptors.add(desc);
descriptorMap.put(id, desc);
} catch (InvalidRegistryObjectException x) {
@@ -174,9 +175,9 @@ public final class RulerColumnRegistry {
warnUser(x.getStatus());
}
}
-
+
sort(descriptors);
-
+
synchronized (this) {
fDescriptors= Collections.unmodifiableList(descriptors);
fDescriptorMap= Collections.unmodifiableMap(descriptorMap);
@@ -185,7 +186,7 @@ public final class RulerColumnRegistry {
/**
* Sorts the column contributions.
- *
+ *
* @param descriptors the descriptors to sort
*/
private void sort(List descriptors) {
@@ -202,18 +203,18 @@ public final class RulerColumnRegistry {
};
Object[] array= descriptors.toArray();
sorter.sort(array);
-
+
Map descriptorsById= new HashMap();
for (int i= 0; i < array.length; i++) {
RulerColumnDescriptor desc= (RulerColumnDescriptor) array[i];
descriptorsById.put(desc.getId(), desc);
}
-
+
DAG dag= new DAG();
for (int i= 0; i < array.length; i++) {
RulerColumnDescriptor desc= (RulerColumnDescriptor) array[i];
dag.addVertex(desc);
-
+
Set before= desc.getPlacement().getConstraints();
for (Iterator it= before.iterator(); it.hasNext();) {
RulerColumnPlacementConstraint constraint= (RulerColumnPlacementConstraint) it.next();
@@ -232,7 +233,7 @@ public final class RulerColumnRegistry {
}
}
}
-
+
Comparator gravityComp= new Comparator() {
public int compare(Object o1, Object o2) {
float diff= ((RulerColumnDescriptor) o1).getPlacement().getGravity() - ((RulerColumnDescriptor) o2).getPlacement().getGravity();
@@ -243,7 +244,7 @@ public final class RulerColumnRegistry {
return 1;
}
};
-
+
/* Topological sort - always select the source with the least gravity */
Set toProcess= dag.getSources();
int index= 0;
@@ -255,7 +256,7 @@ public final class RulerColumnRegistry {
toProcess= dag.getSources();
}
Assert.isTrue(index == array.length);
-
+
ListIterator it= descriptors.listIterator();
for (int i= 0; i < index; i++) {
it.next();
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingAnnotation.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingAnnotation.java
index ca980bb8ef1..fe09e8f649b 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingAnnotation.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingAnnotation.java
@@ -15,21 +15,21 @@ import org.eclipse.jface.text.source.Annotation;
/**
* Spelling annotation.
- *
+ *
* @since 3.3
*/
public class SpellingAnnotation extends Annotation implements IQuickFixableAnnotation {
/** The spelling annotation type. */
public static final String TYPE= "org.eclipse.ui.workbench.texteditor.spelling"; //$NON-NLS-1$
-
+
/** The spelling problem. */
private SpellingProblem fSpellingProblem;
-
+
/**
* Creates a new spelling annotation.
- *
+ *
* @param problem the spelling problem.
*/
public SpellingAnnotation(SpellingProblem problem) {
@@ -60,11 +60,11 @@ public class SpellingAnnotation extends Annotation implements IQuickFixableAnnot
/**
* Returns the spelling problem.
- *
+ *
* @return the spelling problem
*/
public SpellingProblem getSpellingProblem() {
return fSpellingProblem;
}
-
+
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingCorrectionProcessor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingCorrectionProcessor.java
index b5b454ace6e..6b715403877 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingCorrectionProcessor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingCorrectionProcessor.java
@@ -34,10 +34,10 @@ import org.eclipse.ui.internal.texteditor.spelling.NoCompletionsProposal;
* @since 3.3
*/
public final class SpellingCorrectionProcessor implements IQuickAssistProcessor {
-
+
private static final ICompletionProposal[] fgNoSuggestionsProposal= new ICompletionProposal[] { new NoCompletionsProposal() };
-
+
/*
* @see IContentAssistProcessor#computeCompletionProposals(ITextViewer, int)
@@ -91,7 +91,7 @@ public final class SpellingCorrectionProcessor implements IQuickAssistProcessor
List proposals= new ArrayList();
for (int i= 0; i < spellingProblems.length; i++)
proposals.addAll(Arrays.asList(spellingProblems[i].getProposals(context)));
-
+
return proposals;
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingEngineDescriptor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingEngineDescriptor.java
index 9052e060fe5..fd085f1a2c3 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingEngineDescriptor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingEngineDescriptor.java
@@ -17,7 +17,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
-
import org.eclipse.ui.internal.texteditor.spelling.EmptySpellingPreferenceBlock;
/**
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingProblem.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingProblem.java
index 7f049b4fd94..f754e78ab03 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingProblem.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingProblem.java
@@ -27,6 +27,7 @@ import org.eclipse.jface.text.source.IAnnotationModelExtension;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.ui.IEditorInput;
+
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
@@ -54,7 +55,7 @@ public abstract class SpellingProblem {
* down to Platform Text we need to provide the proposals with
* a way to access the annotation model.</em>
* </p>
- *
+ *
* @param editor the text editor, if <code>null</code> this method does nothing
* @param word the word for which to remove the problems or <code>null</code> to remove all
* @since 3.3
@@ -63,23 +64,23 @@ public abstract class SpellingProblem {
public static void removeAllInActiveEditor(ITextEditor editor, String word) {
if (editor == null)
return;
-
+
IDocumentProvider documentProvider= editor.getDocumentProvider();
if (documentProvider == null)
return;
-
+
IEditorInput editorInput= editor.getEditorInput();
if (editorInput == null)
return;
-
+
IAnnotationModel model= documentProvider.getAnnotationModel(editorInput);
if (model == null)
return;
-
+
IDocument document= documentProvider.getDocument(editorInput);
if (document == null)
return;
-
+
boolean supportsBatchReplace= (model instanceof IAnnotationModelExtension);
List toBeRemovedAnnotations= new ArrayList();
Iterator iter= model.getAnnotationIterator();
@@ -107,32 +108,32 @@ public abstract class SpellingProblem {
}
}
}
-
+
if (supportsBatchReplace && !toBeRemovedAnnotations.isEmpty()) {
Annotation[] annotationArray= (Annotation[])toBeRemovedAnnotations.toArray(new Annotation[toBeRemovedAnnotations.size()]);
((IAnnotationModelExtension)model).replaceAnnotations(annotationArray, null);
}
}
-
+
/**
* Removes all spelling problems that are reported
* for the given <code>word</code> in the active editor.
- *
+ *
* @param sourceViewer the source viewer
* @param word the word for which to remove the problems or <code>null</code> to remove all
* @since 3.4
*/
public static void removeAll(ISourceViewer sourceViewer, String word) {
Assert.isNotNull(sourceViewer);
-
+
IAnnotationModel model= sourceViewer.getAnnotationModel();
if (model == null)
return;
-
+
IDocument document= sourceViewer.getDocument();
if (document == null)
return;
-
+
boolean supportsBatchReplace= (model instanceof IAnnotationModelExtension);
List toBeRemovedAnnotations= new ArrayList();
Iterator iter= model.getAnnotationIterator();
@@ -160,7 +161,7 @@ public abstract class SpellingProblem {
}
}
}
-
+
if (supportsBatchReplace && !toBeRemovedAnnotations.isEmpty()) {
Annotation[] annotationArray= (Annotation[])toBeRemovedAnnotations.toArray(new Annotation[toBeRemovedAnnotations.size()]);
((IAnnotationModelExtension)model).replaceAnnotations(annotationArray, null);
@@ -194,10 +195,10 @@ public abstract class SpellingProblem {
* @return the proposals for the incorrectly spelled region
*/
public abstract ICompletionProposal[] getProposals();
-
+
/**
* Returns the proposals for the incorrectly spelled region.
- *
+ *
* @param context the invocation context or <code>null</code> if none
* @return the proposals for the incorrectly spelled region
* @since 3.4
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingReconcileStrategy.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingReconcileStrategy.java
index cb25278ee9e..e450ab42c28 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingReconcileStrategy.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/spelling/SpellingReconcileStrategy.java
@@ -39,12 +39,12 @@ import org.eclipse.jface.text.source.ISourceViewer;
/**
* Reconcile strategy used for spell checking.
- *
+ *
* @since 3.3
*/
public class SpellingReconcileStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension {
-
+
/**
* Spelling problem collector.
*/
@@ -55,7 +55,7 @@ public class SpellingReconcileStrategy implements IReconcilingStrategy, IReconci
/** Annotations to add. */
private Map fAddAnnotations;
-
+
/** Lock object for modifying the annotations. */
private Object fLockObject;
@@ -91,9 +91,9 @@ public class SpellingReconcileStrategy implements IReconcilingStrategy, IReconci
* @see org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector#endCollecting()
*/
public void endCollecting() {
-
+
List toRemove= new ArrayList();
-
+
synchronized (fLockObject) {
Iterator iter= fAnnotationModel.getAnnotationIterator();
while (iter.hasNext()) {
@@ -119,7 +119,7 @@ public class SpellingReconcileStrategy implements IReconcilingStrategy, IReconci
}
}
-
+
/** Text content type */
private static final IContentType TEXT_CONTENT_TYPE= Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
@@ -133,22 +133,22 @@ public class SpellingReconcileStrategy implements IReconcilingStrategy, IReconci
private IProgressMonitor fProgressMonitor;
private SpellingService fSpellingService;
-
+
private ISpellingProblemCollector fSpellingProblemCollector;
-
+
/** The spelling context containing the Java source content type. */
private SpellingContext fSpellingContext;
-
+
/**
* Region array, used to prevent us from creating a new array on each reconcile pass.
* @since 3.4
*/
private IRegion[] fRegions= new IRegion[1];
-
-
+
+
/**
* Creates a new comment reconcile strategy.
- *
+ *
* @param viewer the source viewer
* @param spellingService the spelling service to use
*/
@@ -180,7 +180,7 @@ public class SpellingReconcileStrategy implements IReconcilingStrategy, IReconci
subRegion= startLineInfo;
else
subRegion= new Region(startLineInfo.getOffset(), endLineInfo.getOffset() + Math.max(0, endLineInfo.getLength() - 1) - startLineInfo.getOffset());
-
+
} catch (BadLocationException e) {
subRegion= new Region(0, fDocument.getLength());
}
@@ -207,10 +207,10 @@ public class SpellingReconcileStrategy implements IReconcilingStrategy, IReconci
protected IContentType getContentType() {
return TEXT_CONTENT_TYPE;
}
-
+
/**
* Returns the document which is spell checked.
- *
+ *
* @return the document
*/
protected final IDocument getDocument() {
@@ -227,7 +227,7 @@ public class SpellingReconcileStrategy implements IReconcilingStrategy, IReconci
/**
* Creates a new spelling problem collector.
- *
+ *
* @return the collector or <code>null</code> if none is available
*/
protected ISpellingProblemCollector createSpellingProblemCollector() {
@@ -243,7 +243,7 @@ public class SpellingReconcileStrategy implements IReconcilingStrategy, IReconci
public final void setProgressMonitor(IProgressMonitor monitor) {
fProgressMonitor= monitor;
}
-
+
/**
* Returns the annotation model to be used by this reconcile strategy.
*
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/AbstractTemplatesPage.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/AbstractTemplatesPage.java
index bc7195f8c21..dc47f2900fe 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/AbstractTemplatesPage.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/AbstractTemplatesPage.java
@@ -122,7 +122,7 @@ import org.eclipse.ui.texteditor.templates.TemplatePreferencePage.EditTemplateDi
* categories. A link to editor mode on the templates page allows to filtering
* of the categories to only that are supported in this context.
* </p>
- *
+ *
* @since 3.4
*/
public abstract class AbstractTemplatesPage extends Page implements ITemplatesPage {
@@ -176,7 +176,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Check whether an update of the AbstractTemplatesPage is needed
- *
+ *
* @param contextTypes the context types
* @return true if update is needed
*/
@@ -188,7 +188,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Check whether there is any change in the context types needed
- *
+ *
* @param contextTypes the context types
* @return true if any of the context types changed
*/
@@ -201,7 +201,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
}
}
-
+
/**
* Drop support for the editor linked to this page. When a user drops a
* template into the active editor, the template is applied at the drop
@@ -217,14 +217,14 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
event.detail= DND.DROP_COPY;
}
-
+
/*
* @see org.eclipse.swt.dnd.DropTargetAdapter#dragOperationChanged(org.eclipse.swt.dnd.DropTargetEvent)
*/
public void dragOperationChanged(DropTargetEvent event) {
if (!TemplatesTransfer.getInstance().isSupportedType(event.currentDataType))
return;
-
+
event.detail= DND.DROP_COPY;
}
@@ -234,7 +234,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
public void dragOver(DropTargetEvent event) {
if (!TemplatesTransfer.getInstance().isSupportedType(event.currentDataType))
return;
-
+
event.feedback |= DND.FEEDBACK_SCROLL | DND.FEEDBACK_SELECT;
event.detail= DND.DROP_NONE;
TemplatePersistenceData[] selectedTemplates= getSelectedTemplates();
@@ -249,7 +249,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
public void drop(DropTargetEvent event) {
if (!TemplatesTransfer.getInstance().isSupportedType(event.currentDataType))
return;
-
+
TemplatePersistenceData[] selectedTemplates= getSelectedTemplates();
insertTemplate(selectedTemplates[0].getTemplate());
// The highlight of the item is removed once the drop happens -
@@ -259,7 +259,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
}
-
+
/**
* Comparator for the viewer. Sorts the templates by name and then
* description and context types by names.
@@ -267,7 +267,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
private static final class TemplateViewerComparator extends ViewerComparator {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer,
* java.lang.Object, java.lang.Object)
*/
@@ -298,12 +298,12 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
}
}
-
+
/**
* Label provider for templates.
*/
private final class TemplateLabelProvider extends LabelProvider implements ITableLabelProvider {
-
+
/*
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
*/
@@ -345,13 +345,13 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
}
}
-
+
/**
* Content provider for templates. Provides all the enabled templates
* defined for this editor.
*/
private final class TemplatesContentProvider implements ITreeContentProvider {
-
+
/*
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
@@ -396,11 +396,11 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
return false;
else if (parentElement instanceof TemplateContextType) {
String contextId= ((TemplateContextType) parentElement).getId();
-
+
TemplatePersistenceData[] datas= getTemplateStore().getTemplateData(false);
if (datas.length <= 0)
return false;
-
+
for (int i= 0; i < datas.length; i++) {
if (datas[i].isEnabled() && datas[i].getTemplate().getContextTypeId().equals(contextId))
return true;
@@ -440,7 +440,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}
-
+
/** The text editor. */
private final ITextEditor fTextEditor;
@@ -498,10 +498,10 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
private IAction fEditorOldPasteAction;
private IAction fEditorPasteAction;
-
+
/**
* Creates a new templates page.
- *
+ *
* @param editor the editor
* @param viewer the source viewer
*/
@@ -578,7 +578,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Returns the shell in which this page is displayed.
- *
+ *
* @return the shell
*/
private Shell getShell() {
@@ -589,7 +589,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
* Returns the image to be used for the given template.
* <p>
* Clients can override to provide a different image.</p>
- *
+ *
* @param template the template
* @return the image, must not be disposed
*/
@@ -601,7 +601,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
* Creates and opens a dialog to edit the given template.
* <p
* Subclasses may override this method to provide a custom dialog.</p>
- *
+ *
* @param template the template being edited
* @param edit <code>true</code> if the dialog allows editing
* @param isNameModifiable <code>true</code> if the template name may be modified
@@ -619,7 +619,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
* <p>
* Subclasses can extend this method to update their own pattern viewer.
* </p>
- *
+ *
* @param template the template
*/
protected void updatePatternViewer(Template template) {
@@ -632,7 +632,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
* pattern on the templates page.
* <p>
* Clients may override to provide a custom source viewer featuring e.g. syntax coloring.</p>
- *
+ *
* @param parent the parent control
* @return a configured source viewer
*/
@@ -648,7 +648,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Returns the pattern viewer created by createPatternViewer()
- *
+ *
* @return the pattern viewer
*/
protected final SourceViewer getPatternViewer() {
@@ -659,7 +659,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
* The caret position in the editor has moved into a new context type. It is
* the subclasses responsibility to see that this is called only when needed
* by keeping track of editor contents (eg. partitions).
- *
+ *
* @param ids the ids
*/
private void updateContextTypes(String[] ids) {
@@ -670,7 +670,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Inserts the given template into the editor.
- *
+ *
* @param template the template
* @param document the document
*/
@@ -678,14 +678,14 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Returns the context type registry used in this page.
- *
+ *
* @return the context type registry
*/
abstract protected ContextTypeRegistry getContextTypeRegistry();
/**
* Returns the template store used in this page.
- *
+ *
* @return the template store
*/
abstract protected TemplateStore getTemplateStore();
@@ -693,31 +693,31 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Returns the preference store used to create the template store returned by
* {@link AbstractTemplatesPage#getTemplateStore()}.
- *
+ *
* @return the preference store
*/
abstract protected IPreferenceStore getTemplatePreferenceStore();
/**
* Returns the Template preference page id to be used by this template page.
- *
+ *
* @return id the preference page if or <code>null</code> if none exists
*/
abstract protected String getPreferencePageId();
/**
* Returns the context type ids supported at the given document offset.
- *
+ *
* @param document the document
* @param offset the offset
* @return an array of supported context ids
*/
protected abstract String[] getContextTypeIds(IDocument document, int offset);
-
+
/**
* Returns the context type ids supported at the current
* caret position of the editor.
- *
+ *
* @return an array with the the supported context type ids
*/
private String[] getEditorContextTypeIds() {
@@ -730,7 +730,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Checks whether the given template is valid for the document at the given
* offset and length.
- *
+ *
* @param document the document
* @param template the template
* @param offset the offset
@@ -750,7 +750,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Setup the paste operation
- *
+ *
* We get the editors Paste operation and sets up a new operation that
* checks for the clipboard contents for {@link TemplatesTransfer} data.
*/
@@ -776,7 +776,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Convert the clipboard contents into a template
- *
+ *
* @param clipboard the clipboard
* @return the template or null if contents are not valid
*/
@@ -961,7 +961,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Inserts the given template into the editor.
- *
+ *
* @param template the template
*/
private void insertTemplate(Template template) {
@@ -971,7 +971,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Fill the toolbar.
- *
+ *
* @param actionBars the action bars
*/
private void fillToolbar(IActionBars actionBars) {
@@ -989,7 +989,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Fill the view menu.
- *
+ *
* @param actionBars the action bars
*/
private void fillMenu(IActionBars actionBars) {
@@ -1005,7 +1005,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Fill the context menu items.
- *
+ *
* @param manager the menu manager
*/
private void fillContextMenu(IMenuManager manager) {
@@ -1023,7 +1023,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Create the tree to display templates.
- *
+ *
* @param parent the parent composite
*/
private void createTemplateTree(Composite parent) {
@@ -1079,7 +1079,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Create the tree viewer and setup the providers.
- *
+ *
* @param templatesTree the tree used to show the templates
*/
private void createTreeViewer(Tree templatesTree) {
@@ -1109,7 +1109,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Setup the pattern viewer.
- *
+ *
* @param parent the parent composite
*/
private void createPatternForm(Composite parent) {
@@ -1152,7 +1152,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Check whether the template is valid for the given drop location.
- *
+ *
* @param template the template
* @param location the drop location
* @return <code>true</code> if the template is valid
@@ -1230,7 +1230,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Returns the currently selected templates
- *
+ *
* @return selected templates
*/
private TemplatePersistenceData[] getSelectedTemplates() {
@@ -1251,7 +1251,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Returns the context type id of the selected template.
- *
+ *
* @return the context type id of the selected template or the first from the
* registry if no templates are selected
*/
@@ -1283,7 +1283,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Returns the context id for the given item which is either a template or a context type.
- *
+ *
* @param item the item
* @return the context type id
*/
@@ -1298,7 +1298,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Add a template. The dialog is filled with the values from the given template.
- *
+ *
* @param template the template
*/
private void addTemplate(Template template) {
@@ -1351,10 +1351,10 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Moves the selected template from one context to another.
- *
+ *
* @param templates an array of template data
* @param contextId the contextId
- *
+ *
*/
private void moveTemplates(TemplatePersistenceData[] templates, String contextId) {
for (int i= 0; i < templates.length; i++) {
@@ -1368,10 +1368,10 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Copy the selected templates to another context
- *
+ *
* @param templates an array of template data
* @param contextId the context id
- *
+ *
*/
private void copyTemplates(TemplatePersistenceData[] templates, String contextId) {
TemplatePersistenceData[] newTemplates= new TemplatePersistenceData[templates.length];
@@ -1418,7 +1418,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
DragSourceAdapter dragListener= new DragSourceAdapter() {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.swt.dnd.DragSourceAdapter#dragStart(org.eclipse.swt.dnd.DragSourceEvent)
*/
public void dragStart(DragSourceEvent event) {
@@ -1532,7 +1532,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Create a template name.
- *
+ *
* @return the created template name
*/
private String createTemplateName() {
@@ -1579,7 +1579,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa
/**
* Returns the document relative offset from the text widget relative point
- *
+ *
* @param document the document
* @param textWidget the text widget
* @param point the point for which to get the offset
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/ColumnLayout.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/ColumnLayout.java
index c0d78fc4692..0b5b32cf1cc 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/ColumnLayout.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/ColumnLayout.java
@@ -33,11 +33,11 @@ import org.eclipse.jface.viewers.ColumnWeightData;
* <p>
* XXX: Should switch to use {@link org.eclipse.jface.layout.TableColumnLayout}.
* </p>
- *
+ *
* @since 3.2
*/
final class ColumnLayout extends Layout {
-
+
private static final String RECALCULATE_LAYOUT= "recalculateKey"; //$NON-NLS-1$
/**
@@ -49,7 +49,7 @@ final class ColumnLayout extends Layout {
* {@link org.eclipse.jface.layout.TableColumnLayout} or get API from JFace
* or SWT, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=218483
* </p>
- *
+ *
* @since 3.1
*/
private static int COLUMN_TRIM;
@@ -62,7 +62,7 @@ final class ColumnLayout extends Layout {
else
COLUMN_TRIM= 3;
}
-
+
private List columns= new ArrayList();
/**
@@ -73,10 +73,10 @@ final class ColumnLayout extends Layout {
public void addColumnData(ColumnLayoutData data) {
columns.add(data);
}
-
+
private Point computeTableSize(Table table, int wHint, int hHint) {
Point result= table.computeSize(wHint, hHint);
-
+
int width= 0;
int size= columns.size();
for (int i= 0; i < size; ++i) {
@@ -98,7 +98,7 @@ final class ColumnLayout extends Layout {
result.x= width;
return result;
}
-
+
private void layoutTable(final Table table, final int width, final Rectangle area, final boolean increase) {
final TableColumn[] tableColumns= table.getColumns();
final int size= Math.min(columns.size(), tableColumns.length);
@@ -106,7 +106,7 @@ final class ColumnLayout extends Layout {
final int[] weightIteration= new int[size];
int numberOfWeightColumns= 0;
-
+
int fixedWidth= 0;
int minWeightWidth= 0;
int totalWeight= 0;
@@ -133,13 +133,13 @@ final class ColumnLayout extends Layout {
Assert.isTrue(false, "Unknown column layout data"); //$NON-NLS-1$
}
}
-
+
// Do we have columns that have a weight?
final int restIncludingMinWidths= width - fixedWidth;
final int rest= restIncludingMinWidths - minWeightWidth;
if (numberOfWeightColumns > 0 && rest > 0) {
-
+
// Modify the weights to reflect what each column already
// has due to its minimum. Otherwise, columns with low
// minimums get discriminated.
@@ -150,7 +150,7 @@ final class ColumnLayout extends Layout {
wantedPixels[i]= totalWeight == 0 ? 0 : cw.weight * restIncludingMinWidths / totalWeight;
totalWantedPixels+= wantedPixels[i];
}
-
+
// Now distribute the rest to the columns with weight.
int totalDistributed= 0;
for (int i= 0; i < numberOfWeightColumns; ++i) {
@@ -166,7 +166,7 @@ final class ColumnLayout extends Layout {
--diff;
}
}
-
+
if (increase) {
table.setSize(area.width, area.height);
}
@@ -194,10 +194,10 @@ final class ColumnLayout extends Layout {
int tableWidth= table.getSize().x;
int trim= computeTrim(area, table, tableWidth);
int width= Math.max(0, area.width - trim);
-
+
if (width > 1)
layoutTable(table, width, area, tableWidth < area.width);
-
+
if( composite.getData(RECALCULATE_LAYOUT) == null ) {
composite.setData(RECALCULATE_LAYOUT, Boolean.FALSE);
composite.layout();
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/ITemplatesPage.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/ITemplatesPage.java
index 64a5fdc86b7..d9e784ab1bd 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/ITemplatesPage.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/ITemplatesPage.java
@@ -18,7 +18,7 @@ import org.eclipse.ui.part.IPageBookViewPage;
* for a page within the {@link TemplatesView}.
* <p>
* Clients can either implement this interface directly or subclass the {@link AbstractTemplatesPage}.
- *
+ *
* @see TemplatesView
* @since 3.4
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/MessageLine.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/MessageLine.java
index 79c92c7822d..16d46a4d0be 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/MessageLine.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/MessageLine.java
@@ -10,14 +10,14 @@
*******************************************************************************/
package org.eclipse.ui.texteditor.templates;
-import org.eclipse.core.runtime.IStatus;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.core.runtime.IStatus;
+
import org.eclipse.jface.resource.JFaceColors;
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/StatusInfo.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/StatusInfo.java
index 542e258b9ec..63940d5ecd6 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/StatusInfo.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/StatusInfo.java
@@ -13,7 +13,6 @@ package org.eclipse.ui.texteditor.templates;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
-
import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
/**
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java
index 4efa1f43525..3382e8d7d90 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java
@@ -140,7 +140,7 @@ import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
*/
public abstract class TemplatePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
+
/**
* Dialog to edit a template. Clients will usually instantiate, but
* may also extend.
@@ -330,7 +330,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
}
fContextCombo.addModifyListener(listener);
-
+
fAutoInsertCheckbox= createCheckbox(composite, TemplatesMessages.EditTemplateDialog_autoinsert);
fAutoInsertCheckbox.setSelection(fOriginalTemplate.isAutoInsertable());
}
@@ -382,7 +382,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
applyDialogFont(parent);
return composite;
}
-
+
private void doTextWidgetChanged(Widget w) {
if (w == fNameText) {
fSuppressError= false;
@@ -426,7 +426,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
/**
* Return the grid data for the button.
- *
+ *
* @param button the button
* @return the grid data
*/
@@ -457,14 +457,14 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
Button button= new Button(parent, SWT.CHECK);
button.setText(name);
button.setLayoutData(new GridData());
-
+
return button;
}
-
+
private SourceViewer createEditor(Composite parent, String pattern) {
SourceViewer viewer= createViewer(parent);
viewer.setEditable(true);
-
+
IDocument document= viewer.getDocument();
if (document != null)
document.set(pattern);
@@ -533,14 +533,14 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
handlerService.deactivateHandlers(handlerActivations);
}
});
-
+
Expression expression= new ActiveShellExpression(fPatternEditor.getControl().getShell());
-
+
TextViewerAction action= new TextViewerAction(fPatternEditor, ITextOperationTarget.UNDO);
action.setText(TemplatesMessages.EditTemplateDialog_undo);
fGlobalActions.put(ITextEditorActionConstants.UNDO, action);
handlerActivations.add(handlerService.activateHandler(IWorkbenchActionDefinitionIds.UNDO, new ActionHandler(action), expression));
-
+
action= new TextViewerAction(fPatternEditor, ITextOperationTarget.REDO);
action.setText(TemplatesMessages.EditTemplateDialog_redo);
fGlobalActions.put(ITextEditorActionConstants.REDO, action);
@@ -584,7 +584,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
Menu menu= manager.createContextMenu(text);
text.setMenu(menu);
}
-
+
private void fillContextMenu(IMenuManager menu) {
menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_UNDO));
menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO, (IAction) fGlobalActions.get(ITextEditorActionConstants.UNDO));
@@ -659,11 +659,11 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
public Template getTemplate() {
return fNewTemplate;
}
-
+
/**
* Returns the content assist processor that
* suggests template variables.
- *
+ *
* @return the processor to suggest variables
* @since 3.3
*/
@@ -685,8 +685,8 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
}
}
-
-
+
+
/**
* Label provider for templates.
*/
@@ -827,7 +827,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
data.widthHint= 360;
data.heightHint= convertHeightInCharsToPixels(10);
tableComposite.setLayoutData(data);
-
+
ColumnLayout columnLayout= new ColumnLayout();
tableComposite.setLayout(columnLayout);
Table table= new Table(tableComposite, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
@@ -837,7 +837,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
GC gc= new GC(getShell());
gc.setFont(JFaceResources.getDialogFont());
-
+
TableColumn column1= new TableColumn(table, SWT.NONE);
column1.setText(TemplatesMessages.TemplatePreferencePage_column_name);
int minWidth= computeMinimumColumnWidth(gc, TemplatesMessages.TemplatePreferencePage_column_name);
@@ -859,7 +859,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
minWidth= computeMinimumColumnWidth(gc, TemplatesMessages.TemplatePreferencePage_column_autoinsert);
minWidth= Math.max(minWidth, computeMinimumColumnWidth(gc, TemplatesMessages.TemplatePreferencePage_on));
columnLayout.addColumnData(new ColumnPixelData(minWidth, false, false));
-
+
gc.dispose();
fTableViewer= new CheckboxTableViewer(table);
@@ -995,7 +995,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
updateButtons();
Dialog.applyDialogFont(parent);
innerParent.layout();
-
+
return parent;
}
@@ -1021,7 +1021,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
/**
* Creates a separator between buttons.
- *
+ *
* @param parent the parent composite
* @return a separator
*/
@@ -1035,7 +1035,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
separator.setLayoutData(gd);
return separator;
}
-
+
/**
* Returns whether the formatter preference checkbox should be shown.
@@ -1065,7 +1065,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
label.setLayoutData(data);
SourceViewer viewer= createViewer(parent);
-
+
viewer.setEditable(false);
Cursor arrowCursor= viewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
viewer.getTextWidget().setCursor(arrowCursor);
@@ -1099,7 +1099,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I
/**
* Return the grid data for the button.
- *
+ *
* @param button the button
* @return the grid data
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesPageImages.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesPageImages.java
index f62a3bc7e94..5deb7f5690e 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesPageImages.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesPageImages.java
@@ -28,7 +28,7 @@ import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
/**
* Bundle of the images used by the {@link AbstractTemplatesPage}.
- *
+ *
* @since 3.4
*/
class TemplatesPageImages {
@@ -100,7 +100,7 @@ class TemplatesPageImages {
/**
* Declare an Image in the registry table.
- *
+ *
* @param key the key to use when registering the image
* @param path the path where the image can be found. This path is relative to where this plugin
* class is found (i.e. typically the packages directory)
@@ -118,7 +118,7 @@ class TemplatesPageImages {
/**
* Returns the ImageRegistry.
- *
+ *
* @return image registry
*/
public static ImageRegistry getImageRegistry() {
@@ -132,16 +132,16 @@ class TemplatesPageImages {
* Initialize the image registry by declaring all of the required graphics. This involves
* creating JFace image descriptors describing how to create/find the image should it be needed.
* The image is not actually allocated until requested.
- *
+ *
* Prefix conventions Wizard Banners WIZBAN_ Preference Banners PREF_BAN_ Property Page Banners
* PROPBAN_ Color toolbar CTOOL_ Enable toolbar ETOOL_ Disable toolbar DTOOL_ Local enabled
* toolbar ELCL_ Local Disable toolbar DLCL_ Object large OBJL_ Object small OBJS_ View VIEW_
* Product images PROD_ Misc images MISC_
- *
+ *
* Where are the images? The images (typically gifs) are found in the same location as this
* plugin class. This may mean the same package directory as the package holding this class. The
* images are declared using this.getClass() to ensure they are looked up via this plugin class.
- *
+ *
* @return the image registry
* @see org.eclipse.jface.resource.ImageRegistry
*/
@@ -153,7 +153,7 @@ class TemplatesPageImages {
/**
* Returns the image managed under the given key in this registry.
- *
+ *
* @param key the image's key
* @return the image managed under the given key
*/
@@ -163,7 +163,7 @@ class TemplatesPageImages {
/**
* Returns the image descriptor for the given key in this registry.
- *
+ *
* @param key the image's key
* @return the image descriptor for the given key
*/
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesTransfer.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesTransfer.java
index 30f79b0fae0..8f91261594c 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesTransfer.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesTransfer.java
@@ -22,7 +22,7 @@ import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData;
* <p>
* FIXME: only works inside the same workspace.
* </p>
- *
+ *
* @see AbstractTemplatesPage
* @since 3.4
*/
@@ -34,7 +34,7 @@ class TemplatesTransfer extends ByteArrayTransfer {
private TemplatePersistenceData[] fObject ;
-
+
/**
* Returns the singleton instance of this <code>TemplateTransfer</code> class.
*
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesView.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesView.java
index b8548594e69..622be253f16 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesView.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatesView.java
@@ -34,7 +34,7 @@ import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
* When this view notices an editor being activated, it uses the Eclipse adapter mechanism to get
* its {@link ITemplatesPage}. Hence, editors that want to provide a templates page need to provide
* such an adapter:
- *
+ *
* <pre>
* Object getAdapter() {
* ...
@@ -77,7 +77,7 @@ import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
* <p>
* This class is not intended to be instantiated or subclassed by clients.
* </p>
- *
+ *
* @since 3.4
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@@ -129,7 +129,7 @@ public final class TemplatesView extends PageBookView {
page= (ITemplatesPage)Platform.getAdapterManager().getAdapter(part, ITemplatesPage.class);
if (page == null)
return null; // There is no template page
-
+
initPage(page);
page.createControl(getPageBook());
return new PageRec(part, page);

Back to the top