* view's contents. Eg. workbench selection, view activation, etc.
*/
private void addWorkbenchListeners() {
final IWorkbenchPartSite partSite = getSite();
final ISelectionService selectionService = partSite.getWorkbenchWindow()
.getSelectionService();
// Add workbench selection listener
workbenchSelectionListener = new ISelectionListener() {
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (!(part instanceof DocumentView)) {
handleWorkbenchSelection(selection);
}
}
};
selectionService.addPostSelectionListener(workbenchSelectionListener);
// Add workbench part listener
workbenchPartListener = new IPartListener() {
@Override
public void partOpened(IWorkbenchPart part) {
if (part instanceof DocumentView) {
handleWorkbenchSelection(selectionService.getSelection());
}
}
@Override
public void partDeactivated(IWorkbenchPart part) {
// Nothing