Search in sources :

Example 11 with VFile

use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.

the class GetVFileContentsProvider method doProcess.

protected void doProcess(Element request, Element response) {
    VFile from = VFile.createFrom(request);
    myIdeFacade.fillFileContents(from);
    from.saveTo(response);
}
Also used : VFile(jetbrains.communicator.core.vfs.VFile)

Example 12 with VFile

use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.

the class SendCodePointerCommandTest method testExecute_Cancel.

public void testExecute_Cancel() throws Exception {
    final boolean[] sent = new boolean[1];
    MockUser user = new MockUser() {

        @Override
        public void sendCodeIntervalPointer(VFile file, CodePointer pointer, String comment, EventBroadcaster eventBroadcaster) {
            sent[0] = true;
        }
    };
    myCommand.setCodePointer(new CodePointer(0, 0));
    myCommand.setVFile(VFile.create("a path"));
    myCommand.setUser(user);
    myFacadeMock.expects(once()).method("getMessage").will(returnValue(null));
    myCommand.execute();
    assertFalse("Should call sendCodeIntervalPointer", sent[0]);
}
Also used : EventBroadcaster(jetbrains.communicator.core.EventBroadcaster) CodePointer(jetbrains.communicator.core.vfs.CodePointer) MockUser(jetbrains.communicator.mock.MockUser) VFile(jetbrains.communicator.core.vfs.VFile)

Example 13 with VFile

use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.

the class SendCodePointerCommandTest method testExecute_WithMessage.

public void testExecute_WithMessage() throws Exception {
    final CodePointer codePointerToSend = new CodePointer(0, 0);
    final VFile fileToSend = VFile.create("a path");
    final boolean[] sent = new boolean[1];
    MockUser user = new MockUser() {

        @Override
        public void sendCodeIntervalPointer(VFile file, CodePointer pointer, String comment, EventBroadcaster eventBroadcaster) {
            sent[0] = true;
            assertSame(fileToSend, file);
            assertSame(codePointerToSend, pointer);
            assertEquals("some message", comment);
        }
    };
    myCommand.setCodePointer(codePointerToSend);
    myCommand.setVFile(fileToSend);
    myCommand.setUser(user);
    myFacadeMock.expects(once()).method("getMessage").will(returnValue("some message"));
    myFacadeMock.expects(once()).method("fillFileContents").with(eq(fileToSend));
    myCommand.execute();
    assertTrue("Should call sendCodeIntervalPointer", sent[0]);
}
Also used : EventBroadcaster(jetbrains.communicator.core.EventBroadcaster) CodePointer(jetbrains.communicator.core.vfs.CodePointer) VFile(jetbrains.communicator.core.vfs.VFile) MockUser(jetbrains.communicator.mock.MockUser)

Example 14 with VFile

use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.

the class SendCodePointerCommandTest method testExecute_LocalMessage.

public void testExecute_LocalMessage() throws Exception {
    addEventListener();
    final CodePointer codePointerToSend = new CodePointer(0, 0);
    final VFile fileToSend = VFile.create("a path");
    User user = UserImpl.create("user", MockTransport.NAME);
    myCommand.setCodePointer(codePointerToSend);
    myCommand.setVFile(fileToSend);
    myCommand.setUser(user);
    myFacadeMock.expects(once()).method("getMessage").will(returnValue("some message"));
    myFacadeMock.expects(once()).method("fillFileContents").with(eq(fileToSend));
    myCommand.execute();
    verifySendMessageLocalEvent(user, "some message");
    assertSame(fileToSend, ((SendCodePointerEvent) myEvents.get(0)).getFile());
    assertSame(codePointerToSend, ((SendCodePointerEvent) myEvents.get(0)).getCodePointer());
}
Also used : User(jetbrains.communicator.core.users.User) MockUser(jetbrains.communicator.mock.MockUser) CodePointer(jetbrains.communicator.core.vfs.CodePointer) VFile(jetbrains.communicator.core.vfs.VFile)

Example 15 with VFile

use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.

the class ShowDiffCommandTest method testExecute_NoContent.

public void testExecute_NoContent() throws Exception {
    final VFile vFile = VFile.create("a file");
    MockUser user = new MockUser() {

        @Override
        public String getVFile(VFile file, IDEFacade ideFacade) {
            assertSame(vFile, file);
            return null;
        }
    };
    myCommand.setUser(user);
    myCommand.setVFile(vFile);
    myCommand.execute();
}
Also used : IDEFacade(jetbrains.communicator.ide.IDEFacade) VFile(jetbrains.communicator.core.vfs.VFile) MockUser(jetbrains.communicator.mock.MockUser)

Aggregations

VFile (jetbrains.communicator.core.vfs.VFile)24 CodePointer (jetbrains.communicator.core.vfs.CodePointer)6 MockUser (jetbrains.communicator.mock.MockUser)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 EventBroadcaster (jetbrains.communicator.core.EventBroadcaster)2 IDEFacade (jetbrains.communicator.ide.IDEFacade)2 Document (com.intellij.openapi.editor.Document)1 Editor (com.intellij.openapi.editor.Editor)1 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)1 Project (com.intellij.openapi.project.Project)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 ProjectFileIndex (com.intellij.openapi.roots.ProjectFileIndex)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 SendCodePointerCommand (jetbrains.communicator.commands.SendCodePointerCommand)1 ShowDiffCommand (jetbrains.communicator.commands.ShowDiffCommand)1 EventVisitor (jetbrains.communicator.core.EventVisitor)1 IDEtalkAdapter (jetbrains.communicator.core.IDEtalkAdapter)1 IDEtalkEvent (jetbrains.communicator.core.IDEtalkEvent)1 CodePointerEvent (jetbrains.communicator.core.transport.CodePointerEvent)1