Community
Participate
Working Groups
If a CompartmentEditPart's createFigure() method creates a Figure other than a subclass of ResizableCompartmentEditPart, CompartmentResizeHandle breaks with a ClassCastException. You can fix this if you use the existing method on CompartmentEditPart that returns the ResizableCompartmentFigure - getCompartmentFigure(). Patch attached.
Created attachment 27181 [details] Fix
Looks like there is some slight logic problem in the received patch. The signature of getCompartmentFigure on the ResizableCompartmentEditPart returns a ResizableCompartmentFigure. This is not in the hierarchy of the GatedPaneFigure and consequently the 2 lines: if( compartmentFigure instanceof GatedPaneFigure ){ return ((GatedPaneFigure) compartmentFigure).getElementPane(); } will never get executed. Also it is assuming that the owner is ResizableCompartmentEditPart, but there is no constraint in the constructor enforcing this. I would suggest the following changes to the patch: protected IFigure getCompartmentFigure() { if (getOwner() instanceof ResizableCompartmentEditPart) { return ((ResizableCompartmentEditPart)getOwner()).getCompartmentFigure(); } else if( getOwner().getFigure() instanceof GatedPaneFigure ){ return ((GatedPaneFigure)getOwner().getFigure()).getElementPane(); } return getOwner().getFigure(); }
Your suggestion works for me. Thanks.
- Fixed CompartmentResizeHandle#getCompartmentFigure() to check owner type and utilize method to get compartment figure from the ResizableCompartmentEditPart. Otherwise, it will fall through to existing code (modified patch from Min).
[GMF Restructure] Bug 319140 : product GMF and component UI was the original product and component for this bug