I'm developing a plug-in for Eclipse Luna and I need to update some list of files depending on which project is selected. How would I add some kind of listener which will be activated every time user selects project in Project Explorer?
Use the ISelectionService
to listen to selection events.
In a view or editor you can get the service with:
ISelectionService service = (ISelectionService)getSite().getService(ISelectionService.class);
Add a listener for selection events with:
service.addSelectionListener(listener);
or for events from a particular part:
service.addSelectionListener("part id", listener);