Skip to content

Commit

Permalink
self update disabled for production
Browse files Browse the repository at this point in the history
  • Loading branch information
pannous committed Mar 31, 2023
1 parent b9d6724 commit ffd59ee
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/main/java/com/pannous/jini/Update.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ public class Update extends AnAction {

@Override
public void actionPerformed(AnActionEvent e) {
String jini_id = "com.pannous.jini-plugin";
Path path = Path.of("/Users/me/dev/apps/jini-plugin/build/libs/");
try {
Optional<Path> mostRecentJar = Files.list(path)
.filter(p -> p.toString().endsWith(".jar"))
.max(Comparator.comparingLong(p -> p.toFile().lastModified()));
path = mostRecentJar.get();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
PluginManager pluginManager = PluginManager.getInstance();
IdeaPluginDescriptor jini = pluginManager.findEnabledPlugin(PluginId.getId(jini_id));
IdeaPluginDescriptorImpl pluginDescriptor = (IdeaPluginDescriptorImpl) jini;
pluginDescriptor.setEnabled(false);
Path finalPath = path;
PluginInstaller.installAndLoadDynamicPlugin(finalPath, pluginDescriptor);
PluginManager.enablePlugin(pluginDescriptor.getPluginId().getIdString());
Application application = ApplicationManager.getApplication();
application.restart();
// String jini_id = "com.pannous.jini-plugin";
// Path path = Path.of("/Users/me/dev/apps/jini-plugin/build/libs/");
// try {
// Optional<Path> mostRecentJar = Files.list(path)
// .filter(p -> p.toString().endsWith(".jar"))
// .max(Comparator.comparingLong(p -> p.toFile().lastModified()));
// path = mostRecentJar.get();
// } catch (IOException ex) {
// throw new RuntimeException(ex);
// }
// PluginManager pluginManager = PluginManager.getInstance();
// IdeaPluginDescriptor jini = pluginManager.findEnabledPlugin(PluginId.getId(jini_id));
// IdeaPluginDescriptorImpl pluginDescriptor = (IdeaPluginDescriptorImpl) jini;
// pluginDescriptor.setEnabled(false);
// Path finalPath = path;
// PluginInstaller.installAndLoadDynamicPlugin(finalPath, pluginDescriptor);
// PluginManager.enablePlugin(pluginDescriptor.getPluginId().getIdString());
// Application application = ApplicationManager.getApplication();
// application.restart();
}
}

0 comments on commit ffd59ee

Please sign in to comment.