summaryrefslogtreecommitdiff
path: root/enigma-swing/src/main/java/cuchaz
diff options
context:
space:
mode:
authorGravatar Joe2025-08-21 02:39:03 +0100
committerGravatar modmuss2025-09-13 09:14:23 +0100
commitb7427210851202a748ae0e25693f19e01b2afc4a (patch)
treec43d7e6ad91e262c651b49accf43c393493beda7 /enigma-swing/src/main/java/cuchaz
parentFix threading issues in ClassHandleProvider that are likely to come up if a p... (diff)
downloadenigma-fork-b7427210851202a748ae0e25693f19e01b2afc4a.tar.gz
enigma-fork-b7427210851202a748ae0e25693f19e01b2afc4a.tar.xz
enigma-fork-b7427210851202a748ae0e25693f19e01b2afc4a.zip
Add ProjectService to listen for the project lifecycle
Diffstat (limited to 'enigma-swing/src/main/java/cuchaz')
-rw-r--r--enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java
index a9795bc..9faa0d0 100644
--- a/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java
+++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java
@@ -49,6 +49,7 @@ import cuchaz.enigma.analysis.StructureTreeOptions;
49import cuchaz.enigma.api.DataInvalidationEvent; 49import cuchaz.enigma.api.DataInvalidationEvent;
50import cuchaz.enigma.api.DataInvalidationListener; 50import cuchaz.enigma.api.DataInvalidationListener;
51import cuchaz.enigma.api.service.ObfuscationTestService; 51import cuchaz.enigma.api.service.ObfuscationTestService;
52import cuchaz.enigma.api.service.ProjectService;
52import cuchaz.enigma.api.view.GuiView; 53import cuchaz.enigma.api.view.GuiView;
53import cuchaz.enigma.api.view.entry.EntryReferenceView; 54import cuchaz.enigma.api.view.entry.EntryReferenceView;
54import cuchaz.enigma.classhandle.ClassHandle; 55import cuchaz.enigma.classhandle.ClassHandle;
@@ -133,11 +134,15 @@ public class GuiController implements ClientPacketHandler, GuiView, DataInvalida
133 this.gui.onStartOpenJar(); 134 this.gui.onStartOpenJar();
134 135
135 return ProgressDialog.runOffThread(gui.getFrame(), progress -> { 136 return ProgressDialog.runOffThread(gui.getFrame(), progress -> {
136 project = enigma.openJars(jarPaths, new ClasspathClassProvider(), progress); 137 project = enigma.openJars(jarPaths, new ClasspathClassProvider(), progress, false);
137 project.addDataInvalidationListener(this); 138 project.addDataInvalidationListener(this);
138 indexTreeBuilder = new IndexTreeBuilder(project.getJarIndex()); 139 indexTreeBuilder = new IndexTreeBuilder(project.getJarIndex());
139 chp = new ClassHandleProvider(project, UiConfig.getDecompiler().service); 140 chp = new ClassHandleProvider(project, UiConfig.getDecompiler().service);
140 SwingUtilities.invokeLater(() -> { 141 SwingUtilities.invokeLater(() -> {
142 for (ProjectService projectService : enigma.getServices().get(ProjectService.TYPE)) {
143 projectService.onProjectOpen(project);
144 }
145
141 gui.onFinishOpenJar(getFileNames(jarPaths)); 146 gui.onFinishOpenJar(getFileNames(jarPaths));
142 refreshClasses(); 147 refreshClasses();
143 }); 148 });
@@ -152,6 +157,10 @@ public class GuiController implements ClientPacketHandler, GuiView, DataInvalida
152 } 157 }
153 158
154 public void closeJar() { 159 public void closeJar() {
160 for (ProjectService projectService : enigma.getServices().get(ProjectService.TYPE)) {
161 projectService.onProjectClose(project);
162 }
163
155 this.chp.destroy(); 164 this.chp.destroy();
156 this.chp = null; 165 this.chp = null;
157 this.project = null; 166 this.project = null;