Search in sources :

Example 26 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class AbstractPresenceTestCase method getServerConnectID.

protected ID getServerConnectID(int client) {
    final IContainer container = getClient(client);
    final Namespace connectNamespace = container.getConnectNamespace();
    final String username = getUsername(client);
    try {
        return IDFactory.getDefault().createID(connectNamespace, username);
    } catch (final IDCreateException e) {
        fail("Could not create server connect ID");
        return null;
    }
}
Also used : IDCreateException(org.eclipse.ecf.core.identity.IDCreateException) IContainer(org.eclipse.ecf.core.IContainer) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 27 with IContainer

use of org.eclipse.ecf.core.IContainer 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 28 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class MultiRosterView method selectAndJoinChatRoomForAccounts.

private void selectAndJoinChatRoomForAccounts(MultiRosterAccount[] accounts) {
    // Create chat room selection dialog with managers, open
    ChatRoomSelectionDialog dialog = new ChatRoomSelectionDialog(getViewSite().getShell(), accounts);
    dialog.open();
    // If selection cancelled then simply return
    if (dialog.getReturnCode() != Window.OK)
        return;
    // Get selected room, selected manager, and selected IChatRoomInfo
    IChatRoomInfo selectedInfo = dialog.getSelectedRoom().getRoomInfo();
    MultiRosterAccount account = dialog.getSelectedRoom().getAccount();
    // Now get the secondary ID from the selected room id
    final IContainer container = account.getContainer();
    final ID connectedID = container.getConnectedID();
    if (connectedID == null) {
        MessageDialog.openError(getViewSite().getShell(), Messages.MultiRosterView_NO_IDENTIFIER_FOR_ROOM_TITLE, NLS.bind(Messages.MultiRosterView_NO_IDENTIFIER_FOR_ROOM_MESSAGE, selectedInfo.getRoomID()));
        return;
    }
    try {
        joinChatRoom(container, selectedInfo, null);
    } catch (ECFException e) {
        Throwable e1 = e.getStatus().getException();
        Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.MultiRosterView_EXCEPTION_LOG_JOIN_ROOM, e1));
        ContainerConnectErrorDialog ed = new ContainerConnectErrorDialog(getViewSite().getShell(), selectedInfo.getRoomID().getName(), e1);
        ed.open();
    }
}
Also used : IChatRoomInfo(org.eclipse.ecf.presence.chatroom.IChatRoomInfo) ECFException(org.eclipse.ecf.core.util.ECFException) ContainerConnectErrorDialog(org.eclipse.ecf.ui.dialogs.ContainerConnectErrorDialog) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer)

Example 29 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class ScreenCaptureShareRosterContributionItem method makeActions.

protected IAction[] makeActions() {
    final IRoster roster = getSelectedRoster();
    if (roster != null) {
        // Roster is selected
        final IContainer c = getContainerForRoster(roster);
        if (c != null) {
            // Get existing ScreenCaptureShare for this container (if it exists)
            final ScreenCaptureShare screenCaptureShare = ScreenCaptureShare.getScreenCaptureShare(c.getID());
            // If it does exist already, then create action to remove
            if (screenCaptureShare != null)
                return createActionRemove(c.getID(), screenCaptureShare);
            final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class);
            return (channelAdapter == null) ? null : createActionAdd(c.getID(), channelAdapter);
        }
    }
    return null;
}
Also used : IRoster(org.eclipse.ecf.presence.roster.IRoster) IChannelContainerAdapter(org.eclipse.ecf.datashare.IChannelContainerAdapter) IContainer(org.eclipse.ecf.core.IContainer)

Example 30 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class ScreenCaptureShareRosterEntryContributionItem method makeActions.

protected IAction[] makeActions() {
    // Else check for Roster entry
    final IRosterEntry entry = getSelectedRosterEntry();
    final IContainer c = getContainerForRosterEntry(entry);
    // If roster entry is selected and it has a container
    if (entry != null && c != null) {
        final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class);
        // If the container has channel container adapter and is online/available
        if (channelAdapter != null && isAvailable(entry)) {
            final ScreenCaptureShare tmp = ScreenCaptureShare.getScreenCaptureShare(c.getID());
            // If there is an URL share associated with this container
            if (tmp != null) {
                final ScreenCaptureShare screencaptureshare = tmp;
                final IAction action = new Action() {

                    public void run() {
                        MessageDialog dialog = new MessageDialog(null, Messages.ScreenCaptureShareRosterEntryContributionItem_SCREEN_CAPTURE_MESSAGEBOX_TITLE, Window.getDefaultImage(), Messages.ScreenCaptureShareRosterEntryContributionItem_SCREEN_CAPTURE_MESSAGEBOX_MESSAGE, MessageDialog.QUESTION, new String[] { NLS.bind(Messages.ScreenCaptureShareRosterEntryContributionItem_VERIFY_SEND_BUTTON_TEXT, entry.getName()), Messages.ScreenCaptureShareRosterEntryContributionItem_VERIFY_CANCEL_BUTTON_TEXT }, 0);
                        if (dialog.open() == Window.OK) {
                            ScreenCaptureJob screenCaptureJob = new ScreenCaptureJob(Display.getCurrent(), entry.getUser().getID(), entry.getUser().getName(), new IImageSender() {

                                public void sendImage(ID targetID, ImageData imageData) {
                                    screencaptureshare.sendImage(entry.getRoster().getUser().getID(), entry.getRoster().getUser().getName(), targetID, imageData);
                                }
                            });
                            screenCaptureJob.schedule(SCREEN_CAPTURE_DELAY);
                        }
                    }
                };
                action.setText(Messages.ScreenCaptureShareRosterEntryContributionItem_SCREEN_CAPTURE_MENU);
                action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEF_VIEW));
                return new IAction[] { action };
            }
        }
    }
    return null;
}
Also used : IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) IImageSender(org.eclipse.ecf.ui.screencapture.IImageSender) IAction(org.eclipse.jface.action.IAction) ImageData(org.eclipse.swt.graphics.ImageData) IChannelContainerAdapter(org.eclipse.ecf.datashare.IChannelContainerAdapter) IRosterEntry(org.eclipse.ecf.presence.roster.IRosterEntry) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer) ScreenCaptureJob(org.eclipse.ecf.ui.screencapture.ScreenCaptureJob)

Aggregations

IContainer (org.eclipse.ecf.core.IContainer)121 ID (org.eclipse.ecf.core.identity.ID)29 ContainerTypeDescription (org.eclipse.ecf.core.ContainerTypeDescription)20 IRosterEntry (org.eclipse.ecf.presence.roster.IRosterEntry)9 IRoster (org.eclipse.ecf.presence.roster.IRoster)8 IChannelContainerAdapter (org.eclipse.ecf.datashare.IChannelContainerAdapter)7 IRemoteServiceContainer (org.eclipse.ecf.remoteservice.IRemoteServiceContainer)7 IRemoteServiceContainerAdapter (org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter)7 ISharedObjectContainer (org.eclipse.ecf.core.sharedobject.ISharedObjectContainer)5 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)5 RemoteServiceContainer (org.eclipse.ecf.remoteservice.RemoteServiceContainer)5 Action (org.eclipse.jface.action.Action)5 IAction (org.eclipse.jface.action.IAction)5 URL (java.net.URL)4 Job (org.eclipse.core.runtime.jobs.Job)4 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)4 IContainerManager (org.eclipse.ecf.core.IContainerManager)4 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)4 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)4 RestClientContainer (org.eclipse.ecf.remoteservice.rest.client.RestClientContainer)4