|How to extend Compare Editor [message #1110133]
||Mon, 16 September 2013 12:18
| Vinod Kumar
Registered: September 2013
I need to add a context menu on vertical ruler of a left pane of eclipse compare editor. Another requirement is to have an annotation column on left pane of compare editor vertical ruler to show my annotations. Now since compare editor does not vertical ruler, I tried contributing to the extension point org.eclipse.compare.contentMergeViewers and extend TextMergeViewer, but as it does not expose MergeSourceViewer, I'm trying to get it using reflection, so that I can get SourceViewer on the left pane (MergeSourceViewer) which will give me the vertical ruler object.|
This way I can show vertical ruler on the left side of compare editor. Now this custom compare editor is available as one of the options but cannot be opened as default compare editor (as system default editor take precedence over custom editor and and custom editor can be attached as default editor for specific file type only which does not have any default editor).
What is want is to open 2 versions of my file when I double click on a view where file is listed in tree structure and this file can be any text file (java, txt, xml, properties etc).
Now to force the custom compare editor to open on double click I extended the findContentViewer() method of CompareEditorInput class. In this method I returned an instance of custom viewer irrespective of the file type (discarding the instantiated default viewer) and also removed the org.eclipse.compare.contentMergeViewers extension entry from plugin.xml. This way, I can open the custom compare editor on double click on file node of the tree structured view. Now the problem I'm facing is that when I close the custom editor, I get java.lang.NullPointerException
Now the questions are:
1. Is this the right approach to implement the required functionality?
2. If not then what will be the right approach to implement this?
3. What is the reason of NullPointerException and how to resolve this?
Powered by FUDForum
. Page generated in 0.02374 seconds