mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-17 18:38:12 +00:00
#1371 Go to character id (Ctrl+G in tag tree)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user