當前位置: 首頁>>代碼示例>>Java>>正文


Java InvokeQuickFixAction類代碼示例

本文整理匯總了Java中com.intellij.codeInspection.ui.actions.InvokeQuickFixAction的典型用法代碼示例。如果您正苦於以下問題:Java InvokeQuickFixAction類的具體用法?Java InvokeQuickFixAction怎麽用?Java InvokeQuickFixAction使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


InvokeQuickFixAction類屬於com.intellij.codeInspection.ui.actions包,在下文中一共展示了InvokeQuickFixAction類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createRightActionsToolbar

import com.intellij.codeInspection.ui.actions.InvokeQuickFixAction; //導入依賴的package包/類
@SuppressWarnings({"NonStaticInitializer"})
private JComponent createRightActionsToolbar() {
  myIncludeAction = new AnAction(InspectionsBundle.message("inspections.result.view.include.action.text")){
    {
      registerCustomShortcutSet(CommonShortcuts.INSERT, myTree);
    }

    @Override
    public void actionPerformed(AnActionEvent e) {
      final TreePath[] paths = myTree.getSelectionPaths();
      if (paths != null) {
        for (TreePath path : paths) {
          ((InspectionTreeNode)path.getLastPathComponent()).amnesty();
        }
      }
      updateView(false);
    }

    @Override
    public void update(final AnActionEvent e) {
      final TreePath[] paths = myTree.getSelectionPaths();
      e.getPresentation().setEnabled(paths != null && paths.length > 0 && 
                                     !myGlobalInspectionContext.getUIOptions().FILTER_RESOLVED_ITEMS);
    }
  };

  myExcludeAction = new AnAction(InspectionsBundle.message("inspections.result.view.exclude.action.text")) {
    {
      registerCustomShortcutSet(CommonShortcuts.getDelete(), myTree);
    }

    @Override
    public void actionPerformed(final AnActionEvent e) {
      final TreePath[] paths = myTree.getSelectionPaths();
      if (paths != null) {
        for (TreePath path : paths) {
          ((InspectionTreeNode)path.getLastPathComponent()).ignoreElement();
        }
      }
      updateView(false);
    }

    @Override
    public void update(final AnActionEvent e) {
      final TreePath[] path = myTree.getSelectionPaths();
      e.getPresentation().setEnabled(path != null && path.length > 0);
    }
  };

  DefaultActionGroup specialGroup = new DefaultActionGroup();
  specialGroup.add(myGlobalInspectionContext.getUIOptions().createGroupBySeverityAction(this));
  specialGroup.add(myGlobalInspectionContext.getUIOptions().createGroupByDirectoryAction(this));
  specialGroup.add(myGlobalInspectionContext.getUIOptions().createFilterResolvedItemsAction(this));
  specialGroup.add(myGlobalInspectionContext.getUIOptions().createShowOutdatedProblemsAction(this));
  specialGroup.add(myGlobalInspectionContext.getUIOptions().createShowDiffOnlyAction(this));
  specialGroup.add(new EditSettingsAction());
  specialGroup.add(new InvokeQuickFixAction(this));
  specialGroup.add(new InspectionsOptionsToolbarAction(this));
  return createToolbar(specialGroup);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:61,代碼來源:InspectionResultsView.java

示例2: createRightActionsToolbar

import com.intellij.codeInspection.ui.actions.InvokeQuickFixAction; //導入依賴的package包/類
@SuppressWarnings({"NonStaticInitializer"})
private JComponent createRightActionsToolbar() {
  myIncludeAction = new AnAction(InspectionsBundle.message("inspections.result.view.include.action.text")){
    {
      registerCustomShortcutSet(CommonShortcuts.INSERT, myTree);
    }

    @Override
    public void actionPerformed(AnActionEvent e) {
      ((InspectionTreeNode)myTree.getSelectionPath().getLastPathComponent()).amnesty();
      updateView(false);
    }

    @Override
    public void update(final AnActionEvent e) {
      final TreePath path = myTree.getSelectionPath();
      e.getPresentation().setEnabled(path != null && !myGlobalInspectionContext.getUIOptions().FILTER_RESOLVED_ITEMS);
    }
  };

  myExcludeAction = new AnAction(InspectionsBundle.message("inspections.result.view.exclude.action.text")) {
    {
      registerCustomShortcutSet(CommonShortcuts.DELETE, myTree);
    }

    @Override
    public void actionPerformed(final AnActionEvent e) {
      ((InspectionTreeNode)myTree.getSelectionPath().getLastPathComponent()).ignoreElement();
      updateView(false);
    }

    @Override
    public void update(final AnActionEvent e) {
      final TreePath path = myTree.getSelectionPath();
      e.getPresentation().setEnabled(path != null);
    }
  };

  DefaultActionGroup specialGroup = new DefaultActionGroup();
  specialGroup.add(myGlobalInspectionContext.getUIOptions().createGroupBySeverityAction(this));
  specialGroup.add(myGlobalInspectionContext.getUIOptions().createGroupByDirectoryAction(this));
  specialGroup.add(myGlobalInspectionContext.getUIOptions().createFilterResolvedItemsAction(this));
  specialGroup.add(myGlobalInspectionContext.getUIOptions().createShowOutdatedProblemsAction(this));
  specialGroup.add(myGlobalInspectionContext.getUIOptions().createShowDiffOnlyAction(this));
  specialGroup.add(new EditSettingsAction());
  specialGroup.add(new InvokeQuickFixAction(this));
  specialGroup.add(new InspectionsOptionsToolbarAction(this));
  return createToolbar(specialGroup);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:50,代碼來源:InspectionResultsView.java


注:本文中的com.intellij.codeInspection.ui.actions.InvokeQuickFixAction類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。