Skip to content

Commit c8bb5fc

Browse files
committed
Review points implementation
1 parent 2e548fc commit c8bb5fc

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/SurroundWithBracketsStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public SurroundWithBracketsStrategy(ISourceViewer sourceViewer) {
3838
public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
3939
if (command.text != null && bracketsMap.containsKey(command.text)) {
4040
try {
41-
ITextSelection selection= (ITextSelection) sourceViewer.getSelectionProvider().getSelection();
41+
ITextSelection selection= command.fSelection;
4242
if (selection != null && selection.getLength() > 0) {
4343
String selectedText= document.get(selection.getOffset(), selection.getLength());
4444
String closingBracket= bracketsMap.get(command.text);

bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewerConfiguration.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package org.eclipse.jface.text.source;
1616

1717

18-
import java.util.ArrayList;
1918
import java.util.Arrays;
2019

2120
import org.eclipse.swt.SWT;
@@ -192,11 +191,7 @@ public org.eclipse.jface.text.IAutoIndentStrategy getAutoIndentStrategy(ISourceV
192191
* @since 3.1
193192
*/
194193
public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
195-
196-
IAutoEditStrategy[] autoEditStrategies= new IAutoEditStrategy[] { getAutoIndentStrategy(sourceViewer, contentType) };
197-
ArrayList<IAutoEditStrategy> autoEditStrategiesList= new ArrayList<>(Arrays.asList(autoEditStrategies));
198-
autoEditStrategiesList.add(new SurroundWithBracketsStrategy(sourceViewer));
199-
return autoEditStrategiesList.toArray(new IAutoEditStrategy[0]);
194+
return new IAutoEditStrategy[] { getAutoIndentStrategy(sourceViewer, contentType), new SurroundWithBracketsStrategy(sourceViewer) };
200195
}
201196

202197
/**

0 commit comments

Comments
 (0)