1
0
mirror of https://github.com/chylex/IntelliJ-Colored-Icons.git synced 2025-04-11 05:15:48 +02:00

Force LF line endings & fix code inspections

This commit is contained in:
chylex 2020-09-03 11:16:30 +02:00
parent 9edd8374a3
commit 7f898593c1
3 changed files with 16 additions and 15 deletions
.gitattributes
src/com/chylex/intellij/coloredicons

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto eol=lf

View File

@ -11,20 +11,20 @@ import java.util.Set;
final class BuildHelpers{
static final class FixSVG{
public static void main(String[] args) throws IOException{
Charset charset = StandardCharsets.UTF_8;
String encoding = charset.name();
public static void main(final String[] args) throws IOException{
final Charset charset = StandardCharsets.UTF_8;
final String encoding = charset.name();
String svg12Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\">";
String svg13Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 13 13\">";
String svg16Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\">";
final String svg12Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\">";
final String svg13Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 13 13\">";
final String svg16Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\">";
Set<String> svgTags = new HashSet<>(Arrays.asList(
final Set<String> svgTags = new HashSet<>(Arrays.asList(
svg12Tag, svg13Tag, svg16Tag
));
for(File file : FileUtils.listFiles(new File("./resources/icons"), new String[]{ "svg" }, true)){
List<String> lines = FileUtils.readLines(file, charset);
for(final File file : FileUtils.listFiles(new File("./resources/icons"), new String[]{ "svg" }, true)){
final List<String> lines = FileUtils.readLines(file, charset);
if (lines.get(0).startsWith("<?xml")){
lines.remove(0);
@ -34,7 +34,7 @@ final class BuildHelpers{
lines.remove(0);
}
String svg = lines.get(0);
final String svg = lines.get(0);
if (svg.startsWith("<svg width=\"100%\" height=\"100%\" viewBox=\"0 0 13 13\"")){
lines.set(0, svg13Tag);

View File

@ -114,20 +114,20 @@ public class IconPatcher extends IconPathPatcher{
IconLoader.installPathPatcher(this);
}
private void addPathWithDark(String path){
iconPaths.put("/" + path + ".svg", "/icons/" + path + ".svg");
iconPaths.put("/" + path + "_dark.svg", "/icons/" + path + "_dark.svg");
private void addPathWithDark(final String path){
iconPaths.put('/' + path + ".svg", "/icons/" + path + ".svg");
iconPaths.put('/' + path + "_dark.svg", "/icons/" + path + "_dark.svg");
}
@Nullable
@Override
public String patchPath(@NotNull String path, ClassLoader classLoader){
public String patchPath(@NotNull final String path, final ClassLoader classLoaderIgnore){
return iconPaths.get(path);
}
@Nullable
@Override
public ClassLoader getContextClassLoader(@NotNull String path, ClassLoader originalClassLoader){
public ClassLoader getContextClassLoader(@NotNull final String path, final ClassLoader originalClassLoader){
return classLoader;
}
}