本文整理汇总了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;
}
}
示例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;
}
示例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);
}
示例5: findSequentNonExistingUntitled
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@NotNull
protected File findSequentNonExistingUntitled() {
return FileUtil.findSequentNonexistentFile(new File(ProjectUtil.getBaseDir()), "course", "");
}
示例6: getDefaultPatchFile
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private File getDefaultPatchFile() {
return FileUtil.findSequentNonexistentFile(new File(myProject.getBasePath()), "local_history", "patch");
}
示例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;
}
});
}
示例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);
}
}
示例9: findSequentNonExistingUntitled
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static File findSequentNonExistingUntitled() {
return FileUtil.findSequentNonexistentFile(new File(ProjectUtil.getBaseDir()), "untitled", "");
}