本文整理汇总了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());
}
}
示例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);
}
示例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();
}
示例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;
}
}
示例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);
}
示例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];
}
}
示例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);
}