Bring back deprecated API for TeamCity plugin compatibility, take II

This commit is contained in:
Maxim Shafirov
2012-08-28 13:48:58 +04:00
parent 4c8d93e841
commit b97ea2d069
16 changed files with 41 additions and 36 deletions
@@ -37,7 +37,7 @@ class ItemElementDescriptor extends NodeDescriptor<ItemElement> {
myElement = element;
final String url = element.getUrl();
myName = getPresentablePath(url).replace('/', File.separatorChar);
myIcon = getIconForUrl(url, element.isValid(), element.isJarDirectory());
setIcon(getIconForUrl(url, element.isValid(), element.isJarDirectory()));
}
public boolean update() {
@@ -26,7 +26,7 @@ public class OrderRootTypeElementDescriptor extends NodeDescriptor<OrderRootType
OrderRootTypeElement element, String text, Icon icon) {
super(null, parentDescriptor);
myElement = element;
myIcon = icon;
setIcon(icon);
myName = text;
}
@@ -90,7 +90,7 @@ public final class CallHierarchyNodeDescriptor extends HierarchyNodeDescriptor i
public final boolean update(){
final CompositeAppearance oldText = myHighlightedText;
final Icon oldIcon = myIcon;
final Icon oldIcon = getIcon();
int flags = Iconable.ICON_FLAG_VISIBILITY;
if (isMarkReadOnly()) {
@@ -109,13 +109,14 @@ public final class CallHierarchyNodeDescriptor extends HierarchyNodeDescriptor i
return true;
}
myIcon = enclosingElement.getIcon(flags);
Icon newIcon = enclosingElement.getIcon(flags);
if (changes && myIsBase) {
final LayeredIcon icon = new LayeredIcon(2);
icon.setIcon(myIcon, 0);
icon.setIcon(newIcon, 0);
icon.setIcon(AllIcons.Hierarchy.Base, 1, -AllIcons.Hierarchy.Base.getIconWidth() / 2, 0);
myIcon = icon;
newIcon = icon;
}
setIcon(newIcon);
myHighlightedText = new CompositeAppearance();
TextAttributes mainTextAttributes = null;
@@ -168,7 +169,7 @@ public final class CallHierarchyNodeDescriptor extends HierarchyNodeDescriptor i
if (
!Comparing.equal(myHighlightedText, oldText) ||
!Comparing.equal(myIcon, oldIcon)
!Comparing.equal(getIcon(), oldIcon)
){
changes = true;
}
@@ -123,7 +123,7 @@ public final class MethodHierarchyNodeDescriptor extends HierarchyNodeDescriptor
newIcon = icon;
}
myIcon = newIcon;
setIcon(newIcon);
}
final CompositeAppearance oldText = myHighlightedText;
@@ -56,9 +56,9 @@ public final class TypeHierarchyNodeDescriptor extends HierarchyNodeDescriptor {
if (changes && myIsBase) {
final LayeredIcon icon = new LayeredIcon(2);
icon.setIcon(myIcon, 0);
icon.setIcon(getIcon(), 0);
icon.setIcon(AllIcons.Hierarchy.Base, 1, -AllIcons.Hierarchy.Base.getIconWidth() / 2, 0);
myIcon = icon;
setIcon(icon);
}
final PsiClass psiClass = getPsiClass();
@@ -33,7 +33,7 @@ public class TopLevelNode extends AbstractTreeNode {
public TopLevelNode(Project project, Object value) {
super(project, value);
myName = "[ .. ]";
myIcon = AllIcons.Nodes.UpLevel;
setIcon(AllIcons.Nodes.UpLevel);
}
@NotNull
@@ -82,8 +82,8 @@ public class SmartElementDescriptor extends NodeDescriptor{
color = CopyPasteManager.CUT_COLOR;
}
boolean changes = !Comparing.equal(icon, myIcon) || !Comparing.equal(color, myColor);
myIcon = icon;
boolean changes = !Comparing.equal(icon, getIcon()) || !Comparing.equal(color, myColor);
setIcon(icon);
myColor = color;
return changes;
}
@@ -27,7 +27,13 @@ public abstract class NodeDescriptor<E> {
private final NodeDescriptor myParentDescriptor;
protected String myName;
protected Icon myIcon;
protected Icon myClosedIcon;
/**
* Unused. It's there only for API compatibility.
*/
@Deprecated
protected Icon myOpenIcon;
protected Color myColor;
private int myIndex = -1;
@@ -80,7 +86,7 @@ public abstract class NodeDescriptor<E> {
}
public final Icon getIcon() {
return myIcon;
return myClosedIcon;
}
public final Color getColor() {
@@ -130,11 +136,15 @@ public abstract class NodeDescriptor<E> {
}
public void applyFrom(NodeDescriptor desc) {
myIcon = desc.myIcon;
setIcon(desc.getIcon());
myName = desc.myName;
myColor = desc.myColor;
}
public void setIcon(Icon closedIcon) {
myClosedIcon = closedIcon;
}
public abstract static class NodeComparator<T extends NodeDescriptor> implements Comparator<T> {
private long myStamp;
@@ -179,4 +189,4 @@ public abstract class NodeDescriptor<E> {
}
}
}
}
}
@@ -59,7 +59,7 @@ public abstract class PresentableNodeDescriptor<E> extends NodeDescriptor<E> {
}
protected final boolean apply(PresentationData presentation, @Nullable PresentationData before) {
myIcon = presentation.getIcon(false);
setIcon(presentation.getIcon(false));
myName = presentation.getPresentableText();
myColor = presentation.getForcedTextForeground();
boolean updated = before == null || !presentation.equals(before);
@@ -231,4 +231,4 @@ public abstract class PresentableNodeDescriptor<E> extends NodeDescriptor<E> {
return myName;
}
}
}
@@ -93,7 +93,7 @@ public abstract class SimpleNode extends PresentableNodeDescriptor implements Co
Color oldColor = myColor;
String oldName = myName;
Icon oldIcon = myIcon;
Icon oldIcon = getIcon();
List<ColoredFragment> oldFragments = new ArrayList<ColoredFragment>(presentation.getColoredText());
myColor = UIUtil.getTreeTextForeground();
@@ -104,11 +104,11 @@ public abstract class SimpleNode extends PresentableNodeDescriptor implements Co
myName = getName();
presentation.setPresentableText(myName);
presentation.setChanged(!Comparing.equal(new Object[]{myIcon, myName, oldFragments, myColor},
presentation.setChanged(!Comparing.equal(new Object[]{getIcon(), myName, oldFragments, myColor},
new Object[]{oldIcon, oldName, oldFragments, oldColor}));
presentation.setForcedTextForeground(myColor);
presentation.setIcon(myIcon);
presentation.setIcon(getIcon());
}
protected void updateFileStatus() {
@@ -241,7 +241,7 @@ public abstract class SimpleNode extends PresentableNodeDescriptor implements Co
* or update presentation dynamically by defining {@link #update(com.intellij.ide.projectView.PresentationData)}
*/
public void setUniformIcon(Icon aIcon) {
myIcon = aIcon;
setIcon(aIcon);
}
/**
@@ -58,9 +58,9 @@ public class FileNodeDescriptor extends NodeDescriptor {
if (file == null) return true;
myIcon = myOriginalIcon;
setIcon(myOriginalIcon);
if (myFileElement.isHidden()) {
myIcon = IconLoader.getTransparentIcon(myIcon);
setIcon(IconLoader.getTransparentIcon(getIcon()));
}
myColor = myFileElement.isHidden() ? SimpleTextAttributes.DARK_TEXT.getFgColor() : null;
return changed;
@@ -54,7 +54,7 @@ final class AntBuildFileNodeDescriptor extends AntNodeDescriptor {
if (buildModel != null) {
AntTargetNodeDescriptor.addShortcutText(buildModel.getDefaultTargetActionId(), myAppearance);
}
myIcon = AllIcons.Ant.Build;
setIcon(AllIcons.Ant.Build);
myName = myBuildFile.getPresentableName();
return !Comparing.equal(myAppearance, oldAppearence);
}
@@ -66,7 +66,7 @@ final class AntTargetNodeDescriptor extends AntNodeDescriptor {
final CompositeAppearance oldText = myHighlightedText;
final boolean isMeta = myTarget instanceof MetaTarget;
myIcon = isMeta ? AllIcons.Ant.MetaTarget : AllIcons.Ant.Target;
setIcon(isMeta ? AllIcons.Ant.MetaTarget : AllIcons.Ant.Target);
myHighlightedText = new CompositeAppearance();
@@ -30,7 +30,7 @@ public class GradleProjectStructureNodeDescriptor<T extends GradleEntityId> exte
public GradleProjectStructureNodeDescriptor(@NotNull T id, @NotNull String text, @Nullable Icon icon) {
super(null, null);
myId = id;
myIcon = icon;
setIcon(icon);
myName = text;
}
@@ -38,7 +38,7 @@ public class GradleProjectStructureNodeDescriptor<T extends GradleEntityId> exte
protected void update(@NotNull PresentationData presentation) {
presentation.setAttributesKey(myAttributes);
presentation.setPresentableText(myName);
presentation.setIcon(myIcon);
presentation.setIcon(getIcon());
}
@NotNull
@@ -18,8 +18,6 @@ package com.intellij.designer.componentTree;
import com.intellij.ide.util.treeView.NodeDescriptor;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
/**
* @author Alexander Lobas
*/
@@ -45,8 +43,4 @@ public final class TreeNodeDescriptor extends NodeDescriptor {
public Object getElement() {
return myElement;
}
public void setIcon(Icon icon) {
myIcon = icon;
}
}
@@ -387,7 +387,7 @@ class AssociationsEditor {
public MyNodeDescriptor(NodeDescriptor<PsiFileNode> nodeDescriptor) {
super(nodeDescriptor.getProject(), null);
myName = nodeDescriptor.toString();
myIcon = LayeredIcon.create(nodeDescriptor.getIcon(), LINK_OVERLAY);
setIcon(LayeredIcon.create(nodeDescriptor.getIcon(), LINK_OVERLAY));
myColor = nodeDescriptor.getColor();
myNode = nodeDescriptor.getElement();
}