Search in sources :

Example 6 with IUser

use of org.eclipse.ecf.core.user.IUser in project ecf by eclipse.

the class EclipseCollabSharedObject method handleLaunchEditorForFile.

/**
 * @since 2.0
 */
protected void handleLaunchEditorForFile(final IUser fromuser, final String resourceName) {
    final IUser local = getUserForID(fromuser.getID());
    if (local != null) {
        final Runnable runnable = createOpenEditorForFileRunnable(resourceName);
        showEventInChatOutput(fromuser, resourceName, null, runnable);
        verifyAndOpenEditorLocally(fromuser, resourceName, runnable);
    }
}
Also used : IUser(org.eclipse.ecf.core.user.IUser)

Example 7 with IUser

use of org.eclipse.ecf.core.user.IUser in project ecf by eclipse.

the class EclipseCollabSharedObject method handleOpenAndSelectForFile.

/**
 * @since 2.0
 */
protected void handleOpenAndSelectForFile(final IUser fromuser, final String resourceName, SharedMarker marker) {
    final IUser local = getUserForID(fromuser.getID());
    if (local != null) {
        final Runnable runnable = createOpenEditorAndSelectForFileRunnable(resourceName, marker);
        showEventInChatOutput(fromuser, resourceName, marker, runnable);
        verifyAndOpenEditorLocally(fromuser, resourceName, runnable);
    }
}
Also used : IUser(org.eclipse.ecf.core.user.IUser)

Example 8 with IUser

use of org.eclipse.ecf.core.user.IUser in project ecf by eclipse.

the class EclipseCollabSharedObject method getFileReceiverUI.

/**
 * @since 2.0
 */
public FileReceiverUI getFileReceiverUI(EclipseFileTransfer transfer, FileTransferParams params) {
    return new FileReceiverUI() {

        public void receiveStart(ID from, File aFile, long length, float rate) {
            final IUser user = getUserForID(from);
            String nick = Messages.EclipseCollabSharedObject_UNKNOWN_USERNAME;
            if (user != null) {
                nick = user.getNickname();
            }
            showRawLine(from, NLS.bind(Messages.EclipseCollabSharedObject_FILE_TRANSFER_RECEIVING, nick, aFile.getName()), null);
        }

        public void receiveData(ID from, File aFile, int dataLength) {
        }

        public void receiveDone(ID from, File aFile, Exception e) {
            final IUser user = getUserForID(from);
            String nick = Messages.EclipseCollabSharedObject_UNKNOWN_USERNAME;
            if (user != null) {
                nick = user.getNickname();
            }
            showRawLine(from, NLS.bind(Messages.EclipseCollabSharedObject_FILE_TRANSFER_RECEIVED, new Object[] { aFile.getName(), nick, getLocalFullDownloadPath() }), null);
            refreshProject();
        }
    };
}
Also used : IUser(org.eclipse.ecf.core.user.IUser) ID(org.eclipse.ecf.core.identity.ID)

Example 9 with IUser

use of org.eclipse.ecf.core.user.IUser in project ecf by eclipse.

the class RemotePeerSynchronizeWizard method performFinish.

public boolean performFinish() {
    ID containerId = page.getContainerId();
    RemoteShare share = TeamSynchronization.getShare(containerId);
    IRosterEntry entry = page.getRosterEntry();
    IUser remoteUser = entry.getUser();
    ID ownId = entry.getRoster().getUser().getID();
    IResource[] resources = page.getSelectedResources();
    RemoteSubscriberParticipant participant = getSubscriberParticipant(share, ownId, remoteUser.getID());
    participant.setResources(resources);
    TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] { participant });
    if (resources.length == 1) {
        participant.refresh(resources, NLS.bind(Messages.SynchronizeWithHandler_RemoteSynchronizationTaskName, remoteUser.getNickname()), NLS.bind(Messages.SynchronizeWithHandler_RemoteSynchronizationResourceDescription, resources[0].getName(), remoteUser.getNickname()), null);
    } else {
        participant.refresh(resources, NLS.bind(Messages.SynchronizeWithHandler_RemoteSynchronizationTaskName, remoteUser.getNickname()), NLS.bind(Messages.SynchronizeWithHandler_RemoteSynchronizationResourcesDescription, remoteUser.getNickname()), null);
    }
    return true;
}
Also used : RemoteShare(org.eclipse.team.internal.ecf.core.RemoteShare) IUser(org.eclipse.ecf.core.user.IUser) RemoteSubscriberParticipant(org.eclipse.team.internal.ecf.ui.subscriber.RemoteSubscriberParticipant) ID(org.eclipse.ecf.core.identity.ID) IRosterEntry(org.eclipse.ecf.presence.roster.IRosterEntry) IResource(org.eclipse.core.resources.IResource)

Example 10 with IUser

use of org.eclipse.ecf.core.user.IUser in project ecf by eclipse.

the class SynchronizeWithHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    IRosterEntry selectedEntry = getRosterEntry();
    IRoster roster = selectedEntry.getRoster();
    final IUser remoteUser = roster.getUser();
    final ID localId = remoteUser.getID();
    final ID remoteId = selectedEntry.getUser().getID();
    IContainer container = (IContainer) roster.getPresenceContainerAdapter().getAdapter(IContainer.class);
    final IResource[] resources = getResources(event);
    final RemoteShare share = TeamSynchronization.getShare(container.getID());
    IWorkbenchPart part = HandlerUtil.getActivePart(event);
    final IWorkbenchPartSite site = part == null ? null : part.getSite();
    final Shell shell = HandlerUtil.getActiveShellChecked(event);
    ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
    final boolean[] response = { true };
    IRunnableWithProgress runnable = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            if (resources.length == 1) {
                monitor.beginTask(NLS.bind(Messages.SynchronizeWithHandler_SynchronizeResourceTaskName, resources[0].getName()), IProgressMonitor.UNKNOWN);
            } else {
                monitor.beginTask(Messages.SynchronizeWithHandler_SynchronizeResourcesTaskName, IProgressMonitor.UNKNOWN);
            }
            try {
                if (share.sendShareRequest(localId, remoteId, resources, monitor)) {
                    scheduleRefreshJob(share, localId, remoteId, resources, remoteUser, site);
                } else {
                    response[0] = false;
                }
            } catch (ECFException e) {
                throw new InvocationTargetException(e);
            } catch (OperationCanceledException e) {
                // operation, but check for this just in case
                if (!monitor.isCanceled()) {
                    throw e;
                }
            }
        }
    };
    try {
        dialog.run(true, true, runnable);
        if (!response[0]) {
            MessageDialog.openInformation(shell, null, Messages.SynchronizeWithHandler_SynchronizeRequestDenial);
        }
    } catch (InvocationTargetException e) {
        Throwable cause = e.getCause();
        if (cause instanceof ECFException) {
            MessageDialog.openError(shell, null, Messages.SynchronizeWithHandler_SynchronizeRequestError);
        }
        // $NON-NLS-1$
        TeamSynchronization.log("Failed to contact remote peer", cause);
    } catch (InterruptedException e) {
        Thread.interrupted();
        MessageDialog.openError(shell, null, Messages.SynchronizeWithHandler_SynchronizeRequestInterrupted);
        // $NON-NLS-1$
        TeamSynchronization.log("Synchronization request operation was interrupted", e);
    }
    return null;
}
Also used : ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IRoster(org.eclipse.ecf.presence.roster.IRoster) Shell(org.eclipse.swt.widgets.Shell) ECFException(org.eclipse.ecf.core.util.ECFException) RemoteShare(org.eclipse.team.internal.ecf.core.RemoteShare) IUser(org.eclipse.ecf.core.user.IUser) IRosterEntry(org.eclipse.ecf.presence.roster.IRosterEntry) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer) IResource(org.eclipse.core.resources.IResource)

Aggregations

IUser (org.eclipse.ecf.core.user.IUser)16 IRosterEntry (org.eclipse.ecf.presence.roster.IRosterEntry)5 IResource (org.eclipse.core.resources.IResource)4 ID (org.eclipse.ecf.core.identity.ID)4 User (org.eclipse.ecf.core.user.User)4 IContainer (org.eclipse.ecf.core.IContainer)3 ECFException (org.eclipse.ecf.core.util.ECFException)3 IRoster (org.eclipse.ecf.presence.roster.IRoster)3 RemoteShare (org.eclipse.team.internal.ecf.core.RemoteShare)3 URISyntaxException (java.net.URISyntaxException)2 Iterator (java.util.Iterator)2 XMPPID (org.eclipse.ecf.provider.xmpp.identity.XMPPID)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 Job (org.eclipse.core.runtime.jobs.Job)1 IContainerListener (org.eclipse.ecf.core.IContainerListener)1