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());
}
}
}
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();
}
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());
}
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);
}
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);
}
Aggregations