diff options
| author | 2025-08-21 02:39:03 +0100 | |
|---|---|---|
| committer | 2025-09-13 09:14:23 +0100 | |
| commit | b7427210851202a748ae0e25693f19e01b2afc4a (patch) | |
| tree | c43d7e6ad91e262c651b49accf43c393493beda7 /enigma-swing/src/main/java/cuchaz | |
| parent | Fix threading issues in ClassHandleProvider that are likely to come up if a p... (diff) | |
| download | enigma-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.java | 11 |
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; | |||
| 49 | import cuchaz.enigma.api.DataInvalidationEvent; | 49 | import cuchaz.enigma.api.DataInvalidationEvent; |
| 50 | import cuchaz.enigma.api.DataInvalidationListener; | 50 | import cuchaz.enigma.api.DataInvalidationListener; |
| 51 | import cuchaz.enigma.api.service.ObfuscationTestService; | 51 | import cuchaz.enigma.api.service.ObfuscationTestService; |
| 52 | import cuchaz.enigma.api.service.ProjectService; | ||
| 52 | import cuchaz.enigma.api.view.GuiView; | 53 | import cuchaz.enigma.api.view.GuiView; |
| 53 | import cuchaz.enigma.api.view.entry.EntryReferenceView; | 54 | import cuchaz.enigma.api.view.entry.EntryReferenceView; |
| 54 | import cuchaz.enigma.classhandle.ClassHandle; | 55 | import 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; |