MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / delete

Method delete

ij/src/main/java/ij/plugin/frame/RoiManager.java:618–659  ·  view source on GitHub ↗
(boolean replacing)

Source from the content-addressed store, hash-verified

616 }
617
618 boolean delete(boolean replacing) {
619 int count = getCount();
620 if (count==0)
621 return error("The ROI Manager is empty.");
622 int index[] = getSelectedIndexes();
623 if (index.length==0 || (replacing&&count>1)) {
624 String msg = "Delete all items on the list?";
625 if (replacing)
626 msg = "Replace items on the list?";
627 canceled = false;
628 if (!IJ.isMacro() && !macro) {
629 YesNoCancelDialog d = new YesNoCancelDialog(this, "ROI Manager", msg);
630 if (d.cancelPressed())
631 {canceled = true; return false;}
632 if (!d.yesPressed()) return false;
633 }
634 index = getAllIndexes();
635 }
636 if (count==index.length && !replacing) {
637 rois.clear();
638 listModel.removeAllElements();
639 } else {
640 for (int i=count-1; i>=0; i--) {
641 boolean delete = false;
642 for (int j=0; j<index.length; j++) {
643 if (index[j]==i)
644 delete = true;
645 }
646 if (delete) {
647 if (EventQueue.isDispatchThread()) {
648 rois.remove(i);
649 listModel.remove(i);
650 } else
651 deleteOnEDT(i);
652 }
653 }
654 }
655 updateShowAll();
656 if (record())
657 Recorder.record("roiManager", "Delete");
658 return true;
659 }
660
661 /** Deletes the ROI at 'index' and updates the display. */
662 public void delete(int index) {

Callers 3

doRoiManagerMethod · 0.95
actionPerformedMethod · 0.95
runCommandMethod · 0.95

Calls 14

getCountMethod · 0.95
errorMethod · 0.95
getSelectedIndexesMethod · 0.95
isMacroMethod · 0.95
cancelPressedMethod · 0.95
yesPressedMethod · 0.95
getAllIndexesMethod · 0.95
deleteOnEDTMethod · 0.95
updateShowAllMethod · 0.95
recordMethod · 0.95
recordMethod · 0.95
clearMethod · 0.45

Tested by

no test coverage detected