Java 类com.intellij.openapi.vfs.VfsBundle 实例源码

项目:intellij-ce-playground    文件:VirtualFileSystemEntry.java   
@Override
public VirtualFile copy(final Object requestor, @NotNull final VirtualFile newParent, @NotNull final String copyName) throws IOException {
  if (getFileSystem() != newParent.getFileSystem()) {
    throw new IOException(VfsBundle.message("file.copy.error", newParent.getPresentableUrl()));
  }

  if (!newParent.isDirectory()) {
    throw new IOException(VfsBundle.message("file.copy.target.must.be.directory"));
  }

  return EncodingRegistry.doActionAndRestoreEncoding(this, new ThrowableComputable<VirtualFile, IOException>() {
    @Override
    public VirtualFile compute() throws IOException {
      return ourPersistence.copyFile(requestor, VirtualFileSystemEntry.this, newParent, copyName);
    }
  });
}
项目:intellij-ce-playground    文件:JarHandler.java   
@NotNull
private File copyToMirror(@NotNull File original, @NotNull File mirror) {
  ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
  if (progress != null) {
    progress.pushState();
    progress.setText(VfsBundle.message("jar.copy.progress", original.getPath()));
    progress.setFraction(0);
  }

  try {
    FileUtil.copy(original, mirror);
  }
  catch (final IOException e) {
    reportIOErrorWithJars(original, mirror, e);
    return original;
  }

  if (progress != null) {
    progress.popState();
  }

  return mirror;
}
项目:tools-idea    文件:VirtualFileSystemEntry.java   
@Override
public VirtualFile copy(final Object requestor, @NotNull final VirtualFile newParent, @NotNull final String copyName) throws IOException {
  if (getFileSystem() != newParent.getFileSystem()) {
    throw new IOException(VfsBundle.message("file.copy.error", newParent.getPresentableUrl()));
  }

  if (!newParent.isDirectory()) {
    throw new IOException(VfsBundle.message("file.copy.target.must.be.directory"));
  }

  return EncodingRegistry.doActionAndRestoreEncoding(this, new ThrowableComputable<VirtualFile, IOException>() {
    @Override
    public VirtualFile compute() throws IOException {
      return ourPersistence.copyFile(requestor, VirtualFileSystemEntry.this, newParent, copyName);
    }
  });
}
项目:tools-idea    文件:JarHandler.java   
@NotNull
private File copyToMirror(@NotNull File original, @NotNull File mirror) {
  ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
  if (progress != null) {
    progress.pushState();
    progress.setText(VfsBundle.message("jar.copy.progress", original.getPath()));
    progress.setFraction(0);
  }

  try {
    FileUtil.copy(original, mirror);
  }
  catch (final IOException e) {
    reportIOErrorWithJars(original, mirror, e);
    return original;
  }

  if (progress != null) {
    progress.popState();
  }

  return mirror;
}
项目:consulo    文件:JarHandler.java   
@Nonnull
private File copyToMirror(@Nonnull File original, @Nonnull File mirror) {
  ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
  if (progress != null) {
    progress.pushState();
    progress.setText(VfsBundle.message("jar.copy.progress", original.getPath()));
    progress.setFraction(0);
  }

  try {
    FileUtil.copy(original, mirror);
  }
  catch (final IOException e) {
    reportIOErrorWithJars(original, mirror, e);
    return original;
  }
  finally {
    if (progress != null) {
      progress.popState();
    }
  }


  return mirror;
}
项目:intellij-ce-playground    文件:VirtualFileSystemEntry.java   
@Override
public void rename(final Object requestor, @NotNull @NonNls final String newName) throws IOException {
  if (getName().equals(newName)) return;
  if (!isValidName(newName)) {
    throw new IOException(VfsBundle.message("file.invalid.name.error", newName));
  }

  ourPersistence.renameFile(requestor, this, newName);
}
项目:intellij-ce-playground    文件:VirtualFileSystemEntry.java   
@Override
public void move(final Object requestor, @NotNull final VirtualFile newParent) throws IOException {
  if (getFileSystem() != newParent.getFileSystem()) {
    throw new IOException(VfsBundle.message("file.move.error", newParent.getPresentableUrl()));
  }

  EncodingRegistry.doActionAndRestoreEncoding(this, new ThrowableComputable<VirtualFile, IOException>() {
    @Override
    public VirtualFile compute() throws IOException {
      ourPersistence.moveFile(requestor, VirtualFileSystemEntry.this, newParent);
      return VirtualFileSystemEntry.this;
    }
  });
}
项目:intellij-ce-playground    文件:VirtualFileSystemEntry.java   
public void setNewName(@NotNull String newName) {
  if (!isValidName(newName)) {
    throw new IllegalArgumentException(VfsBundle.message("file.invalid.name.error", newName));
  }

  VirtualDirectoryImpl parent = getParent();
  parent.removeChild(this);
  mySegment.setNameId(myId, FileNameCache.storeName(newName));
  ((PersistentFSImpl)PersistentFS.getInstance()).incStructuralModificationCount();
  parent.addChild(this);
}
项目:intellij-ce-playground    文件:JarHandler.java   
private void reportIOErrorWithJars(File original, File target, IOException e) {
  LOG.warn(e);

  String path = original.getPath();
  myFileSystem.setNoCopyJarForPath(path);

  String message = VfsBundle.message("jar.copy.error.message", path, target.getPath(), e.getMessage());
  ERROR_COPY_NOTIFICATION.getValue().createNotification(message, NotificationType.ERROR).notify(null);
}
项目:intellij-ce-playground    文件:RemoteFileInfoImpl.java   
@Override
public void startDownloading() {
  LOG.debug("Downloading requested");

  File localFile;
  synchronized (myLock) {
    if (myState != RemoteFileState.DOWNLOADING_NOT_STARTED) {
      LOG.debug("File already downloaded: file = " + myLocalVirtualFile + ", state = " + myState);
      return;
    }
    myState = RemoteFileState.DOWNLOADING_IN_PROGRESS;

    try {
      myLocalFile = myManager.getStorage().createLocalFile(myUrl);
      LOG.debug("Local file created: " + myLocalFile.getAbsolutePath());
    }
    catch (IOException e) {
      LOG.info(e);
      errorOccurred(VfsBundle.message("cannot.create.local.file", e.getMessage()), false);
      return;
    }
    myCancelled.set(false);
    localFile = myLocalFile;
  }
  for (FileDownloadingListener listener : myListeners) {
    listener.downloadingStarted();
  }

  if (myContentProvider == null) {
    myContentProvider = myManager.findContentProvider(myUrl);
  }
  myContentProvider.saveContent(myUrl, localFile, this);
}
项目:tools-idea    文件:VirtualFileSystemEntry.java   
@Override
public void rename(final Object requestor, @NotNull @NonNls final String newName) throws IOException {
  if (getName().equals(newName)) return;
  if (!isValidName(newName)) {
    throw new IOException(VfsBundle.message("file.invalid.name.error", newName));
  }

  ourPersistence.renameFile(requestor, this, newName);
}
项目:tools-idea    文件:VirtualFileSystemEntry.java   
@Override
public void move(final Object requestor, @NotNull final VirtualFile newParent) throws IOException {
  if (getFileSystem() != newParent.getFileSystem()) {
    throw new IOException(VfsBundle.message("file.move.error", newParent.getPresentableUrl()));
  }

  EncodingRegistry.doActionAndRestoreEncoding(this, new ThrowableComputable<VirtualFile, IOException>() {
    @Override
    public VirtualFile compute() throws IOException {
      ourPersistence.moveFile(requestor, VirtualFileSystemEntry.this, newParent);
      return VirtualFileSystemEntry.this;
    }
  });
}
项目:tools-idea    文件:JarHandler.java   
private void reportIOErrorWithJars(File original, File mirror, IOException e) {
  LOG.warn(e);
  final String path = original.getPath();
  final String message = VfsBundle.message("jar.copy.error.message", path, mirror.getPath(), e.getMessage());

  ERROR_COPY_NOTIFICATION.getValue().createNotification(message, NotificationType.ERROR).notify(null);

  myFileSystem.setNoCopyJarForPath(path);
}
项目:tools-idea    文件:RemoteFileInfoImpl.java   
@Override
public void startDownloading() {
  LOG.debug("Downloading requested");

  File localFile;
  synchronized (myLock) {
    if (myState != RemoteFileState.DOWNLOADING_NOT_STARTED) {
      LOG.debug("File already downloaded: file = " + myLocalVirtualFile + ", state = " + myState);
      return;
    }
    myState = RemoteFileState.DOWNLOADING_IN_PROGRESS;

    try {
      myLocalFile = myManager.getStorage().createLocalFile(myUrl);
      LOG.debug("Local file created: " + myLocalFile.getAbsolutePath());
    }
    catch (IOException e) {
      LOG.info(e);
      errorOccurred(VfsBundle.message("cannot.create.local.file", e.getMessage()), false);
      return;
    }
    myCancelled.set(false);
    localFile = myLocalFile;
  }
  for (FileDownloadingListener listener : myListeners) {
    listener.downloadingStarted();
  }

  if (myContentProvider == null) {
    myContentProvider = myManager.findContentProvider(myUrl);
  }
  myContentProvider.saveContent(myUrl, localFile, this);
}
项目:tools-idea    文件:PsiDirectoryImpl.java   
@Override
public void checkSetName(String name) throws IncorrectOperationException {
  //CheckUtil.checkIsIdentifier(name);
  CheckUtil.checkWritable(this);
  VirtualFile parentFile = myFile.getParent();
  if (parentFile == null) {
    throw new IncorrectOperationException(VfsBundle.message("cannot.rename.root.directory"));
  }
  VirtualFile child = parentFile.findChild(name);
  if (child != null && !child.equals(myFile)) {
    throw new IncorrectOperationException(VfsBundle.message("file.already.exists.error", child.getPresentableUrl()));
  }
}
项目:tools-idea    文件:PsiDirectoryImpl.java   
@Override
public void checkCreateSubdirectory(@NotNull String name) throws IncorrectOperationException {
  // TODO : another check?
  //CheckUtil.checkIsIdentifier(name);
  VirtualFile existingFile = getVirtualFile().findChild(name);
  if (existingFile != null) {
    throw new IncorrectOperationException(VfsBundle.message("file.already.exists.error", existingFile.getPresentableUrl()));
  }
  CheckUtil.checkWritable(this);
}
项目:tools-idea    文件:PsiDirectoryImpl.java   
@Override
public void checkCreateFile(@NotNull String name) throws IncorrectOperationException {
  VirtualFile existingFile = getVirtualFile().findChild(name);
  if (existingFile != null) {
    throw new IncorrectOperationException(VfsBundle.message("file.already.exists.error", existingFile.getPresentableUrl()));
  }
  CheckUtil.checkWritable(this);
}
项目:consulo    文件:VirtualFileSystemEntry.java   
@Override
public VirtualFile copy(final Object requestor, @Nonnull final VirtualFile newParent, @Nonnull final String copyName) throws IOException {
  if (getFileSystem() != newParent.getFileSystem()) {
    throw new IOException(VfsBundle.message("file.copy.error", newParent.getPresentableUrl()));
  }

  if (!newParent.isDirectory()) {
    throw new IOException(VfsBundle.message("file.copy.target.must.be.directory"));
  }

  return EncodingRegistry.doActionAndRestoreEncoding(this, () -> ourPersistence.copyFile(requestor, this, newParent, copyName));
}
项目:consulo    文件:VirtualFileSystemEntry.java   
@Override
public void move(final Object requestor, @Nonnull final VirtualFile newParent) throws IOException {
  if (getFileSystem() != newParent.getFileSystem()) {
    throw new IOException(VfsBundle.message("file.move.error", newParent.getPresentableUrl()));
  }

  EncodingRegistry.doActionAndRestoreEncoding(this, () -> {
    ourPersistence.moveFile(requestor, this, newParent);
    return this;
  });
}
项目:consulo    文件:VirtualFileSystemEntry.java   
public void setNewName(@Nonnull String newName) {
  if (!getFileSystem().isValidName(newName)) {
    throw new IllegalArgumentException(VfsBundle.message("file.invalid.name.error", newName));
  }

  VirtualDirectoryImpl parent = getParent();
  parent.removeChild(this);
  mySegment.setNameId(myId, FileNameCache.storeName(newName));
  ((PersistentFSImpl)PersistentFS.getInstance()).incStructuralModificationCount();
  parent.addChild(this);
}
项目:consulo    文件:JarHandler.java   
private void reportIOErrorWithJars(File original, File target, IOException e) {
  LOG.warn(e);

  String path = original.getPath();
  myFileSystem.setNoCopyJarForPath(path);

  String message = VfsBundle.message("jar.copy.error.message", path, target.getPath(), e.getMessage());
  ERROR_COPY_NOTIFICATION.getValue().createNotification(message, NotificationType.ERROR).notify(null);
}
项目:consulo    文件:RemoteFileInfo.java   
public void startDownloading() {
  LOG.debug("Downloading requested");

  File localFile;
  synchronized (myLock) {
    if (myState != RemoteFileState.DOWNLOADING_NOT_STARTED) {
      LOG.debug("File already downloaded: file = " + myLocalVirtualFile + ", state = " + myState);
      return;
    }
    myState = RemoteFileState.DOWNLOADING_IN_PROGRESS;

    try {
      myLocalFile = myManager.getStorage().createLocalFile(myUrl);
      LOG.debug("Local file created: " + myLocalFile.getAbsolutePath());
    }
    catch (IOException e) {
      LOG.info(e);
      errorOccurred(VfsBundle.message("cannot.create.local.file", e.getMessage()), false);
      return;
    }
    myCancelled.set(false);
    localFile = myLocalFile;
  }
  for (FileDownloadingListener listener : myListeners) {
    listener.downloadingStarted();
  }

  if (myContentProvider == null) {
    myContentProvider = myManager.findContentProvider(myUrl);
  }
  myContentProvider.saveContent(myUrl, localFile, this);
}
项目:consulo    文件:PsiDirectoryImpl.java   
@Override
public void checkSetName(String name) throws IncorrectOperationException {
  //CheckUtil.checkIsIdentifier(name);
  CheckUtil.checkWritable(this);
  VirtualFile parentFile = myFile.getParent();
  if (parentFile == null) {
    throw new IncorrectOperationException(VfsBundle.message("cannot.rename.root.directory"));
  }
  VirtualFile child = parentFile.findChild(name);
  if (child != null && !child.equals(myFile)) {
    throw new IncorrectOperationException(VfsBundle.message("file.already.exists.error", child.getPresentableUrl()));
  }
}
项目:consulo    文件:PsiDirectoryImpl.java   
@Override
public void checkCreateSubdirectory(@Nonnull String name) throws IncorrectOperationException {
  // TODO : another check?
  //CheckUtil.checkIsIdentifier(name);
  VirtualFile existingFile = getVirtualFile().findChild(name);
  if (existingFile != null) {
    throw new IncorrectOperationException(VfsBundle.message("file.already.exists.error", existingFile.getPresentableUrl()));
  }
  CheckUtil.checkWritable(this);
}
项目:consulo    文件:PsiDirectoryImpl.java   
@Override
public void checkCreateFile(@Nonnull String name) throws IncorrectOperationException {
  VirtualFile existingFile = getVirtualFile().findChild(name);
  if (existingFile != null) {
    throw new IncorrectOperationException(VfsBundle.message("file.already.exists.error", existingFile.getPresentableUrl()));
  }

  for (PsiDirectoryMethodProxy proxy : PsiDirectoryMethodProxy.EP_NAME.getExtensions()) {
    if(!proxy.checkCreateFile(this, name)) {
      return;
    }
  }

  CheckUtil.checkWritable(this);
}
项目:intellij-ce-playground    文件:ArchiveFileSystem.java   
@NotNull
@Override
public VirtualFile copyFile(Object requestor, @NotNull VirtualFile file, @NotNull VirtualFile newParent, @NotNull String copyName) throws IOException {
  throw new IOException(VfsBundle.message("jar.modification.not.supported.error", file.getUrl()));
}
项目:intellij-ce-playground    文件:ArchiveFileSystem.java   
@NotNull
@Override
public VirtualFile createChildDirectory(Object requestor, @NotNull VirtualFile parent, @NotNull String dir) throws IOException {
  throw new IOException(VfsBundle.message("jar.modification.not.supported.error", parent.getUrl()));
}
项目:intellij-ce-playground    文件:ArchiveFileSystem.java   
@NotNull
@Override
public VirtualFile createChildFile(Object requestor, @NotNull VirtualFile parent, @NotNull String file) throws IOException {
  throw new IOException(VfsBundle.message("jar.modification.not.supported.error", parent.getUrl()));
}
项目:intellij-ce-playground    文件:ArchiveFileSystem.java   
@Override
public void deleteFile(Object requestor, @NotNull VirtualFile file) throws IOException {
  throw new IOException(VfsBundle.message("jar.modification.not.supported.error", file.getUrl()));
}
项目:intellij-ce-playground    文件:ArchiveFileSystem.java   
@Override
public void moveFile(Object requestor, @NotNull VirtualFile file, @NotNull VirtualFile newParent) throws IOException {
  throw new IOException(VfsBundle.message("jar.modification.not.supported.error", file.getUrl()));
}
项目:intellij-ce-playground    文件:ArchiveFileSystem.java   
@Override
public void renameFile(Object requestor, @NotNull VirtualFile file, @NotNull String newName) throws IOException {
  throw new IOException(VfsBundle.message("jar.modification.not.supported.error", file.getUrl()));
}
项目:intellij-ce-playground    文件:ArchiveFileSystem.java   
@Override
public void setTimeStamp(@NotNull VirtualFile file, long timeStamp) throws IOException {
  throw new IOException(VfsBundle.message("jar.modification.not.supported.error", file.getUrl()));
}
项目:intellij-ce-playground    文件:ArchiveFileSystem.java   
@Override
public void setWritable(@NotNull VirtualFile file, boolean writableFlag) throws IOException {
  throw new IOException(VfsBundle.message("jar.modification.not.supported.error", file.getUrl()));
}
项目:intellij-ce-playground    文件:ArchiveFileSystem.java   
@NotNull
@Override
public OutputStream getOutputStream(@NotNull VirtualFile file, Object requestor, long modStamp, long timeStamp) throws IOException {
  throw new IOException(VfsBundle.message("jar.modification.not.supported.error", file.getUrl()));
}
项目:intellij-ce-playground    文件:VirtualFileDirectoryImpl.java   
@Override
public InputStream getInputStream() throws IOException {
  throw new IOException(VfsBundle.message("file.read.error", getUrl()));
}
项目:intellij-ce-playground    文件:VirtualFileDirectoryImpl.java   
@Override
@NotNull
public OutputStream getOutputStream(Object requestor, long newModificationStamp, long newTimeStamp) throws IOException {
  throw new IOException(VfsBundle.message("file.write.error", getUrl()));
}
项目:intellij-ce-playground    文件:VirtualFileDirectoryImpl.java   
@Override
@NotNull
public byte[] contentsToByteArray() throws IOException {
  throw new IOException(VfsBundle.message("file.read.error", getUrl()));
}
项目:intellij-ce-playground    文件:VirtualFileSystemEntry.java   
private static void validateName(@NotNull String name) throws IOException {
  if (!isValidName(name)) {
    throw new IOException(VfsBundle.message("file.invalid.name.error", name));
  }
}
项目:intellij-ce-playground    文件:JarHandler.java   
@NotNull
@Override
protected NotificationGroup compute() {
  return NotificationGroup.balloonGroup(VfsBundle.message("jar.copy.error.title"));
}
项目:tools-idea    文件:VirtualFileDirectoryImpl.java   
@Override
public InputStream getInputStream() throws IOException {
  throw new IOException(VfsBundle.message("file.read.error", getUrl()));
}