2121import org .eclipse .core .runtime .IProduct ;
2222import org .eclipse .core .runtime .Platform ;
2323import org .eclipse .core .runtime .preferences .IEclipsePreferences ;
24+ import org .eclipse .core .runtime .preferences .IPreferencesService ;
2425import org .eclipse .core .runtime .preferences .InstanceScope ;
2526import org .eclipse .help .internal .HelpPlugin ;
2627import org .eclipse .help .internal .base .HelpBasePlugin ;
@@ -42,9 +43,12 @@ public class HelpActivitySupport implements IHelpActivitySupport {
4243 private static final String SHOW_DISABLED_ACTIVITIES_ON = "on" ; //$NON-NLS-1$
4344// private static final String SHOW_DISABLED_ACTIVITIES_ALWAYS = "always"; //$NON-NLS-1$
4445
46+ private static final String PREF_KEY_SYNC_SEL = "syncSelection" ; //$NON-NLS-1$
47+
4548 private final IWorkbenchActivitySupport activitySupport ;
4649 private boolean userCanToggleFiltering ;
4750 private boolean filteringEnabled ;
51+ private boolean syncSelection ;
4852 private final ActivityDescriptor activityDescriptor ;
4953
5054 static class ActivityDescriptor {
@@ -122,8 +126,9 @@ public HelpActivitySupport(IWorkbench workbench) {
122126 activitySupport = workbench .getActivitySupport ();
123127 activityDescriptor = new ActivityDescriptor ();
124128
129+ IPreferencesService prefService = Platform .getPreferencesService ();
125130 String showDisabledActivities =
126- Platform . getPreferencesService () .getString (HelpBasePlugin .PLUGIN_ID , PREF_KEY_SHOW_DISABLED_ACTIVITIES , "" , null ); //$NON-NLS-1$
131+ prefService .getString (HelpBasePlugin .PLUGIN_ID , PREF_KEY_SHOW_DISABLED_ACTIVITIES , "" , null ); //$NON-NLS-1$
127132 userCanToggleFiltering = SHOW_DISABLED_ACTIVITIES_OFF
128133 .equalsIgnoreCase (showDisabledActivities )
129134 || SHOW_DISABLED_ACTIVITIES_ON
@@ -136,6 +141,8 @@ public HelpActivitySupport(IWorkbench workbench) {
136141 || SHOW_DISABLED_ACTIVITIES_NEVER
137142 .equalsIgnoreCase (showDisabledActivities );
138143 filteringEnabled = filteringEnabled && isWorkbenchFiltering ();
144+
145+ syncSelection = prefService .getBoolean (HelpBasePlugin .PLUGIN_ID , PREF_KEY_SYNC_SEL , false , null );
139146 }
140147
141148 @ Override
@@ -162,6 +169,22 @@ public void setFilteringEnabled(boolean enabled) {
162169 }
163170 }
164171
172+ @ Override
173+ public boolean isSyncSelection () {
174+ return syncSelection ;
175+ }
176+
177+ @ Override
178+ public void setSyncSelection (boolean syncSel ) {
179+ this .syncSelection = syncSel ;
180+ IEclipsePreferences prefs = InstanceScope .INSTANCE .getNode (HelpBasePlugin .PLUGIN_ID );
181+ prefs .putBoolean (PREF_KEY_SYNC_SEL , syncSel );
182+ try {
183+ prefs .flush ();
184+ } catch (BackingStoreException e ) {
185+ }
186+ }
187+
165188 @ Override
166189 public boolean isUserCanToggleFiltering () {
167190 return userCanToggleFiltering ;
0 commit comments