File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed
src/main/java/org/scijava Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -140,4 +140,8 @@ public String getCancelReason() {
140140 return cancelReason ;
141141 }
142142
143+ // HACK: For OptionsPlugin.
144+ public void uncancel () {
145+ cancelReason = null ;
146+ }
143147}
Original file line number Diff line number Diff line change @@ -108,19 +108,20 @@ public void reset() {
108108 prefService .clear (getClass ());
109109 }
110110
111+ // -- Module methods --
112+
113+ @ Override
114+ public void cancel () {
115+ resetState ();
116+ }
117+
111118 // -- Runnable methods --
112119
113120 @ Override
114121 public void run () {
115122 save ();
116-
117- // NB: Clear "resolved" status of all inputs.
118- // Otherwise, no inputs are harvested on next run.
119- for (final ModuleItem <?> input : getInfo ().inputs ()) {
120- unresolveInput (input .getName ());
121- }
122-
123123 eventService .publish (new OptionsEvent (this ));
124+ resetState ();
124125 }
125126
126127 // -- Helper methods --
@@ -135,4 +136,15 @@ private <T> void saveInput(final ModuleItem<T> input) {
135136 moduleService .save (input , value );
136137 }
137138
139+ private void resetState () {
140+ // NB: Clear "resolved" status of all inputs.
141+ // Otherwise, no inputs are harvested on next run.
142+ for (final ModuleItem <?> input : getInfo ().inputs ()) {
143+ unresolveInput (input .getName ());
144+ }
145+
146+ // NB: Clear "canceled" status.
147+ // Otherwise, the command cannot run again.
148+ uncancel ();
149+ }
138150}
You can’t perform that action at this time.
0 commit comments