use of com.intellij.notification.Notification in project intellij-plugins by JetBrains.
the class LibraryManager method registerModule.
@NotNull
public ProjectComponentReferenceCounter registerModule(@NotNull final Module module, ProblemsHolder problemsHolder, boolean collectLocalStyleHolders) throws InitException {
final Project project = module.getProject();
final StringRegistry.StringWriter stringWriter = new StringRegistry.StringWriter(16384);
stringWriter.startChange();
final AssetCounter assetCounter = new AssetCounter();
final LibraryCollector libraryCollector = new LibraryCollector(this, new LibraryStyleInfoCollector(assetCounter, problemsHolder, module, stringWriter), module);
final Client client;
try {
final AccessToken token = ReadAction.start();
try {
libraryCollector.collect(module);
} finally {
token.finish();
}
client = Client.getInstance();
if (stringWriter.hasChanges()) {
client.updateStringRegistry(stringWriter);
} else {
stringWriter.commit();
}
} catch (Throwable e) {
stringWriter.rollback();
throw new InitException(e, "error.collect.libraries");
}
assert !libraryCollector.sdkLibraries.isEmpty();
final FlexLibrarySet flexLibrarySet = getOrCreateFlexLibrarySet(libraryCollector, assetCounter);
final InfoMap<Project, ProjectInfo> registeredProjects = client.getRegisteredProjects();
ProjectInfo info = registeredProjects.getNullableInfo(project);
if (info == null) {
info = new ProjectInfo(project);
registeredProjects.add(info);
client.openProject(project);
DesignerApplicationManager.getInstance().projectRegistered(project);
}
LibrarySet librarySet;
if (libraryCollector.externalLibraries.isEmpty()) {
librarySet = null;
} else {
final String key = createKey(libraryCollector.externalLibraries, false);
librarySet = librarySets.get(key);
if (librarySet == null) {
final SortResult sortResult = sortLibraries(new LibrarySorter(), libraryCollector, flexLibrarySet.contains, key, false);
librarySet = new LibrarySet(sortResult.id, flexLibrarySet, sortResult.libraries);
registerLibrarySet(key, librarySet);
}
}
final ModuleInfo moduleInfo = new ModuleInfo(module, librarySet == null ? flexLibrarySet : librarySet, ModuleInfoUtil.isApp(module));
final ProjectComponentReferenceCounter projectComponentReferenceCounter = new ProjectComponentReferenceCounter();
if (collectLocalStyleHolders) {
// client.registerModule finalize it
stringWriter.startChange();
try {
moduleInfo.setLocalStyleHolders(ModuleInfoUtil.collectLocalStyle(moduleInfo, libraryCollector.getFlexSdkVersion(), stringWriter, problemsHolder, projectComponentReferenceCounter, assetCounter));
} catch (Throwable e) {
stringWriter.rollback();
throw new InitException(e, "error.collect.local.style.holders");
}
}
client.registerModule(project, moduleInfo, stringWriter);
client.fillAssetClassPoolIfNeed(flexLibrarySet);
module.getMessageBus().connect(moduleInfo).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
@Override
public void rootsChanged(ModuleRootEvent event) {
new Notification(FlashUIDesignerBundle.message("plugin.name"), FlashUIDesignerBundle.message("plugin.name"), "Please reopen your project to update on library changes.", NotificationType.WARNING).notify(project);
}
});
return projectComponentReferenceCounter;
}
use of com.intellij.notification.Notification in project intellij-plugins by JetBrains.
the class ValidateFlashConfigurationsPrecompileTask method suggestParallelCompilationIfNeeded.
private void suggestParallelCompilationIfNeeded(final Project project, final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCsToCompile) {
if (myParallelCompilationSuggested)
return;
if (CompilerWorkspaceConfiguration.getInstance(project).PARALLEL_COMPILATION)
return;
if (modulesAndBCsToCompile.size() < 2)
return;
if (!independentBCsExist(modulesAndBCsToCompile))
return;
final NotificationListener listener = new NotificationListener() {
public void hyperlinkUpdate(@NotNull final Notification notification, @NotNull final HyperlinkEvent event) {
notification.expire();
if ("enable".equals(event.getDescription())) {
CompilerWorkspaceConfiguration.getInstance(project).PARALLEL_COMPILATION = true;
final NotificationListener listener1 = new NotificationListener() {
public void hyperlinkUpdate(@NotNull final Notification notification, @NotNull final HyperlinkEvent event) {
notification.expire();
ShowSettingsUtil.getInstance().showSettingsDialog(project, CompilerBundle.message("compiler.configurable.display.name"));
}
};
new Notification(FLASH_COMPILER_GROUP_ID, FlexBundle.message("parallel.compilation.enabled"), FlexBundle.message("see.settings.compiler"), NotificationType.INFORMATION, listener1).notify(project);
} else if ("open".equals(event.getDescription())) {
ShowSettingsUtil.getInstance().showSettingsDialog(project, CompilerBundle.message("compiler.configurable.display.name"));
}
}
};
new Notification(FLASH_COMPILER_GROUP_ID, FlexBundle.message("parallel.compilation.hint.title"), FlexBundle.message("parallel.compilation.hint"), NotificationType.INFORMATION, listener).notify(project);
myParallelCompilationSuggested = true;
}
use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class IdeMessagePanel method showErrorNotification.
private void showErrorNotification(@Nullable String notificationText, @NotNull Project project) {
Notification notification = new Notification("", AllIcons.Ide.FatalError, notificationText == null ? ERROR_TITLE : "", null, notificationText == null ? "" : notificationText, NotificationType.ERROR, null);
if (notificationText == null) {
notification.addAction(new NotificationAction(ERROR_LINK) {
@Override
public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) {
notification.expire();
_openFatals(null);
}
});
}
BalloonLayout layout = myFrame.getBalloonLayout();
assert layout != null;
BalloonLayoutData layoutData = BalloonLayoutData.createEmpty();
layoutData.fadeoutTime = 5000;
layoutData.fillColor = new JBColor(0XF5E6E7, 0X593D41);
layoutData.borderColor = new JBColor(0XE0A8A9, 0X73454B);
assert myBalloon == null;
myBalloon = NotificationsManagerImpl.createBalloon(myFrame, notification, false, false, new Ref<>(layoutData), project);
Disposer.register(myBalloon, () -> myBalloon = null);
layout.add(myBalloon);
}
use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class DefaultIdeaErrorLogger method processMappingFailed.
private static void processMappingFailed(IdeaLoggingEvent event) throws InterruptedException, InvocationTargetException {
if (!ourMappingFailedNotificationPosted && SystemInfo.isWindows && SystemInfo.is32Bit) {
ourMappingFailedNotificationPosted = true;
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") String exceptionMessage = event.getThrowable().getMessage();
String text = exceptionMessage + "<br>Possible cause: unable to allocate continuous memory chunk of necessary size.<br>" + "Reducing JVM maximum heap size (-Xmx) may help.";
Notifications.Bus.notify(new Notification("Memory", "Memory Mapping Failed", text, NotificationType.WARNING), null);
}
}
use of com.intellij.notification.Notification in project intellij-community by JetBrains.
the class ProjectLoadingErrorsNotifierImpl method fireNotifications.
private void fireNotifications() {
final MultiMap<ConfigurationErrorType, ConfigurationErrorDescription> descriptionsMap = new MultiMap<>();
synchronized (myLock) {
if (myErrors.isEmpty())
return;
descriptionsMap.putAllValues(myErrors);
myErrors.clear();
}
for (final ConfigurationErrorType type : descriptionsMap.keySet()) {
final Collection<ConfigurationErrorDescription> descriptions = descriptionsMap.get(type);
if (descriptions.isEmpty())
continue;
final String invalidElements = getInvalidElementsString(type, descriptions);
final String errorText = ProjectBundle.message("error.message.configuration.cannot.load") + " " + invalidElements + " <a href=\"\">Details...</a>";
Notifications.Bus.notify(new Notification("Project Loading Error", "Error Loading Project", errorText, NotificationType.ERROR, new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
final List<ConfigurationErrorDescription> validDescriptions = ContainerUtil.findAll(descriptions, errorDescription -> errorDescription.isValid());
if (RemoveInvalidElementsDialog.showDialog(myProject, CommonBundle.getErrorTitle(), type, invalidElements, validDescriptions)) {
notification.expire();
}
}
}), myProject);
}
}
Aggregations