diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/AnonymousClassesSorter.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/AnonymousClassesSorter.java index cefb5d9f280c..a6412f050460 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/AnonymousClassesSorter.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/AnonymousClassesSorter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -43,6 +43,7 @@ public class AnonymousClassesSorter implements Sorter { } }; + @NotNull @Override public Comparator getComparator() { return myComparator; diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaAnonymousClassesNodeProvider.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaAnonymousClassesNodeProvider.java index 65bc73d12b8a..557c0fe716c5 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaAnonymousClassesNodeProvider.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaAnonymousClassesNodeProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -45,8 +45,9 @@ public class JavaAnonymousClassesNodeProvider implements FileStructureNodeProvid public static final String ID = "SHOW_ANONYMOUS"; public static final String JAVA_ANONYMOUS_PROPERTY_NAME = "java.anonymous.provider"; + @NotNull @Override - public Collection provideNodes(TreeElement node) { + public Collection provideNodes(@NotNull TreeElement node) { if (node instanceof PsiMethodTreeElement || node instanceof PsiFieldTreeElement || node instanceof ClassInitializerTreeElement) { final PsiElement el = ((PsiTreeElementBase)node).getElement(); for (AnonymousElementProvider provider : Extensions.getExtensions(AnonymousElementProvider.EP_NAME)) { diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaInheritedMembersNodeProvider.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaInheritedMembersNodeProvider.java index e8a4cbbbf481..d17f9bb47842 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaInheritedMembersNodeProvider.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaInheritedMembersNodeProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -20,6 +20,7 @@ import com.intellij.ide.util.InheritedMembersNodeProvider; import com.intellij.ide.util.treeView.smartTree.TreeElement; import com.intellij.psi.*; import com.intellij.util.containers.ContainerUtil; +import org.jetbrains.annotations.NotNull; import java.util.*; @@ -27,8 +28,9 @@ import java.util.*; * @author Konstantin Bulenkov */ public class JavaInheritedMembersNodeProvider extends InheritedMembersNodeProvider { + @NotNull @Override - public Collection provideNodes(TreeElement node) { + public Collection provideNodes(@NotNull TreeElement node) { if (node instanceof JavaClassTreeElement) { final PsiClass aClass = ((JavaClassTreeElement)node).getValue(); Collection inherited = new LinkedHashSet(); diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/KindSorter.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/KindSorter.java index 18cc5972d29a..f1cdf3e6ccb4 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/KindSorter.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/KindSorter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -65,6 +65,7 @@ public class KindSorter implements Sorter { } }; + @NotNull public Comparator getComparator() { return COMPARATOR; } diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/PropertiesGrouper.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/PropertiesGrouper.java index b948ac948f75..5333306d7d24 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/PropertiesGrouper.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/PropertiesGrouper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -33,7 +33,7 @@ public class PropertiesGrouper implements Grouper{ @NonNls public static final String ID = "SHOW_PROPERTIES"; @NotNull - public Collection group(final AbstractTreeNode parent, Collection children) { + public Collection group(@NotNull final AbstractTreeNode parent, @NotNull Collection children) { if (parent.getValue() instanceof PropertyGroup) return Collections.emptyList(); Map result = new THashMap(); for (TreeElement o : children) { diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/PropertyGroup.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/PropertyGroup.java index 90e0c9eecab8..d66464e2af23 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/PropertyGroup.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/PropertyGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -90,10 +90,12 @@ public class PropertyGroup implements Group, ColoredItemPresentation, AccessLeve return null; } + @NotNull public Collection getChildren() { return myChildren; } + @NotNull public ItemPresentation getPresentation() { return this; } diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/PsiFieldTreeElement.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/PsiFieldTreeElement.java index 931750522863..1661596af0cf 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/PsiFieldTreeElement.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/PsiFieldTreeElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -48,6 +48,7 @@ public class PsiFieldTreeElement extends JavaClassTreeElementBase impl return getElement(); } + @NotNull public String getAlphaSortKey() { final PsiField field = getElement(); if (field != null) { diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/PsiMethodTreeElement.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/PsiMethodTreeElement.java index 2f186db66a39..c1afbee6ada4 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/PsiMethodTreeElement.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/PsiMethodTreeElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -127,6 +127,7 @@ public class PsiMethodTreeElement extends JavaClassTreeElementBase im return getElement(); } + @NotNull @Override public String getAlphaSortKey() { final PsiMethod method = getElement(); diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/SuperTypeGroup.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/SuperTypeGroup.java index ee713b880078..c2e2d58bcc12 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/SuperTypeGroup.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/SuperTypeGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -25,6 +25,7 @@ import com.intellij.psi.PsiModifierList; import com.intellij.psi.SmartPointerManager; import com.intellij.psi.SmartPsiElementPointer; import com.intellij.psi.util.PsiUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -47,6 +48,7 @@ public class SuperTypeGroup implements Group, ItemPresentation, AccessLevelProvi mySuperClassPointer = SmartPointerManager.getInstance(superClass.getProject()).createSmartPsiElementPointer(superClass); } + @NotNull public Collection getChildren() { return myChildren; } @@ -56,6 +58,7 @@ public class SuperTypeGroup implements Group, ItemPresentation, AccessLevelProvi return (PsiClass)mySuperClassPointer.getElement(); } + @NotNull public ItemPresentation getPresentation() { return this; } diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/SuperTypesGrouper.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/SuperTypesGrouper.java index 0f5a7589f6d6..cfa6d009293a 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/SuperTypesGrouper.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/SuperTypesGrouper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -38,7 +38,7 @@ public class SuperTypesGrouper implements Grouper{ @NonNls public static final String ID = "SHOW_INTERFACES"; @NotNull - public Collection group(final AbstractTreeNode parent, Collection children) { + public Collection group(@NotNull final AbstractTreeNode parent, @NotNull Collection children) { if (isParentGrouped(parent)) return Collections.emptyList(); Map groups = new THashMap(); diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/VisibilitySorter.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/VisibilitySorter.java index e5ce3310187f..b9f149261c6e 100644 --- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/VisibilitySorter.java +++ b/java/java-impl/src/com/intellij/ide/structureView/impl/java/VisibilitySorter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -30,6 +30,7 @@ public class VisibilitySorter implements Sorter{ public static final Sorter INSTANCE = new VisibilitySorter(); private static final ActionPresentation PRESENTATION = new ActionPresentation() { + @NotNull public String getText() { return IdeBundle.message("action.structureview.sort.by.visibility"); } @@ -44,6 +45,7 @@ public class VisibilitySorter implements Sorter{ }; @NonNls public static final String ID = "VISIBILITY_SORTER"; + @NotNull public Comparator getComparator() { return VisibilityComparator.IMSTANCE; } diff --git a/platform/core-api/src/com/intellij/openapi/editor/colors/ColorKey.java b/platform/core-api/src/com/intellij/openapi/editor/colors/ColorKey.java index d868b99c8585..2c5a9d93cbef 100644 --- a/platform/core-api/src/com/intellij/openapi/editor/colors/ColorKey.java +++ b/platform/core-api/src/com/intellij/openapi/editor/colors/ColorKey.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -18,6 +18,7 @@ package com.intellij.openapi.editor.colors; import com.intellij.openapi.diagnostic.Logger; import com.intellij.ui.Gray; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import java.awt.*; import java.util.HashMap; @@ -31,7 +32,7 @@ public final class ColorKey implements Comparable { private Color myDefaultColor = NULL_COLOR; private static final Map ourRegistry = new HashMap(); - private ColorKey(String externalName) { + private ColorKey(@NotNull String externalName) { myExternalName = externalName; if (ourRegistry.containsKey(myExternalName)) { LOG.error("Key " + myExternalName + " already registered."); @@ -41,20 +42,23 @@ public final class ColorKey implements Comparable { } } - public static ColorKey find(String externalName) { + @NotNull + public static ColorKey find(@NotNull String externalName) { ColorKey key = ourRegistry.get(externalName); - return key != null ? key : new ColorKey(externalName); + return key == null ? new ColorKey(externalName) : key; } public String toString() { return myExternalName; } + @NotNull public String getExternalName() { return myExternalName; } - public int compareTo(ColorKey key) { + @Override + public int compareTo(@NotNull ColorKey key) { return myExternalName.compareTo(key.myExternalName); } @@ -72,15 +76,14 @@ public final class ColorKey implements Comparable { return myDefaultColor; } - public static ColorKey createColorKey(@NonNls String externalName) { + @NotNull + public static ColorKey createColorKey(@NonNls @NotNull String externalName) { return find(externalName); } - public static ColorKey createColorKey(@NonNls String externalName, Color defaultColor) { - ColorKey key = ourRegistry.get(externalName); - if (key == null) { - key = find(externalName); - } + @NotNull + public static ColorKey createColorKey(@NonNls @NotNull String externalName, Color defaultColor) { + ColorKey key = createColorKey(externalName); if (key.getDefaultColor() == null) { key.myDefaultColor = defaultColor; diff --git a/platform/lang-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java b/platform/lang-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java index 02d63de0e0de..17a8c21b2ec8 100644 --- a/platform/lang-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java +++ b/platform/lang-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java @@ -85,12 +85,12 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView } @Override - public final void addEditorPositionListener(FileEditorPositionListener listener) { + public final void addEditorPositionListener(@NotNull FileEditorPositionListener listener) { myListeners.add(listener); } @Override - public final void removeEditorPositionListener(FileEditorPositionListener listener) { + public final void removeEditorPositionListener(@NotNull FileEditorPositionListener listener) { myListeners.remove(listener); } @@ -136,12 +136,12 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView } @Override - public void addModelListener(ModelListener modelListener) { + public void addModelListener(@NotNull ModelListener modelListener) { } @Override - public void removeModelListener(ModelListener modelListener) { + public void removeModelListener(@NotNull ModelListener modelListener) { } diff --git a/platform/lang-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java b/platform/lang-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java index ec30047809be..987b28f7e3c4 100644 --- a/platform/lang-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java +++ b/platform/lang-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -33,8 +33,7 @@ import org.jetbrains.annotations.Nullable; * @see TextEditorBasedStructureViewModel * @see com.intellij.lang.LanguageStructureViewBuilder#getStructureViewBuilder(com.intellij.psi.PsiFile) */ -public abstract class - TreeBasedStructureViewBuilder implements StructureViewBuilder { +public abstract class TreeBasedStructureViewBuilder implements StructureViewBuilder { /** * @deprecated Use createStructureViewModel(Editor editor) */ @@ -60,7 +59,7 @@ public abstract class @Override @NotNull - public StructureView createStructureView(FileEditor fileEditor, Project project) { + public StructureView createStructureView(FileEditor fileEditor, @NotNull Project project) { final StructureViewModel model = createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null); StructureView view = StructureViewFactory.getInstance(project).createStructureView(fileEditor, model, project, isRootNodeShown()); Disposer.register(view, new Disposable() { diff --git a/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java b/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java index 3d48cd908530..3acb49a1b4ba 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -56,16 +56,16 @@ public class ViewStructureAction extends AnAction { final VirtualFile virtualFile; final Editor editor = e.getData(CommonDataKeys.EDITOR); - if (editor != null) { + if (editor == null) { + virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE); + } + else { PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (psiFile == null) return; virtualFile = psiFile.getVirtualFile(); } - else { - virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE); - } String title = virtualFile == null? fileEditor.getName() : virtualFile.getName(); FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.file.structure"); @@ -79,6 +79,7 @@ public class ViewStructureAction extends AnAction { popup.show(); } else { + assert editor != null; DialogWrapper dialog = createDialog(editor, project, navigatable, fileEditor); if (dialog == null) return; @@ -88,7 +89,10 @@ public class ViewStructureAction extends AnAction { } @Nullable - private static DialogWrapper createDialog(@Nullable Editor editor, @NotNull Project project, @Nullable Navigatable navigatable, @NotNull FileEditor fileEditor) { + private static DialogWrapper createDialog(@NotNull Editor editor, + @NotNull Project project, + @Nullable Navigatable navigatable, + @NotNull FileEditor fileEditor) { final StructureViewBuilder structureViewBuilder = fileEditor.getStructureViewBuilder(); if (structureViewBuilder == null) return null; StructureView structureView = structureViewBuilder.createStructureView(fileEditor, project); @@ -112,9 +116,10 @@ public class ViewStructureAction extends AnAction { return PLACE.equals(model.getPlace()); } - private static FileStructureDialog createStructureViewBasedDialog(StructureViewModel structureViewModel, - Editor editor, - Project project, + @NotNull + private static FileStructureDialog createStructureViewBasedDialog(@NotNull StructureViewModel structureViewModel, + @NotNull Editor editor, + @NotNull Project project, Navigatable navigatable, @NotNull Disposable alternativeDisposable) { return new FileStructureDialog(structureViewModel, editor, project, navigatable, alternativeDisposable, true); diff --git a/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java b/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java index bc4064a3fb6d..0591a5014437 100644 --- a/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java +++ b/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -216,7 +216,7 @@ public class ProjectListBuilder extends AbstractListBuilder { } @Override - public void fileStatusChanged(final VirtualFile vFile) { + public void fileStatusChanged(@NotNull final VirtualFile vFile) { final PsiManager manager = PsiManager.getInstance(myProject); if (vFile.isDirectory()) { diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.java index 809c41cb9bf0..ab954007b0d3 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -23,13 +23,13 @@ import com.intellij.openapi.util.Key; import com.intellij.psi.PsiElement; import com.intellij.psi.SmartPointerManager; import com.intellij.psi.SmartPsiElementPointer; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * @author peter */ public class PsiTreeAnchorizer extends TreeAnchorizer { - private static final Key PSI_ANCHORIZER_POINTER = Key.create("PSI_ANCHORIZER_POINTER"); @Override @@ -47,7 +47,8 @@ public class PsiTreeAnchorizer extends TreeAnchorizer { if (pointer == null || pointer.myPointer.getElement() != psiElement) { Project project = psiElement.getProject(); - pointer = new SmartPointerWrapper(SmartPointerManager.getInstance(project).createSmartPsiElementPointer(psiElement)); + SmartPsiElementPointer psiElementPointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(psiElement); + pointer = new SmartPointerWrapper(psiElementPointer); psiElement.putUserData(PSI_ANCHORIZER_POINTER, pointer); } return pointer; @@ -74,7 +75,7 @@ public class PsiTreeAnchorizer extends TreeAnchorizer { private static class SmartPointerWrapper { private final SmartPsiElementPointer myPointer; - private SmartPointerWrapper(SmartPsiElementPointer pointer) { + private SmartPointerWrapper(@NotNull SmartPsiElementPointer pointer) { myPointer = pointer; } diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java b/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java index dd371e72ed63..ceb4fa72ca14 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -18,6 +18,7 @@ package com.intellij.ide.structureView; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collection; @@ -30,7 +31,8 @@ public abstract class StructureViewFactoryEx extends StructureViewFactory { @Nullable public abstract StructureViewWrapper getStructureViewWrapper(); - public abstract Collection getAllExtensions(Class type); + @NotNull + public abstract Collection getAllExtensions(@NotNull Class type); public abstract void setActiveAction(final String name, final boolean state); @@ -40,5 +42,5 @@ public abstract class StructureViewFactoryEx extends StructureViewFactory { return (StructureViewFactoryEx)getInstance(project); } - public abstract void runWhenInitialized(Runnable runnable); + public abstract void runWhenInitialized(@NotNull Runnable runnable); } \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java b/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java index 55f09ca297d8..63f77962fced 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -51,6 +51,7 @@ public class StructureViewElementWrapper implements Struct return (V)myTreeElement.getValue(); } + @NotNull @Override public StructureViewTreeElement[] getChildren() { TreeElement[] baseChildren = myTreeElement.getChildren(); @@ -63,6 +64,7 @@ public class StructureViewElementWrapper implements Struct return result.toArray(new StructureViewTreeElement[result.size()]); } + @NotNull @Override public ItemPresentation getPresentation() { return myTreeElement.getPresentation(); diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java b/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java index d49da8097bfc..8955f0769922 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java @@ -106,8 +106,9 @@ public final class StructureViewFactoryImpl extends StructureViewFactoryEx imple } } + @NotNull @Override - public Collection getAllExtensions(Class type) { + public Collection getAllExtensions(@NotNull Class type) { Collection result = myImplExtensions.get(type); if (result == null) { MultiValuesMap, StructureViewExtension> map = myExtensions.getValue(); @@ -154,7 +155,7 @@ public final class StructureViewFactoryImpl extends StructureViewFactoryEx imple } @Override - public void runWhenInitialized(Runnable runnable) { + public void runWhenInitialized(@NotNull Runnable runnable) { if (myStructureViewWrapperImpl != null) { runnable.run(); } @@ -163,14 +164,20 @@ public final class StructureViewFactoryImpl extends StructureViewFactoryEx imple } } - @Override - public StructureView createStructureView(final FileEditor fileEditor, final StructureViewModel treeModel, final Project project) { - return new StructureViewComponent(fileEditor, treeModel, project); - } - + @NotNull @Override public StructureView createStructureView(final FileEditor fileEditor, - final StructureViewModel treeModel, final Project project, final boolean showRootNode) { + @NotNull final StructureViewModel treeModel, + @NotNull final Project project) { + return createStructureView(fileEditor, treeModel, project, true); + } + + @NotNull + @Override + public StructureView createStructureView(final FileEditor fileEditor, + @NotNull StructureViewModel treeModel, + @NotNull Project project, + final boolean showRootNode) { return new StructureViewComponent(fileEditor, treeModel, project, showRootNode); } } diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java b/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java index e7301cd5be8b..dbc91a77dec6 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -45,22 +45,22 @@ public class StructureViewModelWrapper implements StructureViewModel { } @Override - public void addEditorPositionListener(final FileEditorPositionListener listener) { + public void addEditorPositionListener(@NotNull final FileEditorPositionListener listener) { myStructureViewModel.addEditorPositionListener(listener); } @Override - public void removeEditorPositionListener(final FileEditorPositionListener listener) { + public void removeEditorPositionListener(@NotNull final FileEditorPositionListener listener) { myStructureViewModel.removeEditorPositionListener(listener); } @Override - public void addModelListener(final ModelListener modelListener) { + public void addModelListener(@NotNull final ModelListener modelListener) { myStructureViewModel.addModelListener(modelListener); } @Override - public void removeModelListener(final ModelListener modelListener) { + public void removeModelListener(@NotNull final ModelListener modelListener) { myStructureViewModel.removeModelListener(modelListener); } diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.java b/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.java index 6886470e1a87..83174587bf01 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -155,7 +155,7 @@ public abstract class TemplateLanguageStructureViewBuilder implements StructureV @Override @NotNull - public StructureView createStructureView(FileEditor fileEditor, Project project) { + public StructureView createStructureView(FileEditor fileEditor, @NotNull Project project) { myFileEditor = fileEditor; List viewDescriptors = new ArrayList(); final TemplateLanguageFileViewProvider provider = getViewProvider(); diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java b/platform/lang-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java index 513e31f6be73..9d851c00f31e 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -40,6 +40,7 @@ public abstract class PsiTreeElementBase implements Struc myValue = psiElement; } + @NotNull @Override public ItemPresentation getPresentation() { return this; @@ -94,6 +95,7 @@ public abstract class PsiTreeElementBase implements Struc return element != null ? element.toString() : ""; } + @NotNull @Override public final StructureViewTreeElement[] getChildren() { final T element = getElement(); diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java index ae8cedaf9129..3bdb4de361f3 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -92,13 +92,9 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre private final StructureViewModel myTreeModel; private static int ourSettingsModificationCount; - public StructureViewComponent(FileEditor editor, StructureViewModel structureViewModel, Project project) { - this(editor, structureViewModel, project, true); - } - public StructureViewComponent(final FileEditor editor, - final StructureViewModel structureViewModel, - final Project project, + @NotNull StructureViewModel structureViewModel, + @NotNull Project project, final boolean showRootNode) { super(true, true); @@ -861,13 +857,11 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre final Object o = unwrapValue(getValue()); long currentStamp; - if (( o instanceof PsiElement && + if (o instanceof PsiElement && ((PsiElement)o).getNode() instanceof CompositeElement && - childrenStamp != (currentStamp = ((CompositeElement)((PsiElement)o).getNode()).getModificationCount()) - ) || - ( o instanceof ModificationTracker && + childrenStamp != (currentStamp = ((CompositeElement)((PsiElement)o).getNode()).getModificationCount()) || + o instanceof ModificationTracker && childrenStamp != (currentStamp = ((ModificationTracker)o).getModificationCount()) - ) ) { resetChildren(); childrenStamp = currentStamp; @@ -882,26 +876,22 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre @Override public boolean isAlwaysShowPlus() { - if (getElementInfoProvider() != null) { - return getElementInfoProvider().isAlwaysShowsPlus((StructureViewTreeElement)getValue()); - } - return true; + StructureViewModel.ElementInfoProvider elementInfoProvider = getElementInfoProvider(); + return elementInfoProvider == null || elementInfoProvider.isAlwaysShowsPlus((StructureViewTreeElement)getValue()); } @Override public boolean isAlwaysLeaf() { - if (getElementInfoProvider() != null) { - return getElementInfoProvider().isAlwaysLeaf((StructureViewTreeElement)getValue()); - } - - return false; + StructureViewModel.ElementInfoProvider elementInfoProvider = getElementInfoProvider(); + return elementInfoProvider != null && elementInfoProvider.isAlwaysLeaf((StructureViewTreeElement)getValue()); } @Nullable private StructureViewModel.ElementInfoProvider getElementInfoProvider() { if (myTreeModel instanceof StructureViewModel.ElementInfoProvider) { - return ((StructureViewModel.ElementInfoProvider)myTreeModel); - } else if (myTreeModel instanceof TreeModelWrapper) { + return (StructureViewModel.ElementInfoProvider)myTreeModel; + } + if (myTreeModel instanceof TreeModelWrapper) { StructureViewModel model = ((TreeModelWrapper)myTreeModel).getModel(); if (model instanceof StructureViewModel.ElementInfoProvider) { return (StructureViewModel.ElementInfoProvider)model; @@ -912,12 +902,12 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre } @Override - protected TreeElementWrapper createChildNode(final TreeElement child) { + protected TreeElementWrapper createChildNode(@NotNull final TreeElement child) { return new StructureViewTreeElementWrapper(myProject, child, myTreeModel); } @Override - protected GroupWrapper createGroupWrapper(final Project project, Group group, final TreeModel treeModel) { + protected GroupWrapper createGroupWrapper(final Project project, @NotNull Group group, final TreeModel treeModel) { return new StructureViewGroup(project, group, treeModel); } @@ -940,9 +930,7 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre if (o instanceof StructureViewTreeElement) { return ((StructureViewTreeElement)o).getValue(); } - else { - return o; - } + return o; } public int hashCode() { @@ -957,13 +945,13 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre } @Override - protected TreeElementWrapper createChildNode(TreeElement child) { + protected TreeElementWrapper createChildNode(@NotNull TreeElement child) { return new StructureViewTreeElementWrapper(getProject(), child, myTreeModel); } @Override - protected GroupWrapper createGroupWrapper(Project project, Group group, TreeModel treeModel) { + protected GroupWrapper createGroupWrapper(Project project, @NotNull Group group, TreeModel treeModel) { return new StructureViewGroup(project, group, treeModel); } diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeActionWrapper.java b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeActionWrapper.java index 4f9c63ea0078..890f2dff4740 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeActionWrapper.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeActionWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -23,13 +23,14 @@ import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.actionSystem.ToggleAction; import com.intellij.openapi.actionSystem.impl.MenuItemPresentationFactory; import com.intellij.openapi.project.DumbAware; +import org.jetbrains.annotations.NotNull; public class TreeActionWrapper extends ToggleAction implements DumbAware { private final TreeAction myAction; private final TreeActionsOwner myStructureView; - public TreeActionWrapper(TreeAction action, TreeActionsOwner structureView) { + public TreeActionWrapper(@NotNull TreeAction action, @NotNull TreeActionsOwner structureView) { myAction = action; myStructureView = structureView; } diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeModelWrapper.java b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeModelWrapper.java index 12d35f8f4344..d3af6621739d 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeModelWrapper.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeModelWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -26,12 +26,13 @@ import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.List; public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel { private final StructureViewModel myModel; private final TreeActionsOwner myStructureView; - public TreeModelWrapper(StructureViewModel model, TreeActionsOwner structureView) { + public TreeModelWrapper(@NotNull StructureViewModel model, @NotNull TreeActionsOwner structureView) { myModel = model; myStructureView = structureView; } @@ -45,41 +46,43 @@ public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel @Override @NotNull public Grouper[] getGroupers() { - ArrayList filtered = filterActive(myModel.getGroupers()); + List filtered = filterActive(myModel.getGroupers()); return filtered.toArray(new Grouper[filtered.size()]); } - private ArrayList filterActive(TreeAction[] actions) { - ArrayList filtered = new ArrayList(); - for (TreeAction action : actions) { + @NotNull + private List filterActive(@NotNull T[] actions) { + List filtered = new ArrayList(); + for (T action : actions) { if (isFiltered(action)) filtered.add(action); } return filtered; } - private ArrayList filterProviders(Collection actions) { - ArrayList filtered = new ArrayList(); + @NotNull + private List filterProviders(@NotNull Collection actions) { + List filtered = new ArrayList(); for (NodeProvider action : actions) { if (isFiltered(action)) filtered.add(action); } return filtered; } - private boolean isFiltered(TreeAction action) { + private boolean isFiltered(@NotNull TreeAction action) { return action instanceof Sorter && !((Sorter)action).isVisible() || myStructureView.isActionActive(action.getName()); } @Override @NotNull public Sorter[] getSorters() { - ArrayList filtered = filterActive(myModel.getSorters()); + List filtered = filterActive(myModel.getSorters()); return filtered.toArray(new Sorter[filtered.size()]); } @Override @NotNull public Filter[] getFilters() { - ArrayList filtered = filterActive(myModel.getFilters()); + List filtered = filterActive(myModel.getFilters()); return filtered.toArray(new Filter[filtered.size()]); } @@ -97,27 +100,24 @@ public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel return Collections.emptyList(); } - public static boolean isActive(final TreeAction action, final TreeActionsOwner actionsOwner) { + public static boolean isActive(@NotNull TreeAction action, @NotNull TreeActionsOwner actionsOwner) { if (shouldRevert(action)) { return !actionsOwner.isActionActive(action.getName()); } - else { - if (action instanceof Sorter && !((Sorter)action).isVisible()) return true; - return actionsOwner.isActionActive(action.getName()); - } + return action instanceof Sorter && !((Sorter)action).isVisible() || actionsOwner.isActionActive(action.getName()); } - public static boolean shouldRevert(final TreeAction action) { + public static boolean shouldRevert(@NotNull TreeAction action) { return action instanceof Filter && ((Filter)action).isReverted(); } @Override - public void addEditorPositionListener(FileEditorPositionListener listener) { + public void addEditorPositionListener(@NotNull FileEditorPositionListener listener) { myModel.addEditorPositionListener(listener); } @Override - public void removeEditorPositionListener(FileEditorPositionListener listener) { + public void removeEditorPositionListener(@NotNull FileEditorPositionListener listener) { myModel.removeEditorPositionListener(listener); } @@ -132,12 +132,12 @@ public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel } @Override - public void addModelListener(ModelListener modelListener) { + public void addModelListener(@NotNull ModelListener modelListener) { myModel.addModelListener(modelListener); } @Override - public void removeModelListener(ModelListener modelListener) { + public void removeModelListener(@NotNull ModelListener modelListener) { myModel.removeModelListener(modelListener); } diff --git a/platform/lang-impl/src/com/intellij/ide/todo/nodes/ToDoRootNode.java b/platform/lang-impl/src/com/intellij/ide/todo/nodes/ToDoRootNode.java index 17c19314a5e7..2698f894cd7b 100644 --- a/platform/lang-impl/src/com/intellij/ide/todo/nodes/ToDoRootNode.java +++ b/platform/lang-impl/src/com/intellij/ide/todo/nodes/ToDoRootNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -21,7 +21,6 @@ import com.intellij.ide.todo.ToDoSummary; import com.intellij.ide.todo.TodoTreeBuilder; import com.intellij.ide.util.treeView.AbstractTreeNode; import com.intellij.openapi.project.Project; -import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java index 9e171704605c..4abeb0787727 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -46,7 +46,7 @@ import com.intellij.pom.Navigatable; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; -import com.intellij.psi.util.PsiUtilBase; +import com.intellij.psi.util.PsiUtilCore; import com.intellij.ui.*; import com.intellij.ui.docking.DockManager; import com.intellij.ui.speedSearch.SpeedSearchSupply; @@ -80,9 +80,9 @@ public class FileStructureDialog extends DialogWrapper { @NonNls private static final String ourPropertyKey = "FileStructure.narrowDown"; private boolean myShouldNarrowDown = false; - public FileStructureDialog(StructureViewModel structureViewModel, - @Nullable Editor editor, - Project project, + public FileStructureDialog(@NotNull StructureViewModel structureViewModel, + @NotNull Editor editor, + @NotNull Project project, Navigatable navigatable, @NotNull final Disposable auxDisposable, final boolean applySortAndFilter) { @@ -109,17 +109,17 @@ public class FileStructureDialog extends DialogWrapper { if (psiElement != null) { if (structureViewModel.shouldEnterElement(psiElement)) { - myCommanderPanel.getBuilder().enterElement(psiElement, PsiUtilBase.getVirtualFile(psiElement)); + myCommanderPanel.getBuilder().enterElement(psiElement, PsiUtilCore.getVirtualFile(psiElement)); } else { - myCommanderPanel.getBuilder().selectElement(psiElement, PsiUtilBase.getVirtualFile(psiElement)); + myCommanderPanel.getBuilder().selectElement(psiElement, PsiUtilCore.getVirtualFile(psiElement)); } } Disposer.register(myDisposable, auxDisposable); } - protected PsiFile getPsiFile(final Project project) { + protected PsiFile getPsiFile(@NotNull Project project) { return PsiDocumentManager.getInstance(project).getPsiFile(myEditor.getDocument()); } @@ -189,7 +189,8 @@ public class FileStructureDialog extends DialogWrapper { ProjectListBuilder projectListBuilder = new ProjectListBuilder(myProject, myCommanderPanel, myTreeStructure, null, showRoot) { @Override protected boolean shouldEnterSingleTopLevelElement(Object rootChild) { - return myBaseTreeModel.shouldEnterElement(((StructureViewTreeElement)((AbstractTreeNode)rootChild).getValue()).getValue()); + Object element = ((StructureViewTreeElement)((AbstractTreeNode)rootChild).getValue()).getValue(); + return myBaseTreeModel.shouldEnterElement(element); } @Override @@ -311,7 +312,7 @@ public class FileStructureDialog extends DialogWrapper { boolean oldNarrowDown = myShouldNarrowDown; myShouldNarrowDown = false; try { - builder.enterElement(currentParent, PsiUtilBase.getVirtualFile(currentParent)); + builder.enterElement(currentParent, PsiUtilCore.getVirtualFile(currentParent)); } finally { myShouldNarrowDown = oldNarrowDown; @@ -321,7 +322,7 @@ public class FileStructureDialog extends DialogWrapper { } if (SpeedSearchBase.hasActiveSpeedSearch(myCommanderPanel.getList())) { - final SpeedSearchSupply supply = SpeedSearchBase.getSupply(myCommanderPanel.getList()); + final SpeedSearchSupply supply = SpeedSearchSupply.getSupply(myCommanderPanel.getList()); if (supply != null && supply.isPopupActive()) supply.refreshSelection(); } } diff --git a/platform/lang-impl/src/com/intellij/ide/util/StructureViewCompositeModel.java b/platform/lang-impl/src/com/intellij/ide/util/StructureViewCompositeModel.java index ca4c13626095..ac656636323d 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/StructureViewCompositeModel.java +++ b/platform/lang-impl/src/com/intellij/ide/util/StructureViewCompositeModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -65,11 +65,13 @@ public class StructureViewCompositeModel extends StructureViewModelBase implemen return file.canNavigateToSource(); } + @NotNull @Override public ItemPresentation getPresentation() { return file.getPresentation(); } + @NotNull @Override public TreeElement[] getChildren() { ArrayList elements = new ArrayList(); @@ -127,6 +129,7 @@ public class StructureViewCompositeModel extends StructureViewModelBase implemen return file.canNavigateToSource(); } + @NotNull @Override public ItemPresentation getPresentation() { return new ItemPresentation() { @@ -150,6 +153,7 @@ public class StructureViewCompositeModel extends StructureViewModelBase implemen }; } + @NotNull @Override public TreeElement[] getChildren() { return view.structureView.getTreeModel().getRoot().getChildren(); diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java b/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java index a81d18f13792..f08fb99cf4bf 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java +++ b/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -18,6 +18,7 @@ package com.intellij.ide.util.treeView.smartTree; import com.intellij.ide.structureView.impl.StructureViewElementWrapper; import com.intellij.ide.util.treeView.AbstractTreeNode; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.pom.Navigatable; import gnu.trove.THashMap; @@ -26,6 +27,7 @@ import org.jetbrains.annotations.NotNull; import java.util.*; public abstract class CachingChildrenTreeNode extends AbstractTreeNode { + private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.treeView.smartTree.CachingChildrenTreeNode"); private List myChildren; private List myOldChildren = null; protected final TreeModel myTreeModel; @@ -95,12 +97,13 @@ public abstract class CachingChildrenTreeNode extends AbstractTreeNode children = getChildren(); for (Filter filter : filters) { for (Iterator eachNode = children.iterator(); eachNode.hasNext();) { TreeElementWrapper eachChild = (TreeElementWrapper)eachNode.next(); - if (!filter.isVisible(eachChild.getValue())) { + TreeElement value = eachChild.getValue(); + if (value == null || !filter.isVisible(value)) { eachNode.remove(); } } @@ -108,7 +111,7 @@ public abstract class CachingChildrenTreeNode extends AbstractTreeNode extends AbstractTreeNode> ungrouped, Grouper grouper) { + private void processUngrouped(@NotNull List> ungrouped, @NotNull Grouper grouper) { Map ungroupedObjects = collectValues(ungrouped); Collection groups = grouper.group(this, ungroupedObjects.keySet()); Map groupNodes = createGroupNodes(groups); for (Group group : groups) { + if (group == null) { + LOG.error(grouper + " returned null group: "+groups); + } GroupWrapper groupWrapper = groupNodes.get(group); Collection children = group.getChildren(); for (TreeElement node : children) { + if (node == null) { + LOG.error(group + " returned null child: " + children); + } CachingChildrenTreeNode child = createChildNode(node); groupWrapper.addSubElement(child); AbstractTreeNode abstractTreeNode = ungroupedObjects.get(node); @@ -165,7 +174,7 @@ public abstract class CachingChildrenTreeNode extends AbstractTreeNode extends AbstractTreeNode createGroupNodes(Collection groups) { + private Map createGroupNodes(@NotNull Collection groups) { Map result = new THashMap(); for (Group group : groups) { result.put(group, createGroupWrapper(getProject(), group, myTreeModel)); @@ -185,7 +194,7 @@ public abstract class CachingChildrenTreeNode extends AbstractTreeNode extends AbstractTreeNode { + private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.treeView.smartTree.GroupWrapper"); public GroupWrapper(Project project, Group value, TreeModel treeModel) { super(project, value, treeModel); clearChildren(); } @Override - public void copyFromNewInstance(final CachingChildrenTreeNode newInstance) { + public void copyFromNewInstance(@NotNull final CachingChildrenTreeNode newInstance) { clearChildren(); setChildren(newInstance.getChildren()); synchronizeChildren(); @@ -43,8 +45,12 @@ public class GroupWrapper extends CachingChildrenTreeNode { @Override public void initChildren() { clearChildren(); - Collection children = getValue().getChildren(); + Group group = getValue(); + Collection children = group.getChildren(); for (TreeElement child : children) { + if (child == null) { + LOG.error(group + " returned null child: " + children); + } TreeElementWrapper childNode = createChildNode(child); addSubElement(childNode); } diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java b/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java index a0dafb0ed58f..ac1660aea6a0 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java +++ b/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -18,17 +18,21 @@ package com.intellij.ide.util.treeView.smartTree; import com.intellij.ide.projectView.PresentationData; import com.intellij.ide.structureView.StructureViewTreeElement; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; +import java.util.Arrays; import java.util.Collection; public class TreeElementWrapper extends CachingChildrenTreeNode { + private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.treeView.smartTree.TreeElementWrapper"); public TreeElementWrapper(Project project, TreeElement value, TreeModel treeModel) { super(project, value, treeModel); } @Override - public void copyFromNewInstance(final CachingChildrenTreeNode oldInstance) { + public void copyFromNewInstance(@NotNull final CachingChildrenTreeNode oldInstance) { } @Override @@ -41,16 +45,23 @@ public class TreeElementWrapper extends CachingChildrenTreeNode { @Override public void initChildren() { clearChildren(); - TreeElement[] children = getValue().getChildren(); + TreeElement value = getValue(); + TreeElement[] children = value.getChildren(); for (TreeElement child : children) { + if (child == null) { + LOG.error(value + " returned null child: " + Arrays.toString(children)); + } addSubElement(createChildNode(child)); } if (myTreeModel instanceof ProvidingTreeModel) { final Collection providers = ((ProvidingTreeModel)myTreeModel).getNodeProviders(); for (NodeProvider provider : providers) { if (((ProvidingTreeModel)myTreeModel).isEnabled(provider)) { - final Collection nodes = provider.provideNodes(getValue()); + final Collection nodes = provider.provideNodes(value); for (TreeElement node : nodes) { + if (node == null) { + LOG.error(provider + " returned null node: " + nodes); + } addSubElement(createChildNode(node)); } } diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java b/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java index 87ba9c5e7b4d..ceaab48de15b 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java +++ b/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -49,5 +49,5 @@ public interface StructureViewBuilder { * @see TreeBasedStructureViewBuilder */ @NotNull - StructureView createStructureView(FileEditor fileEditor, Project project); + StructureView createStructureView(FileEditor fileEditor, @NotNull Project project); } diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewFactory.java b/platform/platform-api/src/com/intellij/ide/structureView/StructureViewFactory.java index e10f3c190a69..1d2bf73f10f7 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewFactory.java +++ b/platform/platform-api/src/com/intellij/ide/structureView/StructureViewFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -18,6 +18,7 @@ package com.intellij.ide.structureView; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; /** * Factory interface for creating instances of the standard structure view component. @@ -31,9 +32,10 @@ public abstract class StructureViewFactory { * @param project the project containing the file for which the structure view is requested. * @return the structure view instance. */ + @NotNull public abstract StructureView createStructureView(FileEditor fileEditor, - StructureViewModel treeModel, - Project project); + @NotNull StructureViewModel treeModel, + @NotNull Project project); /** * Creates a structure view component instance for the specified editor. @@ -44,10 +46,11 @@ public abstract class StructureViewFactory { * @param showRootNode pass false if root node of the structure built should not actually be shown in result tree. * @return the structure view instance. */ + @NotNull public abstract StructureView createStructureView(FileEditor fileEditor, - StructureViewModel treeModel, - Project project, - boolean showRootNode); + @NotNull StructureViewModel treeModel, + @NotNull Project project, + boolean showRootNode); public static StructureViewFactory getInstance(Project project) { return ServiceManager.getService(project, StructureViewFactory.class); diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewModel.java b/platform/platform-api/src/com/intellij/ide/structureView/StructureViewModel.java index 61009d21c34c..551d70d055e1 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewModel.java +++ b/platform/platform-api/src/com/intellij/ide/structureView/StructureViewModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -41,7 +41,7 @@ public interface StructureViewModel extends TreeModel { * * @param listener the listener to add. */ - void addEditorPositionListener(FileEditorPositionListener listener); + void addEditorPositionListener(@NotNull FileEditorPositionListener listener); /** * Removes a listener which gets notified when the selection in the editor linked to the @@ -49,7 +49,7 @@ public interface StructureViewModel extends TreeModel { * * @param listener the listener to remove. */ - void removeEditorPositionListener(FileEditorPositionListener listener); + void removeEditorPositionListener(@NotNull FileEditorPositionListener listener); /** * Adds a listener which gets notified when the data represented by the structure view @@ -57,7 +57,7 @@ public interface StructureViewModel extends TreeModel { * * @param modelListener the listener to add. */ - void addModelListener(ModelListener modelListener); + void addModelListener(@NotNull ModelListener modelListener); /** * Removes a listener which gets notified when the data represented by the structure view @@ -65,13 +65,14 @@ public interface StructureViewModel extends TreeModel { * * @param modelListener the listener to remove. */ - void removeModelListener(ModelListener modelListener); + void removeModelListener(@NotNull ModelListener modelListener); /** * Returns the root element of the structure view tree. * * @return the structure view root. */ + @Override @NotNull StructureViewTreeElement getRoot(); @@ -83,15 +84,12 @@ public interface StructureViewModel extends TreeModel { boolean shouldEnterElement(Object element); interface ElementInfoProvider extends StructureViewModel { - boolean isAlwaysShowsPlus(StructureViewTreeElement element); - boolean isAlwaysLeaf(StructureViewTreeElement element); - } interface ExpandInfoProvider { - boolean isAutoExpand(StructureViewTreeElement element); + boolean isAutoExpand(@NotNull StructureViewTreeElement element); boolean isSmartExpand(); } } diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java b/platform/platform-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java index 81010a383d9f..1b666467585e 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java +++ b/platform/platform-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -34,6 +34,4 @@ public interface StructureViewTreeElement extends TreeElement, Navigatable{ * @return the data object instance. */ Object getValue(); - - /*StructureViewTreeElement[] getChildren();*/ } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java index d722c2c6444e..ada9c64047e6 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -69,7 +69,7 @@ public abstract class AbstractTreeNode extends PresentableNodeDescriptor extends PresentableNodeDescriptor extends PresentableNodeDescriptor extends TreeAction { - Collection provideNodes(TreeElement node); + @NotNull + Collection provideNodes(@NotNull TreeElement node); } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java b/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java index 5434bc082bab..cabcc7a7ac0d 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -15,6 +15,8 @@ */ package com.intellij.ide.util.treeView.smartTree; +import org.jetbrains.annotations.NotNull; + /** * @author Konstantin Bulenkov */ @@ -22,16 +24,19 @@ public class SorterUtil { private SorterUtil() { } + @NotNull public static String getStringPresentation(Object object) { String result = null; if (object instanceof SortableTreeElement) { - result = ((SortableTreeElement) object).getAlphaSortKey(); - } else if (object instanceof TreeElement){ - result = ((TreeElement)object).getPresentation().getPresentableText(); - } else if (object instanceof Group){ + result = ((SortableTreeElement)object).getAlphaSortKey(); + } + else if (object instanceof TreeElement) { + result = ((TreeElement)object).getPresentation().getPresentableText(); + } + else if (object instanceof Group) { result = ((Group)object).getPresentation().getPresentableText(); } - return result != null ? result : ""; + return result == null ? "" : result; } } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java b/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java index 0375e32eae03..675c7041cd3e 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -29,7 +29,8 @@ public interface TreeModel { * * @return the tree root. */ - @NotNull TreeElement getRoot(); + @NotNull + TreeElement getRoot(); /** * Returns the list of actions for grouping items in the tree. @@ -37,7 +38,8 @@ public interface TreeModel { * @return the array of grouping actions. * @see Grouper#EMPTY_ARRAY */ - @NotNull Grouper[] getGroupers(); + @NotNull + Grouper[] getGroupers(); /** * Returns the array of actions for sorting items in the tree. @@ -45,7 +47,8 @@ public interface TreeModel { * @return the array of sorting actions. * @see Sorter#EMPTY_ARRAY */ - @NotNull Sorter[] getSorters(); + @NotNull + Sorter[] getSorters(); /** * Returns the array of actions for filtering items in the tree. @@ -53,5 +56,6 @@ public interface TreeModel { * @return the array of filtering actions. * @see Filter#EMPTY_ARRAY */ - @NotNull Filter[] getFilters(); + @NotNull + Filter[] getFilters(); } diff --git a/platform/platform-api/src/com/intellij/openapi/ide/CopyPasteManager.java b/platform/platform-api/src/com/intellij/openapi/ide/CopyPasteManager.java index c96ce0ae3f81..756631c6b3ff 100644 --- a/platform/platform-api/src/com/intellij/openapi/ide/CopyPasteManager.java +++ b/platform/platform-api/src/com/intellij/openapi/ide/CopyPasteManager.java @@ -33,11 +33,11 @@ public abstract class CopyPasteManager { return ServiceManager.getService(CopyPasteManager.class); } - public abstract void addContentChangedListener(ContentChangedListener listener); + public abstract void addContentChangedListener(@NotNull ContentChangedListener listener); - public abstract void addContentChangedListener(ContentChangedListener listener, Disposable parentDisposable); + public abstract void addContentChangedListener(@NotNull ContentChangedListener listener, @NotNull Disposable parentDisposable); - public abstract void removeContentChangedListener(ContentChangedListener listener); + public abstract void removeContentChangedListener(@NotNull ContentChangedListener listener); /** @deprecated use {@link #getContents(DataFlavor)} or {@link #areDataFlavorsAvailable(DataFlavor...)} (to remove in IDEA 14) */ @SuppressWarnings("unused") @@ -53,6 +53,7 @@ public abstract class CopyPasteManager { @Nullable public abstract T getContents(@NotNull DataFlavor flavor); + @NotNull public abstract Transferable[] getAllContents(); public abstract void setContents(@NotNull Transferable content); diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusListener.java b/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusListener.java index a556fb4e104e..f53a2adc086a 100644 --- a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusListener.java +++ b/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull; public interface FileStatusListener { /** * Indicates that some file statuses were change. On this event client should recalculate all statuses - * it's depenedend on. + * it's dependent on. */ void fileStatusesChanged(); void fileStatusChanged(@NotNull VirtualFile virtualFile); diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusManager.java b/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusManager.java index f2fad70bb48e..4c40f9120a46 100644 --- a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusManager.java +++ b/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -35,23 +35,23 @@ public abstract class FileStatusManager { public abstract void fileStatusesChanged(); public abstract void fileStatusChanged(VirtualFile file); - public abstract void addFileStatusListener(FileStatusListener listener); - public abstract void addFileStatusListener(FileStatusListener listener, Disposable parentDisposable); - public abstract void removeFileStatusListener(FileStatusListener listener); + public abstract void addFileStatusListener(@NotNull FileStatusListener listener); + public abstract void addFileStatusListener(@NotNull FileStatusListener listener, @NotNull Disposable parentDisposable); + public abstract void removeFileStatusListener(@NotNull FileStatusListener listener); /** * @deprecated Use getStatus(file).getText()} instead */ - public String getStatusText(VirtualFile file){ + public String getStatusText(@NotNull VirtualFile file){ return getStatus(file).getText(); } /** * @deprecated Use getStatus(file).getColor()} instead */ - public Color getStatusColor(VirtualFile file){ + public Color getStatusColor(@NotNull VirtualFile file){ return getStatus(file).getColor(); } - public abstract Color getNotChangedDirectoryColor(VirtualFile vf); + public abstract Color getNotChangedDirectoryColor(@NotNull VirtualFile vf); } diff --git a/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java b/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java index d4bd50adf117..dea9dd8457bf 100644 --- a/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java +++ b/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java @@ -58,17 +58,17 @@ public class CopyPasteManagerEx extends CopyPasteManager implements ClipboardOwn } @Override - public void addContentChangedListener(ContentChangedListener listener) { + public void addContentChangedListener(@NotNull ContentChangedListener listener) { myDispatcher.addListener(listener); } @Override - public void addContentChangedListener(final ContentChangedListener listener, Disposable parentDisposable) { + public void addContentChangedListener(@NotNull final ContentChangedListener listener, @NotNull Disposable parentDisposable) { myDispatcher.addListener(listener, parentDisposable); } @Override - public void removeContentChangedListener(ContentChangedListener listener) { + public void removeContentChangedListener(@NotNull ContentChangedListener listener) { myDispatcher.removeListener(listener); } @@ -256,6 +256,7 @@ public class CopyPasteManagerEx extends CopyPasteManager implements ClipboardOwn return null; } + @NotNull @Override public Transferable[] getAllContents() { String clipString = getContents(DataFlavor.stringFlavor); diff --git a/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.java b/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.java index f4474c547514..280bfb89eacc 100644 --- a/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.java +++ b/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 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.structureView; import com.intellij.ide.util.treeView.AbstractTreeNode; @@ -42,6 +57,7 @@ public class TestGrouper implements Grouper { myChildren = new ArrayList(children); } + @NotNull @Override public Collection getChildren() { Collection result = new LinkedHashSet(); @@ -53,6 +69,7 @@ public class TestGrouper implements Grouper { return result; } + @NotNull @Override public ItemPresentation getPresentation() { return null; @@ -80,7 +97,7 @@ public class TestGrouper implements Grouper { @Override @NotNull - public Collection group(final AbstractTreeNode parent, Collection children) { + public Collection group(@NotNull final AbstractTreeNode parent, @NotNull Collection children) { List result = new ArrayList(); Collection parentGroupUsedStrings = parent.getValue() instanceof StringGroup ? ((StringGroup)parent.getValue()).myChildrenUsedStrings : diff --git a/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.java b/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.java index 7b0da6e39d40..56e628a37fd8 100644 --- a/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.java +++ b/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 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.structureView; import com.intellij.ide.projectView.PresentationData; @@ -67,12 +82,14 @@ public class TestTreeModel implements StructureViewModel{ myValue = value; } + @NotNull @Override public StructureViewTreeElement[] getChildren() { return myChildren.toArray(new StructureViewTreeElement[myChildren.size()]); } + @NotNull @Override public ItemPresentation getPresentation() { return new PresentationData(myValue, null, null, null); @@ -114,11 +131,11 @@ public class TestTreeModel implements StructureViewModel{ } @Override - public void addEditorPositionListener(FileEditorPositionListener listener) { + public void addEditorPositionListener(@NotNull FileEditorPositionListener listener) { } @Override - public void removeEditorPositionListener(FileEditorPositionListener listener) { + public void removeEditorPositionListener(@NotNull FileEditorPositionListener listener) { } @Override @@ -131,12 +148,12 @@ public class TestTreeModel implements StructureViewModel{ } @Override - public void addModelListener(ModelListener modelListener) { + public void addModelListener(@NotNull ModelListener modelListener) { } @Override - public void removeModelListener(ModelListener modelListener) { + public void removeModelListener(@NotNull ModelListener modelListener) { } } diff --git a/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java b/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java index 41feba6d1584..4db826f55837 100644 --- a/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java +++ b/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java @@ -15,6 +15,7 @@ */ package com.intellij.openapi.util; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -32,35 +33,38 @@ public class MultiValuesMap{ myBaseMap = ordered ? new LinkedHashMap>() : new HashMap>(); } - public void putAll(K key, Collection values) { + public void putAll(K key, @NotNull Collection values) { for (V value : values) { put(key, value); } } - public void putAll(K key, V... values) { + public void putAll(K key, @NotNull V... values) { for (V value : values) { put(key, value); } } public void put(K key, V value) { - if (!myBaseMap.containsKey(key)) { - myBaseMap.put(key, myOrdered ? new LinkedHashSet() : new HashSet()); + Collection collection = myBaseMap.get(key); + if (collection == null) { + collection = myOrdered ? new LinkedHashSet() : new HashSet(); + myBaseMap.put(key, collection); } - myBaseMap.get(key).add(value); + collection.add(value); } - @Nullable public Collection get(K key){ return myBaseMap.get(key); } + @NotNull public Set keySet() { return myBaseMap.keySet(); } + @NotNull public Collection values() { Set result = myOrdered ? new LinkedHashSet() : new HashSet(); for (final Collection values : myBaseMap.values()) { @@ -88,6 +92,7 @@ public class MultiValuesMap{ return myBaseMap.remove(key); } + @NotNull public Set>> entrySet() { return myBaseMap.entrySet(); } @@ -100,6 +105,7 @@ public class MultiValuesMap{ return myBaseMap.containsKey(key); } + @NotNull public Collection collectValues() { Collection result = new HashSet(); for (Collection v : myBaseMap.values()) { diff --git a/platform/util/src/com/intellij/util/ReflectionUtil.java b/platform/util/src/com/intellij/util/ReflectionUtil.java index 897c3c392770..df768fdfa56d 100644 --- a/platform/util/src/com/intellij/util/ReflectionUtil.java +++ b/platform/util/src/com/intellij/util/ReflectionUtil.java @@ -367,7 +367,7 @@ public class ReflectionUtil { } } - public static boolean isAssignable(@NotNull Class ancestor, Class descendant) { + public static boolean isAssignable(@NotNull Class ancestor, @NotNull Class descendant) { return ancestor == descendant || ancestor.isAssignableFrom(descendant); } } diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java index cc38c8d74500..7547e9772c0b 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -34,7 +34,7 @@ public class PropertiesGroupingStructureViewComponent extends StructureViewCompo protected PropertiesGroupingStructureViewComponent(Project project, FileEditor editor, PropertiesGroupingStructureViewModel structureViewModel) { - super(editor, structureViewModel, project); + super(editor, structureViewModel, project, true); showToolbar(); } diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java index b180a42b53da..2a1f94af4c95 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -26,6 +26,7 @@ import com.intellij.lang.properties.ResourceBundle; import com.intellij.lang.properties.psi.PropertiesFile; import com.intellij.navigation.ItemPresentation; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.util.ArrayList; @@ -46,6 +47,7 @@ public class ResourceBundleFileStructureViewElement implements StructureViewTree return myResourceBundle; } + @NotNull public StructureViewTreeElement[] getChildren() { List propertiesFiles = myResourceBundle.getPropertiesFiles(myProject); Map propertyNames = new LinkedHashMap(); @@ -66,6 +68,7 @@ public class ResourceBundleFileStructureViewElement implements StructureViewTree return result.toArray(new StructureViewTreeElement[result.size()]); } + @NotNull public ItemPresentation getPresentation() { return new ItemPresentation() { public String getPresentableText() { diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java index b1eb6126bca0..e521047cb9ba 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -30,6 +30,7 @@ import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.project.Project; import com.intellij.util.PlatformIcons; +import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; @@ -58,24 +59,32 @@ public class ResourceBundlePropertyStructureViewElement implements StructureView myPresentableName = presentableName; } + @Override public String getValue() { return myPropertyName; } + @Override + @NotNull public StructureViewTreeElement[] getChildren() { return EMPTY_ARRAY; } + @Override + @NotNull public ItemPresentation getPresentation() { return new ColoredItemPresentation() { + @Override public String getPresentableText() { return myPresentableName == null ? myPropertyName : myPresentableName; } + @Override public String getLocationString() { return null; } + @Override public Icon getIcon(boolean open) { return PlatformIcons.PROPERTY_ICON; } @@ -92,14 +101,17 @@ public class ResourceBundlePropertyStructureViewElement implements StructureView }; } + @Override public void navigate(boolean requestFocus) { //todo } + @Override public boolean canNavigate() { return false; } + @Override public boolean canNavigateToSource() { return false; } diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java index 90a08c81aa4a..6d3d266e8ae3 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -75,19 +75,19 @@ public class ResourceBundleStructureViewModel implements PropertiesGroupingStruc return null; } - public void addEditorPositionListener(FileEditorPositionListener listener) { + public void addEditorPositionListener(@NotNull FileEditorPositionListener listener) { } - public void removeEditorPositionListener(FileEditorPositionListener listener) { + public void removeEditorPositionListener(@NotNull FileEditorPositionListener listener) { } - public void addModelListener(ModelListener modelListener) { + public void addModelListener(@NotNull ModelListener modelListener) { } - public void removeModelListener(ModelListener modelListener) { + public void removeModelListener(@NotNull ModelListener modelListener) { } diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java b/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java index bd3393591167..b67f6bfbea3f 100644 --- a/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java +++ b/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -49,8 +49,9 @@ public class GroupByWordPrefixes implements Grouper, Sorter { return mySeparator; } + @Override @NotNull - public Collection group(final AbstractTreeNode parent, Collection children) { + public Collection group(@NotNull final AbstractTreeNode parent, @NotNull Collection children) { List keys = new ArrayList(); String parentPrefix; @@ -78,6 +79,7 @@ public class GroupByWordPrefixes implements Grouper, Sorter { keys.add(new Key(words, element)); } Collections.sort(keys, new Comparator() { + @Override public int compare(final Key k1, final Key k2) { List o1 = k1.words; List o2 = k2.words; @@ -146,6 +148,7 @@ public class GroupByWordPrefixes implements Grouper, Sorter { return !Comparing.strEqual(words.get(parentPrefixLength), prevWords.get(parentPrefixLength)); } + @Override @NotNull public ActionPresentation getPresentation() { return new ActionPresentationData(PropertiesBundle.message("structure.view.group.by.prefixes.action.name"), @@ -153,11 +156,13 @@ public class GroupByWordPrefixes implements Grouper, Sorter { AllIcons.Actions.GroupByPrefix); } + @Override @NotNull public String getName() { return ID; } + @NotNull @Override public Comparator getComparator() { return Sorter.ALPHA_SORTER.getComparator(); diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java index 44909dd3c43a..d0a203a7644f 100644 --- a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java +++ b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -52,6 +52,7 @@ public class PropertiesFileStructureViewElement extends PsiTreeElementBase getChildren() { Collection result = new ArrayList(); List prefixWords = StringUtil.split(myPrefix, mySeparator); diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewBuilderFactory.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewBuilderFactory.java index fb14390904e6..477e80fed24b 100644 --- a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewBuilderFactory.java +++ b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewBuilderFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -34,7 +34,7 @@ public class PropertiesStructureViewBuilderFactory implements PsiStructureViewFa public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) { return new StructureViewBuilder() { @NotNull - public StructureView createStructureView(FileEditor fileEditor, Project project) { + public StructureView createStructureView(FileEditor fileEditor, @NotNull Project project) { return new PropertiesFileStructureViewComponent(project, (PropertiesFileImpl)psiFile, fileEditor); } }; diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java index 5ababdd5bf44..77946f442518 100644 --- a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java +++ b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -18,6 +18,7 @@ package com.intellij.lang.properties.structureView; import com.intellij.ide.structureView.StructureViewTreeElement; import com.intellij.lang.properties.psi.Property; import com.intellij.navigation.ItemPresentation; +import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -48,10 +49,12 @@ public class PropertiesStructureViewElement implements StructureViewTreeElement return myProperty.canNavigateToSource(); } + @NotNull public StructureViewTreeElement[] getChildren() { return EMPTY_ARRAY; } + @NotNull public ItemPresentation getPresentation() { return new ItemPresentation() { public String getPresentableText() { diff --git a/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewElement.java b/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewElement.java index 0ba21cc3a7c4..bb2244580dd6 100644 --- a/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewElement.java +++ b/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -22,6 +22,7 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.jetbrains.rest.psi.RestElement; import com.jetbrains.rest.psi.RestTitle; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -56,6 +57,7 @@ public class RestStructureViewElement implements StructureViewTreeElement { return myElement.canNavigateToSource(); } + @NotNull public StructureViewTreeElement[] getChildren() { final Set childrenElements = new LinkedHashSet(); myElement.acceptChildren(new PsiElementVisitor() { @@ -77,6 +79,7 @@ public class RestStructureViewElement implements StructureViewTreeElement { return children; } + @NotNull public ItemPresentation getPresentation() { return new ItemPresentation() { public String getPresentableText() { diff --git a/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewModel.java b/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewModel.java index 0897b996e4f6..8d96f83aa23f 100644 --- a/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewModel.java +++ b/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -48,7 +48,7 @@ public class RestStructureViewModel extends StructureViewModelBase implements St } @Override - public boolean isAutoExpand(StructureViewTreeElement element) { + public boolean isAutoExpand(@NotNull StructureViewTreeElement element) { return element.getValue() instanceof PsiFile; } diff --git a/python/src/com/jetbrains/python/structureView/PyStructureViewElement.java b/python/src/com/jetbrains/python/structureView/PyStructureViewElement.java index fd043ce5dcec..93c44f7f2a17 100644 --- a/python/src/com/jetbrains/python/structureView/PyStructureViewElement.java +++ b/python/src/com/jetbrains/python/structureView/PyStructureViewElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -27,6 +27,7 @@ import com.intellij.util.Function; import com.jetbrains.python.PyNames; import com.jetbrains.python.psi.*; import icons.PythonIcons; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -120,6 +121,7 @@ public class PyStructureViewElement implements StructureViewTreeElement { return name != null ? name.hashCode() : 0; } + @NotNull public StructureViewTreeElement[] getChildren() { final Collection children = new ArrayList(); for (PyElement e : getElementChildren(myElement)) { @@ -232,6 +234,7 @@ public class PyStructureViewElement implements StructureViewTreeElement { return false; } + @NotNull @Override public ItemPresentation getPresentation() { return new ColoredItemPresentation() { diff --git a/python/src/com/jetbrains/python/structureView/PyStructureViewModel.java b/python/src/com/jetbrains/python/structureView/PyStructureViewModel.java index 662179240530..3e8e4f177568 100644 --- a/python/src/com/jetbrains/python/structureView/PyStructureViewModel.java +++ b/python/src/com/jetbrains/python/structureView/PyStructureViewModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -66,7 +66,7 @@ public class PyStructureViewModel extends StructureViewModelBase implements Stru } @Override - public boolean isAutoExpand(StructureViewTreeElement element) { + public boolean isAutoExpand(@NotNull StructureViewTreeElement element) { return element.getValue() instanceof PsiFile; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java index 4794cf59fb2a..548276faf5e9 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java +++ b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -52,10 +52,12 @@ public class DomStructureTreeElement implements StructureViewTreeElement, ItemPr return myElement.isValid() ? myElement.getXmlElement() : null; } + @NotNull public ItemPresentation getPresentation() { return this; } + @NotNull public TreeElement[] getChildren() { if (!myElement.isValid()) return EMPTY_ARRAY; final ArrayList result = new ArrayList(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewBuilder.java b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewBuilder.java index a8fb409e7c2a..0b86f4365492 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewBuilder.java +++ b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -59,8 +59,8 @@ public class DomStructureViewBuilder extends TreeBasedStructureViewBuilder { @Override @NotNull - public StructureView createStructureView(final FileEditor fileEditor, final Project project) { - return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null), project) { + public StructureView createStructureView(final FileEditor fileEditor, @NotNull final Project project) { + return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null), project, true) { @Override public AsyncResult expandPathToElement(final Object element) { if (element instanceof XmlElement) { diff --git a/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java b/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java index dd3341df4133..822086c4e90d 100644 --- a/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java +++ b/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -69,8 +69,9 @@ public class Html5SectionsNodeProvider implements FileStructureNodeProvider provideNodes(final TreeElement node) { + public Collection provideNodes(@NotNull final TreeElement node) { if (!(node instanceof HtmlFileTreeElement)) return Collections.emptyList(); final XmlFile xmlFile = ((HtmlFileTreeElement)node).getElement(); diff --git a/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java b/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java index 8a9f6f7fe54b..9dff12f3f5b0 100644 --- a/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java +++ b/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -37,6 +37,7 @@ class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements Pl private String myStructureViewPlace; private static Sorter HTML_ALPHA_SORTER = new Sorter() { + @NotNull @Override public Comparator getComparator() { return new Comparator() {