mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extract ui from util
GitOrigin-RevId: 4147e60c808d5ffd90a2d4e041bf4233a7c92abd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b7297beff0
commit
ff644d352d
Generated
+1
@@ -630,6 +630,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/util-ex/intellij.platform.util.ex.iml" filepath="$PROJECT_DIR$/platform/util-ex/intellij.platform.util.ex.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/util-rt/intellij.platform.util.rt.iml" filepath="$PROJECT_DIR$/platform/util-rt/intellij.platform.util.rt.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/util/testSrc/intellij.platform.util.tests.iml" filepath="$PROJECT_DIR$/platform/util/testSrc/intellij.platform.util.tests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/util/intellij.platform.util.ui.iml" filepath="$PROJECT_DIR$/platform/util/intellij.platform.util.ui.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/vcs-api/intellij.platform.vcs.iml" filepath="$PROJECT_DIR$/platform/vcs-api/intellij.platform.vcs.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/vcs-api/vcs-api-core/intellij.platform.vcs.core.iml" filepath="$PROJECT_DIR$/platform/vcs-api/vcs-api-core/intellij.platform.vcs.core.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/dvcs-api/intellij.platform.vcs.dvcs.iml" filepath="$PROJECT_DIR$/platform/dvcs-api/intellij.platform.vcs.dvcs.iml" />
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<orderEntry type="module" module-name="intellij.java" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel.impl" />
|
||||
<orderEntry type="library" name="JDOM" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
@@ -23,5 +23,6 @@
|
||||
<orderEntry type="library" name="kotlin-stdlib-jdk8" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.java" />
|
||||
<orderEntry type="module" module-name="intellij.jvm.analysis.impl" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
+5
-4
@@ -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.psi.impl.source.codeStyle;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
@@ -20,6 +20,7 @@ import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.BitUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -623,7 +624,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
|
||||
}
|
||||
}
|
||||
|
||||
String[] words = NameUtil.nameToWords(methodName);
|
||||
String[] words = NameUtilCore.nameToWords(methodName);
|
||||
if (words.length > 0) {
|
||||
final String firstWord = words[0];
|
||||
if (GET_PREFIX.equals(firstWord)
|
||||
@@ -813,7 +814,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
|
||||
name = variableNameToPropertyName(name, VariableKind.PARAMETER);
|
||||
if (expressions.length == 1) {
|
||||
final String methodName = method.getName();
|
||||
String[] words = NameUtil.nameToWords(methodName);
|
||||
String[] words = NameUtilCore.nameToWords(methodName);
|
||||
if (words.length > 0) {
|
||||
final String firstWord = words[0];
|
||||
if (SET_PREFIX.equals(firstWord)) {
|
||||
@@ -911,7 +912,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
|
||||
@Override
|
||||
public String propertyNameToVariableName(@NotNull String propertyName, @NotNull VariableKind variableKind) {
|
||||
if (variableKind == VariableKind.STATIC_FINAL_FIELD) {
|
||||
String[] words = NameUtil.nameToWords(propertyName);
|
||||
String[] words = NameUtilCore.nameToWords(propertyName);
|
||||
return StringUtil.join(words, StringUtil::toUpperCase, "_");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +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.intellij.refactoring.rename;
|
||||
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.psi.codeStyle.SuggestedNameInfo;
|
||||
import com.intellij.psi.codeStyle.VariableKind;
|
||||
import com.intellij.psi.util.PropertyUtilBase;
|
||||
@@ -27,6 +12,7 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.usageView.UsageViewUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
@@ -102,18 +88,18 @@ public class JavaNameSuggestionProvider implements NameSuggestionProvider {
|
||||
final VariableKind kind = codeStyleManager.getVariableKind((PsiVariable)psiElement);
|
||||
prefix = codeStyleManager.getPrefixByVariableKind(kind);
|
||||
if (kind == VariableKind.STATIC_FINAL_FIELD) {
|
||||
final String[] words = NameUtil.splitNameIntoWords(name);
|
||||
final String[] words = NameUtilCore.splitNameIntoWords(name);
|
||||
String buffer = Arrays.stream(words).map(StringUtil::toUpperCase).collect(Collectors.joining("_"));
|
||||
return new String[] {buffer};
|
||||
}
|
||||
}
|
||||
final List<String> result = new ArrayList<>();
|
||||
result.add(suggestProperlyCasedName(prefix, NameUtil.splitNameIntoWords(name)));
|
||||
result.add(suggestProperlyCasedName(prefix, NameUtilCore.splitNameIntoWords(name)));
|
||||
if (name.startsWith(prefix) && !prefix.isEmpty()) {
|
||||
name = name.substring(prefix.length());
|
||||
result.add(suggestProperlyCasedName(prefix, NameUtil.splitNameIntoWords(name)));
|
||||
result.add(suggestProperlyCasedName(prefix, NameUtilCore.splitNameIntoWords(name)));
|
||||
}
|
||||
result.add(suggestProperlyCasedName(prefix, NameUtil.splitNameIntoWords(StringUtil.toLowerCase(name))));
|
||||
result.add(suggestProperlyCasedName(prefix, NameUtilCore.splitNameIntoWords(StringUtil.toLowerCase(name))));
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,5 +8,6 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -13,5 +13,6 @@
|
||||
<orderEntry type="library" name="ASM" level="project" />
|
||||
<orderEntry type="library" name="Guava" level="project" />
|
||||
<orderEntry type="library" name="StreamEx" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -9,5 +9,6 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.platform.structureView.impl" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.java.psi.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -27,6 +27,7 @@
|
||||
<orderEntry type="module" module-name="intellij.java.psi" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.java.indexing" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.java.analysis" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<option name="body" value="/* * Copyright (c) $today.year Your Corporation. All Rights Reserved. */" />
|
||||
|
||||
@@ -13,5 +13,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel" />
|
||||
<orderEntry type="module" module-name="intellij.platform.editor" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -18,5 +18,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.indexing.impl" />
|
||||
<orderEntry type="library" name="kotlin-stdlib-jdk8" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.externalSystem" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
+1
@@ -120,6 +120,7 @@ class DistributionJARsBuilder {
|
||||
withModule("intellij.platform.util")
|
||||
withModule("intellij.platform.util.rt", "util.jar")
|
||||
withModule("intellij.platform.util.classLoader", "util.jar")
|
||||
withModule("intellij.platform.util.ui")
|
||||
withModule("intellij.platform.concurrency")
|
||||
|
||||
withModule("intellij.platform.extensions")
|
||||
|
||||
+8
-2
@@ -3,7 +3,6 @@ package org.jetbrains.intellij.build.impl
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.psi.codeStyle.NameUtil
|
||||
import groovy.transform.CompileDynamic
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.Immutable
|
||||
@@ -139,7 +138,14 @@ class MavenArtifactsBuilder {
|
||||
}
|
||||
|
||||
private static List<String> splitByCamelHumpsMergingNumbers(String s) {
|
||||
def words = NameUtil.splitNameIntoWords(s)
|
||||
String[] words
|
||||
try {
|
||||
words = Class.forName("com.intellij.util.text.NameUtilCore").getDeclaredMethod("splitNameIntoWords", String.class).invoke(null, s) as String[]
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
words = Class.forName("com.intellij.psi.codeStyle.NameUtil").getDeclaredMethod("splitNameIntoWords", String.class).invoke(null, s) as String[]
|
||||
}
|
||||
|
||||
def result = new ArrayList<String>()
|
||||
for (int i = 0; i < words.length; i++) {
|
||||
String next
|
||||
|
||||
+3
-3
@@ -428,11 +428,11 @@ class IconsClassGenerator(private val projectHome: File, val util: JpsModule, pr
|
||||
}
|
||||
}
|
||||
|
||||
if (Character.isJavaIdentifierStart(sb.first())) {
|
||||
return sb.toString()
|
||||
return if (Character.isJavaIdentifierStart(sb.first())) {
|
||||
sb.toString()
|
||||
}
|
||||
else {
|
||||
return "_" + sb.toString()
|
||||
"_$sb"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-6
@@ -1,6 +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.intellij.build.images
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
@@ -14,9 +12,7 @@ internal fun generateIconsClasses() {
|
||||
val home = File(homePath)
|
||||
val project = JpsSerializationManager.getInstance().loadModel(homePath, null).project
|
||||
|
||||
val util = project.modules.find { it.name == "intellij.platform.util" } ?: throw IllegalStateException("Can't load module 'util'")
|
||||
|
||||
val generator = IconsClassGenerator(home, util)
|
||||
val generator = IconsClassGenerator(home, project.modules.find { it.name == "intellij.platform.util.ui" } ?: throw IllegalStateException("Can't load module 'util'"))
|
||||
project.modules.parallelStream().forEach(generator::processModule)
|
||||
generator.printStats()
|
||||
|
||||
|
||||
+1
-5
@@ -1,7 +1,6 @@
|
||||
// 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.intellij.build.images.mappings
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import org.jetbrains.intellij.build.images.IconsClassGenerator
|
||||
import org.jetbrains.intellij.build.images.ImageCollector
|
||||
import org.jetbrains.intellij.build.images.isImage
|
||||
@@ -88,10 +87,7 @@ private fun loadIdeaGeneratedIcons(context: Context): Collection<Mapping> {
|
||||
val home = context.devRepoDir
|
||||
val homePath = home.absolutePath
|
||||
val project = JpsSerializationManager.getInstance().loadModel(homePath, null).project
|
||||
val util = project.modules.find {
|
||||
it.name == "intellij.platform.util"
|
||||
} ?: throw error("Can't load module 'util'")
|
||||
val generator = IconsClassGenerator(home, util)
|
||||
val generator = IconsClassGenerator(home, project.modules.find { it.name == "intellij.platform.util.ui" } ?: throw error("Can't load module 'util'"))
|
||||
return protectStdErr {
|
||||
project.modules.parallelStream().map { module ->
|
||||
val iconsClassInfo = generator.getIconsClassInfo(module) ?: return@map null
|
||||
|
||||
+2
-4
@@ -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.intellij.build.images
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
@@ -116,10 +116,8 @@ abstract class ImageResourcesTestBase {
|
||||
@JvmStatic
|
||||
fun collectNonRegeneratedIconClasses(root: TestRoot): List<Array<Any?>> {
|
||||
val model = loadProjectModel(root)
|
||||
val util = model.project.modules.find { it.name == "intellij.platform.util" } ?: throw IllegalStateException("Can't load module 'util'")
|
||||
val modules = collectModules(root, model)
|
||||
|
||||
val checker = MyIconClassFileChecker(File(PathManager.getHomePath()), util)
|
||||
val checker = MyIconClassFileChecker(File(PathManager.getHomePath()), model.project.modules.find { it.name == "intellij.platform.util.ui" } ?: throw IllegalStateException("Can't load module 'util'"))
|
||||
modules.forEach {
|
||||
checker.checkIconClasses(it)
|
||||
}
|
||||
|
||||
@@ -13,5 +13,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.resources.en" exported="" />
|
||||
<orderEntry type="library" name="automaton" level="project" />
|
||||
<orderEntry type="library" name="JDOM" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -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.ide;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -50,6 +36,6 @@ public abstract class TypePresentationService {
|
||||
if (i >= 0) {
|
||||
simpleName = simpleName.substring(i + 1);
|
||||
}
|
||||
return StringUtil.capitalizeWords(StringUtil.join(NameUtil.nameToWords(simpleName), " "), true);
|
||||
return StringUtil.capitalizeWords(StringUtil.join(NameUtilCore.nameToWords(simpleName), " "), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,5 +11,6 @@
|
||||
<orderEntry type="library" name="picocontainer" level="project" />
|
||||
<orderEntry type="library" name="Guava" level="project" />
|
||||
<orderEntry type="library" name="JDOM" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -8,5 +8,6 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -17,5 +17,6 @@
|
||||
<orderEntry type="library" name="jetbrains-annotations" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ex" />
|
||||
<orderEntry type="module" module-name="intellij.platform.concurrency" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -14,5 +14,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.indexing.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -21,5 +21,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.objectSerializer" />
|
||||
<orderEntry type="module" module-name="intellij.platform.objectSerializer.annotations" />
|
||||
<orderEntry type="library" name="lz4-java" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -11,5 +11,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel" />
|
||||
<orderEntry type="library" name="NanoXML" level="project" />
|
||||
<orderEntry type="library" name="JDOM" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -19,5 +19,6 @@
|
||||
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="hamcrest" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ex" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
+3
-17
@@ -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-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.codeInsight.template.macro;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@@ -22,7 +8,7 @@ import com.intellij.codeInsight.template.ExpressionContext;
|
||||
import com.intellij.codeInsight.template.Result;
|
||||
import com.intellij.codeInsight.template.TextResult;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -66,7 +52,7 @@ public class ConvertToCamelCaseMacro extends MacroBase {
|
||||
|
||||
@NotNull
|
||||
protected String[] splitWords(String text) {
|
||||
return NameUtil.nameToWords(text);
|
||||
return NameUtilCore.nameToWords(text);
|
||||
}
|
||||
|
||||
public static class ReplaceUnderscoresToCamelCaseMacro extends ConvertToCamelCaseMacro {
|
||||
|
||||
@@ -1,25 +1,11 @@
|
||||
/*
|
||||
* 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.refactoring.rename.naming;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import gnu.trove.TIntIntHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -41,8 +27,8 @@ public class NameSuggester {
|
||||
public NameSuggester(String oldClassName, String newClassName) {
|
||||
myOldClassNameAsGiven = oldClassName;
|
||||
myNewClassNameAsGiven = newClassName;
|
||||
myOldClassName = NameUtil.splitNameIntoWords(oldClassName);
|
||||
myNewClassName = NameUtil.splitNameIntoWords(newClassName);
|
||||
myOldClassName = NameUtilCore.splitNameIntoWords(oldClassName);
|
||||
myNewClassName = NameUtilCore.splitNameIntoWords(newClassName);
|
||||
|
||||
myChanges = new ArrayList<>();
|
||||
int oldIndex = myOldClassName.length - 1;
|
||||
@@ -90,7 +76,7 @@ public class NameSuggester {
|
||||
|
||||
public String suggestName(final String propertyName) {
|
||||
if (myOldClassNameAsGiven.equals(propertyName)) return myNewClassNameAsGiven;
|
||||
final String[] propertyWords = NameUtil.splitNameIntoWords(propertyName);
|
||||
final String[] propertyWords = NameUtilCore.splitNameIntoWords(propertyName);
|
||||
TIntIntHashMap matches = calculateMatches(propertyWords);
|
||||
if (matches.isEmpty()) return propertyName;
|
||||
TreeMap<Pair<Integer,Integer>, String> replacements = calculateReplacements(propertyWords, matches);
|
||||
@@ -172,7 +158,7 @@ public class NameSuggester {
|
||||
* @return
|
||||
*/
|
||||
private TreeMap<Pair<Integer, Integer>, String> calculateReplacements(String[] propertyWords, TIntIntHashMap matches) {
|
||||
TreeMap<Pair<Integer,Integer>, String> replacements = new TreeMap<>((pair, pair1) -> pair.getFirst().compareTo(pair1.getFirst()));
|
||||
TreeMap<Pair<Integer,Integer>, String> replacements = new TreeMap<>(Comparator.comparing(pair -> pair.getFirst()));
|
||||
for (final OriginalToNewChange change : myChanges) {
|
||||
final int first = change.oldFirst;
|
||||
final int last = change.oldLast;
|
||||
|
||||
@@ -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.testIntegration;
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -82,7 +82,7 @@ public class TestFinderHelper {
|
||||
}
|
||||
|
||||
public static List<Pair<String, Integer>> collectPossibleClassNamesWithWeights(String testName) {
|
||||
String[] words = NameUtil.splitNameIntoWords(testName);
|
||||
String[] words = NameUtilCore.splitNameIntoWords(testName);
|
||||
List<Pair<String, Integer>> result = new ArrayList<>();
|
||||
|
||||
for (int from = 0; from < words.length; from++) {
|
||||
|
||||
@@ -40,5 +40,6 @@
|
||||
<orderEntry type="library" scope="RUNTIME" name="netty-handler-proxy" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ex" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.concurrency" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
+2
-16
@@ -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.psi.codeStyle;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -25,7 +11,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* {@link FixingLayoutMatcher} extension that returns all matches (not just the first one)
|
||||
* {@link FixingLayoutMatcher} extension that returns all matches (not just the first one)
|
||||
* from {@link MinusculeMatcher#matchingFragments(String)}.
|
||||
*/
|
||||
public class AllOccurrencesMatcher extends MinusculeMatcher {
|
||||
+1
-15
@@ -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.psi.codeStyle;
|
||||
|
||||
import com.intellij.util.ui.KeyboardLayoutUtil;
|
||||
+1
-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.psi.codeStyle;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+6
-5
@@ -1,10 +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.intellij.psi.codeStyle;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.FList;
|
||||
import com.intellij.util.io.IOUtil;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -78,7 +79,7 @@ class MinusculeMatcherImpl extends MinusculeMatcher {
|
||||
if (start < name.length() && Character.isDigit(name.charAt(start))) {
|
||||
return start + 1; //treat each digit as a separate hump
|
||||
}
|
||||
return NameUtil.nextWord(name, start);
|
||||
return NameUtilCore.nextWord(name, start);
|
||||
}
|
||||
|
||||
private boolean hasFlag(int start, boolean[] flags) {
|
||||
@@ -153,7 +154,7 @@ class MinusculeMatcherImpl extends MinusculeMatcher {
|
||||
|
||||
int startIndex = first.getStartOffset();
|
||||
boolean afterSeparator = StringUtil.indexOfAny(name, myHardSeparators, 0, startIndex) >= 0;
|
||||
boolean wordStart = startIndex == 0 || NameUtil.isWordStart(name, startIndex) && !NameUtil.isWordStart(name, startIndex - 1);
|
||||
boolean wordStart = startIndex == 0 || NameUtilCore.isWordStart(name, startIndex) && !NameUtilCore.isWordStart(name, startIndex - 1);
|
||||
boolean finalMatch = fragments.get(fragments.size() - 1).getEndOffset() == name.length();
|
||||
|
||||
return (wordStart ? 1000 : 0) +
|
||||
@@ -334,7 +335,7 @@ class MinusculeMatcherImpl extends MinusculeMatcher {
|
||||
// uppercase should match either uppercase or a word start
|
||||
return !isUpperCase[patternIndex] ||
|
||||
Character.isUpperCase(name.charAt(nextOccurrence)) ||
|
||||
NameUtil.isWordStart(name, nextOccurrence) ||
|
||||
NameUtilCore.isWordStart(name, nextOccurrence) ||
|
||||
// accept uppercase matching lowercase if the whole prefix is uppercase and case sensitivity allows that
|
||||
!myHasHumps && myOptions != NameUtil.MatchingCaseSensitivity.ALL;
|
||||
}
|
||||
@@ -402,7 +403,7 @@ class MinusculeMatcherImpl extends MinusculeMatcher {
|
||||
|
||||
private boolean isMiddleMatch(@NotNull String name, int patternIndex, int nameIndex) {
|
||||
return isPatternChar(patternIndex - 1, '*') && !isWildcard(patternIndex + 1) &&
|
||||
Character.isLetterOrDigit(name.charAt(nameIndex)) && !NameUtil.isWordStart(name, nameIndex);
|
||||
Character.isLetterOrDigit(name.charAt(nameIndex)) && !NameUtilCore.isWordStart(name, nameIndex);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
+13
-123
@@ -1,68 +1,25 @@
|
||||
// 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.psi.codeStyle;
|
||||
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NameUtil {
|
||||
public final class NameUtil {
|
||||
private static final int MAX_LENGTH = 40;
|
||||
|
||||
private NameUtil() {}
|
||||
|
||||
@NotNull
|
||||
public static List<String> nameToWordsLowerCase(@NotNull String name){
|
||||
return ContainerUtil.map(nameToWords(name), StringUtil::toLowerCase);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String[] nameToWords(@NotNull String name){
|
||||
List<String> array = new ArrayList<>();
|
||||
int index = 0;
|
||||
|
||||
while(index < name.length()){
|
||||
int wordStart = index;
|
||||
int upperCaseCount = 0;
|
||||
int lowerCaseCount = 0;
|
||||
int digitCount = 0;
|
||||
int specialCount = 0;
|
||||
while(index < name.length()){
|
||||
char c = name.charAt(index);
|
||||
if (Character.isDigit(c)){
|
||||
if (upperCaseCount > 0 || lowerCaseCount > 0 || specialCount > 0) break;
|
||||
digitCount++;
|
||||
}
|
||||
else if (Character.isUpperCase(c)){
|
||||
if (lowerCaseCount > 0 || digitCount > 0 || specialCount > 0) break;
|
||||
upperCaseCount++;
|
||||
}
|
||||
else if (Character.isLowerCase(c)){
|
||||
if (digitCount > 0 || specialCount > 0) break;
|
||||
if (upperCaseCount > 1) {
|
||||
index--;
|
||||
break;
|
||||
}
|
||||
lowerCaseCount++;
|
||||
}
|
||||
else{
|
||||
if (upperCaseCount > 0 || lowerCaseCount > 0 || digitCount > 0) break;
|
||||
specialCount++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
String word = name.substring(wordStart, index);
|
||||
if (!StringUtil.isEmptyOrSpaces(word)) {
|
||||
array.add(word);
|
||||
}
|
||||
}
|
||||
return ArrayUtil.toStringArray(array);
|
||||
return ContainerUtil.map(NameUtilCore.nameToWords(name), StringUtil::toLowerCase);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -212,23 +169,6 @@ public class NameUtil {
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits an identifier into words, separated with underscores or upper-case characters
|
||||
* (camel-case).
|
||||
*
|
||||
* @param name the identifier to split.
|
||||
* @return the array of strings into which the identifier has been split.
|
||||
*/
|
||||
@NotNull
|
||||
public static String[] splitNameIntoWords(@NotNull String name) {
|
||||
final String[] underlineDelimited = name.split("_");
|
||||
List<String> result = new ArrayList<>();
|
||||
for (String word : underlineDelimited) {
|
||||
addAllWords(word, result);
|
||||
}
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<String> getSuggestionsByName(@NotNull String name,
|
||||
@NotNull String prefix,
|
||||
@@ -237,7 +177,7 @@ public class NameUtil {
|
||||
boolean preferLongerNames,
|
||||
boolean isArray) {
|
||||
ArrayList<String> answer = new ArrayList<>();
|
||||
String[] words = nameToWords(name);
|
||||
String[] words = NameUtilCore.nameToWords(name);
|
||||
|
||||
for (int step = 0; step < words.length; step++) {
|
||||
int wordCount = preferLongerNames ? words.length - step : step + 1;
|
||||
@@ -315,64 +255,14 @@ public class NameUtil {
|
||||
return suggestion;
|
||||
}
|
||||
|
||||
static int nextWord(@NotNull String text, int start) {
|
||||
if (!Character.isLetterOrDigit(text.charAt(start))) {
|
||||
return start + 1;
|
||||
}
|
||||
|
||||
int i = start;
|
||||
while (i < text.length() && Character.isDigit(text.charAt(i))) i++;
|
||||
if (i > start) {
|
||||
// digits form a separate hump
|
||||
return i;
|
||||
}
|
||||
|
||||
while (i < text.length() && Character.isUpperCase(text.charAt(i))) i++;
|
||||
|
||||
if (i > start + 1) {
|
||||
// several consecutive uppercase letter form a hump
|
||||
if (i == text.length() || !Character.isLetter(text.charAt(i))) {
|
||||
return i;
|
||||
}
|
||||
return i - 1;
|
||||
}
|
||||
|
||||
if (i == start) i++;
|
||||
while (i < text.length() && Character.isLetter(text.charAt(i)) && !isWordStart(text, i)) i++;
|
||||
return i;
|
||||
@NotNull
|
||||
public static String[] splitNameIntoWords(@NotNull String name) {
|
||||
return NameUtilCore.splitNameIntoWords(name);
|
||||
}
|
||||
|
||||
private static void addAllWords(@NotNull String text, @NotNull List<? super String> result) {
|
||||
int start = 0;
|
||||
while (start < text.length()) {
|
||||
int next = nextWord(text, start);
|
||||
result.add(text.substring(start, next));
|
||||
start = next;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isWordStart(String text, int i) {
|
||||
char c = text.charAt(i);
|
||||
if (Character.isUpperCase(c)) {
|
||||
if (i > 0 && Character.isUpperCase(text.charAt(i - 1))) {
|
||||
// check that we're not in the middle of an all-caps word
|
||||
return i + 1 < text.length() && Character.isLowerCase(text.charAt(i + 1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (Character.isDigit(c)) {
|
||||
return true;
|
||||
}
|
||||
if (!Character.isLetter(c)) {
|
||||
return false;
|
||||
}
|
||||
return i == 0 || !Character.isLetterOrDigit(text.charAt(i - 1)) || isHardCodedWordStart(text, i);
|
||||
}
|
||||
|
||||
private static boolean isHardCodedWordStart(String text, int i) {
|
||||
return text.charAt(i) == 'l' &&
|
||||
i < text.length() - 1 && text.charAt(i + 1) == 'n' &&
|
||||
(text.length() == i + 2 || isWordStart(text, i + 2));
|
||||
@NotNull
|
||||
public static String[] nameToWords(@NotNull String name) {
|
||||
return NameUtilCore.nameToWords(name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -384,7 +274,7 @@ public class NameUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static com.intellij.util.text.Matcher buildMatcher(@NotNull String pattern, int exactPrefixLen,
|
||||
public static com.intellij.util.text.Matcher buildMatcher(@NotNull String pattern, int exactPrefixLen,
|
||||
boolean allowToUpper, boolean allowToLower) {
|
||||
MatchingCaseSensitivity options = !allowToLower && !allowToUpper ? MatchingCaseSensitivity.ALL
|
||||
: exactPrefixLen > 0 ? MatchingCaseSensitivity.FIRST_LETTER
|
||||
@@ -455,7 +345,7 @@ public class NameUtil {
|
||||
|
||||
@NotNull
|
||||
public static String splitWords(@NotNull String text, char separator, @NotNull Function<? super String, String> transformWord) {
|
||||
final String[] words = nameToWords(text);
|
||||
final String[] words = NameUtilCore.nameToWords(text);
|
||||
boolean insertSeparator = false;
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
for (String word : words) {
|
||||
+6
-5
@@ -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.psi.codeStyle;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
@@ -9,6 +9,7 @@ import com.intellij.util.Processor;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.FList;
|
||||
import com.intellij.util.io.IOUtil;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -79,7 +80,7 @@ class TypoTolerantMatcher extends MinusculeMatcher {
|
||||
if (start < name.length() && Character.isDigit(name.charAt(start))) {
|
||||
return start + 1; //treat each digit as a separate hump
|
||||
}
|
||||
return NameUtil.nextWord(name, start);
|
||||
return NameUtilCore.nextWord(name, start);
|
||||
}
|
||||
|
||||
private boolean hasFlag(int start, boolean[] flags) {
|
||||
@@ -167,7 +168,7 @@ class TypoTolerantMatcher extends MinusculeMatcher {
|
||||
|
||||
int startIndex = first.getStartOffset();
|
||||
boolean afterSeparator = StringUtil.indexOfAny(name, myHardSeparators, 0, startIndex) >= 0;
|
||||
boolean wordStart = startIndex == 0 || NameUtil.isWordStart(name, startIndex) && !NameUtil.isWordStart(name, startIndex - 1);
|
||||
boolean wordStart = startIndex == 0 || NameUtilCore.isWordStart(name, startIndex) && !NameUtilCore.isWordStart(name, startIndex - 1);
|
||||
boolean finalMatch = fragments.get(fragments.size() - 1).getEndOffset() == name.length();
|
||||
|
||||
return (wordStart ? 1000 : 0) +
|
||||
@@ -427,7 +428,7 @@ class TypoTolerantMatcher extends MinusculeMatcher {
|
||||
// uppercase should match either uppercase or a word start
|
||||
return !isUpperCase(patternIndex, errorState) ||
|
||||
Character.isUpperCase(myName.charAt(nextOccurrence)) ||
|
||||
NameUtil.isWordStart(myName, nextOccurrence) ||
|
||||
NameUtilCore.isWordStart(myName, nextOccurrence) ||
|
||||
// accept uppercase matching lowercase if the whole prefix is uppercase and case sensitivity allows that
|
||||
!myHasHumps && myOptions != NameUtil.MatchingCaseSensitivity.ALL;
|
||||
}
|
||||
@@ -543,7 +544,7 @@ class TypoTolerantMatcher extends MinusculeMatcher {
|
||||
|
||||
private boolean isMiddleMatch(int patternIndex, int nameIndex, @NotNull ErrorState errorState) {
|
||||
return isPatternChar(patternIndex - 1, '*', errorState) && !isWildcard(patternIndex + 1) &&
|
||||
Character.isLetterOrDigit(myName.charAt(nameIndex)) && !NameUtil.isWordStart(myName, nameIndex);
|
||||
Character.isLetterOrDigit(myName.charAt(nameIndex)) && !NameUtilCore.isWordStart(myName, nameIndex);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -0,0 +1,14 @@
|
||||
// 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.text;
|
||||
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
@SuppressWarnings("ClassNameSameAsAncestorName")
|
||||
public interface Matcher extends NameUtil.Matcher {
|
||||
@Override
|
||||
boolean matches(@NotNull String name);
|
||||
}
|
||||
@@ -61,5 +61,6 @@
|
||||
<orderEntry type="library" name="kotlin-reflect" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.objectSerializer" scope="RUNTIME" />
|
||||
<orderEntry type="library" name="jackson-databind" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -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.ui;
|
||||
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
@@ -17,10 +17,10 @@ import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.ex.ToolWindowManagerListener;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.ui.border.CustomLineBorder;
|
||||
import com.intellij.ui.speedSearch.SpeedSearch;
|
||||
import com.intellij.ui.speedSearch.SpeedSearchSupply;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -99,7 +99,7 @@ public abstract class SpeedSearchBase<Comp extends JComponent> extends SpeedSear
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
final String prefix = getEnteredPrefix();
|
||||
assert prefix != null;
|
||||
final String[] strings = NameUtil.splitNameIntoWords(prefix);
|
||||
final String[] strings = NameUtilCore.splitNameIntoWords(prefix);
|
||||
final String last = strings[strings.length - 1];
|
||||
final int i = prefix.lastIndexOf(last);
|
||||
mySearchPopup.mySearchField.setText(prefix.substring(0, i).trim());
|
||||
|
||||
@@ -1,24 +1,11 @@
|
||||
/*
|
||||
* 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.ui;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.codeStyle.MinusculeMatcher;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -38,7 +25,7 @@ public class SpeedSearchComparator {
|
||||
public SpeedSearchComparator(boolean shouldMatchFromTheBeginning) {
|
||||
this(shouldMatchFromTheBeginning, false);
|
||||
}
|
||||
|
||||
|
||||
public SpeedSearchComparator(boolean shouldMatchFromTheBeginning, boolean shouldMatchCamelCase) {
|
||||
myShouldMatchFromTheBeginning = shouldMatchFromTheBeginning;
|
||||
myShouldMatchCamelCase = shouldMatchCamelCase;
|
||||
@@ -57,7 +44,7 @@ public class SpeedSearchComparator {
|
||||
if (myRecentSearchText == null || !myRecentSearchText.equals(pattern)) {
|
||||
myRecentSearchText = pattern;
|
||||
if (myShouldMatchCamelCase) {
|
||||
pattern = StringUtil.join(NameUtil.nameToWords(pattern), "*");
|
||||
pattern = StringUtil.join(NameUtilCore.nameToWords(pattern), "*");
|
||||
}
|
||||
if (!myShouldMatchFromTheBeginning && !pattern.startsWith("*")) {
|
||||
pattern = "*" + pattern;
|
||||
|
||||
@@ -13,5 +13,6 @@
|
||||
<orderEntry type="library" name="JDOM" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.concurrency" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ex" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -11,5 +11,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.lang" />
|
||||
<orderEntry type="module" module-name="intellij.platform.remoteServers.agent.rt" exported="" />
|
||||
<orderEntry type="library" name="JDOM" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -19,5 +19,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,12 +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.intellij;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.NameUtilCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -48,7 +46,7 @@ public class ClassFinder {
|
||||
}
|
||||
|
||||
// A test may be named Test*, *Test, *Tests*, *TestCase, *TestSuite, *Suite, etc
|
||||
List<String> words = Arrays.asList(NameUtil.nameToWords(className));
|
||||
List<String> words = Arrays.asList(NameUtilCore.nameToWords(className));
|
||||
|
||||
if (words.contains("Test") || words.contains("Tests") || words.contains("Suite")) {
|
||||
String fqn = StringUtil.trimEnd(absPath.substring(startPackageName), ".class").replace(File.separatorChar, '.');
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="library" scope="PROVIDED" name="Mac" level="project" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="JDOM" level="project" />
|
||||
@@ -20,13 +19,8 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.util.classLoader" exported="" />
|
||||
<orderEntry type="library" name="jna" level="project" />
|
||||
<orderEntry type="library" name="OroMatcher" level="project" />
|
||||
<orderEntry type="library" name="imgscalr" level="project" />
|
||||
<orderEntry type="library" name="xmlgraphics-commons" level="project" />
|
||||
<orderEntry type="library" name="lz4-java" level="project" />
|
||||
<orderEntry type="library" name="xml-apis-ext" level="project" />
|
||||
<orderEntry type="library" name="commons-compress" level="project" />
|
||||
<orderEntry type="library" name="Java Compatibility" level="project" />
|
||||
<orderEntry type="library" name="batik-transcoder" level="project" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/ui">
|
||||
<sourceFolder url="file://$MODULE_DIR$/ui/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="library" scope="PROVIDED" name="Mac" level="project" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util" />
|
||||
<orderEntry type="library" name="batik-transcoder" level="project" />
|
||||
<orderEntry type="library" name="xmlgraphics-commons" level="project" />
|
||||
<orderEntry type="library" name="imgscalr" level="project" />
|
||||
<orderEntry type="library" name="jna" level="project" />
|
||||
<orderEntry type="library" name="xml-apis-ext" level="project" />
|
||||
<orderEntry type="library" name="Java Compatibility" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class DescriptionLabel extends JLabel {
|
||||
|
||||
public DescriptionLabel(@Nullable String text) {
|
||||
setText(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
setForeground(UIUtil.getLabelDisabledForeground());
|
||||
int size = getFont().getSize();
|
||||
if (size >= 12) {
|
||||
size -= 2;
|
||||
}
|
||||
setFont(getFont().deriveFont((float)size));
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public abstract class Divider extends JPanel {
|
||||
public Divider(LayoutManager layout) {
|
||||
super(layout);
|
||||
}
|
||||
|
||||
public abstract void setResizeEnabled(boolean resizeEnabled);
|
||||
|
||||
public abstract void setSwitchOrientationEnabled(boolean switchOrientationEnabled);
|
||||
|
||||
public abstract void setOrientation(boolean vertical);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public interface NullableComponent {
|
||||
|
||||
boolean isNull();
|
||||
|
||||
class Check {
|
||||
private Check() {
|
||||
}
|
||||
|
||||
public static boolean isNull(Component c) {
|
||||
return c == null || c instanceof NullableComponent && ((NullableComponent)c).isNull();
|
||||
}
|
||||
|
||||
public static boolean isNullOrHidden(Component c) {
|
||||
return c != null && !c.isShowing() || isNull(c);
|
||||
}
|
||||
|
||||
public static boolean isNotNullAndVisible(Component c) {
|
||||
return !isNull(c) && c.isVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public interface Splittable {
|
||||
float getMinProportion(boolean first);
|
||||
|
||||
void setProportion(float proportion);
|
||||
|
||||
/**
|
||||
* @return {@code true} if splitter has vertical orientation, {@code false} otherwise
|
||||
*/
|
||||
boolean getOrientation();
|
||||
|
||||
/**
|
||||
* @param verticalSplit {@code true} means that splitter will have vertical split
|
||||
*/
|
||||
void setOrientation(boolean verticalSplit);
|
||||
|
||||
@NotNull
|
||||
Component asComponent();
|
||||
|
||||
void setDragging(boolean dragging);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.openapi.util;
|
||||
|
||||
import com.intellij.util.ui.update.ComparableObject;
|
||||
|
||||
public abstract class IdRunnable extends ComparableObject.Impl implements Runnable {
|
||||
|
||||
public IdRunnable(Object object) {
|
||||
super(object);
|
||||
}
|
||||
|
||||
public IdRunnable(Object[] objects) {
|
||||
super(objects);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import com.intellij.util.ConcurrencyUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.PropertyKey;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.ref.Reference;
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.intellij.openapi.util.registry;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.ui.ColorUtil;
|
||||
import com.intellij.ui.ColorHexUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -92,7 +92,7 @@ public class RegistryValue {
|
||||
Color asColor(Color defaultValue) {
|
||||
final String s = get(myKey, null, true);
|
||||
if (s != null) {
|
||||
Color color = ColorUtil.fromHex(s, null);
|
||||
Color color = ColorHexUtil.fromHex(s, null);
|
||||
if (color != null && myKey.contains("color")) {
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public interface ActiveComponent {
|
||||
void setActive(boolean active);
|
||||
|
||||
@NotNull
|
||||
JComponent getComponent();
|
||||
|
||||
abstract class Adapter implements ActiveComponent {
|
||||
@Override
|
||||
public void setActive(boolean active) { }
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface CollapsingListener {
|
||||
void onCollapsingChanged(@NotNull CollapsiblePanel panel, boolean newValue);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// 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.ui;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class ColorHexUtil {
|
||||
/**
|
||||
* Return Color object from string. The following formats are allowed:
|
||||
* {@code 0xA1B2C3},
|
||||
* {@code #abc123},
|
||||
* {@code ABC123},
|
||||
* {@code ab5},
|
||||
* {@code #FFF}.
|
||||
*
|
||||
* @param str hex string
|
||||
* @return Color object
|
||||
*/
|
||||
@SuppressWarnings("UseJBColor")
|
||||
@NotNull
|
||||
public static Color fromHex(@NotNull String str) {
|
||||
int pos = str.startsWith("#") ? 1 : str.startsWith("0x") ? 2 : 0;
|
||||
int len = str.length() - pos;
|
||||
if (len == 3) return new Color(fromHex1(str, pos), fromHex1(str, pos + 1), fromHex1(str, pos + 2), 255);
|
||||
if (len == 4) return new Color(fromHex1(str, pos), fromHex1(str, pos + 1), fromHex1(str, pos + 2), fromHex1(str, pos + 3));
|
||||
if (len == 6) return new Color(fromHex2(str, pos), fromHex2(str, pos + 2), fromHex2(str, pos + 4), 255);
|
||||
if (len == 8) return new Color(fromHex2(str, pos), fromHex2(str, pos + 2), fromHex2(str, pos + 4), fromHex2(str, pos + 6));
|
||||
throw new IllegalArgumentException("unsupported length:" + str);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Color fromHex(@Nullable String str, @Nullable Color defaultValue) {
|
||||
if (str == null) return defaultValue;
|
||||
try {
|
||||
return fromHex(str);
|
||||
}
|
||||
catch (Exception e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
private static int fromHex(@NotNull String str, int pos) {
|
||||
char ch = str.charAt(pos);
|
||||
if (ch >= '0' && ch <= '9') return ch - '0';
|
||||
if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10;
|
||||
if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10;
|
||||
throw new IllegalArgumentException("unsupported char at " + pos + ":" + str);
|
||||
}
|
||||
|
||||
private static int fromHex1(@NotNull String str, int pos) {
|
||||
return 17 * fromHex(str, pos);
|
||||
}
|
||||
|
||||
private static int fromHex2(@NotNull String str, int pos) {
|
||||
return 16 * fromHex(str, pos) + fromHex(str, pos + 1);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public interface Colors {
|
||||
|
||||
Color DARK_RED = new Color(140, 0, 0);
|
||||
Color DARK_GREEN = new Color(0, 140, 0);
|
||||
Color DARK_BLUE = new Color(0, 0, 140);
|
||||
|
||||
Color DISABLED_COLOR = Gray._150;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public interface FileColorName {
|
||||
String colorName();
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class Gradient {
|
||||
private final Color myStartColor;
|
||||
private final Color myEndColor;
|
||||
|
||||
public Gradient(Color startColor, Color endColor) {
|
||||
myStartColor = startColor;
|
||||
myEndColor = endColor;
|
||||
}
|
||||
|
||||
public Color getStartColor() {
|
||||
return myStartColor;
|
||||
}
|
||||
|
||||
public Color getEndColor() {
|
||||
return myEndColor;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.intellij.ui;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
|
||||
/**
|
||||
* An icon wrapping and painting another icon.
|
||||
*/
|
||||
public interface RetrievableIcon extends Icon {
|
||||
/**
|
||||
* Returns the wrapped icon.
|
||||
*/
|
||||
@Nullable
|
||||
Icon retrieveIcon();
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
|
||||
public class SeparatorOrientation {
|
||||
public static final SeparatorOrientation HORIZONTAL = new SeparatorOrientation("HORIZONTAL");
|
||||
public static final SeparatorOrientation VERTICAL = new SeparatorOrientation("VERTICAL");
|
||||
|
||||
private final String myName; // for debug only
|
||||
|
||||
private SeparatorOrientation(String name) {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.ui.mac.foundation;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
|
||||
/**
|
||||
* Could be an address in memory (if pointer to a class or method) or a value (like 0 or 1)
|
||||
*
|
||||
* User: spLeaner
|
||||
*/
|
||||
public class ID extends NativeLong {
|
||||
|
||||
public ID() {
|
||||
}
|
||||
|
||||
public ID(long peer) {
|
||||
super(peer);
|
||||
}
|
||||
|
||||
public static final ID NIL = new ID(0);
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.ui.mac.foundation;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
|
||||
/**
|
||||
* @author spleaner
|
||||
*/
|
||||
public class Selector extends NativeLong {
|
||||
|
||||
private String myName;
|
||||
|
||||
public Selector() {
|
||||
this("undefined selector", 0);
|
||||
}
|
||||
|
||||
public Selector(String name, long value) {
|
||||
super(value);
|
||||
myName = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("[Selector %s]", myName);
|
||||
}
|
||||
|
||||
public Selector initName(final String name) {
|
||||
myName = name;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.text;
|
||||
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
@SuppressWarnings("ClassNameSameAsAncestorName")
|
||||
public interface Matcher extends NameUtil.Matcher {
|
||||
@Override
|
||||
boolean matches(@NotNull String name);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
// 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.text;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NameUtilCore {
|
||||
/**
|
||||
* Splits an identifier into words, separated with underscores or upper-case characters
|
||||
* (camel-case).
|
||||
*
|
||||
* @param name the identifier to split.
|
||||
* @return the array of strings into which the identifier has been split.
|
||||
*/
|
||||
@NotNull
|
||||
public static String[] splitNameIntoWords(@NotNull String name) {
|
||||
final String[] underlineDelimited = name.split("_");
|
||||
List<String> result = new ArrayList<>();
|
||||
for (String word : underlineDelimited) {
|
||||
addAllWords(word, result);
|
||||
}
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
private static void addAllWords(@NotNull String text, @NotNull List<? super String> result) {
|
||||
int start = 0;
|
||||
while (start < text.length()) {
|
||||
int next = nextWord(text, start);
|
||||
result.add(text.substring(start, next));
|
||||
start = next;
|
||||
}
|
||||
}
|
||||
|
||||
public static int nextWord(@NotNull String text, int start) {
|
||||
if (!Character.isLetterOrDigit(text.charAt(start))) {
|
||||
return start + 1;
|
||||
}
|
||||
|
||||
int i = start;
|
||||
while (i < text.length() && Character.isDigit(text.charAt(i))) i++;
|
||||
if (i > start) {
|
||||
// digits form a separate hump
|
||||
return i;
|
||||
}
|
||||
|
||||
while (i < text.length() && Character.isUpperCase(text.charAt(i))) i++;
|
||||
|
||||
if (i > start + 1) {
|
||||
// several consecutive uppercase letter form a hump
|
||||
if (i == text.length() || !Character.isLetter(text.charAt(i))) {
|
||||
return i;
|
||||
}
|
||||
return i - 1;
|
||||
}
|
||||
|
||||
if (i == start) i++;
|
||||
while (i < text.length() && Character.isLetter(text.charAt(i)) && !isWordStart(text, i)) i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
public static boolean isWordStart(String text, int i) {
|
||||
char c = text.charAt(i);
|
||||
if (Character.isUpperCase(c)) {
|
||||
if (i > 0 && Character.isUpperCase(text.charAt(i - 1))) {
|
||||
// check that we're not in the middle of an all-caps word
|
||||
return i + 1 < text.length() && Character.isLowerCase(text.charAt(i + 1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (Character.isDigit(c)) {
|
||||
return true;
|
||||
}
|
||||
if (!Character.isLetter(c)) {
|
||||
return false;
|
||||
}
|
||||
return i == 0 || !Character.isLetterOrDigit(text.charAt(i - 1)) || isHardCodedWordStart(text, i);
|
||||
}
|
||||
|
||||
private static boolean isHardCodedWordStart(String text, int i) {
|
||||
return text.charAt(i) == 'l' &&
|
||||
i < text.length() - 1 && text.charAt(i + 1) == 'n' &&
|
||||
(text.length() == i + 2 || isWordStart(text, i + 2));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String[] nameToWords(@NotNull String name) {
|
||||
List<String> array = new ArrayList<>();
|
||||
int index = 0;
|
||||
|
||||
while (index < name.length()) {
|
||||
int wordStart = index;
|
||||
int upperCaseCount = 0;
|
||||
int lowerCaseCount = 0;
|
||||
int digitCount = 0;
|
||||
int specialCount = 0;
|
||||
while (index < name.length()) {
|
||||
char c = name.charAt(index);
|
||||
if (Character.isDigit(c)) {
|
||||
if (upperCaseCount > 0 || lowerCaseCount > 0 || specialCount > 0) break;
|
||||
digitCount++;
|
||||
}
|
||||
else if (Character.isUpperCase(c)) {
|
||||
if (lowerCaseCount > 0 || digitCount > 0 || specialCount > 0) break;
|
||||
upperCaseCount++;
|
||||
}
|
||||
else if (Character.isLowerCase(c)) {
|
||||
if (digitCount > 0 || specialCount > 0) break;
|
||||
if (upperCaseCount > 1) {
|
||||
index--;
|
||||
break;
|
||||
}
|
||||
lowerCaseCount++;
|
||||
}
|
||||
else {
|
||||
if (upperCaseCount > 0 || lowerCaseCount > 0 || digitCount > 0) break;
|
||||
specialCount++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
String word = name.substring(wordStart, index);
|
||||
if (!StringUtil.isEmptyOrSpaces(word)) {
|
||||
array.add(word);
|
||||
}
|
||||
}
|
||||
return ArrayUtil.toStringArray(array);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
|
||||
|
||||
public abstract class AbstractTableCellEditor extends AbstractCellEditor implements TableCellEditor{
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
public interface ClientPropertyHolder {
|
||||
|
||||
void putClientProperty(@NonNls String key, @NonNls Object value);
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public interface EditableModel extends ItemRemovable {
|
||||
void addRow();
|
||||
|
||||
void exchangeRows(int oldIndex, int newIndex);
|
||||
|
||||
boolean canExchangeRows(int oldIndex, int newIndex);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public interface EditableTreeModel {
|
||||
/**
|
||||
* Adds a new node into a
|
||||
* @param parentOrNeighbour selected node, maybe used as parent or as a neighbour
|
||||
* @return path to newly created element
|
||||
*/
|
||||
TreePath addNode(TreePath parentOrNeighbour);
|
||||
|
||||
void removeNode(TreePath path);
|
||||
void removeNodes(Collection<? extends TreePath> path);
|
||||
|
||||
void moveNodeTo(TreePath parentOrNeighbour);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public interface ElementProducer<E> {
|
||||
E createElement();
|
||||
boolean canCreateElement();
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import java.awt.datatransfer.ClipboardOwner;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class EmptyClipboardOwner implements ClipboardOwner {
|
||||
public static EmptyClipboardOwner INSTANCE = new EmptyClipboardOwner();
|
||||
|
||||
private EmptyClipboardOwner() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lostOwnership(Clipboard clipboard, Transferable contents) {
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
public class Html {
|
||||
|
||||
private final String myText;
|
||||
private boolean myKeepFont = false;
|
||||
|
||||
public Html(String text) {
|
||||
myText = text;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return myText;
|
||||
}
|
||||
|
||||
public Html setKeepFont(boolean keepFont) {
|
||||
myKeepFont = keepFont;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKeepFont() {
|
||||
return myKeepFont;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import apple.awt.CImage;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
class IsRetina {
|
||||
public static boolean isRetina() {
|
||||
try {
|
||||
final boolean[] isRetina = new boolean[1];
|
||||
new CImage.HiDPIScaledImage(1, 1, BufferedImage.TYPE_INT_ARGB) {
|
||||
@Override
|
||||
public void drawIntoImage(BufferedImage image, float v) {
|
||||
isRetina[0] = v > 1;
|
||||
}
|
||||
};
|
||||
return isRetina[0];
|
||||
}
|
||||
catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
/**
|
||||
* Implement this interface in {@link javax.swing.table.TableModel}'s implementation if it supports removal of items. This will allow using
|
||||
* utility methods to remove items from the table.
|
||||
*
|
||||
* @see com.intellij.ui.TableUtil#removeSelectedItems(javax.swing.JTable)
|
||||
*/
|
||||
public interface ItemRemovable {
|
||||
/**
|
||||
* Remove row with index {@code idx} and fire {@link javax.swing.event.TableModelEvent#DELETE DELETE} event (e.g. by calling
|
||||
* {@link javax.swing.table.AbstractTableModel#fireTableRowsDeleted(int, int)})
|
||||
*/
|
||||
void removeRow(int idx);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
/**
|
||||
* HiDPI-aware image icon
|
||||
*
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class JBImageIcon extends ImageIcon {
|
||||
public JBImageIcon(@NotNull Image image) {
|
||||
super(image);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void paintIcon(final Component c, final Graphics g, final int x, final int y) {
|
||||
final ImageObserver observer = getImageObserver();
|
||||
|
||||
UIUtil.drawImage(g, getImage(), x, y, observer == null ? c : observer);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class JBPoint extends Point {
|
||||
public JBPoint(@NotNull Point p) {
|
||||
super(p instanceof JBPoint ? p : new JBPoint(p.x, p.y));
|
||||
}
|
||||
|
||||
public JBPoint(int x, int y) {
|
||||
super(JBUI.scale(x), JBUI.scale(y));
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import com.intellij.ui.JBColor;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class PlatformColors {
|
||||
public static final Color BLUE = JBColor.BLUE;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author Eugene Belyaev
|
||||
* @deprecated use com.intellij.ui.Gray
|
||||
*/
|
||||
@Deprecated
|
||||
public class SameColor extends Color {
|
||||
public SameColor(int i) {
|
||||
super(i, i, i);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public interface SortableColumnModel {
|
||||
ColumnInfo[] getColumnInfos();
|
||||
|
||||
void setSortable(boolean aBoolean);
|
||||
|
||||
boolean isSortable();
|
||||
|
||||
Object getRowValue(int row);
|
||||
|
||||
@Nullable
|
||||
RowSorter.SortKey getDefaultSortKey();
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class TableViewModel<Item> extends AbstractTableModel implements SortableColumnModel {
|
||||
public abstract void setItems(@NotNull List<Item> items);
|
||||
@NotNull
|
||||
public abstract List<Item> getItems();
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.JBColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
/**
|
||||
* @author Vassiliy Kudryashov
|
||||
* @author Konstantin Bulenkov
|
||||
*
|
||||
* @deprecated use {@link com.intellij.util.ui.ColorsIcon} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public class TwoColorsIcon extends ColorsIcon {
|
||||
public TwoColorsIcon(int size, @Nullable Color color1, @Nullable Color secondColor) {
|
||||
super(size, color1, secondColor);
|
||||
}
|
||||
|
||||
protected TwoColorsIcon(TwoColorsIcon icon) {
|
||||
super(icon);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public TwoColorsIcon copy() {
|
||||
return new TwoColorsIcon(this);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.util.ui.components;
|
||||
|
||||
import com.intellij.util.ui.JBFont;
|
||||
|
||||
import javax.swing.border.Border;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public interface JBComponent<T extends JBComponent> {
|
||||
T withBorder(Border border);
|
||||
|
||||
T withFont(JBFont font);
|
||||
|
||||
T andTransparent();
|
||||
|
||||
T andOpaque();
|
||||
}
|
||||
+1
-15
@@ -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.openapi.ui;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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.ui;
|
||||
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class DescriptionLabel extends JLabel {
|
||||
|
||||
public DescriptionLabel(@Nullable String text) {
|
||||
setText(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
setForeground(UIUtil.getLabelDisabledForeground());
|
||||
int size = getFont().getSize();
|
||||
if (size >= 12) {
|
||||
size -= 2;
|
||||
}
|
||||
setFont(getFont().deriveFont((float)size));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// 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.ui;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public abstract class Divider extends JPanel {
|
||||
public Divider(LayoutManager layout) {
|
||||
super(layout);
|
||||
}
|
||||
|
||||
public abstract void setResizeEnabled(boolean resizeEnabled);
|
||||
|
||||
public abstract void setSwitchOrientationEnabled(boolean switchOrientationEnabled);
|
||||
|
||||
public abstract void setOrientation(boolean vertical);
|
||||
}
|
||||
+1
-15
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* 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.ui;
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// 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.ui;
|
||||
|
||||
import com.intellij.openapi.util.Condition;
|
||||
@@ -0,0 +1,27 @@
|
||||
// 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.ui;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public interface NullableComponent {
|
||||
|
||||
boolean isNull();
|
||||
|
||||
class Check {
|
||||
private Check() {
|
||||
}
|
||||
|
||||
public static boolean isNull(Component c) {
|
||||
return c == null || c instanceof NullableComponent && ((NullableComponent)c).isNull();
|
||||
}
|
||||
|
||||
public static boolean isNullOrHidden(Component c) {
|
||||
return c != null && !c.isShowing() || isNull(c);
|
||||
}
|
||||
|
||||
public static boolean isNotNullAndVisible(Component c) {
|
||||
return !isNull(c) && c.isVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* 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.openapi.ui;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -62,7 +48,7 @@ public class PseudoSplitter extends Splitter {
|
||||
boolean firstIsFixed = myFirstIsFixed;
|
||||
myFirstIsFixed = false;
|
||||
super.setProportion(proportion);
|
||||
|
||||
|
||||
int total = getSizeForComp(this);
|
||||
if (firstIsFixed) {
|
||||
myFirstFixedSize = (int) (myProportion * (total - getDividerWidth()));
|
||||
@@ -0,0 +1,27 @@
|
||||
// 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.ui;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public interface Splittable {
|
||||
float getMinProportion(boolean first);
|
||||
|
||||
void setProportion(float proportion);
|
||||
|
||||
/**
|
||||
* @return {@code true} if splitter has vertical orientation, {@code false} otherwise
|
||||
*/
|
||||
boolean getOrientation();
|
||||
|
||||
/**
|
||||
* @param verticalSplit {@code true} means that splitter will have vertical split
|
||||
*/
|
||||
void setOrientation(boolean verticalSplit);
|
||||
|
||||
@NotNull
|
||||
Component asComponent();
|
||||
|
||||
void setDragging(boolean dragging);
|
||||
}
|
||||
+1
-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.openapi.ui;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
+1
-15
@@ -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.openapi.ui;
|
||||
|
||||
import com.intellij.util.ui.JBInsets;
|
||||
+20
-16
@@ -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.util;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -10,11 +10,14 @@ import com.intellij.ui.RetrievableIcon;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.FixedHashMap;
|
||||
import com.intellij.util.ui.*;
|
||||
import com.intellij.util.ui.JBUIScale.ScaleContextSupport;
|
||||
import com.intellij.util.ui.JBUIScale.UserScaleContext.UpdateListener;
|
||||
import com.intellij.util.ui.ImageUtil;
|
||||
import com.intellij.util.ui.JBImageIcon;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.JBUIScale.ScaleContext;
|
||||
import com.intellij.util.ui.JBUIScale.ScaleContextAware;
|
||||
import com.intellij.util.ui.JBUIScale.ScaleContextSupport;
|
||||
import com.intellij.util.ui.JBUIScale.UserScaleContext.UpdateListener;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -36,7 +39,8 @@ import java.util.function.Supplier;
|
||||
import static com.intellij.ui.paint.PaintUtil.RoundingMode.ROUND;
|
||||
import static com.intellij.util.ui.JBUIScale.DerivedScaleType.DEV_SCALE;
|
||||
import static com.intellij.util.ui.JBUIScale.DerivedScaleType.EFF_USR_SCALE;
|
||||
import static com.intellij.util.ui.JBUIScale.ScaleType.*;
|
||||
import static com.intellij.util.ui.JBUIScale.ScaleType.OBJ_SCALE;
|
||||
import static com.intellij.util.ui.JBUIScale.ScaleType.SYS_SCALE;
|
||||
|
||||
public final class IconLoader {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.util.IconLoader");
|
||||
@@ -49,7 +53,7 @@ public final class IconLoader {
|
||||
* This cache contains mapping between icons and disabled icons.
|
||||
*/
|
||||
private static final Map<Icon, Icon> ourIcon2DisabledIcon = ContainerUtil.createWeakMap(200);
|
||||
|
||||
|
||||
private static volatile boolean STRICT_GLOBAL;
|
||||
private static final ThreadLocal<Boolean> STRICT_LOCAL = new ThreadLocal<Boolean>() {
|
||||
@Override
|
||||
@@ -92,7 +96,7 @@ public final class IconLoader {
|
||||
public static void setStrictGlobally(boolean strict) {
|
||||
STRICT_GLOBAL = strict;
|
||||
}
|
||||
|
||||
|
||||
private static void updateTransform(Function<? super IconTransform, ? extends IconTransform> updater) {
|
||||
IconTransform prev, next;
|
||||
do {
|
||||
@@ -690,7 +694,7 @@ public final class IconLoader {
|
||||
private Icon createWithFilter(@NotNull Supplier<? extends RGBImageFilter> filterSupplier) {
|
||||
return new CachedImageIcon(myOriginalPath, myResolver, myDarkOverridden, myUseCacheOnLoad, myTransform, filterSupplier);
|
||||
}
|
||||
|
||||
|
||||
private boolean isDark() {
|
||||
return myDarkOverridden == null ? myTransform.isDark() : myDarkOverridden;
|
||||
}
|
||||
@@ -791,7 +795,7 @@ public final class IconLoader {
|
||||
@Nullable private final ClassLoader myClassLoader;
|
||||
@Nullable private final String myOverriddenPath;
|
||||
@NotNull private final HandleNotFound myHandleNotFound;
|
||||
// Every myUrl write is performed before isResolved write (see resolve())
|
||||
// Every myUrl write is performed before isResolved write (see resolve())
|
||||
// and every myUrl read is performed after isResolved read (see getUrl()), thus
|
||||
// no necessary to declare myUrl as volatile: happens-before is established via isResolved.
|
||||
@Nullable private URL myUrl;
|
||||
@@ -1007,33 +1011,33 @@ public final class IconLoader {
|
||||
myPatchers = patchers;
|
||||
myFilter = filter;
|
||||
}
|
||||
|
||||
|
||||
public boolean isDark() {
|
||||
return myDark;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public ImageFilter getFilter() {
|
||||
return myFilter;
|
||||
}
|
||||
|
||||
|
||||
public IconTransform withPathPatcher(IconPathPatcher patcher) {
|
||||
return new IconTransform(myDark, ArrayUtil.append(myPatchers, patcher), myFilter);
|
||||
}
|
||||
|
||||
|
||||
public IconTransform withoutPathPatcher(IconPathPatcher patcher) {
|
||||
IconPathPatcher[] newPatchers = ArrayUtil.remove(myPatchers, patcher);
|
||||
return newPatchers == myPatchers ? this : new IconTransform(myDark, newPatchers, myFilter);
|
||||
}
|
||||
|
||||
|
||||
public IconTransform withFilter(ImageFilter filter) {
|
||||
return filter == myFilter ? this : new IconTransform(myDark, myPatchers, filter);
|
||||
}
|
||||
|
||||
|
||||
public IconTransform withDark(boolean dark) {
|
||||
return dark == myDark ? this : new IconTransform(dark, myPatchers, myFilter);
|
||||
}
|
||||
|
||||
|
||||
public Pair<String, ClassLoader> patchPath(@NotNull String path, ClassLoader classLoader) {
|
||||
for (IconPathPatcher patcher : myPatchers) {
|
||||
String newPath = patcher.patchPath(path, classLoader);
|
||||
@@ -0,0 +1,15 @@
|
||||
// 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.util;
|
||||
|
||||
import com.intellij.util.ui.update.ComparableObject;
|
||||
|
||||
public abstract class IdRunnable extends ComparableObject.Impl implements Runnable {
|
||||
|
||||
public IdRunnable(Object object) {
|
||||
super(object);
|
||||
}
|
||||
|
||||
public IdRunnable(Object[] objects) {
|
||||
super(objects);
|
||||
}
|
||||
}
|
||||
+1
-15
@@ -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.intellij.openapi.util.registry.ui;
|
||||
|
||||
import com.intellij.openapi.ui.CheckBoxWithDescription;
|
||||
+3
-17
@@ -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.openapi.wm;
|
||||
|
||||
import com.intellij.reference.SoftReference;
|
||||
@@ -129,7 +115,7 @@ public class FocusWatcher implements ContainerListener,FocusListener{
|
||||
myTopComponent = new WeakReference<>(component);
|
||||
installImpl(component);
|
||||
}
|
||||
|
||||
|
||||
private void installImpl(Component component){
|
||||
if(component instanceof Container){
|
||||
Container container=(Container)component;
|
||||
@@ -180,7 +166,7 @@ public class FocusWatcher implements ContainerListener,FocusListener{
|
||||
* @param cause
|
||||
*/
|
||||
protected void focusedComponentChanged(Component component, @Nullable final AWTEvent cause){}
|
||||
|
||||
|
||||
protected void focusLostImpl(final FocusEvent e){}
|
||||
|
||||
private void setFocusedComponent(final Component focusedComponent) {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user