File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
src/main/java/org/scijava/app Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 4242 */
4343public interface AppService extends SingletonService <App > {
4444
45+ /** Gets the foremost application (the one with the highest priority). */
46+ App getApp ();
47+
4548 /** Gets an application by name. */
4649 App getApp (final String name );
4750
Original file line number Diff line number Diff line change 3333
3434import java .util .Collections ;
3535import java .util .HashMap ;
36+ import java .util .List ;
3637import java .util .Map ;
3738
3839import org .scijava .log .LogService ;
@@ -61,6 +62,13 @@ public class DefaultAppService extends AbstractSingletonService<App> implements
6162
6263 // -- AppService methods --
6364
65+ @ Override
66+ public App getApp () {
67+ final List <App > appList = getInstances ();
68+ if (appList == null || appList .isEmpty ()) return null ;
69+ return appList .get (0 );
70+ }
71+
6472 @ Override
6573 public App getApp (final String name ) {
6674 return apps ().get (name );
You can’t perform that action at this time.
0 commit comments