It's all about the answers!

Ask a question

How to fetch enumaraion values for plug form dropdown.


glory pugazhenthi (5699) | asked Mar 29 '12, 12:42 a.m.
Hi,

i want to display custom enumaration values into my plugin form.

How can i fetch all the enumaration values from my project area.




Thanks,

Glory

3 answers



permanent link
Ralph Schoon (63.4k33646) | answered Mar 29 '12, 5:21 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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


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;
}

permanent link
glory pugazhenthi (5699) | answered Mar 30 '12, 1:20 a.m.
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

permanent link
glory pugazhenthi (5699) | answered Mar 30 '12, 5:28 a.m.
Hi,

I have designed plugin form for create workitem.

i have few query.

1. How to get values for Planned for combo box.
2. How to get values for Filed Against for combo box.
3. How to get values for Release for combo box.



Thanks,

Glory

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.