Skip to content

Commit 8339d23

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents ff58141 + 64fdb5e commit 8339d23

File tree

33 files changed

+586
-41
lines changed

33 files changed

+586
-41
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ indent_style = tab
1212

1313
[*.java]
1414
indent_style = tab
15+
ij_java_names_count_to_use_import_on_demand = 99
1516

1617
[*.tiny]
1718
indent_style = tab

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,3 +352,17 @@ The latest release of everyone's favourite program features major upgrades to bo
352352
day two bugfix release for my all name proposal girlies out there in the world
353353

354354
- fix an NPE that could occur when proposing a null mapping
355+
356+
# 2.6.2
357+
358+
A wealth of bugfixes brought to you by rai, iota, and friends. You'll be rich. Take my hand.
359+
360+
- fixed CFR and vineflower not allowing renames on methods named 'new'
361+
- fixed renames being started when pressing non-letter keys such as escape while hovering an entry (thanks [pitheguy](https://github.com/PiTheGuy)!)
362+
- fixed inheritance for JRE classes not being indexed
363+
- fixed a possible stack overflow in `IndexEntryResolver`
364+
- fixed an issue with similarly-named classes causing the token highlighter to explode (thanks [pitheguy](https://github.com/PiTheGuy)!)
365+
- fixed translations for mapping formats not properly displaying
366+
- fixed deobfuscation level icons not immediately updating after stat generation completes (thanks [pitheguy](https://github.com/PiTheGuy)!)
367+
- improved wording of some save dialogs (thanks [pitheguy](https://github.com/PiTheGuy)!)
368+
- improved `PackageIndex` javadoc

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ subprojects {
3131
}
3232

3333
group = 'net.ornithemc'
34-
version = '2.6.0'
34+
version = '2.6.1'
3535

3636
var ENV = System.getenv()
3737
version = version + (ENV.GITHUB_ACTIONS ? (ENV.SNAPSHOTS_URL ? "-SNAPSHOT" : "") : "+local")

buildSrc/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
1+
java {
2+
sourceCompatibility = JavaVersion.VERSION_17
3+
targetCompatibility = JavaVersion.VERSION_17
4+
}

enigma-swing/src/main/java/org/quiltmc/enigma/gui/Gui.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ public void close() {
532532
}
533533

534534
return null;
535-
}, I18n.translate("prompt.save"), I18n.translate("prompt.close.discard"), I18n.translate("prompt.cancel"));
535+
}, I18n.translate("prompt.close.save"), I18n.translate("prompt.close.discard"), I18n.translate("prompt.cancel"));
536536
}
537537
}
538538

enigma-swing/src/main/java/org/quiltmc/enigma/gui/GuiController.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import org.quiltmc.enigma.api.service.ReadWriteService;
1717
import org.quiltmc.enigma.api.translation.representation.entry.LocalVariableEntry;
1818
import org.quiltmc.enigma.gui.dialog.CrashDialog;
19+
import org.quiltmc.enigma.gui.docker.ClassesDocker;
20+
import org.quiltmc.enigma.gui.docker.CollabDocker;
21+
import org.quiltmc.enigma.gui.docker.Docker;
1922
import org.quiltmc.enigma.gui.network.IntegratedEnigmaClient;
2023
import org.quiltmc.enigma.impl.analysis.IndexTreeBuilder;
2124
import org.quiltmc.enigma.api.analysis.tree.MethodImplementationsTreeNode;
@@ -29,7 +32,6 @@
2932
import org.quiltmc.enigma.api.class_provider.ClasspathClassProvider;
3033
import org.quiltmc.enigma.gui.config.Config;
3134
import org.quiltmc.enigma.gui.dialog.ProgressDialog;
32-
import org.quiltmc.enigma.gui.docker.CollabDocker;
3335
import org.quiltmc.enigma.api.stats.StatType;
3436
import org.quiltmc.enigma.gui.util.History;
3537
import org.quiltmc.enigma.network.ClientPacketHandler;
@@ -83,7 +85,6 @@
8385
import java.util.ArrayList;
8486
import java.util.Collection;
8587
import java.util.List;
86-
import java.util.Locale;
8788
import java.util.Objects;
8889
import java.util.Set;
8990
import java.util.concurrent.CompletableFuture;
@@ -183,6 +184,13 @@ public CompletableFuture<Void> openMappings(ReadWriteService readWriteService, P
183184
ProgressListener progressListener = ProgressListener.createEmpty();
184185
this.gui.getMainWindow().getStatusBar().syncWith(progressListener);
185186
this.statsGenerator.generate(progressListener, EditableType.toStatTypes(this.gui.getEditableTypes()), false);
187+
188+
// ensure all class tree dockers show the update to the stats icons
189+
for (Docker docker : this.gui.getDockerManager().getActiveDockers().values()) {
190+
if (docker instanceof ClassesDocker) {
191+
docker.repaint();
192+
}
193+
}
186194
}).start();
187195
} catch (MappingParseException e) {
188196
JOptionPane.showMessageDialog(this.gui.getFrame(), e.getMessage());
@@ -220,7 +228,7 @@ public CompletableFuture<Void> saveMappings(Path path, ReadWriteService service)
220228
if (this.project == null) {
221229
return CompletableFuture.completedFuture(null);
222230
} else if (!service.supportsWriting()) {
223-
String nonWriteableMessage = I18n.translateFormatted("menu.file.save.non_writeable", I18n.translate("mapping_format." + service.getId().toLowerCase(Locale.ROOT)));
231+
String nonWriteableMessage = I18n.translateFormatted("menu.file.save.non_writeable", I18n.translate("mapping_format." + service.getId().split(":")[1].toLowerCase()));
224232
JOptionPane.showMessageDialog(this.gui.getFrame(), nonWriteableMessage, I18n.translate("menu.file.save.cannot_save"), JOptionPane.ERROR_MESSAGE);
225233
return CompletableFuture.completedFuture(null);
226234
}

enigma-swing/src/main/java/org/quiltmc/enigma/gui/docker/Dock.java

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.quiltmc.enigma.gui.docker.component.DockerSelector;
88
import org.quiltmc.enigma.gui.docker.component.Draggable;
99

10+
import javax.annotation.Nullable;
1011
import javax.swing.JPanel;
1112
import javax.swing.JSplitPane;
1213
import java.awt.BorderLayout;
@@ -17,7 +18,9 @@
1718
import java.awt.Rectangle;
1819
import java.awt.event.MouseEvent;
1920
import java.util.ArrayList;
21+
import java.util.HashMap;
2022
import java.util.List;
23+
import java.util.Map;
2124
import java.util.Objects;
2225

2326
/**
@@ -37,6 +40,9 @@ public class Dock extends JPanel {
3740
*/
3841
private Docker.VerticalLocation hovered;
3942
private boolean isSplit;
43+
/**
44+
* {@code null} if the view is currently split.
45+
*/
4046
private DockerContainer unifiedDock;
4147
private Docker toSave;
4248

@@ -145,7 +151,7 @@ public void host(Docker docker, Docker.VerticalLocation verticalLocation, boolea
145151
if (verticalLocation == Docker.VerticalLocation.BOTTOM || verticalLocation == Docker.VerticalLocation.TOP) {
146152
// if we'd be leaving empty space via opening, we want to host the docker as the full panel
147153
// this is to avoid wasting space
148-
if (avoidEmptySpace && ((this.isSplit && this.getDock(verticalLocation.inverse()).getHostedDocker() == null)
154+
if (avoidEmptySpace && ((this.isSplit && this.getContainer(verticalLocation.inverse()).getHostedDocker() == null)
149155
|| (!this.isSplit && this.unifiedDock.getHostedDocker() == null)
150156
|| (!this.isSplit && this.unifiedDock.getHostedDocker().getId().equals(docker.getId())))) {
151157
this.host(docker, Docker.VerticalLocation.FULL);
@@ -158,7 +164,7 @@ public void host(Docker docker, Docker.VerticalLocation verticalLocation, boolea
158164

159165
// preserve divider location and host
160166
int location = this.splitPane.getDividerLocation();
161-
this.getDock(verticalLocation).setHostedDocker(docker);
167+
this.getContainer(verticalLocation).setHostedDocker(docker);
162168
this.splitPane.setDividerLocation(location);
163169

164170
if (this.toSave != null && !this.toSave.equals(docker)) {
@@ -229,12 +235,12 @@ public void removeDocker(Docker.VerticalLocation location) {
229235

230236
private void removeDocker(Docker.VerticalLocation location, boolean avoidEmptySpace) {
231237
// do not leave empty dockers
232-
if (avoidEmptySpace && location != Docker.VerticalLocation.FULL && this.getDock(location.inverse()).getHostedDocker() != null) {
233-
this.host(this.getDock(location.inverse()).getHostedDocker(), Docker.VerticalLocation.FULL, false);
238+
if (avoidEmptySpace && location != Docker.VerticalLocation.FULL && this.getContainer(location.inverse()).getHostedDocker() != null) {
239+
this.host(this.getContainer(location.inverse()).getHostedDocker(), Docker.VerticalLocation.FULL, false);
234240
return;
235241
}
236242

237-
DockerContainer container = this.getDock(location);
243+
DockerContainer container = this.getContainer(location);
238244
if (container != null) {
239245
container.setHostedDocker(null);
240246
}
@@ -308,7 +314,24 @@ public boolean dropDockerFromMouse(Docker docker, MouseEvent event) {
308314
return false;
309315
}
310316

311-
public DockerContainer getDock(Docker.VerticalLocation verticalLocation) {
317+
/**
318+
* {@return a map of all hosted dockers, keyed by their locations}
319+
*/
320+
public Map<Docker.VerticalLocation, Docker> getHostedDockers() {
321+
Map<Docker.VerticalLocation, Docker> map = new HashMap<>();
322+
for (Docker.VerticalLocation verticalLocation : Docker.VerticalLocation.values()) {
323+
var container = this.getContainer(verticalLocation);
324+
325+
if (container != null && container.getHostedDocker() != null) {
326+
map.put(verticalLocation, container.getHostedDocker());
327+
}
328+
}
329+
330+
return map;
331+
}
332+
333+
@Nullable
334+
private DockerContainer getContainer(Docker.VerticalLocation verticalLocation) {
312335
return switch (verticalLocation) {
313336
case TOP -> this.topDock;
314337
case BOTTOM -> this.bottomDock;
@@ -368,6 +391,7 @@ private static class DockerContainer extends JPanel {
368391
this.hostedDocker = null;
369392
}
370393

394+
@Nullable
371395
public Docker getHostedDocker() {
372396
return this.hostedDocker;
373397
}

enigma-swing/src/main/java/org/quiltmc/enigma/gui/docker/DockerManager.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.HashMap;
77
import java.util.LinkedHashMap;
88
import java.util.Map;
9+
import java.util.stream.Collectors;
910

1011
public class DockerManager {
1112
private final Map<Class<? extends Docker>, Docker> dockers = new LinkedHashMap<>();
@@ -35,6 +36,25 @@ public Dock getLeftDock() {
3536
return this.leftDock;
3637
}
3738

39+
/**
40+
* {@return a map of all currently active dockers, keyed by their locations}
41+
*/
42+
public Map<Docker.Location, Docker> getActiveDockers() {
43+
Map<Docker.Location, Docker> activeDockers = new HashMap<>();
44+
45+
activeDockers.putAll(this.leftDock.getHostedDockers().entrySet().stream().collect(Collectors.toMap(
46+
entry -> new Docker.Location(Docker.Side.LEFT, entry.getKey()),
47+
Map.Entry::getValue
48+
)));
49+
50+
activeDockers.putAll(this.rightDock.getHostedDockers().entrySet().stream().collect(Collectors.toMap(
51+
entry -> new Docker.Location(Docker.Side.RIGHT, entry.getKey()),
52+
Map.Entry::getValue
53+
)));
54+
55+
return activeDockers;
56+
}
57+
3858
/**
3959
* Hosts a docker, making it visible, in the location provided.
4060
* @param docker the docker to be hosted

enigma-swing/src/main/java/org/quiltmc/enigma/gui/element/MenuBar.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ private void onSaveMappingsClicked() {
341341
this.gui.getController().saveMappings(this.gui.mappingsFileChooser.getSelectedFile().toPath());
342342
}
343343

344-
private void openMappingsDiscardPrompt(Runnable then) {
344+
private void openMappingsDiscardPrompt(Runnable then, boolean isReload) {
345345
if (this.gui.getController().isDirty()) {
346346
this.gui.showDiscardDiag((response -> {
347347
if (response == JOptionPane.YES_OPTION) {
@@ -351,22 +351,22 @@ private void openMappingsDiscardPrompt(Runnable then) {
351351
}
352352

353353
return null;
354-
}), I18n.translate("prompt.close.save"), I18n.translate("prompt.close.discard"), I18n.translate("prompt.cancel"));
354+
}), I18n.translate(isReload ? "prompt.close.save_and_reload" : "prompt.close.save"), I18n.translate("prompt.close.discard"), I18n.translate("prompt.cancel"));
355355
} else {
356356
then.run();
357357
}
358358
}
359359

360360
private void onCloseMappingsClicked() {
361-
this.openMappingsDiscardPrompt(() -> this.gui.getController().closeMappings());
361+
this.openMappingsDiscardPrompt(() -> this.gui.getController().closeMappings(), false);
362362
}
363363

364364
private void onReloadMappingsClicked() {
365-
this.openMappingsDiscardPrompt(() -> this.gui.getController().reloadMappings());
365+
this.openMappingsDiscardPrompt(() -> this.gui.getController().reloadMappings(), true);
366366
}
367367

368368
private void onReloadAllClicked() {
369-
this.openMappingsDiscardPrompt(() -> this.gui.getController().reloadAll());
369+
this.openMappingsDiscardPrompt(() -> this.gui.getController().reloadAll(), true);
370370
}
371371

372372
private void onExportSourceClicked() {
@@ -575,7 +575,7 @@ private static Path findCommonPath(Path a, Path b) {
575575
private static void prepareSaveMappingsAsMenu(JMenu saveMappingsAsMenu, JMenuItem saveMappingsItem, Gui gui) {
576576
for (ReadWriteService format : gui.getController().getEnigma().getReadWriteServices()) {
577577
if (format.supportsWriting()) {
578-
JMenuItem item = new JMenuItem(I18n.translate("mapping_format." + format.getId().toLowerCase(Locale.ROOT)));
578+
JMenuItem item = new JMenuItem(I18n.translate("mapping_format." + format.getId().split(":")[1].toLowerCase()));
579579
item.addActionListener(event -> {
580580
JFileChooser fileChooser = gui.mappingsFileChooser;
581581
ExtensionFileFilter.setupFileChooser(gui, fileChooser, format);

enigma-swing/src/main/java/org/quiltmc/enigma/gui/panel/EditorPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public void keyTyped(KeyEvent event) {
197197
if (ref == null) return;
198198
if (!EditorPanel.this.controller.getProject().isRenamable(ref)) return;
199199

200-
if (!event.isControlDown() && !event.isAltDown() && Character.isJavaIdentifierPart(event.getKeyChar())) {
200+
if (!event.isControlDown() && !event.isAltDown() && Character.isJavaIdentifierStart(event.getKeyChar())) {
201201
EnigmaProject project = gui.getController().getProject();
202202
EntryReference<Entry<?>, Entry<?>> reference = project.getRemapper().deobfuscate(EditorPanel.this.cursorReference);
203203
Entry<?> entry = reference.getNameableEntry();

0 commit comments

Comments
 (0)