use of com.intellij.ui.components.labels.ActionLink in project intellij-elixir by KronicDeth.
the class MixConfigurationForm method createUIComponents.
private void createUIComponents() {
myLinkContainer = new JPanel(new BorderLayout());
ActionLink link = new ActionLink("Download the latest Mix version", new AnAction() {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
DownloadableFileService service = DownloadableFileService.getInstance();
DownloadableFileDescription mix = service.createFileDescription("http://s3.hex.pm/builds/mix/mix", "mix");
FileDownloader downloader = service.createDownloader(ContainerUtil.list(mix), "mix");
List<Pair<VirtualFile, DownloadableFileDescription>> pairs = downloader.downloadWithProgress(null, getEventProject(anActionEvent), myLinkContainer);
if (pairs != null) {
for (Pair<VirtualFile, DownloadableFileDescription> pair : pairs) {
try {
String path = pair.first.getCanonicalPath();
if (path != null) {
FileUtilRt.setExecutableAttribute(path, true);
myMixPathSelector.setText(path);
validateMixPath();
}
} catch (Exception e) {
// Ignore
}
}
}
}
});
myLinkContainer.add(link, BorderLayout.NORTH);
}
use of com.intellij.ui.components.labels.ActionLink in project intellij-community by JetBrains.
the class VcsPushDialog method createForcePushInfoLabel.
@NotNull
private JComponent createForcePushInfoLabel() {
JPanel text = new JPanel();
text.setLayout(new BoxLayout(text, BoxLayout.X_AXIS));
JLabel label = new JLabel("You can enable and configure Force Push in " + ShowSettingsUtil.getSettingsMenuName() + ".");
label.setEnabled(false);
label.setFont(JBUI.Fonts.smallFont());
text.add(label);
ActionLink here = new ActionLink("Configure", new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
Project project = myController.getProject();
VcsPushDialog.this.doCancelAction(e.getInputEvent());
ShowSettingsUtilImpl.showSettingsDialog(project, "vcs.Git", "force push");
}
});
here.setFont(JBUI.Fonts.smallFont());
text.add(here);
return JBUI.Panels.simplePanel().addToRight(text).withBorder(JBUI.Borders.emptyBottom(4));
}
use of com.intellij.ui.components.labels.ActionLink in project android by JetBrains.
the class ActionLinkFixture method findByActionId.
@NotNull
public static ActionLinkFixture findByActionId(@NotNull final String actionId, @NotNull final Robot robot, @NotNull final Container container) {
final Ref<ActionLink> actionLinkRef = new Ref<>();
Wait.seconds(1).expecting("ActionLink with ID '" + actionId + "' to be visible").until(() -> {
Collection<ActionLink> found = robot.finder().findAll(container, new GenericTypeMatcher<ActionLink>(ActionLink.class) {
@Override
protected boolean isMatching(@NotNull ActionLink actionLink) {
if (actionLink.isVisible()) {
AnAction action = actionLink.getAction();
String id = ActionManager.getInstance().getId(action);
return actionId.equals(id);
}
return false;
}
});
if (found.size() == 1) {
actionLinkRef.set(getFirstItem(found));
return true;
}
return false;
});
ActionLink actionLink = actionLinkRef.get();
if (actionLink == null) {
throw new ComponentLookupException("Failed to find ActionLink with ID '" + actionId + "'");
}
return new ActionLinkFixture(robot, actionLink);
}
Aggregations