Search in sources :

Example 1 with MessagesView

use of org.eclipse.ecf.presence.ui.MessagesView in project ecf by eclipse.

the class ChatComposite method sendPrivateTextMsg.

protected void sendPrivateTextMsg(IUser data) {
    if (this.view.lch != null) {
        IPresenceContainerAdapter ipca = this.view.lch.getPresenceContainer();
        MessagesView messagesView = this.view.lch.findMessagesView();
        if (messagesView != null) {
            IChatManager chatManager = ipca.getChatManager();
            messagesView.openTab(chatManager.getChatMessageSender(), chatManager.getTypingMessageSender(), this.view.lch.getContainerID(), data.getID());
        }
    }
}
Also used : IPresenceContainerAdapter(org.eclipse.ecf.presence.IPresenceContainerAdapter) IChatManager(org.eclipse.ecf.presence.im.IChatManager) MessagesView(org.eclipse.ecf.presence.ui.MessagesView)

Example 2 with MessagesView

use of org.eclipse.ecf.presence.ui.MessagesView in project ecf by eclipse.

the class EclipseCollabSharedObject method appendMessage.

void appendMessage(IChatMessageSender chatMessageSender, ITypingMessageSender typingMessageSender, IChatMessage message) {
    IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
    for (int i = 0; i < windows.length; i++) {
        IWorkbenchPage page = windows[i].getActivePage();
        if (page != null) {
            MessagesView view = (MessagesView) page.findView(MessagesView.VIEW_ID);
            if (view != null) {
                view.openTab(chatMessageSender, typingMessageSender, containerID, message.getFromID());
                view.showMessage(message);
                if (!page.isPartVisible(view)) {
                    IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) view.getSite().getService(IWorkbenchSiteProgressService.class);
                    if (service != null) {
                        service.warnOfContentChange();
                    }
                }
                return;
            }
        }
    }
    for (int i = 0; i < windows.length; i++) {
        IWorkbenchPage page = windows[i].getActivePage();
        if (page != null) {
            try {
                MessagesView view = (MessagesView) page.showView(MessagesView.VIEW_ID);
                view.openTab(chatMessageSender, typingMessageSender, containerID, message.getFromID());
                view.showMessage(message);
            } catch (PartInitException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            break;
        }
    }
}
Also used : IWorkbenchSiteProgressService(org.eclipse.ui.progress.IWorkbenchSiteProgressService) MessagesView(org.eclipse.ecf.presence.ui.MessagesView)

Example 3 with MessagesView

use of org.eclipse.ecf.presence.ui.MessagesView in project ecf by eclipse.

the class MSNConnectWizard method displayMessage.

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();
                }
            }
        }
    });
}
Also used : IChatMessage(org.eclipse.ecf.presence.im.IChatMessage) IWorkbenchSiteProgressService(org.eclipse.ui.progress.IWorkbenchSiteProgressService) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) MessagesView(org.eclipse.ecf.presence.ui.MessagesView)

Example 4 with MessagesView

use of org.eclipse.ecf.presence.ui.MessagesView in project ecf by eclipse.

the class BrowseHandler method execute.

/**
 * the command has been executed, so extract extract the needed information
 * from the application context.
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    IContainerManager containerManager = Activator.getDefault().getContainerManager();
    IContainer[] containers = containerManager.getAllContainers();
    BrowseDialog dialog = new BrowseDialog(window.getShell(), containers);
    int status = dialog.open();
    if (status == Window.OK) {
        Object[] object = dialog.getResult();
        IRosterEntry entry = (IRosterEntry) object[0];
        IRoster roster = entry.getRoster();
        if (roster != null) {
            IChatManager manager = roster.getPresenceContainerAdapter().getChatManager();
            IChatMessageSender icms = manager.getChatMessageSender();
            ITypingMessageSender itms = manager.getTypingMessageSender();
            try {
                MessagesView view = (MessagesView) window.getActivePage().showView(MessagesView.VIEW_ID);
                view.selectTab(icms, itms, roster.getUser().getID(), entry.getUser().getID(), entry.getUser().getName());
            } catch (PartInitException e) {
                e.printStackTrace();
            }
        }
    }
    return null;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IContainerManager(org.eclipse.ecf.core.IContainerManager) IRoster(org.eclipse.ecf.presence.roster.IRoster) IRosterEntry(org.eclipse.ecf.presence.roster.IRosterEntry) PartInitException(org.eclipse.ui.PartInitException) IContainer(org.eclipse.ecf.core.IContainer) MessagesView(org.eclipse.ecf.presence.ui.MessagesView)

Example 5 with MessagesView

use of org.eclipse.ecf.presence.ui.MessagesView in project ecf by eclipse.

the class ChatRoomManagerView method getMessagesView.

private MessagesView getMessagesView() throws PartInitException {
    IWorkbenchPage page = getSite().getPage();
    MessagesView messageView = (MessagesView) page.findView(MessagesView.VIEW_ID);
    if (messageView == null) {
        messageView = (MessagesView) page.showView(MessagesView.VIEW_ID, null, IWorkbenchPage.VIEW_CREATE);
    }
    return messageView;
}
Also used : MessagesView(org.eclipse.ecf.presence.ui.MessagesView)

Aggregations

MessagesView (org.eclipse.ecf.presence.ui.MessagesView)6 PartInitException (org.eclipse.ui.PartInitException)2 IWorkbenchSiteProgressService (org.eclipse.ui.progress.IWorkbenchSiteProgressService)2 IContainer (org.eclipse.ecf.core.IContainer)1 IContainerManager (org.eclipse.ecf.core.IContainerManager)1 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)1 IChatManager (org.eclipse.ecf.presence.im.IChatManager)1 IChatMessage (org.eclipse.ecf.presence.im.IChatMessage)1 IRoster (org.eclipse.ecf.presence.roster.IRoster)1 IRosterEntry (org.eclipse.ecf.presence.roster.IRosterEntry)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1