diff --git a/src/com/jpexs/decompiler/flash/gui/locales/soleditor/SolEditorFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/soleditor/SolEditorFrame.properties index e33313c56..d8803415b 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/soleditor/SolEditorFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/soleditor/SolEditorFrame.properties @@ -2,6 +2,8 @@ dialog.title = Sol editor button.new = New button.open = Open... +button.open.npapi = Open NPAPI... +button.open.ppapi = Open PPAPI... button.save = Save button.saveAs = Save as... diff --git a/src/com/jpexs/decompiler/flash/gui/locales/soleditor/SolEditorFrame_zh.properties b/src/com/jpexs/decompiler/flash/gui/locales/soleditor/SolEditorFrame_zh.properties index f394d80ce..6b8b98119 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/soleditor/SolEditorFrame_zh.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/soleditor/SolEditorFrame_zh.properties @@ -1,6 +1,8 @@ dialog.title = \u5b58\u6863\u7f16\u8f91\u5668 button.new = \u65b0\u5efa button.open = \u6253\u5f00... +button.open.npapi = \u6253\u5f00 NPAPI... +button.open.ppapi = \u6253\u5f00 PPAPI... button.save = \u4fdd\u5b58 button.saveAs = \u53e6\u5b58\u4e3a... filter.sol = SOL\u6587\u4ef6 (*.sol) diff --git a/src/com/jpexs/decompiler/flash/gui/soleditor/SolEditorFrame.java b/src/com/jpexs/decompiler/flash/gui/soleditor/SolEditorFrame.java index d0c08f8fb..04573b4bd 100644 --- a/src/com/jpexs/decompiler/flash/gui/soleditor/SolEditorFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/soleditor/SolEditorFrame.java @@ -111,7 +111,13 @@ public class SolEditorFrame extends AppFrame { JButton openButton = new JButton(translate("button.open"), View.getIcon("open16")); openButton.addActionListener(this::openActionPerformed); + + JButton openNpApiButton = new JButton(translate("button.open.npapi"), View.getIcon("open16")); + openNpApiButton.addActionListener(this::openNpApiActionPerformed); + JButton openPpApiButton = new JButton(translate("button.open.ppapi"), View.getIcon("open16")); + openPpApiButton.addActionListener(this::openPpApiActionPerformed); + saveButton = new JButton(translate("button.save"), View.getIcon("save16")); saveButton.addActionListener(this::saveActionPerformed); saveButton.setEnabled(false); @@ -121,6 +127,15 @@ public class SolEditorFrame extends AppFrame { topPanel.add(newButton); topPanel.add(openButton); + + File npApiDirectory = SharedObjectsStorage.getNpApiDirectory(); + if (npApiDirectory != null && npApiDirectory.exists()) { + topPanel.add(openNpApiButton); + } + File ppApiDirectory = SharedObjectsStorage.getPpApiDirectory(); + if (ppApiDirectory != null && ppApiDirectory.exists()) { + topPanel.add(openPpApiButton); + } topPanel.add(saveButton); topPanel.add(saveAsButton); @@ -175,6 +190,18 @@ public class SolEditorFrame extends AppFrame { } private void openActionPerformed(ActionEvent e) { + openDirectory(new File(Configuration.lastSolEditorDirectory.get())); + } + + private void openNpApiActionPerformed(ActionEvent e) { + openDirectory(SharedObjectsStorage.getNpApiDirectory()); + } + + private void openPpApiActionPerformed(ActionEvent e) { + openDirectory(SharedObjectsStorage.getPpApiDirectory()); + } + + private void openDirectory(File directory) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileHidingEnabled(false); fileChooser.setFileFilter(new FileFilter() { @@ -188,7 +215,7 @@ public class SolEditorFrame extends AppFrame { return translate("filter.sol"); } }); - fileChooser.setCurrentDirectory(new File(Configuration.lastSolEditorDirectory.get())); + fileChooser.setCurrentDirectory(directory); if (fileChooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION) { return; }