Search in sources :

Example 1 with EnumerationChildrenRenderer

use of com.intellij.debugger.ui.tree.render.EnumerationChildrenRenderer in project intellij-community by JetBrains.

the class RemoveCustomFieldAction method perform.

@Override
protected void perform(XValueNodeImpl node, @NotNull String nodeName, AnActionEvent e) {
    UserExpressionDescriptorImpl descriptor = (UserExpressionDescriptorImpl) ((JavaValue) node.getValueContainer()).getDescriptor();
    EnumerationChildrenRenderer enumerationChildrenRenderer = getParentEnumerationRenderer(descriptor);
    if (enumerationChildrenRenderer != null) {
        enumerationChildrenRenderer.getChildren().remove(descriptor.getEnumerationIndex());
        TreeNode parent = node.getParent();
        int index = parent.getIndex(node);
        int indexToSelect = index + 1 < parent.getChildCount() ? index + 1 : index - 1;
        TreeUtil.selectNode(node.getTree(), indexToSelect >= 0 ? parent.getChildAt(indexToSelect) : parent);
        XDebuggerUtilImpl.rebuildTreeAndViews(node.getTree());
    }
}
Also used : EnumerationChildrenRenderer(com.intellij.debugger.ui.tree.render.EnumerationChildrenRenderer) UserExpressionDescriptorImpl(com.intellij.debugger.ui.impl.watch.UserExpressionDescriptorImpl) TreeNode(javax.swing.tree.TreeNode)

Example 2 with EnumerationChildrenRenderer

use of com.intellij.debugger.ui.tree.render.EnumerationChildrenRenderer in project intellij-community by JetBrains.

the class DebuggerTreeRenderer method getValueIcon.

public static Icon getValueIcon(ValueDescriptorImpl valueDescriptor) {
    Icon nodeIcon;
    if (valueDescriptor instanceof FieldDescriptorImpl) {
        FieldDescriptorImpl fieldDescriptor = (FieldDescriptorImpl) valueDescriptor;
        nodeIcon = PlatformIcons.FIELD_ICON;
        if (fieldDescriptor.getField().isFinal()) {
            nodeIcon = new LayeredIcon(nodeIcon, AllIcons.Nodes.FinalMark);
        }
        if (fieldDescriptor.isStatic()) {
            nodeIcon = new LayeredIcon(nodeIcon, AllIcons.Nodes.StaticMark);
        }
    } else if (valueDescriptor instanceof ThrownExceptionValueDescriptorImpl) {
        nodeIcon = AllIcons.Nodes.ExceptionClass;
    } else if (valueDescriptor instanceof MethodReturnValueDescriptorImpl) {
        nodeIcon = AllIcons.Debugger.WatchLastReturnValue;
    } else if (isParameter(valueDescriptor)) {
        nodeIcon = PlatformIcons.PARAMETER_ICON;
    } else if (valueDescriptor.isEnumConstant()) {
        nodeIcon = PlatformIcons.ENUM_ICON;
    } else if (valueDescriptor.isArray()) {
        nodeIcon = AllIcons.Debugger.Db_array;
    } else if (valueDescriptor.isPrimitive()) {
        nodeIcon = AllIcons.Debugger.Db_primitive;
    } else if (valueDescriptor instanceof WatchItemDescriptor) {
        nodeIcon = AllIcons.Debugger.Watch;
    } else {
        nodeIcon = AllIcons.Debugger.Value;
    }
    if (valueDescriptor instanceof UserExpressionDescriptorImpl) {
        EnumerationChildrenRenderer enumerationChildrenRenderer = EnumerationChildrenRenderer.getCurrent(((UserExpressionDescriptorImpl) valueDescriptor).getParentDescriptor());
        if (enumerationChildrenRenderer != null && enumerationChildrenRenderer.isAppendDefaultChildren()) {
            nodeIcon = AllIcons.Debugger.Watch;
        }
    }
    // if watches in variables enabled, always use watch icon
    if (valueDescriptor instanceof WatchItemDescriptor && nodeIcon != AllIcons.Debugger.Watch) {
        XDebugSession session = XDebuggerManager.getInstance(valueDescriptor.getProject()).getCurrentSession();
        if (session != null) {
            XDebugSessionTab tab = ((XDebugSessionImpl) session).getSessionTab();
            if (tab != null && tab.isWatchesInVariables()) {
                nodeIcon = AllIcons.Debugger.Watch;
            }
        }
    }
    final Icon valueIcon = valueDescriptor.getValueIcon();
    if (nodeIcon != null && valueIcon != null) {
        nodeIcon = new RowIcon(nodeIcon, valueIcon);
    }
    return nodeIcon;
}
Also used : EnumerationChildrenRenderer(com.intellij.debugger.ui.tree.render.EnumerationChildrenRenderer) XDebugSession(com.intellij.xdebugger.XDebugSession) XDebugSessionTab(com.intellij.xdebugger.impl.ui.XDebugSessionTab) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl)

Example 3 with EnumerationChildrenRenderer

use of com.intellij.debugger.ui.tree.render.EnumerationChildrenRenderer in project intellij-community by JetBrains.

the class EditCustomFieldAction method perform.

@Override
protected void perform(XValueNodeImpl node, @NotNull String nodeName, AnActionEvent e) {
    ValueDescriptorImpl descriptor = ((JavaValue) node.getValueContainer()).getDescriptor();
    EnumerationChildrenRenderer enumerationChildrenRenderer = getParentEnumerationRenderer(descriptor);
    if (enumerationChildrenRenderer != null) {
        new CustomFieldInplaceEditor(node, (UserExpressionDescriptorImpl) descriptor, enumerationChildrenRenderer).show();
    }
}
Also used : EnumerationChildrenRenderer(com.intellij.debugger.ui.tree.render.EnumerationChildrenRenderer) ValueDescriptorImpl(com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl) JavaValue(com.intellij.debugger.engine.JavaValue) UserExpressionDescriptorImpl(com.intellij.debugger.ui.impl.watch.UserExpressionDescriptorImpl) CustomFieldInplaceEditor(com.intellij.debugger.ui.tree.render.CustomFieldInplaceEditor)

Aggregations

EnumerationChildrenRenderer (com.intellij.debugger.ui.tree.render.EnumerationChildrenRenderer)3 UserExpressionDescriptorImpl (com.intellij.debugger.ui.impl.watch.UserExpressionDescriptorImpl)2 JavaValue (com.intellij.debugger.engine.JavaValue)1 ValueDescriptorImpl (com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl)1 CustomFieldInplaceEditor (com.intellij.debugger.ui.tree.render.CustomFieldInplaceEditor)1 XDebugSession (com.intellij.xdebugger.XDebugSession)1 XDebugSessionImpl (com.intellij.xdebugger.impl.XDebugSessionImpl)1 XDebugSessionTab (com.intellij.xdebugger.impl.ui.XDebugSessionTab)1 TreeNode (javax.swing.tree.TreeNode)1