mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 02:20:45 +01:00
beginning work on refactoring ui
This commit is contained in:
@@ -25,6 +25,8 @@ import java.awt.Frame;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -153,7 +155,21 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
|
||||
// access to customized (i.e. subclassed) text area
|
||||
ta = (TextArea) textarea;
|
||||
|
||||
|
||||
// add refactor option
|
||||
JMenuItem renameItem = new JMenuItem("Rename..");
|
||||
renameItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleRefactor();
|
||||
}
|
||||
});
|
||||
// TODO: Add support for word select on right click and rename.
|
||||
// ta.customPainter.addMouseListener(new MouseAdapter() {
|
||||
// public void mouseClicked(MouseEvent evt) {
|
||||
// System.out.println(evt);
|
||||
// }
|
||||
// });
|
||||
ta.getRightClickPopup().add(renameItem);
|
||||
// set action on frame close
|
||||
// addWindowListener(new WindowAdapter() {
|
||||
// @Override
|
||||
@@ -1122,6 +1138,12 @@ public class DebugEditor extends JavaEditor implements ActionListener {
|
||||
return errorTable.updateTable(tableModel);
|
||||
}
|
||||
|
||||
private void handleRefactor() {
|
||||
System.out.println("Caret at:");
|
||||
System.out.println(ta.getLineText(ta.getCaretLine()));
|
||||
errorCheckerService.astGenerator.handleRefactor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the sketch contains java tabs. If it does, XQMode ain't built
|
||||
* for it, yet. Also, user should really start looking at Eclipse. Disable
|
||||
|
||||
Reference in New Issue
Block a user