use of com.intellij.openapi.actionSystem.AnAction in project android by JetBrains.
the class Header method setAdditionalActions.
public void setAdditionalActions(@NotNull AnAction... actions) {
myButtonPanel.removeAll();
myButtonPanel.revalidate();
myButtonPanel.repaint();
int actionCount = actions.length;
for (int i = 0; i < actionCount; i++) {
AnAction action = actions[i];
if (action == null) {
continue;
}
myButtonPanel.add(new ActionButton(action));
if (i < actionCount - 1) {
myButtonPanel.add(Box.createHorizontalStrut(9));
}
}
}
use of com.intellij.openapi.actionSystem.AnAction in project android by JetBrains.
the class IdeSdks method createAndroidSdkPerAndroidTarget.
@NotNull
public List<Sdk> createAndroidSdkPerAndroidTarget(@NotNull File androidSdkPath) {
List<Sdk> sdks = createAndroidSdkPerAndroidTarget(androidSdkPath, null);
AnAction sdkManagerAction = ActionManager.getInstance().getAction("WelcomeScreen.RunAndroidSdkManager");
if (sdkManagerAction != null) {
sdkManagerAction.update(null);
}
return sdks;
}
use of com.intellij.openapi.actionSystem.AnAction in project android by JetBrains.
the class DefaultGradleConsoleView method createToolWindowContent.
@Override
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
//Create runner UI layout
RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);
JComponent layoutComponent = layoutUi.getComponent();
// Adding actions
DefaultActionGroup group = new DefaultActionGroup();
layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
Content console = layoutUi.createContent(GradleConsoleToolWindowFactory.ID, myConsoleView.getComponent(), "", null, null);
AnAction[] consoleActions = myConsoleView.createConsoleActions();
for (AnAction action : consoleActions) {
if (!shouldIgnoreAction(action)) {
group.add(action);
}
}
layoutUi.addContent(console, 0, PlaceInGrid.right, false);
myConsolePanel.add(layoutComponent, BorderLayout.CENTER);
//noinspection ConstantConditions
Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
toolWindow.getContentManager().addContent(content);
}
use of com.intellij.openapi.actionSystem.AnAction in project android by JetBrains.
the class GradleDslMethodNotFoundErrorHandler method getApplyGradlePluginHyperlink.
@NotNull
private static NotificationHyperlink getApplyGradlePluginHyperlink(@NotNull final VirtualFile virtualFile, @NotNull final NotificationData notification) {
return new NotificationHyperlink("apply.gradle.plugin", "Apply Gradle plugin") {
@Override
protected void execute(@NotNull Project project) {
openFile(virtualFile, notification, project);
ActionManager actionManager = ActionManager.getInstance();
String actionId = AddGradleDslPluginAction.ID;
AnAction action = actionManager.getAction(actionId);
assert action instanceof AddGradleDslPluginAction;
AddGradleDslPluginAction addPluginAction = (AddGradleDslPluginAction) action;
actionManager.tryToExecute(addPluginAction, ActionCommand.getInputEvent(actionId), null, ActionPlaces.UNKNOWN, true);
}
};
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class GitBranchPopup method getInstance.
/**
* @param currentRepository Current repository, which means the repository of the currently open or selected file.
* In the case of synchronized branch operations current repository matter much less, but sometimes is used,
* for example, it is preselected in the repositories combobox in the compare branches dialog.
*/
static GitBranchPopup getInstance(@NotNull final Project project, @NotNull GitRepository currentRepository) {
final GitVcsSettings vcsSettings = GitVcsSettings.getInstance(project);
Condition<AnAction> preselectActionCondition = action -> {
if (action instanceof GitBranchPopupActions.LocalBranchActions) {
GitBranchPopupActions.LocalBranchActions branchAction = (GitBranchPopupActions.LocalBranchActions) action;
String branchName = branchAction.getBranchName();
String recentBranch;
List<GitRepository> repositories = branchAction.getRepositories();
if (repositories.size() == 1) {
recentBranch = vcsSettings.getRecentBranchesByRepository().get(repositories.iterator().next().getRoot().getPath());
} else {
recentBranch = vcsSettings.getRecentCommonBranch();
}
if (recentBranch != null && recentBranch.equals(branchName)) {
return true;
}
}
return false;
};
return new GitBranchPopup(currentRepository, GitUtil.getRepositoryManager(project), vcsSettings, preselectActionCondition);
}
Aggregations