當前位置: 首頁>>代碼示例>>Java>>正文


Java FileUtil.findSequentNonexistentFile方法代碼示例

本文整理匯總了Java中com.intellij.openapi.util.io.FileUtil.findSequentNonexistentFile方法的典型用法代碼示例。如果您正苦於以下問題:Java FileUtil.findSequentNonexistentFile方法的具體用法?Java FileUtil.findSequentNonexistentFile怎麽用?Java FileUtil.findSequentNonexistentFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.util.io.FileUtil的用法示例。


在下文中一共展示了FileUtil.findSequentNonexistentFile方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doCreateDeploymentRuntime

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
protected CloudDeploymentRuntime doCreateDeploymentRuntime(ArtifactDeploymentSource artifactSource,
                                                           File artifactFile,
                                                           CloudMultiSourceServerRuntimeInstance serverRuntime,
                                                           DeploymentTask<? extends CloudDeploymentNameConfiguration> deploymentTask,
                                                           DeploymentLogManager logManager) throws ServerRuntimeException {
  RepositoryDeploymentConfiguration config = (RepositoryDeploymentConfiguration)deploymentTask.getConfiguration();

  String repositoryPath = config.getRepositoryPath();
  File repositoryRootFile;
  if (StringUtil.isEmpty(repositoryPath)) {
    File repositoryParentFolder = new File(PathManager.getSystemPath(), "cloud-git-artifact-deploy");
    repositoryRootFile = FileUtil.findSequentNonexistentFile(repositoryParentFolder, artifactFile.getName(), "");
  }
  else {
    repositoryRootFile = new File(repositoryPath);
  }

  if (!FileUtil.createDirectory(repositoryRootFile)) {
    throw new ServerRuntimeException("Unable to create deploy folder: " + repositoryRootFile);
  }
  config.setRepositoryPath(repositoryRootFile.getAbsolutePath());
  return doCreateDeploymentRuntime(artifactSource, artifactFile, serverRuntime, deploymentTask, logManager, repositoryRootFile);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:RepositoryArtifactDeploymentRuntimeProviderBase.java

示例2: suggestPatchName

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@NotNull
// for create patch only
public static File suggestPatchName(Project project, @NotNull final String commitMessage, final File file, String extension) {
  @NonNls String defaultPath = shortenAndSanitize(commitMessage);
  while (true) {
    final File nonexistentFile = FileUtil.findSequentNonexistentFile(file, defaultPath,
                                                                     extension == null
                                                                     ? VcsConfiguration.getInstance(project).getPatchFileExtension()
                                                                     : extension);
    if (nonexistentFile.getName().length() >= PatchNameChecker.MAX) {
      defaultPath = defaultPath.substring(0, defaultPath.length() - 1);
      continue;
    }
    return nonexistentFile;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:ShelveChangesManager.java

示例3: createLocalFile

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public File createLocalFile(@NotNull Url url) throws IOException {
  String baseName = PathUtilRt.getFileName(url.getPath());
  int index = baseName.lastIndexOf('.');
  String prefix = index == -1 ? baseName : baseName.substring(0, index);
  String suffix = index == -1 ? "" : baseName.substring(index+1);
  prefix = PathUtilRt.suggestFileName(prefix);
  suffix = PathUtilRt.suggestFileName(suffix);
  File file = FileUtil.findSequentNonexistentFile(myStorageIODirectory, prefix, suffix);
  FileUtilRt.createIfNotExists(file);
  return file;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:LocalFileStorage.java

示例4: moveToUndoStorage

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private void moveToUndoStorage(final VirtualFile file) {
  if (myStorageForUndo == null) {
    try {
      myStorageForUndo = FileUtil.createTempDirectory("svnUndoStorage", "");
    }
    catch (IOException e) {
      LOG.error(e);
      return; 
    }
  }
  final File tmpFile = FileUtil.findSequentNonexistentFile(myStorageForUndo, "tmp", "");
  myUndoStorageContents.add(0, Couple.of(new File(file.getPath()), tmpFile));
  new File(file.getPath()).renameTo(tmpFile);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:SvnFileSystemListener.java

示例5: findSequentNonExistingUntitled

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@NotNull
protected File findSequentNonExistingUntitled() {
  return FileUtil.findSequentNonexistentFile(new File(ProjectUtil.getBaseDir()), "course", "");
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:5,代碼來源:EduCreateNewProjectPanel.java

示例6: getDefaultPatchFile

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private File getDefaultPatchFile() {
  return FileUtil.findSequentNonexistentFile(new File(myProject.getBasePath()), "local_history", "patch");
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:HistoryDialog.java

示例7: LocationNameFieldsBinding

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public LocationNameFieldsBinding(@Nullable Project project,
                                 final TextFieldWithBrowseButton locationField,
                                 final JTextField nameField,
                                 String baseDir,
                                 String title) {
  myBaseDir = baseDir;
  File suggestedProjectDirectory = FileUtil.findSequentNonexistentFile(new File(baseDir), "untitled", "");
  locationField.setText(suggestedProjectDirectory.toString());
  nameField.setDocument(new NameFieldDocument(nameField, locationField));
  mySuggestedProjectName = suggestedProjectDirectory.getName();
  nameField.setText(mySuggestedProjectName);
  nameField.selectAll();

  FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  BrowseFolderActionListener<JTextField> listener =
    new BrowseFolderActionListener<JTextField>(title, "", locationField, project, descriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
      @Override
      protected void onFileChosen(@NotNull VirtualFile chosenFile) {
        myBaseDir = chosenFile.getPath();
        if (isProjectNameChanged(nameField.getText()) && !nameField.getText().equals(chosenFile.getName())) {
          myExternalModify = true;
          locationField.setText(new File(chosenFile.getPath(), nameField.getText()).toString());
          myExternalModify = false;
        }
        else {
          myExternalModify = true;
          locationField.setText(chosenFile.getPath());
          nameField.setText(chosenFile.getName());
          myExternalModify = false;
        }
      }
    };
  locationField.addActionListener(listener);
  locationField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      if (myExternalModify) {
        return;
      }
      myModifyingLocation = true;
      String path = locationField.getText().trim();
      if (path.endsWith(File.separator)) {
        path = path.substring(0, path.length() - File.separator.length());
      }
      int ind = path.lastIndexOf(File.separator);
      if (ind != -1) {
        String projectName = path.substring(ind + 1, path.length());
        if (!nameField.getText().trim().isEmpty()) {
          myBaseDir = path.substring(0, ind);
        }
        if (!projectName.equals(nameField.getText())) {
          if (!myModifyingProjectName) {
            nameField.setText(projectName);
          }
        }
      }
      myModifyingLocation = false;
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:61,代碼來源:LocationNameFieldsBinding.java

示例8: finished

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public void finished(@Nullable final FileType fileType) {
  final File localIOFile;

  synchronized (myLock) {
    LOG.debug("Downloading finished, size = " + myLocalFile.length() + ", file type=" + (fileType != null ? fileType.getName() : "null"));
    if (fileType != null) {
      String fileName = myLocalFile.getName();
      int dot = fileName.lastIndexOf('.');
      String extension = fileType.getDefaultExtension();
      if (dot == -1 || !extension.regionMatches(true, 0, fileName, dot + 1, extension.length())) {
        File newFile = FileUtil.findSequentNonexistentFile(myLocalFile.getParentFile(), fileName, extension);
        try {
          FileUtil.rename(myLocalFile, newFile);
          myLocalFile = newFile;
        }
        catch (IOException e) {
          LOG.debug(e);
        }
      }
    }

    localIOFile = myLocalFile;
  }

  VirtualFile localFile = new WriteAction<VirtualFile>() {
    @Override
    protected void run(@NotNull final Result<VirtualFile> result) {
      final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(localIOFile);
      if (file != null) {
        file.refresh(false, false);
      }
      result.setResult(file);
    }
  }.execute().getResultObject();
  LOG.assertTrue(localFile != null, "Virtual local file not found for " + localIOFile.getAbsolutePath());
  LOG.debug("Virtual local file: " + localFile + ", size = " + localFile.getLength());
  synchronized (myLock) {
    myLocalVirtualFile = localFile;
    myPrevLocalFile = null;
    myState = RemoteFileState.DOWNLOADED;
    myErrorMessage = null;
  }
  for (FileDownloadingListener listener : myListeners) {
    listener.fileDownloaded(localFile);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:48,代碼來源:RemoteFileInfoImpl.java

示例9: findSequentNonExistingUntitled

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private static File findSequentNonExistingUntitled() {
  return FileUtil.findSequentNonexistentFile(new File(ProjectUtil.getBaseDir()), "untitled", "");
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:ProjectSettingsStepBase.java


注:本文中的com.intellij.openapi.util.io.FileUtil.findSequentNonexistentFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。