mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-24 22:50:45 +00:00
format code
This commit is contained in:
@@ -100,7 +100,7 @@ public final class BinaryPanel extends JPanel implements ComponentListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
swfInsidePanel.setVisible(binaryIsSwf);
|
||||
} else {
|
||||
hexEditor.setData(new byte[0], null, null);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.decompiler.flash.gui.debugger.DebugListener;
|
||||
@@ -43,52 +42,52 @@ public class DebugLogDialog extends AppDialog implements ActionListener {
|
||||
private final String ACTION_CLOSE = "CLOSE";
|
||||
private final String ACTION_CLEAR = "CLEAR";
|
||||
private final Debugger debug;
|
||||
|
||||
|
||||
public DebugLogDialog(Debugger debug) {
|
||||
setSize(800, 600);
|
||||
this.debug = debug;
|
||||
setSize(800, 600);
|
||||
this.debug = debug;
|
||||
setTitle(translate("dialog.title"));
|
||||
logTextArea.setBackground(Color.white);
|
||||
logTextArea.setEditable(false);
|
||||
JScrollPane spane = new JScrollPane(logTextArea);
|
||||
spane.setPreferredSize(new Dimension(800,500));
|
||||
|
||||
spane.setPreferredSize(new Dimension(800, 500));
|
||||
|
||||
debug.addMessageListener(new DebugListener() {
|
||||
|
||||
@Override
|
||||
public void onMessage(String clientId, String msg) {
|
||||
log(translate("msg.header").replace("%clientid%", clientId)+msg);
|
||||
log(translate("msg.header").replace("%clientid%", clientId) + msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish(String clientId) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
cnt.add(spane,BorderLayout.CENTER);
|
||||
|
||||
cnt.add(spane, BorderLayout.CENTER);
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
JButton clearButton = new JButton(translate("button.clear"));
|
||||
clearButton.setActionCommand(ACTION_CLEAR);
|
||||
clearButton.addActionListener(this);
|
||||
|
||||
|
||||
JButton closeButton = new JButton(translate("button.close"));
|
||||
closeButton.setActionCommand(ACTION_CLOSE);
|
||||
closeButton.addActionListener(this);
|
||||
|
||||
|
||||
buttonsPanel.add(clearButton);
|
||||
buttonsPanel.add(closeButton);
|
||||
cnt.add(buttonsPanel,BorderLayout.SOUTH);
|
||||
cnt.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
View.setWindowIcon(this);
|
||||
View.centerScreen(this);
|
||||
}
|
||||
|
||||
public void log(String msg){
|
||||
|
||||
public void log(String msg) {
|
||||
Document d = logTextArea.getDocument();
|
||||
try {
|
||||
d.insertString(d.getLength(), msg+"\r\n", null);
|
||||
d.insertString(d.getLength(), msg + "\r\n", null);
|
||||
} catch (BadLocationException ex) {
|
||||
//ignore
|
||||
}
|
||||
@@ -96,7 +95,7 @@ public class DebugLogDialog extends AppDialog implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch(e.getActionCommand()){
|
||||
switch (e.getActionCommand()) {
|
||||
case ACTION_CLEAR:
|
||||
logTextArea.setText("");
|
||||
break;
|
||||
@@ -105,5 +104,5 @@ public class DebugLogDialog extends AppDialog implements ActionListener {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
|
||||
if (ttfFileRadio.isSelected() && customFont != null) {
|
||||
return customFont;
|
||||
}
|
||||
return ((FontFace)faceSelection.getSelectedItem()).font;
|
||||
return ((FontFace) faceSelection.getSelectedItem()).font;
|
||||
}
|
||||
|
||||
public boolean hasUpdateTexts() {
|
||||
@@ -123,8 +123,8 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
|
||||
private JRadioButton ttfFileRadio;
|
||||
private JRadioButton installedRadio;
|
||||
|
||||
private void updateFaceSelection() {
|
||||
faceSelection.setModel(FontPanel.getFaceModel((FontFamily)familyNamesSelection.getSelectedItem()));
|
||||
private void updateFaceSelection() {
|
||||
faceSelection.setModel(FontPanel.getFaceModel((FontFamily) familyNamesSelection.getSelectedItem()));
|
||||
}
|
||||
|
||||
public FontEmbedDialog(FontFace selectedFace, String selectedChars) {
|
||||
@@ -147,7 +147,7 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
|
||||
installedRadio.setSelected(true);
|
||||
|
||||
individialSample = new JLabel();
|
||||
familyNamesSelection = new JComboBox<>(FontPanel.getFamilyModel());
|
||||
familyNamesSelection = new JComboBox<>(FontPanel.getFamilyModel());
|
||||
familyNamesSelection.setSelectedItem(new FontFamily(selectedFace.font));
|
||||
faceSelection = new JComboBox<>();
|
||||
updateFaceSelection();
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Font;
|
||||
@@ -24,46 +23,48 @@ import java.util.Objects;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class FontFace implements Comparable<FontFace>{
|
||||
public Font font;
|
||||
public FontFace(Font font) {
|
||||
this.font = font;
|
||||
}
|
||||
public class FontFace implements Comparable<FontFace> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String face = font.getFontName();
|
||||
String fam = font.getFamily();
|
||||
if(face.startsWith(fam)){
|
||||
face = face.substring(fam.length()).trim();
|
||||
}
|
||||
if(face.startsWith(".")){
|
||||
face=face.substring(1);
|
||||
}
|
||||
return face;
|
||||
}
|
||||
public Font font;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 79 * hash + Objects.hashCode(this.font);
|
||||
return hash;
|
||||
}
|
||||
public FontFace(Font font) {
|
||||
this.font = font;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final FontFace other = (FontFace) obj;
|
||||
if (!Objects.equals(this.font, other.font)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@Override
|
||||
public String toString() {
|
||||
String face = font.getFontName();
|
||||
String fam = font.getFamily();
|
||||
if (face.startsWith(fam)) {
|
||||
face = face.substring(fam.length()).trim();
|
||||
}
|
||||
if (face.startsWith(".")) {
|
||||
face = face.substring(1);
|
||||
}
|
||||
return face;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 79 * hash + Objects.hashCode(this.font);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final FontFace other = (FontFace) obj;
|
||||
if (!Objects.equals(this.font, other.font)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(FontFace o) {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Font;
|
||||
@@ -25,45 +24,46 @@ import java.util.Objects;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class FontFamily implements Comparable<FontFamily>{
|
||||
public String familyEn;
|
||||
public String family;
|
||||
public class FontFamily implements Comparable<FontFamily> {
|
||||
|
||||
public FontFamily(Font font){
|
||||
this(font.getFamily(Locale.ENGLISH),font.getFamily());
|
||||
}
|
||||
|
||||
public FontFamily(String familyEn, String family) {
|
||||
this.familyEn = familyEn;
|
||||
this.family = family;
|
||||
}
|
||||
public String familyEn;
|
||||
public String family;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return family;
|
||||
}
|
||||
public FontFamily(Font font) {
|
||||
this(font.getFamily(Locale.ENGLISH), font.getFamily());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 89 * hash + Objects.hashCode(this.familyEn);
|
||||
return hash;
|
||||
}
|
||||
public FontFamily(String familyEn, String family) {
|
||||
this.familyEn = familyEn;
|
||||
this.family = family;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final FontFamily other = (FontFamily) obj;
|
||||
if (!Objects.equals(this.familyEn, other.familyEn)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@Override
|
||||
public String toString() {
|
||||
return family;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 89 * hash + Objects.hashCode(this.familyEn);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final FontFamily other = (FontFamily) obj;
|
||||
if (!Objects.equals(this.familyEn, other.familyEn)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(FontFamily o) {
|
||||
|
||||
@@ -77,20 +77,20 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
public static ComboBoxModel<FontFamily> getFamilyModel() {
|
||||
Set<FontFamily> famSet=new TreeSet<>();
|
||||
for(Font f:FontTag.installedFontsByName.values()){
|
||||
Set<FontFamily> famSet = new TreeSet<>();
|
||||
for (Font f : FontTag.installedFontsByName.values()) {
|
||||
famSet.add(new FontFamily(f));
|
||||
}
|
||||
return new DefaultComboBoxModel<>(new Vector<>(famSet));
|
||||
}
|
||||
|
||||
public static ComboBoxModel<FontFace> getFaceModel(FontFamily family) {
|
||||
|
||||
Set<FontFace> faceSet=new TreeSet<>();
|
||||
for(Font f:FontTag.installedFontsByFamily.get(family.familyEn).values()){
|
||||
public static ComboBoxModel<FontFace> getFaceModel(FontFamily family) {
|
||||
|
||||
Set<FontFace> faceSet = new TreeSet<>();
|
||||
for (Font f : FontTag.installedFontsByFamily.get(family.familyEn).values()) {
|
||||
faceSet.add(new FontFace(f));
|
||||
}
|
||||
|
||||
|
||||
return new DefaultComboBoxModel<>(new Vector<>(faceSet));
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
|
||||
public void showFontTag(FontTag ft) {
|
||||
SWF swf = ft.getSwf();
|
||||
fontTag = ft;
|
||||
fontTag = ft;
|
||||
fontNameIntagLabel.setText(ft.getFontNameIntag());
|
||||
fontNameTextArea.setText(ft.getFontName());
|
||||
fontCopyrightTextArea.setText(ft.getFontCopyright());
|
||||
@@ -197,9 +197,9 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
fontCharactersTextArea.setText(chars);
|
||||
setAllowSave(false);
|
||||
String key = swf.getShortFileName() + "_" + ft.getFontId() + "_" + ft.getFontName();
|
||||
|
||||
|
||||
String selectedFont = "";
|
||||
|
||||
|
||||
if (swf.sourceFontNamesMap.containsKey(ft.getFontId())) {
|
||||
selectedFont = swf.sourceFontNamesMap.get(ft.getFontId());
|
||||
} else if (Configuration.getFontToNameMap().containsKey(key)) {
|
||||
@@ -209,17 +209,16 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
} else {
|
||||
selectedFont = FontTag.findInstalledFontName(ft.getFontName());
|
||||
}
|
||||
|
||||
|
||||
Font selFont = FontTag.installedFontsByName.get(selectedFont);
|
||||
if(selFont == null){
|
||||
if (selFont == null) {
|
||||
selectedFont = FontTag.findInstalledFontName(ft.getFontName());
|
||||
selFont = FontTag.installedFontsByName.get(selectedFont);
|
||||
}
|
||||
|
||||
|
||||
fontFamilyNameSelection.setSelectedItem(new FontFamily(selFont));
|
||||
fontFaceSelection.setSelectedItem(new FontFace(selFont));
|
||||
|
||||
|
||||
|
||||
setAllowSave(true);
|
||||
setEditable(false);
|
||||
}
|
||||
@@ -397,7 +396,7 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
|
||||
fontFamilyNameSelection.setModel(getFamilyModel());
|
||||
fontFamilyNameSelection.setSelectedItem(FontTag.defaultFontName);
|
||||
fontFaceSelection.setModel(getFaceModel((FontFamily)fontFamilyNameSelection.getSelectedItem()));
|
||||
fontFaceSelection.setModel(getFaceModel((FontFamily) fontFamilyNameSelection.getSelectedItem()));
|
||||
fontFamilyNameSelection.addItemListener(new java.awt.event.ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
@@ -510,7 +509,7 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
for (int c = 0; c < newchars.length(); c++) {
|
||||
selChars.add(newchars.codePointAt(c));
|
||||
}
|
||||
fontAddChars((FontTag) item, selChars, ((FontFace)fontFaceSelection.getSelectedItem()).font);
|
||||
fontAddChars((FontTag) item, selChars, ((FontFace) fontFaceSelection.getSelectedItem()).font);
|
||||
fontAddCharactersField.setText("");
|
||||
mainPanel.reload(true);
|
||||
}
|
||||
@@ -520,7 +519,7 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
TreeItem item = mainPanel.tagTree.getCurrentTreeItem();
|
||||
if (item instanceof FontTag) {
|
||||
FontTag ft = (FontTag) item;
|
||||
FontEmbedDialog fed = new FontEmbedDialog((FontFace)fontFaceSelection.getSelectedItem(), fontAddCharactersField.getText());
|
||||
FontEmbedDialog fed = new FontEmbedDialog((FontFace) fontFaceSelection.getSelectedItem(), fontAddCharactersField.getText());
|
||||
if (fed.display()) {
|
||||
Set<Integer> selChars = fed.getSelectedChars();
|
||||
if (!selChars.isEmpty()) {
|
||||
@@ -549,8 +548,8 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
TreeItem item = mainPanel.tagTree.getCurrentTreeItem();
|
||||
if (item instanceof FontTag) {
|
||||
FontTag f = (FontTag) item;
|
||||
SWF swf = f.getSwf();
|
||||
String selectedName = ((FontFace)fontFaceSelection.getSelectedItem()).font.getFontName(Locale.ENGLISH);
|
||||
SWF swf = f.getSwf();
|
||||
String selectedName = ((FontFace) fontFaceSelection.getSelectedItem()).font.getFontName(Locale.ENGLISH);
|
||||
swf.sourceFontNamesMap.put(f.getFontId(), selectedName);
|
||||
Configuration.addFontPair(swf.getShortFileName(), f.getFontId(), f.getFontName(), selectedName);
|
||||
}
|
||||
@@ -559,7 +558,7 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
private void fontFamilySelectionItemStateChanged() {
|
||||
|
||||
savePair();
|
||||
fontFaceSelection.setModel(getFaceModel((FontFamily)fontFamilyNameSelection.getSelectedItem()));
|
||||
fontFaceSelection.setModel(getFaceModel((FontFamily) fontFamilyNameSelection.getSelectedItem()));
|
||||
}
|
||||
|
||||
private void fontFaceSelectionItemStateChanged() {
|
||||
@@ -585,8 +584,8 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
setEditable(false);
|
||||
}
|
||||
|
||||
private void buttonPreviewFontActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
new FontPreviewDialog(null, true, ((FontFace)fontFaceSelection.getSelectedItem()).font).setVisible(true);
|
||||
private void buttonPreviewFontActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
new FontPreviewDialog(null, true, ((FontFace) fontFaceSelection.getSelectedItem()).font).setVisible(true);
|
||||
}
|
||||
|
||||
private void formComponentResized(java.awt.event.ComponentEvent evt) {
|
||||
@@ -670,5 +669,5 @@ public class FontPanel extends javax.swing.JPanel {
|
||||
private javax.swing.JPanel addCharsPanel;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JCheckBox updateTextsCheckBox;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1143,18 +1143,18 @@ public class Main {
|
||||
Random rnd = new Random();
|
||||
byte rb[] = new byte[16];
|
||||
rnd.nextBytes(rb);
|
||||
String rhex = byteArrayToHex(rb);
|
||||
String rhex = byteArrayToHex(rb);
|
||||
try {
|
||||
//load debug swf
|
||||
SWF debugSWF = new SWF(Main.class.getClassLoader().getResourceAsStream("com/jpexs/decompiler/flash/gui/debugger/debug.swf"), false);
|
||||
|
||||
ABCContainerTag firstAbc = swf.abcList.get(0);
|
||||
String newdebuggerpkg = DEBUGGER_PACKAGE;
|
||||
|
||||
if(Configuration.randomDebuggerPackage.get()){
|
||||
newdebuggerpkg += ".pkg"+rhex;
|
||||
|
||||
if (Configuration.randomDebuggerPackage.get()) {
|
||||
newdebuggerpkg += ".pkg" + rhex;
|
||||
}
|
||||
|
||||
|
||||
//add debug ABC tags to main SWF
|
||||
for (ABCContainerTag ds : debugSWF.abcList) {
|
||||
ABC a = ds.getABC();
|
||||
@@ -1177,7 +1177,7 @@ public class Main {
|
||||
((Tag) ds).setModified(true);
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Error while attaching debugger", ex);
|
||||
//ignore
|
||||
}
|
||||
|
||||
@@ -391,43 +391,38 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
}
|
||||
|
||||
private RibbonTask createToolsRibbonTask() {
|
||||
|
||||
|
||||
|
||||
JRibbonBand debuggerBand = new JRibbonBand(translate("menu.debugger"), null);
|
||||
debuggerBand.setResizePolicies(getResizePolicies(debuggerBand));
|
||||
|
||||
debuggerSwitchCommandButton = new JCommandToggleButton(translate("menu.debugger.switch"),View.getResizableIcon("debugger32"));
|
||||
|
||||
debuggerSwitchCommandButton = new JCommandToggleButton(translate("menu.debugger.switch"), View.getResizableIcon("debugger32"));
|
||||
assignListener(debuggerSwitchCommandButton, ACTION_DEBUGGER_SWITCH);
|
||||
|
||||
|
||||
//debuggerDetachCommandButton = new JCommandButton("Detach debugger",View.getResizableIcon("debuggerremove16"));
|
||||
//assignListener(debuggerDetachCommandButton, ACTION_DEBUGGER_DETACH);
|
||||
|
||||
debuggerReplaceTraceCommandButton = new JCommandButton(translate("menu.debugger.replacetrace"), View.getResizableIcon("debuggerreplace16"));
|
||||
assignListener(debuggerReplaceTraceCommandButton, ACTION_DEBUGGER_REPLACE_TRACE);
|
||||
|
||||
|
||||
debuggerLogCommandButton = new JCommandButton(translate("menu.debugger.showlog"), View.getResizableIcon("debuggerlog16"));
|
||||
assignListener(debuggerLogCommandButton, ACTION_DEBUGGER_LOG);
|
||||
|
||||
|
||||
debuggerSwitchGroup = new CommandToggleButtonGroup();
|
||||
debuggerSwitchGroup.add(debuggerSwitchCommandButton);
|
||||
|
||||
debuggerSwitchCommandButton.setEnabled(false);
|
||||
|
||||
debuggerReplaceTraceCommandButton.setEnabled(false);
|
||||
|
||||
debuggerBand.addCommandButton(debuggerSwitchCommandButton, RibbonElementPriority.TOP);
|
||||
debuggerBand.addCommandButton(debuggerReplaceTraceCommandButton, RibbonElementPriority.MEDIUM);
|
||||
debuggerBand.addCommandButton(debuggerLogCommandButton, RibbonElementPriority.MEDIUM);
|
||||
|
||||
|
||||
|
||||
//----------------------------------------- TOOLS -----------------------------------
|
||||
|
||||
debuggerSwitchCommandButton.setEnabled(false);
|
||||
|
||||
debuggerReplaceTraceCommandButton.setEnabled(false);
|
||||
|
||||
debuggerBand.addCommandButton(debuggerSwitchCommandButton, RibbonElementPriority.TOP);
|
||||
debuggerBand.addCommandButton(debuggerReplaceTraceCommandButton, RibbonElementPriority.MEDIUM);
|
||||
debuggerBand.addCommandButton(debuggerLogCommandButton, RibbonElementPriority.MEDIUM);
|
||||
|
||||
//----------------------------------------- TOOLS -----------------------------------
|
||||
JRibbonBand toolsBand = new JRibbonBand(translate("menu.tools"), null);
|
||||
toolsBand.setResizePolicies(getResizePolicies(toolsBand));
|
||||
|
||||
searchCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.search")), View.getResizableIcon("search32"));
|
||||
assignListener(searchCommandButton, ACTION_SEARCH);
|
||||
assignListener(searchCommandButton, ACTION_SEARCH);
|
||||
|
||||
timeLineToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.tools.timeline")), View.getResizableIcon("timeline32"));
|
||||
assignListener(timeLineToggleButton, ACTION_TIMELINE);
|
||||
@@ -635,7 +630,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
boolean swfLoaded = swf != null;
|
||||
boolean hasAbc = swfLoaded && abcList != null && !abcList.isEmpty();
|
||||
boolean hasDebugger = hasAbc && Main.hasDebugger(swf);
|
||||
|
||||
|
||||
exportAllMenu.setEnabled(swfLoaded);
|
||||
exportFlaMenu.setEnabled(swfLoaded);
|
||||
exportSelMenu.setEnabled(swfLoaded);
|
||||
@@ -667,7 +662,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
//debuggerSwitchCommandButton.
|
||||
//debuggerDetachCommandButton.setEnabled(hasDebugger);
|
||||
debuggerReplaceTraceCommandButton.setEnabled(hasAbc && hasDebugger);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private boolean saveAs(SWF swf, SaveFileMode mode) {
|
||||
@@ -683,24 +678,24 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
case ACTION_DEBUGGER_SWITCH:
|
||||
if(debuggerSwitchGroup.getSelected()==null || View.showConfirmDialog(mainFrame, translate("message.debugger"), translate("dialog.message.title"),JOptionPane.OK_CANCEL_OPTION,JOptionPane.INFORMATION_MESSAGE, Configuration.displayDebuggerInfo,JOptionPane.OK_OPTION)==JOptionPane.OK_OPTION){
|
||||
Main.switchDebugger();
|
||||
mainFrame.panel.refreshDecompiled();
|
||||
}else{
|
||||
if(debuggerSwitchGroup.getSelected()==debuggerSwitchCommandButton){
|
||||
case ACTION_DEBUGGER_SWITCH:
|
||||
if (debuggerSwitchGroup.getSelected() == null || View.showConfirmDialog(mainFrame, translate("message.debugger"), translate("dialog.message.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, Configuration.displayDebuggerInfo, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Main.switchDebugger();
|
||||
mainFrame.panel.refreshDecompiled();
|
||||
} else {
|
||||
if (debuggerSwitchGroup.getSelected() == debuggerSwitchCommandButton) {
|
||||
debuggerSwitchGroup.setSelected(debuggerSwitchCommandButton, false);
|
||||
}
|
||||
}
|
||||
debuggerReplaceTraceCommandButton.setEnabled(debuggerSwitchGroup.getSelected()==debuggerSwitchCommandButton);
|
||||
break;
|
||||
debuggerReplaceTraceCommandButton.setEnabled(debuggerSwitchGroup.getSelected() == debuggerSwitchCommandButton);
|
||||
break;
|
||||
case ACTION_DEBUGGER_LOG:
|
||||
Main.debuggerShowLog();
|
||||
break;
|
||||
case ACTION_DEBUGGER_REPLACE_TRACE:
|
||||
ReplaceTraceDialog rtd = new ReplaceTraceDialog(mainFrame,Configuration.lastDebuggerReplaceFunction.get());
|
||||
ReplaceTraceDialog rtd = new ReplaceTraceDialog(mainFrame, Configuration.lastDebuggerReplaceFunction.get());
|
||||
rtd.setVisible(true);
|
||||
if(rtd.getValue()!=null){
|
||||
if (rtd.getValue() != null) {
|
||||
Main.replaceTraceCalls(rtd.getValue());
|
||||
mainFrame.panel.refreshDecompiled();
|
||||
Configuration.lastDebuggerReplaceFunction.set(rtd.getValue());
|
||||
|
||||
@@ -1909,7 +1909,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
String fontName = font.getSwf().sourceFontNamesMap.get(font.getFontId());
|
||||
if (fontName == null) {
|
||||
fontName = font.getFontName();
|
||||
}
|
||||
}
|
||||
Font f = FontTag.installedFontsByName.get(fontName);
|
||||
if (f == null || !f.canDisplay(character)) {
|
||||
View.showMessageDialog(null, translate("error.font.nocharacter").replace("%char%", "" + character), translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
@@ -2261,7 +2261,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
|
||||
oldItem = treeItem;
|
||||
|
||||
|
||||
// show the preview of the tag when the user clicks to the tagname inside the scripts node, too
|
||||
// this is a little bit inconsistent, beacuse the frames (FrameScript) are not shown
|
||||
if (treeItem instanceof TagScript) {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Container;
|
||||
@@ -33,19 +32,18 @@ import javax.swing.JRadioButton;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ReplaceTraceDialog extends AppDialog {
|
||||
|
||||
|
||||
private JRadioButton debugAlertRadio;
|
||||
private JRadioButton debugConsoleRadio;
|
||||
private JRadioButton debugSocketRadio;
|
||||
|
||||
private String value = null;
|
||||
|
||||
|
||||
private void setValue(String val){
|
||||
if(val == null){
|
||||
private void setValue(String val) {
|
||||
if (val == null) {
|
||||
return;
|
||||
}
|
||||
switch(val){
|
||||
switch (val) {
|
||||
case "debugAlert":
|
||||
debugAlertRadio.setSelected(true);
|
||||
break;
|
||||
@@ -55,17 +53,17 @@ public class ReplaceTraceDialog extends AppDialog {
|
||||
case "debugSocket":
|
||||
debugSocketRadio.setSelected(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public ReplaceTraceDialog(Window owner,String defaultVal) {
|
||||
super(owner);
|
||||
|
||||
public ReplaceTraceDialog(Window owner, String defaultVal) {
|
||||
super(owner);
|
||||
setTitle(translate("dialog.title"));
|
||||
Container cnt=getContentPane();
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BoxLayout(cnt, BoxLayout.Y_AXIS));
|
||||
debugAlertRadio = new JRadioButton(translate("function.debugAlert"));
|
||||
debugAlertRadio.setAlignmentX(0);
|
||||
@@ -73,39 +71,37 @@ public class ReplaceTraceDialog extends AppDialog {
|
||||
debugConsoleRadio.setAlignmentX(0);
|
||||
debugSocketRadio = new JRadioButton(translate("function.debugSocket"));
|
||||
debugSocketRadio.setAlignmentX(0);
|
||||
|
||||
|
||||
debugAlertRadio.setSelected(true);
|
||||
|
||||
|
||||
ButtonGroup bg = new ButtonGroup();
|
||||
bg.add(debugAlertRadio);
|
||||
bg.add(debugConsoleRadio);
|
||||
bg.add(debugSocketRadio);
|
||||
|
||||
|
||||
|
||||
|
||||
cnt.add(debugAlertRadio);
|
||||
cnt.add(debugConsoleRadio);
|
||||
cnt.add(debugSocketRadio);
|
||||
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
JButton okButton=new JButton(AppStrings.translate("button.ok"));
|
||||
JButton okButton = new JButton(AppStrings.translate("button.ok"));
|
||||
okButton.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if(debugAlertRadio.isSelected()){
|
||||
if (debugAlertRadio.isSelected()) {
|
||||
value = "debugAlert";
|
||||
}
|
||||
if(debugConsoleRadio.isSelected()){
|
||||
if (debugConsoleRadio.isSelected()) {
|
||||
value = "debugConsole";
|
||||
}
|
||||
if(debugSocketRadio.isSelected()){
|
||||
if (debugSocketRadio.isSelected()) {
|
||||
value = "debugSocket";
|
||||
}
|
||||
setVisible(false);
|
||||
}
|
||||
});
|
||||
JButton cancelButton=new JButton(AppStrings.translate("button.cancel"));
|
||||
JButton cancelButton = new JButton(AppStrings.translate("button.cancel"));
|
||||
cancelButton.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
@@ -115,7 +111,7 @@ public class ReplaceTraceDialog extends AppDialog {
|
||||
}
|
||||
});
|
||||
buttonsPanel.add(okButton);
|
||||
buttonsPanel.add(cancelButton);
|
||||
buttonsPanel.add(cancelButton);
|
||||
buttonsPanel.setAlignmentX(0);
|
||||
add(buttonsPanel);
|
||||
setModalityType(DEFAULT_MODALITY_TYPE);
|
||||
@@ -124,5 +120,5 @@ public class ReplaceTraceDialog extends AppDialog {
|
||||
View.centerScreen(this);
|
||||
setValue(defaultVal);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ public class View {
|
||||
}
|
||||
|
||||
public static ImageIcon getIcon(String name) {
|
||||
return new ImageIcon(View.class.getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/" + name + ".png"));
|
||||
return new ImageIcon(View.class.getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/" + name + ".png"));
|
||||
}
|
||||
private static final KeyStroke escapeStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
|
||||
private static final String dispatchWindowClosingActionMapKey = "com.jpexs.dispatch:WINDOW_CLOSING";
|
||||
@@ -376,7 +376,7 @@ public class View {
|
||||
|
||||
public static int showConfirmDialog(final Component parentComponent, String message, final String title, final int optionType, final int messageTyp, ConfigurationItem<Boolean> showAgainConfig, int defaultOption) {
|
||||
|
||||
JLabel warLabel = new JLabel("<html>"+message.replace("\r\n", "<br>")+"</html>");
|
||||
JLabel warLabel = new JLabel("<html>" + message.replace("\r\n", "<br>") + "</html>");
|
||||
final JPanel warPanel = new JPanel(new BorderLayout());
|
||||
warPanel.add(warLabel, BorderLayout.CENTER);
|
||||
JCheckBox donotShowAgainCheckBox = new JCheckBox(AppStrings.translate("message.confirm.donotshowagain"));
|
||||
@@ -408,7 +408,7 @@ public class View {
|
||||
JCheckBox donotShowAgainCheckBox = new JCheckBox(AppStrings.translate("message.confirm.donotshowagain"));
|
||||
|
||||
if (showAgainConfig != null) {
|
||||
JLabel warLabel = new JLabel("<html>"+message.replace("\r\n", "<br>")+"</html>");
|
||||
JLabel warLabel = new JLabel("<html>" + message.replace("\r\n", "<br>") + "</html>");
|
||||
final JPanel warPanel = new JPanel(new BorderLayout());
|
||||
warPanel.add(warLabel, BorderLayout.CENTER);
|
||||
donotShowAgainCheckBox.setSelected(!showAgainConfig.get());
|
||||
@@ -418,7 +418,7 @@ public class View {
|
||||
return;
|
||||
}
|
||||
}
|
||||
final Object fmsg=msg;
|
||||
final Object fmsg = msg;
|
||||
|
||||
execInEventDispatch(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -320,11 +320,10 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
this.swf = swf;
|
||||
if (swf.abcList.size() > 0) {
|
||||
this.abc = swf.abcList.get(0).getABC();
|
||||
}
|
||||
navigator.setABC(swf.abcList, abc);
|
||||
}
|
||||
navigator.setABC(swf.abcList, abc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void initSplits() {
|
||||
//splitPaneTreeVSNavigator.setDividerLocation(splitPaneTreeVSNavigator.getHeight() / 2);
|
||||
@@ -364,7 +363,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
decompiledTextArea = new DecompiledEditorPane(this);
|
||||
|
||||
|
||||
decompiledTextArea.setLinkHandler(new LinkHandler() {
|
||||
|
||||
@Override
|
||||
@@ -478,7 +477,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
decompiledTextArea.addKeyListener(cch);
|
||||
decompiledTextArea.addMouseListener(cch);
|
||||
decompiledTextArea.addMouseMotionListener(cch);
|
||||
|
||||
|
||||
navigator = new TraitsList(this);
|
||||
|
||||
navPanel = new JPanel(new BorderLayout());
|
||||
@@ -561,13 +560,13 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
//more than one? display list
|
||||
if (!usages.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
return decompiledTextArea.getLocalDeclarationOfPos(pos)!=-1;
|
||||
}
|
||||
} else {
|
||||
return decompiledTextArea.getLocalDeclarationOfPos(pos) != -1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void gotoDeclaration(int pos) {
|
||||
int multinameIndex = decompiledTextArea.getMultinameAtPos(pos);
|
||||
if (multinameIndex > -1) {
|
||||
@@ -595,9 +594,9 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
} else if (!usages.isEmpty()) { //one
|
||||
UsageFrame.gotoUsage(ABCPanel.this, usages.get(0));
|
||||
}
|
||||
}else{
|
||||
int dpos=decompiledTextArea.getLocalDeclarationOfPos(pos);
|
||||
if(dpos>-1){
|
||||
} else {
|
||||
int dpos = decompiledTextArea.getLocalDeclarationOfPos(pos);
|
||||
if (dpos > -1) {
|
||||
decompiledTextArea.setCaretPosition(dpos);
|
||||
}
|
||||
}
|
||||
@@ -673,7 +672,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
}
|
||||
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (e.getSource() == constantTypeList) {
|
||||
int index = ((JComboBox) e.getSource()).getSelectedIndex();
|
||||
if (index == -1) {
|
||||
@@ -805,21 +804,20 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
ScriptPack pack = decompiledTextArea.getScriptLeaf();
|
||||
int oldIndex = pack.scriptIndex;
|
||||
decompiledTextArea.uncache(pack);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
String oldSp = null;
|
||||
List<MyEntry<ClassPath, ScriptPack>> packs = abc.script_info.get(oldIndex).getPacks(abc, oldIndex);
|
||||
if (!packs.isEmpty()) {
|
||||
oldSp = packs.get(0).getKey().toString();
|
||||
oldSp = packs.get(0).getKey().toString();
|
||||
}
|
||||
|
||||
|
||||
String as = decompiledTextArea.getText();
|
||||
abc.replaceSciptPack(pack, as);
|
||||
lastDecompiled = as;
|
||||
mainPanel.updateClassesList();
|
||||
|
||||
if(oldSp!=null){
|
||||
|
||||
if (oldSp != null) {
|
||||
hilightScript(swf, oldSp);
|
||||
}
|
||||
//decompiledTextArea.setClassIndex(-1);
|
||||
@@ -831,12 +829,12 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
abc.script_info.get(oldIndex).delete(abc, false);
|
||||
decompiledTextArea.gotoLine((int) ex.line);
|
||||
decompiledTextArea.markError();
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
} catch (CompilationException ex) {
|
||||
abc.script_info.get(oldIndex).delete(abc, false);
|
||||
decompiledTextArea.gotoLine((int) ex.line);
|
||||
decompiledTextArea.markError();
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
} catch (IOException | InterruptedException ex) {
|
||||
//ignore
|
||||
}
|
||||
|
||||
@@ -280,7 +280,6 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
|
||||
setCaretPosition(lineStart);
|
||||
//requestFocus();
|
||||
}
|
||||
|
||||
|
||||
public Highlighting getSelectedSpecial() {
|
||||
return Highlighting.search(specialHilights, getCaretPosition());
|
||||
|
||||
@@ -80,12 +80,12 @@ public class ClassesListTreeModel extends AS3ClassTreeItem implements TreeModel
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AS3Package pkg = ensurePackage(item.getKey().packageStr);
|
||||
pkg.scripts.put(item.getKey().className, item.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private AS3Package ensurePackage(String packageStr) {
|
||||
StringTokenizer st = new StringTokenizer(packageStr, ".");
|
||||
AS3Package parent = root;
|
||||
@@ -96,17 +96,17 @@ public class ClassesListTreeModel extends AS3ClassTreeItem implements TreeModel
|
||||
pkg = new AS3Package(pathElement, swf);
|
||||
parent.subPackages.put(pathElement, pkg);
|
||||
}
|
||||
|
||||
|
||||
parent = pkg;
|
||||
}
|
||||
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
public ScriptPack getElementByClassIndex(int classIndex) {
|
||||
return getElementByClassIndexRecursive(root, classIndex);
|
||||
}
|
||||
|
||||
|
||||
private ScriptPack getElementByClassIndexRecursive(AS3Package item, int classIndex) {
|
||||
for (AS3Package pkg : item.subPackages.values()) {
|
||||
ScriptPack result = getElementByClassIndexRecursive(pkg, classIndex);
|
||||
@@ -114,7 +114,7 @@ public class ClassesListTreeModel extends AS3ClassTreeItem implements TreeModel
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (ScriptPack sc : item.scripts.values()) {
|
||||
for (Trait t : sc.abc.script_info.get(sc.scriptIndex).traits.traits) {
|
||||
if (t instanceof TraitClass) {
|
||||
@@ -124,7 +124,7 @@ public class ClassesListTreeModel extends AS3ClassTreeItem implements TreeModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class ClassesListTreeModel extends AS3ClassTreeItem implements TreeModel
|
||||
if (parentItem instanceof ScriptPack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
AS3Package pkg = (AS3Package) parentItem;
|
||||
return pkg.getChildCount();
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
}
|
||||
|
||||
List<Highlighting> allh = new ArrayList<>();
|
||||
for (Highlighting h : traitHighlights) {
|
||||
for (Highlighting h : traitHighlights) {
|
||||
if (h.getPropertyString("index").equals("" + lastTraitIndex)) {
|
||||
for (Highlighting sh : specialHighlights) {
|
||||
if (sh.startPos >= h.startPos && (sh.startPos + sh.len < h.startPos + h.len)) {
|
||||
@@ -222,59 +222,59 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
caretUpdate(null);
|
||||
reset = false;
|
||||
}
|
||||
public int getMultinameUnderMouseCursor(Point pt) {
|
||||
return getMultinameAtPos(viewToModel(pt));
|
||||
|
||||
public int getMultinameUnderMouseCursor(Point pt) {
|
||||
return getMultinameAtPos(viewToModel(pt));
|
||||
}
|
||||
|
||||
|
||||
public int getMultinameUnderCaret() {
|
||||
return getMultinameAtPos(getCaretPosition());
|
||||
return getMultinameAtPos(getCaretPosition());
|
||||
}
|
||||
|
||||
|
||||
public int getLocalDeclarationOfPos(int pos) {
|
||||
Highlighting sh=Highlighting.search(specialHighlights,pos);
|
||||
Highlighting h=Highlighting.search(highlights,pos);
|
||||
Highlighting sh = Highlighting.search(specialHighlights, pos);
|
||||
Highlighting h = Highlighting.search(highlights, pos);
|
||||
Highlighting tm = Highlighting.search(methodHighlights, pos);
|
||||
if (tm == null) {
|
||||
return -1;
|
||||
}
|
||||
List<Highlighting> tms= Highlighting.searchAll(methodHighlights, -1, "index", tm.getPropertyString("index"), -1, -1);
|
||||
if(h==null){
|
||||
List<Highlighting> tms = Highlighting.searchAll(methodHighlights, -1, "index", tm.getPropertyString("index"), -1, -1);
|
||||
if (h == null) {
|
||||
return -1;
|
||||
}
|
||||
//is it already declaration?
|
||||
if("true".equals(h.getPropertyString("declaration")) || (sh!=null && "true".equals(sh.getPropertyString("declaration")))){
|
||||
if ("true".equals(h.getPropertyString("declaration")) || (sh != null && "true".equals(sh.getPropertyString("declaration")))) {
|
||||
return -1; //no jump
|
||||
}
|
||||
|
||||
Map<String,String> search=h.getProperties();
|
||||
|
||||
Map<String, String> search = h.getProperties();
|
||||
search.remove("index");
|
||||
search.remove("subtype");
|
||||
search.remove("offset");
|
||||
if(search.isEmpty()){
|
||||
if (search.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
search.put("declaration", "true");
|
||||
|
||||
for(Highlighting tm1:tms)
|
||||
{
|
||||
Highlighting rh= Highlighting.search(highlights, search, tm1.startPos, tm1.startPos+tm1.len);
|
||||
if(rh==null){
|
||||
rh=Highlighting.search(specialHighlights, search, tm1.startPos, tm1.startPos+tm1.len);
|
||||
search.put("declaration", "true");
|
||||
|
||||
for (Highlighting tm1 : tms) {
|
||||
Highlighting rh = Highlighting.search(highlights, search, tm1.startPos, tm1.startPos + tm1.len);
|
||||
if (rh == null) {
|
||||
rh = Highlighting.search(specialHighlights, search, tm1.startPos, tm1.startPos + tm1.len);
|
||||
}
|
||||
if(rh!=null){
|
||||
if (rh != null) {
|
||||
return rh.startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getMultinameAtPos(int pos) {
|
||||
|
||||
public int getMultinameAtPos(int pos) {
|
||||
Highlighting tm = Highlighting.search(methodHighlights, pos);
|
||||
if (tm == null) {
|
||||
return -1;
|
||||
}
|
||||
int mi = (int)(long)tm.getPropertyLong("index");
|
||||
int mi = (int) (long) tm.getPropertyLong("index");
|
||||
int bi = abc.findBodyIndex(mi);
|
||||
Highlighting h = Highlighting.search(highlights, pos);
|
||||
if (h != null) {
|
||||
@@ -565,7 +565,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
|
||||
public void reloadClass() {
|
||||
int ci = classIndex;
|
||||
uncache(script);
|
||||
uncache(script);
|
||||
if ((script != null) && (abc != null)) {
|
||||
setScript(script, abcList);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public class DetailPanel extends JPanel implements ActionListener {
|
||||
if (trait == null) {
|
||||
traitNameLabel.setText("-");
|
||||
} else {
|
||||
if(abcPanel!=null){
|
||||
if (abcPanel != null) {
|
||||
traitNameLabel.setText(trait.getName(abcPanel.abc).getName(abcPanel.abc.constants, new ArrayList<String>(), false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,14 +204,14 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
|
||||
}
|
||||
repaint();
|
||||
|
||||
}
|
||||
}else {
|
||||
lastUnderlined = null;
|
||||
MyMarkers.removeMarkers(LineMarkedEditorPane.this, underLinePainter);
|
||||
setCursor(Cursor.getDefaultCursor());
|
||||
repaint();
|
||||
}
|
||||
|
||||
} else {
|
||||
lastUnderlined = null;
|
||||
MyMarkers.removeMarkers(LineMarkedEditorPane.this, underLinePainter);
|
||||
setCursor(Cursor.getDefaultCursor());
|
||||
repaint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -291,7 +291,7 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) {
|
||||
public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) {
|
||||
try {
|
||||
// --- determine locations ---
|
||||
TextUI mapper = c.getUI();
|
||||
@@ -318,7 +318,7 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
|
||||
@Override
|
||||
public Shape paintLayer(Graphics g, int offs0, int offs1,
|
||||
Shape bounds, JTextComponent c, View view) {
|
||||
|
||||
|
||||
g.setColor(c.getSelectionColor());
|
||||
|
||||
Rectangle r;
|
||||
@@ -350,7 +350,7 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
|
||||
r.width = Math.max(r.width, 1);
|
||||
|
||||
paint(g, offs0, offs1, r, c);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return r;
|
||||
|
||||
@@ -24,7 +24,10 @@ import jsyntaxpane.Token;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface LinkHandler {
|
||||
|
||||
public boolean isLink(Token token);
|
||||
|
||||
public void handleLink(Token token);
|
||||
|
||||
public Highlighter.HighlightPainter linkPainter();
|
||||
}
|
||||
|
||||
@@ -47,12 +47,13 @@ public class MyMarkers {
|
||||
Highlighter.HighlightPainter hMarker = hilites[i].getPainter();
|
||||
if (marker == null || hMarker.equals(marker)) {
|
||||
hilite.removeHighlight(hilites[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all the markers from an JEditorPane
|
||||
*
|
||||
* @param editorPane
|
||||
*/
|
||||
public static void removeMarkers(JTextComponent editorPane) {
|
||||
@@ -61,6 +62,7 @@ public class MyMarkers {
|
||||
|
||||
/**
|
||||
* add highlights for the given Token on the given pane
|
||||
*
|
||||
* @param pane
|
||||
* @param token
|
||||
* @param marker
|
||||
@@ -71,6 +73,7 @@ public class MyMarkers {
|
||||
|
||||
/**
|
||||
* add highlights for the given region on the given pane
|
||||
*
|
||||
* @param pane
|
||||
* @param start
|
||||
* @param end
|
||||
@@ -82,45 +85,44 @@ public class MyMarkers {
|
||||
int selStart = pane.getSelectionStart();
|
||||
int selEnd = pane.getSelectionEnd();
|
||||
// if there is no selection or selection does not overlap
|
||||
if(selStart == selEnd || end < selStart || start > selStart) {
|
||||
if (selStart == selEnd || end < selStart || start > selStart) {
|
||||
hiliter.addHighlight(start, end, marker);
|
||||
return;
|
||||
}
|
||||
// selection starts within the highlight, highlight before slection
|
||||
if(selStart > start && selStart < end ) {
|
||||
if (selStart > start && selStart < end) {
|
||||
hiliter.addHighlight(start, selStart, marker);
|
||||
}
|
||||
// selection ends within the highlight, highlight remaining
|
||||
if(selEnd > start && selEnd < end ) {
|
||||
if (selEnd > start && selEnd < end) {
|
||||
hiliter.addHighlight(selEnd, end, marker);
|
||||
}
|
||||
|
||||
} catch (BadLocationException ex) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark all text in the document that matches the given pattern
|
||||
*
|
||||
* @param pane control to use
|
||||
* @param pattern pattern to match
|
||||
* @param marker marker to use for highlighting
|
||||
*/
|
||||
public static void markAll(JTextComponent pane, Pattern pattern, Highlighter.HighlightPainter marker) {
|
||||
SyntaxDocument sDoc = ActionUtils.getSyntaxDocument(pane);
|
||||
if(sDoc == null || pattern == null) {
|
||||
if (sDoc == null || pattern == null) {
|
||||
return;
|
||||
}
|
||||
Matcher matcher = sDoc.getMatcher(pattern);
|
||||
// we may not have any matcher (due to undo or something, so don't do anything.
|
||||
if(matcher==null) {
|
||||
return;
|
||||
}
|
||||
while(matcher.find()) {
|
||||
// we may not have any matcher (due to undo or something, so don't do anything.
|
||||
if (matcher == null) {
|
||||
return;
|
||||
}
|
||||
while (matcher.find()) {
|
||||
markText(pane, matcher.start(), matcher.end(), marker);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -714,7 +714,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene
|
||||
String newText = lastDecompiled;
|
||||
setDecompiledText(newText);
|
||||
if (lastLine > -1) {
|
||||
decompiledEditor.gotoLine(lastLine + prefLines + 1);
|
||||
decompiledEditor.gotoLine(lastLine + prefLines + 1);
|
||||
}
|
||||
decompiledEditor.setEditable(false);
|
||||
saveDecompiledButton.setVisible(false);
|
||||
@@ -777,7 +777,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene
|
||||
} catch (ActionParseException ex) {
|
||||
editor.gotoLine((int) ex.line);
|
||||
editor.markError();
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
break;
|
||||
case ACTION_EDIT_DECOMPILED:
|
||||
|
||||
@@ -5,6 +5,8 @@ package com.jpexs.decompiler.flash.gui.debugger;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface DebugListener {
|
||||
public void onMessage(String clientId,String msg);
|
||||
|
||||
public void onMessage(String clientId, String msg);
|
||||
|
||||
public void onFinish(String clientId);
|
||||
}
|
||||
|
||||
@@ -189,10 +189,10 @@ public class TagTree extends JTree implements ActionListener {
|
||||
|
||||
public static TreeNodeType getTreeNodeType(TreeItem t) {
|
||||
|
||||
if (t instanceof TagScript){
|
||||
if (t instanceof TagScript) {
|
||||
t = ((TagScript) t).getTag();
|
||||
}
|
||||
|
||||
|
||||
if (t instanceof HeaderItem) {
|
||||
return TreeNodeType.HEADER;
|
||||
}
|
||||
@@ -247,7 +247,7 @@ public class TagTree extends JTree implements ActionListener {
|
||||
if (t instanceof AS3Package) {
|
||||
return TreeNodeType.PACKAGE;
|
||||
}
|
||||
if ((t instanceof Frame)
|
||||
if ((t instanceof Frame)
|
||||
|| (t instanceof FrameScript)) {
|
||||
return TreeNodeType.FRAME;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class TagTreeModel implements TreeModel {
|
||||
this.swfs.add(swf);
|
||||
createTagList(swf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String translate(String key) {
|
||||
@@ -247,7 +247,7 @@ public class TagTreeModel implements TreeModel {
|
||||
hasInnerFrames = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!hasInnerFrames) {
|
||||
if (tag instanceof Container) {
|
||||
for (ContainerItem item : ((Container) tag).getSubItems()) {
|
||||
@@ -257,7 +257,7 @@ public class TagTreeModel implements TreeModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!tagSubNodes.isEmpty()) {
|
||||
TagScript ts = new TagScript(swf, tag, tagSubNodes);
|
||||
if (hasInnerFrames) {
|
||||
@@ -268,7 +268,7 @@ public class TagTreeModel implements TreeModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
subNodes.addAll(subFrames);
|
||||
|
||||
for (Frame frame : timeline.getFrames()) {
|
||||
@@ -277,13 +277,13 @@ public class TagTreeModel implements TreeModel {
|
||||
subNodes.add(frameScript);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (subNodes.size() > 0) {
|
||||
TreeItem actionScriptNode = new FolderItem(translate("node.scripts"), FOLDER_SCRIPTS, swf, subNodes);
|
||||
nodeList.add(actionScriptNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
swfFolders.put(swf, nodeList);
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ public class TagTreeModel implements TreeModel {
|
||||
int childCount = getChildCount(swf);
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
TreeItem child = getChild(swf, i);
|
||||
if (child instanceof ClassesListTreeModel){
|
||||
if (child instanceof ClassesListTreeModel) {
|
||||
return child;
|
||||
} else if (child instanceof FolderItem) {
|
||||
FolderItem folder = (FolderItem) child;
|
||||
@@ -303,7 +303,7 @@ public class TagTreeModel implements TreeModel {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private List<TreeItem> searchTag(TreeItem obj, TreeItem parent, List<TreeItem> path) {
|
||||
List<TreeItem> ret = null;
|
||||
int cnt = getChildCount(parent);
|
||||
@@ -356,14 +356,14 @@ public class TagTreeModel implements TreeModel {
|
||||
public TreeItem getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
private List<TreeItem> getSwfFolders(SWF swf) {
|
||||
List<TreeItem> ret = swfFolders.get(swf);
|
||||
if (ret == null) {
|
||||
createTagList(swf);
|
||||
ret = swfFolders.get(swf);
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user