beginning work on refactoring ui

This commit is contained in:
Manindra Moharana
2013-06-29 11:27:25 +05:30
parent 1bddc05dd9
commit af6b128793
3 changed files with 40 additions and 9 deletions

View File

@@ -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