use of jetbrains.communicator.core.vfs.VFile 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]);
}
use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.
the class ShowDiffCommandTest method testEnabled.
public void testEnabled() throws Exception {
assertFalse(myCommand.isEnabled());
myCommand.setUser(new MockUser());
assertFalse(myCommand.isEnabled());
VFile vFile = VFile.create("a path");
myCommand.setVFile(vFile);
myFacadeMock.expects(once()).method("hasFile").with(eq(vFile)).will(returnValue(false));
assertFalse(myCommand.isEnabled());
myFacadeMock.expects(once()).method("hasFile").with(eq(vFile)).will(returnValue(true));
assertTrue(myCommand.isEnabled());
}
use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.
the class ShowDiffCommandTest method testExecute.
public void testExecute() 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 "something";
}
};
myCommand.setUser(user);
myCommand.setVFile(vFile);
myFacadeMock.expects(once()).method("showDiffFor").with(eq(user), eq(vFile), eq("something"));
myCommand.execute();
}
use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.
the class AbstractTransportTestCase method testGetFileContent_NoSuchFile.
public void testGetFileContent_NoSuchFile() throws Exception {
VFile vFile = VFile.create("a path");
String text = mySelf.getVFile(vFile, myIdeFacade);
assertNull("No file - no text", text);
}
use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.
the class BaseEditorAction method update.
public void update(AnActionEvent e) {
FileEditorManager editorManager = FileEditorManager.getInstance(getProject(e));
Editor editor = editorManager.getSelectedTextEditor();
T command = getCommand(e);
MutablePicoContainer container = getContainer(e);
if (command != null && editor != null && container != null) {
VirtualFile file = FileDocumentManager.getInstance().getFile(editor.getDocument());
if (file != null) {
VFile vFile = VFSUtil.createFileFrom(file, editor.getProject());
if (vFile == null) {
return;
}
command.setVFile(vFile);
setUser(container, command);
prepareCommand(command, editor, container);
}
}
super.update(e);
}
Aggregations