Bug 60172 - [Preferences] Compare editor does not keep two sides in line
Summary: [Preferences] Compare editor does not keep two sides in line
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P2 major (vote)
Target Milestone: 3.0 M9   Edit
Assignee: DJ Houghton CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 60190 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-04-27 15:17 EDT by Douglas Pollock CLA
Modified: 2004-04-29 16:39 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Douglas Pollock CLA 2004-04-27 15:17:11 EDT
When doing a CVS compare with head, I notice that the two halves of the compare 
show differences, but that there are no "links" between the two halves -- 
indicating how the differences line up.  Also, when moving one scroll bar, only 
one half moves; the editors do not stay in line with each other. 
 
I200404270800.  Linux GTK+ 2.4.0.
Comment 1 Stefan Xenos CLA 2004-04-27 17:55:58 EDT
*** Bug 60190 has been marked as a duplicate of this bug. ***
Comment 2 Andre Weinand CLA 2004-04-27 18:03:00 EDT
The default preference settings for the preference page are no longer respected.
Since I didn't change anything in that area for months, I suspect a problem somewhere else.

The workaround is to enable the "Synchronize Scrolling..." preference manually.

Moving to platform UI for comment.
Comment 3 Andre Weinand CLA 2004-04-27 18:58:10 EDT
It seems that the method AbstractUIPlugin.initializeDefaultPluginPreferences doesn't get called for the 
CompareUIPlugin.
Did I miss any change in that area?
Comment 4 Kim Horne CLA 2004-04-28 08:38:03 EDT
Nick, you've recently made changes to the preference support... could this be a
regression caused by those changes?
Comment 5 Nick Edgar CLA 2004-04-28 11:47:40 EDT
The changes to how prefs are initialized in the workbench should not affect
compare's preference initialization.

There have been changes to core preference initialization which may have
affected this.

DJ, can you investigate?
Comment 6 DJ Houghton CLA 2004-04-28 13:37:13 EDT
CompareUIPlugin.startup initializes the preference store which in turn tries to
initialize the default values. The new mechanism gets the plug-in descriptor
from the registry and then calls #getPlugin. 

The plug-in object returned is not CompareUIPlugin but is a generic plug-in
object since we are still in the startup/initialization of this plug-in. (thus
when the #initializeDefaultPluginPreferences method is called, its not called on
the compare plug-in)

I will investigate further and talk to the runtime folk.
Comment 7 DJ Houghton CLA 2004-04-28 14:33:46 EDT
Oops, I made a typo in my previous comment...it should have said that the
initialization is done in the CompareUIPlugin constructor. (not #startup)

Here is a small test case which exhibits the same behaviour:

  public class MyPlugin extends Plugin {
     private static final String PLUGIN_ID = "com.example";
     public MyPlugin(IPluginDescriptor descriptor) {
        super(descriptor);
        Platform.getPlugin(PLUGIN_ID); // returns generic plug-in object
     }
  }

The plug-in object isn't finished being initialized so its not yet available via
the plug-in registry.

The old runtime preferences wrapper the new mechanism and at that time they know
which plug-in object they are calling from. I will investigate passing this down
into the implementation of the default nodes.

Either way, the story going forward is that the following code will still result
in the same problem. But if a plug-in is accessing the preference store via the
new APIs (IEclipsePreferences#node) then they must use the extension point to
specify their preference initializer and not rely on the 2.1 behaviour.

  public class MyPlugin extends Plugin {
     private static final String PLUGIN_ID = "com.example";
     public MyPlugin(IPluginDescriptor descriptor) {
        super(descriptor);
        IPreferencesService service = Platform.getPreferencesService();
        // returns generic plug-in object
        service.getRootNode().node(DefaultScope.SCOPE).node(PLUGIN_ID);     
     }
  }
Comment 8 DJ Houghton CLA 2004-04-29 11:49:01 EDT
Fix released to HEAD.