Search in sources :

Example 1 with CodePointerEvent

use of jetbrains.communicator.core.transport.CodePointerEvent 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 CodePointerEvent

use of jetbrains.communicator.core.transport.CodePointerEvent in project intellij-plugins by JetBrains.

the class IDEAFacade method createLocalMessageForIncomingEvent.

@Override
public LocalMessage createLocalMessageForIncomingEvent(TransportEvent event) {
    final LocalMessage[] result = new LocalMessage[1];
    event.accept(new EventVisitor() {

        @SuppressWarnings({ "RefusedBequest" })
        @Override
        public void visitStacktraceEvent(StacktraceEvent event) {
            result[0] = new IncomingStacktraceMessage(event);
        }

        @SuppressWarnings({ "RefusedBequest" })
        @Override
        public void visitCodePointerEvent(CodePointerEvent event) {
            result[0] = new IncomingCodePointerMessage(event, IDEAFacade.this);
        }

        @SuppressWarnings({ "RefusedBequest" })
        @Override
        public void visitMessageEvent(MessageEvent event) {
            result[0] = new IncomingLocalMessage(event);
        }
    });
    return result[0];
}
Also used : LocalMessage(jetbrains.communicator.core.dispatcher.LocalMessage) IncomingLocalMessage(jetbrains.communicator.idea.sendMessage.IncomingLocalMessage) IncomingCodePointerMessage(jetbrains.communicator.idea.codePointer.IncomingCodePointerMessage) EventVisitor(jetbrains.communicator.core.EventVisitor) MessageEvent(jetbrains.communicator.core.transport.MessageEvent) StacktraceEvent(jetbrains.communicator.core.transport.StacktraceEvent) CodePointerEvent(jetbrains.communicator.core.transport.CodePointerEvent) IncomingLocalMessage(jetbrains.communicator.idea.sendMessage.IncomingLocalMessage) IncomingStacktraceMessage(jetbrains.communicator.idea.sendMessage.IncomingStacktraceMessage)

Example 3 with CodePointerEvent

use of jetbrains.communicator.core.transport.CodePointerEvent in project intellij-plugins by JetBrains.

the class CodePointerLocalMessageTest method testLinkText.

private void testLinkText(String expected, String path, int line1, int line2) {
    CodePointerEvent event = EventFactory.createCodePointerEvent(new MockTransport(), "remoteUser", VFile.create(path), line1, 22, line2, 43, "comment");
    IncomingCodePointerMessage message = new IncomingCodePointerMessage(event, null);
    assertEquals("Incorrect link text", expected, message.getLinkText());
}
Also used : MockTransport(jetbrains.communicator.mock.MockTransport) CodePointerEvent(jetbrains.communicator.core.transport.CodePointerEvent)

Aggregations

CodePointerEvent (jetbrains.communicator.core.transport.CodePointerEvent)3 EventVisitor (jetbrains.communicator.core.EventVisitor)2 IDEtalkAdapter (jetbrains.communicator.core.IDEtalkAdapter)1 IDEtalkEvent (jetbrains.communicator.core.IDEtalkEvent)1 LocalMessage (jetbrains.communicator.core.dispatcher.LocalMessage)1 MessageEvent (jetbrains.communicator.core.transport.MessageEvent)1 StacktraceEvent (jetbrains.communicator.core.transport.StacktraceEvent)1 CodePointer (jetbrains.communicator.core.vfs.CodePointer)1 VFile (jetbrains.communicator.core.vfs.VFile)1 IncomingCodePointerMessage (jetbrains.communicator.idea.codePointer.IncomingCodePointerMessage)1 IncomingLocalMessage (jetbrains.communicator.idea.sendMessage.IncomingLocalMessage)1 IncomingStacktraceMessage (jetbrains.communicator.idea.sendMessage.IncomingStacktraceMessage)1 MockTransport (jetbrains.communicator.mock.MockTransport)1 WaitFor (jetbrains.communicator.util.WaitFor)1