mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduce NonTrivialActionGroup
This commit is contained in:
@@ -28,6 +28,9 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* Represents a group of actions.
|
||||
*
|
||||
* @see com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||
* @see com.intellij.openapi.actionSystem.ComputableActionGroup
|
||||
*/
|
||||
public abstract class ActionGroup extends AnAction {
|
||||
private boolean myPopup;
|
||||
|
||||
@@ -15,17 +15,10 @@
|
||||
*/
|
||||
package com.intellij.ide.projectView.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionGroupUtil;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.ide.actions.NonTrivialActionGroup;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class MarkRootGroup extends DefaultActionGroup implements DumbAware {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setVisible(!ActionGroupUtil.isGroupEmpty(this, e));
|
||||
}
|
||||
public class MarkRootGroup extends NonTrivialActionGroup {
|
||||
}
|
||||
|
||||
@@ -35,7 +35,13 @@ import java.util.List;
|
||||
* to implement your own <code>ActionGroup</code>.
|
||||
*
|
||||
* @see Constraints
|
||||
* @see ComputableActionGroup
|
||||
*
|
||||
* @see com.intellij.openapi.actionSystem.ComputableActionGroup
|
||||
*
|
||||
* @see com.intellij.ide.actions.NonEmptyActionGroup
|
||||
* @see com.intellij.ide.actions.NonTrivialActionGroup
|
||||
* @see com.intellij.ide.actions.SmartPopupActionGroup
|
||||
*
|
||||
*/
|
||||
public class DefaultActionGroup extends ActionGroup {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.actionSystem.DefaultActionGroup");
|
||||
|
||||
@@ -20,6 +20,12 @@ import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
|
||||
/**
|
||||
* This group hides itself when there's no registered children.
|
||||
*
|
||||
* @see com.intellij.ide.actions.SmartPopupActionGroup
|
||||
* @see com.intellij.ide.actions.NonTrivialActionGroup
|
||||
*/
|
||||
public class NonEmptyActionGroup extends DefaultActionGroup implements DumbAware {
|
||||
public NonEmptyActionGroup() {
|
||||
super();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionGroupUtil;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
|
||||
/**
|
||||
* This group hides itself when there's no enabled and visible child.
|
||||
*
|
||||
* @see com.intellij.ide.actions.SmartPopupActionGroup
|
||||
* @see com.intellij.ide.actions.NonEmptyActionGroup
|
||||
*
|
||||
* @author gregsh
|
||||
*/
|
||||
public class NonTrivialActionGroup extends DefaultActionGroup implements DumbAware {
|
||||
public NonTrivialActionGroup() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setVisible(!ActionGroupUtil.isGroupEmpty(this, e));
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,10 @@ import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
|
||||
/**
|
||||
* This group turns itself into a popup if there's more than one child.
|
||||
*
|
||||
* @see com.intellij.ide.actions.NonEmptyActionGroup
|
||||
* @see com.intellij.ide.actions.NonTrivialActionGroup
|
||||
* @author yole
|
||||
*/
|
||||
public class SmartPopupActionGroup extends DefaultActionGroup {
|
||||
|
||||
Reference in New Issue
Block a user