diff options
author | Lars Vogel | 2019-06-17 09:19:57 +0000 |
---|---|---|
committer | Lars Vogel | 2019-06-17 09:39:10 +0000 |
commit | 8def8098992f4ea0f6dd016a0d2d5c2c6b7a814f (patch) | |
tree | 5c19ae70a25ec84beba49bdda67e5c69870db69a | |
parent | 925e3c83512b8467fdbfc8ebb45819c82c18be01 (diff) | |
download | eclipse.platform.text-8def8098992f4ea0f6dd016a0d2d5c2c6b7a814f.tar.gz eclipse.platform.text-8def8098992f4ea0f6dd016a0d2d5c2c6b7a814f.tar.xz eclipse.platform.text-8def8098992f4ea0f6dd016a0d2d5c2c6b7a814f.zip |
Remove redundant block
Change-Id: I01d785405a51605a19429bcd9560232530fc51c1
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
6 files changed, 83 insertions, 103 deletions
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 7b8de9855a1..742d8699942 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 @@ -482,21 +482,19 @@ class ContextInformationPopup implements IContentAssistListener { break; } } - { - fContentAssistant.removeContentAssistListener(this, ContentAssistant.CONTEXT_INFO_POPUP); + fContentAssistant.removeContentAssistListener(this, ContentAssistant.CONTEXT_INFO_POPUP); - if (fContentAssistSubjectControlAdapter.getControl() != null) - fContentAssistSubjectControlAdapter.removeSelectionListener(fTextWidgetSelectionListener); - fTextWidgetSelectionListener= null; + if (fContentAssistSubjectControlAdapter.getControl() != null) + fContentAssistSubjectControlAdapter.removeSelectionListener(fTextWidgetSelectionListener); + fTextWidgetSelectionListener= null; - fContextInfoPopup.setVisible(false); - fContextInfoPopup.dispose(); - fContextInfoPopup= null; + fContextInfoPopup.setVisible(false); + fContextInfoPopup.dispose(); + fContextInfoPopup= null; - if (fTextPresentation != null) { - fTextPresentation.clear(); - fTextPresentation= null; - } + if (fTextPresentation != null) { + fTextPresentation.clear(); + fTextPresentation= null; } } 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 9a8c5b1e70a..405b49c2041 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 @@ -159,24 +159,22 @@ public class TemplateProposal implements ICompletionProposal, ICompletionProposa fContext.setReadOnly(false); int start; TemplateBuffer templateBuffer; - { - int oldReplaceOffset= getReplaceOffset(); - try { - // this may already modify the document (e.g. add imports) - templateBuffer= fContext.evaluate(fTemplate); - } catch (TemplateException e1) { - fSelectedRegion= fRegion; - return; - } + int oldReplaceOffset= getReplaceOffset(); + try { + // this may already modify the document (e.g. add imports) + templateBuffer= fContext.evaluate(fTemplate); + } catch (TemplateException e1) { + fSelectedRegion= fRegion; + return; + } - start= getReplaceOffset(); - int shift= start - oldReplaceOffset; - int end= Math.max(getReplaceEndOffset(), offset + shift); + start= getReplaceOffset(); + int shift= start - oldReplaceOffset; + int end= Math.max(getReplaceEndOffset(), offset + shift); - // insert template string - String templateString= templateBuffer.getString(); - document.replace(start, end - start, templateString); - } + // insert template string + String templateString= templateBuffer.getString(); + document.replace(start, end - start, templateString); // translate positions LinkedModeModel model= new LinkedModeModel(); diff --git a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileSearchTests.java b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileSearchTests.java index 887affd314b..51e3c093038 100644 --- a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileSearchTests.java +++ b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileSearchTests.java @@ -311,13 +311,11 @@ public class FileSearchTests { engine.search(scope, collector, searchPattern, null); assertEquals("Number of whole-word results", 10, collector.getNumberOfResults()); } - { - // regexp, whole word = false: match all lines - Pattern searchPattern= PatternConstructor.createPattern("h[eio]ll", true, true, false, false); - collector.reset(); - engine.search(scope, collector, searchPattern, null); - assertEquals("Number of partial-word results", 22, collector.getNumberOfResults()); - } + // regexp, whole word = false: match all lines + Pattern searchPattern= PatternConstructor.createPattern("h[eio]ll", true, true, false, false); + collector.reset(); + engine.search(scope, collector, searchPattern, null); + assertEquals("Number of partial-word results", 22, collector.getNumberOfResults()); } @Test @@ -437,13 +435,11 @@ public class FileSearchTests { engine.search(scope, collector, searchPattern, null); assertEquals(1, collector.getNumberOfResults()); } - { - // visit non-derived in folder3 - TextSearchScope scope= TextSearchScope.newSearchScope(new IResource[] { folder3 }, fileNamePattern, false); - collector.reset(); - engine.search(scope, collector, searchPattern, null); - assertEquals(0, collector.getNumberOfResults()); - } + // visit non-derived in folder3 + TextSearchScope scope= TextSearchScope.newSearchScope(new IResource[] { folder3 }, fileNamePattern, false); + collector.reset(); + engine.search(scope, collector, searchPattern, null); + assertEquals(0, collector.getNumberOfResults()); } @Test 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 575649876b3..3e93d4ec276 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 @@ -1093,23 +1093,21 @@ public class TextEditTests { IDocument document= new Document("foo(1, 2), 3"); MultiTextEdit root= new MultiTextEdit(); - { - CopySourceEdit innerRoot= new CopySourceEdit(0, 9); + CopySourceEdit innerRoot= new CopySourceEdit(0, 9); - TextEdit e1= new ReplaceEdit(0, 9, ""); - e1.addChild(innerRoot); - CopyTargetEdit t1= new CopyTargetEdit(11, innerRoot); + 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); - CopyTargetEdit t2= new CopyTargetEdit(0, s2); + TextEdit e2= new ReplaceEdit(11, 1, ""); + CopySourceEdit s2= new CopySourceEdit(11, 1); + e2.addChild(s2); + CopyTargetEdit t2= new CopyTargetEdit(0, s2); - root.addChild(e1); - root.addChild(t2); - root.addChild(e2); - root.addChild(t1); - } + root.addChild(e1); + root.addChild(t2); + root.addChild(e2); + root.addChild(t1); root.apply(document); @@ -1122,22 +1120,20 @@ public class TextEditTests { 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 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); + 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.addChild(e1); + root.addChild(t2); + root.addChild(e2); + root.addChild(t1); root.apply(document); @@ -1167,21 +1163,19 @@ public class TextEditTests { innerRoot.addChild(t1); } MultiTextEdit root= new MultiTextEdit(); - { - TextEdit e1= new ReplaceEdit(0, 9, ""); - e1.addChild(innerRoot); - CopyTargetEdit t1= new CopyTargetEdit(11, innerRoot); + 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); - CopyTargetEdit t2= new CopyTargetEdit(0, s2); + TextEdit e2= new ReplaceEdit(11, 1, ""); + CopySourceEdit s2= new CopySourceEdit(11, 1); + e2.addChild(s2); + CopyTargetEdit t2= new CopyTargetEdit(0, s2); - root.addChild(e1); - root.addChild(t2); - root.addChild(e2); - root.addChild(t1); - } + root.addChild(e1); + root.addChild(t2); + root.addChild(e2); + root.addChild(t1); root.apply(document); diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/ZoomTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/ZoomTest.java index bd4c2b20e4a..41db9115a94 100644 --- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/ZoomTest.java +++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/ZoomTest.java @@ -96,22 +96,18 @@ public class ZoomTest { @Test public void testZoomCommand() throws Exception { int times = 6; - { - Command zoomInCommand = PlatformUI.getWorkbench().getService(ICommandService.class) - .getCommand("org.eclipse.ui.edit.text.zoomIn"); - for (int i = 0; i < times; i++) { - zoomInCommand.executeWithChecks(new ExecutionEvent(zoomInCommand, Collections.EMPTY_MAP, null, null)); - } - Assert.assertEquals(this.initialFontSize + 12, text.getFont().getFontData()[0].getHeight()); + Command zoomInCommand = PlatformUI.getWorkbench().getService(ICommandService.class) + .getCommand("org.eclipse.ui.edit.text.zoomIn"); + for (int i = 0; i < times; i++) { + zoomInCommand.executeWithChecks(new ExecutionEvent(zoomInCommand, Collections.EMPTY_MAP, null, null)); } - { - Command zoomOutCommand = PlatformUI.getWorkbench().getService(ICommandService.class) - .getCommand("org.eclipse.ui.edit.text.zoomOut"); - for (int i = 0; i < times; i++) { - zoomOutCommand.executeWithChecks(new ExecutionEvent(zoomOutCommand, Collections.EMPTY_MAP, null, null)); - } - Assert.assertEquals(this.initialFontSize, text.getFont().getFontData()[0].getHeight()); + Assert.assertEquals(this.initialFontSize + 12, text.getFont().getFontData()[0].getHeight()); + Command zoomOutCommand = PlatformUI.getWorkbench().getService(ICommandService.class) + .getCommand("org.eclipse.ui.edit.text.zoomOut"); + for (int i = 0; i < times; i++) { + zoomOutCommand.executeWithChecks(new ExecutionEvent(zoomOutCommand, Collections.EMPTY_MAP, null, null)); } + Assert.assertEquals(this.initialFontSize, text.getFont().getFontData()[0].getHeight()); } } 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 aecfa6e5655..beb70b4ec30 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 @@ -6310,14 +6310,12 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit StyledText widget= fSourceViewer.getTextWidget(); widget.setRedraw(false); - { - adjustHighlightRange(revealStart, revealLength); - fSourceViewer.revealRange(revealStart, revealLength); + adjustHighlightRange(revealStart, revealLength); + fSourceViewer.revealRange(revealStart, revealLength); - fSourceViewer.setSelectedRange(selectionStart, selectionLength); + fSourceViewer.setSelectedRange(selectionStart, selectionLength); - markInNavigationHistory(); - } + markInNavigationHistory(); widget.setRedraw(true); } |