View on GitHub

EMU-guide

Guide to EMU, a Micro-Manager plugin to load easily reconfigurable user interfaces.

UIPlugin

The UIPlugin interface is the class detected by EMU. The plugin system uses Java ServiceLoader.

First implement the interface, returning your ConfigurableMainFrame in the getMainFrame() method:

public class GuideUIPlugin implements UIPlugin{

	@Override
	public String getName() {
		return "Guide plugin";
	}

	@Override
	public ConfigurableMainFrame getMainFrame(SystemController controller,
                                              TreeMap<String, String> pluginSettings) {
        return new GuideConfigurableMainFrame("Guide plugin", controller,
                                              pluginSettings);
	}
}

Provider-configuration file

In order for the ServiceLoader to discover your plugin, you need to make sure the jar files contains the provider-configuration file. This file should be named “de.embl.rieslab.emu.plugin.UIPlugin” and contain the UIPlugin implementation’s fully-qualified binary name, for instance:

de.embl.rieslab.emuguide.GuideUIPlugin

In order for the file to appear in the jar, you must respect the following project organization:

src/main/
      |
      ---> java/de/embl/rieslab/emuguide/
                                   |
                                   ---> GuideUIPlugin.java
      ---> resources/META-INF/services/
                                   |
                                   ---> de.embl.rieslab.emu.plugin.UIPlugin
              

In your project, the “de.embl.rieslab.emuguide.GuideUIPlugin.java” must be replaced by your own package structure and plugin name, in both the projects and the provider-configuration file.

Make sure that resources is set as a source folder and explore the exported jar to make sure that the META-INF folder contains the /services/de.embl.rieslab.emu.plugin.UIPlugin file.

The most common errors causing the plugin to be ignored by the ServiceLoader are:

Export as .jar

Finally, your project must be exported as a .jar. Make sure the configuration file is present in the jar under the correct path. Then place the archive in the EMU folder of your Micro-manager installation folder.

Example

Back to the programming guide

Back to the main menu