|
Re: Strange code generated by GMF in XXXVisualIDRegistry#canCreateNode(...) [message #161645 is a reply to message #161635] |
Tue, 20 November 2007 09:43 |
Boris Blajer Messages: 217 Registered: July 2009 |
Senior Member |
|
|
Hi Mariot,
The inner if (and especially its else part) is needed in case your model
provides shortcuts to other models (in this case, the outer if is also a
bit different). You are right that a simpler code can be generated if
the model does not provide shortcuts, but this is not a error, just a
stylistic problem.
Best regards,
Boris
Mariot Chauvin wrote:
> Hi,
>
> Below, a code snippet generated by GMF (SDK version 2.0.1). The second
> if statement is not required and the else statement will never be called.
> Does someone have an explanation ?
> Thanks.
>
> Regards,
>
> Mariot
>
> public static boolean canCreateNode (View view, intnodeVisualID) {
>
> String modelID = XXXVisualIDRegistry.getModelID(view);
>
> if (!XXXEditPart.MODEL_ID.equals(modelID)) {
> return false;
> }
> int visualID;
> if (XXXEditPart.MODEL_ID.equals(modelID)) {
> visualID = XXXVisualIDRegistry.getVisualID(view);
> } else {
> ...
> }
> ...
>
> }
|
|
|
Powered by
FUDForum. Page generated in 0.04234 seconds