mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[shelf]: EA-76344 change required project data to simple data and handle null cases
This commit is contained in:
+7
-7
@@ -17,7 +17,6 @@ package com.intellij.openapi.vcs.changes.shelf;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
@@ -29,7 +28,7 @@ public class ShowHideRecycledAction extends ToggleAction implements DumbAware {
|
||||
@Override
|
||||
public void update(@NotNull final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
final Project project = getEventProject(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
presentation.setEnabledAndVisible(project != null);
|
||||
if (project != null) {
|
||||
@@ -41,14 +40,15 @@ public class ShowHideRecycledAction extends ToggleAction implements DumbAware {
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
|
||||
final ShelveChangesManager manager = ShelveChangesManager.getInstance(project);
|
||||
return manager.isShowRecycled();
|
||||
final Project project = getEventProject(e);
|
||||
return project != null && ShelveChangesManager.getInstance(project).isShowRecycled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
|
||||
ShelveChangesManager.getInstance(project).setShowRecycled(state);
|
||||
final Project project = getEventProject(e);
|
||||
if (project != null) {
|
||||
ShelveChangesManager.getInstance(project).setShowRecycled(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user