MCPcopy
hub / github.com/arduino/Arduino / buildEditMenu

Method buildEditMenu

app/src/processing/app/Editor.java:1180–1330  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1178
1179
1180 private JMenu buildEditMenu() {
1181 JMenu menu = new JMenu(tr("Edit"));
1182 menu.setName("menuEdit");
1183 menu.setMnemonic(KeyEvent.VK_E);
1184
1185 undoItem = newJMenuItem(tr("Undo"), 'Z');
1186 undoItem.setName("menuEditUndo");
1187 undoItem.addActionListener(event -> getCurrentTab().handleUndo());
1188 menu.add(undoItem);
1189
1190 if (!OSUtils.isMacOS()) {
1191 redoItem = newJMenuItem(tr("Redo"), 'Y');
1192 } else {
1193 redoItem = newJMenuItemShift(tr("Redo"), 'Z');
1194 }
1195 redoItem.setName("menuEditRedo");
1196 redoItem.addActionListener(event -> getCurrentTab().handleRedo());
1197 menu.add(redoItem);
1198
1199 menu.addSeparator();
1200
1201 JMenuItem cutItem = newJMenuItem(tr("Cut"), 'X');
1202 cutItem.addActionListener(event -> getCurrentTab().handleCut());
1203 menu.add(cutItem);
1204
1205 JMenuItem copyItem = newJMenuItem(tr("Copy"), 'C');
1206 copyItem.addActionListener(event -> getCurrentTab().getTextArea().copy());
1207 menu.add(copyItem);
1208
1209 JMenuItem copyForumItem = newJMenuItemShift(tr("Copy for Forum"), 'C');
1210 copyForumItem.addActionListener(event -> getCurrentTab().handleDiscourseCopy());
1211 menu.add(copyForumItem);
1212
1213 JMenuItem copyHTMLItem = newJMenuItemAlt(tr("Copy as HTML"), 'C');
1214 copyHTMLItem.addActionListener(event -> getCurrentTab().handleHTMLCopy());
1215 menu.add(copyHTMLItem);
1216
1217 JMenuItem pasteItem = newJMenuItem(tr("Paste"), 'V');
1218 pasteItem.addActionListener(event -> getCurrentTab().handlePaste());
1219 menu.add(pasteItem);
1220
1221 JMenuItem selectAllItem = newJMenuItem(tr("Select All"), 'A');
1222 selectAllItem.addActionListener(event -> getCurrentTab().handleSelectAll());
1223 menu.add(selectAllItem);
1224
1225 JMenuItem gotoLine = newJMenuItem(tr("Go to line..."), 'L');
1226 gotoLine.addActionListener(event -> {
1227 GoToLineNumber goToLineNumber = new GoToLineNumber(Editor.this);
1228 goToLineNumber.setLocationRelativeTo(Editor.this);
1229 goToLineNumber.setVisible(true);
1230 });
1231 menu.add(gotoLine);
1232
1233 menu.addSeparator();
1234
1235 JMenuItem commentItem = newJMenuItem(tr("Comment/Uncomment"), PreferencesData.get("editor.keys.shortcut_comment", "/").charAt(0));
1236 commentItem.addActionListener(event -> getCurrentTab().handleCommentUncomment());
1237 menu.add(commentItem);

Callers 1

buildMenuBarMethod · 0.95

Calls 15

newJMenuItemMethod · 0.95
getCurrentTabMethod · 0.95
isMacOSMethod · 0.95
newJMenuItemShiftMethod · 0.95
newJMenuItemAltMethod · 0.95
getMethod · 0.95
trMethod · 0.80
setNameMethod · 0.80
handleUndoMethod · 0.80
handleRedoMethod · 0.80
handleCutMethod · 0.80
getTextAreaMethod · 0.80

Tested by

no test coverage detected