Skip to content

Commit

Permalink
Fixed get Forge version method
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Nov 10, 2020
1 parent c22f661 commit 5421086
Showing 1 changed file with 2 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import java.io.File;
import java.util.concurrent.Future;

import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManagerCore;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
Expand All @@ -20,6 +18,7 @@
import com.intellij.openapi.extensions.PluginId;
import org.jboss.forge.addon.convert.ConverterFactory;
import org.jboss.forge.addon.ui.command.CommandFactory;
import org.jboss.forge.addon.ui.command.UICommand;
import org.jboss.forge.addon.ui.controller.CommandControllerFactory;
import org.jboss.forge.furnace.Furnace;
import org.jboss.forge.furnace.addons.Addon;
Expand Down Expand Up @@ -168,26 +167,9 @@ void initializeAddonRepositories(boolean addBundledAddons)
}
}

/**
* Ugly hack. Versions.getImplementationVersionFor does not work here
*/
public static String getForgeVersion()
{
IdeaPluginDescriptor plugin = PluginManagerCore.getPlugin(PLUGIN_ID);
String description = plugin.getChangeNotes();
String version = "(unknown)";
String str = "Bundled with Forge";
int bundledIdx = description.indexOf(str);
if (bundledIdx > -1)
{
int endIndex = description.indexOf(OperatingSystemUtils.isWindows() ? "\n" : System.lineSeparator(), bundledIdx);
if (endIndex == -1)
{
endIndex = description.length();
}
version = description.substring(bundledIdx + str.length(), endIndex).trim();
}
return version;
return UICommand.class.getPackage().getImplementationVersion();
}

@Nullable
Expand Down

0 comments on commit 5421086

Please sign in to comment.