mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
mark more obvious usages of ViewSettings not null
This commit is contained in:
+2
-2
@@ -44,7 +44,7 @@ import java.util.Collection;
|
||||
|
||||
public class PsiClassFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
@Override
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, final ViewSettings viewSettings) {
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, @NotNull final ViewSettings viewSettings) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(context);
|
||||
if (project == null) return null;
|
||||
PsiElement[] elements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(context);
|
||||
@@ -77,7 +77,7 @@ public class PsiClassFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTreeNode createNode(final Project project, final Object element, final ViewSettings viewSettings) {
|
||||
public AbstractTreeNode createNode(final Project project, final Object element, @NotNull final ViewSettings viewSettings) {
|
||||
if (element instanceof PsiClass && checkClassUnderSources((PsiElement)element, project)) {
|
||||
return new ClassSmartPointerNode(project, (PsiClass)element, viewSettings);
|
||||
}
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ import java.util.Collection;
|
||||
|
||||
public class PsiFieldFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
@Override
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, final ViewSettings viewSettings) {
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, @NotNull final ViewSettings viewSettings) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(context);
|
||||
if (project == null) return null;
|
||||
PsiElement[] elements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(context);
|
||||
@@ -64,7 +64,7 @@ public class PsiFieldFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTreeNode createNode(final Project project, final Object element, final ViewSettings viewSettings) {
|
||||
public AbstractTreeNode createNode(final Project project, final Object element, @NotNull final ViewSettings viewSettings) {
|
||||
if (element instanceof PsiField) {
|
||||
return new FieldSmartPointerNode(project, (PsiField)element, viewSettings);
|
||||
}
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ import java.util.Collection;
|
||||
|
||||
public class PsiMethodFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
@Override
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, final ViewSettings viewSettings) {
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, @NotNull final ViewSettings viewSettings) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(context);
|
||||
if (project == null) return null;
|
||||
PsiElement[] elements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(context);
|
||||
@@ -64,7 +64,7 @@ public class PsiMethodFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTreeNode createNode(final Project project, final Object element, final ViewSettings viewSettings) {
|
||||
public AbstractTreeNode createNode(final Project project, final Object element, @NotNull final ViewSettings viewSettings) {
|
||||
if (element instanceof PsiMethod) {
|
||||
return new MethodSmartPointerNode(project, (PsiMethod)element, viewSettings);
|
||||
}
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ import java.util.Set;
|
||||
|
||||
public class PsiPackageFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
@Override
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, final ViewSettings viewSettings) {
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, @NotNull final ViewSettings viewSettings) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(context);
|
||||
if (project == null) return null;
|
||||
PsiElement[] elements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(context);
|
||||
@@ -101,7 +101,7 @@ public class PsiPackageFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTreeNode createNode(final Project project, final Object element, final ViewSettings viewSettings) {
|
||||
public AbstractTreeNode createNode(final Project project, final Object element, @NotNull final ViewSettings viewSettings) {
|
||||
if (element instanceof PackageElement) {
|
||||
return new PackageElementNode(project, (PackageElement)element, viewSettings);
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import java.util.Collection;
|
||||
abstract class BaseSmartPointerPsiNode <Type extends SmartPsiElementPointer> extends ProjectViewNode<Type> implements PsiElementNavigationItem {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.projectView.impl.nodes.BasePsiNode");
|
||||
|
||||
BaseSmartPointerPsiNode(Project project, @NotNull Type value, ViewSettings viewSettings) {
|
||||
BaseSmartPointerPsiNode(@NotNull Project project, @NotNull Type value, @NotNull ViewSettings viewSettings) {
|
||||
super(project, value, viewSettings);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class ClassSmartPointerNode extends BaseSmartPointerPsiNode<SmartPsiElementPointer>{
|
||||
public ClassSmartPointerNode(Project project, @NotNull PsiClass value, ViewSettings viewSettings) {
|
||||
public ClassSmartPointerNode(@NotNull Project project, @NotNull PsiClass value, @NotNull ViewSettings viewSettings) {
|
||||
super(project, SmartPointerManager.getInstance(project).createSmartPsiElementPointer(value), viewSettings);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class FieldSmartPointerNode extends BaseSmartPointerPsiNode<SmartPsiElementPointer>{
|
||||
public FieldSmartPointerNode(Project project, @NotNull PsiField value, ViewSettings viewSettings) {
|
||||
public FieldSmartPointerNode(@NotNull Project project, @NotNull PsiField value, @NotNull ViewSettings viewSettings) {
|
||||
super(project, SmartPointerManager.getInstance(project).createSmartPsiElementPointer(value), viewSettings);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class MethodSmartPointerNode extends BaseSmartPointerPsiNode<SmartPsiElementPointer>{
|
||||
public MethodSmartPointerNode(Project project, @NotNull PsiMethod value, ViewSettings viewSettings) {
|
||||
public MethodSmartPointerNode(@NotNull Project project, @NotNull PsiMethod value, @NotNull ViewSettings viewSettings) {
|
||||
super(project, SmartPointerManager.getInstance(project).createSmartPsiElementPointer(value), viewSettings);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PsiFieldNode extends BasePsiMemberNode<PsiField>{
|
||||
public PsiFieldNode(Project project, @NotNull PsiField value, ViewSettings viewSettings) {
|
||||
public PsiFieldNode(Project project, @NotNull PsiField value, @NotNull ViewSettings viewSettings) {
|
||||
super(project, value, viewSettings);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.Collection;
|
||||
|
||||
public class PsiMethodNode extends BasePsiMemberNode<PsiMethod>{
|
||||
public PsiMethodNode(Project project, @NotNull PsiMethod value, ViewSettings viewSettings) {
|
||||
public PsiMethodNode(Project project, @NotNull PsiMethod value, @NotNull ViewSettings viewSettings) {
|
||||
super(project, value, viewSettings);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class SameNamesJoiner implements TreeStructureProvider {
|
||||
for (Object each : executed.keySet()) {
|
||||
Collection<AbstractTreeNode> objects = executed.get(each);
|
||||
if (objects.size() > 1) {
|
||||
result.add(new JoinedNode(objects, new Joined(findPsiFileIn(objects))));
|
||||
result.add(new JoinedNode(objects, new Joined(findPsiFileIn(objects)), settings));
|
||||
}
|
||||
else if (objects.size() == 1) {
|
||||
result.add(objects.iterator().next());
|
||||
@@ -121,8 +121,8 @@ class SameNamesJoiner implements TreeStructureProvider {
|
||||
return myChildren;
|
||||
}
|
||||
|
||||
JoinedNode(Collection<AbstractTreeNode> children, @NotNull Joined formFile) {
|
||||
super(null, formFile, null);
|
||||
JoinedNode(Collection<AbstractTreeNode> children, @NotNull Joined formFile, ViewSettings settings) {
|
||||
super(null, formFile, settings);
|
||||
myChildren = children;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,10 +40,10 @@ public abstract class FavoriteNodeProvider {
|
||||
public static final ExtensionPointName<FavoriteNodeProvider> EP_NAME = new ExtensionPointName<>("com.intellij.favoriteNodeProvider");
|
||||
|
||||
@Nullable
|
||||
public abstract Collection<AbstractTreeNode> getFavoriteNodes(DataContext context, final ViewSettings viewSettings);
|
||||
public abstract Collection<AbstractTreeNode> getFavoriteNodes(DataContext context, @NotNull ViewSettings viewSettings);
|
||||
|
||||
@Nullable
|
||||
public AbstractTreeNode createNode(final Project project, final Object element, final ViewSettings viewSettings) {
|
||||
public AbstractTreeNode createNode(final Project project, final Object element, @NotNull ViewSettings viewSettings) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ public abstract class FavoriteNodeProvider {
|
||||
* Returns the weight of the specified project view node element to use when sorting the favorites list.
|
||||
*
|
||||
* @param element the element for which the weight is requested.
|
||||
* @param isSortByType
|
||||
* @return the weight, or -1 if {@code element} is not an element supported by this provider.
|
||||
*/
|
||||
public abstract int getElementWeight(final Object element, final boolean isSortByType);
|
||||
@@ -94,7 +93,6 @@ public abstract class FavoriteNodeProvider {
|
||||
/**
|
||||
* Returns the persistable URL for the specified element.
|
||||
*
|
||||
* @param element
|
||||
* @return the URL, or null if the element is not supported by this provider.
|
||||
*/
|
||||
@Nullable @NonNls
|
||||
@@ -103,7 +101,6 @@ public abstract class FavoriteNodeProvider {
|
||||
/**
|
||||
* Returns the name of the module containing the specified element.
|
||||
*
|
||||
* @param element
|
||||
* @return the name of the module, or null if the element is not supported by this provider or the module name is unknown.
|
||||
*/
|
||||
@Nullable
|
||||
|
||||
@@ -160,6 +160,7 @@ public class FavoritesManager implements ProjectComponent, JDOMExternalizable {
|
||||
rootsChanged();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FavoritesViewSettings getViewSettings() {
|
||||
return myViewSettings;
|
||||
}
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ public class UsageFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(DataContext context, ViewSettings viewSettings) {
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(DataContext context, @NotNull ViewSettings viewSettings) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(context);
|
||||
if (project == null) {
|
||||
return null;
|
||||
@@ -132,7 +132,7 @@ public class UsageFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTreeNode createNode(Project project, Object element, ViewSettings viewSettings) {
|
||||
public AbstractTreeNode createNode(Project project, Object element, @NotNull ViewSettings viewSettings) {
|
||||
if (element instanceof UsageInfo) {
|
||||
return new UsageProjectTreeNode(project, (UsageInfo)element, viewSettings);
|
||||
}
|
||||
|
||||
+2
-2
@@ -130,7 +130,7 @@ public class AddToFavoritesAction extends AnAction implements DumbAware {
|
||||
Module moduleContext,
|
||||
Object object,
|
||||
boolean inProjectView,
|
||||
ViewSettings favoritesConfig) {
|
||||
@NotNull ViewSettings favoritesConfig) {
|
||||
if (project == null) return Collections.emptyList();
|
||||
ArrayList<AbstractTreeNode> result = new ArrayList<>();
|
||||
for (FavoriteNodeProvider provider : FavoriteNodeProvider.EP_NAME.getExtensions(project)) {
|
||||
@@ -230,7 +230,7 @@ public class AddToFavoritesAction extends AnAction implements DumbAware {
|
||||
private static void addPsiElementNode(PsiElement psiElement,
|
||||
final Project project,
|
||||
final ArrayList<? super AbstractTreeNode> result,
|
||||
final ViewSettings favoritesConfig) {
|
||||
@NotNull ViewSettings favoritesConfig) {
|
||||
|
||||
Class<? extends AbstractTreeNode> klass = getPsiElementNodeClass(psiElement);
|
||||
if (klass == null) {
|
||||
|
||||
+1
-1
@@ -413,7 +413,7 @@ public class ProjectViewDirectoryHelper {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<AbstractTreeNode> createFileAndDirectoryNodes(@NotNull List<? extends VirtualFile> files, @Nullable ViewSettings viewSettings) {
|
||||
public Collection<AbstractTreeNode> createFileAndDirectoryNodes(@NotNull List<? extends VirtualFile> files, ViewSettings viewSettings) {
|
||||
final List<AbstractTreeNode> children = new ArrayList<>(files.size());
|
||||
final PsiManager psiManager = PsiManager.getInstance(myProject);
|
||||
for (final VirtualFile virtualFile : files) {
|
||||
|
||||
@@ -576,9 +576,11 @@ public final class ScopeViewTreeModel extends BaseTreeModel<AbstractTreeNode> im
|
||||
}
|
||||
});
|
||||
if (provider == null) return children;
|
||||
children.addAll(provider.modify(parent, files.stream()
|
||||
List<AbstractTreeNode> nodes = files
|
||||
.stream()
|
||||
.map(file -> new PsiFileNode(getProject(), file, getSettings()))
|
||||
.collect(Collectors.toList()), getSettings()));
|
||||
.collect(Collectors.toList());
|
||||
children.addAll(provider.modify(parent, nodes, getSettings()));
|
||||
return children;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,19 +74,11 @@ public class SliceNode extends AbstractTreeNode<SliceUsage> implements Duplicate
|
||||
|
||||
if (current == null) {
|
||||
ProgressIndicator indicator = new ProgressIndicatorBase();
|
||||
indicator.start();
|
||||
|
||||
Ref<List<SliceNode>> nodesRef = Ref.create();
|
||||
try {
|
||||
ProgressManager.getInstance().executeProcessUnderProgress(
|
||||
() -> nodesRef.set(doGetChildren()), indicator);
|
||||
}
|
||||
finally {
|
||||
indicator.stop();
|
||||
}
|
||||
|
||||
ProgressManager.getInstance().runProcess(() -> nodesRef.set(doGetChildren()), indicator);
|
||||
nodes = nodesRef.get();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
nodes = doGetChildren();
|
||||
}
|
||||
|
||||
@@ -94,7 +86,8 @@ public class SliceNode extends AbstractTreeNode<SliceUsage> implements Duplicate
|
||||
myCachedChildren = nodes;
|
||||
}
|
||||
return nodes;
|
||||
} catch (ProcessCanceledException pce) {
|
||||
}
|
||||
catch (ProcessCanceledException pce) {
|
||||
changed = true;
|
||||
throw pce;
|
||||
}
|
||||
|
||||
+4
-10
@@ -177,16 +177,10 @@ public class BackgroundTaskUtil {
|
||||
|
||||
Helper<T> helper = new Helper<>();
|
||||
|
||||
indicator.start();
|
||||
ApplicationManager.getApplication().executeOnPooledThread(() -> ProgressManager.getInstance().executeProcessUnderProgress(() -> {
|
||||
try {
|
||||
T result = task.fun(indicator);
|
||||
if (!helper.setResult(result)) {
|
||||
asyncCallback.consume(result, indicator);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
indicator.stop();
|
||||
ApplicationManager.getApplication().executeOnPooledThread(() -> ProgressManager.getInstance().runProcess(() -> {
|
||||
T result = task.fun(indicator);
|
||||
if (!helper.setResult(result)) {
|
||||
asyncCallback.consume(result, indicator);
|
||||
}
|
||||
}, indicator));
|
||||
|
||||
|
||||
+1
-2
@@ -22,7 +22,6 @@ import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.navigation.NavigationItem;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.ui.Queryable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.problems.WolfTheProblemSolver;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -55,7 +54,7 @@ public abstract class AbstractMvcPsiNodeDescriptor extends BasePsiNode<PsiElemen
|
||||
private final int myWeight;
|
||||
|
||||
protected AbstractMvcPsiNodeDescriptor(@NotNull final Module module,
|
||||
@Nullable final ViewSettings viewSettings,
|
||||
final ViewSettings viewSettings,
|
||||
@NotNull final PsiElement nodeId, int weight) {
|
||||
super(module.getProject(), nodeId, viewSettings);
|
||||
myModule = module;
|
||||
|
||||
@@ -35,7 +35,7 @@ import java.util.List;
|
||||
public class ClassNode extends AbstractMvcPsiNodeDescriptor {
|
||||
public ClassNode(@NotNull final Module module,
|
||||
@NotNull final GrTypeDefinition rClass,
|
||||
@Nullable final ViewSettings viewSettings) {
|
||||
final ViewSettings viewSettings) {
|
||||
super(module, viewSettings, rClass, CLASS);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.ide.util.treeView.AbstractTreeNode;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -32,7 +31,7 @@ import java.util.Collection;
|
||||
public class MethodNode extends AbstractMvcPsiNodeDescriptor {
|
||||
public MethodNode(@NotNull final Module module,
|
||||
@NotNull final GrMethod method,
|
||||
@Nullable final ViewSettings viewSettings) {
|
||||
final ViewSettings viewSettings) {
|
||||
super(module, viewSettings, method, METHOD);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TestClassNode extends ClassNode {
|
||||
|
||||
public TestClassNode(@NotNull final Module module,
|
||||
@NotNull final GrTypeDefinition controllerClass,
|
||||
@Nullable final ViewSettings viewSettings, final Icon methodIcon) {
|
||||
final ViewSettings viewSettings, final Icon methodIcon) {
|
||||
super(module, controllerClass, viewSettings);
|
||||
myMethodIcon = methodIcon;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.ide.projectView.ViewSettings;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
|
||||
|
||||
@@ -32,7 +31,7 @@ public class TestMethodNode extends MethodNode {
|
||||
|
||||
public TestMethodNode(@NotNull final Module module,
|
||||
@NotNull final GrMethod method,
|
||||
@Nullable final ViewSettings viewSettings, final Icon icon) {
|
||||
final ViewSettings viewSettings, final Icon icon) {
|
||||
super(module, method, viewSettings);
|
||||
myIcon = icon;
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
public class ResourcesFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
|
||||
@Override
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, final ViewSettings viewSettings) {
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, @NotNull final ViewSettings viewSettings) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(context);
|
||||
if (project == null) {
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import java.util.*;
|
||||
public class UIDesignerFavoriteNodeProvider extends FavoriteNodeProvider {
|
||||
@Override
|
||||
@Nullable
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(DataContext context, final ViewSettings viewSettings) {
|
||||
public Collection<AbstractTreeNode> getFavoriteNodes(DataContext context, @NotNull final ViewSettings viewSettings) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(context);
|
||||
if (project == null) return null;
|
||||
Form[] forms = Form.DATA_KEY.getData(context);
|
||||
|
||||
Reference in New Issue
Block a user