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

Method revert

ij/src/main/java/ij/ImagePlus.java:2406–2443  ·  view source on GitHub ↗

Implements the File/Revert command.

()

Source from the content-addressed store, hash-verified

2404
2405 /** Implements the File/Revert command. */
2406 public void revert() {
2407 if (getStackSize()>1 && getStack().isVirtual()) {
2408 int thisSlice = currentSlice;
2409 currentSlice = 0;
2410 setSlice(thisSlice);
2411 return;
2412 }
2413 FileInfo fi = getOriginalFileInfo();
2414 boolean isFileInfo = fi!=null && fi.fileFormat!=FileInfo.UNKNOWN;
2415 if (!isFileInfo && url==null)
2416 return;
2417 if (fi.directory==null && url==null)
2418 return;
2419 if (ij!=null && changes && isFileInfo && !Interpreter.isBatchMode() && !IJ.isMacro() && !IJ.altKeyDown()) {
2420 if (!IJ.showMessageWithCancel("Revert?", "Revert to saved version of\n\""+getTitle()+"\"?"))
2421 return;
2422 }
2423 Roi saveRoi = null;
2424 if (roi!=null) {
2425 roi.endPaste();
2426 saveRoi = (Roi)roi.clone();
2427 }
2428 trimProcessor();
2429 new FileOpener(fi).revertToSaved(this);
2430 if (Prefs.useInvertingLut && getBitDepth()==8 && ip!=null && !ip.isInvertedLut()&& !ip.isColorLut())
2431 invertLookupTable();
2432 if (getProperty("FHT")!=null) {
2433 properties.remove("FHT");
2434 if (getTitle().startsWith("FFT of "))
2435 setTitle(getTitle().substring(7));
2436 }
2437 ContrastAdjuster.update();
2438 if (saveRoi!=null) setRoi(saveRoi);
2439 repaintWindow();
2440 IJ.showStatus("");
2441 changes = false;
2442 notifyListeners(UPDATED);
2443 }
2444
2445 void revertStack(FileInfo fi) {
2446 String path = null;

Callers 1

revertMethod · 0.95

Calls 15

getStackSizeMethod · 0.95
getStackMethod · 0.95
setSliceMethod · 0.95
getOriginalFileInfoMethod · 0.95
isBatchModeMethod · 0.95
isMacroMethod · 0.95
altKeyDownMethod · 0.95
showMessageWithCancelMethod · 0.95
getTitleMethod · 0.95
trimProcessorMethod · 0.95
getBitDepthMethod · 0.95
invertLookupTableMethod · 0.95

Tested by

no test coverage detected