Compare commits

..

3 commits

Author SHA1 Message Date
moehreag c784a8b286 merge main, add scrolling to report page, scroll pages to top 2024-06-12 19:28:39 +02:00
moehreag 9ed7490c0e Merge remote-tracking branch 'refs/remotes/origin/main' into TheKodeToad/rework-ui
# Conflicts:
#	src/main/java/dev/frogmc/frogloader/impl/gui/LoaderGui.java
2024-06-12 19:03:01 +02:00
moehreag fe32ccd2bd add inner class aw processing, make generic error gui scrollable
All checks were successful
Publish to snapshot maven / build (push) Successful in 18s
2024-06-11 23:42:04 +02:00
4 changed files with 29 additions and 8 deletions

View file

@ -4,6 +4,7 @@ import dev.frogmc.frogloader.impl.gui.component.DependencyErrorEntry;
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
import javax.swing.*;
import java.awt.*;
import java.util.Objects;
public class BreakingDepPage extends JScrollPane {
@ -47,6 +48,7 @@ public class BreakingDepPage extends JScrollPane {
list.add(result);
});
setViewportView(list);
SwingUtilities.invokeLater(() -> getViewport().setViewPosition(new Point()));
}
}

View file

@ -1,8 +1,7 @@
package dev.frogmc.frogloader.impl.gui.page;
import dev.frogmc.frogloader.impl.util.PlatformUtil;
import javax.swing.*;
import java.awt.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
@ -10,18 +9,24 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
public class ReportPage extends JTextPane {
public class ReportPage extends JScrollPane {
public ReportPage(Path reportPath) {
setEditable(false);
getHorizontalScrollBar().setUnitIncrement(16);
getVerticalScrollBar().setUnitIncrement(16);
JTextPane text = new JTextPane();
text.setEditable(false);
try {
setText(Files.readString(reportPath, StandardCharsets.UTF_8));
text.setText(Files.readString(reportPath, StandardCharsets.UTF_8));
} catch (IOException e) {
StringWriter writer = new StringWriter();
PrintWriter printer = new PrintWriter(writer);
printer.printf("Could not load contents of %s:%n", reportPath);
e.printStackTrace(printer);
}
setViewportView(text);
SwingUtilities.invokeLater(() -> getViewport().setViewPosition(new Point(0, 0)));
}
}

View file

@ -1,12 +1,11 @@
package dev.frogmc.frogloader.impl.gui.page;
import dev.frogmc.frogloader.impl.FrogLoaderImpl;
import dev.frogmc.frogloader.impl.gui.component.DependencyErrorEntry;
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
import dev.frogmc.frogloader.impl.mod.ModUtil;
import dev.frogmc.frogloader.impl.util.PlatformUtil;
import javax.swing.*;
import java.awt.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Objects;
@ -73,6 +72,7 @@ public class UnfulfilledDepPage extends JScrollPane {
});
setViewportView(list);
SwingUtilities.invokeLater(() -> getViewport().setViewPosition(new Point()));
}
}

View file

@ -91,6 +91,20 @@ public class AccessWidener {
}
return super.visitMethod(access, name, descriptor, signature, exceptions);
}
@Override
public void visitInnerClass(String name, String outerName, String innerName, int access) {
Entry e = classMap.get(name);
if (e != null) {
access &= ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC);
access |= e.type.access;
}
if (fields.containsKey(name) || methods.containsKey(name) || mutations.containsKey(name)) {
access &= ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC);
access |= Opcodes.ACC_PUBLIC;
}
super.visitInnerClass(name, outerName, innerName, access);
}
};
reader.accept(mapper, 0);
@ -139,7 +153,7 @@ public class AccessWidener {
public record Entry(AccessType type, String targetType, String className, String name, String descriptor) {
public Entry(String[] line) {
this(AccessType.of(line[0]), line[1], line[2], line[3], line[4]);
this(AccessType.of(line[0]), line[1], line[2], line.length > 3 ? line[3] : null, line.length > 4 ? line[4] : null);
}
public boolean isAccessGreaterThan(Entry other) {