Package de.fu_berlin.inf.dpp

Examples of de.fu_berlin.inf.dpp.User


     */
    public void sendMessageToUser(JID jid, Message message,
        boolean sessionMembersOnly) {

        if (sessionMembersOnly) {
            User participant = sarosSessionObservable.getValue().getUser(jid);
            if (participant == null) {
                log.warn("Buddy not in session:" + Utils.prefix(jid));
                return;
            }

            if (participant.getConnectionState() == UserConnectionState.OFFLINE) {
                /*
                 * TODO This probably does not work anymore! See Feature Request
                 * #2577390
                 */
                // remove participant if he/she is offline too long
                if (participant.getOfflineSeconds() > XMPPTransmitter.FORCEDPART_OFFLINEUSER_AFTERSECS) {
                    log.info("Removing offline buddy from session...");
                    sarosSessionObservable.getValue().removeUser(participant);
                } else {
                    queueMessage(jid, message);
                    log.info("Buddy known as offline - Message queued!");
View Full Code Here


        }

        for (Entry<JID, JupiterActivity> entry : outgoing.entrySet()) {

            JID jid = entry.getKey();
            User to = sarosSession.getUser(jid);

            if (to == null) {
                log.error("Unknown buddy in transformation result: "
                    + Utils.prefix(jid));
                continue;
View Full Code Here

        }

        for (Entry<JID, ChecksumActivity> entry : outgoing.entrySet()) {

            JID jid = entry.getKey();
            User to = sarosSession.getUser(jid);

            if (to == null) {
                log.error("Unknown buddy in transformation result: "
                    + Utils.prefix(jid));
                continue;
View Full Code Here

     */
    public void exec(final IActivity activity) {

        assert Utils.isSWT();

        User sender = activity.getSource();
        if (!sender.isInSarosSession()) {
            log.warn("Trying to execute activityDataObject for unknown buddy: "
                + activity);
            return;
        }

View Full Code Here

        activity.dispatch(activityReceiver);
    }

    protected void execEditorActivity(EditorActivity editorActivity) {
        User sender = editorActivity.getSource();
        SPath sPath = editorActivity.getPath();
        switch (editorActivity.getType()) {
        case Activated:
            execActivated(sender, sPath);
            break;
View Full Code Here

                + " is not available locally: " + textEdit);
            // TODO A consistency check can be started here
            return;
        }

        User user = textEdit.getSource();

        /*
         * Disable documentListener temporarily to avoid being notified of the
         * change
         */
        documentListener.enabled = false;

        replaceText(path, textEdit.getOffset(), textEdit.getReplacedText(),
            textEdit.getText(), user);

        documentListener.enabled = true;

        /*
         * If the text edit ends in the visible region of a local editor, set
         * the cursor annotation.
         *
         * TODO Performance optimization in case of batch operation might make
         * sense. Problem: How to recognize batch operations?
         */
        for (IEditorPart editorPart : editorPool.getEditors(path)) {
            ITextViewer viewer = EditorAPI.getViewer(editorPart);
            if (viewer == null) {
                // No text viewer for the editorPart found.
                continue;
            }
            int cursorOffset = textEdit.getOffset()
                + textEdit.getText().length();
            if (viewer.getTopIndexStartOffset() <= cursorOffset
                && cursorOffset <= viewer.getBottomIndexEndOffset()) {

                editorAPI.setSelection(editorPart, new TextSelection(
                    cursorOffset, 0), user, user.equals(getFollowedUser()));
            }
        }

        // inform all registered ISharedEditorListeners about this text edit
        editorListenerDispatch.textEditRecieved(user, path, textEdit.getText(),
View Full Code Here

        }

        TextSelection textSelection = new TextSelection(selection.getOffset(),
            selection.getLength());

        User user = selection.getSource();

        Set<IEditorPart> editors = EditorManager.this.editorPool
            .getEditors(path);
        for (IEditorPart editorPart : editors) {
            this.editorAPI.setSelection(editorPart, textSelection, user,
                user.equals(getFollowedUser()));
        }

        /*
         * inform all registered ISharedEditorListeners about a text selection
         * made
 
View Full Code Here

    protected void execViewport(ViewportActivity viewport) {

        log.trace("EditorManager.execViewport invoked");

        User user = viewport.getSource();
        boolean following = user.equals(getFollowedUser());

        {
            /**
             * Check if source is an observed user with
             * {@link User.Permission#WRITE_ACCESS} and his cursor is outside
             * the viewport.
             */
            ITextSelection userWithWriteAccessSelection = remoteEditorManager
                .getSelection(user);
            /**
             * user with {@link User.Permission#WRITE_ACCESS} selection can be
             * null if viewport activityDataObject came before the first text
             * selection activityDataObject.
             */
            if (userWithWriteAccessSelection != null) {
                /**
                 * TODO MR Taking the last line of the last selection of the
                 * user with {@link User.Permission#WRITE_ACCESS} might be a bit
                 * inaccurate.
                 */
                int userWithWriteAccessCursor = userWithWriteAccessSelection
                    .getEndLine();
                int top = viewport.getTopIndex();
                int bottom = viewport.getBottomIndex();
                following = following
                    && (userWithWriteAccessCursor < top || userWithWriteAccessCursor > bottom);
            }
        }

        Set<IEditorPart> editors = this.editorPool.getEditors(viewport
            .getPath());
        ILineRange lineRange = viewport.getLineRange();
        for (IEditorPart editorPart : editors) {
            if (following || user.hasWriteAccess())
                this.editorAPI.setViewportAnnotation(editorPart, lineRange,
                    user);
            if (following)
                this.editorAPI.reveal(editorPart, lineRange);
        }
View Full Code Here

     * than before! Probably when renaming.
     *
     */
    public void partInputChanged(IEditorPart editor) {
        // notice currently followed user before closing the editor
        User followedUser = getFollowedUser();

        if (editorPool.isManaged(editor)) {

            // Pretend as if the editor was closed locally (but use the old part
            // before the move happened) and then simulate it being opened again
View Full Code Here

     */
    public void setFollowing(User newFollowedUser) {
        assert newFollowedUser == null
            || !newFollowedUser.equals(sarosSession.getLocalUser()) : "Local buddy cannot follow himself!";

        User oldFollowedUser = this.followedUser;
        this.followedUser = newFollowedUser;

        if (oldFollowedUser != null && !oldFollowedUser.equals(newFollowedUser)) {
            editorListenerDispatch.followModeChanged(oldFollowedUser, false);
        }

        if (newFollowedUser != null) {
            editorListenerDispatch.followModeChanged(newFollowedUser, true);
View Full Code Here

TOP

Related Classes of de.fu_berlin.inf.dpp.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.