Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [gef-dev] Selection assumption

Are you saying that you have a structured selection consisting of editparts
from more than one type of viewer?



                                                                           
             <David.Dubrow@nok                                             
             ia.com>                                                       
             Sent by:                                                   To 
             gef-dev-bounces@e         <gef-dev@xxxxxxxxxxx>               
             clipse.org                                                 cc 
                                                                           
                                                                   Subject 
             05/18/2007 03:23          RE: [gef-dev] Selection assumption  
             PM                                                            
                                                                           
                                                                           
             Please respond to                                             
              GEF development                                              
             <gef-dev@eclipse.                                             
                   org>                                                    
                                                                           
                                                                           




Hi Randy,

It's in the calculation of the enabled state that the ClassCastException
occurs. The action is not running.
In AlignmentAction#getOperationSet() only checks the first item in the
selection before passing on the rest of the selected parts to
ToolUtilities#getSelectionWithoutDependants() which directly casts all
objects to GraphicalEditPart.
MatchSizeAction#createMatchSizeCommand() calls
MatchSizeAction#getPrimarySelectionEditPart() which also does this. At
least, with the MatchSizeActions, I can override
SelectionAction#getSelectedObjects() and do the right thing, but with
AlignmentAction being final, I can't.

--David


-----Original Message-----
From: gef-dev-bounces@xxxxxxxxxxx [mailto:gef-dev-bounces@xxxxxxxxxxx]
On Behalf Of ext Randy Hudson
Sent: Friday, May 18, 2007 2:09 PM
To: GEF development
Subject: Re: [gef-dev] Selection assumption

The action correctly identifies that it should not be enabled in those
cases, so it should be impossible to get to run().

-Randy





             <David.Dubrow@nok

             ia.com>

             Sent by:
To
             gef-dev-bounces@e         <gef-dev@xxxxxxxxxxx>

             clipse.org
cc



Subject
             05/18/2007 10:18          [gef-dev] Selection assumption

             AM





             Please respond to

              GEF development

             <gef-dev@eclipse.

                   org>









Hi,

It seems that the MatchSizeAction actions and AlignmentAction make the
assumption that the selection they get will only contain
GraphicalEditPart objects. This assumption takes the form of cast
without checking the type first.
However, our application allows for objects that may be in the outline
only and not in the graphical viewer, and while these objects should
rightly be allowed to exist in the selection, in order to allow
non-graphical actions such as cut, copy and paste to access them, they
cause ClassCastExceptions when the graphical actions access them.

I can override them MatchSizeAction actions' getSelectedObjects()
method, but am afraid that AlignmentAction is final so I can't do so for
that action. However, it seems that these actions should check before
casting the selected EditPart objects.

Should I submit a bugzilla? With a patch?

Thanks!

David.Dubrow@xxxxxxxxx
_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gef-dev


_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gef-dev
_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gef-dev




Back to the top