mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
GitOrigin-RevId: 272c03d5ba717c911a65ecb3a9acb39939ba481c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7f5527ca6a
commit
aff737f7ef
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2019 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.
|
||||
*/
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.util.treeView;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -24,11 +10,11 @@ import java.awt.*;
|
||||
import java.util.Comparator;
|
||||
|
||||
public abstract class NodeDescriptor<E> {
|
||||
public static final NodeDescriptor[] EMPTY_ARRAY = new NodeDescriptor[0];
|
||||
public static final NodeDescriptor<?>[] EMPTY_ARRAY = new NodeDescriptor[0];
|
||||
public static final int DEFAULT_WEIGHT = 30;
|
||||
|
||||
protected final Project myProject;
|
||||
private final NodeDescriptor myParentDescriptor;
|
||||
private final NodeDescriptor<?> myParentDescriptor;
|
||||
|
||||
protected String myName;
|
||||
@Nullable protected Icon myClosedIcon;
|
||||
@@ -47,13 +33,13 @@ public abstract class NodeDescriptor<E> {
|
||||
|
||||
private boolean myWasDeclaredAlwaysLeaf;
|
||||
|
||||
public NodeDescriptor(@Nullable Project project, @Nullable NodeDescriptor parentDescriptor) {
|
||||
public NodeDescriptor(@Nullable Project project, @Nullable NodeDescriptor<?> parentDescriptor) {
|
||||
myProject = project;
|
||||
myParentDescriptor = parentDescriptor;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public NodeDescriptor getParentDescriptor() {
|
||||
public NodeDescriptor<?> getParentDescriptor() {
|
||||
return myParentDescriptor;
|
||||
}
|
||||
|
||||
@@ -124,7 +110,6 @@ public abstract class NodeDescriptor<E> {
|
||||
return DEFAULT_WEIGHT;
|
||||
}
|
||||
|
||||
|
||||
public final long getChildrenSortingStamp() {
|
||||
return myChildrenSortingStamp;
|
||||
}
|
||||
@@ -149,7 +134,7 @@ public abstract class NodeDescriptor<E> {
|
||||
myWasDeclaredAlwaysLeaf = leaf;
|
||||
}
|
||||
|
||||
public void applyFrom(@NotNull NodeDescriptor desc) {
|
||||
public void applyFrom(@NotNull NodeDescriptor<?> desc) {
|
||||
setIcon(desc.getIcon());
|
||||
myName = desc.myName;
|
||||
myColor = desc.myColor;
|
||||
@@ -159,7 +144,7 @@ public abstract class NodeDescriptor<E> {
|
||||
myClosedIcon = closedIcon;
|
||||
}
|
||||
|
||||
public abstract static class NodeComparator<T extends NodeDescriptor> implements Comparator<T> {
|
||||
public abstract static class NodeComparator<T extends NodeDescriptor<?>> implements Comparator<T> {
|
||||
private long myStamp;
|
||||
|
||||
public final void setStamp(long stamp) {
|
||||
@@ -174,11 +159,11 @@ public abstract class NodeDescriptor<E> {
|
||||
setStamp(getStamp() + 1);
|
||||
}
|
||||
|
||||
public static class Delegate<T extends NodeDescriptor> extends NodeComparator<T> {
|
||||
public static final class Delegate<T extends NodeDescriptor<?>> extends NodeComparator<T> {
|
||||
@NotNull
|
||||
private NodeComparator<? super T> myDelegate;
|
||||
|
||||
protected Delegate(@NotNull NodeComparator<? super T> delegate) {
|
||||
private Delegate(@NotNull NodeComparator<? super T> delegate) {
|
||||
myDelegate = delegate;
|
||||
}
|
||||
|
||||
|
||||
+4
-6
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.util.treeView;
|
||||
|
||||
import com.intellij.ide.projectView.PresentationData;
|
||||
@@ -13,7 +13,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.awt.*;
|
||||
|
||||
public abstract class PresentableNodeDescriptor<E> extends NodeDescriptor<E> {
|
||||
|
||||
private PresentationData myTemplatePresentation;
|
||||
private PresentationData myUpdatedPresentation;
|
||||
|
||||
@@ -38,8 +37,7 @@ public abstract class PresentableNodeDescriptor<E> extends NodeDescriptor<E> {
|
||||
@Override
|
||||
public void applyFrom(@NotNull NodeDescriptor desc) {
|
||||
if (desc instanceof PresentableNodeDescriptor) {
|
||||
PresentableNodeDescriptor pnd = (PresentableNodeDescriptor)desc;
|
||||
apply(pnd.getPresentation());
|
||||
apply(((PresentableNodeDescriptor<?>)desc).getPresentation());
|
||||
}
|
||||
else {
|
||||
super.applyFrom(desc);
|
||||
@@ -127,7 +125,7 @@ public abstract class PresentableNodeDescriptor<E> extends NodeDescriptor<E> {
|
||||
return true;
|
||||
}
|
||||
|
||||
public PresentableNodeDescriptor getChildToHighlightAt(int index) {
|
||||
public PresentableNodeDescriptor<?> getChildToHighlightAt(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -141,7 +139,7 @@ public abstract class PresentableNodeDescriptor<E> extends NodeDescriptor<E> {
|
||||
}
|
||||
|
||||
public boolean isAncestorOrSelf(NodeDescriptor selectedNode) {
|
||||
NodeDescriptor node = selectedNode;
|
||||
NodeDescriptor<?> node = selectedNode;
|
||||
while (node != null) {
|
||||
if (equals(node)) return true;
|
||||
node = node.getParentDescriptor();
|
||||
|
||||
+8
-5
@@ -20,12 +20,13 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class FavoriteTreeNodeDescriptor extends PresentableNodeDescriptor<AbstractTreeNode> {
|
||||
private final AbstractTreeNode myElement;
|
||||
public final class FavoriteTreeNodeDescriptor extends PresentableNodeDescriptor<AbstractTreeNode> {
|
||||
private final AbstractTreeNode<?> myElement;
|
||||
public static final FavoriteTreeNodeDescriptor[] EMPTY_ARRAY = new FavoriteTreeNodeDescriptor[0];
|
||||
|
||||
public FavoriteTreeNodeDescriptor(final Project project, final NodeDescriptor parentDescriptor, final AbstractTreeNode element) {
|
||||
public FavoriteTreeNodeDescriptor(@NotNull Project project, final NodeDescriptor parentDescriptor, final AbstractTreeNode element) {
|
||||
super(project, parentDescriptor);
|
||||
|
||||
myElement = element;
|
||||
}
|
||||
|
||||
@@ -35,14 +36,16 @@ public class FavoriteTreeNodeDescriptor extends PresentableNodeDescriptor<Abstra
|
||||
presentation.copyFrom(myElement.getPresentation());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getLocation() {
|
||||
return getLocation(myElement, myProject);
|
||||
}
|
||||
|
||||
public static String getLocation(final AbstractTreeNode element, @NotNull final Project project) {
|
||||
@Nullable
|
||||
public static String getLocation(@NotNull AbstractTreeNode<?> element, @NotNull Project project) {
|
||||
Object nodeElement = element.getValue();
|
||||
if (nodeElement instanceof SmartPsiElementPointer) {
|
||||
nodeElement = ((SmartPsiElementPointer)nodeElement).getElement();
|
||||
nodeElement = ((SmartPsiElementPointer<?>)nodeElement).getElement();
|
||||
}
|
||||
if (nodeElement instanceof PsiElement) {
|
||||
if (nodeElement instanceof PsiDirectory) {
|
||||
|
||||
Reference in New Issue
Block a user