use of javax.swing.event.HyperlinkEvent in project intellij-community by JetBrains.
the class TaskManagerImpl method notifyAboutConnectionFailure.
private void notifyAboutConnectionFailure(final TaskRepository repository, String details) {
Notifications.Bus.register(TASKS_NOTIFICATION_GROUP, NotificationDisplayType.BALLOON);
String content = "<p><a href=\"\">Configure server...</a></p>";
if (!StringUtil.isEmpty(details)) {
content = "<p>" + details + "</p>" + content;
}
Notifications.Bus.notify(new Notification(TASKS_NOTIFICATION_GROUP, "Cannot connect to " + repository.getUrl(), content, NotificationType.WARNING, new NotificationListener() {
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
TaskRepositoriesConfigurable configurable = new TaskRepositoriesConfigurable(myProject);
ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable);
if (!ArrayUtil.contains(repository, getAllRepositories())) {
notification.expire();
}
}
}), myProject);
}
use of javax.swing.event.HyperlinkEvent in project intellij-community by JetBrains.
the class StudyProjectComponent method projectOpened.
@Override
public void projectOpened() {
Course course = StudyTaskManager.getInstance(myProject).getCourse();
// Check if user has javafx lib in his JDK. Now bundled JDK doesn't have this lib inside.
if (StudyUtils.hasJavaFx()) {
Platform.setImplicitExit(false);
}
if (course != null && !course.isAdaptive() && !course.isUpToDate()) {
final Notification notification = new Notification("Update.course", "Course Updates", "Course is ready to <a href=\"update\">update</a>", NotificationType.INFORMATION, new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
FileEditorManagerEx.getInstanceEx(myProject).closeAllFiles();
ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
return execCancelable(() -> {
updateCourse();
return true;
});
}, "Updating Course", true, myProject);
EduUtils.synchronize();
course.setUpdated();
}
});
notification.notify(myProject);
}
StudyUtils.registerStudyToolWindow(course, myProject);
StartupManager.getInstance(myProject).runWhenProjectIsInitialized(() -> ApplicationManager.getApplication().invokeLater((DumbAwareRunnable) () -> ApplicationManager.getApplication().runWriteAction((DumbAwareRunnable) () -> {
Course course1 = StudyTaskManager.getInstance(myProject).getCourse();
if (course1 != null) {
UISettings instance = UISettings.getInstance();
instance.setHideToolStripes(false);
instance.fireUISettingsChanged();
registerShortcuts();
EduUsagesCollector.projectTypeOpened(course1.isAdaptive() ? EduNames.ADAPTIVE : EduNames.STUDY);
}
})));
myBusConnection = ApplicationManager.getApplication().getMessageBus().connect();
myBusConnection.subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {
@Override
public void globalSchemeChange(EditorColorsScheme scheme) {
final StudyToolWindow toolWindow = StudyUtils.getStudyToolWindow(myProject);
if (toolWindow != null) {
toolWindow.updateFonts(myProject);
}
}
});
}
use of javax.swing.event.HyperlinkEvent in project intellij-community by JetBrains.
the class PythonSdkType method notifyRemoteSdkSkeletonsFail.
public static void notifyRemoteSdkSkeletonsFail(final InvalidSdkException e, @Nullable final Runnable restartAction) {
NotificationListener notificationListener;
String notificationMessage;
if (e.getCause() instanceof VagrantNotStartedException) {
notificationListener = new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
final PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
if (manager != null) {
try {
VagrantNotStartedException cause = (VagrantNotStartedException) e.getCause();
manager.runVagrant(cause.getVagrantFolder(), cause.getMachineName());
} catch (ExecutionException e1) {
throw new RuntimeException(e1);
}
}
if (restartAction != null) {
restartAction.run();
}
}
};
notificationMessage = e.getMessage() + "\n<a href=\"#\">Launch vagrant and refresh skeletons</a>";
} else if (ExceptionUtil.causedBy(e, ExceptionFix.class)) {
//noinspection ThrowableResultOfMethodCallIgnored
final ExceptionFix fix = ExceptionUtil.findCause(e, ExceptionFix.class);
notificationListener = new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
fix.apply();
if (restartAction != null) {
restartAction.run();
}
}
};
notificationMessage = fix.getNotificationMessage(e.getMessage());
} else {
notificationListener = null;
notificationMessage = e.getMessage();
}
Notifications.Bus.notify(new Notification(SKELETONS_TOPIC, "Couldn't refresh skeletons for remote interpreter", notificationMessage, NotificationType.WARNING, notificationListener));
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class GradleRenderErrorContributor method reportIssue170841.
private void reportIssue170841(RenderLogger logger, AndroidFacet facet) {
Map<String, Throwable> brokenClasses = logger.getBrokenClasses();
if (brokenClasses == null || brokenClasses.isEmpty() || facet == null) {
return;
}
AndroidModuleModel model = AndroidModuleModel.get(facet);
if (model == null || !model.getFeatures().isLayoutRenderingIssuePresent()) {
return;
}
Runnable runnable = new Runnable() {
@Override
public void run() {
FixAndroidGradlePluginVersionHyperlink quickFix = new FixAndroidGradlePluginVersionHyperlink(GradleVersion.parse(GRADLE_PLUGIN_RECOMMENDED_VERSION), null);
quickFix.executeIfClicked(facet.getModule().getProject(), new HyperlinkEvent(this, HyperlinkEvent.EventType.ACTIVATED, null, quickFix.getUrl()));
}
};
HtmlBuilder builder = new HtmlBuilder();
HtmlLinkManager linkManager = logger.getLinkManager();
builder.add("Tip: Either ").addLink("update the Gradle plugin build version to 1.2.3", linkManager.createRunnableLink(runnable)).add(" or later, or downgrade to version 1.1.3, or as a workaround, ");
builder.beginList().listItem().addLink("", "Build the project", ", then", linkManager.createBuildProjectUrl()).listItem().addLink("", "Gradle Sync the project", ", then", linkManager.createSyncProjectUrl()).listItem().addLink("Manually ", "refresh the layout", " (or restart the IDE)", linkManager.createRefreshRenderUrl()).endList();
builder.newline();
GradleVersion modelVersion = model.getModelVersion();
addIssue().setSeverity(HighlightSeverity.ERROR).setSummary("Using an obsolete version of the Gradle plugin (" + modelVersion + "); " + "this can lead to layouts not rendering correctly.").setHtmlContent(builder).build();
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class AndroidPropertyFilesUpdater method askUserIfUpdatePropertyFile.
private void askUserIfUpdatePropertyFile(@NotNull Project project, @NotNull Collection<AndroidFacet> facets, @NotNull final Processor<MyResult> callback) {
final StringBuilder moduleList = new StringBuilder();
for (AndroidFacet facet : facets) {
moduleList.append(facet.getModule().getName()).append("<br>");
}
myNotification = PROPERTY_FILES_UPDATING_NOTIFICATION.createNotification(AndroidBundle.message("android.update.project.properties.dialog.title"), AndroidBundle.message("android.update.project.properties.dialog.text", moduleList.toString()), NotificationType.INFORMATION, new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
final String desc = event.getDescription();
if ("once".equals(desc)) {
callback.process(MyResult.ONCE);
} else if ("never".equals(desc)) {
callback.process(MyResult.NEVER);
} else {
callback.process(MyResult.ALWAYS);
}
notification.expire();
}
});
myNotification.notify(project);
}
Aggregations