public void run( IProgressMonitor monitor ) throws Exception {
PrimitiveShape shape = provider.get();
if( shape==null || shape.getNumPoints()==0 )
return;
Point start = shape.getPoint(0);
Point end= shape.getPoint(shape.getNumPoints()-1);
int radius=PreferenceUtil.instance().getVertexRadius();
if( start==null || end==null )
return;
if( showMouseOver && tracker.getCurrentPoint()!=null ){
MinFinder finder=new MinFinder(tracker.getCurrentPoint());
graphics.setColor(PreferenceUtil.instance().getDrawVertexFillColor());
if( start!=null && end!=null && finder.dist(start)<radius ){
graphics.fill(new Rectangle(start.getX()-radius, start.getY()-radius, radius*2, radius*2 ));
graphics.fill(new Rectangle(end.getX()-radius, end.getY()-radius, radius*2, radius*2 ));
}
if( start!=null && end !=null && finder.dist(end)<radius ){
graphics.fill(new Rectangle(start.getX()-radius, start.getY()-radius, radius*2, radius*2 ));
graphics.fill(new Rectangle(end.getX()-radius, end.getY()-radius, radius*2, radius*2 ));
}
}
graphics.setColor(PreferenceUtil.instance().getDrawVertexLineColor());
graphics.draw(new Rectangle(start.getX()-radius, start.getY()-radius, radius*2, radius*2 ));
graphics.draw(new Rectangle(end.getX()-radius, end.getY()-radius, radius*2, radius*2 ));
}