Posts

Showing posts from May, 2012

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

Image
Decorating read-only section by line background The second part of this series I am going to explain changing line background color for particular section of editor, in this case read-only code section. We had reached till restricting editing in read-only code section in previous post . After previous post changes, user won’t able to edit in read-only code section, but user should get some kind of feedback about not able to edit the particular section of file. It would be very informative to color the background with grey color so that user understand that greyed out section is read-only. This can be achieved by providing Line background color listen over source viewer. LineBackgroundListener lineBackgroundListener = new LineBackgroundListener(){ @Override public void lineGetBackground(LineBackgroundEvent event) { int offset = event.lineOffset; if (editorSupport.isInsideReadOnlyBlock(offset, 0)){ event.lineBackground = colorManager.getColor

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

Image
Restricting any keyboard input  in read-only section Eclipse plug-in development framework provides a robust editor feature. Given default implementation take care of each and every single requirements of a source editor like color coding, keyword highlighting, content assist , partitions and many more. 9Go through the another series of editor development on my blog for more details about building editor.) Eclipse Editor: Partially editable/read-only editor Series Part 1: Restricting any keyboard input in read-only section Part 2: Decorating read-only section by line background. Part 3: Blocking Editor Actions in read-only code section . Part 4: Blocking drag & drop action to non-editable section Many time we have very strange requirements which standard eclipse framework doesn’t support or there is no straight forward way to achieve it. Many times source files are auto generated by some designing tools and such file can only be editable in the designing tool if i