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


Java FileUtilRt.getNameWithoutExtension方法代码示例

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


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

示例1: readProjectName

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private static String readProjectName(@NotNull String path) {
  final File file = new File(path);
  if (file.isDirectory()) {
    final File nameFile = new File(new File(path, Project.DIRECTORY_STORE_FOLDER), ProjectImpl.NAME_FILE);
    if (nameFile.exists()) {
      try {
        final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(nameFile), CharsetToolkit.UTF8_CHARSET));
        try {
          String name = in.readLine();
          if (!StringUtil.isEmpty(name)) {
            return name.trim();
          }
        }
        finally {
          in.close();
        }
      }
      catch (IOException ignored) { }
    }
    return file.getName();
  }
  else {
    return FileUtilRt.getNameWithoutExtension(file.getName());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:RecentProjectsManagerBase.java

示例2: fileNameToModuleName

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
public static String fileNameToModuleName(String filename) {
    String nameWithoutExtension = FileUtilRt.getNameWithoutExtension(filename);
    if (nameWithoutExtension.isEmpty()) {
        return "";
    }
    return nameWithoutExtension.substring(0, 1).toUpperCase(Locale.getDefault()) + nameWithoutExtension.substring(1);
}
 
开发者ID:reasonml-editor,项目名称:reasonml-idea-plugin,代码行数:8,代码来源:RmlPsiUtil.java

示例3: progessArg

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private String progessArg(String arg) {
  final String[] subargs = arg.split(File.pathSeparator);
  final StringBuilder builder = new StringBuilder();

  for (int i = 0; i < subargs.length; i++) {
    String subarg = subargs[i];
    String s = FileUtil.toSystemIndependentName(subarg);

    if (s.endsWith(".exe")) {
      s = FileUtilRt.getNameWithoutExtension(s);
    }
    for (Pair<String, Pattern> pair : myPathPatterns) {
      final String id = pair.getFirst();
      final Pattern prefixPattern = pair.getSecond();
      final Matcher matcher = prefixPattern.matcher(s);

      if (matcher.matches()) {
        s = "$" + id + "$" + s.substring(matcher.group(1).length());
      }
    }
    builder.append(s);

    if (i < subargs.length - 1) {
      builder.append(';');
    }
  }
  return builder.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AndroidBuildTestingCommandExecutor.java

示例4: getName

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Override
@Nullable
public String getName() {
  String fileName = myFile.getName();
  final String name = FileUtilRt.getNameWithoutExtension(fileName);
  if (StringUtil.isJavaIdentifier(name)) {
    return name;
  }
  else {
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:GroovyScriptClass.java

示例5: hashName

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private static String hashName(File src) {
  String name = src.getName();
  return FileUtilRt.getNameWithoutExtension(name)
      + "_"
      + Integer.toHexString(src.getParent().hashCode())
      + "."
      + FileUtilRt.getExtension(name);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:9,代码来源:BlazeGoRootsProvider.java

示例6: runSingle

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Test
public void runSingle() throws Throwable {
  final Throwable[] throwables = new Throwable[1];

  final Runnable runnable = () -> {
    try {
      final String filePath = getBeforeFile(myFileSuffix);
      configureByFile(filePath);

      final File testDir = new File(getTestDataPath(), filePath).getParentFile();
      final String afterName = getAfterFile(myFileSuffix);
      final boolean conflictShouldBeFound = !new File(testDir, afterName).exists();
      try {
        perform();
        if (conflictShouldBeFound) {
          fail("Conflict expected.");
        }
      }
      catch (BaseRefactoringProcessor.ConflictsInTestsException exception) {
        if (!conflictShouldBeFound) {
          fail("Conflict not expected");
        } else {
          final File conflicts = new File(testDir, FileUtilRt.getNameWithoutExtension(myFileSuffix) + CONFLICTS_SUFFIX);
          if (!conflicts.exists()) {
            fail("Conflict file " + conflicts.getPath() + " not found");
          }
          final VirtualFile conflictsFile = VfsUtil.findFileByIoFile(conflicts, false);
          assertNotNull(conflictsFile);
          assertEquals(LoadTextUtil.loadText(conflictsFile).toString(), exception.getMessage());
        }
      }

      if (!conflictShouldBeFound) {
        checkResultByFile(getAfterFile(myFileSuffix));
      }
    }
    catch (Throwable e) {
      throwables[0] = e;
    }
  };

  invokeTestRunnable(() -> CommandProcessor.getInstance().executeCommand(getProject(), runnable::run, "", null));

  if (throwables[0] != null) {
    throw throwables[0];
  }

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:LightRefactoringParameterizedTestCase.java

示例7: getAfterFile

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Override
protected String getAfterFile(String fileName) {
  return FileUtilRt.getNameWithoutExtension(fileName) + "_" + AFTER_PREFIX + "." + FileUtilRt.getExtension(fileName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:InvertBooleanTest.java


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