@Override public void run() { if (USE_VIRTUAL) { fillTable(); Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { if (!tree.isDisposed()) { tree.setItemCount(groupInfoList.size()); tree.clearAll(true); doRefreshDetail(); } } }); } else { results = ContactService.getInstance().getAll(); Display.getDefault() .asyncExec( new Runnable() { @Override public void run() { if (!tree.isDisposed()) { fillTableOld(); if (USE_PACK) { packTable(); } doRefreshDetail(); } } }); } }
private String delete() { try { ContactService.getInstance().delete(infoList); return null; } catch (DBException e) { e.printStackTrace(); return e.toString(); } }
private void fillTable() { results = ContactService.getInstance().getAll(); groupInfoList = new ArrayList<ContactGroupInfo>(); for (int i = 0; i < results.size(); i++) { ContactInfo info = results.get(i); String catalog = info.getCatalog(); ContactGroupInfo lastGroupInfo = null; if (groupInfoList.size() > 0) { lastGroupInfo = groupInfoList.get(groupInfoList.size() - 1); } if (lastGroupInfo != null && lastGroupInfo.getGroupName() != null && lastGroupInfo.getGroupName().equals(catalog)) { lastGroupInfo.setIndexEnd(i); } else { lastGroupInfo = new ContactGroupInfo(); lastGroupInfo.setGroupName(catalog); lastGroupInfo.setIndexStart(i); lastGroupInfo.setIndexEnd(i); groupInfoList.add(lastGroupInfo); } } }