e.printStackTrace();
}
}
private void displayMessage(IChatMessageEvent e) {
final IChatMessage message = e.getChatMessage();
Display.getDefault().asyncExec(new Runnable() {
public void run() {
MessagesView view = (MessagesView) workbench.getActiveWorkbenchWindow().getActivePage().findView(MessagesView.VIEW_ID);
if (view != null) {
final IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) view.getSite().getAdapter(IWorkbenchSiteProgressService.class);
view.openTab(icms, itms, targetID, message.getFromID());
view.showMessage(message);
service.warnOfContentChange();
} else {
try {
final IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
view = (MessagesView) page.showView(MessagesView.VIEW_ID, null, IWorkbenchPage.VIEW_CREATE);
if (!page.isPartVisible(view)) {
final IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) view.getSite().getAdapter(IWorkbenchSiteProgressService.class);
service.warnOfContentChange();
}
view.openTab(icms, itms, targetID, message.getFromID());
view.showMessage(message);
} catch (final PartInitException e) {
e.printStackTrace();
}
}