Skip to content

Commit

Permalink
fix the loading of the default implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
LabyStudio committed Jun 13, 2021
1 parent e5e1386 commit 7993de9
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,20 @@ public enum EnumFileType {
* Creates and instance of the given implementation class for hot-swapping if the required plugin is available
*
* @param className Hotswap implementation class
* @param requiredPluginId The required plugin for this hotswap type
* @param requiredPluginId The required plugin for this hotswap type. This can be null to skip the requirement.
*/
EnumFileType( String className, String requiredPluginId ) {
try {
// Find plugin by plugin id
@Nullable IdeaPluginDescriptor plugin = requiredPluginId == null ? null :
PluginManager.getInstance().findEnabledPlugin( PluginId.getId( requiredPluginId ) );
// Check if plugin is required
if ( requiredPluginId != null ) {

// Skip implementation if not plugin is not available
if ( plugin == null || !plugin.isEnabled() ) {
return;
// Find plugin by plugin id
@Nullable IdeaPluginDescriptor plugin = PluginManager.getInstance().findEnabledPlugin( PluginId.getId( requiredPluginId ) );

// Skip implementation if not plugin is not available
if ( plugin == null || !plugin.isEnabled() ) {
return;
}
}

// Load implementation
Expand All @@ -58,6 +61,7 @@ public enum EnumFileType {
}
}


/**
* Get hotswap implementation for current type
*
Expand Down

0 comments on commit 7993de9

Please sign in to comment.