mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-117041 Keybinding for reformat code does not work in Changes view
This commit is contained in:
@@ -79,7 +79,7 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
|
||||
final VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
|
||||
|
||||
PsiFile file = null;
|
||||
final PsiDirectory dir;
|
||||
PsiDirectory dir = null;
|
||||
boolean hasSelection = false;
|
||||
|
||||
if (editor != null){
|
||||
@@ -110,6 +110,9 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (files != null && files.length == 1) {
|
||||
file = PsiManager.getInstance(project).findFile(files[0]);
|
||||
}
|
||||
else {
|
||||
Project projectContext = PlatformDataKeys.PROJECT_CONTEXT.getData(dataContext);
|
||||
Module moduleContext = LangDataKeys.MODULE_CONTEXT.getData(dataContext);
|
||||
@@ -144,14 +147,16 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
|
||||
|
||||
final boolean showDialog = EditorSettingsExternalizable.getInstance().getOptions().SHOW_REFORMAT_DIALOG;
|
||||
|
||||
if (file == null && dir != null) {
|
||||
if (file == null && dir == null) return;
|
||||
if (file == null) {
|
||||
DirectoryFormattingOptions options = getDirectoryFormattingOptions(project, dir);
|
||||
if (options != null) {
|
||||
reformatDirectory(project, dir, options);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (showDialog) {
|
||||
|
||||
if (showDialog) {
|
||||
LayoutCodeOptions selectedFlags = getLayoutCodeOptions(project, file, dir, hasSelection);
|
||||
if (selectedFlags == null)
|
||||
return;
|
||||
@@ -168,8 +173,6 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
|
||||
}
|
||||
}
|
||||
|
||||
if (file == null) return;
|
||||
|
||||
if (!showDialog && processChangedTextOnly && isChangeNotTrackedForFile(project, file)) {
|
||||
processChangedTextOnly = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user