Arrangement: add action should not be available outside of arrangement panel

This commit is contained in:
Svetlana.Zemlyanskaya
2016-03-24 17:47:17 +01:00
parent 6a70531384
commit 0110cdfde9
2 changed files with 7 additions and 0 deletions
@@ -38,6 +38,12 @@ public class AddArrangementRuleAction extends AbstractArrangementRuleAction impl
setEnabledInModalContext(true);
}
@Override
public void update(AnActionEvent e) {
ArrangementMatchingRulesControl control = getRulesControl(e);
e.getPresentation().setEnabled(control != null);
}
@Override
public void actionPerformed(AnActionEvent e) {
ArrangementMatchingRulesControl control = getRulesControl(e);
@@ -39,6 +39,7 @@ public class AddArrangementSectionRuleAction extends AddArrangementRuleAction {
public void update(AnActionEvent e) {
final ArrangementMatchingRulesControl control = getRulesControl(e);
if (control == null || !(control instanceof ArrangementSectionRulesControl)) {
e.getPresentation().setEnabledAndVisible(false);
return;
}
e.getPresentation().setEnabledAndVisible(((ArrangementSectionRulesControl)control).getSectionRuleManager() != null);