Java Code Examples for com.intellij.openapi.actionSystem.AnAction#EMPTY_ARRAY

The following examples show how to use com.intellij.openapi.actionSystem.AnAction#EMPTY_ARRAY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RunContentDescriptor.java    From consulo with Apache License 2.0 6 votes vote down vote up
public RunContentDescriptor(@Nullable ExecutionConsole executionConsole,
                            @Nullable ProcessHandler processHandler,
                            @Nonnull JComponent component,
                            String displayName,
                            @Nullable Image icon,
                            @Nullable Runnable activationCallback,
                            @Nullable AnAction[] restartActions) {
  myExecutionConsole = executionConsole;
  myProcessHandler = processHandler;
  myComponent = component;
  myDisplayName = displayName;
  myIcon = icon;
  myHelpId = myExecutionConsole instanceof HelpIdProvider ? ((HelpIdProvider)myExecutionConsole).getHelpId() : null;
  myActivationCallback = activationCallback;
  if (myExecutionConsole != null) {
    Disposer.register(this, myExecutionConsole);
  }

  myRestartActions = restartActions == null ? AnAction.EMPTY_ARRAY : restartActions;
}
 
Example 2
Source File: ArtifactsStructureConfigurable.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected AbstractAddGroup createAddAction() {
  return new AbstractAddGroup(ProjectBundle.message("add.new.header.text")) {
    @Nonnull
    @Override
    public AnAction[] getChildren(@Nullable AnActionEvent e) {
      final ArtifactType[] types = ArtifactType.EP_NAME.getExtensions();
      List<AnAction> list = new ArrayList<AnAction>(types.length);
      for (ArtifactType type : types) {
        if (type.isAvailableForAdd(myContext.getModulesConfigurator())) {
          list.add(createAddArtifactAction(type));
        }
      }
      return list.isEmpty() ? AnAction.EMPTY_ARRAY : list.toArray(new AnAction[list.size()]);
    }
  };
}
 
Example 3
Source File: AddToFavoritesActionGroup.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
@Nonnull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
  if (e == null) return AnAction.EMPTY_ARRAY;
  final Project project = e.getProject();
  if (project == null) {
    return AnAction.EMPTY_ARRAY;
  }
  final List<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
  availableFavoritesLists.remove(e.getDataContext().getData(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY));
  if (availableFavoritesLists.isEmpty()) {
    return new AnAction[]{new AddToNewFavoritesListAction()};
  }

  AnAction[] actions = new AnAction[availableFavoritesLists.size() + 2];
  int idx = 0;
  for (String favoritesList : availableFavoritesLists) {
    actions[idx++] = new AddToFavoritesAction(favoritesList);
  }
  actions[idx++] = AnSeparator.getInstance();
  actions[idx] = new AddToNewFavoritesListAction();
  return actions;
}
 
Example 4
Source File: AddAllToFavoritesActionGroup.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
@Nonnull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
  if (e == null) return AnAction.EMPTY_ARRAY;
  final Project project = e.getProject();
  if (project == null) {
    return AnAction.EMPTY_ARRAY;
  }
  final List<String> listNames = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
  final List<String> availableFavoritesLists = FavoritesManager.getInstance(project).getAvailableFavoritesListNames();
  availableFavoritesLists.remove(e.getDataContext().getData(FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY));
  if (availableFavoritesLists.isEmpty()) {
    return new AnAction[]{new AddAllOpenFilesToNewFavoritesListAction()};
  }

  AnAction[] actions = new AnAction[listNames.size() + 2];
  int idx = 0;
  for (String favoritesList : listNames) {
    actions[idx++] = new AddAllOpenFilesToFavorites(favoritesList);
  }
  actions[idx++] = AnSeparator.getInstance();
  actions[idx] = new AddAllOpenFilesToNewFavoritesListAction();
  return actions;
}
 
Example 5
Source File: Unity3dAssetUsageFilteringRuleProvider.java    From consulo-unity3d with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public AnAction[] createFilteringActions(@Nonnull UsageView view)
{
	if(view.getPresentation().isCodeUsages())
	{
		return new AnAction[]{new ShowAssetUsageAction(view)};
	}
	else
	{
		return AnAction.EMPTY_ARRAY;
	}
}
 
Example 6
Source File: TestExecutionState.java    From buck with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner)
    throws ExecutionException {
  final ProcessHandler processHandler = runBuildCommand(executor);
  final TestConsoleProperties properties =
      new BuckTestConsoleProperties(
          processHandler, mProject, mConfiguration, "Buck test", executor);
  final ConsoleView console =
      SMTestRunnerConnectionUtil.createAndAttachConsole("buck test", processHandler, properties);
  return new DefaultExecutionResult(console, processHandler, AnAction.EMPTY_ARRAY);
}
 
Example 7
Source File: UsageNodeTreeBuilderTest.java    From consulo with Apache License 2.0 5 votes vote down vote up
private GroupNode buildUsageTree(int[] indices, UsageGroupingRule[] rules) {
  Usage[] usages = new Usage[indices.length];
  for (int i = 0; i < usages.length; i++) {
    usages[i] = createUsage(indices[i]);
  }

  UsageViewPresentation presentation = new UsageViewPresentation();
  presentation.setUsagesString("searching for mock usages");

  ExtensionPoint<UsageGroupingRuleProvider> point = Application.get().getExtensionPoint(UsageGroupingRuleProvider.EP_NAME);
  UsageGroupingRuleProvider provider = new UsageGroupingRuleProvider() {
    @Nonnull
    @Override
    public UsageGroupingRule[] getActiveRules(Project project) {
      return rules;
    }

    @Nonnull
    @Override
    public AnAction[] createGroupingActions(UsageView view) {
      return AnAction.EMPTY_ARRAY;
    }
  };
 // point.registerExtension(provider);
  try {
    UsageViewImpl usageView = new UsageViewImpl(getProject(), presentation, UsageTarget.EMPTY_ARRAY, null);
    Disposer.register(getTestRootDisposable(), usageView);
    for (Usage usage : usages) {
      usageView.appendUsage(usage);
    }
    UIUtil.dispatchAllInvocationEvents();

    return usageView.getRoot();
  }
  finally {
   // point.unregisterExtension(provider);
  }
}
 
Example 8
Source File: ImportUsageFilteringRuleProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public AnAction[] createFilteringActions(@Nonnull final UsageView view) {
  if (view.getPresentation().isCodeUsages()) {
    final JComponent component = view.getComponent();
    final ShowImportsAction showImportsAction = new ShowImportsAction(view);
    showImportsAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK)), component, view);
    return new AnAction[] { showImportsAction };
  }
  else {
    return AnAction.EMPTY_ARRAY;
  }
}
 
Example 9
Source File: SMTestRunnerResultsForm.java    From consulo with Apache License 2.0 4 votes vote down vote up
public SMTestRunnerResultsForm(@Nonnull final JComponent console, final TestConsoleProperties consoleProperties) {
  this(console, AnAction.EMPTY_ARRAY, consoleProperties, null);
}
 
Example 10
Source File: BaseTestsOutputConsoleView.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public AnAction[] createConsoleActions() {
  return AnAction.EMPTY_ARRAY;
}
 
Example 11
Source File: DefaultExecutionResult.java    From consulo with Apache License 2.0 4 votes vote down vote up
public DefaultExecutionResult() {
  myConsole = null;
  myProcessHandler = null;
  myActions = AnAction.EMPTY_ARRAY;
}
 
Example 12
Source File: DefaultExecutionResult.java    From consulo with Apache License 2.0 4 votes vote down vote up
public DefaultExecutionResult(final ExecutionConsole console, @Nonnull final ProcessHandler processHandler) {
  this(console, processHandler, AnAction.EMPTY_ARRAY);
}
 
Example 13
Source File: RunContentDescriptor.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * @return actions to restart or rerun
 */
@Nonnull
public AnAction[] getRestartActions() {
  return myRestartActions.length == 0 ? AnAction.EMPTY_ARRAY : myRestartActions.clone();
}