}
ICompilationUnit compilationUnit = field.getCompilationUnit();
ShowAttributeInListDialog showAttributeInListDialog = new ShowAttributeInListDialog(null);
showAttributeInListDialog.pack();
showAttributeInListDialog.setLocationRelativeTo(null);
showAttributeInListDialog.setVisible(true);
String order = showAttributeInListDialog.getOrder();
if (order == null)
return;
try
{
String newFieldSourceCode = "";
String oldFieldSourceCode = "";
// Dal codice esistente rimuove l'annotazione se presente
StringTokenizer st = new StringTokenizer(field.getSource(),"\n\r\f");
while (st.hasMoreTokens())
{
String token = st.nextToken();
//System.out.println(".."+token);
if(!token.contains("@ShowAttributeInList"))
{
oldFieldSourceCode += token+"\r\n";;
}
}
IType type = compilationUnit.getTypes()[0];
//Rimuove il campo esistente
type.getField(field.getElementName()).delete(true, null);
newFieldSourceCode += "\r\n\r\n@ShowAttributeInList(order=" + order + ", isDefaultOrderingAttribute="+showAttributeInListDialog.isDefaultOrderingAttribute()+", ascending="+showAttributeInListDialog.getMode()+")\r\n";
newFieldSourceCode += oldFieldSourceCode+"\r\n";
type.createField("\r\n"+newFieldSourceCode, nextField, true, null);
if(!compilationUnit.getSource().contains("import org.boco.seamwebappgen.annotations.ShowAttributeInList"))