Posts

Showing posts with the label editor

Eclipse Editor: Partially editable/read-only editor Part 4

Image
Blocking drag & drop action to non-editable section It is an additional post to Eclipse Editor: Partially editable/read-only editor series . In all the previous pos ts I have explained making editor partially editable step by step to make functionality more robust. This post I am going to explain how to block drag & drop action to non-editable section of editor. Eclipse’s default implementation of text editor supports drag and drop of selection of text. When you have read-only as well as editable code section present, then such drag and drop may disturb read-only code section. To prevent the read-only code section from getting modified knowing or unknowingly , any drop action on read-on code section should be disabled. Eclipse TextEditor gives handle to DragAndDrop service , using it you can install your own implementation for DropTragetListener against the expected source viewer control. In your implementation any drop operation on the read-only code section can be ignore...

Eclipse Editor: Partially editable/read-only editor Part 3

Blocking Editor Actions in read-only code section: In addition to previous posts about partially editable/read-only editor, I am going to explain blocking editor actions like Ctrl-D in read-only code sections. Till now I have taken care of keyboard events and background color for read only code section. This post, we will see restricting editor actions like Ctrl-D, move line up/down etc. I am going to extend same example of XML editor . In this example, XMLEditor extends TextEditors and hence AbstractTextEditor. AbstractTextEditor is the one who introduces all basic text editor actions to text editor. Few of these actions are Delete Line Cut line move line up/down copy line up/down Shift Left/Right Every Action implements IAction directly or indirectly, IAction provides flexibility of enabling/disabling or handling by providing following set of methods 1: /** 2: * Returns whether this action is enabled. 3: * <p> 4: ...