prefer FileUtilRt

GitOrigin-RevId: f379eef14eb665d3e1065115a67ac25c5a87a0d9
This commit is contained in:
Vladimir Krivosheev
2019-05-30 13:11:46 +03:00
committed by intellij-monorepo-bot
parent ce5abe2c5e
commit c3b02ab658
68 changed files with 224 additions and 473 deletions
@@ -11,7 +11,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.PathUtil;
import com.intellij.util.io.URLUtil;
@@ -82,7 +82,7 @@ public class BuildProcessClasspathManager {
// development mode
if (PluginManagerCore.isRunningFromSources()) {
// ... try "out/classes/production/<jar-name>", assuming that <jar-name> means module name
String moduleName = FileUtil.getNameWithoutExtension(PathUtil.getFileName(relativePath));
String moduleName = FileUtilRt.getNameWithoutExtension(PathUtil.getFileName(relativePath));
if (OLD_TO_NEW_MODULE_NAME.containsKey(moduleName)) {
moduleName = OLD_TO_NEW_MODULE_NAME.get(moduleName);
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution;
import com.intellij.execution.testframework.TestSearchScope;
@@ -22,7 +8,7 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.roots.OrderEnumerator;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
@@ -81,7 +67,7 @@ public class TestClassCollector {
try {
Path relativePath = baseDir.relativize(file.getParent());
String subpackageName = StringUtil.getQualifiedName(relativePath.toString().replace(pathSeparator, "."),
FileUtil.getNameWithoutExtension(fName));
FileUtilRt.getNameWithoutExtension(fName));
String fqName = StringUtil.getQualifiedName(packageName, subpackageName);
Class<?> aClass = Class.forName(fqName, false, classLoader);
//is potential junit 4
@@ -17,6 +17,7 @@ import com.intellij.openapi.roots.OrderEnumerator;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
@@ -123,7 +124,7 @@ public class JavaScratchCompilationSupport implements CompileTask {
}
}
}
return FileUtil.getNameWithoutExtension(scratchFile);
return FileUtilRt.getNameWithoutExtension(scratchFile.getName());
});
srcFile = new File(srcDir, srcFileName + ".java");
FileUtil.copy(scratchFile, srcFile);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.util.importProject;
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot;
@@ -22,6 +8,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.Consumer;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Interner;
@@ -234,7 +221,8 @@ public abstract class ModuleInsight {
final Set<String> libNames = new HashSet<>(myExistingProjectLibraryNames);
for (LibraryDescriptor library : libraries) {
final Collection<File> libJars = library.getJars();
final String newName = suggestUniqueName(libNames, libJars.size() == 1? FileUtil.getNameWithoutExtension(libJars.iterator().next()) : library.getName());
final String newName = suggestUniqueName(libNames, libJars.size() == 1 ? FileUtilRt
.getNameWithoutExtension(libJars.iterator().next().getName()) : library.getName());
library.setName(newName);
libNames.add(newName);
}
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.roots.ui.configuration.artifacts;
import com.intellij.codeInsight.hint.HintManager;
@@ -473,7 +473,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
if (root instanceof ArchivePackagingElement) {
String oldFileName = ArtifactUtil.suggestArtifactFileName(oldArtifactName);
final String name = ((ArchivePackagingElement)root).getArchiveFileName();
final String fileName = FileUtil.getNameWithoutExtension(name);
final String fileName = FileUtilRt.getNameWithoutExtension(name);
final String extension = FileUtilRt.getExtension(name);
if (fileName.equals(oldFileName) && extension.length() > 0) {
myLayoutTreeComponent.editLayout(
@@ -106,7 +106,7 @@ public abstract class ChangeLibraryLevelActionBase extends AnAction {
final File targetDir = new File(FileUtil.toSystemDependentName(targetDirPath));
for (final File from : filesToProcess) {
indicator.checkCanceled();
final File to = FileUtil.findSequentNonexistentFile(targetDir, FileUtil.getNameWithoutExtension(from),
final File to = FileUtil.findSequentNonexistentFile(targetDir, FileUtilRt.getNameWithoutExtension(from.getName()),
FileUtilRt.getExtension(from.getName()));
try {
if (from.isDirectory()) {
@@ -1,5 +1,5 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.migration;
import com.intellij.application.options.CodeStyle;
@@ -9,6 +9,7 @@ import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.io.FileFilters;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.text.UniqueNameGenerator;
import org.jdom.Document;
@@ -95,12 +96,12 @@ public class MigrationMapSet {
private static boolean isPredefined(String name) {
for (PredefinedMigrationProvider provider : PredefinedMigrationProvider.EP_NAME.getExtensionList()) {
URL migrationMap = provider.getMigrationMap();
String fileName = FileUtil.getNameWithoutExtension(new File(migrationMap.getFile()));
String fileName = FileUtilRt.getNameWithoutExtension(new File(migrationMap.getFile()).getName());
if (fileName.equals(name)) return true;
}
for (String defaultTemplate : DEFAULT_MAPS) {
String fileName = FileUtil.getNameWithoutExtension(StringUtil.getShortName(defaultTemplate, '/'));
String fileName = FileUtilRt.getNameWithoutExtension(StringUtil.getShortName(defaultTemplate, '/'));
if (fileName.equals(name)) return true;
}
@@ -143,7 +144,7 @@ public class MigrationMapSet {
for (PredefinedMigrationProvider provider : PredefinedMigrationProvider.EP_NAME.getExtensionList()) {
URL migrationMap = provider.getMigrationMap();
String fileName = new File(migrationMap.getFile()).getName();
if (myDeletedMaps.contains(FileUtil.getNameWithoutExtension(fileName))) continue;
if (myDeletedMaps.contains(FileUtilRt.getNameWithoutExtension(fileName))) continue;
copyMap(dir, migrationMap, fileName);
}
@@ -151,7 +152,7 @@ public class MigrationMapSet {
URL url = MigrationMapSet.class.getResource(defaultTemplate);
LOG.assertTrue(url != null);
String fileName = defaultTemplate.substring(defaultTemplate.lastIndexOf("/") + 1);
if (myDeletedMaps.contains(FileUtil.getNameWithoutExtension(fileName))) continue;
if (myDeletedMaps.contains(FileUtilRt.getNameWithoutExtension(fileName))) continue;
copyMap(dir, url, fileName);
}
}
@@ -192,7 +193,7 @@ public class MigrationMapSet {
try {
MigrationMap map = readMap(file);
if (map != null) {
map.setFileName(FileUtil.getNameWithoutExtension(file));
map.setFileName(FileUtilRt.getNameWithoutExtension(file.getName()));
myMaps.add(map);
}
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.testIntegration;
import com.intellij.codeInsight.CodeInsightActionHandler;
@@ -33,7 +19,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.util.CommonRefactoringUtil;
@@ -74,7 +60,7 @@ public class BaseGenerateTestSupportMethodAction extends BaseGenerateAction {
final FileTemplateDescriptor descriptor = methodKind.getFileTemplateDescriptor(framework);
if (descriptor != null) {
final String fileName = descriptor.getFileName();
AllFileTemplatesConfigurable.editCodeTemplate(FileUtil.getNameWithoutExtension(fileName), project);
AllFileTemplatesConfigurable.editCodeTemplate(FileUtilRt.getNameWithoutExtension(fileName), project);
} else {
HintManager.getInstance().showErrorHint(editor, "No template found for " + framework.getName() + ":" + BaseGenerateTestSupportMethodAction.this.getTemplatePresentation().getText());
}
@@ -7,6 +7,7 @@ import com.intellij.compiler.instrumentation.FailSafeClassReader;
import com.intellij.compiler.instrumentation.InstrumenterClassWriter;
import com.intellij.compiler.notNullVerification.NotNullVerifyingInstrumenter;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.io.IoTestUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.testFramework.IdeaTestUtil;
@@ -429,7 +430,7 @@ public abstract class NotNullVerifyingInstrumenterTest {
int flags = InstrumenterClassWriter.getAsmClassWriterFlags(InstrumenterClassWriter.getClassFileVersion(reader));
ClassWriter writer = new ClassWriter(reader, flags);
modified |= NotNullVerifyingInstrumenter.processClassFile(reader, writer, notNullAnnotations);
String className = FileUtil.getNameWithoutExtension(file.getName());
String className = FileUtilRt.getNameWithoutExtension(file.getName());
Class aClass = classLoader.doDefineClass(className, writer.toByteArray());
if (className.equals(testName)) {
mainClass = aClass;
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.jps.model.serialization;
import com.intellij.openapi.diagnostic.Logger;
@@ -251,7 +251,7 @@ public class JpsProjectLoader extends JpsLoaderBase {
private void loadFromIpr(@NotNull Path iprFile) {
final Element iprRoot = loadRootElement(iprFile);
String projectName = FileUtil.getNameWithoutExtension(iprFile.getFileName().toString());
String projectName = FileUtilRt.getNameWithoutExtension(iprFile.getFileName().toString());
myProject.setName(projectName);
Path iwsFile = iprFile.getParent().resolve(projectName + ".iws");
Element iwsRoot = loadRootElement(iwsFile);
@@ -463,7 +463,7 @@ public class JpsProjectLoader extends JpsLoaderBase {
@NotNull
private static String getModuleName(@NotNull Path file) {
return FileUtil.getNameWithoutExtension(file.getFileName().toString());
return FileUtilRt.getNameWithoutExtension(file.getFileName().toString());
}
static JpsMacroExpander createModuleMacroExpander(final Map<String, String> pathVariables, @NotNull Path moduleFile) {
@@ -1,21 +1,7 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.jps.model.serialization;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import org.jdom.Element;
import org.jetbrains.jps.model.artifact.JpsArtifact;
import org.jetbrains.jps.model.artifact.JpsArtifactService;
@@ -48,7 +34,8 @@ public class JpsArtifactSerializationTest extends JpsSerializationTestCase {
List<Path> artifactFiles = Files.list(getTestDataAbsoluteFile(SAMPLE_PROJECT_PATH + "/.idea/artifacts")).collect(Collectors.toList());
assertNotNull(artifactFiles);
for (Path file : artifactFiles) {
JpsArtifact artifact = getService().createReference(FileUtil.getNameWithoutExtension(file.getFileName().toString())).asExternal(myModel).resolve();
JpsArtifact artifact = getService().createReference(
FileUtilRt.getNameWithoutExtension(file.getFileName().toString())).asExternal(myModel).resolve();
assertNotNull(artifact);
doTestSaveArtifact(artifact, file);
}
@@ -1,22 +1,9 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.jps.model.serialization;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsDummyElement;
@@ -236,7 +223,7 @@ public class JpsProjectSerializationTest extends JpsSerializationTestCase {
List<Path> libs = Files.list(getFileInSampleProject(".idea/libraries")).collect(Collectors.toList());
assertNotNull(libs);
for (Path libFile : libs) {
String libName = FileUtil.getNameWithoutExtension(libFile.getFileName().toString());
String libName = FileUtilRt.getNameWithoutExtension(libFile.getFileName().toString());
JpsLibrary library = myProject.getLibraryCollection().findLibrary(libName);
assertNotNull(libName, library);
doTestSaveLibrary(libFile, libName, library);
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.analysis;
@@ -19,7 +17,7 @@ import com.intellij.openapi.project.ProjectCoreUtil;
import com.intellij.openapi.project.ProjectUtilCore;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.libraries.LibraryUtil;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.psi.*;
@@ -529,7 +527,7 @@ public class AnalysisScope {
@NotNull
private static String pathToName(@NotNull String path) {
File file = new File(path);
return FileUtil.getNameWithoutExtension(file);
return FileUtilRt.getNameWithoutExtension(file.getName());
}
public int getFileCount() {
@@ -36,7 +36,7 @@ import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.packaging.artifacts.ArtifactModel;
import com.intellij.packaging.artifacts.ModifiableArtifactModel;
@@ -123,7 +123,7 @@ public abstract class AbstractIdeModifiableModelsProvider extends IdeModelsProvi
@Override
public Module newModule(@NotNull final String filePath, final String moduleTypeId) {
Module module = getModifiableModuleModel().newModule(filePath, moduleTypeId);
final String moduleName = FileUtil.getNameWithoutExtension(new File(filePath));
final String moduleName = FileUtilRt.getNameWithoutExtension(new File(filePath).getName());
if (!module.getName().equals(moduleName)) {
try {
getModifiableModuleModel().renameModule(module, moduleName);
@@ -33,6 +33,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
@@ -290,7 +291,7 @@ public abstract class AbstractModuleDataService<E extends ModuleData> extends Ab
for (Path modulePath : orphanModules) {
try {
String path = FileUtil.loadFile(modulePath.resolveSibling(modulePath.getFileName() + ".path").toFile());
modulesToRestoreText.append(FileUtil.getNameWithoutExtension(new File(path))).append("\n");
modulesToRestoreText.append(FileUtilRt.getNameWithoutExtension(new File(path).getName())).append("\n");
modulesToRestore.add(Pair.create(path, modulePath));
}
catch (IOException e) {
@@ -338,7 +339,7 @@ public abstract class AbstractModuleDataService<E extends ModuleData> extends Ab
@Override
protected JComponent createCenterPanel() {
orphanModulesList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
orphanModulesList.setItems(orphanModules, module -> FileUtil.getNameWithoutExtension(new File(module.getFirst())));
orphanModulesList.setItems(orphanModules, module -> FileUtilRt.getNameWithoutExtension(new File(module.getFirst()).getName()));
orphanModulesList.setBorder(JBUI.Borders.empty(5));
JScrollPane myModulesScrollPane =
@@ -1,8 +1,9 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection.ex;
import com.intellij.codeInspection.InspectionApplication;
import com.intellij.codeInspection.InspectionsReportConverter;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.io.URLUtil;
import org.jdom.Document;
@@ -87,7 +88,7 @@ public class PlainTextFormatter implements InspectionsReportConverter {
warn("Folder isn't expected here: " + inspectionData.getName());
continue;
}
final String fileNameWithoutExt = FileUtil.getNameWithoutExtension(inspectionData);
final String fileNameWithoutExt = FileUtilRt.getNameWithoutExtension(inspectionData.getName());
if (InspectionApplication.DESCRIPTIONS.equals(fileNameWithoutExt)) {
continue;
}
@@ -1,23 +1,9 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection.ex;
import com.intellij.codeInspection.InspectionApplication;
import com.intellij.codeInspection.InspectionsReportConverter;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -94,7 +80,7 @@ public class XSLTReportConverter implements InspectionsReportConverter {
warn("Folder isn't expected here: " + inspectionData.getName());
continue;
}
final String fileNameWithoutExt = FileUtil.getNameWithoutExtension(inspectionData);
final String fileNameWithoutExt = FileUtilRt.getNameWithoutExtension(inspectionData.getName());
if (InspectionApplication.DESCRIPTIONS.equals(fileNameWithoutExt)) {
continue;
}
@@ -1,27 +1,12 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.framework.library.impl;
import com.intellij.facet.frameworks.beans.Artifact;
import com.intellij.facet.frameworks.beans.ArtifactItem;
import com.intellij.framework.FrameworkAvailabilityCondition;
import com.intellij.framework.library.DownloadableLibraryDescription;
import com.intellij.framework.library.DownloadableLibraryFileDescription;
import com.intellij.framework.FrameworkAvailabilityCondition;
import com.intellij.framework.library.FrameworkLibraryVersion;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.download.impl.FileSetVersionsFetcherBase;
import org.jetbrains.annotations.NotNull;
@@ -59,6 +44,6 @@ public class LibraryVersionsFetcher extends FileSetVersionsFetcherBase<Framework
docUrl = prependPrefix(docUrl, prefix);
}
final String name = item.getName();
return new DownloadableLibraryFileDescriptionImpl(url, FileUtil.getNameWithoutExtension(name), FileUtilRt.getExtension(name), sourceUrl, docUrl, item.isOptional());
return new DownloadableLibraryFileDescriptionImpl(url, FileUtilRt.getNameWithoutExtension(name), FileUtilRt.getExtension(name), sourceUrl, docUrl, item.isOptional());
}
}
@@ -1,25 +1,11 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.fileEditor.impl;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.fileEditor.UniqueVFilePathBuilder;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
@@ -47,7 +33,7 @@ public class UniqueNameEditorTabTitleProvider implements EditorTabTitleProvider
public static String getEditorTabText(String result, String separator, boolean hideKnownExtensionInTabs) {
if (hideKnownExtensionInTabs) {
String withoutExtension = FileUtil.getNameWithoutExtension(result);
String withoutExtension = FileUtilRt.getNameWithoutExtension(result);
if (StringUtil.isNotEmpty(withoutExtension) && !withoutExtension.endsWith(separator)) {
return withoutExtension;
}
@@ -1,28 +1,18 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.roots.impl.libraries;
import com.intellij.openapi.fileChooser.*;
import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.libraries.*;
import com.intellij.openapi.roots.libraries.LibraryProperties;
import com.intellij.openapi.roots.libraries.LibraryType;
import com.intellij.openapi.roots.libraries.LibraryTypeService;
import com.intellij.openapi.roots.libraries.NewLibraryConfiguration;
import com.intellij.openapi.roots.libraries.ui.LibraryRootsComponentDescriptor;
import com.intellij.openapi.roots.libraries.ui.OrderRoot;
import com.intellij.openapi.roots.libraries.ui.impl.RootDetectionUtil;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.PathUtil;
import org.jetbrains.annotations.NotNull;
@@ -70,7 +60,7 @@ public class LibraryTypeServiceImpl extends LibraryTypeService {
@NotNull
public static String suggestLibraryName(@NotNull VirtualFile[] classesRoots) {
if (classesRoots.length >= 1) {
return FileUtil.getNameWithoutExtension(PathUtil.getFileName(classesRoots[0].getPath()));
return FileUtilRt.getNameWithoutExtension(PathUtil.getFileName(classesRoots[0].getPath()));
}
return DEFAULT_LIBRARY_NAME;
}
@@ -78,7 +68,7 @@ public class LibraryTypeServiceImpl extends LibraryTypeService {
@NotNull
public static String suggestLibraryName(@NotNull List<? extends OrderRoot> roots) {
if (roots.size() >= 1) {
return FileUtil.getNameWithoutExtension(PathUtil.getFileName(roots.get(0).getFile().getPath()));
return FileUtilRt.getNameWithoutExtension(PathUtil.getFileName(roots.get(0).getFile().getPath()));
}
return DEFAULT_LIBRARY_NAME;
}
@@ -30,7 +30,7 @@ import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.io.StreamUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
@@ -105,7 +105,7 @@ public class SaveProjectAsTemplateAction extends AnAction implements DumbAware {
AnAction manageAction = ActionManager.getInstance().getAction("ManageProjectTemplates");
Notification notification = new Notification("Project Template",
"Template Created",
FileUtil.getNameWithoutExtension(file.getFileName().toString()) +
FileUtilRt.getNameWithoutExtension(file.getFileName().toString()) +
" was successfully created",
NotificationType.INFORMATION
);
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.platform.templates;
import com.intellij.ide.util.projectWizard.ProjectTemplateParameterFactory;
@@ -10,7 +10,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.ValidationInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
@@ -109,7 +109,7 @@ public class SaveProjectAsTemplateDialog extends DialogWrapper {
Path file = getTemplateFile();
if (PathKt.exists(file)) {
if (Messages.showYesNoDialog(myPanel,
FileUtil.getNameWithoutExtension(file.getFileName().toString()) + " exists already.\n" +
FileUtilRt.getNameWithoutExtension(file.getFileName().toString()) + " exists already.\n" +
"Do you want to replace it with the new one?", "Template Already Exists",
Messages.getWarningIcon()) == Messages.NO) {
return;
@@ -1,24 +1,9 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.util.download.impl;
import com.intellij.facet.frameworks.beans.Artifact;
import com.intellij.facet.frameworks.beans.ArtifactItem;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.download.*;
import org.jetbrains.annotations.NotNull;
@@ -35,7 +20,7 @@ public class DownloadableFileServiceImpl extends DownloadableFileService {
@NotNull
@Override
public DownloadableFileDescription createFileDescription(@NotNull String downloadUrl, @NotNull String fileName) {
return new DownloadableFileDescriptionImpl(downloadUrl, FileUtil.getNameWithoutExtension(fileName), FileUtilRt.getExtension(fileName));
return new DownloadableFileDescriptionImpl(downloadUrl, FileUtilRt.getNameWithoutExtension(fileName), FileUtilRt.getExtension(fileName));
}
@NotNull
@@ -12,6 +12,7 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.updateSettings.impl.UpdateSettings;
import com.intellij.openapi.util.BuildNumber;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.Url;
import com.intellij.util.Urls;
import com.intellij.util.containers.ContainerUtil;
@@ -241,7 +242,7 @@ public class RepositoryHelper {
}
if (node.getName() == null) {
String url = node.getDownloadUrl();
node.setName(FileUtil.getNameWithoutExtension(url.substring(url.lastIndexOf('/') + 1)));
node.setName(FileUtilRt.getNameWithoutExtension(url.substring(url.lastIndexOf('/') + 1)));
}
IdeaPluginDescriptor previous = result.get(pluginId);
@@ -19,7 +19,6 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
/**
* To customize your IDE splash go to YourIdeNameApplicationInfo.xml and edit 'logo' tag. For more information see documentation for
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.testframework.sm.runner.history.actions;
import com.intellij.execution.TestStateStorage;
@@ -20,7 +6,7 @@ import com.intellij.execution.testframework.sm.TestHistoryConfiguration;
import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties;
import com.intellij.execution.testframework.sm.runner.ui.SMTestRunnerResultsForm;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
@@ -35,7 +21,7 @@ import java.util.Date;
public class ImportTestsFromHistoryAction extends AbstractImportTestsAction {
private final String myFileName;
public ImportTestsFromHistoryAction(@Nullable SMTRunnerConsoleProperties properties, Project project, String name) {
super(properties, StringUtil.escapeMnemonics(getPresentableText(project, name)), getPresentableText(project, name), getIcon(project, name));
myFileName = name;
@@ -47,14 +33,14 @@ public class ImportTestsFromHistoryAction extends AbstractImportTestsAction {
@NotNull
private static String getPresentableText(Project project, String name) {
String nameWithoutExtension = FileUtil.getNameWithoutExtension(name);
String nameWithoutExtension = FileUtilRt.getNameWithoutExtension(name);
final int lastIndexOf = nameWithoutExtension.lastIndexOf(" - ");
if (lastIndexOf > 0) {
final String date = nameWithoutExtension.substring(lastIndexOf + 3);
try {
final Date creationDate = new SimpleDateFormat(SMTestRunnerResultsForm.HISTORY_DATE_FORMAT).parse(date);
final String configurationName = TestHistoryConfiguration.getInstance(project).getConfigurationName(name);
return (configurationName != null ? configurationName : nameWithoutExtension.substring(0, lastIndexOf)) +
return (configurationName != null ? configurationName : nameWithoutExtension.substring(0, lastIndexOf)) +
" (" + DateFormatUtil.formatDateTime(creationDate) + ")";
}
catch (ParseException ignore) {}
@@ -30,7 +30,6 @@ import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
@@ -87,7 +86,7 @@ public class CodeInsightTestUtil {
@TestOnly
public static void doIntentionTest(CodeInsightTestFixture fixture, @NonNls String file, @NonNls String actionText) {
String extension = FileUtilRt.getExtension(file);
file = FileUtil.getNameWithoutExtension(file);
file = FileUtilRt.getNameWithoutExtension(file);
if (extension.isEmpty()) extension = "xml";
doIntentionTest(fixture, actionText, file + "." + extension, file + "_after." + extension);
}
@@ -118,7 +117,7 @@ public class CodeInsightTestUtil {
}
});
}
public static void doWordSelectionTestOnDirectory(@NotNull final CodeInsightTestFixture fixture,
@TestDataFile @NotNull final String directoryName,
@NotNull final String filesExtension) {
@@ -221,7 +220,7 @@ public class CodeInsightTestUtil {
public static void doActionTest(AnAction action, String file, CodeInsightTestFixture fixture) {
String extension = FileUtilRt.getExtension(file);
String name = FileUtil.getNameWithoutExtension(file);
String name = FileUtilRt.getNameWithoutExtension(file);
fixture.configureByFile(file);
fixture.testAction(action);
fixture.checkResultByFile(name + "_after." + extension);
@@ -551,7 +551,7 @@ public class FileUtil extends FileUtilRt {
@NotNull
public static String getNameWithoutExtension(@NotNull File file) {
return getNameWithoutExtension(file.getName());
return FileUtilRt.getNameWithoutExtension(file.getName());
}
@NotNull
@@ -6,7 +6,6 @@ import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfoRt;
import com.intellij.openapi.util.io.BufferExposingByteArrayInputStream;
import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
@@ -300,7 +299,7 @@ public class ImageLoader implements Serializable {
// retina images provides a better result than up-scaling non-retina images.
boolean retina = JBUI.isHiDPI(ctx.getScale(PIX_SCALE));
Builder list = new Builder(FileUtil.getNameWithoutExtension(path),
Builder list = new Builder(FileUtilRt.getNameWithoutExtension(path),
FileUtilRt.getExtension(path),
cls,
true,
@@ -13,6 +13,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.ThrowableComputable;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vcs.changes.patch.RelativePathCalculator;
@@ -593,7 +594,7 @@ public class PathsVerifier {
File destFile = new File(newParentFile, tmpFileWithUniqueName.getName());
while (destFile.exists()) {
destFile = new File(newParentFile,
FileUtil.createTempFile(oldParent, FileUtil.getNameWithoutExtension(destFile.getName()), null, false)
FileUtil.createTempFile(oldParent, FileUtilRt.getNameWithoutExtension(destFile.getName()), null, false)
.getName());
}
myCurrent.rename(PatchApplier.class, destFile.getName());
@@ -595,7 +595,7 @@ public class ShelveChangesManager implements PersistentStateComponent<Element>,
String shelvedPath = null;
if (afterFile != null) {
String shelvedFileName = afterFile.getName();
String name = FileUtil.getNameWithoutExtension(shelvedFileName);
String name = FileUtilRt.getNameWithoutExtension(shelvedFileName);
String extension = FileUtilRt.getExtension(shelvedFileName);
File shelvedFile = FileUtil.findSequentNonexistentFile(schemePatchDir, name, extension);
FileUtil.copy(afterRevision.getFile().getIOFile(), shelvedFile);
@@ -1,11 +1,11 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.siyeh.ipp.modifiers;
import com.intellij.codeInsight.intention.LowPriorityAction;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.impl.source.resolve.JavaResolveUtil;
@@ -109,7 +109,7 @@ abstract class ModifierIntention extends Intention implements LowPriorityAction
return MultiMap.emptyInstance();
}
final PsiJavaFile javaFile = (PsiJavaFile)parent;
final String name = FileUtil.getNameWithoutExtension(javaFile.getName());
final String name = FileUtilRt.getNameWithoutExtension(javaFile.getName());
final String className = aClass.getName();
if (name.equals(className)) {
return MultiMap.emptyInstance();
@@ -136,7 +136,7 @@ public class JavaCoverageEngine extends CoverageEngine {
final int line = in.readInt();
if (Comparing.strEqual(className, classFQName)) {
if (lineNumber == line) {
tests.add(FileUtil.getNameWithoutExtension(traceFile));
tests.add(FileUtilRt.getNameWithoutExtension(traceFile.getName()));
return;
}
}
@@ -162,7 +162,7 @@ public class JavaCoverageEngine extends CoverageEngine {
private static File getTracesDirectory(CoverageSuite coverageSuite) {
final String filePath = coverageSuite.getCoverageDataFileName();
final String dirName = FileUtil.getNameWithoutExtension(new File(filePath).getName());
final String dirName = FileUtilRt.getNameWithoutExtension(new File(filePath).getName());
final File parentDir = new File(filePath).getParentFile();
return new File(parentDir, dirName);
@@ -372,7 +372,7 @@ public class JavaCoverageEngine extends CoverageEngine {
@NotNull
public String getQualifiedName(@NotNull final File outputFile, @NotNull final PsiFile sourceFile) {
final String packageFQName = getPackageName(sourceFile);
return StringUtil.getQualifiedName(packageFQName, FileUtil.getNameWithoutExtension(outputFile));
return StringUtil.getQualifiedName(packageFQName, FileUtilRt.getNameWithoutExtension(outputFile.getName()));
}
@NotNull
@@ -436,7 +436,7 @@ public class JavaCoverageEngine extends CoverageEngine {
final String className = ReadAction.compute(() -> psiClass.getName());
for (File child : children) {
if (FileUtilRt.extensionEquals(child.getName(), StdFileTypes.CLASS.getDefaultExtension())) {
final String childName = FileUtil.getNameWithoutExtension(child);
final String childName = FileUtilRt.getNameWithoutExtension(child.getName());
if (childName.equals(className) || //class or inner
childName.startsWith(className) && childName.charAt(className.length()) == '$') {
classFiles.add(child);
@@ -23,6 +23,7 @@ import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.psi.xml.XmlFile;
@@ -179,7 +180,7 @@ public class PrepareToDeployAction extends AnAction {
String classpath = tag.getAttributeValue("classpath");
if (classpath != null) {
for (String path : StringUtil.split(classpath, ";")) {
String moduleName = FileUtil.getNameWithoutExtension(PathUtil.getFileName(path));
String moduleName = FileUtilRt.getNameWithoutExtension(PathUtil.getFileName(path));
Module jpsModule = ModuleManager.getInstance(module.getProject()).findModuleByName(moduleName);
if (jpsModule != null) {
jpsPluginToOutputPath.put(jpsModule, path);
@@ -1,8 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.devkit.icons;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.vfs.VirtualFile;
import org.intellij.images.thumbnail.ThumbnailView;
import org.intellij.images.thumbnail.actions.ThemeFilter;
@@ -11,7 +11,7 @@ public enum Theme implements ThemeFilter{
WHITE(null, "Default") {
@Override
public boolean accepts(VirtualFile fileName) {
String nameWithoutExtension = FileUtil.getNameWithoutExtension(fileName.getName());
String nameWithoutExtension = FileUtilRt.getNameWithoutExtension(fileName.getName());
for (Theme theme : values()) {
String extension = theme.getExtension();
if (extension != null && nameWithoutExtension.endsWith(extension)) {
@@ -25,13 +25,13 @@ public enum Theme implements ThemeFilter{
HIGH_DPI_WHITE("@2x", "Default HiDPI") {
@Override
public boolean accepts(VirtualFile fileName) {
return FileUtil.getNameWithoutExtension(fileName.getName()).endsWith(getExtension());
return FileUtilRt.getNameWithoutExtension(fileName.getName()).endsWith(getExtension());
}
},
DARK("_dark", "Darcula") {
@Override
public boolean accepts(VirtualFile file) {
String name = FileUtil.getNameWithoutExtension(file.getName());
String name = FileUtilRt.getNameWithoutExtension(file.getName());
if (name.endsWith(getExtension()) && !name.endsWith(HIGH_DPI_DARK.getExtension())) {
return true;
}
@@ -45,7 +45,7 @@ public enum Theme implements ThemeFilter{
HIGH_DPI_DARK("@2x_dark", "Darcula HiDPI") {
@Override
public boolean accepts(VirtualFile file) {
String name = FileUtil.getNameWithoutExtension(file.getName());
String name = FileUtilRt.getNameWithoutExtension(file.getName());
if (name.endsWith(getExtension())) {
return true;
}
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.devkit.navigation;
import com.intellij.codeInspection.InspectionProfileEntry;
@@ -11,7 +11,7 @@ import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiClass;
@@ -68,7 +68,7 @@ public class DescriptionInspectionGotoRelatedProvider extends GotoRelatedProvide
// Try to find class by description name first. It may improve performance significantly.
PsiShortNamesCache psiShortNamesCache = PsiShortNamesCache.getInstance(project);
String possibleImplementationName = FileUtil.getNameWithoutExtension(descriptionFile.getName()) + "Inspection";
String possibleImplementationName = FileUtilRt.getNameWithoutExtension(descriptionFile.getName()) + "Inspection";
Set<PsiClass> checkedPossibleImplementation = new HashSet<>();
for (GlobalSearchScope scope : DescriptionCheckerUtil.searchScopes(module)) {
PsiClass[] possibleImplementations = psiShortNamesCache.getClassesByName(possibleImplementationName, scope);
@@ -1,13 +1,11 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.devkit.refactoring;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.ElementManipulators;
@@ -128,7 +126,7 @@ public class InspectionAutomaticRenamerFactory implements AutomaticRenamerFactor
String descriptionFileName = descriptionFile.getName();
String defaultShortName = getDescriptionFileName(inspectionClassName);
if (!newName.endsWith(INSPECTION_CLASS_SUFFIX) || !defaultShortName.equals(FileUtil.getNameWithoutExtension(descriptionFileName))) {
if (!newName.endsWith(INSPECTION_CLASS_SUFFIX) || !defaultShortName.equals(FileUtilRt.getNameWithoutExtension(descriptionFileName))) {
return;
}
@@ -15,6 +15,7 @@ import com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunCo
import com.intellij.openapi.externalSystem.util.OutputWrapper;
import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.io.StreamUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.*;
@@ -709,7 +710,7 @@ public class GradleExecutionHelper {
final Set<String> jarPaths = ContainerUtil.map2SetNotNull(toolingExtensionClasses, aClass -> {
String path = PathManager.getJarPathForClass(aClass);
if (path != null) {
if (FileUtil.getNameWithoutExtension(path).equals("gradle-api-" + GradleVersion.current().getBaseVersion())) {
if (FileUtilRt.getNameWithoutExtension(path).equals("gradle-api-" + GradleVersion.current().getBaseVersion())) {
LOG.warn("The gradle api jar shouldn't be added to the gradle daemon classpath: {" + aClass + "," + path + "}");
return null;
}
@@ -1116,7 +1116,7 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver
level = LibraryLevel.PROJECT;
libraryName = String.format("%s:%s:%s", moduleVersion.getGroup(), moduleVersion.getName(), moduleVersion.getVersion());
if (binaryPath.isFile()) {
String libraryFileName = FileUtil.getNameWithoutExtension(binaryPath);
String libraryFileName = FileUtilRt.getNameWithoutExtension(binaryPath.getName());
final String mavenLibraryFileName = String.format("%s-%s", moduleVersion.getName(), moduleVersion.getVersion());
if (!mavenLibraryFileName.equals(libraryFileName)) {
Pattern pattern = Pattern.compile(moduleVersion.getName() + "-" + moduleVersion.getVersion() + "-(.*)");
@@ -1179,7 +1179,7 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver
private String chooseName(File path,
LibraryLevel level,
DataNode<ProjectData> ideProject) {
final String fileName = FileUtil.getNameWithoutExtension(path);
final String fileName = FileUtilRt.getNameWithoutExtension(path.getName());
if (level == LibraryLevel.MODULE) {
return fileName;
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.refactoring.convertToJava;
import com.intellij.codeInsight.daemon.impl.quickfix.MoveClassToSeparateFileFix;
@@ -21,7 +7,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
@@ -141,7 +127,7 @@ public class ConvertToJavaProcessor extends BaseRefactoringProcessor {
for (PsiFile psiFile : files) {
fileNames.add(psiFile.getName());
}
String prefix = FileUtil.getNameWithoutExtension(file.getName());
String prefix = FileUtilRt.getNameWithoutExtension(file.getName());
String fileName = prefix + ".java";
int index = 1;
while (fileNames.contains(fileName)) {
@@ -1,7 +1,7 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.refactoring.rename;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
@@ -27,7 +27,7 @@ public class RenameGroovyScriptProcessor extends RenamePsiFileProcessor {
if (element instanceof GroovyFile) {
final PsiClass script = ((GroovyFile)element).getScriptClass();
if (script != null && script.isValid()) {
final String scriptName = FileUtil.getNameWithoutExtension(newName);
final String scriptName = FileUtilRt.getNameWithoutExtension(newName);
if (StringUtil.isJavaIdentifier(scriptName)) {
allRenames.put(script, scriptName);
}
@@ -37,7 +37,7 @@ public class RenameGroovyScriptProcessor extends RenamePsiFileProcessor {
@Override
public void findExistingNameConflicts(@NotNull PsiElement element, @NotNull String newName, @NotNull MultiMap<PsiElement, String> conflicts) {
final String scriptName = FileUtil.getNameWithoutExtension(newName);
final String scriptName = FileUtilRt.getNameWithoutExtension(newName);
if (!StringUtil.isJavaIdentifier(scriptName)) {
final PsiClass script = ((GroovyFile)element).getScriptClass();
conflicts.putValue(script, GroovyRefactoringBundle.message("cannot.rename.script.class.to.0", script.getName(), scriptName));
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.javaFX.packaging;
import com.intellij.execution.CommandLineUtil;
@@ -10,6 +10,7 @@ import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.PathUtilRt;
@@ -88,7 +89,7 @@ public abstract class AbstractJavaFxPackager {
tempUnzippedArtifactOutput = FileUtil.createTempDirectory("artifact", "unzipped");
final File artifactOutputFile = new File(zipPath);
ZipUtil.extract(artifactOutputFile, tempUnzippedArtifactOutput, null);
copyLibraries(FileUtil.getNameWithoutExtension(artifactOutputFile), tempUnzippedArtifactOutput);
copyLibraries(FileUtilRt.getNameWithoutExtension(artifactOutputFile.getName()), tempUnzippedArtifactOutput);
}
catch (IOException e) {
registerJavaFxPackagerError(e);
@@ -1,23 +1,10 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.javaFX.packaging;
import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
@@ -33,13 +20,13 @@ public class JavaFxAntGenerator {
String tempDirPath,
String tempDirDeployPath,
String relativeToBaseDirPath) {
final String artifactFileNameWithoutExtension = FileUtil.getNameWithoutExtension(artifactFileName);
final String artifactFileNameWithoutExtension = FileUtilRt.getNameWithoutExtension(artifactFileName);
final List<SimpleTag> topLevelTagsCollector = new ArrayList<>();
final String preloaderJar = packager.getPreloaderJar();
final String preloaderClass = packager.getPreloaderClass();
String preloaderFiles = null;
String allButPreloader = null;
if (!StringUtil.isEmptyOrSpaces(preloaderJar) && !StringUtil.isEmptyOrSpaces(preloaderClass)) {
preloaderFiles = artifactFileNameWithoutExtension + "_preloader_files";
topLevelTagsCollector.add(new SimpleTag("fx:fileset",
@@ -338,7 +325,7 @@ public class JavaFxAntGenerator {
public void addAttribute(Pair attr) {
myPairs.add(attr);
}
public void add(SimpleTag tag) {
mySubTags.add(tag);
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.javaFX.packaging.ant;
import com.intellij.compiler.ant.*;
@@ -23,7 +9,7 @@ import com.intellij.openapi.projectRoots.JavaSdkType;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactManager;
import com.intellij.packaging.artifacts.ArtifactType;
@@ -91,7 +77,7 @@ public class JavaFxChunkBuildExtension extends ChunkBuildExtension {
protected List<? extends Generator> computeChildrenGenerators(PackagingElementResolvingContext resolvingContext,
final AntCopyInstructionCreator copyInstructionCreator,
final ArtifactAntGenerationContext generationContext,
final ArtifactAntGenerationContext generationContext,
ArtifactType artifactType,
List<PackagingElement<?>> children) {
final List<Generator> generators = new ArrayList<>();
@@ -100,7 +86,7 @@ public class JavaFxChunkBuildExtension extends ChunkBuildExtension {
}
return generators;
}
@Override
public void generateTasksForArtifact(Artifact artifact,
boolean preprocessing,
@@ -122,13 +108,13 @@ public class JavaFxChunkBuildExtension extends ChunkBuildExtension {
}
}
final String artifactName = FileUtil.getNameWithoutExtension(artifactFileName);
final String artifactName = FileUtilRt.getNameWithoutExtension(artifactFileName);
final String tempDirPath = BuildProperties.propertyRef(
context.createNewTempFileProperty("artifact.temp.output." + artifactName, artifactFileName));
final PackagingElementResolvingContext resolvingContext = ArtifactManager.getInstance(context.getProject()).getResolvingContext();
for (Generator childGenerator : computeChildrenGenerators(resolvingContext,
for (Generator childGenerator : computeChildrenGenerators(resolvingContext,
new DirectoryAntCopyInstructionCreator(tempDirPath),
context, artifact.getArtifactType(), children)) {
generator.add(childGenerator);
@@ -171,15 +157,15 @@ public class JavaFxChunkBuildExtension extends ChunkBuildExtension {
final String keypass = selfSigning ? "keypass" : new String(Base64.getDecoder().decode(properties.getKeypass()), StandardCharsets.UTF_8);
generator.add(new Property(artifactBasedProperty(ARTIFACTKEYPASS_SIGN_PROPERTY, artifactName), keypass));
final Pair[] keysDescriptions = createKeysDescriptions(artifactName);
if (selfSigning) {
generator.add(new Tag("genkey",
generator.add(new Tag("genkey",
ArrayUtil.prepend(Couple.of("dname", BuildProperties
.propertyRef(artifactBasedProperty(ARTIFACT_VENDOR_SIGN_PROPERTY, artifactName))),
keysDescriptions)));
}
final Tag signjar = new Tag("signjar", keysDescriptions);
final Tag fileset = new Tag("fileset", Couple.of("dir", tempDirDeployPath));
fileset.add(new Tag("include", Couple.of("name", "*.jar")));
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.lang.properties;
import com.intellij.lang.properties.psi.PropertiesFile;
@@ -8,7 +6,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
@@ -101,7 +99,7 @@ public class PropertiesUtil {
final String name = file.getName();
if (!StringUtil.containsChar(name, '_')) {
return FileUtil.getNameWithoutExtension(name);
return FileUtilRt.getNameWithoutExtension(name);
}
final Matcher matcher = LOCALE_PATTERN.matcher(name);
@@ -118,11 +116,11 @@ public class PropertiesUtil {
continue;
}
baseNameWithExtension = name.substring(0, matchResult.start(1)) + name.substring(matchResult.end(1));
return FileUtil.getNameWithoutExtension(baseNameWithExtension);
return FileUtilRt.getNameWithoutExtension(baseNameWithExtension);
}
}
baseNameWithExtension = name;
return FileUtil.getNameWithoutExtension(baseNameWithExtension);
return FileUtilRt.getNameWithoutExtension(baseNameWithExtension);
}
});
}
@@ -250,7 +248,7 @@ public class PropertiesUtil {
public static String getSuffix(@NotNull PropertiesFile propertiesFile) {
final String baseName = propertiesFile.getResourceBundle().getBaseName();
final String propertiesFileName = propertiesFile.getName();
if (baseName.equals(FileUtil.getNameWithoutExtension(propertiesFileName))) return "";
return FileUtil.getNameWithoutExtension(propertiesFileName.substring(baseName.length() + 1));
if (baseName.equals(FileUtilRt.getNameWithoutExtension(propertiesFileName))) return "";
return FileUtilRt.getNameWithoutExtension(propertiesFileName.substring(baseName.length() + 1));
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.lang.properties.editor;
import com.intellij.codeInsight.FileModificationService;
@@ -18,7 +18,7 @@ import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.ValidationInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
@@ -166,7 +166,7 @@ public class PropertiesCopyHandler extends CopyHandlerDelegateBase {
@NotNull
private static String getPropertiesFileSuffix(PropertiesFile searchFile, String baseName) {
String suffix = FileUtil.getNameWithoutExtension(searchFile.getContainingFile().getName());
String suffix = FileUtilRt.getNameWithoutExtension(searchFile.getContainingFile().getName());
suffix = StringUtil.trimStart(suffix, baseName);
return suffix;
}
@@ -1,7 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.svn.commandLine;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.EnvironmentUtil;
import com.intellij.util.execution.ParametersListUtil;
import org.jetbrains.annotations.NotNull;
@@ -13,7 +14,6 @@ import org.jetbrains.idea.svn.SvnConfigurationState;
import java.util.List;
import static com.intellij.execution.CommandLineUtil.toCommandLine;
import static com.intellij.openapi.util.io.FileUtil.getNameWithoutExtension;
import static com.intellij.openapi.util.io.FileUtil.toSystemIndependentName;
import static com.intellij.openapi.util.text.StringUtil.*;
import static com.intellij.util.ObjectUtils.notNull;
@@ -58,7 +58,7 @@ public class SshTunnelRuntimeModule extends BaseCommandRuntimeModule {
@NotNull
private GeneralCommandLine buildTunnelCommandLine(@NotNull String sshPath) {
GeneralCommandLine result = new GeneralCommandLine(sshPath);
boolean isPuttyLinkClient = endsWithIgnoreCase(getNameWithoutExtension(sshPath), "plink");
boolean isPuttyLinkClient = endsWithIgnoreCase(FileUtilRt.getNameWithoutExtension(sshPath), "plink");
SvnConfigurationState state = getState();
// quiet mode
@@ -173,7 +173,7 @@ public class BuildoutFacet extends LibraryContributingFacet<BuildoutFacetConfigu
List<String> paths = extractFromScript(script);
if (paths == null) {
VirtualFile root = script.getParent().getParent();
String partName = FileUtil.getNameWithoutExtension(script.getName());
String partName = FileUtilRt.getNameWithoutExtension(script.getName());
if (SystemInfoRt.isWindows && partName.endsWith(SCRIPT_SUFFIX)) {
partName = partName.substring(0, partName.length() - SCRIPT_SUFFIX.length());
}
@@ -356,7 +356,7 @@ public class BuildoutFacet extends LibraryContributingFacet<BuildoutFacetConfigu
String scriptName = SystemInfoRt.isWindows ? name + SCRIPT_SUFFIX : name;
final List<File> scripts = getScripts(buildoutFacet, baseDir);
for (File script : scripts) {
if (FileUtil.getNameWithoutExtension(script.getName()).equals(scriptName)) {
if (FileUtilRt.getNameWithoutExtension(script.getName()).equals(scriptName)) {
return script;
}
}
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.codeInsight.completion
import com.intellij.codeInsight.TailType
@@ -11,7 +9,6 @@ import com.intellij.codeInsight.completion.CompletionResultSet
import com.intellij.codeInsight.lookup.LookupElementBuilder
import com.intellij.codeInsight.lookup.TailTypeDecorator
import com.intellij.openapi.util.io.FileUtil
import com.intellij.psi.PsiDirectory
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiFileSystemItem
import com.jetbrains.python.PyNames
@@ -21,7 +18,6 @@ import com.jetbrains.python.psi.PyFile
import com.jetbrains.python.psi.PyFunction
import com.jetbrains.python.psi.resolve.QualifiedNameFinder
import com.jetbrains.python.psi.types.TypeEvalContext
import com.jetbrains.python.sdk.PythonSdkType
import icons.PythonIcons
/**
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.codeInsight.imports;
@@ -7,7 +7,7 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.psi.*;
import com.intellij.psi.search.FilenameIndex;
import com.intellij.psi.search.GlobalSearchScope;
@@ -180,15 +180,15 @@ public final class PythonImportUtils {
private static boolean isAcceptableForImport(PyElement node, PsiFile existingImportFile, PsiFileSystemItem srcfile) {
return srcfile != existingImportFile && srcfile != node.getContainingFile() &&
(ImportFromExistingAction.isRoot(srcfile) || PyNames.isIdentifier(FileUtil.getNameWithoutExtension(srcfile.getName()))) &&
!isShadowedModule(srcfile);
(ImportFromExistingAction.isRoot(srcfile) || PyNames.isIdentifier(FileUtilRt.getNameWithoutExtension(srcfile.getName()))) &&
!isShadowedModule(srcfile);
}
private static boolean isShadowedModule(PsiFileSystemItem file) {
if (file.isDirectory() || file.getName().equals(PyNames.INIT_DOT_PY)) {
return false;
}
String name = FileUtil.getNameWithoutExtension(file.getName());
String name = FileUtilRt.getNameWithoutExtension(file.getName());
final PsiDirectory directory = ((PsiFile)file).getContainingDirectory();
if (directory == null) {
return false;
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.packaging;
import com.google.common.cache.CacheBuilder;
@@ -14,7 +14,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.CatchingConsumer;
import com.intellij.util.SmartList;
@@ -45,7 +45,7 @@ import java.util.stream.Collectors;
public class PyPIPackageUtil {
private static final Logger LOG = Logger.getInstance(PyPIPackageUtil.class);
private static final Gson GSON = new GsonBuilder().create();
private static final String PYPI_HOST = "https://pypi.python.org";
public static final String PYPI_URL = PYPI_HOST + "/pypi";
public static final String PYPI_LIST_URL = PYPI_HOST + "/simple";
@@ -113,14 +113,14 @@ public class PyPIPackageUtil {
.connect(request -> GSON.fromJson(request.getReader(), PackageDetails.class));
}
});
/**
* Prevents simultaneous updates of {@link PyPackageService#PYPI_REMOVED}
* because the corresponding response contains tons of data and multiple
* queries at the same time can cause memory issues.
* queries at the same time can cause memory issues.
*/
private final Object myPyPIPackageCacheUpdateLock = new Object();
/**
* Value for "User Agent" HTTP header in form: PyCharm/2016.2 EAP
*/
@@ -145,7 +145,7 @@ public class PyPIPackageUtil {
catch (IOException e) {
LOG.error("Cannot find \"packages\". " + e.getMessage());
}
return builder.build();
return builder.build();
}
public static boolean isPyPIRepository(@Nullable String repository) {
@@ -220,7 +220,7 @@ public class PyPIPackageUtil {
* Fetches available package versions using JSON API of PyPI.
*/
@NotNull
private List<String> getPackageVersionsFromPyPI(@NotNull String packageName,
private List<String> getPackageVersionsFromPyPI(@NotNull String packageName,
boolean force) throws IOException {
final PackageDetails details = refreshAndGetPackageDetailsFromPyPI(packageName, force);
final List<String> result = details.getReleases();
@@ -236,7 +236,7 @@ public class PyPIPackageUtil {
}
/**
* Fetches available package versions by scrapping the page containing package archives.
* Fetches available package versions by scrapping the page containing package archives.
* It's primarily used for additional repositories since, e.g. devpi doesn't provide another way to get this information.
*/
@NotNull
@@ -318,7 +318,7 @@ public class PyPIPackageUtil {
withoutExtension = StringUtil.trimEnd(artifactName, ".tar.gz");
}
else {
withoutExtension = FileUtil.getNameWithoutExtension(artifactName);
withoutExtension = FileUtilRt.getNameWithoutExtension(artifactName);
}
final String packageNameWithUnderscores = packageName.replace('-', '_');
final String suffix;
@@ -397,11 +397,11 @@ public class PyPIPackageUtil {
@SuppressWarnings("FieldMayBeFinal")
public static final class PackageDetails {
public static final class Info {
// We have to explicitly name each of the fields instead of just using
// We have to explicitly name each of the fields instead of just using
// GsonBuilder#setFieldNamingStrategy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES),
// since otherwise GSON wouldn't be able to deserialize server responses
// in the professional edition of PyCharm where the names of private fields
// are obfuscated.
// in the professional edition of PyCharm where the names of private fields
// are obfuscated.
@SerializedName("version")
private String version = "";
@SerializedName("author")
@@ -413,7 +413,7 @@ public class PyPIPackageUtil {
@SerializedName("summary")
private String summary = "";
@NotNull
public String getVersion() {
return StringUtil.notNullize(version);
@@ -1,24 +1,10 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.packaging.setupPy;
import com.google.common.collect.ImmutableSet;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
@@ -91,7 +77,7 @@ public class SetupTaskIntrospector {
final List<SetupTask> result = new ArrayList<>();
for (PsiFile commandFile : commandDir.getFiles()) {
if (commandFile instanceof PyFile && !SKIP_NAMES.contains(commandFile.getName())) {
final String taskName = FileUtil.getNameWithoutExtension(commandFile.getName());
final String taskName = FileUtilRt.getNameWithoutExtension(commandFile.getName());
result.add(createTaskFromFile((PyFile)commandFile, taskName, setuptools));
}
}
@@ -1,7 +1,7 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.patterns;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.patterns.InitialPatternCondition;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.psi.PsiElement;
@@ -74,7 +74,7 @@ public class PythonPatterns extends PlatformPatterns {
.select(PyFunction.class)
.map(ScopeUtil::getScopeOwner)
.select(PyFile.class)
.anyMatch(file -> moduleName.equals(FileUtil.getNameWithoutExtension(file.getName())));
.anyMatch(file -> moduleName.equals(FileUtilRt.getNameWithoutExtension(file.getName())));
}
});
}
@@ -439,11 +439,11 @@ public class PyUtil {
final File file = new File(pyFilePath);
File pycache = new File(file.getParentFile(), PyNames.PYCACHE);
if (pycache.isDirectory()) {
final String shortName = FileUtil.getNameWithoutExtension(file);
final String shortName = FileUtilRt.getNameWithoutExtension(file.getName());
Collections.addAll(filesToDelete, pycache.listFiles(pathname -> {
if (!FileUtilRt.extensionEquals(pathname.getName(), "pyc")) return false;
String nameWithMagic = FileUtil.getNameWithoutExtension(pathname);
return FileUtil.getNameWithoutExtension(nameWithMagic).equals(shortName);
String nameWithMagic = FileUtilRt.getNameWithoutExtension(pathname.getName());
return FileUtilRt.getNameWithoutExtension(nameWithMagic).equals(shortName);
}));
}
FileUtil.asyncDelete(filesToDelete);
@@ -452,7 +452,7 @@ public class PyUtil {
public static String getElementNameWithoutExtension(PsiNamedElement psiNamedElement) {
return psiNamedElement instanceof PyFile
? FileUtil.getNameWithoutExtension(((PyFile)psiNamedElement).getName())
? FileUtilRt.getNameWithoutExtension(((PyFile)psiNamedElement).getName())
: psiNamedElement.getName();
}
@@ -510,7 +510,7 @@ public class PyUtil {
@NotNull
public static String computeElementNameForStringSearch(@NotNull final PsiElement element) {
if (element instanceof PyFile) {
return FileUtil.getNameWithoutExtension(((PyFile)element).getName());
return FileUtilRt.getNameWithoutExtension(((PyFile)element).getName());
}
if (element instanceof PsiDirectory) {
return ((PsiDirectory)element).getName();
@@ -1392,7 +1392,7 @@ public class PyUtil {
final FileTemplateManager fileTemplateManager = FileTemplateManager.getInstance(project);
final FileTemplate template = fileTemplateManager.getInternalTemplate("Python Script");
final Properties properties = fileTemplateManager.getDefaultProperties();
properties.setProperty("NAME", FileUtil.getNameWithoutExtension(file.getName()));
properties.setProperty("NAME", FileUtilRt.getNameWithoutExtension(file.getName()));
final String content = (template != null) ? template.getText(properties) : null;
psi = PyExtractSuperclassHelper.placeFile(project,
StringUtil.notNullize(
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.psi.impl;
import com.google.common.collect.Lists;
@@ -11,7 +11,7 @@ import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.RecursionManager;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
@@ -771,7 +771,7 @@ public class PyFileImpl extends PsiFileBase implements PyFile, PyExpression {
return dir.getName();
}
}
return FileUtil.getNameWithoutExtension(file.getName());
return FileUtilRt.getNameWithoutExtension(file.getName());
}
@Nullable
@@ -1,10 +1,10 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.psi.resolve;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
@@ -229,7 +229,7 @@ public class QualifiedNameFinder {
final List<String> result = new ArrayList<>(StringUtil.split(relativePath, "/"));
if (!result.isEmpty()) {
final int lastIndex = result.size() - 1;
final String nameWithoutExtension = FileUtil.getNameWithoutExtension(result.get(lastIndex));
final String nameWithoutExtension = FileUtilRt.getNameWithoutExtension(result.get(lastIndex));
if (myVFile.isDirectory() || !nameWithoutExtension.equals(PyNames.INIT)) {
result.set(lastIndex, nameWithoutExtension);
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.psi.resolve;
import com.google.common.collect.Lists;
@@ -9,7 +9,7 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
@@ -423,7 +423,7 @@ public class ResolveImportUtil {
}
}
}
if (file != null && FileUtil.getNameWithoutExtension(file.getName()).equals(referencedName)) {
if (file != null && FileUtilRt.getNameWithoutExtension(file.getName()).equals(referencedName)) {
return file;
}
return null;
@@ -1,8 +1,8 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.psi.resolve;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiInvalidElementAccessException;
import com.intellij.psi.PsiNamedElement;
@@ -79,7 +79,7 @@ public abstract class VariantsProcessor implements PsiScopeProcessor {
if (!expr.isValid()) {
throw new PsiInvalidElementAccessException(expr, "Definer: " + definer);
}
final String name = expr instanceof PyFile ? FileUtil.getNameWithoutExtension(((PyFile)expr).getName()) : expr.getName();
final String name = expr instanceof PyFile ? FileUtilRt.getNameWithoutExtension(((PyFile)expr).getName()) : expr.getName();
if (nameIsAcceptable(name)) {
addImportedElement(name, expr);
}
@@ -1,22 +1,8 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.psi.stubs;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
@@ -52,7 +38,7 @@ public class PyModuleNameIndex extends ScalarIndexExtension<String> {
}
}
else {
return Collections.singletonMap(FileUtil.getNameWithoutExtension(name), null);
return Collections.singletonMap(FileUtilRt.getNameWithoutExtension(name), null);
}
return Collections.emptyMap();
}
@@ -8,7 +8,6 @@ import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.SystemInfoRt;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
@@ -527,7 +526,7 @@ public class PyModuleType implements PyType { // Modules don't descend from obje
@Nullable
public static LookupElementBuilder buildFileLookupElement(PsiFile file, PsiFileSystemItem item, @Nullable Set<? super String> existingNames) {
final String s = FileUtil.getNameWithoutExtension(item.getName());
final String s = FileUtilRt.getNameWithoutExtension(item.getName());
if (!PyNames.isIdentifier(s)) return null;
if (existingNames != null) {
if (existingNames.contains(s)) {
@@ -1,7 +1,6 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.refactoring.rename;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
@@ -32,7 +31,7 @@ public class PyContainingFileRenamerFactory implements AutomaticRenamerFactory {
ScopeOwner scopeOwner = PsiTreeUtil.getParentOfType(element, ScopeOwner.class);
if (scopeOwner instanceof PyFile) {
String className = ((PyClass) element).getName();
String fileName = FileUtil.getNameWithoutExtension(scopeOwner.getName());
String fileName = FileUtilRt.getNameWithoutExtension(scopeOwner.getName());
return fileName.equalsIgnoreCase(className);
}
return false;
@@ -85,7 +84,7 @@ public class PyContainingFileRenamerFactory implements AutomaticRenamerFactory {
@Override
protected String nameToCanonicalName(@NonNls String name, PsiNamedElement element) {
return FileUtil.getNameWithoutExtension(name);
return FileUtilRt.getNameWithoutExtension(name);
}
@Override
@@ -1,8 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.refactoring.rename;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiPolyVariantReference;
import com.intellij.psi.PsiReference;
@@ -61,7 +61,7 @@ public class RenamePyFileProcessor extends RenamePsiFileProcessor {
@NotNull final String newName,
@NotNull Map<? extends PsiElement, String> allRenames,
@NotNull List<UsageInfo> result) {
final String newFileName = FileUtil.getNameWithoutExtension(newName);
final String newFileName = FileUtilRt.getNameWithoutExtension(newName);
if (!PyNames.isIdentifier(newFileName)) {
final List<UsageInfo> usages = new ArrayList<>(result);
for (UsageInfo usageInfo : usages) {
@@ -1,9 +1,9 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.sdk.flavors;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.configurations.ParamsGroup;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.PatternUtil;
import com.jetbrains.python.run.PythonCommandLineState;
@@ -33,7 +33,7 @@ public class JythonSdkFlavor extends PythonSdkFlavor {
@Override
public boolean isValidSdkPath(@NotNull File file) {
return StringUtil.toLowerCase(FileUtil.getNameWithoutExtension(file)).startsWith("jython");
return StringUtil.toLowerCase(FileUtilRt.getNameWithoutExtension(file.getName())).startsWith("jython");
}
@Nullable
@@ -1,8 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.sdk.flavors;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.PatternUtil;
import com.jetbrains.python.psi.LanguageLevel;
@@ -32,7 +32,7 @@ public class PyPySdkFlavor extends PythonSdkFlavor {
@Override
public boolean isValidSdkPath(@NotNull File file) {
return StringUtil.toLowerCase(FileUtil.getNameWithoutExtension(file)).startsWith("pypy");
return StringUtil.toLowerCase(FileUtilRt.getNameWithoutExtension(file.getName())).startsWith("pypy");
}
@Nullable
@@ -10,7 +10,7 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SdkAdditionalData;
import com.intellij.openapi.util.SystemInfoRt;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.PatternUtil;
@@ -171,7 +171,7 @@ public abstract class PythonSdkFlavor {
}
public boolean isValidSdkPath(@NotNull File file) {
return StringUtil.toLowerCase(FileUtil.getNameWithoutExtension(file)).startsWith("python");
return StringUtil.toLowerCase(FileUtilRt.getNameWithoutExtension(file.getName())).startsWith("python");
}
@Nullable
@@ -1,24 +1,11 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.sdk.flavors;
import com.google.common.collect.ImmutableMap;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
@@ -87,7 +74,7 @@ public final class WinPythonSdkFlavor extends CPythonSdkFlavor {
private static void findInstallations(Set<String> candidates, String exe_name, String... roots) {
for (String root : roots) {
findSubdirInstallations(candidates, root, FileUtil.getNameWithoutExtension(exe_name), exe_name);
findSubdirInstallations(candidates, root, FileUtilRt.getNameWithoutExtension(exe_name), exe_name);
}
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.testing;
import com.google.common.collect.Sets;
@@ -23,7 +9,7 @@ import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
@@ -188,7 +174,7 @@ public final class PythonUnitTestUtil {
final PsiFile containingFile = cls.getContainingFile();
final VirtualFile virtualFile = containingFile.getVirtualFile();
final String clsFileName = virtualFile == null ? containingFile.getName() : virtualFile.getPath();
final String clsFileNameWithoutExt = FileUtil.getNameWithoutExtension(clsFileName);
final String clsFileNameWithoutExt = FileUtilRt.getNameWithoutExtension(clsFileName);
if (!clsFileNameWithoutExt.endsWith(fileName) && !fileName.equals(clsFileName)) {
continue;
}
@@ -212,7 +198,7 @@ public final class PythonUnitTestUtil {
final PsiFile containingFile = function.getContainingFile();
final VirtualFile virtualFile = containingFile.getVirtualFile();
final String clsFileName = virtualFile == null ? containingFile.getName() : virtualFile.getPath();
final String clsFileNameWithoutExt = FileUtil.getNameWithoutExtension(clsFileName);
final String clsFileNameWithoutExt = FileUtilRt.getNameWithoutExtension(clsFileName);
if (!clsFileNameWithoutExt.endsWith(fileName)) {
continue;
}
@@ -1,8 +1,8 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.intentions;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.psi.PsiFile;
import com.jetbrains.python.PythonTestUtil;
import com.jetbrains.python.fixtures.PyTestCase;
@@ -28,7 +28,7 @@ public abstract class PyIntentionTestCase extends PyTestCase {
if (files.length > 0) {
final PsiFile[] allFiles = myFixture.configureByFiles(files);
file = allFiles[0];
testFileName = FileUtil.getNameWithoutExtension(file.getName());
testFileName = FileUtilRt.getNameWithoutExtension(file.getName());
}
else {
testFileName = getTestName(true);