mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-175168 On-demand renderers - use on-demand for filtered out toString enabled types
This commit is contained in:
@@ -122,8 +122,8 @@ public class LabelRenderer extends TypeRenderer implements ValueLabelRenderer, O
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnDemand(EvaluationContext evaluationContext) {
|
||||
return myOnDemand || OnDemandRenderer.super.isOnDemand(evaluationContext);
|
||||
public boolean isOnDemand(EvaluationContext evaluationContext, ValueDescriptor valueDescriptor) {
|
||||
return myOnDemand || OnDemandRenderer.super.isOnDemand(evaluationContext, valueDescriptor);
|
||||
}
|
||||
|
||||
public boolean isOnDemand() {
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface OnDemandRenderer extends FullValueEvaluatorProvider {
|
||||
@Override
|
||||
default XFullValueEvaluator getFullValueEvaluator(EvaluationContextImpl evaluationContext,
|
||||
ValueDescriptorImpl valueDescriptor) {
|
||||
if (isOnDemand(evaluationContext) && !isCalculated(valueDescriptor)) {
|
||||
if (isOnDemand(evaluationContext, valueDescriptor) && !isCalculated(valueDescriptor)) {
|
||||
return createFullValueEvaluator(getLinkText());
|
||||
}
|
||||
return null;
|
||||
@@ -48,12 +48,12 @@ public interface OnDemandRenderer extends FullValueEvaluatorProvider {
|
||||
|
||||
String getLinkText();
|
||||
|
||||
default boolean isOnDemand(EvaluationContext evaluationContext) {
|
||||
default boolean isOnDemand(EvaluationContext evaluationContext, ValueDescriptor valueDescriptor) {
|
||||
return isOnDemandForced(evaluationContext);
|
||||
}
|
||||
|
||||
default boolean isShowValue(ValueDescriptor valueDescriptor, EvaluationContext evaluationContext) {
|
||||
return !isOnDemand(evaluationContext) || isCalculated(valueDescriptor);
|
||||
return !isOnDemand(evaluationContext, valueDescriptor) || isCalculated(valueDescriptor);
|
||||
}
|
||||
|
||||
static XFullValueEvaluator createFullValueEvaluator(String text) {
|
||||
|
||||
@@ -116,27 +116,25 @@ public class ToStringRenderer extends NodeRendererImpl implements OnDemandRender
|
||||
USE_CLASS_FILTERS = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnDemand(EvaluationContext evaluationContext, ValueDescriptor valueDescriptor) {
|
||||
if (USE_CLASS_FILTERS && !isFiltered(valueDescriptor.getType())) {
|
||||
return true;
|
||||
}
|
||||
return OnDemandRenderer.super.isOnDemand(evaluationContext, valueDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(Type type) {
|
||||
if(!(type instanceof ReferenceType)) {
|
||||
if (!(type instanceof ReferenceType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(JAVA_LANG_STRING.equals(type.name())) {
|
||||
if (JAVA_LANG_STRING.equals(type.name())) {
|
||||
return false; // do not render 'String' objects for performance reasons
|
||||
}
|
||||
|
||||
if(!overridesToString(type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (USE_CLASS_FILTERS) {
|
||||
if (!isFiltered(type)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return overridesToString(type);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public abstract class UnboxableTypeRenderer extends CompoundReferenceRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnDemand(EvaluationContext evaluationContext) {
|
||||
public boolean isOnDemand(EvaluationContext evaluationContext, ValueDescriptor valueDescriptor) {
|
||||
return false;
|
||||
}
|
||||
}, null);
|
||||
|
||||
Reference in New Issue
Block a user