diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/NewLibraryEditor.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/NewLibraryEditor.java index 412e21d0584b..7f74f68b1b0e 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/NewLibraryEditor.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/NewLibraryEditor.java @@ -81,6 +81,10 @@ public class NewLibraryEditor implements LibraryEditor { List result = new ArrayList(); for (LightFilePointer pointer : myRoots.get(rootType)) { final VirtualFile file = pointer.getFile(); + if (file == null) { + continue; + } + if (file.isDirectory()) { final Boolean recursively = myJarDirectories.get(file.getUrl()); if (recursively != null) { diff --git a/platform/lang-api/src/com/intellij/psi/util/PsiFilter.java b/platform/lang-api/src/com/intellij/psi/util/PsiFilter.java index 3a8d5034f50d..0a6dec43eca6 100644 --- a/platform/lang-api/src/com/intellij/psi/util/PsiFilter.java +++ b/platform/lang-api/src/com/intellij/psi/util/PsiFilter.java @@ -17,8 +17,11 @@ package com.intellij.psi.util; import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiRecursiveElementVisitor; import org.jetbrains.annotations.NotNull; +import java.util.List; + /** * @author Konstantin Bulenkov */ @@ -41,4 +44,29 @@ public class PsiFilter { public boolean areEquivalent(T e1, T e2) { return e1.isEquivalentTo(e2); } + + public Visitor createVisitor(List elements) { + return new Visitor(this, elements); + } + + public static class Visitor extends PsiRecursiveElementVisitor { + private final PsiFilter filter; + private final List elements; + + protected Visitor(final PsiFilter filter, final List elements) { + this.filter = filter; + this.elements = elements; + } + + @Override + public void visitElement(PsiElement element) { + if (filter.getParentClass().isAssignableFrom(element.getClass())) { + final T e = (T)element; + if (filter.accept(e)) { + elements.add(e); + } + } + super.visitElement(element); + } + } } diff --git a/platform/lang-impl/src/com/intellij/openapi/vcs/changes/PsiChangeTracker.java b/platform/lang-impl/src/com/intellij/openapi/vcs/changes/PsiChangeTracker.java index 016c27062dbb..d8d0b5e6f85f 100644 --- a/platform/lang-impl/src/com/intellij/openapi/vcs/changes/PsiChangeTracker.java +++ b/platform/lang-impl/src/com/intellij/openapi/vcs/changes/PsiChangeTracker.java @@ -22,7 +22,6 @@ import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileEditor.impl.LoadTextUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; -import com.intellij.psi.util.PsiFilter; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.FileStatus; import com.intellij.openapi.vcs.FileStatusManager; @@ -31,7 +30,7 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFileFactory; -import com.intellij.psi.PsiRecursiveElementVisitor; +import com.intellij.psi.util.PsiFilter; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -64,14 +63,14 @@ public class PsiChangeTracker { final List elements = new ArrayList(); if (file == null) { - oldFile.accept(new MyVisitor(filter, oldElements)); + oldFile.accept(filter.createVisitor(oldElements)); calculateStatuses(elements, oldElements, result, filter); return result; } final Project project = file.getProject(); - file.accept(new MyVisitor(filter, elements)); + file.accept(filter.createVisitor(elements)); final VirtualFile vf = file.getVirtualFile(); FileStatus status = vf == null ? null : FileStatusManager.getInstance(project).getStatus(vf); if (status == null && oldFile == null) { @@ -88,7 +87,7 @@ public class PsiChangeTracker { } if (oldFile == null) return result; - oldFile.accept(new MyVisitor(filter, oldElements)); + oldFile.accept(filter.createVisitor(oldElements)); calculateStatuses(elements, oldElements, result, filter); return result; @@ -155,25 +154,4 @@ public class PsiChangeTracker { return null; } - - static class MyVisitor extends PsiRecursiveElementVisitor { - private final PsiFilter filter; - private final List elements; - - protected MyVisitor(final PsiFilter filter, final List elements) { - this.filter = filter; - this.elements = elements; - } - - @Override - public void visitElement(PsiElement element) { - if (filter.getParentClass().isAssignableFrom(element.getClass())) { - final T e = (T)element; - if (filter.accept(e)) { - elements.add(e); - } - } - super.visitElement(element); - } - } } diff --git a/platform/platform-api/src/com/intellij/notification/Notifications.java b/platform/platform-api/src/com/intellij/notification/Notifications.java index e056d4ee7f37..1b214dec7cb7 100644 --- a/platform/platform-api/src/com/intellij/notification/Notifications.java +++ b/platform/platform-api/src/com/intellij/notification/Notifications.java @@ -58,17 +58,8 @@ public interface Notifications { }); } else { - if (EventQueue.isDispatchThread()) { - project.getMessageBus().syncPublisher(TOPIC).notify(notification, defaultDisplayType); - } - else { - //noinspection SSBasedInspection - SwingUtilities.invokeLater(new Runnable() { - public void run() { - project.getMessageBus().syncPublisher(TOPIC).notify(notification, defaultDisplayType); - } - }); - } + final MessageBus bus = project.getMessageBus(); + _notify(notification, defaultDisplayType, bus); } return; @@ -80,20 +71,24 @@ public interface Notifications { final MessageBus bus = project == null ? ApplicationManager.getApplication().getMessageBus() : (project.isDisposed() ? null : project.getMessageBus()); if (bus != null) { - if (EventQueue.isDispatchThread()) { - bus.syncPublisher(TOPIC).notify(notification, defaultDisplayType); - } - else { - //noinspection SSBasedInspection - SwingUtilities.invokeLater(new Runnable() { - public void run() { - bus.syncPublisher(TOPIC).notify(notification, defaultDisplayType); - } - }); - } + _notify(notification, defaultDisplayType, bus); } } }); } + + private static void _notify(final Notification notification, final NotificationDisplayType defaultDisplayType, final MessageBus bus) { + if (EventQueue.isDispatchThread()) { + bus.syncPublisher(TOPIC).notify(notification, defaultDisplayType); + } + else { + //noinspection SSBasedInspection + SwingUtilities.invokeLater(new Runnable() { + public void run() { + bus.syncPublisher(TOPIC).notify(notification, defaultDisplayType); + } + }); + } + } } } diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/LightFilePointer.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/LightFilePointer.java index a4315c359ade..74958b2b001f 100644 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/LightFilePointer.java +++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/LightFilePointer.java @@ -19,6 +19,7 @@ import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.File; @@ -35,6 +36,7 @@ public class LightFilePointer { myFile = file; } + @Nullable public VirtualFile getFile() { refreshFile(); return myFile; diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValueNode.java b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValueNode.java index 600a4cdd078b..4c003c468754 100644 --- a/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValueNode.java +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValueNode.java @@ -30,7 +30,6 @@ import javax.swing.*; * @author nik */ public interface XValueNode extends Obsolescent { - void setPresentation(@Nullable Icon icon, @NonNls @Nullable String type, @NonNls @NotNull String value, boolean hasChildren); void setPresentation(@Nullable Icon icon, @NonNls @Nullable String type, @NonNls @NotNull String separator, @NonNls @NotNull String value, boolean hasChildren);