Search in sources :

Example 1 with CodePointer

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

the class TestUtil method testSendCodePointer_Functional.

public static void testSendCodePointer_Functional(BaseTestCase testCase, User self) {
    final String[] log = new String[] { "" };
    testCase.getBroadcaster().addListener(new IDEtalkAdapter() {

        @Override
        public void afterChange(IDEtalkEvent event) {
            event.accept(new EventVisitor() {

                @Override
                public void visitCodePointerEvent(CodePointerEvent event) {
                    log[0] += event.getRemoteUser() + ' ';
                    log[0] += event.getComment();
                    log[0] += event.getCodePointer().toString();
                    log[0] += event.getFile().toString();
                }
            });
        }
    });
    testCase.markLastListenerForCleanup();
    log[0] = "";
    CodePointer pointer = new CodePointer(0, 1);
    VFile file = VFile.create("path");
    self.sendCodeIntervalPointer(file, pointer, "comment���< && 53", testCase.getBroadcaster());
    new WaitFor(2000) {

        @Override
        protected boolean condition() {
            return log[0].length() > 0;
        }
    };
    Assert.assertEquals("Code Pointer expected", self.getName() + " comment���< && 53" + pointer + file, log[0]);
}
Also used : EventVisitor(jetbrains.communicator.core.EventVisitor) WaitFor(jetbrains.communicator.util.WaitFor) IDEtalkEvent(jetbrains.communicator.core.IDEtalkEvent) CodePointerEvent(jetbrains.communicator.core.transport.CodePointerEvent) CodePointer(jetbrains.communicator.core.vfs.CodePointer) IDEtalkAdapter(jetbrains.communicator.core.IDEtalkAdapter) VFile(jetbrains.communicator.core.vfs.VFile)

Example 2 with CodePointer

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

the class IDEAFacadeTest method testCreateLocalMessage_OutgoingCodePointer.

public void testCreateLocalMessage_OutgoingCodePointer() throws Exception {
    SendCodePointerEvent event = new SendCodePointerEvent("message", VFile.create("a path"), new CodePointer(3, 4), myUser);
    LocalMessage outgoingEvent = myFacade.createLocalMessageForOutgoingEvent(event);
    assertTrue(outgoingEvent instanceof OutgoingCodePointerLocalMessage);
}
Also used : IncomingLocalMessage(jetbrains.communicator.idea.sendMessage.IncomingLocalMessage) LocalMessage(jetbrains.communicator.core.dispatcher.LocalMessage) CodePointer(jetbrains.communicator.core.vfs.CodePointer) SendCodePointerEvent(jetbrains.communicator.ide.SendCodePointerEvent)

Example 3 with CodePointer

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

the class CodePointerXmlMessageTest method testComplexVFile.

public void testComplexVFile() throws Throwable {
    VFile expected = VFile.create("foo/bar", "bar", false);
    expected.setContents("#$@#@#$что-то такое");
    expected.setProjectName("project");
    expected.setFQName("some FQName");
    expected.setSourcePath("some source path");
    _test("", expected, new CodePointer(1, 2, 3, 4));
}
Also used : CodePointer(jetbrains.communicator.core.vfs.CodePointer) VFile(jetbrains.communicator.core.vfs.VFile)

Example 4 with CodePointer

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

the class SendCodePointerAction method prepareCommand.

protected void prepareCommand(FileCommand command, Editor editor, MutablePicoContainer container) {
    CodePointer codePointer = ActionUtil.getCodePointer(editor);
    ((SendCodePointerCommand) command).setCodePointer(codePointer);
}
Also used : SendCodePointerCommand(jetbrains.communicator.commands.SendCodePointerCommand) CodePointer(jetbrains.communicator.core.vfs.CodePointer)

Example 5 with CodePointer

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

the class SendToAction method doActionCommand.

protected void doActionCommand(final User user, final VirtualFile file, final Editor editor) {
    VFile vFile = VFSUtil.createFileFrom(file, editor.getProject());
    if (vFile == null) {
        LOG.info("Unable to send code pointer for " + file);
        return;
    }
    CodePointer codePointer = ActionUtil.getCodePointer(editor);
    SendCodePointerCommand command = Pico.getCommandManager().getCommand(SendCodePointerCommand.class, BaseAction.getContainer(editor.getProject()));
    command.setCodePointer(codePointer);
    command.setVFile(vFile);
    command.setUser(user);
    command.execute();
}
Also used : SendCodePointerCommand(jetbrains.communicator.commands.SendCodePointerCommand) CodePointer(jetbrains.communicator.core.vfs.CodePointer) VFile(jetbrains.communicator.core.vfs.VFile)

Aggregations

CodePointer (jetbrains.communicator.core.vfs.CodePointer)10 VFile (jetbrains.communicator.core.vfs.VFile)6 MockUser (jetbrains.communicator.mock.MockUser)4 SendCodePointerCommand (jetbrains.communicator.commands.SendCodePointerCommand)2 EventBroadcaster (jetbrains.communicator.core.EventBroadcaster)2 LogicalPosition (com.intellij.openapi.editor.LogicalPosition)1 EventVisitor (jetbrains.communicator.core.EventVisitor)1 IDEtalkAdapter (jetbrains.communicator.core.IDEtalkAdapter)1 IDEtalkEvent (jetbrains.communicator.core.IDEtalkEvent)1 LocalMessage (jetbrains.communicator.core.dispatcher.LocalMessage)1 CodePointerEvent (jetbrains.communicator.core.transport.CodePointerEvent)1 User (jetbrains.communicator.core.users.User)1 SendCodePointerEvent (jetbrains.communicator.ide.SendCodePointerEvent)1 IncomingLocalMessage (jetbrains.communicator.idea.sendMessage.IncomingLocalMessage)1 WaitFor (jetbrains.communicator.util.WaitFor)1