Search in sources :

Example 1 with IPresenceContainerAdapter

use of org.eclipse.ecf.presence.IPresenceContainerAdapter 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 IPresenceContainerAdapter

use of org.eclipse.ecf.presence.IPresenceContainerAdapter in project ecf by eclipse.

the class DocShareRosterMenuContributionItem method getContributionItems.

/* (non-Javadoc)
	 * @see org.eclipse.ecf.presence.ui.menu.AbstractRosterMenuContributionItem#getContributionItems()
	 */
protected IContributionItem[] getContributionItems() {
    // Make sure this is a text editor
    IEditorPart editorPart = getEditorPart();
    if (editorPart == null)
        return NO_CONTRIBUTIONS;
    // A frequent pattern for multi-page editors with one source page
    if (!(editorPart instanceof ITextEditor)) {
        editorPart = (IEditorPart) editorPart.getAdapter(ITextEditor.class);
        if (editorPart == null)
            return NO_CONTRIBUTIONS;
    }
    // If we are already engaged in a doc share (either as initiator or as receiver)
    // Then present menu item to stop
    final List presenceContainerAdapters = getPresenceContainerAdapters();
    for (final Iterator i = presenceContainerAdapters.iterator(); i.hasNext(); ) {
        final IPresenceContainerAdapter pca = (IPresenceContainerAdapter) i.next();
        final DocShare docShare = getDocShareForPresenceContainerAdapter(pca);
        if (docShare != null && docShare.isSharing() && docShare.getTextEditor().equals(editorPart)) {
            return getMenuContributionForStopShare(pca.getRosterManager().getRoster(), docShare, docShare.getOtherID());
        }
    }
    return super.getContributionItems();
}
Also used : IPresenceContainerAdapter(org.eclipse.ecf.presence.IPresenceContainerAdapter) DocShare(org.eclipse.ecf.docshare.DocShare) ITextEditor(org.eclipse.ui.texteditor.ITextEditor) Iterator(java.util.Iterator) List(java.util.List)

Example 3 with IPresenceContainerAdapter

use of org.eclipse.ecf.presence.IPresenceContainerAdapter in project ecf by eclipse.

the class RemotePeerSynchronizeWizardPage method createPeersViewer.

private void createPeersViewer(Composite composite) {
    peersViewer = new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    peersViewer.setContentProvider(new ITreeContentProvider() {

        public Object[] getChildren(Object parentElement) {
            if (parentElement instanceof IRosterGroup) {
                return ((IRosterGroup) parentElement).getEntries().toArray();
            } else if (parentElement instanceof IRoster) {
                return ((IRoster) parentElement).getItems().toArray();
            } else {
                return new Object[0];
            }
        }

        public Object getParent(Object element) {
            return ((IRosterItem) element).getParent();
        }

        public boolean hasChildren(Object element) {
            if (element instanceof IRosterGroup) {
                return !((IRosterGroup) element).getEntries().isEmpty();
            } else if (element instanceof IRoster) {
                return !((IRoster) element).getItems().isEmpty();
            } else {
                return false;
            }
        }

        public Object[] getElements(Object inputElement) {
            return (Object[]) inputElement;
        }

        public void dispose() {
        // nothing to do
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        // nothing to do
        }
    });
    peersViewer.setLabelProvider(new LabelProvider() {

        public String getText(Object element) {
            Entry entry = (Entry) element;
            IRosterItem item = (IRosterItem) entry.getValue();
            return item.getName();
        }
    });
    IContainerManager manager = (IContainerManager) ContainerFactory.getDefault();
    IContainer[] containers = manager.getAllContainers();
    Map presenceContainers = new HashMap();
    for (int i = 0; i < containers.length; i++) {
        IPresenceContainerAdapter adapter = (IPresenceContainerAdapter) containers[i].getAdapter(IPresenceContainerAdapter.class);
        if (adapter != null) {
            IRosterManager rosterManager = adapter.getRosterManager();
            if (rosterManager != null) {
                presenceContainers.put(containers[i], rosterManager.getRoster());
            }
        }
    }
    peersViewer.setInput(presenceContainers.entrySet().toArray());
}
Also used : ContainerCheckedTreeViewer(org.eclipse.ui.dialogs.ContainerCheckedTreeViewer) ContainerCheckedTreeViewer(org.eclipse.ui.dialogs.ContainerCheckedTreeViewer) IPresenceContainerAdapter(org.eclipse.ecf.presence.IPresenceContainerAdapter) Entry(java.util.Map.Entry) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider)

Example 4 with IPresenceContainerAdapter

use of org.eclipse.ecf.presence.IPresenceContainerAdapter in project ecf by eclipse.

the class AbstractAdapterAccessTest method testGetChatRoomManager.

public void testGetChatRoomManager() {
    final IPresenceContainerAdapter adapter = getPresenceAdapter();
    assertNotNull(adapter);
    final IChatRoomManager chatRoomManager = adapter.getChatRoomManager();
    assertNotNull(chatRoomManager);
}
Also used : IPresenceContainerAdapter(org.eclipse.ecf.presence.IPresenceContainerAdapter) IChatRoomManager(org.eclipse.ecf.presence.chatroom.IChatRoomManager)

Example 5 with IPresenceContainerAdapter

use of org.eclipse.ecf.presence.IPresenceContainerAdapter in project ecf by eclipse.

the class AbstractAdapterAccessTest method testGetAccountManager.

public void testGetAccountManager() {
    final IPresenceContainerAdapter adapter = getPresenceAdapter();
    assertNotNull(adapter);
    final IAccountManager accountManager = adapter.getAccountManager();
    assertNotNull(accountManager);
}
Also used : IPresenceContainerAdapter(org.eclipse.ecf.presence.IPresenceContainerAdapter) IAccountManager(org.eclipse.ecf.presence.IAccountManager)

Aggregations

IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)18 IContainer (org.eclipse.ecf.core.IContainer)5 IRosterManager (org.eclipse.ecf.presence.roster.IRosterManager)4 IChatManager (org.eclipse.ecf.presence.im.IChatManager)3 Iterator (java.util.Iterator)2 List (java.util.List)2 Namespace (org.eclipse.ecf.core.identity.Namespace)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Entry (java.util.Map.Entry)1 IProject (org.eclipse.core.resources.IProject)1 IResource (org.eclipse.core.resources.IResource)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)1 IContainerListener (org.eclipse.ecf.core.IContainerListener)1 IContainerManager (org.eclipse.ecf.core.IContainerManager)1 IContainerConnectedEvent (org.eclipse.ecf.core.events.IContainerConnectedEvent)1 IContainerEvent (org.eclipse.ecf.core.events.IContainerEvent)1