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


Java DumbAwareAction类代码示例

本文整理汇总了Java中com.intellij.openapi.project.DumbAwareAction的典型用法代码示例。如果您正苦于以下问题:Java DumbAwareAction类的具体用法?Java DumbAwareAction怎么用?Java DumbAwareAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createPopupActionGroup

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
  if (myItems == null) {
    myItems = new DefaultActionGroup(null, true);
    for (final ClasspathType classpathType : ClasspathType.values()) {
      myItems.addAction(new DumbAwareAction(classpathType.getDescription()) {
        @Override
        public void actionPerformed(AnActionEvent e) {
          mySettings.setRuntime(classpathType.isRuntime());
          mySettings.setTest(classpathType.isTest());
          updateTree();
        }
      });
    }
  }
  return myItems;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AnalyzeDependenciesComponent.java

示例2: createPopup

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
@NotNull
JBPopup createPopup() {
  JPanel panel = new JPanel(new BorderLayout());
  panel.add(myTextField, BorderLayout.CENTER);
  ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTextField)
    .setCancelOnClickOutside(true)
    .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish")
    .setRequestFocus(true)
    .setResizable(true)
    .setMayBeParent(true);

  final JBPopup popup = builder.createPopup();
  popup.setMinimumSize(new Dimension(200, 90));
  AnAction okAction = new DumbAwareAction() {
    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      unregisterCustomShortcutSet(popup.getContent());
      popup.closeOk(e.getInputEvent());
    }
  };
  okAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, popup.getContent());
  return popup;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:MultilinePopupBuilder.java

示例3: fillActions

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) {
  final LafManager manager = LafManager.getInstance();
  final UIManager.LookAndFeelInfo[] lfs = manager.getInstalledLookAndFeels();
  final UIManager.LookAndFeelInfo current = manager.getCurrentLookAndFeel();
  for (final UIManager.LookAndFeelInfo lf : lfs) {
    group.add(new DumbAwareAction(lf.getName(), "", lf == current ? ourCurrentAction : ourNotCurrentAction) {
      public void actionPerformed(AnActionEvent e) {
        final UIManager.LookAndFeelInfo cur = manager.getCurrentLookAndFeel();
        if (cur == lf) return;
        boolean needUninstall = UIUtil.isUnderDarcula();
        manager.setCurrentLookAndFeel(lf);
        manager.updateUI();
        if (UIUtil.isUnderDarcula()) {
          DarculaInstaller.install();
        } else if (needUninstall) {
          DarculaInstaller.uninstall();
        }
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:QuickChangeLookAndFeel.java

示例4: createPopupActionGroup

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
  final DefaultActionGroup gr = new DefaultActionGroup();
  for (final String enabledValue : InstalledPluginsTableModel.ENABLED_VALUES) {
    gr.add(new DumbAwareAction(enabledValue) {
      @Override
      public void actionPerformed(AnActionEvent e) {
        final IdeaPluginDescriptor[] selection = pluginTable.getSelectedObjects();
        final String filter = myFilter.getFilter().toLowerCase();
        ((InstalledPluginsTableModel)pluginsModel).setEnabledFilter(enabledValue, filter);
        if (selection != null) {
          select(selection);
        }
      }
    });
  }
  return gr;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:InstalledPluginsManagerMain.java

示例5: showHint

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
@Override
protected boolean showHint(final JComponent component) {
  boolean result = super.showHint(component);
  if (result && getType() == ValueHintType.MOUSE_OVER_HINT) {
    myDisposable = Disposer.newDisposable();
    ShortcutSet shortcut = ActionManager.getInstance().getAction("ShowErrorDescription").getShortcutSet();
    new DumbAwareAction() {
      @Override
      public void actionPerformed(@NotNull AnActionEvent e) {
        hideHint();
        final Point point = new Point(myPoint.x, myPoint.y + getEditor().getLineHeight());
        new XValueHint(getProject(), getEditor(), point, ValueHintType.MOUSE_CLICK_HINT, myExpressionInfo, myEvaluator, myDebugSession).invokeHint();
      }
    }.registerCustomShortcutSet(shortcut, getEditor().getContentComponent(), myDisposable);
  }
  if (result) {
    XValueHint prev = getEditor().getUserData(HINT_KEY);
    if (prev != null) {
      prev.hideHint();
    }
    getEditor().putUserData(HINT_KEY, this);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:XValueHint.java

示例6: fillActionGroup

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
private void fillActionGroup(final DefaultActionGroup group,
                             final List<NamedScope> scopes,
                             final List<Descriptor> defaultDescriptors,
                             final InspectionProfileImpl inspectionProfile,
                             final Set<String> excludedScopeNames) {
  for (final NamedScope scope : scopes) {
    final String scopeName = scope.getName();
    if (excludedScopeNames.contains(scopeName)) {
      continue;
    }
    group.add(new DumbAwareAction(scopeName) {
      @Override
      public void actionPerformed(final AnActionEvent e) {
        for (final Descriptor defaultDescriptor : defaultDescriptors) {
          inspectionProfile.addScope(defaultDescriptor.getToolWrapper().createCopy(), scope, defaultDescriptor.getLevel(), true, getEventProject(e));
        }
        onScopeAdded();
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ScopesChooser.java

示例7: selectBranchAndPerformAction

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
private static void selectBranchAndPerformAction(@NotNull VcsLogDataPack dataPack,
                                                 @NotNull AnActionEvent event,
                                                 @NotNull final Consumer<String> consumer,
                                                 @NotNull Collection<VirtualFile> visibleRoots) {
  ActionGroup actionGroup = BranchFilterPopupComponent.constructActionGroup(dataPack, null, new Function<String, AnAction>() {
    @Override
    public AnAction fun(final String s) {
      return new DumbAwareAction(s) {
        @Override
        public void actionPerformed(AnActionEvent e) {
          consumer.consume(s);
        }
      };
    }
  }, visibleRoots);
  ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Select branch to compare", actionGroup, event.getDataContext(),
                                                                        false, false, false, null, -1, null);
  InputEvent inputEvent = event.getInputEvent();
  if (inputEvent instanceof MouseEvent) {
    popup.show(new RelativePoint((MouseEvent)inputEvent));
  }
  else {
    popup.showInBestPositionFor(event.getDataContext());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DeepCompareAction.java

示例8: convertActions

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
public static void convertActions(@NotNull JComponent component,
                                  @NotNull List<TerminalAction> actions,
                                  @Nullable final Predicate<KeyEvent> elseAction) {
  for (final TerminalAction action : actions) {
    AnAction a = new DumbAwareAction() {
      @Override
      public void actionPerformed(AnActionEvent e) {
        KeyEvent event = e.getInputEvent() instanceof KeyEvent ? (KeyEvent)e.getInputEvent() : null;
        if (!action.perform(event)) {
          if (elseAction != null) {
            elseAction.apply(event);
          }
        }
      }
    };
    a.registerCustomShortcutSet(action.getKeyCode(), action.getModifiers(), component);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JBTabbedTerminalWidget.java

示例9: createAddActions

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
public void createAddActions(DefaultActionGroup group,
                             final JComponent parent,
                             final Consumer<Sdk> updateTree,
                             @Nullable Condition<SdkTypeId> filter) {
  final SdkType[] types = SdkType.getAllTypes();
  for (final SdkType type : types) {
    if (filter != null && !filter.value(type)) continue;
    final AnAction addAction = new DumbAwareAction(type.getPresentableName(),
                                            null,
                                            type.getIconForAddAction()) {
        @Override
        public void actionPerformed(AnActionEvent e) {
          doAdd(parent, type, updateTree);
        }
      };
    group.add(addAction);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:ProjectSdksModel.java

示例10: convertActions

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
public static void convertActions(@NotNull JComponent component,
		@NotNull List<TerminalAction> actions,
		@Nullable final Predicate<KeyEvent> elseAction)
{
	for(final TerminalAction action : actions)
	{
		AnAction a = new DumbAwareAction()
		{
			@Override
			public void actionPerformed(AnActionEvent e)
			{
				KeyEvent event = e.getInputEvent() instanceof KeyEvent ? (KeyEvent) e.getInputEvent() : null;
				if(!action.perform(event))
				{
					if(elseAction != null)
					{
						elseAction.apply(event);
					}
				}
			}
		};
		a.registerCustomShortcutSet(action.getKeyCode(), action.getModifiers(), component);
	}
}
 
开发者ID:consulo,项目名称:consulo-terminal,代码行数:25,代码来源:JBTabbedTerminalWidget.java

示例11: createPopup

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
@Nonnull
JBPopup createPopup() {
  JPanel panel = new JPanel(new BorderLayout());
  panel.add(myTextField, BorderLayout.CENTER);
  ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTextField)
          .setCancelOnClickOutside(true)
          .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish")
          .setRequestFocus(true)
          .setResizable(true)
          .setMayBeParent(true);

  final JBPopup popup = builder.createPopup();
  popup.setMinimumSize(new JBDimension(200, 90));
  AnAction okAction = new DumbAwareAction() {
    @Override
    public void actionPerformed(@Nonnull AnActionEvent e) {
      unregisterCustomShortcutSet(popup.getContent());
      popup.closeOk(e.getInputEvent());
    }
  };
  okAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, popup.getContent());
  return popup;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:MultilinePopupBuilder.java

示例12: fillActions

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
@Override
protected void fillActions(Project project, @Nonnull DefaultActionGroup group, @Nonnull DataContext dataContext) {
  final LafManager manager = LafManager.getInstance();
  final UIManager.LookAndFeelInfo[] lfs = manager.getInstalledLookAndFeels();
  final UIManager.LookAndFeelInfo current = manager.getCurrentLookAndFeel();
  for (final UIManager.LookAndFeelInfo lf : lfs) {
    group.add(new DumbAwareAction(lf.getName(), "", lf == current ? ourCurrentAction : ourNotCurrentAction) {
      @Override
      public void actionPerformed(AnActionEvent e) {
        final UIManager.LookAndFeelInfo cur = manager.getCurrentLookAndFeel();
        if (cur == lf) return;
        manager.setCurrentLookAndFeel(lf);
        manager.updateUI();
      }
    });
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:QuickChangeLookAndFeel.java

示例13: showHint

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
@Override
protected boolean showHint(final JComponent component) {
  boolean result = super.showHint(component);
  if (result && getType() == ValueHintType.MOUSE_OVER_HINT) {
    myDisposable = Disposer.newDisposable();
    ShortcutSet shortcut = ActionManager.getInstance().getAction("ShowErrorDescription").getShortcutSet();
    new DumbAwareAction() {
      @Override
      public void actionPerformed(@Nonnull AnActionEvent e) {
        hideHint();
        final Point point = new Point(myPoint.x, myPoint.y + getEditor().getLineHeight());
        new XValueHint(getProject(), getEditor(), point, ValueHintType.MOUSE_CLICK_HINT, myExpressionInfo, myEvaluator, myDebugSession).invokeHint();
      }
    }.registerCustomShortcutSet(shortcut, getEditor().getContentComponent(), myDisposable);
  }
  if (result) {
    XValueHint prev = getEditor().getUserData(HINT_KEY);
    if (prev != null) {
      prev.hideHint();
    }
    getEditor().putUserData(HINT_KEY, this);
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:XValueHint.java

示例14: createPopupActionGroup

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Nonnull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
  if (myItems == null) {
    myItems = new DefaultActionGroup(null, true);
    for (final ClasspathType classpathType : ClasspathType.values()) {
      myItems.addAction(new DumbAwareAction(classpathType.getDescription()) {
        @Override
        public void actionPerformed(AnActionEvent e) {
          mySettings.setRuntime(classpathType.isRuntime());
          mySettings.setTest(classpathType.isTest());
          updateTree();
        }
      });
    }
  }
  return myItems;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:AnalyzeDependenciesComponent.java

示例15: actionPerformed

import com.intellij.openapi.project.DumbAwareAction; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  List<String> languages = IdeScriptEngineManager.getInstance().getLanguages();
  if (languages.size() == 1) {
    runConsole(e, languages.iterator().next());
    return;
  }

  DefaultActionGroup actions =
          new DefaultActionGroup(ContainerUtil.map(languages, (NotNullFunction<String, AnAction>)language -> new DumbAwareAction(language) {
            @Override
            public void actionPerformed(@Nonnull AnActionEvent e1) {
              runConsole(e1, language);
            }
          }));
  JBPopupFactory.getInstance().createActionGroupPopup("Script Engine", actions, e.getDataContext(), JBPopupFactory.ActionSelectionAid.NUMBERING, false).
          showInBestPositionFor(e.getDataContext());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:RunIdeConsoleAction.java


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