Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "CDT/Obsolete/ScannerDiscovery61/API"
< CDT | Obsolete | ScannerDiscovery61
m (→API) |
m (→API) |
||
Line 4: | Line 4: | ||
=== API === | === API === | ||
− | + | * New interface [https://github.com/angvoz/SD80/blob/sd80.Patch1.CDT/all/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ILanguageSettingsProvider.java ILanguageSettingsProvider]. This base interface is the cornerstone of the new Scanner Discovery functionality. It defines following: | |
− | This base interface is the cornerstone of the new Scanner Discovery functionality. | + | public interface ILanguageSettingsProvider { |
+ | public String getId(); | ||
+ | public String getName(); | ||
+ | public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId); | ||
+ | } | ||
+ | * [https://github.com/angvoz/SD80/blob/sd80.Patch1.CDT/all/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsBaseProvider.java LanguageSettingsBaseProvider] is a an implementation of ILanguageSettingsProvider for the new extension point [https://github.com/angvoz/SD80/blob/sd80.Patch1.CDT/all/org.eclipse.cdt.core/schema/externalSettingsProvider.exsd org.eclipse.cdt.core.LanguageSettingsProvider]. This class is intended to be extended by concrete provider implementations like GCC Build Output Parser etc. | ||
+ | * [https://github.com/angvoz/SD80/blob/sd80.Patch1.CDT/all/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsManager.java LanguageSettingsManager] is a utility class. It provides following API methods, mostly for the usage by UI plugin: | ||
+ | public class LanguageSettingsManager { | ||
+ | ... | ||
+ | /** | ||
+ | * Returns the list of setting entries of the given provider | ||
+ | * for the given configuration description, resource and language. | ||
+ | * This method reaches to the parent folder of the resource recursively | ||
+ | * in case the resource does not define the entries for the given provider. | ||
+ | * | ||
+ | * @param provider - language settings provider. | ||
+ | * @param cfgDescription - configuration description. | ||
+ | * @param rc - resource such as file or folder. | ||
+ | * @param languageId - language id. | ||
+ | * | ||
+ | * @return the list of setting entries. Never returns {@code null} | ||
+ | * although individual providers return {@code null} if no settings defined. | ||
+ | */ | ||
+ | public static List<ICLanguageSettingEntry> getSettingEntriesUpResourceTree(ILanguageSettingsProvider provider, ICConfigurationDescription cfgDescription, IResource rc, String languageId) { | ||
+ | return LanguageSettingsExtensionManager.getSettingEntriesUpResourceTree(provider, cfgDescription, rc, languageId); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Returns the list of setting entries of a certain kind (such as include paths) | ||
+ | * for the given configuration description, resource and language. This is a | ||
+ | * combined list for all providers taking into account settings of parent folder | ||
+ | * if settings for the given resource are not defined. | ||
+ | * | ||
+ | * @param cfgDescription - configuration description. | ||
+ | * @param rc - resource such as file or folder. | ||
+ | * @param languageId - language id. | ||
+ | * @param kind - kind of language settings entries, such as | ||
+ | * {@link ICSettingEntry#INCLUDE_PATH} etc. This is a binary flag | ||
+ | * and it is possible to specify composite kind. | ||
+ | * Use {@link ICSettingEntry#ALL} to get all kinds. | ||
+ | * | ||
+ | * @return the list of setting entries. | ||
+ | */ | ||
+ | public static List<ICLanguageSettingEntry> getSettingEntriesByKind(ICConfigurationDescription cfgDescription, IResource rc, String languageId, int kind) { | ||
+ | return LanguageSettingsExtensionManager.getSettingEntriesByKind(cfgDescription, rc, languageId, kind); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * @return a list of language settings providers defined on workspace level. | ||
+ | * That includes providers defined as | ||
+ | * extensions via {@code org.eclipse.cdt.core.LanguageSettingsProvider} | ||
+ | * extension point. | ||
+ | */ | ||
+ | public static List<ILanguageSettingsProvider> getWorkspaceProviders() { | ||
+ | return LanguageSettingsExtensionManager.getExtensionProviders(); | ||
+ | } | ||
+ | ... | ||
+ | } |
Revision as of 14:09, 26 December 2010
Scanner Discovery project
The project is hosted currently on GitHub. Please, refer there https://github.com/angvoz/SD80/ for the most recent API and code. Use branch [sd80] for bleeding edge code and [sd80.Patch#.CDT] to take a look at clean patches intended for CDT submission.
API
- New interface ILanguageSettingsProvider. This base interface is the cornerstone of the new Scanner Discovery functionality. It defines following:
public interface ILanguageSettingsProvider { public String getId(); public String getName(); public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId); }
- LanguageSettingsBaseProvider is a an implementation of ILanguageSettingsProvider for the new extension point org.eclipse.cdt.core.LanguageSettingsProvider. This class is intended to be extended by concrete provider implementations like GCC Build Output Parser etc.
- LanguageSettingsManager is a utility class. It provides following API methods, mostly for the usage by UI plugin:
public class LanguageSettingsManager { ... /** * Returns the list of setting entries of the given provider * for the given configuration description, resource and language. * This method reaches to the parent folder of the resource recursively * in case the resource does not define the entries for the given provider. * * @param provider - language settings provider. * @param cfgDescription - configuration description. * @param rc - resource such as file or folder. * @param languageId - language id. * * @return the list of setting entries. Never returns {@code null} * although individual providers return {@code null} if no settings defined. */ public static List<ICLanguageSettingEntry> getSettingEntriesUpResourceTree(ILanguageSettingsProvider provider, ICConfigurationDescription cfgDescription, IResource rc, String languageId) { return LanguageSettingsExtensionManager.getSettingEntriesUpResourceTree(provider, cfgDescription, rc, languageId); } /** * Returns the list of setting entries of a certain kind (such as include paths) * for the given configuration description, resource and language. This is a * combined list for all providers taking into account settings of parent folder * if settings for the given resource are not defined. * * @param cfgDescription - configuration description. * @param rc - resource such as file or folder. * @param languageId - language id. * @param kind - kind of language settings entries, such as * {@link ICSettingEntry#INCLUDE_PATH} etc. This is a binary flag * and it is possible to specify composite kind. * Use {@link ICSettingEntry#ALL} to get all kinds. * * @return the list of setting entries. */ public static List<ICLanguageSettingEntry> getSettingEntriesByKind(ICConfigurationDescription cfgDescription, IResource rc, String languageId, int kind) { return LanguageSettingsExtensionManager.getSettingEntriesByKind(cfgDescription, rc, languageId, kind); } /** * @return a list of language settings providers defined on workspace level. * That includes providers defined as * extensions via {@code org.eclipse.cdt.core.LanguageSettingsProvider} * extension point. */ public static List<ILanguageSettingsProvider> getWorkspaceProviders() { return LanguageSettingsExtensionManager.getExtensionProviders(); } ...
}