Skip to content

Commit 93ad2ab

Browse files
committed
OptionsLookAndFeel: use UIService as parameter
The UIService is more flexible, since we can operate across multiple UIs rather than only the default one.
1 parent 0bd3c6a commit 93ad2ab

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/org/scijava/ui/swing/options/OptionsLookAndFeel.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.scijava.plugin.Menu;
4646
import org.scijava.plugin.Parameter;
4747
import org.scijava.plugin.Plugin;
48+
import org.scijava.ui.UIService;
4849
import org.scijava.ui.UserInterface;
4950
import org.scijava.ui.swing.SwingApplicationFrame;
5051

@@ -67,7 +68,7 @@ public class OptionsLookAndFeel extends OptionsPlugin {
6768
// -- Parameters --
6869

6970
@Parameter
70-
private UserInterface ui;
71+
private UIService uiService;
7172

7273
@Parameter
7374
private LogService log;
@@ -101,6 +102,7 @@ public void run() {
101102
@Override
102103
public void run() {
103104
// FIXME: Get all windows from UIService rather than just app.
105+
final UserInterface ui = uiService.getDefaultUI();
104106
final SwingApplicationFrame swingAppFrame =
105107
(SwingApplicationFrame) ui.getApplicationFrame();
106108
SwingUtilities.updateComponentTreeUI(swingAppFrame);
@@ -151,11 +153,11 @@ protected void initLookAndFeel() {
151153

152154
@Deprecated
153155
public UserInterface getUI() {
154-
return ui;
156+
return uiService.getDefaultUI();
155157
}
156158

157159
@Deprecated
158-
public void setUI(final UserInterface ui) {
159-
this.ui = ui;
160+
public void setUI(@SuppressWarnings("unused") final UserInterface ui) {
161+
throw new UnsupportedOperationException();
160162
}
161163
}

0 commit comments

Comments
 (0)