1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Javadoc adjustments.

This commit is contained in:
Sergey Prigogin 2013-03-31 14:46:54 -07:00
parent 52aa9bac76
commit a83be9db5b

View file

@ -27,32 +27,31 @@ import org.eclipse.core.runtime.Platform;
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
public class ToolFactory { public class ToolFactory {
/** /**
* Create an instance of a code formatter. A code formatter implementation can be contributed via the * Creates an instance of a code formatter. A code formatter implementation can be contributed
* extension point "org.eclipse.cdt.core.CodeFormatter". If unable to find a registered extension, the factory * via the extension point "org.eclipse.cdt.core.CodeFormatter". If unable to find a registered
* will default to using the default code formatter. * extension, the factory will default to using the default code formatter.
* @param options - the options map to use for formatting with the code formatter. Recognized options * @param options - the options map to use for formatting with the code formatter. Recognized
* are documented on <code>DefaultCodeFormatterConstants</code>. If set to <code>null</code>, then use * options are documented in {@link DefaultCodeFormatterConstants}. If set to {@code null},
* the current settings from <code>CCorePlugin.getOptions()</code>. * then use the current settings from {@code CCorePlugin.getOptions()}.
* @return an instance of either a contributed the built-in code formatter * @return an instance of either a contributed the built-in code formatter
* @see CodeFormatter * @see CodeFormatter
* @see DefaultCodeFormatterConstants * @see DefaultCodeFormatterConstants
* @see CCorePlugin#getOptions() * @see CCorePlugin#getOptions()
*/ */
public static CodeFormatter createCodeFormatter(Map<String, ?> options){ public static CodeFormatter createCodeFormatter(Map<String, ?> options) {
if (options == null) if (options == null)
options = CCorePlugin.getOptions(); options = CCorePlugin.getOptions();
String formatterID = (String)options.get(CCorePreferenceConstants.CODE_FORMATTER); String formatterID = (String) options.get(CCorePreferenceConstants.CODE_FORMATTER);
String extID = CCorePlugin.FORMATTER_EXTPOINT_ID; String extID = CCorePlugin.FORMATTER_EXTPOINT_ID;
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, extID); IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, extID);
if (extension != null) { if (extension != null) {
IExtension[] extensions = extension.getExtensions(); IExtension[] extensions = extension.getExtensions();
for (int i = 0; i < extensions.length; i++){ for (int i = 0; i < extensions.length; i++) {
IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; j++){ for (int j = 0; j < configElements.length; j++) {
String initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$ String initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$
if (initializerID != null && initializerID.equals(formatterID)){ if (initializerID != null && initializerID.equals(formatterID)) {
try { try {
Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
if (execExt instanceof CodeFormatter){ if (execExt instanceof CodeFormatter){
@ -72,19 +71,21 @@ public class ToolFactory {
} }
/** /**
* Create an instance of the built-in code formatter. * Creates an instance of the built-in code formatter.
* *
* @param options - the options map to use for formatting with the default code formatter. Recognized options * @param options - the options map to use for formatting with the default code formatter.
* are documented on <code>DefaultCodeFormatterConstants</code>. If set to <code>null</code>, then use * Recognized options are documented in {@link DefaultCodeFormatterConstants}. If set to
* the current settings from <code>CCorePlugin.getOptions()</code>. * {@code null}, then use the current settings from {@code CCorePlugin.getOptions()}.
* @return an instance of the built-in code formatter * @return an instance of the built-in code formatter
* @see CodeFormatter * @see CodeFormatter
* @see DefaultCodeFormatterConstants * @see DefaultCodeFormatterConstants
* @see CCorePlugin#getOptions() * @see CCorePlugin#getOptions()
*/ */
public static CodeFormatter createDefaultCodeFormatter(Map<String, ?> options){ public static CodeFormatter createDefaultCodeFormatter(Map<String, ?> options) {
if (options == null) if (options == null)
options = CCorePlugin.getOptions(); options = CCorePlugin.getOptions();
return new CCodeFormatter(options); return new CCodeFormatter(options);
} }
private ToolFactory() {}
} }