Search in sources :

Example 21 with VFile

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));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) VFile(jetbrains.communicator.core.vfs.VFile) VFile(jetbrains.communicator.core.vfs.VFile)

Example 22 with 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);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ModifiableRootModel(com.intellij.openapi.roots.ModifiableRootModel) VFile(jetbrains.communicator.core.vfs.VFile)

Example 23 with VFile

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();
}
Also used : SendCodePointerCommand(jetbrains.communicator.commands.SendCodePointerCommand) CodePointer(jetbrains.communicator.core.vfs.CodePointer) VFile(jetbrains.communicator.core.vfs.VFile)

Example 24 with VFile

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();
}
Also used : ShowDiffCommand(jetbrains.communicator.commands.ShowDiffCommand) VFile(jetbrains.communicator.core.vfs.VFile)

Aggregations

VFile (jetbrains.communicator.core.vfs.VFile)24 CodePointer (jetbrains.communicator.core.vfs.CodePointer)6 MockUser (jetbrains.communicator.mock.MockUser)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 EventBroadcaster (jetbrains.communicator.core.EventBroadcaster)2 IDEFacade (jetbrains.communicator.ide.IDEFacade)2 Document (com.intellij.openapi.editor.Document)1 Editor (com.intellij.openapi.editor.Editor)1 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)1 Project (com.intellij.openapi.project.Project)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 ProjectFileIndex (com.intellij.openapi.roots.ProjectFileIndex)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 SendCodePointerCommand (jetbrains.communicator.commands.SendCodePointerCommand)1 ShowDiffCommand (jetbrains.communicator.commands.ShowDiffCommand)1 EventVisitor (jetbrains.communicator.core.EventVisitor)1 IDEtalkAdapter (jetbrains.communicator.core.IDEtalkAdapter)1 IDEtalkEvent (jetbrains.communicator.core.IDEtalkEvent)1 CodePointerEvent (jetbrains.communicator.core.transport.CodePointerEvent)1