use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.
the class VFSUtilTest method testNoContentRoot.
public void testNoContentRoot() throws Exception {
File dir = createTempDirectory();
VirtualFile someDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(dir);
VirtualFile file = someDir.createChildData(this, "some.file");
VFile vFile = VFSUtil.createFileFrom(file, null);
assertNull("Wrong content path", vFile.getContentPath());
assertEquals("Wrong full path", file.getPath(), vFile.getFullPath());
assertNull("Should NOT restore Virtual File NOT FROM CONTENT ROOT: ", VFSUtil.getVirtualFile(vFile));
}
use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.
the class VFSUtilTest method testInSourceRoot.
public void testInSourceRoot() throws Exception {
VirtualFile file = mySourceRoot.createChildData(this, "some.file");
VFile vFile = checkVFile(file, getProject(), "/src/some.file", file.getPath());
assertEquals("Wrong src path", "/some.file", vFile.getSourcePath());
// Change our source path:
final VirtualFile newSrc = myContentRoot.createChildDirectory(this, "new_src");
updateRoots(new Updater() {
@Override
public void update(ModifiableRootModel modifiableModel) {
myContentEntry = modifiableModel.getContentEntries()[0];
myContentEntry.removeSourceFolder(myContentEntry.getSourceFolders()[0]);
myContentEntry.addSourceFolder(newSrc, false);
}
});
file.delete(this);
VirtualFile childData = newSrc.createChildData(this, "some.file");
VirtualFile virtualFile = VFSUtil.getVirtualFile(vFile);
assertEquals("Should find source file basing on src path", childData, virtualFile);
}
use of jetbrains.communicator.core.vfs.VFile 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();
}
use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.
the class ShowRemoteDiffAction 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 get file " + file);
return;
}
ShowDiffCommand command = Pico.getCommandManager().getCommand(ShowDiffCommand.class, BaseAction.getContainer(editor.getProject()));
command.setUser(user);
command.setVFile(vFile);
command.execute();
}
Aggregations