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

Method rename

ij/src/main/java/ij/plugin/frame/RoiManager.java:720–747  ·  view source on GitHub ↗
(String name2)

Source from the content-addressed store, hash-verified

718 }
719
720 boolean rename(String name2) {
721 int index = list.getSelectedIndex();
722 if (index<0)
723 return error("Exactly one item in the list must be selected.");
724 String name = (String)listModel.getElementAt(index);
725 if (name2==null)
726 name2 = promptForName(name);
727 if (name2==null)
728 return false;
729 if (name2.equals(name))
730 return false;
731 Roi roi = (Roi)rois.get(index);
732 roi.setName(name2);
733 int position = getSliceNumber(name2);
734 if (position>0 && !roi.hasHyperStackPosition())
735 roi.setPosition(position);
736 rois.set(index, roi);
737 listModel.setElementAt(name2, index);
738 list.setSelectedIndex(index);
739 ImagePlus imp = WindowManager.getCurrentImage();
740 if (imp!=null && imp.getRoi()!=null)
741 imp.setRoi(roi);
742 if (Prefs.useNamesAsLabels && labelsCheckbox.getState())
743 if (imp!=null) imp.draw();
744 if (record())
745 Recorder.record("roiManager", "Rename", name2);
746 return true;
747 }
748
749 public void rename(int index, String newName) {
750 if (index<0 || index>=getCount())

Callers 3

actionPerformedMethod · 0.95
setPropertiesMethod · 0.95
runCommandMethod · 0.95

Calls 15

errorMethod · 0.95
promptForNameMethod · 0.95
setNameMethod · 0.95
getSliceNumberMethod · 0.95
hasHyperStackPositionMethod · 0.95
setPositionMethod · 0.95
getCurrentImageMethod · 0.95
getRoiMethod · 0.95
setRoiMethod · 0.95
drawMethod · 0.95
recordMethod · 0.95
recordMethod · 0.95

Tested by

no test coverage detected