|
Re: How do I enforce single selection in GEF? [message #184874 is a reply to message #184817] |
Sun, 19 June 2005 06:28 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Probably the viewer should support it. Open a feature request. An
extension of GraphicalViewer could probably make something like this happen.
You could customize the Tracker which performs selection, but then you'd
have to worry about hte keyhandler
"Damian" <damian_biollo@hotmail.com> wrote in message
news:d8v4mr$g1n$1@news.eclipse.org...
> Hi there,
>
> This might be a useful item for the GEF faq...
>
> By default GEF supports multiple selection. You can hold down Ctrl or
> Shift
> to multi-select.
> I have found a way to force it to support single selection instead;
> although
> I'm not sure if this is the best or only way to do it.
>
> Here's a snippet of code to get it working:
>
>
> public abstract class MyFilterPart extends AbstractGraphicalEditPart
> {
> public DragTracker getDragTracker (Request request)
> {
> // Create a drag tracker that will enforce single selection
> return new DragEditPartsTracker (this)
> {
> protected void performSelection ()
> {
> if (hasSelectionOccurred ())
> return;
>
> setFlag (FLAG_SELECTION_PERFORMED, true);
> getCurrentViewer ().select (getSourceEditPart ());
> }
> };
> }
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03153 seconds