Skip to content

Commit 1248424

Browse files
committed
Link with Selection Action for Help View toolbar is implemented.
This is similar to JDT Package Explorer's 'Link with Editor' Action. We will refresh the Help View input based on selection if this Action is enabled. see #1874
1 parent 27a1efe commit 1248424

File tree

9 files changed

+360
-1
lines changed

9 files changed

+360
-1
lines changed

ua/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBasePlugin.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ public String getDocumentMessage(boolean embedded) {
7171
public boolean getDocumentMessageUsesLiveHelp(boolean embedded) {
7272
return false;
7373
}
74+
75+
@Override
76+
public boolean isSyncSelection() {
77+
return false;
78+
}
79+
80+
@Override
81+
public void setSyncSelection(boolean syncSel) {
82+
83+
}
7484
};
7585

7686

ua/org.eclipse.help.base/src/org/eclipse/help/internal/base/IHelpActivitySupport.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public interface IHelpActivitySupport {
5757

5858
public void setFilteringEnabled(boolean enabled);
5959

60+
public boolean isSyncSelection();
61+
62+
public void setSyncSelection(boolean syncSel);
63+
6064
public boolean isUserCanToggleFiltering();
6165

6266
/**
Lines changed: 296 additions & 0 deletions
Loading

ua/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpActivitySupport.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.eclipse.core.runtime.IProduct;
2222
import org.eclipse.core.runtime.Platform;
2323
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
24+
import org.eclipse.core.runtime.preferences.IPreferencesService;
2425
import org.eclipse.core.runtime.preferences.InstanceScope;
2526
import org.eclipse.help.internal.HelpPlugin;
2627
import 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;

ua/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/IHelpUIConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public interface IHelpUIConstants {
5555
public static final String IMAGE_CLOSE_HOT = "elcl16/close_hot.svg"; //$NON-NLS-1$
5656
public static final String IMAGE_SYNC_TOC = "elcl16/synch_toc_nav.svg"; //$NON-NLS-1$
5757
public static final String IMAGE_SHOW_ALL = "elcl16/show_all.svg"; //$NON-NLS-1$
58+
public static final String IMAGE_SYNC_SEL = "elcl16/synced.svg"; //$NON-NLS-1$
5859
public static final String IMAGE_DOC_OVR = "ovr16/doc_co.svg"; //$NON-NLS-1$
5960
public static final String IMAGE_SCOPE_SET = "obj16/scopeset_obj.svg"; //$NON-NLS-1$
6061
public static final String IMAGE_SEARCH_WIZ = "wizban/newsearch_wiz.svg"; //$NON-NLS-1$

0 commit comments

Comments
 (0)