Search in sources :

Example 1 with ExclusionSearch

use of org.eclipse.draw2d.ExclusionSearch in project tdi-studio-se by Talend.

the class MapperGraphicalViewer method findFigureAt.

public IFigure findFigureAt(int x, int y, Collection exclude, final Conditional condition) {
    class ConditionalTreeSearch extends ExclusionSearch {

        ConditionalTreeSearch(Collection coll) {
            super(coll);
        }

        @Override
        public boolean accept(IFigure figure) {
            EditPart editpart = null;
            while (editpart == null && figure != null) {
                editpart = (EditPart) getVisualPartMap().get(figure);
                figure = figure.getParent();
            }
            return editpart != null && (condition == null || condition.evaluate(editpart));
        }
    }
    return getLightweightSystem().getRootFigure().findFigureAt(x, y, new ConditionalTreeSearch(exclude));
}
Also used : MapperRootEditPart(org.talend.designer.gefabstractmap.part.MapperRootEditPart) EditPart(org.eclipse.gef.EditPart) Collection(java.util.Collection) ExclusionSearch(org.eclipse.draw2d.ExclusionSearch) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

Collection (java.util.Collection)1 ExclusionSearch (org.eclipse.draw2d.ExclusionSearch)1 IFigure (org.eclipse.draw2d.IFigure)1 EditPart (org.eclipse.gef.EditPart)1 MapperRootEditPart (org.talend.designer.gefabstractmap.part.MapperRootEditPart)1