if editor has selection, reformat only selected lines, when reformat dialog is not shown. Do not take into account processChangedText flag

This commit is contained in:
Yaroslav Lepenkin
2014-07-10 14:28:46 +04:00
parent 76ed9f7ee8
commit cb79e2e133
@@ -174,7 +174,7 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
}
final TextRange range;
if (!processWholeFile && editor != null && editor.getSelectionModel().hasSelection()){
if (!processWholeFile && hasSelection) {
range = TextRange.create(editor.getSelectionModel().getSelectionStart(), editor.getSelectionModel().getSelectionEnd());
}
else{
@@ -185,7 +185,7 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
new OptimizeImportsProcessor(new ReformatCodeProcessor(project, file, null, processChangedTextOnly)).run();
}
else {
new ReformatCodeProcessor(project, file, range, processChangedTextOnly).run();
new ReformatCodeProcessor(project, file, range, !hasSelection && processChangedTextOnly).run();
}
if (rearrangeEntries && file != null && editor != null) {