当前位置: 首页>>代码示例>>Java>>正文


Java PathUtil.getFileName方法代码示例

本文整理汇总了Java中com.intellij.util.PathUtil.getFileName方法的典型用法代码示例。如果您正苦于以下问题:Java PathUtil.getFileName方法的具体用法?Java PathUtil.getFileName怎么用?Java PathUtil.getFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.PathUtil的用法示例。


在下文中一共展示了PathUtil.getFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  if (ourOutputRoot == null) {
    ourOutputRoot = FileUtil.createTempDirectory("ExecutionTestCase", null, true);
  }
  myModuleOutputDir = new File(ourOutputRoot, PathUtil.getFileName(getTestAppPath()));
  myChecker = initOutputChecker();
  EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
    @Override
    public void run() throws Throwable {
      ExecutionTestCase.super.setUp();
    }
  });
  if (!myModuleOutputDir.exists()) {
    myCompilerTester = new CompilerTester(myProject, Arrays.asList(ModuleManager.getInstance(myProject).getModules()));
    List<CompilerMessage> messages = myCompilerTester.rebuild();
    for (CompilerMessage message : messages) {
      if (message.getCategory() == CompilerMessageCategory.ERROR) {
        FileUtil.delete(myModuleOutputDir);
        fail("Compilation failed: " + message);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ExecutionTestCase.java

示例2: getDownloadFilesMessage

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
private String getDownloadFilesMessage() {
  final LibraryDownloadSettings downloadSettings = mySettings.getDownloadSettings();
  if (downloadSettings == null) return "";

  final String downloadPath = downloadSettings.getDirectoryForDownloadedLibrariesPath();
  final String basePath = mySettings.getBaseDirectoryPath();
  String path;
  if (!StringUtil.isEmpty(basePath) && FileUtil.startsWith(downloadPath, basePath)) {
    path = FileUtil.getRelativePath(basePath, downloadPath, '/');
  }
  else {
    path = PathUtil.getFileName(downloadPath);
  }
  return MessageFormat.format("{0} {0, choice, 1#JAR|2#JARs} will be downloaded into <b>{1}</b> directory<br>" +
                                 "{2} library <b>{3}</b> will be created",
                                 downloadSettings.getSelectedDownloads().size(),
                                 path,
                                 downloadSettings.getLibraryLevel(),
                                 downloadSettings.getLibraryName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LibraryOptionsPanel.java

示例3: computeAntInstructions

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
@Override
public List<? extends Generator> computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext,
                                                        @NotNull AntCopyInstructionCreator creator,
                                                        @NotNull ArtifactAntGenerationContext generationContext,
                                                        @NotNull ArtifactType artifactType) {
  final String jarPath = generationContext.getSubstitutedPath(myFilePath);
  final String pathInJar = StringUtil.trimStart(myPathInJar, "/");
  if (pathInJar.length() == 0) {
    return Collections.singletonList(creator.createExtractedDirectoryInstruction(jarPath));
  }

  final String archiveName = PathUtil.getFileName(myFilePath);
  final String tempDirProperty = generationContext.createNewTempFileProperty("temp.unpacked.path." + archiveName, archiveName);
  final String tempDirPath = BuildProperties.propertyRef(tempDirProperty);
  generationContext.runBeforeCurrentArtifact(new Mkdir(tempDirPath));

  final Unzip unzip = new Unzip(jarPath, tempDirPath);
  final PatternSet patterns = new PatternSet(null);
  patterns.add(new Include(pathInJar + "**"));
  unzip.add(patterns);
  generationContext.runBeforeCurrentArtifact(unzip);

  return Collections.singletonList(creator.createDirectoryContentCopyInstruction(tempDirPath + "/" + pathInJar));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ExtractedDirectoryPackagingElement.java

示例4: createLabelFromString

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
/**
 * Canonicalizes the label (to the form [@external_workspace]//packagePath:packageRelativeTarget).
 * Returns null if the string does not represent a valid label.
 */
@Nullable
public static Label createLabelFromString(
    @Nullable BlazePackage blazePackage, @Nullable String labelString) {
  if (labelString == null) {
    return null;
  }
  int colonIndex = labelString.indexOf(':');
  if (isAbsolute(labelString)) {
    if (colonIndex == -1) {
      // add the implicit rule name
      labelString += ":" + PathUtil.getFileName(labelString);
    }
    return Label.createIfValid(labelString);
  }
  // package-relative label of the form '[:]relativePath'
  if (colonIndex > 0 || blazePackage == null) {
    return null;
  }
  Label packageLabel = blazePackage.getPackageLabel();
  return packageLabel != null
      ? packageLabel.withTargetName(labelString.substring(colonIndex + 1))
      : null;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:28,代码来源:LabelUtils.java

示例5: containsDependencyOnApklibFile

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
private static boolean containsDependencyOnApklibFile(@NotNull LibraryOrderEntry libraryOrderEntry,
                                                      @NotNull IdeModifiableModelsProvider modelsProvider) {
  final Library library = libraryOrderEntry.getLibrary();

  if (library == null) {
    return false;
  }
  final Library.ModifiableModel libraryModel = modelsProvider.getModifiableLibraryModel(library);
  final String[] urls = libraryModel.getUrls(OrderRootType.CLASSES);

  for (String url : urls) {
    final String fileName = PathUtil.getFileName(PathUtil.toPresentableUrl(url));

    if (FileUtilRt.extensionEquals(fileName, "apklib")) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidFacetImporterBase.java

示例6: getProjectCreationRootPreviewPath

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
private String getProjectCreationRootPreviewPath() {
    String sketchDirectoryName = PathUtil.getFileName(projectRootDirectoryBrowser.getText());

    if (importIntoDefaultProjectOption.isSelected()) {

        return Paths.get(ProjectUtil.getBaseDir(), sketchDirectoryName).toString();
    } else if (createProjectInSelectedRootOption.isSelected()) {
        return projectRootDirectoryBrowser.getText();
    } else if (importProjectIntoCustomRootOption.isSelected()) {
        return Paths.get(customImportRootDirectoryBrowser.getText(), sketchDirectoryName).toString();
    }

    return "";
}
 
开发者ID:mistodev,项目名称:processing-idea,代码行数:15,代码来源:ProcessingSketchRootSelectStep.java

示例7: findExecutable

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
/**
 * Basic heuristic for choosing between multiple output files. Currently just looks for a filename
 * matching the target name.
 */
@VisibleForTesting
@Nullable
static File findExecutable(Label target, List<File> outputs) {
  if (outputs.size() == 1) {
    return outputs.get(0);
  }
  String name = PathUtil.getFileName(target.targetName().toString());
  for (File file : outputs) {
    if (file.getName().equals(name)) {
      return file;
    }
  }
  return null;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:19,代码来源:BlazePyRunConfigurationRunner.java

示例8: getMockJdkVersion

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
public static String getMockJdkVersion(String path) {
  String name = PathUtil.getFileName(path);
  if (name.startsWith(MOCK_JDK_DIR_NAME_PREFIX)) {
    return "java " + StringUtil.trimStart(name, MOCK_JDK_DIR_NAME_PREFIX);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:IdeaTestUtil.java

示例9: addFileCopy

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
@Override
public void addFileCopy(@NotNull CompositePackagingElement<?> root, @NotNull String outputDirectoryPath, @NotNull String sourceFilePath,
                        @Nullable String outputFileName) {
  final String fileName = PathUtil.getFileName(sourceFilePath);
  if (outputFileName != null && outputFileName.equals(fileName)) {
    outputFileName = null;
  }
  getOrCreateDirectory(root, outputDirectoryPath).addOrFindChild(createFileCopy(sourceFilePath, outputFileName));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PackagingElementFactoryImpl.java

示例10: createDirectoryOrArchiveWithParents

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
public static CompositePackagingElement<?> createDirectoryOrArchiveWithParents(@NotNull String path, final boolean archive) {
  path = FileUtil.toSystemIndependentName(path);
  final String parentPath = PathUtil.getParentPath(path);
  final String fileName = PathUtil.getFileName(path);
  final PackagingElement<?> element = archive ? new ArchivePackagingElement(fileName) : new DirectoryPackagingElement(fileName);
  return (CompositePackagingElement<?>)getInstance().createParentDirectories(parentPath, element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PackagingElementFactoryImpl.java

示例11: findExecutable

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
/**
 * Basic heuristic for choosing between multiple output files. Currently just looks for a filename
 * matching the target name.
 */
@Nullable
private static File findExecutable(Label target, List<File> outputs) {
  if (outputs.size() == 1) {
    return outputs.get(0);
  }
  String name = PathUtil.getFileName(target.targetName().toString());
  for (File file : outputs) {
    if (file.getName().equals(name)) {
      return file;
    }
  }
  return null;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:18,代码来源:BlazeCidrRunConfigurationRunner.java

示例12: DirectoryCopyPresentation

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
public DirectoryCopyPresentation(String filePath) {
  mySourceFileName = PathUtil.getFileName(filePath);

  String parentPath;
  myFile = LocalFileSystem.getInstance().findFileByPath(filePath);
  if (myFile != null) {
    final VirtualFile parent = myFile.getParent();
    parentPath = parent != null ? FileUtil.toSystemDependentName(parent.getPath()) : "";
  }
  else {
    parentPath = FileUtil.toSystemDependentName(PathUtil.getParentPath(filePath));
  }

  mySourcePath = parentPath;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:DirectoryCopyPresentation.java

示例13: generateTasksForArtifact

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
@Override
public void generateTasksForArtifact(Artifact artifact, boolean preprocessing, ArtifactAntGenerationContext context,
                                     CompositeGenerator generator) {
  final ArtifactPropertiesProvider provider;
  if (preprocessing) {
    provider = AntArtifactPreProcessingPropertiesProvider.getInstance();
  }
  else {
    provider = AntArtifactPostprocessingPropertiesProvider.getInstance();
  }
  final AntArtifactProperties properties = (AntArtifactProperties)artifact.getProperties(provider);
  if (properties != null && properties.isEnabled()) {
    final String path = VfsUtil.urlToPath(properties.getFileUrl());
    String fileName = PathUtil.getFileName(path);
    String dirPath = PathUtil.getParentPath(path);
    final String relativePath = GenerationUtils.toRelativePath(dirPath, BuildProperties.getProjectBaseDir(context.getProject()),
                                                               BuildProperties.getProjectBaseDirProperty(), context.getGenerationOptions());
    final Tag ant = new Tag("ant", Pair.create("antfile", fileName), Pair.create("target", properties.getTargetName()),
                                   Pair.create("dir", relativePath));
    final String outputPath = BuildProperties.propertyRef(context.getArtifactOutputProperty(artifact));
    ant.add(new Property(JpsAntArtifactExtensionImpl.ARTIFACT_OUTPUT_PATH_PROPERTY, outputPath));
    for (BuildFileProperty property : properties.getUserProperties()) {
      ant.add(new Property(property.getPropertyName(), property.getPropertyValue()));
    }
    generator.add(ant);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:AntArtifactBuildExtension.java

示例14: getFileName

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
@NotNull
private static String getFileName(@NotNull String urlString) {
  try {
    // In case we need to strip query string
    if (URLUtil.containsScheme(urlString)) {
      URL url = new URL(urlString);
      return PathUtil.getFileName(url.getPath());
    }
  }
  catch (MalformedURLException e) {
    // Ignore it
  }
  return PathUtil.getFileName(urlString);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:DownloadOperation.java

示例15: findFile

import com.intellij.util.PathUtil; //导入方法依赖的package包/类
@Override
public VirtualFile findFile(@NotNull RootType rootType, @NotNull String pathName, @NotNull Option option) throws IOException {
  ApplicationManager.getApplication().assertReadAccessAllowed();

  String fullPath = getRootPath(rootType) + "/" + pathName;
  if (option != Option.create_new_always) {
    VirtualFile file = LocalFileSystem.getInstance().findFileByPath(fullPath);
    if (file != null && !file.isDirectory()) return file;
    if (option == Option.existing_only) return null;
  }
  String ext = PathUtil.getFileExtension(pathName);
  String fileNameExt = PathUtil.getFileName(pathName);
  String fileName = StringUtil.trimEnd(fileNameExt, ext == null ? "" : "." + ext);
  AccessToken token = ApplicationManager.getApplication().acquireWriteActionLock(getClass());
  try {
    VirtualFile dir = VfsUtil.createDirectories(PathUtil.getParentPath(fullPath));
    if (option == Option.create_new_always) {
      return VfsUtil.createChildSequent(LocalFileSystem.getInstance(), dir, fileName, StringUtil.notNullize(ext));
    }
    else {
      return dir.createChildData(LocalFileSystem.getInstance(), fileNameExt);
    }
  }
  finally {
    token.finish();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:ScratchFileServiceImpl.java


注:本文中的com.intellij.util.PathUtil.getFileName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。