1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-26 02:15:31 +02:00

API cleanup & JavaDoc

This commit is contained in:
Andrew Gvozdev 2011-11-18 16:52:50 -05:00
parent 39431dc5f5
commit 1415806f83
4 changed files with 50 additions and 20 deletions

View file

@ -15,10 +15,27 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
/** /**
* Helper class to allow listeners self-register/dispose. Called by cdt core. * Helper class to allow listeners of arbitrary events self-register/dispose.
* TODO - expand in more detail. *
* Called by CDT core when {@linkplain ICListenerAgent} added/removed to
* the list of {@link ILanguageSettingsProvider}s managed by the model.
* {@linkplain ICListenerAgent} would commonly be implemented by a language
* settings provider.
* <br><br>
* Implementers are to create a specific listener and register it to
* appropriate event manager in {@link #registerListener(ICConfigurationDescription)}
* then unregister and dispose in {@link #unregisterListener()}.
*/ */
public interface ICListenerAgent { public interface ICListenerAgent {
/**
* Registers a specific listener.
*
* @param cfgDescription - configuration description for the listener.
*/
public void registerListener(ICConfigurationDescription cfgDescription); public void registerListener(ICConfigurationDescription cfgDescription);
/**
* Unregister listener and dispose all resources.
*/
public void unregisterListener(); public void unregisterListener();
} }

View file

@ -1,12 +1,12 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2010 Andrew Gvozdev (Quoin Inc.) and others. * Copyright (c) 2009, 2011 Andrew Gvozdev and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation * Andrew Gvozdev - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.language.settings.providers; package org.eclipse.cdt.core.language.settings.providers;
@ -20,32 +20,32 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
/** /**
* Base interface to provide list of {@link ICLanguageSettingEntry}. * Base interface to provide list of {@link ICLanguageSettingEntry}.
* This interface is used to deliver additions to compiler options such as * This interface is used to deliver additions to compiler options such as
* include paths (-I) or preprocessor defines (-D) and others (see * include paths (-I) or preprocessor defines (-D) and others (see
* {@link ICSettingEntry#INCLUDE_PATH} and other kinds). * {@link ICSettingEntry#INCLUDE_PATH} and other kinds).
* * <br>
* To define a provider like that use extension point * To define a provider like that use extension point
* {@code org.eclipse.cdt.core.LanguageSettingsProvider} and implement this * {@code org.eclipse.cdt.core.LanguageSettingsProvider} and implement this
* interface. CDT provides a few general use implementations such as * interface. CDT provides a few general use implementations such as
* {@link LanguageSettingsBaseProvider} which could be used out of the box or * {@link LanguageSettingsBaseProvider} or {@link LanguageSettingsSerializable}
* extended. See extension point schema description LanguageSettingsProvider.exsd * which could be used out of the box or extended. See also extension point
* for more details. * schema description LanguageSettingsProvider.exsd.
* *
* @since 6.0 * @since 6.0
*/ */
public interface ILanguageSettingsProvider { public interface ILanguageSettingsProvider {
/** /**
* Id is used to keep track of the providers internally. Use unique id * Id is used to keep track of the providers internally. Use unique id
* to represent the provider. * to represent the provider.
* *
* @return Id of the provider. * @return Id of the provider.
*/ */
public String getId(); public String getId();
/** /**
* Name is used to present the provider to the end user in UI. * Name is used to present the provider to the end user in UI.
* *
* @return name of the provider. * @return name of the provider.
*/ */
public String getName(); public String getName();
@ -53,12 +53,21 @@ public interface ILanguageSettingsProvider {
/** /**
* Returns the list of setting entries for the given configuration description, * Returns the list of setting entries for the given configuration description,
* resource and language. * resource and language.
* * <br><br>
* Note to implementers - this method should not be used to do any long running
* operations such as extensive calculations or reading files. If you need to do
* so, the recommended way is to do the calculations outside of
* this function call - in advance and on appropriate event. For example, Build
* Output Parser prepares the list and stores it in internal cache while parsing output.
* {@link #getSettingEntries(ICConfigurationDescription, IResource, String)} will
* return cached entries when asked. You can also implement {@link ICListenerAgent}
* interface to get registered and listen to arbitrary events.
*
* @param cfgDescription - configuration description. * @param cfgDescription - configuration description.
* @param rc - resource such as file or folder. * @param rc - resource such as file or folder.
* @param languageId - language id * @param languageId - language id
* (see {@link LanguageManager#getLanguageForFile(org.eclipse.core.resources.IFile, ICConfigurationDescription)}). * (see {@link LanguageManager#getLanguageForFile(org.eclipse.core.resources.IFile, ICConfigurationDescription)}).
* *
* @return the list of setting entries or {@code null} if no settings defined. * @return the list of setting entries or {@code null} if no settings defined.
*/ */
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId); public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId);

View file

@ -83,8 +83,8 @@ public class LanguageSettingsProvidersSerializer {
private ICListenerAgent listener; private ICListenerAgent listener;
private ICConfigurationDescription cfgDescription; private ICConfigurationDescription cfgDescription;
public ListenerAssociation(ICListenerAgent li, ICConfigurationDescription cfgd) { public ListenerAssociation(ICListenerAgent la, ICConfigurationDescription cfgd) {
listener = li; listener = la;
cfgDescription = cfgd; cfgDescription = cfgd;
} }
} }
@ -864,7 +864,7 @@ projects:
} }
/** /**
* Get a providers list including only providers of type ICListenerRegisterer * Get a providers list including only providers of type {@link ICListenerAgent}
* for a given project description - collecting from all configurations. * for a given project description - collecting from all configurations.
*/ */
private static List<ICListenerAgent> getListeners(ICProjectDescription prjDescription) { private static List<ICListenerAgent> getListeners(ICProjectDescription prjDescription) {
@ -895,7 +895,7 @@ projects:
} }
/** /**
* Get a providers list including only providers of type IResourceChangeListener * Get a providers list including only providers of type {@link ICListenerAgent}
* for a given project description - collecting from all configurations. * for a given project description - collecting from all configurations.
*/ */
private static List<ListenerAssociation> getListenersAssociations(ICProjectDescription prjDescription) { private static List<ListenerAssociation> getListenersAssociations(ICProjectDescription prjDescription) {
@ -916,7 +916,8 @@ projects:
/** /**
* Unregister listeners which are not used anymore and register new listeners. * Unregister listeners which are not used anymore and register new listeners.
* The method is used when project description is applied to workspace. * The method is called when project description is applied to workspace.
*
* @param oldPrjDescription - old project descriptions being replaced in the workspace. * @param oldPrjDescription - old project descriptions being replaced in the workspace.
* @param newPrjDescription - new project description being applied to the workspace. * @param newPrjDescription - new project description being applied to the workspace.
*/ */

View file

@ -15,6 +15,9 @@
<appInfo> <appInfo>
<meta.element /> <meta.element />
</appInfo> </appInfo>
<documentation>
This extension point is used to contribute a new Language Settings Provider. A Language Settings Provider is used to get additions to compiler options such as include paths (-I) or preprocessor defines (-D) and others into the project model.
</documentation>
</annotation> </annotation>
<complexType> <complexType>
<sequence minOccurs="1" maxOccurs="unbounded"> <sequence minOccurs="1" maxOccurs="unbounded">