Exemplo n.º 1
0
    @Override
    public void renderValue(@NotNull XValueTextRenderer renderer, @Nullable XValueNodeImpl node) {
      boolean compact = node != null;
      if (myError != null) {
        if (myValue.endsWith(myError)) {
          renderer.renderValue(myValue.substring(0, myValue.length() - myError.length()));
        }
        renderer.renderError(myError);
      } else {
        if (compact && node.getValueContainer() instanceof JavaValue) {
          final JavaValue container = (JavaValue) node.getValueContainer();

          if (container.getDescriptor().isArray()) {
            final ArrayReference value = (ArrayReference) container.getDescriptor().getValue();
            final ArrayType type = (ArrayType) container.getDescriptor().getType();
            if (type != null) {
              final String typeName = type.componentTypeName();
              if (TypeConversionUtil.isPrimitive(typeName)
                  || CommonClassNames.JAVA_LANG_STRING.equals(typeName)) {
                int size = value.length();
                int max =
                    Math.min(size, CommonClassNames.JAVA_LANG_STRING.equals(typeName) ? 5 : 10);
                // TODO [eu]: this is a quick fix for IDEA-136606, need to move this away from
                // EDT!!!
                final List<Value> values = value.getValues(0, max);
                int i = 0;
                final List<String> vals = new ArrayList<String>(max);
                while (i < values.size()) {
                  vals.add(StringUtil.first(values.get(i).toString(), 15, true));
                  i++;
                }
                String more = "";
                if (vals.size() < size) {
                  more = ", + " + (size - vals.size()) + " more";
                }

                renderer.renderValue("{" + StringUtil.join(vals, ", ") + more + "}");
                return;
              }
            }
          }
        }

        String value = myValue;
        if (myValueDescriptor.isString()) {
          renderer.renderStringValue(myValue, "\"\\", XValueNode.MAX_VALUE_LENGTH);
          return;
        } else if (myValueDescriptor.getLastRenderer() instanceof ToStringRenderer
            || myValueDescriptor.getLastRenderer() instanceof ToStringBasedRenderer) {
          value = StringUtil.wrapWithDoubleQuote(truncateToMaxLength(myValue));
        } else if (myValueDescriptor.getLastRenderer() instanceof CompoundReferenceRenderer) {
          value = truncateToMaxLength(myValue);
        }
        renderer.renderValue(value);
      }
    }
Exemplo n.º 2
0
 @NotNull
 @Override
 public String getSeparator() {
   String fullName = myValueDescriptor.calcValueName();
   String name = myValueDescriptor.getName();
   if (!StringUtil.isEmpty(fullName) && !name.equals(fullName) && fullName.startsWith(name)) {
     return fullName.substring(name.length()) + " " + DEFAULT_SEPARATOR;
   }
   return DEFAULT_SEPARATOR;
 }
Exemplo n.º 3
0
 @NotNull
 @Override
 public String getSeparator() {
   boolean emptyAfterSeparator =
       !myValueDescriptor.isShowIdLabel() && StringUtil.isEmpty(myValue);
   String declaredType = myValueDescriptor.getDeclaredTypeLabel();
   if (!StringUtil.isEmpty(declaredType)) {
     return emptyAfterSeparator ? declaredType : declaredType + " " + DEFAULT_SEPARATOR;
   }
   return emptyAfterSeparator ? "" : DEFAULT_SEPARATOR;
 }
Exemplo n.º 4
0
 protected JavaValue(
     JavaValue parent,
     @NotNull ValueDescriptorImpl valueDescriptor,
     @NotNull EvaluationContextImpl evaluationContext,
     NodeManagerImpl nodeManager,
     boolean contextSet) {
   super(valueDescriptor.calcValueName());
   myParent = parent;
   myValueDescriptor = valueDescriptor;
   myEvaluationContext = evaluationContext;
   myNodeManager = nodeManager;
   myContextSet = contextSet;
 }
Exemplo n.º 5
0
 public void setRenderer(NodeRenderer nodeRenderer, final XValueNodeImpl node) {
   DebuggerManagerThreadImpl.assertIsManagerThread();
   myValueDescriptor.setRenderer(nodeRenderer);
   myCurrentChildrenStart = 0;
   node.getTree()
       .getLaterInvocator()
       .offer(
           new Runnable() {
             @Override
             public void run() {
               node.clearChildren();
               computePresentation(node, XValuePlace.TREE);
             }
           });
 }
Exemplo n.º 6
0
 public void setRenderer(NodeRenderer nodeRenderer, final XValueNodeImpl node) {
   DebuggerManagerThreadImpl.assertIsManagerThread();
   myValueDescriptor.setRenderer(nodeRenderer);
   reBuild(node);
 }
Exemplo n.º 7
0
 @Override
 public String getValueText() {
   return myValueDescriptor.getValueText();
 }
Exemplo n.º 8
0
 @Nullable
 @Override
 public XValueModifier getModifier() {
   return myValueDescriptor.canSetValue() ? new JavaValueModifier(this) : null;
 }
Exemplo n.º 9
0
 public Project getProject() {
   return myValueDescriptor.getProject();
 }
Exemplo n.º 10
0
 @NotNull
 String getValueString() {
   return myValueDescriptor.getValueText();
 }
Exemplo n.º 11
0
 @Override
 public boolean isModified() {
   return myValueDescriptor.isDirty();
 }