Added simple support for import Plugins via plugin API

This commit is contained in:
Michael Starke
2019-07-15 12:23:32 +02:00
parent 9a55559e71
commit 9d0dc1630d
2 changed files with 6 additions and 2 deletions

View File

@@ -284,7 +284,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
return;
}
NSMenuItem *menuItem = sender;
if(![menuItem.representedObject isKindOfClass:NSDictionary.class]) {
if(![menuItem.representedObject isKindOfClass:NSString.class]) {
return;
}
@@ -292,7 +292,8 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
if(!sheetWindow) {
return;
}
MPPlugin<MPImportPlugin> *importPlugin;
NSString *bundleIdentifier = menuItem.representedObject;
MPPlugin<MPImportPlugin> *importPlugin = (MPPlugin<MPImportPlugin> *)[MPPluginHost.sharedHost pluginWithBundleIdentifier:bundleIdentifier];
NSOpenPanel *openPanel = NSOpenPanel.openPanel;
[importPlugin prepareOpenPanel:openPanel];
[openPanel beginSheetModalForWindow:sheetWindow completionHandler:^(NSModalResponse result) {