use of jetbrains.communicator.core.vfs.CodePointer in project intellij-plugins by JetBrains.
the class SendCodePointerCommandTest method testEnabled.
public void testEnabled() throws Exception {
assertFalse(myCommand.isEnabled());
myCommand.setCodePointer(new CodePointer(0, 0));
assertFalse(myCommand.isEnabled());
myCommand.setVFile(VFile.create("a path"));
assertFalse(myCommand.isEnabled());
myCommand.setUser(new MockUser());
assertTrue("Now codePointer, file, user are selected - ready to send", myCommand.isEnabled());
}
use of jetbrains.communicator.core.vfs.CodePointer 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]);
}
use of jetbrains.communicator.core.vfs.CodePointer 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());
}
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);
}
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();
}
Aggregations