Skip to content

Commit

Permalink
Summary: Refactoring code.(T54828)
Browse files Browse the repository at this point in the history
Bugzilla Bug Resolved:

Description:
Added extension ID argument for some methods.
  • Loading branch information
heli committed Dec 4, 2012
1 parent 9fa6ce3 commit 968dac6
Showing 1 changed file with 58 additions and 4 deletions.
Expand Up @@ -975,14 +975,15 @@ public final String[] getRegisteredSeries( ) throws ChartException
* Returns a list of registered device renderer output formats and display
* names.
*
* @param extensionID
* @return all registered output formats and display names
* @throws ChartException
*/
public final String[][] getRegisteredOutputFormats( ) throws ChartException
public final String[][] getRegisteredOutputFormats( String extensionID ) throws ChartException
{
if ( inEclipseEnv( ) )
{
String[][] formats = getPluginXmlStrings( "devicerenderers", //$NON-NLS-1$
String[][] formats = getPluginXmlStrings( extensionID, "devicerenderers", //$NON-NLS-1$
"deviceRenderer", //$NON-NLS-1$
"format", //$NON-NLS-1$
"displayName" ); //$NON-NLS-1$
Expand Down Expand Up @@ -1012,6 +1013,18 @@ public final String[][] getRegisteredOutputFormats( ) throws ChartException
return al.toArray( new String[0][0] );
}
}

/**
* Returns a list of registered device renderer output formats and display
* names.
*
* @return all registered output formats and display names
* @throws ChartException
*/
public final String[][] getRegisteredOutputFormats( ) throws ChartException
{
return getRegisteredOutputFormats( null );
}

/**
* Returns a list of all aggregate function names registered via extension
Expand Down Expand Up @@ -1331,6 +1344,31 @@ private static final String getPluginXmlAttribute( String sXsdListName,
private static final String[][] getPluginXmlStrings( String sXsdListName,
String sXsdComplexName, String sXsdElementName,
String sXsdElementValue ) throws ChartException
{
return getPluginXmlStrings( null,
sXsdListName,
sXsdComplexName,
sXsdElementName,
sXsdElementValue );
}

/**
* Attempts to walk through the schema tree as defined in an extension point
* schema and instantiate the class associated with the value for a given
* element name.
*
* @param extensionID
* @param sXsdListName
* @param sXsdComplexName
* @param sXsdElementName
* @param sXsdElementValue
* @param sLookupName
*
* @return An array of the text value via the extension framework
*/
private static final String[][] getPluginXmlStrings( String extensionID, String sXsdListName,
String sXsdComplexName, String sXsdElementName,
String sXsdElementValue ) throws ChartException
{
final IExtensionRegistry ier = Platform.getExtensionRegistry( );
final IExtensionPoint iep = ier.getExtensionPoint( PLUGIN, sXsdListName );
Expand All @@ -1344,9 +1382,25 @@ private static final String[][] getPluginXmlStrings( String sXsdListName,
},
Messages.getResourceBundle( ) );
}
final IExtension[] iea = iep.getExtensions( );
IExtension[] iea = null;
if ( extensionID != null )
{
IExtension ext = iep.getExtension( extensionID );
if ( ext != null )
{
iea = new IExtension[]{ext};
}
else
{
iea = new IExtension[]{};
}
}
else
{
iea = iep.getExtensions( );
}
IConfigurationElement[] icea;

List<String[]> lst = new ArrayList<String[]>( );

for ( int i = 0; i < iea.length; i++ )
Expand Down

0 comments on commit 968dac6

Please sign in to comment.