Search in sources :

Example 1 with SetValueDialog

use of jadx.gui.ui.dialog.SetValueDialog in project jadx by skylot.

the class VarTreePopupMenu method addItems.

private void addItems() {
    JMenuItem copyValItem = new JMenuItem(new AbstractAction(NLS.str("debugger.popup_copy_value")) {

        private static final long serialVersionUID = -1111111202103171118L;

        @Override
        public void actionPerformed(ActionEvent e) {
            String val = valNode.getValue();
            if (val != null) {
                if (val.startsWith("\"") && val.endsWith("\"")) {
                    val = val.substring(1, val.length() - 1);
                }
                StringSelection stringSelection = new StringSelection(val);
                Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                clipboard.setContents(stringSelection, null);
            }
        }
    });
    JMenuItem setValItem = new JMenuItem(new AbstractAction(NLS.str("debugger.popup_set_value")) {

        private static final long serialVersionUID = -1111111202103171119L;

        @Override
        public void actionPerformed(ActionEvent e) {
            (new SetValueDialog(mainWindow, valNode)).setVisible(true);
        }
    });
    JMenuItem zeroItem = new JMenuItem(new AbstractAction(NLS.str("debugger.popup_change_to_zero")) {

        private static final long serialVersionUID = -1111111202103171120L;

        @Override
        public void actionPerformed(ActionEvent event) {
            try {
                mainWindow.getDebuggerPanel().getDbgController().modifyRegValue(valNode, ArgType.INT, 0);
            } catch (Exception e) {
                LOG.error("Change to zero failed", e);
                UiUtils.showMessageBox(mainWindow, e.getMessage());
            }
        }
    });
    JMenuItem oneItem = new JMenuItem(new AbstractAction(NLS.str("debugger.popup_change_to_one")) {

        private static final long serialVersionUID = -1111111202103171121L;

        @Override
        public void actionPerformed(ActionEvent event) {
            try {
                mainWindow.getDebuggerPanel().getDbgController().modifyRegValue(valNode, ArgType.INT, 1);
            } catch (Exception e) {
                LOG.error("Change to one failed", e);
                UiUtils.showMessageBox(mainWindow, e.getMessage());
            }
        }
    });
    this.add(copyValItem);
    this.add(new Separator());
    this.add(setValItem);
    this.add(zeroItem);
    this.add(oneItem);
    this.add(zeroItem);
}
Also used : ActionEvent(java.awt.event.ActionEvent) SetValueDialog(jadx.gui.ui.dialog.SetValueDialog) Clipboard(java.awt.datatransfer.Clipboard) JMenuItem(javax.swing.JMenuItem) AbstractAction(javax.swing.AbstractAction) StringSelection(java.awt.datatransfer.StringSelection)

Aggregations

SetValueDialog (jadx.gui.ui.dialog.SetValueDialog)1 Clipboard (java.awt.datatransfer.Clipboard)1 StringSelection (java.awt.datatransfer.StringSelection)1 ActionEvent (java.awt.event.ActionEvent)1 AbstractAction (javax.swing.AbstractAction)1 JMenuItem (javax.swing.JMenuItem)1