diff --git a/build/lib/gant/lib/README_JPS.txt b/build/lib/gant/lib/README_JPS.txt new file mode 100644 index 000000000000..dc927aa0c583 --- /dev/null +++ b/build/lib/gant/lib/README_JPS.txt @@ -0,0 +1,4 @@ +The source code for JPS, JetBrains' Gant-based build system used for +building IntelliJ, can be found on GitHub: + + http://github.com/shafirov/JPS diff --git a/native/VistaUpdaterLauncher/VistaUpdaterLauncher/VistaUpdaterLauncher.cpp b/native/VistaUpdaterLauncher/VistaUpdaterLauncher/VistaUpdaterLauncher.cpp index bd14d4d4163e..dd2e41980873 100644 --- a/native/VistaUpdaterLauncher/VistaUpdaterLauncher/VistaUpdaterLauncher.cpp +++ b/native/VistaUpdaterLauncher/VistaUpdaterLauncher/VistaUpdaterLauncher.cpp @@ -1,5 +1,18 @@ -// VistaUpdaterLauncher.cpp : Defines the entry point for the console application. -// +/* + * Copyright 2000-2009 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "stdafx.h" #include diff --git a/native/breakgen/AppMain.c b/native/breakgen/AppMain.c index bf4603365dac..4b33f16fa89c 100644 --- a/native/breakgen/AppMain.c +++ b/native/breakgen/AppMain.c @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2009 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #if defined(WIN32) #include diff --git a/native/fileWatcher/ReadMe.txt b/native/fileWatcher/ReadMe.txt deleted file mode 100644 index 959f007d34f3..000000000000 --- a/native/fileWatcher/ReadMe.txt +++ /dev/null @@ -1,33 +0,0 @@ -======================================================================== - CONSOLE APPLICATION : fileWatcher3 Project Overview -======================================================================== - -AppWizard has created this fileWatcher3 application for you. - -This file contains a summary of what you will find in each of the files that -make up your fileWatcher3 application. - - -fileWatcher3.vcproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -fileWatcher3.cpp - This is the main application source file. - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named fileWatcher3.pch and a precompiled types file named StdAfx.obj. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" comments to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// diff --git a/native/fileWatcher/fileWatcher3.cpp b/native/fileWatcher/fileWatcher3.cpp index 8c61739b8398..97c32fdbfafb 100644 --- a/native/fileWatcher/fileWatcher3.cpp +++ b/native/fileWatcher/fileWatcher3.cpp @@ -1,5 +1,18 @@ -// fileWatcher3.cpp : Defines the entry point for the console application. -// +/* + * Copyright 2000-2009 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "stdafx.h" diff --git a/native/fsNotifier/mac/fsnotifier.c b/native/fsNotifier/mac/fsnotifier.c index bae724d3b6fb..cefe730156ad 100644 --- a/native/fsNotifier/mac/fsnotifier.c +++ b/native/fsNotifier/mac/fsnotifier.c @@ -1,3 +1,19 @@ +/* + * Copyright 2000-2009 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include #include diff --git a/native/restarter/ReadMe.txt b/native/restarter/ReadMe.txt deleted file mode 100644 index 80a9a1c63148..000000000000 --- a/native/restarter/ReadMe.txt +++ /dev/null @@ -1,33 +0,0 @@ -======================================================================== - CONSOLE APPLICATION : restarter Project Overview -======================================================================== - -AppWizard has created this restarter application for you. - -This file contains a summary of what you will find in each of the files that -make up your restarter application. - - -restarter.vcproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -restarter.cpp - This is the main application source file. - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named restarter.pch and a precompiled types file named StdAfx.obj. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" comments to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// diff --git a/native/restarter/restarter.cpp b/native/restarter/restarter.cpp index da1682182475..65b1eb214a55 100644 --- a/native/restarter/restarter.cpp +++ b/native/restarter/restarter.cpp @@ -1,5 +1,18 @@ -// restarter.cpp : Defines the entry point for the console application. -// +/* + * Copyright 2000-2009 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "stdafx.h" diff --git a/platform/icons/src/ide/error_notifications.png b/platform/icons/src/ide/error_notifications.png new file mode 100644 index 000000000000..ef68f6af4209 Binary files /dev/null and b/platform/icons/src/ide/error_notifications.png differ diff --git a/platform/icons/src/ide/info_notifications.png b/platform/icons/src/ide/info_notifications.png new file mode 100644 index 000000000000..eab75749bbec Binary files /dev/null and b/platform/icons/src/ide/info_notifications.png differ diff --git a/platform/icons/src/ide/read_notifications.png b/platform/icons/src/ide/read_notifications.png index 2d865bb119f0..77bedbcc15e2 100644 Binary files a/platform/icons/src/ide/read_notifications.png and b/platform/icons/src/ide/read_notifications.png differ diff --git a/platform/icons/src/ide/unread_notifications.png b/platform/icons/src/ide/unread_notifications.png deleted file mode 100644 index 022bb1b3e8d1..000000000000 Binary files a/platform/icons/src/ide/unread_notifications.png and /dev/null differ diff --git a/platform/icons/src/ide/warning_notifications.png b/platform/icons/src/ide/warning_notifications.png new file mode 100644 index 000000000000..ac2d621ec097 Binary files /dev/null and b/platform/icons/src/ide/warning_notifications.png differ diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java index b69e1672cbbb..82aeb3423aaa 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java @@ -23,15 +23,14 @@ import com.intellij.codeInsight.hint.HintManager; import com.intellij.codeInsight.intention.AbstractIntentionAction; import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInsight.intention.IntentionManager; -import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction; import com.intellij.codeInsight.intention.impl.IntentionHintComponent; +import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler; import com.intellij.codeInsight.intention.impl.config.IntentionManagerSettings; import com.intellij.codeInsight.lookup.LookupManager; import com.intellij.codeInsight.template.impl.TemplateManagerImpl; import com.intellij.codeInsight.template.impl.TemplateState; import com.intellij.ide.DataManager; import com.intellij.lang.annotation.HighlightSeverity; -import com.intellij.lang.injection.InjectedLanguageManager; import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; @@ -44,14 +43,13 @@ import com.intellij.openapi.editor.LogicalPosition; import com.intellij.openapi.editor.markup.GutterIconRenderer; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.project.IndexNotReadyException; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.JBPopupFactory; +import com.intellij.openapi.util.Pair; import com.intellij.psi.IntentionFilterOwner; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; -import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.ui.awt.RelativePoint; import com.intellij.util.IncorrectOperationException; import com.intellij.util.containers.ContainerUtil; @@ -188,27 +186,13 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass { public static void getActionsToShow(@NotNull final Editor editor, @NotNull final PsiFile psiFile, @NotNull IntentionsInfo intentions, int passIdToShowIntentionsFor) { final PsiElement psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); LOG.assertTrue(psiElement == null || psiElement.isValid(), psiElement); - final boolean isInProject = psiFile.getManager().isInProject(psiFile); int offset = editor.getCaretModel().getOffset(); Project project = psiFile.getProject(); - PsiElement injected = InjectedLanguageManager.getInstance(project).findInjectedElementAt(psiFile, offset); - PsiFile injectedFile; - Editor injectedEditor; - if (injected != null) { - injectedFile = injected.getContainingFile(); - injectedEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, injectedFile); - } - else { - injectedFile = null; - injectedEditor = null; - } - for (IntentionAction action : IntentionManager.getInstance().getIntentionActions()) { - if (injectedFile != null && isAvailableHere(injectedEditor, injectedFile, injected, isInProject, project, action) || - isAvailableHere(editor, psiFile, psiElement, isInProject, project, action) - ) { + Pair place = ShowIntentionActionsHandler.availableFor(psiFile, editor, action, psiElement); + if (place != null) { List enableDisableIntentionAction = new ArrayList(); enableDisableIntentionAction.add(new IntentionHintComponent.EnableDisableIntentionAction(action)); intentions.intentionsToShow.add(new HighlightInfo.IntentionActionDescriptor(action, enableDisableIntentionAction, null)); @@ -256,19 +240,4 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass { } } - private static boolean isAvailableHere(Editor editor, PsiFile psiFile, PsiElement psiElement, boolean inProject, Project project, - IntentionAction action) { - try { - if (action instanceof PsiElementBaseIntentionAction) { - if (!inProject || !((PsiElementBaseIntentionAction)action).isAvailable(project, editor, psiElement)) return false; - } - else if (!action.isAvailable(project, editor, psiFile)) { - return false; - } - } - catch (IndexNotReadyException e) { - return false; - } - return true; - } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionListStep.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionListStep.java index 73ac167c645e..7d25cc3b1d59 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionListStep.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionListStep.java @@ -29,6 +29,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.*; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Iconable; +import com.intellij.openapi.util.Pair; import com.intellij.psi.*; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.psi.util.PsiUtilBase; @@ -83,52 +84,56 @@ class IntentionListStep implements ListPopupStep private boolean wrapActionsTo(final List descriptors, final Set cachedActions) { boolean result = true; - for (HighlightInfo.IntentionActionDescriptor descriptor : descriptors) { - IntentionAction action = descriptor.getAction(); - IntentionActionWithTextCaching cachedAction = new IntentionActionWithTextCaching(action, descriptor.getDisplayName(), descriptor.getIcon()); - result &= !cachedActions.add(cachedAction); - final int caretOffset = myEditor.getCaretModel().getOffset(); - final int fileOffset = caretOffset > 0 && caretOffset == myFile.getTextLength() ? caretOffset - 1 : caretOffset; - PsiElement element; - if (myFile instanceof PsiCompiledElement) { - element = myFile; - } - else if (PsiDocumentManager.getInstance(myProject).isUncommited(myEditor.getDocument())) { - //??? - FileViewProvider viewProvider = myFile.getViewProvider(); - element = viewProvider.findElementAt(fileOffset, viewProvider.getBaseLanguage()); - } - else { - element = InjectedLanguageUtil.findElementAtNoCommit(myFile, fileOffset); - } - final List options; - if (element != null && (options = descriptor.getOptions(element)) != null) { - for (IntentionAction option : options) { - boolean isErrorFix = myCachedErrorFixes.contains(new IntentionActionWithTextCaching(option, option.getText())); - if (isErrorFix) { - cachedAction.addErrorFix(option); - } - boolean isInspectionFix = myCachedInspectionFixes.contains(new IntentionActionWithTextCaching(option, option.getText())); - if (isInspectionFix) { - cachedAction.addInspectionFix(option); - } - else { - cachedAction.addIntention(option); + final int caretOffset = myEditor.getCaretModel().getOffset(); + final int fileOffset = caretOffset > 0 && caretOffset == myFile.getTextLength() ? caretOffset - 1 : caretOffset; + PsiElement element; + if (myFile instanceof PsiCompiledElement) { + element = myFile; + } + else if (PsiDocumentManager.getInstance(myProject).isUncommited(myEditor.getDocument())) { + //??? + FileViewProvider viewProvider = myFile.getViewProvider(); + element = viewProvider.findElementAt(fileOffset, viewProvider.getBaseLanguage()); + } + else { + element = InjectedLanguageUtil.findElementAtNoCommit(myFile, fileOffset); + } + if (!descriptors.isEmpty()) { + + for (HighlightInfo.IntentionActionDescriptor descriptor : descriptors) { + IntentionAction action = descriptor.getAction(); + IntentionActionWithTextCaching cachedAction = new IntentionActionWithTextCaching(action, descriptor.getDisplayName(), descriptor.getIcon()); + result &= !cachedActions.add(cachedAction); + final List options; + if (element != null && (options = descriptor.getOptions(element)) != null) { + for (IntentionAction option : options) { + boolean isErrorFix = myCachedErrorFixes.contains(new IntentionActionWithTextCaching(option, option.getText())); + if (isErrorFix) { + cachedAction.addErrorFix(option); + } + boolean isInspectionFix = myCachedInspectionFixes.contains(new IntentionActionWithTextCaching(option, option.getText())); + if (isInspectionFix) { + cachedAction.addInspectionFix(option); + } + else { + cachedAction.addIntention(option); + } } } } } - result &= removeInvalidActions(cachedActions); + result &= removeInvalidActions(cachedActions, element); return result; } - private boolean removeInvalidActions(final Collection cachedActions) { + private boolean removeInvalidActions(final Collection cachedActions, final PsiElement element) { boolean result = true; Iterator iterator = cachedActions.iterator(); while (iterator.hasNext()) { IntentionActionWithTextCaching cachedAction = iterator.next(); IntentionAction action = cachedAction.getAction(); - if (!myFile.isValid() || !action.isAvailable(myProject, myEditor, myFile)) { + Pair place = ShowIntentionActionsHandler.availableFor(myFile, myEditor, action, element); + if (place == null) { iterator.remove(); result = false; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/ShowIntentionActionsHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/ShowIntentionActionsHandler.java index df1c94197e6b..f20747b27c14 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/ShowIntentionActionsHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/ShowIntentionActionsHandler.java @@ -39,6 +39,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.progress.Task; +import com.intellij.openapi.project.IndexNotReadyException; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; @@ -50,6 +51,7 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -142,7 +144,10 @@ public class ShowIntentionActionsHandler implements CodeInsightActionHandler { return false; } - public static void chooseActionAndInvoke(PsiFile file, final Editor editor, final IntentionAction action, final String text) { + // returns editor,file where the action is available or null if there are none + @Nullable + public static Pair availableFor(PsiFile file, final Editor editor, final IntentionAction action, final PsiElement element) { + if (!file.isValid()) return null; final Project project = file.getProject(); final Editor editorToApply; @@ -150,29 +155,58 @@ public class ShowIntentionActionsHandler implements CodeInsightActionHandler { int offset = editor.getCaretModel().getOffset(); PsiElement injected = InjectedLanguageManager.getInstance(project).findInjectedElementAt(file, offset); + boolean inProject = file.getManager().isInProject(file); if (injected != null) { PsiFile injectedFile = injected.getContainingFile(); Editor injectedEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, injectedFile); - if (action.isAvailable(project, injectedEditor, injectedFile)) { + if (isAvailableHere(injectedEditor, injectedFile, injected, inProject, action)) { editorToApply = injectedEditor; fileToApply = injectedFile; } - else if (!action.isAvailable(project, editor, file)) { - return; + else if (!isAvailableHere(editor, file, element, inProject, action)) { + return null; } else { editorToApply = editor; fileToApply = file; } } - else if (!action.isAvailable(project, editor, file)) { - return; + else if (!isAvailableHere(editor, file, element, inProject, action)) { + return null; } else { editorToApply = editor; fileToApply = file; } + return Pair.create(fileToApply, editorToApply); + } + + private static boolean isAvailableHere(Editor editor, PsiFile psiFile, PsiElement psiElement, boolean inProject, IntentionAction action) { + try { + Project project = psiFile.getProject(); + if (action instanceof PsiElementBaseIntentionAction) { + if (!inProject || !((PsiElementBaseIntentionAction)action).isAvailable(project, editor, psiElement)) return false; + } + else if (!action.isAvailable(project, editor, psiFile)) { + return false; + } + } + catch (IndexNotReadyException e) { + return false; + } + return true; + } + + public static void chooseActionAndInvoke(PsiFile file, final Editor editor, final IntentionAction action, final String text) { + final Project project = file.getProject(); + + int offset = editor.getCaretModel().getOffset(); + PsiElement element = file.findElementAt(offset); + Pair pair = availableFor(file, editor, action, element); + if (pair == null) return; + final Editor editorToApply = pair.second; + final PsiFile fileToApply = pair.first; Runnable runnable = new Runnable() { public void run() { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java index ba3c7d5d291e..77b4f3d931b7 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java @@ -532,8 +532,8 @@ class TemplateListPanel extends JPanel { TemplateImpl orTemplate = getTemplate(selected); LOG.assertTrue(orTemplate != null); TemplateImpl template = orTemplate.copy(); - myTemplateOptions.put(getKey(template), template.createOptions()); - myTemplateContext.put(getKey(template), template.createContext()); + myTemplateOptions.put(getKey(template), getOptions(orTemplate)); + myTemplateContext.put(getKey(template), getContext(orTemplate)); EditTemplateDialog dialog = new EditTemplateDialog(this, CodeInsightBundle.message("dialog.copy.live.template.title"), template, getTemplateGroups(), (String)myExpandByCombo.getSelectedItem(), getOptions(template), getContext(template)); dialog.show(); diff --git a/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesDialog.java b/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesDialog.java index adcd4da4db83..bb5dede39a82 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesDialog.java +++ b/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesDialog.java @@ -24,6 +24,7 @@ import com.intellij.openapi.help.HelpManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.TextFieldWithBrowseButton; +import com.intellij.openapi.util.Disposer; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; @@ -96,6 +97,7 @@ public class MoveFilesOrDirectoriesDialog extends DialogWrapper{ validateOKButton(); } }); + Disposer.register(getDisposable(), myTargetDirectoryField); return panel; } diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationModel.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationModel.java index b9e1781c3803..a4c3c69429b4 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/NotificationModel.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationModel.java @@ -104,7 +104,8 @@ public class NotificationModel { private LinkedList filterNotifications(@NotNull PairFunction filter) { final LinkedList result = new LinkedList(); - final HashSet>> entries = new HashSet>>(myNotifications.entrySet()); + final HashSet>> entries = + new HashSet>>(myNotifications.entrySet()); for (final Map.Entry> entry : entries) { if (filter.fun(entry.getKey(), entry.getValue().first)) { result.addFirst(entry.getKey()); @@ -183,4 +184,24 @@ public class NotificationModel { public boolean hasRead(PairFunction filter) { return getUnreadCount(filter) < myNotifications.size(); } + + @Nullable + public NotificationType getMaximumType(PairFunction filter) { + final LinkedList notifications = filterNotifications(filter); + NotificationType result = null; + for (Notification notification : notifications) { + if (NotificationType.ERROR == notification.getType()) { + return NotificationType.ERROR; + } + + if (NotificationType.WARNING == notification.getType()) { + result = NotificationType.WARNING; + } + else if (result == null && NotificationType.INFORMATION == notification.getType()) { + result = NotificationType.INFORMATION; + } + } + + return result; + } } diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java index ac076e5ece21..5130a80723d7 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java @@ -268,6 +268,11 @@ public class NotificationsManagerImpl extends NotificationsManager implements No return myModel.getByType(type, createFilter(project, false)); } + @Nullable + public NotificationType getMaximumType(@Nullable final Project project) { + return myModel.getMaximumType(createFilter(project, false)); + } + public boolean hasUnread(@Nullable final Project project) { return myModel.hasUnread(createFilter(project, false)); } diff --git a/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationComponent.java b/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationComponent.java index c876faf73e14..29aaf0aadd1e 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationComponent.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationComponent.java @@ -17,6 +17,7 @@ package com.intellij.notification.impl.ui; import com.intellij.concurrency.JobScheduler; import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; import com.intellij.notification.impl.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.JBPopup; @@ -39,7 +40,9 @@ import java.util.concurrent.TimeUnit; public class NotificationComponent extends JLabel implements NotificationModelListener { private static final Icon EMPTY_ICON = IconLoader.getIcon("/ide/notifications.png"); private static final Icon READ_ICON = IconLoader.getIcon("/ide/read_notifications.png"); - private static final Icon UNREAD_ICON = IconLoader.getIcon("/ide/unread_notifications.png"); + private static final Icon ERROR_ICON = IconLoader.getIcon("/ide/error_notifications.png"); + private static final Icon WARNING_ICON = IconLoader.getIcon("/ide/warning_notifications.png"); + private static final Icon INFO_ICON = IconLoader.getIcon("/ide/info_notifications.png"); private WeakReference myPopupRef; @@ -112,11 +115,20 @@ public class NotificationComponent extends JLabel implements NotificationModelLi final NotificationsManagerImpl manager = getManager(); Icon icon = EMPTY_ICON; - if (manager.hasUnread(getProject())) { - icon = UNREAD_ICON; - } - else if (manager.hasRead(getProject())) { - icon = READ_ICON; + final NotificationType maximumType = manager.getMaximumType(getProject()); + if (maximumType != null) { + switch (maximumType) { + case WARNING: + icon = WARNING_ICON; + break; + case ERROR: + icon = ERROR_ICON; + break; + case INFORMATION: + default: + icon = INFO_ICON; + break; + } } myCurrentIcon = new BlinkIconWrapper(icon, false); diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java index 749e8d94e0c3..86c290934d02 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java @@ -884,6 +884,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt fireProjectClosing(project); myOpenProjects.remove(project); + myChangedProjectFiles.remove(project); fireProjectClosed(project); if (save) { diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/AWTUtilitiesWrapper.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/AWTUtilitiesWrapper.java index 51ede83b5cac..fe756a1da8b2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/AWTUtilitiesWrapper.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/AWTUtilitiesWrapper.java @@ -82,12 +82,14 @@ public class AWTUtilitiesWrapper { } public static boolean isTranslucencySupported(Object kind) { - if (translucencyClass == null) { - return false; - } + if (!isTranslucencyAPISupported()) return false; return isSupported(mIsTranslucencySupported, kind); } + public static boolean isTranslucencyAPISupported() { + return translucencyClass != null; + } + public static boolean isTranslucencyCapable(GraphicsConfiguration gc) { return isSupported(mIsTranslucencyCapable, gc); } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java index 4b1bcc8c6dff..81b7a07acaec 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java @@ -226,7 +226,9 @@ public final class WindowManagerImpl extends WindowManagerEx implements Applicat } private static boolean calcAlphaModelSupported() { - if (AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.TRANSLUCENT)) return true; + if (AWTUtilitiesWrapper.isTranslucencyAPISupported()) { + return AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.TRANSLUCENT); + } try { return WindowUtils.isWindowAlphaSupported(); } diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/pattern/compiler/AnnotationBasedInstrumentingCompiler.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/pattern/compiler/AnnotationBasedInstrumentingCompiler.java index e228fa426636..390375f727c8 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/pattern/compiler/AnnotationBasedInstrumentingCompiler.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/pattern/compiler/AnnotationBasedInstrumentingCompiler.java @@ -23,6 +23,7 @@ import com.intellij.openapi.compiler.*; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.roots.CompilerModuleExtension; @@ -65,6 +66,9 @@ public abstract class AnnotationBasedInstrumentingCompiler implements ClassInstr final Project project = context.getProject(); final Set result = new HashSet(); final PsiSearchHelper searchHelper = PsiManager.getInstance(context.getProject()).getSearchHelper(); + + DumbService.getInstance(project).waitForSmartMode(); + ApplicationManager.getApplication().runReadAction(new Runnable() { public void run() { final String[] names = getAnnotationNames(project); diff --git a/plugins/maven/maven.iml b/plugins/maven/maven.iml index 401bac01486b..084702bf62a3 100644 --- a/plugins/maven/maven.iml +++ b/plugins/maven/maven.iml @@ -25,47 +25,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +