use of com.intellij.openapi.actionSystem.AnAction in project android by JetBrains.
the class OpenAndroidSdkManagerHyperlink method execute.
@Override
protected void execute(@NotNull Project project) {
ActionManager actionManager = ActionManager.getInstance();
AnAction sdkManagerAction = actionManager.getAction("Android.RunAndroidSdkManager");
sdkManagerAction.actionPerformed(null);
}
use of com.intellij.openapi.actionSystem.AnAction in project android by JetBrains.
the class AnalysisResultsManager method createActions.
@NotNull
@Override
protected AnAction[] createActions() {
return new AnAction[] { new ToggleAction(AndroidBundle.message("android.captures.analysis.results.manager.run.name"), AndroidBundle.message("android.captures.analysis.results.manager.run.description"), AllIcons.Toolwindows.ToolWindowRun) {
@Override
public boolean isSelected(AnActionEvent e) {
AnalysisResultsContent analysisResultsContent = getContentFromDesigner();
return analysisResultsContent != null && !analysisResultsContent.canRunAnalysis();
}
@Override
public void setSelected(AnActionEvent e, boolean state) {
if (state) {
AnalysisResultsContent analysisResultsContent = getContentFromDesigner();
if (analysisResultsContent != null && analysisResultsContent.canRunAnalysis()) {
analysisResultsContent.performAnalysis();
}
}
}
@Override
public void update(@NotNull AnActionEvent e) {
super.update(e);
Presentation presentation = e.getPresentation();
if (isSelected(e)) {
presentation.setText(AndroidBundle.message("android.captures.analysis.results.manager.run.disabled.name"));
presentation.setDescription(AndroidBundle.message("android.captures.analysis.results.manager.run.disabled.description"));
presentation.setIcon(AllIcons.Process.DisabledRun);
} else {
presentation.setText(AndroidBundle.message("android.captures.analysis.results.manager.run.enabled.name"));
presentation.setDescription(AndroidBundle.message("android.captures.analysis.results.manager.run.enabled.description"));
presentation.setIcon(AllIcons.Toolwindows.ToolWindowRun);
}
}
} };
}
use of com.intellij.openapi.actionSystem.AnAction in project android by JetBrains.
the class DeviceMenuActionTest method prettyPrintActions.
private static void prettyPrintActions(AnAction action, StringBuilder sb, int depth) {
String text;
if (action instanceof Separator) {
text = "------------------------------------------------------";
} else {
text = action.getTemplatePresentation().getText();
if (text != null && text.startsWith("AVD:")) {
// build environment
return;
}
}
if (text != null) {
for (int i = 0; i < depth; i++) {
sb.append(" ");
}
sb.append(text).append("\n");
}
DefaultActionGroup group = action instanceof DefaultActionGroup ? (DefaultActionGroup) action : null;
if (group != null) {
for (AnAction child : group.getChildActionsOrStubs()) {
prettyPrintActions(child, sb, depth + 1);
}
}
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-plugins by JetBrains.
the class BaseEditorPopup method getChildren.
@NotNull
public AnAction[] getChildren(AnActionEvent e) {
if (e == null)
return EMPTY_ARRAY;
final Editor editor = getEditor(e);
final VirtualFile file = getFile(e);
if (file == null || editor == null)
return EMPTY_ARRAY;
List<AnAction> result = new ArrayList<>();
final UserModel userModel = getUserModel();
String[] groups = userModel.getGroups();
List<String> groupsWithUsers = new ArrayList<>();
for (String group : groups) {
if (userModel.getUsers(group).length > 0) {
groupsWithUsers.add(group);
}
}
if (groupsWithUsers.size() == 1) {
User[] users = userModel.getUsers(groupsWithUsers.get(0));
fillWithUserActions(users, result, file, editor);
} else {
for (String groupsWithUser : groupsWithUsers) {
ActionGroup actionGroup = createGroupWithUsersActionGroup(groupsWithUser, userModel, file, editor);
result.add(actionGroup);
}
}
return result.toArray(new AnAction[result.size()]);
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-plugins by JetBrains.
the class OptionsButton method addResetPreferencesActionTo.
private void addResetPreferencesActionTo(DefaultActionGroup actionGroup) {
myResetSettingsAction = new AnAction("Reset to default settings") {
public void actionPerformed(AnActionEvent e) {
try {
Preferences preferences = Preferences.userRoot().node("jetbrains.communicator");
preferences.removeNode();
preferences.flush();
} catch (BackingStoreException e1) {
LOG.error(e1.getMessage(), e1);
}
}
};
actionGroup.add(myResetSettingsAction);
}
Aggregations