diff --git a/.idea/modules.xml b/.idea/modules.xml
index e177cad44135..d48c568c7a5d 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -58,7 +58,8 @@
-
+
+
diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant
index 0ef5893a72fc..cd56346c2752 100644
--- a/build/scripts/layouts.gant
+++ b/build/scripts/layouts.gant
@@ -174,10 +174,14 @@ def layoutFull(String home, String targetDirectory) {
layoutPlugin("maven") {
- jar("maven-facade.jar") {
- module("maven-facade")
+ jar("maven-facade-api.jar") {
+ module("maven-facade-api")
}
- fileset(dir: "$home/plugins/maven/lib")
+ jar("maven-facade-impl.jar") {
+ module("maven-facade-impl")
+ }
+ fileset(dir: "$home/plugins/maven/facade-impl/lib")
+ fileset(dir: "$home/plugins/maven/facade-api/lib")
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
index a5f75d1b6229..02c587c440d0 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
@@ -109,20 +109,8 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
LOG.assertTrue(element.isValid());
}
element.accept(this);
-
- if (myRefCountHolder != null) {
- instantiateInjections(element);
- }
}
- private void instantiateInjections(final PsiElement element) {
- InjectedLanguageUtil.enumerate(element, myFile, new PsiLanguageInjectionHost.InjectedPsiVisitor() {
- public void visit(@NotNull final PsiFile injectedPsi, @NotNull final List places) {
- // no op
- }
- }, false);
- }
-
private void registerReferencesFromInjectedFragments(final PsiElement element) {
InjectedLanguageUtil.enumerate(element, myFile, new PsiLanguageInjectionHost.InjectedPsiVisitor() {
public void visit(@NotNull final PsiFile injectedPsi, @NotNull final List places) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveUnusedVariableFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveUnusedVariableFix.java
index 6d12e5e69805..cf9505c1b85c 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveUnusedVariableFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveUnusedVariableFix.java
@@ -39,8 +39,6 @@ import java.util.*;
public class RemoveUnusedVariableFix implements IntentionAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.quickfix.RemoveUnusedVariableFix");
private final PsiVariable myVariable;
- @NonNls private static final String JAVA_LANG_PCKG = "java.lang";
- @NonNls private static final String JAVA_IO_PCKG = "java.io";
public RemoveUnusedVariableFix(PsiVariable variable) {
myVariable = variable;
@@ -356,10 +354,10 @@ public class RemoveUnusedVariableFix implements IntentionAction {
PsiFile file = aClass.getContainingFile();
PsiDirectory directory = file.getContainingDirectory();
PsiPackage classPackage = JavaDirectoryService.getInstance().getPackage(directory);
- String packageName = classPackage.getQualifiedName();
+ String packageName = classPackage == null ? null : classPackage.getQualifiedName();
// all Throwable descendants from java.lang are side effects free
- if (JAVA_LANG_PCKG.equals(packageName) || JAVA_IO_PCKG.equals(packageName)) {
+ if ("java.lang".equals(packageName) || "java.io".equals(packageName)) {
PsiClass throwableClass = JavaPsiFacade.getInstance(aClass.getProject()).findClass("java.lang.Throwable", aClass.getResolveScope());
if (throwableClass != null && InheritanceUtil.isInheritorOrSelf(aClass, throwableClass, true)) {
return true;
diff --git a/java/java-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java b/java/java-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java
index bd7885956600..94422d944b9c 100644
--- a/java/java-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java
+++ b/java/java-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java
@@ -497,7 +497,8 @@ public class PsiPackageImpl extends PsiElementBase implements PsiPackage, Querya
NameHint nameHint = processor.getHint(NameHint.KEY);
if (nameHint != null) {
final String shortName = nameHint.getName(state);
- if (containsClassNamed(shortName) && processClassesByName(processor, state, place, scope, shortName)) return false;
+ if ((migration != null || containsClassNamed(shortName))
+ && processClassesByName(processor, state, place, scope, shortName)) return false;
}
else if (prefixMatcher != null && migration == null) {
for (String className : getClassNamesCache()) {
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/PsiClassReferenceType.java b/java/java-impl/src/com/intellij/psi/impl/source/PsiClassReferenceType.java
index be09f49c2670..0022b749bf5d 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/PsiClassReferenceType.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/PsiClassReferenceType.java
@@ -138,7 +138,9 @@ public class PsiClassReferenceType extends PsiClassType {
return factory.createType(aClass, rawSubstitutor, getLanguageLevel(), getAnnotations());
}
String qualifiedName = myReference.getQualifiedName();
- LightClassReference reference = new LightClassReference(myReference.getManager(), myReference.getReferenceName(), qualifiedName, myReference.getResolveScope());
+ String name = myReference.getReferenceName();
+ if (name==null) name="";
+ LightClassReference reference = new LightClassReference(myReference.getManager(), name, qualifiedName, myReference.getResolveScope());
return new PsiClassReferenceType(reference, null,getAnnotations());
}
diff --git a/java/openapi/src/com/intellij/psi/util/PropertyUtil.java b/java/openapi/src/com/intellij/psi/util/PropertyUtil.java
index 615dce0ebb35..ec4cb396e9a4 100644
--- a/java/openapi/src/com/intellij/psi/util/PropertyUtil.java
+++ b/java/openapi/src/com/intellij/psi/util/PropertyUtil.java
@@ -54,16 +54,17 @@ public class PropertyUtil {
String methodName = method.getName();
PsiType returnType = method.getReturnType();
- if (methodName.startsWith("get") && methodName.length() > "get".length()) {
+ int methodNameLength = methodName.length();
+ if (methodName.startsWith("get") && methodNameLength > "get".length()) {
if (Character.isLowerCase(methodName.charAt("get".length()))
- && (methodName.length() == "get".length() + 1 || Character.isLowerCase(methodName.charAt("get".length() + 1)))) {
+ && (methodNameLength == "get".length() + 1 || Character.isLowerCase(methodName.charAt("get".length() + 1)))) {
return false;
}
if (returnType != null && PsiType.VOID.equals(returnType)) return false;
}
- else if (methodName.startsWith("is") && methodName.length() > "is".length()) {
+ else if (methodName.startsWith("is") && methodNameLength > "is".length()) {
if (Character.isLowerCase(methodName.charAt("is".length()))
- && (methodName.length() == "is".length() + 1 || Character.isLowerCase(methodName.charAt("is".length() + 1)))) {
+ && (methodNameLength == "is".length() + 1 || Character.isLowerCase(methodName.charAt("is".length() + 1)))) {
return false;
}
return isBoolean(returnType);
@@ -209,7 +210,8 @@ public class PropertyUtil {
return null;
}
- @Nullable public static PsiMethod findPropertyGetterWithType(String propertyName, boolean isStatic, PsiType type, Iterator methods) {
+ @Nullable
+ public static PsiMethod findPropertyGetterWithType(String propertyName, boolean isStatic, PsiType type, Iterator methods) {
while (methods.hasNext()) {
PsiMethod method = methods.next();
if (method.hasModifierProperty(PsiModifier.STATIC) != isStatic) continue;
@@ -252,7 +254,8 @@ public class PropertyUtil {
return null;
}
- @Nullable public static PsiMethod findPropertySetterWithType(String propertyName, boolean isStatic, PsiType type, Iterator methods) {
+ @Nullable
+ public static PsiMethod findPropertySetterWithType(String propertyName, boolean isStatic, PsiType type, Iterator methods) {
while (methods.hasNext()) {
PsiMethod method = methods.next();
if (method.hasModifierProperty(PsiModifier.STATIC) != isStatic) continue;
@@ -500,7 +503,8 @@ public class PropertyUtil {
/**
* "xxx", "void setMyProperty(String pp)" -> "setXxx"
*/
- @Nullable public static String suggestPropertyAccessor(String name, PsiMethod accessorTemplate) {
+ @Nullable
+ public static String suggestPropertyAccessor(String name, PsiMethod accessorTemplate) {
if (isSimplePropertyGetter(accessorTemplate)) {
PsiType type = accessorTemplate.getReturnType();
return suggestGetterName(name, type, accessorTemplate.getName());
diff --git a/native/fsNotifier/linux/fsnotifier b/native/fsNotifier/linux/fsnotifier
index 3d84ba68c1c2..9290ab239af5 100755
Binary files a/native/fsNotifier/linux/fsnotifier and b/native/fsNotifier/linux/fsnotifier differ
diff --git a/native/fsNotifier/linux/fsnotifier64 b/native/fsNotifier/linux/fsnotifier64
index 1c959e2ddfb8..3a573dd7a183 100755
Binary files a/native/fsNotifier/linux/fsnotifier64 and b/native/fsNotifier/linux/fsnotifier64 differ
diff --git a/native/fsNotifier/linux/inotify.c b/native/fsNotifier/linux/inotify.c
index b3306e5c64ed..411a6def1733 100644
--- a/native/fsNotifier/linux/inotify.c
+++ b/native/fsNotifier/linux/inotify.c
@@ -284,7 +284,9 @@ static int walk_tree(const char* path, watch_node* parent, array* ignores) {
int watch(const char* root, array* ignores) {
- return walk_tree(root, NULL, ignores);
+ char buf[PATH_MAX];
+ const char* normalized = realpath(root, buf);
+ return walk_tree((normalized != NULL ? normalized : root), NULL, ignores);
}
diff --git a/native/fsNotifier/linux/make.sh b/native/fsNotifier/linux/make.sh
index e2741da2778d..f2ec112fc406 100755
--- a/native/fsNotifier/linux/make.sh
+++ b/native/fsNotifier/linux/make.sh
@@ -1,2 +1,5 @@
+#!/bin/sh
+echo "compiling 32-bit version"
gcc -O2 -m32 -Wall -std=c99 -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -o fsnotifier main.c inotify.c util.c
+echo "compiling 64-bit version"
gcc -O2 -m64 -Wall -std=c99 -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -o fsnotifier64 main.c inotify.c util.c
diff --git a/platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java b/platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java
index f74fa8690af7..ea75268d6e7d 100644
--- a/platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java
+++ b/platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java
@@ -18,7 +18,6 @@ package com.intellij.execution.configurations;
import com.intellij.execution.*;
import com.intellij.execution.executors.DefaultRunExecutor;
import com.intellij.execution.filters.TextConsoleBuilder;
-import com.intellij.execution.process.OSProcessHandler;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.runners.ProgramRunner;
@@ -61,7 +60,7 @@ public abstract class CommandLineState implements RunnableState {
return new DefaultExecutionResult(console, processHandler, createActions(console, processHandler, executor));
}
- protected abstract OSProcessHandler startProcess() throws ExecutionException;
+ protected abstract ProcessHandler startProcess() throws ExecutionException;
protected AnAction[] createActions(final ConsoleView console, final ProcessHandler processHandler) {
return createActions(console, processHandler, null);
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CollectHighlightsUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CollectHighlightsUtil.java
index 6afc04842402..59f11b128a57 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CollectHighlightsUtil.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CollectHighlightsUtil.java
@@ -26,10 +26,13 @@ import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.*;
+import com.intellij.psi.PsiCodeFragment;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtilBase;
-import gnu.trove.TIntArrayList;
+import com.intellij.util.containers.Stack;
+import gnu.trove.TIntStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -37,7 +40,7 @@ import java.util.ArrayList;
import java.util.List;
public class CollectHighlightsUtil {
- private static final ExtensionPointName> EP_NAME = ExtensionPointName.create("com.intellij.elementsToHighlightFilter");
+ public static final ExtensionPointName> EP_NAME = ExtensionPointName.create("com.intellij.elementsToHighlightFilter");
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.CollectHighlightsUtil");
@@ -76,65 +79,58 @@ public class CollectHighlightsUtil {
final int currentOffset = commonParent.getTextRange().getStartOffset();
final Condition[] filters = Extensions.getExtensions(EP_NAME);
- final PsiElementVisitor visitor = new PsiElementVisitor() {
- int offset = currentOffset;
-
- final TIntArrayList starts = new TIntArrayList(STARTING_TREE_HEIGHT);
- final List elements = new ArrayList(STARTING_TREE_HEIGHT);
- final List children = new ArrayList(STARTING_TREE_HEIGHT);
-
- @Override public void visitElement(PsiElement element) {
- children.add(PsiUtilBase.NULL_PSI_ELEMENT);
-
- while (true) {
- ProgressManager.checkCanceled();
-
- PsiElement child = children.remove(children.size() - 1);
+ int offset = currentOffset;
- for (Condition filter : filters) {
- if (!filter.value(element)) {
- assert child == PsiUtilBase.NULL_PSI_ELEMENT;
- child = null; // do not want to process children
- break;
- }
- }
+ final TIntStack starts = new TIntStack(STARTING_TREE_HEIGHT);
+ final Stack elements = new Stack(STARTING_TREE_HEIGHT);
+ final Stack children = new Stack(STARTING_TREE_HEIGHT);
+ PsiElement element = commonParent;
- boolean startChildrenVisiting = false;
+ PsiElement child = PsiUtilBase.NULL_PSI_ELEMENT;
+ while (true) {
+ ProgressManager.checkCanceled();
- if (child == PsiUtilBase.NULL_PSI_ELEMENT) {
- startChildrenVisiting = true;
- child = element.getFirstChild();
- }
-
- if (child == null) {
- if (startChildrenVisiting) {
- // leaf element
- offset += element.getTextLength();
- }
-
- if (elements.size() == 0) break;
- int start = starts.remove(starts.size() - 1);
- if (startOffset <= start && offset <= endOffset) result.add(element);
-
- element = elements.remove(elements.size() - 1);
- }
- else {
- // composite element
- if (offset <= endOffset) {
- starts.add(offset);
- children.add(child.getNextSibling());
- children.add(PsiUtilBase.NULL_PSI_ELEMENT);
- elements.add(element);
- element = child;
- } else {
- break;
- }
- }
+ for (Condition filter : filters) {
+ if (!filter.value(element)) {
+ assert child == PsiUtilBase.NULL_PSI_ELEMENT;
+ child = null; // do not want to process children
+ break;
}
}
- };
- commonParent.accept(visitor);
-
+
+ boolean startChildrenVisiting;
+ if (child == PsiUtilBase.NULL_PSI_ELEMENT) {
+ startChildrenVisiting = true;
+ child = element.getFirstChild();
+ }
+ else {
+ startChildrenVisiting = false;
+ }
+
+ if (child == null) {
+ if (startChildrenVisiting) {
+ // leaf element
+ offset += element.getTextLength();
+ }
+
+ if (elements.isEmpty()) break;
+ int start = starts.pop();
+ if (startOffset <= start && offset <= endOffset) result.add(element);
+
+ element = elements.pop();
+ child = children.pop();
+ }
+ else {
+ // composite element
+ if (offset > endOffset) break;
+ children.push(child.getNextSibling());
+ starts.push(offset);
+ elements.push(element);
+ element = child;
+ child = PsiUtilBase.NULL_PSI_ELEMENT;
+ }
+ }
+
return result;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java
index 98e0398777e2..6c14fadc30d7 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java
@@ -16,35 +16,54 @@
package com.intellij.codeInsight.daemon.impl;
-import com.intellij.codeHighlighting.*;
+import com.intellij.codeHighlighting.BackgroundEditorHighlighter;
+import com.intellij.codeHighlighting.HighlightingPass;
import com.intellij.codeHighlighting.Pass;
-import com.intellij.codeInsight.daemon.*;
-import com.intellij.codeInsight.hint.*;
-import com.intellij.codeInsight.intention.impl.*;
-import com.intellij.concurrency.*;
-import com.intellij.lang.annotation.*;
-import com.intellij.openapi.application.*;
-import com.intellij.openapi.diagnostic.*;
+import com.intellij.codeHighlighting.TextEditorHighlightingPass;
+import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
+import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings;
+import com.intellij.codeInsight.daemon.LineMarkerInfo;
+import com.intellij.codeInsight.daemon.ReferenceImporter;
+import com.intellij.codeInsight.hint.HintManager;
+import com.intellij.codeInsight.intention.impl.IntentionHintComponent;
+import com.intellij.concurrency.Job;
+import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.*;
-import com.intellij.openapi.editor.ex.*;
-import com.intellij.openapi.editor.markup.*;
-import com.intellij.openapi.extensions.*;
-import com.intellij.openapi.fileEditor.*;
-import com.intellij.openapi.fileEditor.impl.text.*;
-import com.intellij.openapi.fileTypes.*;
-import com.intellij.openapi.progress.*;
-import com.intellij.openapi.project.*;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.ex.EditorMarkupModel;
+import com.intellij.openapi.editor.markup.MarkupModel;
+import com.intellij.openapi.editor.markup.RangeHighlighter;
+import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.fileEditor.FileEditor;
+import com.intellij.openapi.fileEditor.TextEditor;
+import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.*;
-import com.intellij.openapi.vfs.*;
-import com.intellij.packageDependencies.*;
-import com.intellij.psi.*;
-import com.intellij.psi.search.scope.packageSet.*;
-import com.intellij.util.*;
-import com.intellij.util.containers.*;
-import gnu.trove.*;
-import org.jdom.*;
-import org.jetbrains.annotations.*;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileManager;
+import com.intellij.packageDependencies.DependencyValidationManager;
+import com.intellij.psi.PsiCompiledElement;
+import com.intellij.psi.PsiDocumentManager;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiFileSystemItem;
+import com.intellij.psi.search.scope.packageSet.NamedScope;
+import com.intellij.psi.search.scope.packageSet.NamedScopeManager;
+import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
+import com.intellij.util.Alarm;
+import com.intellij.util.SmartList;
+import com.intellij.util.containers.ContainerUtil;
+import gnu.trove.THashMap;
+import gnu.trove.THashSet;
+import org.jdom.Element;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
import java.util.*;
@@ -82,6 +101,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
@NonNls private static final String FILE_TAG = "file";
@NonNls private static final String URL_ATT = "url";
private DaemonListeners myDaemonListeners;
+ private StatusBarUpdater myStatusBarUpdater;
private final PassExecutorService myPassExecutorService;
private static final Key> HIGHLIGHTS_TO_REMOVE_KEY = Key.create("HIGHLIGHTS_TO_REMOVE");
private int myModificationCount = 0;
@@ -126,6 +146,9 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
public void projectOpened() {
assert !myInitialized : "Double Initializing";
+ myStatusBarUpdater = new StatusBarUpdater(myProject);
+ Disposer.register(myProject, myStatusBarUpdater);
+
myDaemonListeners = new DaemonListeners(myProject, this, myEditorTracker);
Disposer.register(myProject, myDaemonListeners);
reloadScopes();
@@ -451,6 +474,11 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
markup.putUserData(HIGHLIGHTS_IN_EDITOR_DOCUMENT_KEY, Collections.unmodifiableList(highlightsToSet));
markup.putUserData(HIGHLIGHTS_TO_REMOVE_KEY, Collections.unmodifiableList(highlightsToRemove));
+
+ DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(project);
+ if (codeAnalyzer instanceof DaemonCodeAnalyzerImpl && ((DaemonCodeAnalyzerImpl)codeAnalyzer).myStatusBarUpdater != null) {
+ ((DaemonCodeAnalyzerImpl)codeAnalyzer).myStatusBarUpdater.updateStatus();
+ }
}
private static void stripWarningsCoveredByErrors(final Project project, List highlights, MarkupModel markup) {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/StatusBarUpdater.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/StatusBarUpdater.java
new file mode 100644
index 000000000000..67c7ddebd635
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/StatusBarUpdater.java
@@ -0,0 +1,94 @@
+
+/*
+ * 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.
+ */
+
+package com.intellij.codeInsight.daemon.impl;
+
+import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.EditorFactory;
+import com.intellij.openapi.editor.event.CaretEvent;
+import com.intellij.openapi.editor.event.CaretListener;
+import com.intellij.openapi.editor.ex.DocumentEx;
+import com.intellij.openapi.fileEditor.FileEditorManager;
+import com.intellij.openapi.fileEditor.FileEditorManagerAdapter;
+import com.intellij.openapi.fileEditor.FileEditorManagerEvent;
+import com.intellij.openapi.fileEditor.FileEditorManagerListener;
+import com.intellij.openapi.project.DumbAwareRunnable;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.wm.StatusBar;
+import com.intellij.openapi.wm.WindowManager;
+import com.intellij.openapi.wm.ex.StatusBarEx;
+
+public class StatusBarUpdater implements Disposable {
+ private final Project myProject;
+ private final UpdateStatusRunnable myUpdateStatusRunnable = new UpdateStatusRunnable();
+
+ public StatusBarUpdater(Project project) {
+ myProject = project;
+
+ CaretListener caretListener = new CaretListener() {
+ public void caretPositionChanged(CaretEvent e) {
+ ApplicationManager.getApplication().invokeLater(myUpdateStatusRunnable);
+ }
+ };
+ EditorFactory.getInstance().getEventMulticaster().addCaretListener(caretListener, this);
+
+ project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
+ @Override
+ public void selectionChanged(FileEditorManagerEvent event) {
+ ApplicationManager.getApplication().invokeLater(myUpdateStatusRunnable);
+ }
+ });
+ }
+
+ public void dispose() {
+ }
+
+ public void updateStatus() {
+ Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor();
+ if (editor == null || !editor.getContentComponent().hasFocus()){
+ return;
+ }
+
+ final Document document = editor.getDocument();
+ if (document instanceof DocumentEx && ((DocumentEx)document).isInBulkUpdate()) return;
+
+ int offset = editor.getCaretModel().getOffset();
+ DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject);
+ HighlightInfo info = ((DaemonCodeAnalyzerImpl)codeAnalyzer).findHighlightByOffset(document, offset, false);
+ String text = info != null && info.description != null ? info.description : "";
+
+ StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
+ if (statusBar instanceof StatusBarEx) {
+ StatusBarEx barEx = (StatusBarEx)statusBar;
+ if (!text.equals(barEx.getInfo())){
+ statusBar.setInfo(text);
+ }
+ }
+ }
+
+ private class UpdateStatusRunnable implements DumbAwareRunnable {
+ public void run() {
+ if (!myProject.isDisposed()) {
+ updateStatus();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterAction.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterAction.java
index 4fdf4dfad206..23f66a8cb3ad 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterAction.java
@@ -33,8 +33,6 @@ import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.util.text.CharArrayUtil;
-import java.util.List;
-
/**
* @author max
*/
@@ -91,14 +89,9 @@ public class SmartEnterAction extends EditorAction {
final Language language = PsiUtilBase.getLanguageInEditor(editor, project);
boolean processed = false;
if (language != null) {
- final List processors = SmartEnterProcessors.INSTANCE.forKey(language);
- if (!processors.isEmpty()) {
- for (SmartEnterProcessor processor : processors) {
- if (processor.process(project, editor, psiFile)) {
- processed = true;
- break;
- }
- }
+ final SmartEnterProcessor processor = SmartEnterProcessors.INSTANCE.forLanguage(language);
+ if (processor != null && processor.process(project, editor, psiFile)) {
+ processed = true;
}
}
if (!processed) {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/problems/WolfTheProblemSolverImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/problems/WolfTheProblemSolverImpl.java
index 4318a65a2cb6..69624d0e7bb4 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/problems/WolfTheProblemSolverImpl.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/problems/WolfTheProblemSolverImpl.java
@@ -73,25 +73,6 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
}
};
- private final VirtualFileListener myVirtualFileListener = new VirtualFileAdapter() {
- public void fileDeleted(final VirtualFileEvent event) {
- onDeleted(event.getFile());
- }
-
- public void fileMoved(final VirtualFileMoveEvent event) {
- onDeleted(event.getFile());
- }
-
- private void onDeleted(final VirtualFile file) {
- if (file.isDirectory()) {
- clearInvalidFiles();
- }
- else {
- doRemove(file);
- }
- }
- };
-
private void doRemove(VirtualFile problemFile) {
ProblemFileInfo old;
synchronized (myProblems) {
@@ -106,8 +87,6 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
}
}
- private final PsiTreeChangeListener myChangeListener;
-
private static class ProblemFileInfo {
private final Collection problems = new THashSet();
private boolean hasSyntaxErrors;
@@ -118,10 +97,7 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
final ProblemFileInfo that = (ProblemFileInfo)o;
- if (hasSyntaxErrors != that.hasSyntaxErrors) return false;
- if (!problems.equals(that.problems)) return false;
-
- return true;
+ return hasSyntaxErrors == that.hasSyntaxErrors && problems.equals(that.problems);
}
public int hashCode() {
@@ -133,7 +109,7 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
public WolfTheProblemSolverImpl(Project project, PsiManager psiManager, VirtualFileManager virtualFileManager) {
myProject = project;
- myChangeListener = new PsiTreeChangeAdapter() {
+ PsiTreeChangeListener changeListener = new PsiTreeChangeAdapter() {
public void childAdded(PsiTreeChangeEvent event) {
childrenChanged(event);
}
@@ -158,8 +134,26 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
clearSyntaxErrorFlag(event);
}
};
- psiManager.addPsiTreeChangeListener(myChangeListener);
- virtualFileManager.addVirtualFileListener(myVirtualFileListener, myProject);
+ psiManager.addPsiTreeChangeListener(changeListener);
+ VirtualFileListener virtualFileListener = new VirtualFileAdapter() {
+ public void fileDeleted(final VirtualFileEvent event) {
+ onDeleted(event.getFile());
+ }
+
+ public void fileMoved(final VirtualFileMoveEvent event) {
+ onDeleted(event.getFile());
+ }
+
+ private void onDeleted(final VirtualFile file) {
+ if (file.isDirectory()) {
+ clearInvalidFiles();
+ }
+ else {
+ doRemove(file);
+ }
+ }
+ };
+ virtualFileManager.addVirtualFileListener(virtualFileListener, myProject);
FileStatusManager fileStatusManager = FileStatusManager.getInstance(myProject);
if (fileStatusManager != null) { //tests?
fileStatusManager.addFileStatusListener(new FileStatusListener() {
diff --git a/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java b/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java
index 9da838b8559e..bd514d0da822 100644
--- a/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java
+++ b/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java
@@ -13,8 +13,8 @@ import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.execution.runners.DefaultProgramRunner;
import com.intellij.execution.runners.ProgramRunner;
import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Ref;
@@ -34,20 +34,16 @@ import java.util.List;
* @author Gregory.Shrago
*/
public abstract class RemoteProcessSupport {
- private final Project myProject;
+ public static final Logger LOG = Logger.getInstance("#" + RemoteProcessSupport.class);
+
private final Class myValueClass;
private final HashMap, Object> myProcMap =
new HashMap, Object>();
- public RemoteProcessSupport(Project project, Class valueClass) {
- myProject = project;
+ public RemoteProcessSupport(Class valueClass) {
myValueClass = valueClass;
}
- public Project getProject() {
- return myProject;
- }
-
protected abstract void fireModificationCountChanged();
protected abstract String getName(Target target);
@@ -55,7 +51,6 @@ public abstract class RemoteProcessSupport {
protected void logText(Parameters configuration, ProcessEvent event, Key outputType, Object info) {
}
-
public void stopAll() {
final ArrayList allHandlers = new ArrayList();
synchronized (myProcMap) {
@@ -86,17 +81,7 @@ public abstract class RemoteProcessSupport {
final Ref ref = Ref.create(null);
final Pair key = Pair.create(target, configuration);
if (!getExistingInfo(ref, key)) {
- final Runnable runnable = new Runnable() {
- public void run() {
- startProcess(target, configuration, key);
- }
- };
- if (ApplicationManager.getApplication().isDispatchThread()) {
- runnable.run();
- }
- else {
- ApplicationManager.getApplication().invokeLater(runnable);
- }
+ startProcess(target, configuration, key);
if (ref.isNull()) {
try {
synchronized (ref) {
@@ -166,7 +151,8 @@ public abstract class RemoteProcessSupport {
}
}
- protected abstract RunProfileState getRunProfileState(Target target, Parameters configuration, Executor executor) throws ExecutionException;
+ protected abstract RunProfileState getRunProfileState(Target target, Parameters configuration, Executor executor)
+ throws ExecutionException;
private boolean getExistingInfo(Ref ref, final Pair key) {
Object info;
@@ -214,7 +200,7 @@ public abstract class RemoteProcessSupport {
}
private static T narrowImpl(Remote remote, Class to) {
- return (T) (to.isInstance(remote)? remote : PortableRemoteObject.narrow(remote, to));
+ return (T)(to.isInstance(remote) ? remote : PortableRemoteObject.narrow(remote, to));
}
private ProcessListener getProcessListener(final Pair key) {
@@ -240,6 +226,13 @@ public abstract class RemoteProcessSupport {
}
public void onTextAvailable(ProcessEvent event, Key outputType) {
+ if (outputType == ProcessOutputTypes.STDERR) {
+ LOG.warn(event.getText());
+ }
+ else {
+ LOG.info(event.getText());
+ }
+
Info result = null;
final PendingInfo info;
synchronized (myProcMap) {
@@ -262,7 +255,9 @@ public abstract class RemoteProcessSupport {
info.stderr.append(event.getText());
}
}
- else info = null;
+ else {
+ info = null;
+ }
}
if (result != null) {
synchronized (info.ref) {
@@ -280,8 +275,8 @@ public abstract class RemoteProcessSupport {
final PendingInfo pendingInfo;
synchronized (myProcMap) {
o = myProcMap.remove(key);
- pendingInfo = o instanceof PendingInfo? (PendingInfo)o : null;
- if (pendingInfo != null && (pendingInfo.stderr.length() > 0 || pendingInfo.ref.isNull())) {
+ pendingInfo = o instanceof PendingInfo ? (PendingInfo)o : null;
+ if (pendingInfo != null && (pendingInfo.stderr.length() > 0 || pendingInfo.ref.isNull())) {
if (errorMessage != null) pendingInfo.stderr.append(errorMessage);
pendingInfo.ref.set(new Info(null, -1, pendingInfo.stderr.toString()));
}
diff --git a/platform/lang-impl/src/com/intellij/extapi/psi/ASTDelegatePsiElement.java b/platform/lang-impl/src/com/intellij/extapi/psi/ASTDelegatePsiElement.java
index 5dbb53923a0d..308512ecd921 100644
--- a/platform/lang-impl/src/com/intellij/extapi/psi/ASTDelegatePsiElement.java
+++ b/platform/lang-impl/src/com/intellij/extapi/psi/ASTDelegatePsiElement.java
@@ -148,17 +148,33 @@ public abstract class ASTDelegatePsiElement extends PsiElementBase {
return node == null ? null : node.getPsi();
}
+ @NotNull
+ protected PsiElement findNotNullChildByType(IElementType type) {
+ return notNullChild(findChildByType(type));
+ }
+
+ @Nullable
protected PsiElement findChildByType(TokenSet type) {
ASTNode node = getNode().findChildByType(type);
return node == null ? null : node.getPsi();
}
+ @NotNull
+ protected PsiElement findNotNullChildByType(TokenSet type) {
+ return notNullChild(findChildByType(type));
+ }
+
@Nullable
protected PsiElement findChildByFilter(TokenSet tokenSet) {
ASTNode[] nodes = getNode().getChildren(tokenSet);
return nodes == null || nodes.length == 0 ? null : nodes[0].getPsi();
}
+ @NotNull
+ protected PsiElement findNotNullChildByFilter(TokenSet tokenSet) {
+ return notNullChild(findChildByFilter(tokenSet));
+ }
+
protected T[] findChildrenByType(IElementType elementType, Class arrayClass) {
return ContainerUtil.map2Array(SharedImplUtil.getChildrenOfType(getNode(), elementType), arrayClass, new Function() {
public T fun(final ASTNode s) {
diff --git a/platform/lang-impl/src/com/intellij/extapi/psi/PsiElementBase.java b/platform/lang-impl/src/com/intellij/extapi/psi/PsiElementBase.java
index 51b3594a0fda..6a238c15a1aa 100644
--- a/platform/lang-impl/src/com/intellij/extapi/psi/PsiElementBase.java
+++ b/platform/lang-impl/src/com/intellij/extapi/psi/PsiElementBase.java
@@ -241,7 +241,11 @@ public abstract class PsiElementBase extends ElementBase implements NavigatableP
@NotNull
protected T findNotNullChildByClass(Class aClass) {
- final T child = findChildByClass(aClass);
+ return notNullChild(findChildByClass(aClass));
+ }
+
+ @NotNull
+ protected T notNullChild(T child) {
if (child == null) {
LOG.error(getText() + "\n parent=" + getParent().getText());
}
diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/FileTemplateUtil.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/FileTemplateUtil.java
index 2bfc43b57dc4..9f763221b164 100644
--- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/FileTemplateUtil.java
+++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/FileTemplateUtil.java
@@ -213,7 +213,7 @@ public class FileTemplateUtil{
};
Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, emptyLogSystem);
Velocity.setProperty(RuntimeConstants.RESOURCE_LOADER, "file,class");
- //todo[myakovlev] implement my oun Loader, with ability to load templates from classpath
+ //todo[myakovlev] implement my own Loader, with ability to load templates from classpath
Velocity.setProperty("file.resource.loader.class", MyFileResourceLoader.class.getName());
Velocity.setProperty("class.resource.loader.class", MyClasspathResourceLoader.class.getName());
Velocity.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, modifiedPatternsPath.getAbsolutePath());
@@ -321,7 +321,7 @@ public class FileTemplateUtil{
File modifiedPatternsPath = new File(PathManager.getConfigPath());
modifiedPatternsPath = new File(modifiedPatternsPath, INCLUDES_PATH);
- try{
+ try {
Field pathsField = FileResourceLoader.class.getDeclaredField("paths");
pathsField.setAccessible(true);
Collection paths = (Collection)pathsField.get(this);
@@ -333,12 +333,13 @@ public class FileTemplateUtil{
paths.add(testsDir.getAbsolutePath());
}
}
- catch (Exception e){
+ catch (Exception e) {
+ LOG.error(e);
throw new RuntimeException(e);
}
}
}
-
+
public static boolean canCreateFromTemplate (PsiDirectory[] dirs, FileTemplate template) {
FileType fileType = FileTypeManagerEx.getInstanceEx().getFileTypeByExtension(template.getExtension());
if (fileType.equals(FileTypes.UNKNOWN)) return false;
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/BaseProjectTreeBuilder.java b/platform/lang-impl/src/com/intellij/ide/projectView/BaseProjectTreeBuilder.java
index 62c157186e1d..ae4abf72fef1 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/BaseProjectTreeBuilder.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/BaseProjectTreeBuilder.java
@@ -25,24 +25,22 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Progressive;
import com.intellij.openapi.progress.util.StatusBarProgress;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.ActionCallback;
-import com.intellij.openapi.util.AsyncResult;
-import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.util.Conditions;
+import com.intellij.openapi.util.*;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.psi.PsiDirectory;
+import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiFileSystemItem;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
+import java.util.*;
public abstract class BaseProjectTreeBuilder extends AbstractTreeBuilder {
protected final Project myProject;
@@ -52,10 +50,54 @@ public abstract class BaseProjectTreeBuilder extends AbstractTreeBuilder {
DefaultTreeModel treeModel,
AbstractTreeStructure treeStructure,
Comparator comparator) {
- super(tree, treeModel, treeStructure, comparator);
+ init(tree, treeModel, new AbstractTreeStructure.Delegate(treeStructure) {
+ @Override
+ public AsyncResult revalidateElement(Object element) {
+ return _revalidateElement(element);
+ }
+ }, comparator, DEFAULT_UPDATE_INACTIVE);
myProject = project;
}
+ private AsyncResult _revalidateElement(Object element) {
+ final AsyncResult