Skip to content

Commit

Permalink
Merge pull request #386 from jburel/issue_361
Browse files Browse the repository at this point in the history
open image in imageJ when using as IJ plugin
  • Loading branch information
jburel authored Aug 17, 2023
2 parents 2279b84 + 409823e commit 4e94bf8
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*------------------------------------------------------------------------------
* Copyright (C) 2014-2021 University of Dundee. All rights reserved.
* Copyright (C) 2014-2023 University of Dundee. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -52,7 +52,10 @@
import org.openmicroscopy.shoola.agents.events.iviewer.ViewImage;
import org.openmicroscopy.shoola.agents.events.iviewer.ViewImageObject;
import org.openmicroscopy.shoola.agents.imviewer.ImViewerAgent;
import org.openmicroscopy.shoola.env.LookupNames;
import org.openmicroscopy.shoola.env.data.events.ViewInPluginEvent;
import omero.gateway.SecurityContext;
import org.openmicroscopy.shoola.env.event.EventBus;
import org.openmicroscopy.shoola.env.event.RequestEvent;
import org.openmicroscopy.shoola.env.ui.UserNotifier;
import org.openmicroscopy.shoola.util.ui.UIUtilities;
Expand Down Expand Up @@ -222,9 +225,18 @@ private JButton createActionButton(final DataObject obj) {
@Override
public void actionPerformed(ActionEvent e) {
ImageData img = (ImageData) obj;
RequestEvent ev = new ViewImage(new SecurityContext(obj
.getGroupId()), new ViewImageObject(img), null);
ImViewerAgent.getRegistry().getEventBus().post(ev);
SecurityContext ctx = new SecurityContext(img.getGroupId());
EventBus bus = DataBrowserAgent.getRegistry().getEventBus();
if (DataBrowserAgent.runAsPlugin() == LookupNames.IMAGE_J) {
ViewInPluginEvent evt = new ViewInPluginEvent(ctx,
img, LookupNames.IMAGE_J);
bus.post(evt);
} else {
RequestEvent evt = new ViewImage(ctx,
new ViewImageObject(img), null);
bus.post(evt);

}
}
});
} else {
Expand Down

0 comments on commit 4e94bf8

Please sign in to comment.