#1371 Go to character id (Ctrl+G in tag tree)

This commit is contained in:
Jindra Petřík
2021-03-06 16:33:10 +01:00
parent 277aa6c59e
commit 028ef6d0cf
4 changed files with 48 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
### Added
- [#1645] Scrollbar to recent searches dropdown
- [#1639] Clearing search results for current file
- [#1371] Go to character id (Ctrl+G in tag tree)
### Changed
- [#1471] Import script menuitem renamed to Import scripts.
@@ -2079,6 +2080,7 @@ All notable changes to this project will be documented in this file.
[alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7
[#1645]: https://www.free-decompiler.com/flash/issues/1645
[#1639]: https://www.free-decompiler.com/flash/issues/1639
[#1371]: https://www.free-decompiler.com/flash/issues/1371
[#1471]: https://www.free-decompiler.com/flash/issues/1471
[#1396]: https://www.free-decompiler.com/flash/issues/1396
[#1254]: https://www.free-decompiler.com/flash/issues/1254

View File

@@ -739,6 +739,37 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
searchPanel.setVisible(true);
filterField.requestFocusInWindow();
}
if ((e.getKeyCode() == 'G') && (e.isControlDown())) {
SWF swf = getCurrentSwf();
if (swf != null) {
String val = "";
boolean valid;
int characterId = -1;
do {
val = View.showInputDialog(MainPanel.this, translate("message.input.gotoCharacter"), translate("message.input.gotoCharacter.title"), val);
if (val == null) {
break;
}
try {
characterId = Integer.parseInt(val);
} catch (NumberFormatException nfe) {
characterId = -1;
}
} while (characterId <= 0);
if (characterId > 0) {
CharacterTag tag = swf.getCharacter(characterId);
if (tag == null) {
View.showMessageDialog(MainPanel.this, translate("message.character.notfound").replace("%characterid%", "" + characterId), translate("error"), JOptionPane.ERROR_MESSAGE);
} else {
TreePath path = tagTree.getModel().getTreePath(tag);
if (path != null) {
tagTree.setSelectionPath(path);
}
}
}
}
}
}
});
detailPanel.setVisible(false);

View File

@@ -67,6 +67,7 @@ import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRootPane;
@@ -572,6 +573,14 @@ public class View {
return ret[0];
}
public static String showInputDialog(Component parentComponent, final Object message, final String title, final Object initialSelection) {
final String[] ret = new String[1];
execInEventDispatch(() -> {
ret[0] = (String) JOptionPane.showInputDialog(parentComponent, message, title, JOptionPane.QUESTION_MESSAGE, null, null, initialSelection);
});
return ret[0];
}
public static SubstanceColorScheme getColorScheme() {
return SubstanceColorSchemeUtilities.getActiveColorScheme(new JButton(), ComponentState.ENABLED);
}

View File

@@ -797,4 +797,9 @@ menu.recentSearches = Recent searches for current file
menu.recentSearches.empty = Recent searches list is empty
menu.tools.otherTools.clearRecentSearches = Clear all recent searches
menu.recentSearches.clear = clear search results
message.confirm.recentSearches.clear = Do you really want to clear recent searches for current file?
message.confirm.recentSearches.clear = Do you really want to clear recent searches for current file?
message.input.gotoCharacter.title = Go to character
message.input.gotoCharacter = Enter character id
message.character.notfound = Character %characterid% not found.