[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: EditPartViewer.findObjectAt problem

Ah found the problem. Forgot to convert the absolute cursor location into one relevant to the Graphical viewer.

Thanks.

Randy Hudson wrote:
findObjectAt(Point) works for me. Maybe your editpart is not registered with its figure? You should step into the find method and see where it is failing.

"Kevin O'Riordan" <k.oriordan@xxxxxxxxxx> wrote in message news:dtic5j$3tl$1@xxxxxxxxxxxxxxxxxxxx
Hey all, I'm having a problem here and was wondering if anyone could shine some light.

I'm trying to find out what EditPart/Figure is under the cursor at any moment.

Using EditPartViewer.findObjectAt(<point>) gives me back the root edit part but not the specific edit part.

I've tried using EditPartViewer.findObjectAtExcluding(Point position, Collection exclusionList, Conditional condition) in both the following ways to specify I don't want the root edit part:

1) Giving it a List containing the root edit part that I don't want.
2) Using the following Conditional
    new EditPartViewer.Conditional() {
        public boolean evaluate(EditPart part) {
            return part instanceof <type of part I want>;
        }
    }

But both of them still give me back the root.

Anyone got any ideas? I was thinking of locating the IFigure instead and working from there, but getLightWeightSystem() is a protected method in EditPartViewer so I can't access it.

Regards,
Kevin.