de.slission.mps.richtext actions are causing NullPointers due to insufficiient isApplicable checks.
Issues occur, for instance, when shortcuts (e.g. ctrl shift delete) are pressed in any EditorCell_Label which does not belong to a richtext editor - like any other name property cell.
Actions like DeleteToLineEnd should check if the selected cell belongs to a node which is part of the richtext lang so that it does not interfere with other actions which could be assigned to the same shortcut but are really applicable in the current context.
EditorCell_Word selectedCell = context.getSelectedCell() as EditorCell_Word; selectedCell.changeText(selectedCell.getTextBeforeCaret()); if a "soft cast" is used, the present of none null should be checked afterwards to prevent a null pointer.
User's action execute method failed. Action: Delete to Line End. Class: de.slisson.mps.richtext.plugin.DeleteToLineEnd_Action
java.lang.NullPointerException: Cannot invoke "de.slisson.mps.editor.multiline.cells.EditorCell_Word.getTextBeforeCaret()" because "selectedCell" is null
at de.slisson.mps.richtext.editor.TextModificationUtil.removeTextFromCaretToLineEnd(TextModificationUtil.java:78)
at de.slisson.mps.richtext.plugin.DeleteToLineEnd_Action.doExecute(DeleteToLineEnd_Action.java:54)
at jetbrains.mps.workbench.action.BaseAction.lambda$actionPerformed$2(BaseAction.java:208)
at jetbrains.mps.editor.runtime.commands.EditorCommandAdapter.doExecute(EditorCommandAdapter.java:46)
at jetbrains.mps.editor.runtime.commands.EditorCommand.run(EditorCommand.java:55)
at jetbrains.mps.smodel.WorkbenchModelAccess$UndoContextSetup.run(WorkbenchModelAccess.java:367)
at jetbrains.mps.smodel.ActionDispatcher.dispatch(ActionDispatcher.java:98)
at jetbrains.mps.smodel.ActionDispatcher.lambda$wrap$0(ActionDispatcher.java:135)
at jetbrains.mps.smodel.ActionDispatcher.dispatch(ActionDispatcher.java:98)
at jetbrains.mps.smodel.ActionDispatcher.lambda$wrap$0(ActionDispatcher.java:135)
at jetbrains.mps.smodel.LockRunnable.run(LockRunnable.java:60)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1023)
at jetbrains.mps.smodel.TryRunPlatformWriteHelper.runWrite(TryRunPlatformWriteHelper.java:103)
at jetbrains.mps.smodel.TryRunPlatformWriteHelper.lambda$withPlatformWrite$1(TryRunPlatformWriteHelper.java:96)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164)
at jetbrains.mps.smodel.WorkbenchModelAccess.executeCommand(WorkbenchModelAccess.java:302)
at jetbrains.mps.smodel.ProjectModelAccess2.executeCommand(ProjectModelAccess2.java:35)
at jetbrains.mps.ide.editor.EditorActionAccess.runWithAccess(EditorActionAccess.java:32)
at jetbrains.mps.workbench.action.BaseAction.actionPerformed(BaseAction.java:200)
at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:315)
at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:47)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:595)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$9(IdeKeyEventDispatcher.java:717)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$10(IdeKeyEventDispatcher.java:717)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:337)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.doPerformActionInner(IdeKeyEventDispatcher.java:714)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:658)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:606)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:489)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:478)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:229)
at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:824)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:760)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:450)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:449)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:624)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:447)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:493)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
de.slission.mps.richtext actions are causing NullPointers due to insufficiient isApplicable checks.
Issues occur, for instance, when shortcuts (e.g. ctrl shift delete) are pressed in any EditorCell_Label which does not belong to a richtext editor - like any other name property cell.
DeleteToLineEnd
should check if the selected cell belongs to a node which is part of the richtext lang so that it does not interfere with other actions which could be assigned to the same shortcut but are really applicable in the current context.EditorCell_Word selectedCell = context.getSelectedCell() as EditorCell_Word; selectedCell.changeText(selectedCell.getTextBeforeCaret());
if a "soft cast" is used, the present of none null should be checked afterwards to prevent a null pointer.