Home » Eclipse Projects » Plugin Development Environment (PDE) » Cut, copy and paste actions disabled on AbstractTextEditor
Cut, copy and paste actions disabled on AbstractTextEditor [message #1412704] |
Tue, 26 August 2014 21:54 |
César Iván Orozco Cervantes Messages: 4 Registered: August 2014 |
Junior Member |
|
|
Hi,
Sometime ago I created a simple source editor for Helios which now I'm trying to move to Juno+, this editor is using actions from the AbstractTextEditor class, this class have a method called createActions() with actions including cut, copy and paste, this is the important piece of code on Helios:
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Cut.", this, ITextOperationTarget.CUT); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT);
setAction(ITextEditorActionConstants.CUT, action);
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Copy.", this, ITextOperationTarget.COPY, true); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
setAction(ITextEditorActionConstants.COPY, action);
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Paste.", this, ITextOperationTarget.PASTE); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.PASTE_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);
setAction(ITextEditorActionConstants.PASTE, action);
And on Juno+ that actions are set to null (on first line of each paragraph):
setAction(IWorkbenchCommandConstants.EDIT_CUT, null);
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Cut.", this, ITextOperationTarget.CUT); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT);
setAction(ITextEditorActionConstants.CUT, action);
setAction(IWorkbenchCommandConstants.EDIT_COPY, null);
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Copy.", this, ITextOperationTarget.COPY, true); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
setAction(ITextEditorActionConstants.COPY, action);
setAction(IWorkbenchCommandConstants.EDIT_PASTE, null);
action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Paste.", this, ITextOperationTarget.PASTE); //$NON-NLS-1$
action.setHelpContextId(IAbstractTextEditorHelpContextIds.PASTE_ACTION);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);
setAction(ITextEditorActionConstants.PASTE, action);
Therefore my editor is now throwing a NullPointerException, the question is, why are those actions set to null on newer Eclipse versions? and any pointers on how to resolve this problem?
Thanks!
|
|
|
Goto Forum:
Current Time: Fri Apr 19 20:41:11 GMT 2024
Powered by FUDForum. Page generated in 0.03213 seconds
|