コード例 #1
0
 public String getColumnText(Object element, int columnIndex) {
   AAProductsDetails aaProductsDetails = (AAProductsDetails) element;
   String result = ""; // $NON-NLS-1$
   switch (columnIndex) {
     case 0:
       {
         String str = aaProductsDetails.getName();
         result =
             StringUtils.isBlank(str) ? Messages.ProductLineSelectionGroup_DefaultName : str;
         break;
       }
     default:
       // should not reach here
       result = ""; // $NON-NLS-1$
   }
   return result;
 }
コード例 #2
0
 @Override
 public int compare(Viewer viewer, Object e1, Object e2) {
   AAProductsDetails v1 = (AAProductsDetails) e1;
   AAProductsDetails v2 = (AAProductsDetails) e2;
   int rc = 0;
   switch (column) {
     case 0:
       rc = v1.getName().compareTo(v2.getName());
       break;
     default:
       rc = 0;
   }
   // If descending order, flip the direction
   if (direction == DESCENDING) {
     rc = -rc;
   }
   return rc;
 }