| [ve-dev] Bug in VE decoder helper? |
|
I have a decoder helper for a “label” widget I’m
writing. I have a “look” property that is being changed in the Property
view. The decoder helper is defined as follows: public class LabelDecoderHelper extends
SimpleAttributeDecoderHelper { private static final String
LOOK_TRY_EXCEPTION = "try {\n"; private static final String
LOOK_CATCH_EXCEPTION = "} catch (HInvalidLookException ex) {}"; public LabelDecoderHelper(BeanPart bean,
Statement exp, IJavaFeatureMapper fm, IExpressionDecoder owner) { super(bean, exp,
fm, owner); } /* (non-Javadoc) * @see
org.eclipse.ve.internal.java.codegen.java.IExpressionDecoderHelper#generate(java.lang.Object[]) */ public String generate(Object[] noArgs)
throws CodeGenException { String result =
super.generate(noArgs); // Add a
try/catch block for the HInvalidLookException. int idx =
result.lastIndexOf(';') + 1; return
LOOK_TRY_EXCEPTION + result.substring(0, idx) + LOOK_CATCH_EXCEPTION +
result.substring(idx, result.length()); } } I would expect the final generated code to have the
try/catch block surrounding the code generated by VE: try { label.setLook(new FillDecorator()); } catch (HInvalidLookException ex) {} Instead, the catch code is truncated to: try { label.setLook(new FillDecorator()); I have tried different variations of the LOOK_CATCH_EXCEPTION
string and the final code is always truncated, sometimes generating part of the
LOOK_CATCH_EXCEPTION string (depending on what the string is). Any help here is appreciated. --------------------------------------------------- Mark S. Millard, Software Architect |