use of com.biglybt.activities.ActivitiesEntry in project BiglyBT by BiglySoftware.
the class SBC_ActivityTableView method removeEntries.
private void removeEntries(final ActivitiesEntry[] toRemove, final int startIndex) {
final ActivitiesEntry entry = toRemove[startIndex];
if (entry == null || ActivitiesConstants.TYPEID_HEADER.equals(entry.getTypeID())) {
int nextIndex = startIndex + 1;
if (nextIndex < toRemove.length) {
removeEntries(toRemove, nextIndex);
}
return;
}
MessageBoxShell mb = new MessageBoxShell(MessageText.getString("v3.activity.remove.title"), MessageText.getString("v3.activity.remove.text", new String[] { entry.getText() }));
mb.setRemember(tableID + "-Remove", false, MessageText.getString("MessageBoxWindow.nomoreprompting"));
if (startIndex == toRemove.length - 1) {
mb.setButtons(0, new String[] { MessageText.getString("Button.yes"), MessageText.getString("Button.no") }, new Integer[] { 0, 1 });
mb.setRememberOnlyIfButton(0);
} else {
mb.setButtons(1, new String[] { MessageText.getString("Button.removeAll"), MessageText.getString("Button.yes"), MessageText.getString("Button.no") }, new Integer[] { 2, 0, 1 });
mb.setRememberOnlyIfButton(1);
}
mb.setHandleHTML(false);
mb.open(new UserPrompterResultListener() {
@Override
public void prompterClosed(int result) {
if (result == 2) {
int numToRemove = toRemove.length - startIndex;
ActivitiesEntry[] toGroupRemove = new ActivitiesEntry[numToRemove];
System.arraycopy(toRemove, startIndex, toGroupRemove, 0, numToRemove);
ActivitiesManager.removeEntries(toGroupRemove);
return;
} else if (result == 0) {
ActivitiesManager.removeEntries(new ActivitiesEntry[] { entry });
}
int nextIndex = startIndex + 1;
if (nextIndex < toRemove.length) {
removeEntries(toRemove, nextIndex);
}
}
});
}
Aggregations