Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How to extend Compare Editor
How to extend Compare Editor [message #1110133] Mon, 16 September 2013 12:18
Vinod Kumar is currently offline Vinod KumarFriend
Messages: 1
Registered: September 2013
Junior Member
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 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 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
at org.eclipse.jface.viewers.ContentViewer$2.widgetDisposed(
at org.eclipse.swt.widgets.TypedListener.handleEvent(
at org.eclipse.swt.widgets.EventTable.sendEvent(
at org.eclipse.swt.widgets.Widget.sendEvent(
at org.eclipse.swt.widgets.Widget.sendEvent(
at org.eclipse.swt.widgets.Widget.sendEvent(
at org.eclipse.swt.widgets.Widget.release(

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?
Previous Topic:Binary not found
Next Topic:new to Eclipse
Goto Forum:

Current Time: Thu Jun 21 16:36:05 GMT 2018

Powered by FUDForum. Page generated in 0.03063 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top