added show usage menu item

This commit is contained in:
Manindra Moharana
2013-07-26 21:49:47 +05:30
parent 9bc0aadce3
commit 202ae14c73
3 changed files with 56 additions and 10 deletions

View File

@@ -156,13 +156,23 @@ public class DebugEditor extends JavaEditor implements ActionListener {
// access to customized (i.e. subclassed) text area
ta = (TextArea) textarea;
// Add show usage option
JMenuItem showUsageItem = new JMenuItem("Show Usage..");
showUsageItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleShowUsage();
}
});
ta.getRightClickPopup().add(showUsageItem);
// 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) {
@@ -1144,6 +1154,12 @@ public class DebugEditor extends JavaEditor implements ActionListener {
errorCheckerService.astGenerator.handleRefactor();
}
private void handleShowUsage() {
System.out.println("Caret at:");
System.out.println(ta.getLineText(ta.getCaretLine()));
errorCheckerService.astGenerator.handleShowUsage();
}
/**
* 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