private void showVendoringNotification() { if (!myModuleInitialized || myModule.isDisposed()) { return; } Project project = myModule.getProject(); String version = GoSdkService.getInstance(project).getSdkVersion(myModule); if (!GoVendoringUtil.supportsVendoring(version) || GoVendoringUtil.supportsVendoringByDefault(version)) { return; } if (GoModuleSettings.getInstance(myModule).getVendoringEnabled() != ThreeState.UNSURE) { return; } PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(project); boolean shownAlready; //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (propertiesComponent) { shownAlready = propertiesComponent.getBoolean(GO_VENDORING_NOTIFICATION_HAD_BEEN_SHOWN, false); if (!shownAlready) { propertiesComponent.setValue( GO_VENDORING_NOTIFICATION_HAD_BEEN_SHOWN, String.valueOf(true)); } } if (!shownAlready) { NotificationListener.Adapter notificationListener = new NotificationListener.Adapter() { @Override protected void hyperlinkActivated( @NotNull Notification notification, @NotNull HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED && "configure".equals(event.getDescription())) { GoModuleSettings.showModulesConfigurable(project); } } }; Notification notification = GoConstants.GO_NOTIFICATION_GROUP.createNotification( "Vendoring usage is detected", "<p><strong>vendor</strong> directory usually means that project uses Go Vendor Experiment.</p>\n" + "<p>Selected Go SDK version support vendoring but it's disabled by default.</p>\n" + "<p>You may want to explicitly enabled Go Vendor Experiment in the <a href='configure'>project settings</a>.</p>", NotificationType.INFORMATION, notificationListener); Notifications.Bus.notify(notification, project); } }
private static void showNotification(@NotNull Project project) { PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); PropertiesComponent projectPropertiesComponent = PropertiesComponent.getInstance(project); boolean shownAlready; //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (propertiesComponent) { shownAlready = propertiesComponent.getBoolean(GO_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, false) || projectPropertiesComponent.getBoolean( GO_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, false); if (!shownAlready) { propertiesComponent.setValue( GO_LIBRARIES_NOTIFICATION_HAD_BEEN_SHOWN, String.valueOf(true)); } } if (!shownAlready) { NotificationListener.Adapter notificationListener = new NotificationListener.Adapter() { @Override protected void hyperlinkActivated( @NotNull Notification notification, @NotNull HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED && "configure".equals(event.getDescription())) { GoLibrariesConfigurableProvider.showModulesConfigurable(project); } } }; Notification notification = GoConstants.GO_NOTIFICATION_GROUP.createNotification( "GOPATH was detected", "We've detected some libraries from your GOPATH.\n" + "You may want to add extra libraries in <a href='configure'>Go Libraries configuration</a>.", NotificationType.INFORMATION, notificationListener); Notifications.Bus.notify(notification, project); } }