Merge branch 'master' of git.labs.intellij.net:idea/community
authorBas <bas@MegaLappie.local>
Fri, 16 Oct 2009 15:22:55 +0000 (17:22 +0200)
committerBas <bas@MegaLappie.local>
Fri, 16 Oct 2009 15:22:55 +0000 (17:22 +0200)
26 files changed:
build/lib/gant/lib/README_JPS.txt [new file with mode: 0644]
native/VistaUpdaterLauncher/VistaUpdaterLauncher/VistaUpdaterLauncher.cpp
native/breakgen/AppMain.c
native/fileWatcher/ReadMe.txt [deleted file]
native/fileWatcher/fileWatcher3.cpp
native/fsNotifier/mac/fsnotifier.c
native/restarter/ReadMe.txt [deleted file]
native/restarter/restarter.cpp
platform/icons/src/ide/error_notifications.png [new file with mode: 0644]
platform/icons/src/ide/info_notifications.png [new file with mode: 0644]
platform/icons/src/ide/read_notifications.png
platform/icons/src/ide/unread_notifications.png [deleted file]
platform/icons/src/ide/warning_notifications.png [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java
platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionListStep.java
platform/lang-impl/src/com/intellij/codeInsight/intention/impl/ShowIntentionActionsHandler.java
platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java
platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesDialog.java
platform/platform-impl/src/com/intellij/notification/impl/NotificationModel.java
platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java
platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationComponent.java
platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/AWTUtilitiesWrapper.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java
plugins/IntelliLang/src/org/intellij/plugins/intelliLang/pattern/compiler/AnnotationBasedInstrumentingCompiler.java
plugins/maven/maven.iml

diff --git a/build/lib/gant/lib/README_JPS.txt b/build/lib/gant/lib/README_JPS.txt
new file mode 100644 (file)
index 0000000..dc927aa
--- /dev/null
@@ -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
index bd14d4d4163e9f15cc1d4ba48256c67f7ae6ac2d..dd2e41980873351a2f9cb7a7c465ecc4630ce675 100644 (file)
@@ -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 <windows.h>
index bf4603365dac4d5e933ea48fe708c1826164449e..4b33f16fa89c314e8a7ef1fb10fe00b8c7c602e0 100644 (file)
@@ -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 <windows.h>
diff --git a/native/fileWatcher/ReadMe.txt b/native/fileWatcher/ReadMe.txt
deleted file mode 100644 (file)
index 959f007..0000000
+++ /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.
-
-/////////////////////////////////////////////////////////////////////////////
index 8c61739b839849164257642735f1b786c09e9b27..97c32fdbfafb9a121b1b15d489dab62a3fb8a18c 100644 (file)
@@ -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"
 
index bae724d3b6fb2ef39c6d7dfb9f1fce748d7c3a9b..cefe730156ade0d01f3c095c0237c3832697f4d6 100644 (file)
@@ -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 <CoreServices/CoreServices.h>
 #include <sys/mount.h>
 
diff --git a/native/restarter/ReadMe.txt b/native/restarter/ReadMe.txt
deleted file mode 100644 (file)
index 80a9a1c..0000000
+++ /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.
-
-/////////////////////////////////////////////////////////////////////////////
index da16821824752e34c214241f904b3f02f953dc5d..65b1eb214a552fd596a7d037ccae9c6965a7043a 100644 (file)
@@ -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 (file)
index 0000000..ef68f6a
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 (file)
index 0000000..eab7574
Binary files /dev/null and b/platform/icons/src/ide/info_notifications.png differ
index 2d865bb119f059f215fb1632c523b63ed1fb85b0..77bedbcc15e2303640e18a8060ae1f7482cfc272 100644 (file)
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 (file)
index 022bb1b..0000000
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 (file)
index 0000000..ac2d621
Binary files /dev/null and b/platform/icons/src/ide/warning_notifications.png differ
index b69e1672cbbb258075dbf6c8768c9c739f6b2204..82aeb3423aaa11e5ca98a38c5eb9fa249e7b8663 100644 (file)
@@ -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<PsiFile,Editor> place = ShowIntentionActionsHandler.availableFor(psiFile, editor, action, psiElement);
+      if (place != null) {
         List<IntentionAction> enableDisableIntentionAction = new ArrayList<IntentionAction>();
         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;
-  }
 }
index 73ac167c645e98c7428585b92d717892904f2cf4..7d25cc3b1d59c5136d27a84dd6638a8af2426f7e 100644 (file)
@@ -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<IntentionActionWithTextCaching>
 
   private boolean wrapActionsTo(final List<HighlightInfo.IntentionActionDescriptor> descriptors, final Set<IntentionActionWithTextCaching> 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<IntentionAction> 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<IntentionAction> 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<IntentionActionWithTextCaching> cachedActions) {
+  private boolean removeInvalidActions(final Collection<IntentionActionWithTextCaching> cachedActions, final PsiElement element) {
     boolean result = true;
     Iterator<IntentionActionWithTextCaching> iterator = cachedActions.iterator();
     while (iterator.hasNext()) {
       IntentionActionWithTextCaching cachedAction = iterator.next();
       IntentionAction action = cachedAction.getAction();
-      if (!myFile.isValid() || !action.isAvailable(myProject, myEditor, myFile)) {
+      Pair<PsiFile,Editor> place = ShowIntentionActionsHandler.availableFor(myFile, myEditor, action, element);
+      if (place == null) {
         iterator.remove();
         result = false;
       }
index df1c94197e6be09075659b4276c925caf862b73d..f20747b27c1405a153bf9e999e9d70758f6fe108 100644 (file)
@@ -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<PsiFile, Editor> 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<PsiFile, Editor> 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() {
index ba3c7d5d291efebdc3ff8cd5fa2d0d09367095a9..77b4f3d931b7ba5110cb286e140652302dd4370a 100644 (file)
@@ -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();
index adcd4da4db83f810a533d1a28155415e197355e9..bb5dede39a82f5db6aa04ae8f2000349906acac0 100644 (file)
@@ -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;
   }
index b9e1781c3803d01a4662367a3930f4c285293c5d..a4c3c69429b47159df3ab9213f5b1054e5f249df 100644 (file)
@@ -104,7 +104,8 @@ public class NotificationModel {
 
   private LinkedList<Notification> filterNotifications(@NotNull PairFunction<Notification, Project, Boolean> filter) {
     final LinkedList<Notification> result = new LinkedList<Notification>();
-    final HashSet<Map.Entry<Notification, Pair<Project, Boolean>>> entries = new HashSet<Map.Entry<Notification, Pair<Project, Boolean>>>(myNotifications.entrySet());
+    final HashSet<Map.Entry<Notification, Pair<Project, Boolean>>> entries =
+      new HashSet<Map.Entry<Notification, Pair<Project, Boolean>>>(myNotifications.entrySet());
     for (final Map.Entry<Notification, Pair<Project, Boolean>> 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<Notification, Project, Boolean> filter) {
     return getUnreadCount(filter) < myNotifications.size();
   }
+
+  @Nullable
+  public NotificationType getMaximumType(PairFunction<Notification, Project, Boolean> filter) {
+    final LinkedList<Notification> 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;
+  }
 }
index ac076e5ece210dea1e2597c6fb3afd92f81e293f..5130a80723d72420b334a02acc039a9ac956ff77 100644 (file)
@@ -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));
   }
index c876faf73e140d5e34ad32046d323155c868e366..29aaf0aadd1e4c11d2e441668052df859a3d0073 100644 (file)
@@ -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<JBPopup> 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);
index 749e8d94e0c3c291cd98a56e67a4fa26ee1fcaae..86c290934d023a23f4a55dd57e4c1ff698e4d129 100644 (file)
@@ -884,6 +884,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
       fireProjectClosing(project);
 
       myOpenProjects.remove(project);
+      myChangedProjectFiles.remove(project);
       fireProjectClosed(project);
 
       if (save) {
index 51ede83b5cac7b3c344f68d421cbce83849e2dde..fe756a1da8b2e2c517929a30b13a75d7fbd4a95b 100644 (file)
@@ -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);
   }
index 4b1bcc8c6dff3b6794b9108fbeff46236b83f45b..81b7a07acaec67220f786261dc3e6cb8e66bb8e6 100644 (file)
@@ -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();
     }
index e228fa42663615e89f24d40102b6865a9ffc8abb..390375f727c8b98788928a844cb7cf1507c8eeae 100644 (file)
@@ -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<InstrumentationItem> result = new HashSet<InstrumentationItem>();
     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);
index 401bac01486bbd46cc42654c398e57121a5f61e8..084702bf62a36c0be2d305d1642391e264f33048 100644 (file)
           <root url="jar://$MODULE_DIR$/lib/maven-2.2.0-uber.jar!/" />
         </CLASSES>
         <JAVADOC />
-        <SOURCES>
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-toolchain/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-providers/wagon-file/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-plugin-api/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-reporting/maven-reporting-api/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-plugin-registry/target/generated-sources/modello" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-script/maven-script-beanshell/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-providers/wagon-http-shared/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-settings/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-providers/wagon-ftp/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-providers/wagon-ssh/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/plexus/interpolation-1.11/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-providers/wagon-ssh-external/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/plexus/plexus-utils-1.5.15/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-repository-metadata/target/generated-sources/modello" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-profile/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-plugin-registry/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-provider-test/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-artifact/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-artifact-manager/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-compat/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-profile/target/generated-sources/modello" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-settings/target/generated-sources/modello" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-providers/wagon-http/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-plugin-descriptor/target/generated-sources/modello" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-project/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-providers/wagon-webdav-jackrabbit/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-script/maven-script-ant/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-plugin-descriptor/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-plugin-parameter-documenter/target/generated-sources/modello" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-toolchain/target/generated-sources/modello" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-core/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-providers/wagon-ssh-common/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/plexus/plexus-container-default-1.0-alpha-9-stable-1/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-model/target/generated-sources/modello" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-error-diagnostics/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-provider-api/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/components/maven-monitor/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-providers/wagon-http-lightweight/src/main/java" />
-          <root url="file://$MODULE_DIR$/../../../../maven/maven-2.2/wagon/wagon-providers/wagon-scm/src/main/java" />
-        </SOURCES>
+        <SOURCES />
       </library>
     </orderEntry>
     <orderEntry type="module-library">