mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
NotNull
This commit is contained in:
+2
-1
@@ -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;
|
||||
|
||||
+3
-2
@@ -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<JavaAnonymousClassTreeElement> provideNodes(TreeElement node) {
|
||||
public Collection<JavaAnonymousClassTreeElement> 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)) {
|
||||
|
||||
+4
-2
@@ -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<TreeElement> provideNodes(TreeElement node) {
|
||||
public Collection<TreeElement> provideNodes(@NotNull TreeElement node) {
|
||||
if (node instanceof JavaClassTreeElement) {
|
||||
final PsiClass aClass = ((JavaClassTreeElement)node).getValue();
|
||||
Collection<PsiElement> inherited = new LinkedHashSet<PsiElement>();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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> group(final AbstractTreeNode parent, Collection<TreeElement> children) {
|
||||
public Collection<Group> group(@NotNull final AbstractTreeNode parent, @NotNull Collection<TreeElement> children) {
|
||||
if (parent.getValue() instanceof PropertyGroup) return Collections.emptyList();
|
||||
Map<Group,Group> result = new THashMap<Group, Group>();
|
||||
for (TreeElement o : children) {
|
||||
|
||||
@@ -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<TreeElement> getChildren() {
|
||||
return myChildren;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ItemPresentation getPresentation() {
|
||||
return this;
|
||||
}
|
||||
|
||||
+2
-1
@@ -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<PsiField> impl
|
||||
return getElement();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getAlphaSortKey() {
|
||||
final PsiField field = getElement();
|
||||
if (field != null) {
|
||||
|
||||
+2
-1
@@ -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<PsiMethod> im
|
||||
return getElement();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getAlphaSortKey() {
|
||||
final PsiMethod method = getElement();
|
||||
|
||||
@@ -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<TreeElement> getChildren() {
|
||||
return myChildren;
|
||||
}
|
||||
@@ -56,6 +58,7 @@ public class SuperTypeGroup implements Group, ItemPresentation, AccessLevelProvi
|
||||
return (PsiClass)mySuperClassPointer.getElement();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ItemPresentation getPresentation() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -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> group(final AbstractTreeNode parent, Collection<TreeElement> children) {
|
||||
public Collection<Group> group(@NotNull final AbstractTreeNode parent, @NotNull Collection<TreeElement> children) {
|
||||
if (isParentGrouped(parent)) return Collections.emptyList();
|
||||
Map<Group, SuperTypeGroup> groups = new THashMap<Group, SuperTypeGroup>();
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<ColorKey> {
|
||||
private Color myDefaultColor = NULL_COLOR;
|
||||
private static final Map<String, ColorKey> ourRegistry = new HashMap<String, ColorKey>();
|
||||
|
||||
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<ColorKey> {
|
||||
}
|
||||
}
|
||||
|
||||
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<ColorKey> {
|
||||
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;
|
||||
|
||||
+4
-4
@@ -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) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
+5
-4
@@ -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<SmartPointerWrapper> 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<PsiElement> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<StructureViewExtension> getAllExtensions(Class<? extends PsiElement> type);
|
||||
@NotNull
|
||||
public abstract Collection<StructureViewExtension> getAllExtensions(@NotNull Class<? extends PsiElement> 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);
|
||||
}
|
||||
+3
-1
@@ -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<V extends PsiElement> implements Struct
|
||||
return (V)myTreeElement.getValue();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public StructureViewTreeElement[] getChildren() {
|
||||
TreeElement[] baseChildren = myTreeElement.getChildren();
|
||||
@@ -63,6 +64,7 @@ public class StructureViewElementWrapper<V extends PsiElement> implements Struct
|
||||
return result.toArray(new StructureViewTreeElement[result.size()]);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ItemPresentation getPresentation() {
|
||||
return myTreeElement.getPresentation();
|
||||
|
||||
+15
-8
@@ -106,8 +106,9 @@ public final class StructureViewFactoryImpl extends StructureViewFactoryEx imple
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<StructureViewExtension> getAllExtensions(Class<? extends PsiElement> type) {
|
||||
public Collection<StructureViewExtension> getAllExtensions(@NotNull Class<? extends PsiElement> type) {
|
||||
Collection<StructureViewExtension> result = myImplExtensions.get(type);
|
||||
if (result == null) {
|
||||
MultiValuesMap<Class<? extends PsiElement>, 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);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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<StructureViewComposite.StructureViewDescriptor> viewDescriptors = new ArrayList<StructureViewComposite.StructureViewDescriptor>();
|
||||
final TemplateLanguageFileViewProvider provider = getViewProvider();
|
||||
|
||||
+3
-1
@@ -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 <T extends PsiElement> implements Struc
|
||||
myValue = psiElement;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ItemPresentation getPresentation() {
|
||||
return this;
|
||||
@@ -94,6 +95,7 @@ public abstract class PsiTreeElementBase <T extends PsiElement> implements Struc
|
||||
return element != null ? element.toString() : "";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public final StructureViewTreeElement[] getChildren() {
|
||||
final T element = getElement();
|
||||
|
||||
+18
-30
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -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;
|
||||
}
|
||||
|
||||
+21
-21
@@ -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<TreeAction> filtered = filterActive(myModel.getGroupers());
|
||||
List<Grouper> filtered = filterActive(myModel.getGroupers());
|
||||
return filtered.toArray(new Grouper[filtered.size()]);
|
||||
}
|
||||
|
||||
private ArrayList<TreeAction> filterActive(TreeAction[] actions) {
|
||||
ArrayList<TreeAction> filtered = new ArrayList<TreeAction>();
|
||||
for (TreeAction action : actions) {
|
||||
@NotNull
|
||||
private <T extends TreeAction> List<T> filterActive(@NotNull T[] actions) {
|
||||
List<T> filtered = new ArrayList<T>();
|
||||
for (T action : actions) {
|
||||
if (isFiltered(action)) filtered.add(action);
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
||||
private ArrayList<NodeProvider> filterProviders(Collection<NodeProvider> actions) {
|
||||
ArrayList<NodeProvider> filtered = new ArrayList<NodeProvider>();
|
||||
@NotNull
|
||||
private List<NodeProvider> filterProviders(@NotNull Collection<NodeProvider> actions) {
|
||||
List<NodeProvider> filtered = new ArrayList<NodeProvider>();
|
||||
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<TreeAction> filtered = filterActive(myModel.getSorters());
|
||||
List<Sorter> filtered = filterActive(myModel.getSorters());
|
||||
return filtered.toArray(new Sorter[filtered.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Filter[] getFilters() {
|
||||
ArrayList<TreeAction> filtered = filterActive(myModel.getFilters());
|
||||
List<Filter> 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<TreeElement> elements = new ArrayList<TreeElement>();
|
||||
@@ -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();
|
||||
|
||||
+18
-9
@@ -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 <Value> extends AbstractTreeNode<Value> {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.treeView.smartTree.CachingChildrenTreeNode");
|
||||
private List<CachingChildrenTreeNode> myChildren;
|
||||
private List<CachingChildrenTreeNode> myOldChildren = null;
|
||||
protected final TreeModel myTreeModel;
|
||||
@@ -95,12 +97,13 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V
|
||||
}
|
||||
}
|
||||
|
||||
protected void filterChildren(Filter[] filters) {
|
||||
protected void filterChildren(@NotNull Filter[] filters) {
|
||||
Collection<AbstractTreeNode> children = getChildren();
|
||||
for (Filter filter : filters) {
|
||||
for (Iterator<AbstractTreeNode> 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 <Value> extends AbstractTreeNode<V
|
||||
setChildren(children);
|
||||
}
|
||||
|
||||
protected void groupChildren(Grouper[] groupers) {
|
||||
protected void groupChildren(@NotNull Grouper[] groupers) {
|
||||
for (Grouper grouper : groupers) {
|
||||
groupElements(grouper);
|
||||
}
|
||||
@@ -147,16 +150,22 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V
|
||||
setChildren(result);
|
||||
}
|
||||
|
||||
private void processUngrouped(List<AbstractTreeNode<TreeElement>> ungrouped, Grouper grouper) {
|
||||
private void processUngrouped(@NotNull List<AbstractTreeNode<TreeElement>> ungrouped, @NotNull Grouper grouper) {
|
||||
Map<TreeElement,AbstractTreeNode> ungroupedObjects = collectValues(ungrouped);
|
||||
Collection<Group> groups = grouper.group(this, ungroupedObjects.keySet());
|
||||
|
||||
Map<Group, GroupWrapper> groupNodes = createGroupNodes(groups);
|
||||
|
||||
for (Group group : groups) {
|
||||
if (group == null) {
|
||||
LOG.error(grouper + " returned null group: "+groups);
|
||||
}
|
||||
GroupWrapper groupWrapper = groupNodes.get(group);
|
||||
Collection<TreeElement> 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 <Value> extends AbstractTreeNode<V
|
||||
}
|
||||
}
|
||||
|
||||
protected TreeElementWrapper createChildNode(final TreeElement child) {
|
||||
protected TreeElementWrapper createChildNode(@NotNull TreeElement child) {
|
||||
return new TreeElementWrapper(getProject(), child, myTreeModel);
|
||||
}
|
||||
|
||||
@@ -177,7 +186,7 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V
|
||||
return objects;
|
||||
}
|
||||
|
||||
private Map<Group, GroupWrapper> createGroupNodes(Collection<Group> groups) {
|
||||
private Map<Group, GroupWrapper> createGroupNodes(@NotNull Collection<Group> groups) {
|
||||
Map<Group, GroupWrapper> result = new THashMap<Group, GroupWrapper>();
|
||||
for (Group group : groups) {
|
||||
result.put(group, createGroupWrapper(getProject(), group, myTreeModel));
|
||||
@@ -185,7 +194,7 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V
|
||||
return result;
|
||||
}
|
||||
|
||||
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 GroupWrapper(project, group, treeModel);
|
||||
}
|
||||
|
||||
@@ -225,7 +234,7 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void copyFromNewInstance(final CachingChildrenTreeNode newInstance);
|
||||
protected abstract void copyFromNewInstance(@NotNull CachingChildrenTreeNode newInstance);
|
||||
|
||||
protected abstract void performTreeActions();
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -17,19 +17,21 @@
|
||||
package com.intellij.ide.util.treeView.smartTree;
|
||||
|
||||
import com.intellij.ide.projectView.PresentationData;
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class GroupWrapper extends CachingChildrenTreeNode<Group> {
|
||||
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<Group> {
|
||||
@Override
|
||||
public void initChildren() {
|
||||
clearChildren();
|
||||
Collection<TreeElement> children = getValue().getChildren();
|
||||
Group group = getValue();
|
||||
Collection<TreeElement> children = group.getChildren();
|
||||
for (TreeElement child : children) {
|
||||
if (child == null) {
|
||||
LOG.error(group + " returned null child: " + children);
|
||||
}
|
||||
TreeElementWrapper childNode = createChildNode(child);
|
||||
addSubElement(childNode);
|
||||
}
|
||||
|
||||
+15
-4
@@ -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<TreeElement> {
|
||||
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<TreeElement> {
|
||||
@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<NodeProvider> providers = ((ProvidingTreeModel)myTreeModel).getNodeProviders();
|
||||
for (NodeProvider provider : providers) {
|
||||
if (((ProvidingTreeModel)myTreeModel).isEnabled(provider)) {
|
||||
final Collection<TreeElement> nodes = provider.provideNodes(getValue());
|
||||
final Collection<TreeElement> nodes = provider.provideNodes(value);
|
||||
for (TreeElement node : nodes) {
|
||||
if (node == null) {
|
||||
LOG.error(provider + " returned null node: " + nodes);
|
||||
}
|
||||
addSubElement(createChildNode(node));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 <code>false</code> 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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -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();*/
|
||||
}
|
||||
|
||||
@@ -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<T> extends PresentableNodeDescriptor<Abst
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postprocess(PresentationData presentation) {
|
||||
protected void postprocess(@NotNull PresentationData presentation) {
|
||||
if (hasProblemFileBeneath() ) {
|
||||
presentation.setAttributesKey(CodeInsightColors.ERRORS_ATTRIBUTES);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public abstract class AbstractTreeNode<T> extends PresentableNodeDescriptor<Abst
|
||||
}
|
||||
}
|
||||
|
||||
protected void setForcedForeground(PresentationData presentation) {
|
||||
protected void setForcedForeground(@NotNull PresentationData presentation) {
|
||||
final FileStatus status = getFileStatus();
|
||||
Color fgColor = getFileStatusColor(status);
|
||||
fgColor = fgColor == null ? status.getColor() : fgColor;
|
||||
@@ -145,18 +145,11 @@ public abstract class AbstractTreeNode<T> extends PresentableNodeDescriptor<Abst
|
||||
if (myValue == null) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return (T)TreeAnchorizer.getService().retrieveElement(myValue);
|
||||
}
|
||||
return (T)TreeAnchorizer.getService().retrieveElement(myValue);
|
||||
}
|
||||
|
||||
public final void setValue(T value) {
|
||||
if (value == null) {
|
||||
myValue = null;
|
||||
}
|
||||
else {
|
||||
myValue = TreeAnchorizer.getService().createAnchor(value);
|
||||
}
|
||||
myValue = value == null ? null : TreeAnchorizer.getService().createAnchor(value);
|
||||
}
|
||||
|
||||
public final Object getEqualityObject() {
|
||||
|
||||
@@ -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.
|
||||
@@ -717,8 +717,9 @@ public class AbstractTreeUi {
|
||||
Runnable update = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (getElementFromDescriptor(rootDescriptor.get()) != null) {
|
||||
createMapping(getElementFromDescriptor(rootDescriptor.get()), getRootNode());
|
||||
Object fromDescriptor = getElementFromDescriptor(rootDescriptor.get());
|
||||
if (fromDescriptor != null) {
|
||||
createMapping(fromDescriptor, getRootNode());
|
||||
}
|
||||
|
||||
|
||||
@@ -3070,8 +3071,9 @@ public class AbstractTreeUi {
|
||||
public void run() {
|
||||
if (!oldElement.equals(newElement.get()) || forceRemapping.get()) {
|
||||
removeMapping(oldElement, childNode, newElement.get());
|
||||
if (newElement.get() != null) {
|
||||
createMapping(newElement.get(), childNode);
|
||||
Object newE = newElement.get();
|
||||
if (newE != null) {
|
||||
createMapping(newE, childNode);
|
||||
}
|
||||
NodeDescriptor parentDescriptor = getDescriptorFrom(parentNode);
|
||||
if (parentDescriptor != null) {
|
||||
@@ -3660,7 +3662,9 @@ public class AbstractTreeUi {
|
||||
NodeDescriptor descriptor = getDescriptorFrom(node);
|
||||
if (descriptor == null) return;
|
||||
final Object element = getElementFromDescriptor(descriptor);
|
||||
removeMapping(element, node, null);
|
||||
if (element != null) {
|
||||
removeMapping(element, node, null);
|
||||
}
|
||||
myAutoExpandRoots.remove(element);
|
||||
node.setUserObject(null);
|
||||
node.removeAllChildren();
|
||||
@@ -4565,7 +4569,7 @@ public class AbstractTreeUi {
|
||||
myUpdaterState = null;
|
||||
}
|
||||
|
||||
private void createMapping(Object element, DefaultMutableTreeNode node) {
|
||||
private void createMapping(@NotNull Object element, DefaultMutableTreeNode node) {
|
||||
element = TreeAnchorizer.getService().createAnchor(element);
|
||||
if (!myElementToNodeMap.containsKey(element)) {
|
||||
myElementToNodeMap.put(element, node);
|
||||
@@ -4585,7 +4589,7 @@ public class AbstractTreeUi {
|
||||
}
|
||||
}
|
||||
|
||||
private void removeMapping(Object element, DefaultMutableTreeNode node, @Nullable Object elementToPutNodeActionsFor) {
|
||||
private void removeMapping(@NotNull Object element, DefaultMutableTreeNode node, @Nullable Object elementToPutNodeActionsFor) {
|
||||
element = TreeAnchorizer.getService().createAnchor(element);
|
||||
final Object value = myElementToNodeMap.get(element);
|
||||
if (value != null) {
|
||||
|
||||
+5
-2
@@ -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,11 +15,14 @@
|
||||
*/
|
||||
package com.intellij.ide.util.treeView.smartTree;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public interface NodeProvider<T extends TreeElement> extends TreeAction {
|
||||
Collection<T> provideNodes(TreeElement node);
|
||||
@NotNull
|
||||
Collection<T> provideNodes(@NotNull TreeElement node);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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> T getContents(@NotNull DataFlavor flavor);
|
||||
|
||||
@NotNull
|
||||
public abstract Transferable[] getAllContents();
|
||||
|
||||
public abstract void setContents(@NotNull Transferable content);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<TreeElement>(children);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<TreeElement> getChildren() {
|
||||
Collection<TreeElement> result = new LinkedHashSet<TreeElement>();
|
||||
@@ -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> group(final AbstractTreeNode parent, Collection<TreeElement> children) {
|
||||
public Collection<Group> group(@NotNull final AbstractTreeNode parent, @NotNull Collection<TreeElement> children) {
|
||||
List<Group> result = new ArrayList<Group>();
|
||||
Collection<String> parentGroupUsedStrings = parent.getValue() instanceof StringGroup ?
|
||||
((StringGroup)parent.getValue()).myChildrenUsedStrings :
|
||||
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<K, V>{
|
||||
myBaseMap = ordered ? new LinkedHashMap<K, Collection<V>>() : new HashMap<K, Collection<V>>();
|
||||
}
|
||||
|
||||
public void putAll(K key, Collection<V> values) {
|
||||
public void putAll(K key, @NotNull Collection<V> 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<V>() : new HashSet<V>());
|
||||
Collection<V> collection = myBaseMap.get(key);
|
||||
if (collection == null) {
|
||||
collection = myOrdered ? new LinkedHashSet<V>() : new HashSet<V>();
|
||||
myBaseMap.put(key, collection);
|
||||
}
|
||||
|
||||
myBaseMap.get(key).add(value);
|
||||
collection.add(value);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Collection<V> get(K key){
|
||||
return myBaseMap.get(key);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<K> keySet() {
|
||||
return myBaseMap.keySet();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<V> values() {
|
||||
Set<V> result = myOrdered ? new LinkedHashSet<V>() : new HashSet<V>();
|
||||
for (final Collection<V> values : myBaseMap.values()) {
|
||||
@@ -88,6 +92,7 @@ public class MultiValuesMap<K, V>{
|
||||
return myBaseMap.remove(key);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<Map.Entry<K, Collection<V>>> entrySet() {
|
||||
return myBaseMap.entrySet();
|
||||
}
|
||||
@@ -100,6 +105,7 @@ public class MultiValuesMap<K, V>{
|
||||
return myBaseMap.containsKey(key);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<V> collectValues() {
|
||||
Collection<V> result = new HashSet<V>();
|
||||
for (Collection<V> v : myBaseMap.values()) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -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<PropertiesFile> propertiesFiles = myResourceBundle.getPropertiesFiles(myProject);
|
||||
Map<String, IProperty> propertyNames = new LinkedHashMap<String, IProperty>();
|
||||
@@ -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() {
|
||||
|
||||
+13
-1
@@ -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;
|
||||
}
|
||||
|
||||
+5
-5
@@ -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) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -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> group(final AbstractTreeNode parent, Collection<TreeElement> children) {
|
||||
public Collection<Group> group(@NotNull final AbstractTreeNode parent, @NotNull Collection<TreeElement> children) {
|
||||
List<Key> keys = new ArrayList<Key>();
|
||||
|
||||
String parentPrefix;
|
||||
@@ -78,6 +79,7 @@ public class GroupByWordPrefixes implements Grouper, Sorter {
|
||||
keys.add(new Key(words, element));
|
||||
}
|
||||
Collections.sort(keys, new Comparator<Key>() {
|
||||
@Override
|
||||
public int compare(final Key k1, final Key k2) {
|
||||
List<String> o1 = k1.words;
|
||||
List<String> 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();
|
||||
|
||||
+2
-1
@@ -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<Prope
|
||||
return getElement().getName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ItemPresentation getPresentation() {
|
||||
return new ItemPresentation() {
|
||||
public String getPresentableText() {
|
||||
|
||||
+2
-1
@@ -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 class PropertiesFileStructureViewModel extends TextEditorBasedStructureVi
|
||||
private final GroupByWordPrefixes myGroupByWordPrefixes;
|
||||
@NonNls public static final String KIND_SORTER_ID = "KIND_SORTER";
|
||||
private static final Sorter KIND_SORTER = new Sorter() {
|
||||
@NotNull
|
||||
public Comparator getComparator() {
|
||||
return new Comparator() {
|
||||
public int compare(final Object o1, final Object o2) {
|
||||
|
||||
+3
-1
@@ -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,6 +46,7 @@ public class PropertiesPrefixGroup implements Group {
|
||||
mySeparator = separator;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ItemPresentation getPresentation() {
|
||||
return new ItemPresentation() {
|
||||
public String getPresentableText() {
|
||||
@@ -62,6 +63,7 @@ public class PropertiesPrefixGroup implements Group {
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<TreeElement> getChildren() {
|
||||
Collection<TreeElement> result = new ArrayList<TreeElement>();
|
||||
List<String> prefixWords = StringUtil.split(myPrefix, mySeparator);
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
+4
-1
@@ -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() {
|
||||
|
||||
@@ -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<RestElement> childrenElements = new LinkedHashSet<RestElement>();
|
||||
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() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<StructureViewTreeElement> children = new ArrayList<StructureViewTreeElement>();
|
||||
for (PyElement e : getElementChildren(myElement)) {
|
||||
@@ -232,6 +234,7 @@ public class PyStructureViewElement implements StructureViewTreeElement {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ItemPresentation getPresentation() {
|
||||
return new ColoredItemPresentation() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<TreeElement> result = new ArrayList<TreeElement>();
|
||||
|
||||
@@ -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<AbstractTreeNode> expandPathToElement(final Object element) {
|
||||
if (element instanceof XmlElement) {
|
||||
|
||||
@@ -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<Html
|
||||
return HTML5_OUTLINE_PROVIDER_PROPERTY;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<Html5SectionTreeElement> provideNodes(final TreeElement node) {
|
||||
public Collection<Html5SectionTreeElement> provideNodes(@NotNull final TreeElement node) {
|
||||
if (!(node instanceof HtmlFileTreeElement)) return Collections.emptyList();
|
||||
|
||||
final XmlFile xmlFile = ((HtmlFileTreeElement)node).getElement();
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user