Package org.eclipse.ecf.presence.ui

Examples of org.eclipse.ecf.presence.ui.MessagesView


    return null;
  }

  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;
View Full Code Here


  public void handleChatMessage(final IChatMessage message) {
    Display.getDefault().asyncExec(new Runnable() {
      public void run() {
        try {
          ID targetID = createStringID(localUserName);
          MessagesView messageView = getMessagesView();

          IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) messageView.getSite().getAdapter(IWorkbenchSiteProgressService.class);

          if (container.getPrivateMessageSender() != null) {
            messageView.openTab(container.getPrivateMessageSender(), null, targetID, message.getFromID());

            messageView.showMessage(message);
            service.warnOfContentChange();
          }
        } catch (Exception e) {
          Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.ChatRoomManagerView_EXCEPTION_MESSAGE_VIEW_INITIALIZATION + message.getFromID(), e));
        }
View Full Code Here

          public void open(OpenEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            String user = ((ChatRoomParticipant) selection.getFirstElement()).getName();
            if (!ChatRoomManagerView.this.localUserName.equals(user)) {
              try {
                MessagesView messagesView = getMessagesView();
                messagesView.selectTab(container.getPrivateMessageSender(), null, createStringID(localUserName), createStringID(user));
                getSite().getPage().activate(messagesView);
              } catch (PartInitException e) {
                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, NLS.bind(Messages.ChatRoomManagerView_EXCEPTION_MESSAGE_VIEW_INITIALIZATION, user), e));
              }
            }
View Full Code Here

  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();
          }
        }
      }
View Full Code Here

  }

  private void displayTypingNotification(final ITypingMessageEvent e) {
    Display.getDefault().asyncExec(new Runnable() {
      public void run() {
        final MessagesView view = (MessagesView) workbench.getActiveWorkbenchWindow().getActivePage().findView(MessagesView.VIEW_ID);
        if (view != null) {
          view.displayTypingNotification(e);
        }
      }
    });
  }
View Full Code Here

      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());
        } catch (PartInitException e) {
          e.printStackTrace();
        }
      }
    }
View Full Code Here

  }

  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());
      }
    }
  }
View Full Code Here

  public MessagesView findMessagesView() {
    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) {
          return view;
        }
      }
    }
View Full Code Here

  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;
View Full Code Here

  private void openMessagesView(IChatManager chatManager, ID localID, ID targetID) throws PartInitException {
    final IChatMessageSender icms = chatManager.getChatMessageSender();
    final ITypingMessageSender itms = chatManager.getTypingMessageSender();
    final IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    final MessagesView view = (MessagesView) ww.getActivePage().showView(MessagesView.VIEW_ID);
    view.selectTab(icms, itms, localID, targetID);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.presence.ui.MessagesView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.