Package com.intellij.openapi.vfs

Examples of com.intellij.openapi.vfs.VirtualFile.rename()


    if (newFileName == null || newFileName.equals(file.getName())) return;

    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      @Override public void run() {
        try {
          file.rename(null, newFileName);
          updateTreeModel_HACK();
        } catch (IOException e) {
          IdeUtil.showErrorDialog(event.getProject(), "Couldn't rename " + file.getName() + " to " + newFileName, "Error");
        }
      }
View Full Code Here


    if (virtualFile == null) return false;

    return ApplicationManager.getApplication().runWriteAction(new Computable<Boolean>() {
      @Override public Boolean compute() {
        try {
          virtualFile.rename(this, newFileName);
          return true;
        } catch (IOException e) {
          LOG.warn(e);
          return false;
        }
View Full Code Here

  public static PsiElement setName(@NotNull ErlangModule o, @NotNull String newName) {
    VirtualFile virtualFile = o.getContainingFile().getVirtualFile();
    if (virtualFile != null) {
      try {
        String ext = FileUtilRt.getExtension(virtualFile.getName());
        virtualFile.rename(o, StringUtil.replace(newName, "'", "") + "." + ext);
        renameQAtom(o.getQAtom(), newName);
      } catch (Exception ignored) {
      }
    }
    return o;
View Full Code Here

      AccessToken token = WriteAction.start();
      try {
        VirtualFile virtualFile = module.getContainingFile().getVirtualFile();
        String extension = FileUtilRt.getExtension(module.getContainingFile().getName());
        if (virtualFile != null) {
          virtualFile.rename(problemDescriptor, StringUtil.replace(module.getName(), "'", "") + "." + extension);
        }
      } catch (IOException ignored) {
      } finally {
        token.finish();
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.