Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Compare Editor following the cursor(Compare editor API problems)
Compare Editor following the cursor [message #636644] Tue, 02 November 2010 10:23 Go to next message
Nadav is currently offline NadavFriend
Messages: 29
Registered: July 2009
Junior Member
I'm trying to get or follow the cursor in org.eclipse.compare.internal.CompareEditor

I can follow the selection by adding an EditorSelectionChangedListener to compareEditor.getSite().getSelectionProvider(), however this only helps when text is selected, not when the cursor is set(without selecting text).

In an AbstractTextEditor I can surmount this problem with com.ibm.seecode.util.ListeningStatusField, but this class only can work on Text Editors, not on the CompareEditor.

Is there a way to get the cursor location in the CompareEditor???
Re: Compare Editor following the cursor [message #636761 is a reply to message #636644] Tue, 02 November 2010 16:36 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Nadav wrote:
> I'm trying to get or follow the cursor in
> org.eclipse.compare.internal.CompareEditor
>
> I can follow the selection by adding an EditorSelectionChangedListener
> to compareEditor.getSite().getSelectionProvider(), however this only
> helps when text is selected, not when the cursor is set(without
> selecting text).
>
> In an AbstractTextEditor I can surmount this problem with
> com.ibm.seecode.util.ListeningStatusField, but this class only can
> work on Text Editors, not on the CompareEditor.
>
> Is there a way to get the cursor location in the CompareEditor???
Check if the selection provider is an IPostSelectionProvider. If so, use
that one.

Dani
Re: Compare Editor following the cursor [message #636890 is a reply to message #636761] Wed, 03 November 2010 09:13 Go to previous message
Nadav is currently offline NadavFriend
Messages: 29
Registered: July 2009
Junior Member
It does implement IPostSelectionProvider and I changed provider.addSelectionChangedListener(listener) to provider.addPostSelectionChangedListener(listener); however the behavior is the same i.e. simply moving the cursor does not even register as an event: only selecting text registers as an event.

Does Eclipse version make a difference? I'm working with Galileo.

Also, why does Selection vs Post-Selection make a difference? Isn't it just an issue of when the event is triggered--before or after the selection change is processed?

As far as I can tell, this is a result of incorrect interface design of the Compare editor since selection events give you either:
a) the cursor selection(if there is one)
b) otherwise it returns the 'current difference'(can be a totally different place than the cursor

What the CompareEditor really needs is 3 separate methods for tracking 3 different entities:
1) current difference
2) cursor position
3) cursor selection
Previous Topic:Deploy a JBoss BPEL project to
Next Topic:Eclipse SDK for "hpux.motif.ia64" 64 bit
Goto Forum:
  


Current Time: Sat Apr 27 00:31:25 GMT 2024

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

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

Back to the top