Search in sources :

Example 1 with IDCreateErrorDialog

use of org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog in project ecf by eclipse.

the class IRCConnectWizard method performFinish.

public boolean performFinish() {
    final String connectID = page.getConnectID();
    final String password = page.getPassword();
    connectContext = ConnectContextFactory.createPasswordConnectContext(password);
    page.saveComboText();
    try {
        targetID = IDFactory.getDefault().createID(container.getConnectNamespace(), connectID);
    } catch (final IDCreateException e) {
        new IDCreateErrorDialog(null, connectID, e).open();
        return false;
    }
    final IChatRoomManager manager = (IChatRoomManager) this.container.getAdapter(IChatRoomManager.class);
    final IRCUI ui = new IRCUI(this.container, manager, null);
    ui.showForTarget(targetID);
    // If it's not already connected, then we connect this new container
    if (!ui.isContainerConnected()) {
        page.saveComboItems();
        // bug 274613, we need to remove the extra autojoin channel bits
        IRCID id = (IRCID) targetID;
        // start with user, then host, then port, abc@irc.freenode.net:6667
        StringBuffer buffer = new StringBuffer(id.getUsername());
        buffer.append('@').append(id.getHost());
        buffer.append(':').append(id.getPort());
        // create a truncated ID instance for the container to connect to
        id = (IRCID) container.getConnectNamespace().createInstance(new Object[] { buffer.toString() });
        new AsynchContainerConnectAction(container, id, connectContext, null, new Runnable() {

            public void run() {
                cachePassword(page.getPasswordKeyFromUserName(connectID), password);
            }
        }).run();
    }
    return true;
}
Also used : IDCreateErrorDialog(org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog) AsynchContainerConnectAction(org.eclipse.ecf.ui.actions.AsynchContainerConnectAction) IChatRoomManager(org.eclipse.ecf.presence.chatroom.IChatRoomManager) IRCID(org.eclipse.ecf.internal.provider.irc.identity.IRCID)

Example 2 with IDCreateErrorDialog

use of org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog in project ecf by eclipse.

the class MSNConnectWizard method performFinish.

public boolean performFinish() {
    final String connectID = page.getEmail();
    final String password = page.getPassword();
    // Save combo text even if we don't successfully login
    page.saveComboText();
    connectContext = ConnectContextFactory.createPasswordConnectContext(password);
    try {
        targetID = container.getConnectNamespace().createInstance(new Object[] { connectID });
    } catch (final IDCreateException e) {
        new IDCreateErrorDialog(null, connectID, e).open();
        return false;
    }
    page.saveComboItems();
    final IPresenceContainerAdapter adapter = (IPresenceContainerAdapter) container.getAdapter(IPresenceContainerAdapter.class);
    container.addListener(new IContainerListener() {

        public void handleEvent(IContainerEvent event) {
            if (event instanceof IContainerConnectedEvent) {
                Display.getDefault().asyncExec(new Runnable() {

                    public void run() {
                        openView();
                    }
                });
            }
        }
    });
    final IChatManager icm = adapter.getChatManager();
    icms = icm.getChatMessageSender();
    itms = icm.getTypingMessageSender();
    icm.addMessageListener(new IIMMessageListener() {

        public void handleMessageEvent(IIMMessageEvent e) {
            if (e instanceof IChatMessageEvent) {
                displayMessage((IChatMessageEvent) e);
            } else if (e instanceof ITypingMessageEvent) {
                displayTypingNotification((ITypingMessageEvent) e);
            }
        }
    });
    new AsynchContainerConnectAction(container, targetID, connectContext, null, new Runnable() {

        public void run() {
            cachePassword(connectID, password);
        }
    }).run();
    return true;
}
Also used : IDCreateException(org.eclipse.ecf.core.identity.IDCreateException) IContainerEvent(org.eclipse.ecf.core.events.IContainerEvent) IContainerListener(org.eclipse.ecf.core.IContainerListener) IChatMessageEvent(org.eclipse.ecf.presence.im.IChatMessageEvent) IContainerConnectedEvent(org.eclipse.ecf.core.events.IContainerConnectedEvent) IIMMessageEvent(org.eclipse.ecf.presence.IIMMessageEvent) IDCreateErrorDialog(org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog) IPresenceContainerAdapter(org.eclipse.ecf.presence.IPresenceContainerAdapter) IIMMessageListener(org.eclipse.ecf.presence.IIMMessageListener) ITypingMessageEvent(org.eclipse.ecf.presence.im.ITypingMessageEvent) AsynchContainerConnectAction(org.eclipse.ecf.ui.actions.AsynchContainerConnectAction) IChatManager(org.eclipse.ecf.presence.im.IChatManager)

Example 3 with IDCreateErrorDialog

use of org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog in project ecf by eclipse.

the class XMPPConnectWizard method performFinish.

public boolean performFinish() {
    final String connectID = page.getConnectID();
    final String password = page.getPassword();
    // Save combo text even if we don't successfully login
    page.saveComboText();
    connectContext = createConnectContext();
    try {
        targetID = IDFactory.getDefault().createID(container.getConnectNamespace(), connectID);
    } catch (final IDCreateException e) {
        new IDCreateErrorDialog(null, connectID, e).open();
        return false;
    }
    // Save combo items if targetID created successfully
    page.saveComboItems();
    final IPresenceContainerAdapter adapter = (IPresenceContainerAdapter) container.getAdapter(IPresenceContainerAdapter.class);
    container.addListener(new IContainerListener() {

        public void handleEvent(IContainerEvent event) {
            if (event instanceof IContainerConnectedEvent) {
                Display.getDefault().asyncExec(new Runnable() {

                    public void run() {
                        openView();
                    }
                });
            }
        }
    });
    final IChatManager icm = adapter.getChatManager();
    icms = icm.getChatMessageSender();
    itms = icm.getTypingMessageSender();
    icm.addMessageListener(new IIMMessageListener() {

        public void handleMessageEvent(IIMMessageEvent e) {
            if (e instanceof IChatMessageEvent) {
                displayMessage((IChatMessageEvent) e);
            } else if (e instanceof ITypingMessageEvent) {
                displayTypingNotification((ITypingMessageEvent) e);
            }
        }
    });
    final ISendFileTransferContainerAdapter ioftca = (ISendFileTransferContainerAdapter) container.getAdapter(ISendFileTransferContainerAdapter.class);
    ioftca.addListener(requestListener);
    // Connect
    new AsynchContainerConnectAction(container, targetID, connectContext, null, new Runnable() {

        public void run() {
            cachePassword(connectID, password);
        }
    }).run();
    return true;
}
Also used : IContainerEvent(org.eclipse.ecf.core.events.IContainerEvent) IContainerConnectedEvent(org.eclipse.ecf.core.events.IContainerConnectedEvent) IDCreateErrorDialog(org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog) AsynchContainerConnectAction(org.eclipse.ecf.ui.actions.AsynchContainerConnectAction)

Aggregations

AsynchContainerConnectAction (org.eclipse.ecf.ui.actions.AsynchContainerConnectAction)3 IDCreateErrorDialog (org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog)3 IContainerConnectedEvent (org.eclipse.ecf.core.events.IContainerConnectedEvent)2 IContainerEvent (org.eclipse.ecf.core.events.IContainerEvent)2 IContainerListener (org.eclipse.ecf.core.IContainerListener)1 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)1 IRCID (org.eclipse.ecf.internal.provider.irc.identity.IRCID)1 IIMMessageEvent (org.eclipse.ecf.presence.IIMMessageEvent)1 IIMMessageListener (org.eclipse.ecf.presence.IIMMessageListener)1 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)1 IChatRoomManager (org.eclipse.ecf.presence.chatroom.IChatRoomManager)1 IChatManager (org.eclipse.ecf.presence.im.IChatManager)1 IChatMessageEvent (org.eclipse.ecf.presence.im.IChatMessageEvent)1 ITypingMessageEvent (org.eclipse.ecf.presence.im.ITypingMessageEvent)1