Example usage for org.eclipse.jdt.internal.core JavaModelManager CPVARIABLE_INITIALIZER_EXTPOINT_ID

List of usage examples for org.eclipse.jdt.internal.core JavaModelManager CPVARIABLE_INITIALIZER_EXTPOINT_ID

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core JavaModelManager CPVARIABLE_INITIALIZER_EXTPOINT_ID.

Prototype

String CPVARIABLE_INITIALIZER_EXTPOINT_ID

To view the source code for org.eclipse.jdt.internal.core JavaModelManager CPVARIABLE_INITIALIZER_EXTPOINT_ID.

Click Source Link

Document

Name of the extension point for contributing classpath variable initializers

Usage

From source file:org.eclipse.jdt.internal.core.JavaModelManager.java

License:Open Source License

/**
  * Returns the name of the variables for which an CP variable initializer is registered through an extension point
  *///  w  w w  .j  av a  2 s  .co m
public static String[] getRegisteredVariableNames() {

    Plugin jdtCorePlugin = JavaCore.getPlugin();
    if (jdtCorePlugin == null)
        return null;

    ArrayList variableList = new ArrayList(5);
    IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(JavaCore.PLUGIN_ID,
            JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID);
    if (extension != null) {
        IExtension[] extensions = extension.getExtensions();
        for (int i = 0; i < extensions.length; i++) {
            IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
            for (int j = 0; j < configElements.length; j++) {
                String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$
                if (varAttribute != null)
                    variableList.add(varAttribute);
            }
        }
    }
    String[] variableNames = new String[variableList.size()];
    variableList.toArray(variableNames);
    return variableNames;
}