use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class IdeSdksConfigurable method createNdkResetLink.
private void createNdkResetLink() {
myNdkResetHyperlinkLabel = new HyperlinkLabel();
myNdkResetHyperlinkLabel.setHyperlinkText("", "Select", " default NDK");
myNdkResetHyperlinkLabel.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
// known non-null since otherwise we won't show the link
File androidNdkPath = IdeSdks.getInstance().getAndroidNdkPath();
assert androidNdkPath != null;
myNdkLocationTextField.setText(androidNdkPath.getPath());
}
});
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class InstallTask method showPrepareCompleteNotification.
private void showPrepareCompleteNotification(@NotNull final Collection<RepoPackage> packages) {
final NotificationListener notificationListener = new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
if ("install".equals(event.getDescription())) {
ModelWizardDialog dialogForPaths = SdkQuickfixUtils.createDialogForPackages(null, myInstallRequests, myUninstallRequests, false);
if (dialogForPaths != null) {
dialogForPaths.show();
}
}
notification.expire();
}
};
final NotificationGroup group = new NotificationGroup("SDK Installer", NotificationDisplayType.STICKY_BALLOON, false);
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
final Project[] openProjectsOrNull = openProjects.length == 0 ? new Project[] { null } : openProjects;
ApplicationManager.getApplication().invokeLater(() -> {
for (Project p : openProjectsOrNull) {
String message;
if (packages.size() == 1) {
RepoPackage pack = packages.iterator().next();
PackageOperation op = myRepoManager.getInProgressInstallOperation(pack);
// op shouldn't be null. But just in case, we assume it's an install.
String opName = op == null || op instanceof Installer ? "Install" : "Uninstall";
message = String.format("%1$sation of '%2$s' is ready to continue<br/><a href=\"install\">%1$s Now</a>", opName, pack.getDisplayName());
} else {
message = packages.size() + " packages are ready to install or uninstall<br/><a href=\"install\">Continue</a>";
}
group.createNotification("SDK Install", message, NotificationType.INFORMATION, notificationListener).notify(p);
}
}, // Don't show while we're in a modal context (e.g. sdk manager)
ModalityState.NON_MODAL, o -> {
for (RepoPackage pack : packages) {
PackageOperation installer = myRepoManager.getInProgressInstallOperation(pack);
if (installer != null && installer.getInstallStatus() == PackageOperation.InstallStatus.PREPARED) {
return false;
}
}
return true;
});
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class NotificationHyperlinkTest method testExecuteIfClickedWhenDescriptionMatchesUrl.
public void testExecuteIfClickedWhenDescriptionMatchesUrl() {
HyperlinkEvent event = createMock(HyperlinkEvent.class);
expect(event.getDescription()).andReturn("openFile");
replay(event);
assertTrue(myHyperlink.executeIfClicked(myProject, event));
verify(event);
assertTrue(myExecuted);
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class NotificationHyperlinkTest method testExecuteIfClickedWhenDescriptionDoesNotMatchUrl.
public void testExecuteIfClickedWhenDescriptionDoesNotMatchUrl() {
HyperlinkEvent event = createMock(HyperlinkEvent.class);
expect(event.getDescription()).andReturn("browse");
replay(event);
assertFalse(myHyperlink.executeIfClicked(myProject, event));
verify(event);
assertFalse(myExecuted);
}
use of javax.swing.event.HyperlinkEvent in project intellij-plugins by JetBrains.
the class DartProblemsFilterForm method createUIComponents.
private void createUIComponents() {
myResetFilterHyperlink = new HoverHyperlinkLabel(DartBundle.message("reset.filter"));
myResetFilterHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(final HyperlinkEvent e) {
myListeners.forEach(FilterListener::filtersResetRequested);
}
});
}
Aggregations