当前位置: 首页>>代码示例>>Java>>正文


Java Presentation.isEnabled方法代码示例

本文整理汇总了Java中com.intellij.openapi.actionSystem.Presentation.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Presentation.isEnabled方法的具体用法?Java Presentation.isEnabled怎么用?Java Presentation.isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.actionSystem.Presentation的用法示例。


在下文中一共展示了Presentation.isEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(final AnActionEvent e) {
    super.update(e);

    Presentation presentation = e.getPresentation();
    boolean enabled = presentation.isEnabled();
    boolean selected = false;

    if (enabled) {
        final EditorEx editor = (EditorEx) CommonDataKeys.EDITOR.getData(e.getDataContext());
        if (editor != null) {
            LineSelectionManager manager = LineSelectionManager.getInstance(editor);
            RangeLimitedCaretSpawningHandler spawningHandler = manager.getCaretSpawningHandler();
            if (spawningHandler != null && !spawningHandler.isBackwards()) {
                selected = true;
            }
        }
    }

    presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);

    e.getPresentation().setVisible(!ApplicationSettings.getInstance().isHideDisabledButtons() || e.getPresentation().isEnabled());
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:24,代码来源:ForwardSearchCaretSpawningAction.java

示例2: update

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(final AnActionEvent e) {
    super.update(e);

    Presentation presentation = e.getPresentation();
    boolean enabled = presentation.isEnabled();
    boolean selected = false;

    if (enabled) {
        final EditorEx editor = (EditorEx) CommonDataKeys.EDITOR.getData(e.getDataContext());
        if (editor != null) {
            LineSelectionManager manager = LineSelectionManager.getInstance(editor);
            RangeLimitedCaretSpawningHandler spawningHandler = manager.getCaretSpawningHandler();
            if (spawningHandler != null && spawningHandler.isBackwards()) {
                selected = true;
            }
        }
    }

    presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);

    e.getPresentation().setVisible(!ApplicationSettings.getInstance().isHideDisabledButtons() || e.getPresentation().isEnabled());
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:24,代码来源:BackwardSearchCaretSpawningAction.java

示例3: update

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
    super.update(e);
    final Presentation presentation = e.getPresentation();
    if(presentation.isEnabled()) {
        final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
        final Project project = e.getProject();
        if (view != null && project != null) {
            ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
            PsiDirectory[] dirs = view.getDirectories();
            for (PsiDirectory dir : dirs) {
                if (projectFileIndex.isUnderSourceRootOfType(dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) &&
                        JavaDirectoryService.getInstance().getPackage(dir) != null && isValidForClass(project,dir)) {
                    return;
                }
            }
        }
        presentation.setEnabled(false);
        presentation.setVisible(false);
    }
}
 
开发者ID:wangtotang,项目名称:DaggerHelper,代码行数:22,代码来源:BaseAction.java

示例4: setEnabledForNode

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
/**
 * Sets the enabled/disabled action property depending on the node type and whether the node is executable.
 *
 * @param selectedNodes       Selected nodes in the repository view tree.
 * @param presentation        {@link Presentation}       The specific place in the user interface of the action.
 * @param executableCondition True for nodes that can be executed. False otherwise.
 * @see NodeType
 * @see DefaultMutableTreeNode
 */

private static void setEnabledForNode(final DefaultMutableTreeNode[] selectedNodes, final Presentation presentation,
                                      final boolean executableCondition) {

    if (ArrayUtils.isEmpty(selectedNodes)) {
        presentation.setEnabled(false);
        return;
    }

    boolean currentEnabled = presentation.isEnabled();

    for (DefaultMutableTreeNode selectedNode : selectedNodes) {

        Object userObject = selectedNode.getUserObject();

        currentEnabled = ((Node) userObject).getType() == NodeType.SPECIFICATION;

        if (!currentEnabled || (executableCondition && !((SpecificationNode) userObject).isExecutable())) {
            currentEnabled = false;
            break;
        }
    }

    presentation.setEnabled(currentEnabled);
}
 
开发者ID:testIT-LivingDoc,项目名称:livingdoc-intellij,代码行数:35,代码来源:RepositoryViewUtils.java

示例5: update

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
protected void update(final VcsContext vcsContext, final Presentation presentation) {
  super.update(vcsContext, presentation);
  if (presentation.isVisible() && presentation.isEnabled()) {
    final ChangeList[] selectedChangeLists = vcsContext.getSelectedChangeLists();
    final Change[] selectedChanges = vcsContext.getSelectedChanges();
    if (vcsContext.getPlace().equals(ActionPlaces.CHANGES_VIEW_POPUP)) {
      if (selectedChangeLists != null && selectedChangeLists.length > 0) {
        presentation.setEnabled(selectedChangeLists.length == 1 && !ContainerUtil.isEmpty(selectedChangeLists[0].getChanges()));
      }
      else {
        presentation.setEnabled (selectedChanges != null && selectedChanges.length > 0);
      }
    }
    if (presentation.isEnabled() && selectedChanges != null) {
      final ChangeListManager changeListManager = ChangeListManager.getInstance(vcsContext.getProject());
      for(Change c: selectedChanges) {
        if (c.getFileStatus() == FileStatus.HIJACKED && changeListManager.getChangeList(c) == null) {
          presentation.setEnabled(false);
          break;
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AbstractCommitChangesAction.java

示例6: update

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(final AnActionEvent e) {
  super.update(e);
  final Project project = e.getData(CommonDataKeys.PROJECT);
  final Presentation presentation = e.getPresentation();
  if (presentation.isEnabled()) {
    final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
    if (view != null) {
      final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
      final PsiDirectory[] dirs = view.getDirectories();
      for (final PsiDirectory dir : dirs) {
        if (projectFileIndex.isUnderSourceRootOfType(dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) && JavaDirectoryService.getInstance().getPackage(dir) != null) {
          return;
        }
      }
    }

    presentation.setEnabled(false);
    presentation.setVisible(false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AbstractCreateFormAction.java

示例7: update

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
  final Presentation presentation = e.getPresentation();
  StudyUtils.updateAction(e);
  if (presentation.isEnabled()) {
    updateDescription(e);
    presentation.setEnabled(!myCheckInProgress.get());
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:10,代码来源:StudyCheckAction.java

示例8: executeAction

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public static void executeAction(String actionId, InputEvent e) {
    ActionManager actionManager = ActionManager.getInstance();
    AnAction action = actionManager.getAction(actionId);
    if (action != null) {
        Presentation presentation = new Presentation();
        AnActionEvent event = new AnActionEvent(e, DataManager.getInstance().getDataContext(e.getComponent()), "", presentation, actionManager, 0);
        action.update(event);
        if (presentation.isEnabled()) {
            action.actionPerformed(event);
        }
    }
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:13,代码来源:NavigatorUtil.java

示例9: setEnabledForNodeVersion

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
/**
 * Sets the enabled/disabled action property for the executable nodes that can change their version.
 *
 * @param selectedNodes    Selected nodes in the repository view tree.
 * @param presentation     The specific place in the user interface of the action.
 * @param toCurrentVersion True whether the action changes to current version. False for implemented version.
 */
public static void setEnabledForNodeVersion(final DefaultMutableTreeNode[] selectedNodes,
                                            final Presentation presentation, final boolean toCurrentVersion) {

    setEnabledForExecutableNode(selectedNodes, presentation);

    boolean currentEnabled = presentation.isEnabled();

    if (!currentEnabled) {
        return;
    }

    for (DefaultMutableTreeNode selectedNode : selectedNodes) {

        Object userObject = selectedNode.getUserObject();

        if (userObject instanceof SpecificationNode) {
            SpecificationNode specificationNode = (SpecificationNode) userObject;

            if (!(specificationNode.isCanBeImplemented()
                    && (specificationNode.isUsingCurrentVersion() ^ toCurrentVersion))) {

                currentEnabled = false;
                break;
            }
        }
    }
    presentation.setEnabled(currentEnabled);
}
 
开发者ID:testIT-LivingDoc,项目名称:livingdoc-intellij,代码行数:36,代码来源:RepositoryViewUtils.java

示例10: update

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
protected void update(@NotNull Presentation presentation,
                      @NotNull Project project,
                      @NotNull Editor editor,
                      @NotNull PsiFile file,
                      @NotNull DataContext dataContext,
                      @Nullable String actionPlace) {
  super.update(presentation, project, editor, file, dataContext, actionPlace);
  if (myHandler instanceof ContextAwareActionHandler && presentation.isEnabled()) {
    presentation.setEnabled(((ContextAwareActionHandler)myHandler).isAvailableForQuickList(editor, file, dataContext));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:BaseGenerateAction.java

示例11: update

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(AnActionEvent event){
  super.update(event);
  Presentation presentation = event.getPresentation();
  if (!presentation.isEnabled()) {
    return;
  }
  presentation.setEnabled(CommonDataKeys.PROJECT.getData(event.getDataContext()) != null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:CompileDirtyAction.java

示例12: update

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(AnActionEvent event) {
  super.update(event);
  Presentation presentation = event.getPresentation();
  if (!presentation.isEnabled()) {
    return;
  }
  Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
  presentation.setEnabled(project != null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CompileProjectAction.java

示例13: update

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
protected void update(final FileSystemTree fileSystemTree, final AnActionEvent e) {
  final Presentation presentation = e.getPresentation();
  if (!presentation.isEnabled()) return;

  final VirtualFile userHomeDir = VfsUtil.getUserHomeDir();
  presentation.setEnabled(userHomeDir != null && fileSystemTree.isUnderRoots(userHomeDir));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:GotoHomeAction.java

示例14: update

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
  final Presentation presentation = e.getPresentation();
  StudyUtils.updateAction(e);
  if (presentation.isEnabled()) {
    presentation.setEnabled(!checkInProgress);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:StudyCheckAction.java

示例15: setEnabled

import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
/**
 * Enable or disable current action from event.
 *
 * @param e Action event
 * @return Enabled value
 */
public static boolean setEnabled(AnActionEvent e) {
    ThumbnailView thumbnailView = getVisibleThumbnailView(e);
    Presentation presentation = e.getPresentation();
    presentation.setEnabled(thumbnailView != null);
    return presentation.isEnabled();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ThumbnailViewActionUtil.java


注:本文中的com.intellij.openapi.actionSystem.Presentation.isEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。