diff options
author | Kai Maetzel | 2003-09-23 08:56:34 +0000 |
---|---|---|
committer | Kai Maetzel | 2003-09-23 08:56:34 +0000 |
commit | a42ef2a40a9dfc90dd84247c9ac03cba53c83899 (patch) | |
tree | a7c7dc0b86fef4f35c3c59faee4b06bb247f9cff | |
parent | 86dd083dd4b4e76469978102dd09ee0a0c6c6abc (diff) | |
download | eclipse.platform.text-a42ef2a40a9dfc90dd84247c9ac03cba53c83899.tar.gz eclipse.platform.text-a42ef2a40a9dfc90dd84247c9ac03cba53c83899.tar.xz eclipse.platform.text-a42ef2a40a9dfc90dd84247c9ac03cba53c83899.zip |
bug fixing
-rw-r--r-- | org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java | 118 |
1 files changed, 59 insertions, 59 deletions
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 f8e57ab8b7f..7eeda599c74 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 @@ -620,68 +620,68 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi fSelectionCategory= null; } - /* - * @see ITextOperationTarget#doOperation(int) - */ - public void doOperation(int operation) { - - if (getTextWidget() == null || !redraws()) + /* + * @see ITextOperationTarget#doOperation(int) + */ + public void doOperation(int operation) { + + if (getTextWidget() == null || !redraws()) + return; + + switch (operation) { + case CONTENTASSIST_PROPOSALS: + fContentAssistant.showPossibleCompletions(); return; - - switch (operation) { - case CONTENTASSIST_PROPOSALS: - fContentAssistant.showPossibleCompletions(); - return; - case CONTENTASSIST_CONTEXT_INFORMATION: - fContentAssistant.showContextInformation(); - return; - case INFORMATION: - fInformationPresenter.showInformation(); - return; - case FORMAT : - { - final Point selection= rememberSelection(); - - final IRegion region= new Region(selection.x, selection.y); - final IRewriteTarget target= getRewriteTarget(); - final IFormattingContext context= createFormattingContext(); - - if (selection.y == 0) { - context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.TRUE); - } else { - context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.FALSE); - context.setProperty(FormattingContextProperties.CONTEXT_REGION, region); - } - try { - setRedraw(false); - // startSequentialRewriteMode(false); - target.beginCompoundChange(); - - final IDocument document= getDocument(); - if (fContentFormatter instanceof IContentFormatterExtension2) { - - final IContentFormatterExtension2 extension= (IContentFormatterExtension2)fContentFormatter; - extension.format(document, context); - - } else - fContentFormatter.format(document, region); - - } finally { - target.endCompoundChange(); - - restoreSelection(); - context.dispose(); - - // stopSequentialRewriteMode(); - setRedraw(true); - } - return; + case CONTENTASSIST_CONTEXT_INFORMATION: + fContentAssistant.showContextInformation(); + return; + case INFORMATION: + fInformationPresenter.showInformation(); + return; + case FORMAT : + { + final Point selection= rememberSelection(); + + final IRegion region= new Region(selection.x, selection.y); + final IRewriteTarget target= getRewriteTarget(); + final IFormattingContext context= createFormattingContext(); + + if (selection.y == 0) { + context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.TRUE); + } else { + context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.FALSE); + context.setProperty(FormattingContextProperties.CONTEXT_REGION, region); } - default : - super.doOperation(operation); - } + try { + setRedraw(false); +// startSequentialRewriteMode(false); + target.beginCompoundChange(); + + final IDocument document= getDocument(); + if (fContentFormatter instanceof IContentFormatterExtension2) { + + final IContentFormatterExtension2 extension= (IContentFormatterExtension2)fContentFormatter; + extension.format(document, context); + + } else + fContentFormatter.format(document, region); + + } finally { + target.endCompoundChange(); + + restoreSelection(); + context.dispose(); + +// stopSequentialRewriteMode(); + setRedraw(true); + } + return; + } + default : + super.doOperation(operation); } - + } + /* * @see ITextOperationTargetExtension#enableOperation(int, boolean) * @since 2.0 |