This method is called when the plugin is loaded. 'arg', which may be blank, is the argument specified for this plugin in IJ_Props.txt.
(String arg)
| 47 | * IJ_Props.txt. |
| 48 | */ |
| 49 | public void run(String arg) { |
| 50 | imp = WindowManager.getCurrentImage(); |
| 51 | if (imp == null) { |
| 52 | IJ.noImage(); |
| 53 | return; |
| 54 | } |
| 55 | // Snapshot before anything, so we can revert if the user cancels the action. |
| 56 | imp.getProcessor().snapshot(); |
| 57 | saveAndDeleteOverlayScaleBar(); |
| 58 | |
| 59 | userRoiExists = parseCurrentROI(); |
| 60 | GenericDialog dialog = askUserConfiguration(userRoiExists); |
| 61 | |
| 62 | if (dialog.wasCanceled()) { |
| 63 | removeScalebar(); |
| 64 | restoreOverlayScaleBar(); |
| 65 | return; |
| 66 | } else if (dialog.wasOKed()) { |
| 67 | if (!IJ.isMacro()) |
| 68 | persistConfiguration(); |
| 69 | updateScalebar(!config.labelAll); |
| 70 | } else //user has pressed 'remove scale bar' |
| 71 | removeScalebar(); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Remove the scalebar drawn by this plugin. |
nothing calls this directly
no test coverage detected