1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Add copy/paste contextual menu to Firnd/replace text fields

Fixes #4883
This commit is contained in:
Martino Facchin 2017-08-10 14:30:49 +02:00
parent 921dd272ad
commit 1f9d99b699

View File

@ -37,6 +37,9 @@ import processing.app.helpers.OSUtils;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JPopupMenu;
import javax.swing.Action;
import javax.swing.text.DefaultEditorKit;
import java.util.HashMap;
import java.util.Map;
@ -161,6 +164,22 @@ public class FindReplace extends javax.swing.JFrame {
searchAllFilesBox.setText(tr("Search all Sketch Tabs"));
JPopupMenu menu = new JPopupMenu();
Action cut = new DefaultEditorKit.CutAction();
cut.putValue(Action.NAME, tr("Cut"));
menu.add( cut );
Action copy = new DefaultEditorKit.CopyAction();
copy.putValue(Action.NAME, tr("Copy"));
menu.add( copy );
Action paste = new DefaultEditorKit.PasteAction();
paste.putValue(Action.NAME, tr("Paste"));
menu.add( paste );
findField.setComponentPopupMenu( menu );
replaceField.setComponentPopupMenu( menu );
findButton.setText(tr("Find"));
findButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {