Bug 58392 - [EditorMgmt] restoreSelection after elementContentReplaced
Summary: [EditorMgmt] restoreSelection after elementContentReplaced
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-13 18:39 EDT by Kit Lo CLA
Modified: 2019-09-06 16:19 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kit Lo CLA 2004-04-13 18:39:16 EDT
Inner class of AbstractTextEditor, ElementStateListener, tries to restore the 
selection in the editor after elementContentReplaced (Revert File action). See 
the following method:

public void elementContentReplaced(Object element) {
  if (element != null && element.equals(getEditorInput())) {
    Runnable r= new Runnable() {
      public void run() {
        enableSanityChecking(true);
        firePropertyChange(PROP_DIRTY);
        restoreSelection();
      }
    };
    execute(r);
  }
}

====================
However, the selection after Revert File is very unpredictable. If the bottom 
half of file was changed, the restoreSelection may work okay. If lines were 
deleted from the top half of the file, the restored selection is very 
uppredicatable.

Usually, Revert is used to start the edit session all over again (because the 
changes in the editor are all messed up). I think it's very reasonable to reset 
the curor to the beginning of the file, instead of trying restore the cursor to 
the last selection in the editor.
Comment 1 Michael Van Meekeren CLA 2006-04-21 13:19:27 EDT
Moving Dougs bugs
Comment 2 Susan McCourt CLA 2009-07-09 19:04:20 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 3 Boris Bokowski CLA 2009-11-17 13:02:11 EST
Remy is now responsible for watching the [EditorMgmt] component area.
Comment 4 Eclipse Webmaster CLA 2019-09-06 16:19:13 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.