Package floobits.common.protocol.buf

Examples of floobits.common.protocol.buf.Buf


        }
    }

    void _on_patch(JsonObject obj) {
        final FlooPatch res = new Gson().fromJson(obj, (Type) FlooPatch.class);
        final Buf buf = this.state.bufs.get(res.id);
        editor.queue(buf, new RunLater<Buf>() {
            @Override
            public void run(Buf b) {
                if (b.buf == null) {
                    Flog.warn("no buffer");
View Full Code Here


    }

    void _on_get_buf(JsonObject obj) {
        Gson gson = new Gson();
        final GetBufResponse res = gson.fromJson(obj, (Type) GetBufResponse.class);
        Buf b = state.bufs.get(res.id);
        editor.queue(b, new RunLater<Buf>() {
            @Override
            public void run(Buf b) {
                b.set(res.buf, res.md5);
                b.write();
                Flog.info("on get buffed. %s", b.path);
            }
        });
    }
View Full Code Here

    public void rename(String path, String newPath) {
        if (!state.can("patch")) {
            return;
        }
        Flog.log("Renamed buf: %s - %s", path, newPath);
        Buf buf = state.getBufByPath(path);
        if (buf == null) {
            Flog.info("buf does not exist.");
            return;
        }
        String newRelativePath = context.toProjectRelPath(newPath);
View Full Code Here

        }
        if (!context.isShared(filePath)) {
            return;
        }
        state.pauseFollowing(true);
        final Buf buf = state.getBufByPath(filePath);
        if (buf == null) {
            return;
        }
        synchronized (buf) {
            if (Buf.isBad(buf)) {
                Flog.info("buf isn't populated yet %s", file.getPath());
                return;
            }
            buf.send_patch(file);
        }
    }
View Full Code Here

            buf.send_patch(file);
        }
    }

    public void changeSelection(String path, ArrayList<ArrayList<Integer>> textRanges, boolean following) {
        Buf buf = state.getBufByPath(path);
        outbound.highlight(buf, textRanges, false, following);
    }
View Full Code Here

        Buf buf = state.getBufByPath(path);
        outbound.highlight(buf, textRanges, false, following);
    }

    public void save(String path) {
        Buf buf = state.getBufByPath(path);
        outbound.saveBuf(buf);
    }
View Full Code Here

        if (!state.can("patch")) {
            return;
        }

        for (String path : files) {
            Buf buf = state.getBufByPath(path);
            if (buf == null) {
                context.warnMessage(String.format("The file, %s, is not in the workspace.", path));
                continue;
            }
            outbound.deleteBuf(buf, false);
View Full Code Here

            outbound.deleteBuf(buf, false);
        }
    }

    void delete(String path) {
        Buf buf = state.getBufByPath(path);
        if (buf == null) {
            return;
        }
        outbound.deleteBuf(buf, true);
    }
View Full Code Here

        }
        if (!virtualFile.isValid()) {
            return;
        }
        String path = virtualFile.getPath();
        Buf b = state.getBufByPath(path);
        if (b != null) {
            Flog.info("Already in workspace: %s", path);
            return;
        }
        outbound.createBuf(virtualFile);
View Full Code Here

    }

    public void beforeChange(IDoc doc) {
        final IFile virtualFile = doc.getVirtualFile();
        final String path = virtualFile.getPath();
        final Buf bufByPath = state.getBufByPath(path);
        if (bufByPath == null) {
            return;
        }
        String msg;
        if (state.readOnly) {
            msg = "This document is readonly because you don't have edit permission in the workspace.";
        } else if (!bufByPath.isPopulated()) {
            msg = "This document is temporarily readonly while we fetch a fresh copy.";
        } else {
            return;
        }
        context.statusMessage(msg);
        doc.setReadOnly(true);
        IFactory.readOnlyBufferIds.add(bufByPath.path);
        final String text = doc.getText();
        context.setTimeout(0, new Runnable() {
            @Override
            public void run() {
                context.writeThread(new Runnable() {
                    @Override
                    public void run() {
                        if (!state.readOnly && bufByPath.isPopulated()) {
                            return;
                        }
                        synchronized (context) {
                            try {
                                context.setListener(false);
View Full Code Here

TOP

Related Classes of floobits.common.protocol.buf.Buf

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.