Hi David,
> But getExpressionText() seems to contain null data.
TCFDataCache has asynchronous API. Comments in TCFDataCache.java explain how it supposed to be used.
You, probably, have to use getType() and getValue() instead of getExpressionText().
Your code would look something like this:
TCFDataCache<String> getText(ITCFObject object) {
if (object instanceof TCFNodeExpression) {
final TCFNodeExpression exp = (TCFNodeExpression)object;
return new TCFDataCache<String>(channel) {
@Override
protected boolean startDataRetrieval() {
TCFDataCache<ISymbols.Symbol> sym_cache = exp.getType();
if (!sym_cache.validate(this)) return false;
ISymbols.Symbol sym_data = sym_cache.getData();
// TODO: check for sym_data == null, sym_data.getError() == null, etc.
set(null, null, "Value type name: " + sym_data.getName());
return true;
}
};
}
return null;
}
You also might want to consider “presentation_provider” extension point. For this one, there is example plugin in the examples directory.
Regards,
Eugene
From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx]
On Behalf Of Docteur, David
Sent: Tuesday, April 28, 2015 4:42 AM
To: tcf-dev@xxxxxxxxxxx
Subject: [tcf-dev] TCF and Pretty Printing
Hi guys,
We are actually trying to implement our own pretty printers thanks to the ITCFPrettyExpressionProvider extension point.
The getText(ITCFObject object) overridden method returns a TCFDataCache<String> object from the object passed as a parameter.
This object is an instance of ITCFExpression but I don’t really know which is the best way to build a custom TCFDataCache<String> object from that.
For now I am having :
TCFNodeExpression _expression_ = (TCFNodeExpression) object;
TCFDataCache<String> _expression_ = _expression_.getExpressionText();
But getExpressionText() seems to contain null data.
What would be the best way to build a proper TCFDataCache<String> object so that It can contain our “homemade” pretty printer ?
Thank you very much for your help.
David.
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.