You need to register a java.beans.PropertyChangeListener on a project. Selection changes fire java.beans.PropertyChangeEvent.

Project project = ;

Listener listener = new Listener();
SelectionProvider selectionProvider = SelectionProvider.getInstance(project);
selectionProvider.addSelectionChangedListener(listener);

private static class Listener implements SelectionProvider.SelectionChangedListener
{
	@Override
	public void selectionChanged(SelectionProvider.SelectionChangedEvent event)
	{
		// was selected
		SelectionProvider.Selection oldSelection = event.getOldSelection();
		
		// now selected
		SelectionProvider.Selection newSelection = event.getNewSelection();
		
		// do something
	}
}