mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 05:21:09 +00:00
Added #2306 Export to VS Code project
This commit is contained in:
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.configuration.ConfigurationItemChangeListener;
|
||||
import com.jpexs.decompiler.flash.console.ContextMenuTools;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfFlashDevelopExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfIntelliJIdeaExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfVsCodeExporter;
|
||||
import com.jpexs.decompiler.flash.gui.debugger.DebuggerTools;
|
||||
import com.jpexs.decompiler.flash.gui.helpers.CheckResources;
|
||||
import com.jpexs.decompiler.flash.search.ScriptSearchResult;
|
||||
@@ -506,6 +507,17 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
mainFrame.getPanel().exportIdea((SWF) openable);
|
||||
}
|
||||
|
||||
protected void exportVsCodeActionPerformed(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
if (mainFrame.getPanel().checkEdited()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainFrame.getPanel().exportVsCode((SWF) openable);
|
||||
}
|
||||
|
||||
protected void exportFlaActionPerformed(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
@@ -1005,10 +1017,12 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
boolean isAs3 = false;
|
||||
boolean canExportFlashDevelop = false;
|
||||
boolean canExportIdea = false;
|
||||
boolean canExportVsCode = false;
|
||||
if (swf != null) {
|
||||
isAs3 = swf.isAS3();
|
||||
canExportFlashDevelop = SwfFlashDevelopExporter.canExportSwf(swf);
|
||||
canExportIdea = SwfIntelliJIdeaExporter.canExportSwf(swf);
|
||||
canExportVsCode = SwfVsCodeExporter.canExportSwf(swf);
|
||||
}
|
||||
if (abcSelected) {
|
||||
isAs3 = true;
|
||||
@@ -1085,6 +1099,8 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
setMenuEnabled("/file/export/exportFlashDevelop", allSameSwf && openableSelected && isAs3 && !isWorking && canExportFlashDevelop);
|
||||
setMenuEnabled("_/exportIdea", swfSelected && !isWorking && canExportIdea);
|
||||
setMenuEnabled("/file/export/exportIdea", allSameSwf && openableSelected && isAs3 && !isWorking && canExportIdea);
|
||||
setMenuEnabled("_/exportVsCode", swfSelected && !isWorking && canExportVsCode);
|
||||
setMenuEnabled("/file/export/exportVsCode", allSameSwf && openableSelected && isAs3 && !isWorking && canExportVsCode);
|
||||
setMenuEnabled("_/exportSelected", openableSelected && !isWorking);
|
||||
setMenuEnabled("/file/export/exportSelected", openableSelected && !isWorking);
|
||||
setMenuEnabled("/file/export/exportXml", swfSelected && !isWorking);
|
||||
@@ -1185,6 +1201,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
addMenuItem("_/exportFla", translate("menu.file.export.fla"), "exportfla32", this::exportFlaActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("_/exportFlashDevelop", translate("menu.file.export.flashDevelop"), "exportflashdevelop32", this::exportFlashDevelopActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("_/exportIdea", translate("menu.file.export.idea"), "exportidea32", this::exportIdeaActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("_/exportVsCode", translate("menu.file.export.vsCode"), "exportvscode32", this::exportVsCodeActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("_/exportAll", translate("menu.file.export.all"), "export32", this::exportAllActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("_/exportSelected", translate("menu.file.export.selection"), "exportsel32", this::exportSelectedActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addSeparator("_");
|
||||
@@ -1219,8 +1236,9 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
addMenuItem("/file/export", translate("menu.export"), null, null, 0, null, false, null, false);
|
||||
addMenuItem("/file/export/exportFla", translate("menu.file.export.fla"), "exportfla32", this::exportFlaActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("/file/export/exportFlashDevelop", translate("menu.file.export.flashDevelop"), "exportflashdevelop32", this::exportFlashDevelopActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("/file/export/exportIdea", translate("menu.file.export.idea"), "exportidea32", this::exportIdeaActionPerformed, PRIORITY_TOP, null, true, null, false);
|
||||
addMenuItem("/file/export/exportFlashDevelop", translate("menu.file.export.flashDevelop"), "exportflashdevelop32", this::exportFlashDevelopActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
|
||||
addMenuItem("/file/export/exportIdea", translate("menu.file.export.idea"), "exportidea32", this::exportIdeaActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
|
||||
addMenuItem("/file/export/exportVsCode", translate("menu.file.export.vsCode"), "exportvscode32", this::exportVsCodeActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
|
||||
addMenuItem("/file/export/exportXml", translate("menu.file.export.xml"), "exportxml32", this::exportXmlActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
|
||||
addMenuItem("/file/export/exportAll", translate("menu.file.export.all"), "export16", this::exportAllActionPerformed, PRIORITY_MEDIUM, null, true, new HotKey("CTRL+SHIFT+E"), false);
|
||||
addMenuItem("/file/export/exportSelected", translate("menu.file.export.selection"), "exportsel16", this::exportSelectedActionPerformed, PRIORITY_MEDIUM, null, true, null, false);
|
||||
|
||||
@@ -91,6 +91,7 @@ import com.jpexs.decompiler.flash.exporters.settings.TextExportSettings;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfFlashDevelopExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfIntelliJIdeaExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfJavaExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfVsCodeExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfXmlExporter;
|
||||
import com.jpexs.decompiler.flash.flexsdk.MxmlcAs3ScriptReplacer;
|
||||
import com.jpexs.decompiler.flash.gui.abc.ABCExplorerDialog;
|
||||
@@ -3499,6 +3500,79 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public void exportVsCode(final SWF swf) {
|
||||
if (swf == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
JFileChooser chooser = View.getFileChooserWithIcon("exportvscode");
|
||||
chooser.setCurrentDirectory(new File(Configuration.lastExportDir.get()));
|
||||
chooser.setDialogTitle(translate("export.project.select.directory"));
|
||||
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
chooser.setAcceptAllFileFilterUsed(false);
|
||||
if (chooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) {
|
||||
return;
|
||||
}
|
||||
final String fpath = Helper.fixDialogFile(chooser.getSelectedFile()).getAbsolutePath();
|
||||
Configuration.lastExportDir.set(Helper.fixDialogFile(chooser.getSelectedFile()).getAbsolutePath());
|
||||
SwfVsCodeExporter exporter = new SwfVsCodeExporter();
|
||||
|
||||
long timeBefore = System.currentTimeMillis();
|
||||
new CancellableWorker() {
|
||||
@Override
|
||||
protected Void doInBackground() throws Exception {
|
||||
Helper.freeMem();
|
||||
|
||||
CancellableWorker w = this;
|
||||
|
||||
ProgressListener prog = new ProgressListener() {
|
||||
@Override
|
||||
public void progress(int p) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void status(String status) {
|
||||
Main.startWork(translate("work.exporting.vsCode") + "..." + status, w);
|
||||
}
|
||||
};
|
||||
EventListener evl = swf.getExportEventListener();
|
||||
try {
|
||||
AbortRetryIgnoreHandler errorHandler = new GuiAbortRetryIgnoreHandler();
|
||||
exporter.exportVsCodeProject(swf, new File(fpath), false, errorHandler, evl);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "VsCode export error", ex);
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("error.export") + ": " + ex.getClass().getName() + " " + ex.getLocalizedMessage(), translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
Helper.freeMem();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
Main.startWork(translate("work.exporting.vsCode") + "...", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
Main.stopWork();
|
||||
long timeAfter = System.currentTimeMillis();
|
||||
final long timeMs = timeAfter - timeBefore;
|
||||
|
||||
View.execInEventDispatch(() -> {
|
||||
setStatus(translate("export.finishedin").replace("%time%", Helper.formatTimeSec(timeMs)));
|
||||
});
|
||||
|
||||
if (Configuration.openFolderAfterFlaExport.get()) {
|
||||
try {
|
||||
Desktop.getDesktop().open(new File(fpath).getAbsoluteFile().getParentFile());
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public void exportFla(final SWF swf) {
|
||||
if (swf == null) {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
@@ -967,14 +967,14 @@ warning.cleanAbc=This action will remove items from ABC which have zero usages -
|
||||
tagInfo.idType=Type of the id
|
||||
contextmenu.configurePathResolving=Configure path resolving...
|
||||
contextmenu.setAsLinkage=Set AS linkage
|
||||
contextmenu.exportFlashDevelop=Export FlashDevelop project
|
||||
contextmenu.exportFlashDevelop=Export to FlashDevelop
|
||||
filter.as3proj=FlashDevelop AS3 project (*.as3proj)
|
||||
work.exporting.flashDevelop=Exporting FlashDevelop project
|
||||
menu.file.export.flashDevelop=Export FD project
|
||||
contextmenu.exportIdea=Export IDEA project
|
||||
menu.file.export.flashDevelop=Export to FlashDevelop
|
||||
contextmenu.exportIdea=Export to IntelliJ IDEA
|
||||
filter.iml=IntelliJ IDEA projects (*.iml)
|
||||
work.exporting.idea=Exporting IntelliJ IDEA project
|
||||
menu.file.export.idea=Export IDEA project
|
||||
menu.file.export.idea=Export to IntelliJ IDEA
|
||||
contextmenu.exportFla=Export to FLA
|
||||
export.project.select.directory=Select location of the new project directory
|
||||
menu.file.saveAll=Save all
|
||||
@@ -996,4 +996,9 @@ addfunction.result.title=New method info
|
||||
filter.air.as3proj = FlashDevelop AIR AS3 project (*.as3proj)
|
||||
|
||||
packer.key.title = Key for: %packer%
|
||||
packer.key = Enter key for the packer "%packer%":
|
||||
packer.key = Enter key for the packer "%packer%":
|
||||
|
||||
#after 21.0.5
|
||||
contextmenu.exportVsCode=Export to VS Code
|
||||
work.exporting.vsCode=Exporting VS Code
|
||||
menu.file.export.vsCode=Export to VS Code
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.jpexs.decompiler.flash.configuration.CustomConfigurationKeys;
|
||||
import com.jpexs.decompiler.flash.configuration.SwfSpecificCustomConfiguration;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfFlashDevelopExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfIntelliJIdeaExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfVsCodeExporter;
|
||||
import com.jpexs.decompiler.flash.gui.AppDialog;
|
||||
import com.jpexs.decompiler.flash.gui.AppStrings;
|
||||
import com.jpexs.decompiler.flash.gui.AsLinkageDialog;
|
||||
@@ -217,6 +218,8 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
private JMenuItem exportFlashDevelopMenuItem;
|
||||
|
||||
private JMenuItem exportIdeaMenuItem;
|
||||
|
||||
private JMenuItem exportVsCodeMenuItem;
|
||||
|
||||
private JMenuItem exportSwfXmlMenuItem;
|
||||
|
||||
@@ -454,6 +457,11 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
exportIdeaMenuItem.addActionListener(this::exportIdeaActionPerformed);
|
||||
exportIdeaMenuItem.setIcon(View.getIcon("exportidea16"));
|
||||
add(exportIdeaMenuItem);
|
||||
|
||||
exportVsCodeMenuItem = new JMenuItem(mainPanel.translate("contextmenu.exportVsCode"));
|
||||
exportVsCodeMenuItem.addActionListener(this::exportVsCodeActionPerformed);
|
||||
exportVsCodeMenuItem.setIcon(View.getIcon("exportvscode16"));
|
||||
add(exportVsCodeMenuItem);
|
||||
|
||||
exportJavaSourceMenuItem = new JMenuItem(mainPanel.translate("contextmenu.exportJavaSource"));
|
||||
exportJavaSourceMenuItem.addActionListener(new ActionListener() {
|
||||
@@ -1213,6 +1221,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
exportFlaMenuItem.setVisible(false);
|
||||
exportFlashDevelopMenuItem.setVisible(false);
|
||||
exportIdeaMenuItem.setVisible(false);
|
||||
exportVsCodeMenuItem.setVisible(false);
|
||||
exportJavaSourceMenuItem.setVisible(allSelectedIsSwf);
|
||||
exportSwfXmlMenuItem.setVisible(allSelectedIsSwf);
|
||||
|
||||
@@ -1480,6 +1489,9 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
if (SwfIntelliJIdeaExporter.canExportSwf(swf)) {
|
||||
exportIdeaMenuItem.setVisible(true);
|
||||
}
|
||||
if (SwfVsCodeExporter.canExportSwf(swf)) {
|
||||
exportVsCodeMenuItem.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5544,6 +5556,11 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
SWF swf = (SWF) getCurrentItem().getOpenable();
|
||||
mainPanel.exportIdea(swf);
|
||||
}
|
||||
|
||||
public void exportVsCodeActionPerformed(ActionEvent evt) {
|
||||
SWF swf = (SWF) getCurrentItem().getOpenable();
|
||||
mainPanel.exportVsCode(swf);
|
||||
}
|
||||
|
||||
public void importScriptsActionPerformed(ActionEvent evt) {
|
||||
Openable openable = getCurrentItem().getOpenable();
|
||||
|
||||
Reference in New Issue
Block a user