use of jadx.gui.utils.DefaultPopupMenuListener in project jadx by skylot.
the class AbstractCodeArea method addWrapLineMenuAction.
private void addWrapLineMenuAction(JadxSettings settings) {
JPopupMenu popupMenu = getPopupMenu();
popupMenu.addSeparator();
JCheckBoxMenuItem wrapItem = new JCheckBoxMenuItem(NLS.str("popup.line_wrap"), getLineWrap());
wrapItem.setAction(new AbstractAction(NLS.str("popup.line_wrap")) {
@Override
public void actionPerformed(ActionEvent e) {
boolean wrap = !getLineWrap();
settings.setCodeAreaLineWrap(wrap);
contentPanel.getTabbedPane().getOpenTabs().values().forEach(v -> {
if (v instanceof AbstractCodeContentPanel) {
AbstractCodeArea codeArea = ((AbstractCodeContentPanel) v).getCodeArea();
setCodeAreaLineWrap(codeArea, wrap);
if (v instanceof ClassCodeContentPanel) {
codeArea = ((ClassCodeContentPanel) v).getSmaliCodeArea();
setCodeAreaLineWrap(codeArea, wrap);
}
}
});
settings.sync();
}
});
popupMenu.add(wrapItem);
popupMenu.addPopupMenuListener(new DefaultPopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
wrapItem.setState(getLineWrap());
}
});
}
use of jadx.gui.utils.DefaultPopupMenuListener in project jadx by skylot.
the class CodeArea method addMenuItems.
private void addMenuItems() {
FindUsageAction findUsage = new FindUsageAction(this);
GoToDeclarationAction goToDeclaration = new GoToDeclarationAction(this);
RenameAction rename = new RenameAction(this);
CommentAction comment = new CommentAction(this);
FridaAction frida = new FridaAction(this);
XposedAction xposed = new XposedAction(this);
JPopupMenu popup = getPopupMenu();
popup.addSeparator();
popup.add(findUsage);
popup.add(goToDeclaration);
popup.add(comment);
popup.add(new CommentSearchAction(this));
popup.add(rename);
popup.addSeparator();
popup.add(frida);
popup.add(xposed);
popup.addPopupMenuListener(findUsage);
popup.addPopupMenuListener(goToDeclaration);
popup.addPopupMenuListener(comment);
popup.addPopupMenuListener(rename);
popup.addPopupMenuListener(frida);
popup.addPopupMenuListener(xposed);
// move caret on mouse right button click
popup.addPopupMenuListener(new DefaultPopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
CodeArea codeArea = CodeArea.this;
if (codeArea.getSelectedText() == null) {
int offset = UiUtils.getOffsetAtMousePosition(codeArea);
if (offset >= 0) {
codeArea.setCaretPosition(offset);
}
}
}
});
}
Aggregations