mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
re-enable action groups when their children become visible
This commit is contained in:
+5
@@ -47,4 +47,9 @@ public class CodeCompletionGroup extends DefaultActionGroup implements DumbAware
|
||||
|
||||
presentation.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disableIfNoVisibleChildren() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,4 +188,8 @@ public abstract class ActionGroup extends AnAction {
|
||||
public boolean hideIfNoVisibleChildren() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean disableIfNoVisibleChildren() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,14 +130,14 @@ public class Utils{
|
||||
if (child instanceof ActionGroup) {
|
||||
ActionGroup actionGroup = (ActionGroup)child;
|
||||
if (actionGroup.isPopup()) { // popup menu has its own presentation
|
||||
// disable group if it contains no visible actions
|
||||
final boolean visibleChildren = hasVisibleChildren(actionGroup, presentationFactory, context, place);
|
||||
if (actionGroup.hideIfNoVisibleChildren() && !visibleChildren) {
|
||||
continue;
|
||||
}
|
||||
if (!actionGroup.canBePerformed(context) && !visibleChildren) {
|
||||
presentation.setEnabled(false);
|
||||
if (actionGroup.disableIfNoVisibleChildren()) {
|
||||
final boolean visibleChildren = hasVisibleChildren(actionGroup, presentationFactory, context, place);
|
||||
if (actionGroup.hideIfNoVisibleChildren() && !visibleChildren) {
|
||||
continue;
|
||||
}
|
||||
presentation.setEnabled(actionGroup.canBePerformed(context) || visibleChildren);
|
||||
}
|
||||
|
||||
list.add(child);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user