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

bug 288489: [API] [cdt.managedbuild.core] Add getLibraryFiles method to IOption interface

Patch from Emilio U. Giuffrida
This commit is contained in:
Andrew Gvozdev 2010-02-17 16:38:49 +00:00
parent 1fc47b91e1
commit b91139e868
3 changed files with 40 additions and 0 deletions

View file

@ -344,6 +344,15 @@ public interface IOption extends IBuildObject {
*/
public String[] getLibraries() throws BuildException ;
/**
* @return an array or <code>String</code>s containing the library files
* that must be linked into the project.
*
* @throws BuildException
* @since 7.0
*/
public String[] getLibraryFiles() throws BuildException ;
/**
* Answers a <code>String</code> containing the unique ID of the selected
* enumeration in an enumerated option. For an option that has not been

View file

@ -1337,6 +1337,23 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getLibraryFiles()
*/
public String[] getLibraryFiles() throws BuildException {
if (getValueType() != LIBRARY_FILES) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
ArrayList<String> v = (ArrayList<String>)getValue();
if (v == null) {
return EMPTY_STRING_ARRAY;
} else {
v.trimToSize();
return v.toArray(new String[v.size()]);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getDefaultEnumValue()
*/

View file

@ -440,6 +440,20 @@ public class OptionReference implements IOption {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getLibraryFiles()
*/
public String[] getLibraryFiles() throws BuildException {
if (value == null)
return option.getLibraryFiles();
else if (getValueType() == LIBRARY_FILES) {
ArrayList<String> list = (ArrayList<String>)value;
return list.toArray(new String[list.size()]);
}
else
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
*/