hide rename file for files outside project (EA-69745 - assert: RenameFileAction.actionPerformed)

This commit is contained in:
Anna Kozlova
2015-06-23 12:05:24 +03:00
parent 6fd53851a0
commit 45c5a5f8c7
@@ -43,7 +43,9 @@ public class RenameFileAction extends AnAction implements DumbAware {
PsiFile file = e.getData(CommonDataKeys.PSI_FILE);
Presentation presentation = e.getPresentation();
String place = e.getPlace();
boolean enabled = (file instanceof PsiClassOwner || ActionPlaces.EDITOR_TAB_POPUP.equals(place)) && place != ActionPlaces.EDITOR_POPUP && e.getData(CommonDataKeys.PROJECT) != null;
boolean enabled = file != null &&
(file instanceof PsiClassOwner || ActionPlaces.EDITOR_TAB_POPUP.equals(place)) &&
place != ActionPlaces.EDITOR_POPUP && e.getData(CommonDataKeys.PROJECT) != null;
presentation.setEnabled(enabled);
presentation.setVisible(enabled);
if (enabled) {