コード例 #1
0
  public CustomFieldInplaceEditor(
      @NotNull XDebuggerTreeNode node,
      @Nullable UserExpressionDescriptorImpl descriptor,
      @Nullable EnumerationChildrenRenderer renderer) {
    super(node, "customField");
    myDescriptor = descriptor;
    myRenderer = renderer;
    myExpressionEditor.setExpression(
        descriptor != null
            ? TextWithImportsImpl.toXExpression(descriptor.getEvaluationText())
            : null);

    ValueDescriptorImpl parentDescriptor =
        ((JavaValue) ((XValueContainerNode) node.getParent()).getValueContainer()).getDescriptor();
    Pair<PsiClass, PsiType> pair =
        DebuggerUtilsImpl.getPsiClassAndType(getTypeName(parentDescriptor), getProject());
    if (pair.first != null) {
      myExpressionEditor.setContext(pair.first);
    }
  }
コード例 #2
0
  @Override
  public void doOKAction() {
    List<Pair<String, TextWithImports>> children = getRendererChildren();
    TextWithImports newText =
        TextWithImportsImpl.fromXExpression(myExpressionEditor.getExpression());
    if (myDescriptor == null) {
      children.add(0, Pair.create("", newText));
    } else {
      int index = myDescriptor.getEnumerationIndex();
      children.set(index, Pair.create(children.get(index).first, newText));
    }

    myTree.putClientProperty(
        XDebuggerTreeRestorer.SELECTION_PATH_PROPERTY,
        createDummySelectionTreePath(newText.getText(), (XDebuggerTreeNode) myNode.getParent()));

    XDebuggerUtilImpl.rebuildTreeAndViews(myTree);

    super.doOKAction();
  }