Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ve-dev] Bug in VE decoder helper?


The current CodeExpressionRef expects a decoder to generate a single AST _expression_.   You will have to replace the ExpressionParser that is used by this _expression_.


------------
Dr. Gili Mendel
IBM
Software Development
RTP Raleigh, NC
(919)543 6408, tie: 441 6408



"Mark S. Millard" <mmillard@xxxxxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx

10/27/2005 02:03 PM

Please respond to
Discussions people developing code for the Visual Editor project

To
<ve-dev@xxxxxxxxxxx>
cc
Subject
[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_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


Back to the top