Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open image in imageJ when using as IJ plugin #386

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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