The focus goes to the Cancel, Don't Save, Save All dialog.
Associated exception:
java.lang.NullPointerException
at e.edit.ETextAction.chooseStopChars(ETextAction.java:94)
at e.edit.ETextAction.getWordAtCaret(ETextAction.java:86)
at e.edit.Workspace.makeShellCommand(Workspace.java:456)
at e.edit.ExternalToolAction.actionPerformed(ExternalToolAction.java:59)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1225)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1266)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at e.debug.EventDispatchThreadHangMonitor.dispatchEvent(EventDispatchThreadHangMonitor.java:191)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
We could easily pass in the ETextWindow instead of fallibly trying to deduce it from focus:
--- /home/martind/software.jessies.org/work/evergreen/src/e/edit/ETextAction.java (revision 1677)
+++ /home/martind/software.jessies.org/work/evergreen/src/e/edit/ETextAction.java (working copy)
@@ -66,10 +66,11 @@
ETextAction.getSelectedRegularExpression
*
Returns the empty string if no text area has the focus.
*/
public
static String getSearchTerm() {
- PTextArea
textArea = ETextAction.getFocusedTextArea();
- if
(textArea == null) {
+ ETextWindow
textWindow = ETextAction.getFocusedTextWindow();
+ if
(textWindow == null) {
return
"";
}
+ PTextArea
textArea = textWindow.getTextArea();
//
We use the selection, if there is one.
String
selection = textArea.getSelectedText();
@@ -78,20
+79,21 @@ ETextAction.getSearchTerm
}
//
Otherwise, we use the word at the caret.
- return
getWordAtCaret(textArea);
+ return
getWordAtCaret(textWindow);
}
- public static String
getWordAtCaret(PTextArea textArea) {
+ public static String
getWordAtCaret(ETextWindow textWindow) {
+ PTextArea
textArea = textWindow.getTextArea();
CharSequence
chars = textArea.getTextBuffer();
- String
stopChars = chooseStopChars();
+ String
stopChars = chooseStopChars(textWindow);
int
caretPosition = textArea.getSelectionStart();
int
start = PWordUtilities.getWordStart(chars, caretPosition, stopChars);
int
end = PWordUtilities.getWordEnd(chars, caretPosition, stopChars);
return
chars.subSequence(start, end).toString();
}
- private static String
chooseStopChars() {
- FileType
fileType = ETextAction.getFocusedTextWindow().getFileType();
+ private static String
chooseStopChars(ETextWindow textWindow) {
+ FileType
fileType = textWindow.getFileType();
String
stopChars = PWordUtilities.DEFAULT_STOP_CHARS;
if
(fileType == FileType.C_PLUS_PLUS) {
//
"::" is useful in C++, so remove it from the stop list.
--- /home/martind/software.jessies.org/work/evergreen/src/e/edit/Workspace.java (revision 1677)
+++ /home/martind/software.jessies.org/work/evergreen/src/e/edit/Workspace.java (working copy)
@@ -453,7 +453,7 @@
Workspace.makeShellCommand
final
int currentLineNumber = 1 +
textArea.getLineOfOffset(textArea.getSelectionStart());
environment.put("EVERGREEN_CURRENT_LINE_NUMBER",
Integer.toString(currentLineNumber));
- environment.put("EVERGREEN_CURRENT_WORD",
ETextAction.getWordAtCaret(textArea));
+ environment.put("EVERGREEN_CURRENT_WORD",
ETextAction.getWordAtCaret(textWindow));
if
(textArea.getSelectionEnd() - textArea.getSelectionStart() < 1024) {
environment.put("EVERGREEN_CURRENT_SELECTION",
textArea.getSelectedText());
}