cleanup — use PathMacroUtil.DEPRECATED_MODULE_DIR

This commit is contained in:
Vladimir Krivosheev
2018-04-26 15:38:07 +02:00
parent 63f11876ca
commit 8b182dbf9d
4 changed files with 7 additions and 36 deletions
@@ -86,7 +86,6 @@ public class JavaBuilder extends ModuleLevelBuilder {
private static final Key<JavaCompilingTool> COMPILING_TOOL = Key.create("_java_compiling_tool_");
private static final Key<ConcurrentMap<String, Collection<String>>> COMPILER_USAGE_STATISTICS = Key.create("_java_compiler_usage_stats_");
private static final List<String> COMPILABLE_EXTENSIONS = Collections.singletonList(JAVA_EXTENSION);
private static final String MODULE_DIR_MACRO_TEMPLATE = "$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$";
private static final Set<String> FILTERED_OPTIONS = ContainerUtil.newHashSet(
"-target"
@@ -473,7 +472,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
final ConcurrentMap<String, Collection<String>> map = COMPILER_USAGE_STATISTICS.get(context);
Collection<String> names = map.get(compilerName);
if (names == null) {
names = Collections.synchronizedSet(new HashSet<String>());
names = Collections.synchronizedSet(new HashSet<>());
final Collection<String> prev = map.putIfAbsent(compilerName, names);
if (prev != null) {
names = prev;
@@ -774,7 +773,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
//this is a temporary workaround to allow passing per-module compiler options for Eclipse compiler in form
// -properties $MODULE_DIR$/.settings/org.eclipse.jdt.core.prefs
final String moduleDirPath = FileUtil.toCanonicalPath(baseDirectory.getAbsolutePath());
appender = (strings, option) -> strings.add(StringUtil.replace(option, MODULE_DIR_MACRO_TEMPLATE, moduleDirPath));
appender = (strings, option) -> strings.add(StringUtil.replace(option, PathMacroUtil.DEPRECATED_MODULE_DIR, moduleDirPath));
}
boolean skip = false;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 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-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.
package com.intellij.ide.util.projectWizard;
import com.intellij.CommonBundle;
@@ -98,7 +84,7 @@ public class ExistingModuleLoader extends ModuleBuilder {
}
final Element root = JDOMUtil.load(file);
final Set<String> usedMacros = PathMacrosCollector.getMacroNames(root);
usedMacros.remove("$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$");
usedMacros.remove(PathMacroUtil.DEPRECATED_MODULE_DIR);
usedMacros.removeAll(PathMacros.getInstance().getAllMacroNames());
if (usedMacros.size() > 0) {
@@ -299,7 +299,7 @@ public class SaveProjectAsTemplateAction extends AnAction {
private static String getRelativePath(PathMacroManager pathMacroManager, VirtualFile moduleRoot) {
String path = pathMacroManager.collapsePath(moduleRoot.getPath());
path = StringUtil.trimStart(path, "$" + PathMacroUtil.PROJECT_DIR_MACRO_NAME + "$");
path = StringUtil.trimStart(path, "$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$");
path = StringUtil.trimStart(path, PathMacroUtil.DEPRECATED_MODULE_DIR);
path = StringUtil.trimStart(path, "/");
return path;
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 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-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.
package com.intellij.application.options;
import com.intellij.openapi.components.PathMacroMap;
@@ -174,7 +160,7 @@ public class ReplacePathToMacroMap extends PathMacroMap {
if (replacement.contains("..")) return 1;
if (replacement.contains("$" + PathMacroUtil.USER_HOME_NAME + "$")) return 1;
if (replacement.contains("$" + PathMacroUtil.APPLICATION_HOME_DIR + "$")) return 1;
if (replacement.contains("$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$")) return 3;
if (replacement.contains(PathMacroUtil.DEPRECATED_MODULE_DIR)) return 3;
if (replacement.contains("$" + PathMacroUtil.PROJECT_DIR_MACRO_NAME + "$")) return 3;
return 2;
}