How to fetch enumaraion values for plug form dropdown.
3 answers
Hi,
this might be helpful. In general you can search the PDE and Eclipse in general for things. E.g. if you find return values in the API, select the type and press F3 (search for references) or open the for declarations and search for references there.
There are also numerous posts that you can search for examples: https://jazz.net/search_results.jsp?q=#page=0&type=type%3DDocument-ForumThread&q=enumeration%20ILiteral
this might be helpful. In general you can search the PDE and Eclipse in general for things. E.g. if you find return values in the API, select the type and press F3 (search for references) or open the for declarations and search for references there.
There are also numerous posts that you can search for examples: https://jazz.net/search_results.jsp?q=#page=0&type=type%3DDocument-ForumThread&q=enumeration%20ILiteral
private static Identifier<extends> getLiteralStartsWithString(
String name, IWorkItemCommon workItemCommon, IAttributeHandle ia)
throws TeamRepositoryException {
Identifier<extends> literalID = null;
IEnumeration<extends> enumeration = workItemCommon
.resolveEnumeration(ia, null);
List<extends> literals = enumeration
.getEnumerationLiterals();
for (Iterator<extends> iterator = literals.iterator(); iterator
.hasNext();) {
ILiteral iLiteral = (ILiteral) iterator.next();
if (iLiteral.getName().startsWith(name)) {
literalID = iLiteral.getIdentifier2();
break;
}
}
return literalID;
}
Hi ,
Thank you for your response.
I have found the solution for this.
Check my code below.
public static String[] getEnumarationList(String attributeName) throws TeamRepositoryException {
String[] list = null;
IProgressMonitor monitor = new NullProgressMonitor();
IAttribute attribute= workItemClient.findAttribute(projectArea,attributeName, monitor );
IEnumeration<ILiteral> enumeration;
int i =0;
try {
enumeration = (IEnumeration<ILiteral>)workItemClient.resolveEnumeration(attribute, null);
List<ILiteral> enumerationLiterals = enumeration.getEnumerationLiterals();
list = new String;
for (ILiteral literal : enumerationLiterals) {
list = literal.getName();
i++;
}
} catch (TeamRepositoryException e) {
}
return list;
}
Thanks ,
Glory
Thank you for your response.
I have found the solution for this.
Check my code below.
public static String[] getEnumarationList(String attributeName) throws TeamRepositoryException {
String[] list = null;
IProgressMonitor monitor = new NullProgressMonitor();
IAttribute attribute= workItemClient.findAttribute(projectArea,attributeName, monitor );
IEnumeration<ILiteral> enumeration;
int i =0;
try {
enumeration = (IEnumeration<ILiteral>)workItemClient.resolveEnumeration(attribute, null);
List<ILiteral> enumerationLiterals = enumeration.getEnumerationLiterals();
list = new String;
for (ILiteral literal : enumerationLiterals) {
list = literal.getName();
i++;
}
} catch (TeamRepositoryException e) {
}
return list;
}
Thanks ,
Glory