Skip to content

Commit

Permalink
guice module check if the passed plugin is null
Browse files Browse the repository at this point in the history
If it is null, it defaults to the EmfParsleyJavaGuiceModule behavior

Change-Id: Iddb00c342181c5d98b0acc746612f28473142b3a
  • Loading branch information
LorenzoBettini committed Dec 8, 2016
1 parent b7b3c1e commit 065f79f
Showing 1 changed file with 15 additions and 3 deletions.
Expand Up @@ -29,16 +29,25 @@ public class EmfParsleyGuiceModule extends EmfParsleyJavaGuiceModule {

private final AbstractUIPlugin plugin;

/**
* If the passed {@link AbstractUIPlugin} is not null, it also
* performs additional Guice configuration, otherwise, this
* basically behaves like {@link EmfParsleyJavaGuiceModule}
*
* @param plugin
*/
public EmfParsleyGuiceModule(AbstractUIPlugin plugin) {
this.plugin = plugin;
}

@Override
public void configure(Binder binder) {
super.configure(binder);
binder.bind(AbstractUIPlugin.class).toInstance(plugin);
binder.bind(IDialogSettings.class).toInstance(
plugin.getDialogSettings());
if (plugin != null) {
binder.bind(AbstractUIPlugin.class).toInstance(plugin);
binder.bind(IDialogSettings.class).toInstance(
plugin.getDialogSettings());
}
}

/**
Expand All @@ -49,6 +58,9 @@ public void configure(Binder binder) {
*/
@Override
public Class<? extends IImageHelper> bindIImageHelper() {
if (plugin == null) {
return super.bindIImageHelper();
}
return PluginImageHelper.class;
}

Expand Down

0 comments on commit 065f79f

Please sign in to comment.