diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml index 979559724ab..05226a7de0a 100644 --- a/build/org.eclipse.cdt.make.ui/plugin.xml +++ b/build/org.eclipse.cdt.make.ui/plugin.xml @@ -431,6 +431,7 @@ name="%Includes" icon="icons/obj16/hfolder_obj.gif" weight="001" + helpId="cdt_u_prop_pns_inc" parent="org.eclipse.cdt.make.internal.ui.properties.PathAndSymbolPage" tooltip=""Includes list""/> diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml index 585e77b68cb..941d02504c8 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml +++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml @@ -217,44 +217,52 @@ icon="icons/elcl16/discovery.gif" name="(Single) Discovery.options" weight="005" + helpId="cdt_u_prop_build_discovery" parent="org.eclipse.cdt.managedbuilder.ui.properties.Page_Discovery"/> @@ -263,6 +271,7 @@ icon="icons/obj16/hfolder_obj.gif" name="%Includes" weight="001" + helpId="cdt_u_prop_pns_inc" parent="org.eclipse.cdt.managedbuilder.ui.properties.Page_PathAndSymb" tooltip=""Includes list""/> - @@ -358,54 +381,65 @@ class="org.eclipse.cdt.ui.newui.EnvironmentTab" icon="icons/obj16/environment.gif" name="(Single) Environment" + helpId="cdt_u_prop_build_environment" parent="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_Env"/> diff --git a/core/org.eclipse.cdt.ui/schema/cPropertyTab.exsd b/core/org.eclipse.cdt.ui/schema/cPropertyTab.exsd index fa0fbf67de4..80d913608e2 100644 --- a/core/org.eclipse.cdt.ui/schema/cPropertyTab.exsd +++ b/core/org.eclipse.cdt.ui/schema/cPropertyTab.exsd @@ -1,10 +1,10 @@ - + - + - + Implementation of property/preference UI element. @@ -51,9 +51,9 @@ their weights. - + - + @@ -67,9 +67,9 @@ their weights. Icon to be displayed for corresponding tab in tabfolder. Ignored for single-tab pages - + - + @@ -77,9 +77,9 @@ Ignored for single-tab pages Class implementing org.eclipse.cdt.managedbuilder.ui.newproperties.ICPropertyTab - + - + @@ -103,7 +103,7 @@ but it is not obligatory. - + Text of tooltip shown over the tab. @@ -115,22 +115,29 @@ Ignored for single-tab page. + + + + Help context Id for given tab. + + + - + - + 4.0 - + - + <extension point="org.eclipse.cdt.ui.cPropertyTab"> @@ -145,19 +152,20 @@ Ignored for single-tab page. - + - + Tabs must implement interface: org.eclipse.cdt.managedbuilder.ui.newproperties.ICPropertyTab + - + - + Implementors in org.eclipse.cdt.ui.newui: BinaryParsTab @@ -192,9 +200,9 @@ ToolSettingsTab - + - + /******************************************************************************* * Copyright (c) 2007 Intel Corporation and others. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java index 0cafdcce4e5..60e3963c2ea 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractCPropertyTab.java @@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; import org.eclipse.ui.dialogs.ISelectionStatusValidator; import org.eclipse.ui.model.WorkbenchContentProvider; @@ -101,6 +102,8 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { public static final String WORKSPACE_DIR_DIALOG_ERR = UIMessages.getString("BrowseEntryDialog.wsp.dir.dlg.err"); //$NON-NLS-1$ public static final String BACKGROUND_TEXT_DEFAULT = UIMessages.getString("AbstractCPropertyTab.2"); //$NON-NLS-1$ public static final Color BACKGROUND_FOR_USER_VAR = new Color(Display.getDefault(), 255, 255, 200); // light yellow + + private static final String PREFIX = "org.eclipse.cdt.ui."; //$NON-NLS-1$ public static final int TRI_UNKNOWN = 2; public static final int TRI_YES = 1; @@ -115,6 +118,7 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { private Button[] buttons; // buttons in buttoncomp public ICPropertyProvider page; protected Image icon = null; + private String helpId = EMPTY_STR; protected boolean visible; @@ -141,6 +145,8 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { GridData d = new GridData(GridData.END); d.widthHint = 1; buttoncomp.setLayoutData(d); + + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, helpId); } /** @@ -668,4 +674,11 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab { return (wmode == CDTPrefUtil.WMODE_MODIFY); } + public String getHelpContextId() { + return helpId; + } + + public void setHelpContextId(String id) { + helpId = PREFIX + id; + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java index 24bd4c1803f..d1fc619f549 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java @@ -32,6 +32,8 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.QualifiedName; +import org.eclipse.help.HelpSystem; +import org.eclipse.help.IContext; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.preference.IPreferencePageContainer; @@ -61,6 +63,7 @@ import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPartReference; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation; import org.eclipse.ui.dialogs.PropertyPage; @@ -114,13 +117,14 @@ implements private static ICConfigurationDescription[] multiCfgs = null; // selected multi cfg // tabs private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.cPropertyTab"; //$NON-NLS-1$ - public static final String ELEMENT_NAME = "tab"; //$NON-NLS-1$ - public static final String CLASS_NAME = "class"; //$NON-NLS-1$ - public static final String PARENT_NAME = "parent"; //$NON-NLS-1$ - public static final String IMAGE_NAME = "icon"; //$NON-NLS-1$ - public static final String TIP_NAME = "tooltip"; //$NON-NLS-1$ - public static final String TEXT_NAME = "name"; //$NON-NLS-1$ - public static final String WEIGHT_NAME = "weight"; //$NON-NLS-1$ + private static final String ELEMENT_NAME = "tab"; //$NON-NLS-1$ + private static final String CLASS_NAME = "class"; //$NON-NLS-1$ + private static final String PARENT_NAME = "parent"; //$NON-NLS-1$ + private static final String IMAGE_NAME = "icon"; //$NON-NLS-1$ + private static final String TIP_NAME = "tooltip"; //$NON-NLS-1$ + private static final String TEXT_NAME = "name"; //$NON-NLS-1$ + private static final String WEIGHT_NAME = "weight"; //$NON-NLS-1$ + private static final String HELPID_NAME = "helpId"; //$NON-NLS-1$ private static final Object NOT_NULL = new Object(); public static final String EMPTY_STR = ""; //$NON-NLS-1$ @@ -888,6 +892,13 @@ implements } if (page == null) return false; + String helpId = element.getAttribute(HELPID_NAME); + if (helpId != null && helpId.length() > 0 + // TODO: in next version: refer to ICPropertyTab instead of AbstractCPropertyTab + && page instanceof AbstractCPropertyTab) { + ((AbstractCPropertyTab)page).setHelpContextId(helpId); + } + Image _img = getIcon(element); if (_img != null) page.handleTabEvent(ICPropertyTab.SET_ICON, _img); @@ -1092,17 +1103,20 @@ implements public Button getDButton() { return getDefaultsButton(); } -/* + @Override public void performHelp() { + // TODO: in next version: refer to ICPropertyTab instead of AbstractCPropertyTab if (currentTab != null && currentTab instanceof AbstractCPropertyTab) { String s = ((AbstractCPropertyTab)currentTab).getHelpContextId(); - if (s != null) { + if (s != null && s.length() > 0) { IContext context= HelpSystem.getContext(s); - PlatformUI.getWorkbench().getHelpSystem().displayHelp(context); -// PlatformUI.getWorkbench().getHelpSystem().displayHelp(s); + if (context != null) + PlatformUI.getWorkbench().getHelpSystem().displayHelp(context); + else + PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp(); } } } -*/ + } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyTab.java index 054181868c3..3979e43eef8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ICPropertyTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Intel Corporation and others. + * Copyright (c) 2007, 2008 Intel Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -60,5 +60,16 @@ public interface ICPropertyTab { * settings are not possible when managed build is off). */ public boolean canBeVisible(); - + + //********************************* + // TODO: in next version, add : + //********************************* + /** + * @return Help Context Id + */ + // public String getHelpContextId(); + /** + * set Help Context Id for the tab + */ + // public void setHelpContextId(String id); } diff --git a/doc/org.eclipse.cdt.doc.user/contexts_CDT.xml b/doc/org.eclipse.cdt.doc.user/contexts_CDT.xml index 3a04a1f15f3..b9aee2cc2ae 100644 --- a/doc/org.eclipse.cdt.doc.user/contexts_CDT.xml +++ b/doc/org.eclipse.cdt.doc.user/contexts_CDT.xml @@ -354,4 +354,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +