mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve code quality
This commit is contained in:
parent
de568140d2
commit
55164ef60f
1 changed files with 21 additions and 16 deletions
|
|
@ -273,25 +273,12 @@ namespace Flow.Launcher.Core.Plugin
|
|||
// Register ResultsUpdated event so that plugin query can use results updated interface
|
||||
register.RegisterResultsUpdatedEvent(pair);
|
||||
|
||||
// Register plugin's action keywords so that plugins can be queried in results
|
||||
// set distinct on each plugin's action keywords helps only firing global(*) and action keywords once where a plugin
|
||||
// has multiple global and action keywords because we will only add them here once.
|
||||
foreach (var actionKeyword in pair.Metadata.ActionKeywords.Distinct())
|
||||
{
|
||||
switch (actionKeyword)
|
||||
{
|
||||
case Query.GlobalPluginWildcardSign:
|
||||
_globalPlugins.TryAdd(pair.Metadata.ID, pair);
|
||||
break;
|
||||
default:
|
||||
_nonGlobalPlugins.TryAdd(actionKeyword, pair);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Update plugin metadata translation after the plugin is initialized with IPublicAPI instance
|
||||
Internationalization.UpdatePluginMetadataTranslation(pair);
|
||||
|
||||
// Register plugin action keywords so that plugins can be queried in results
|
||||
RegisterPluginActionKeywords(pair);
|
||||
|
||||
// Add plugin to Dialog Jump plugin list after the plugin is initialized
|
||||
DialogJump.InitializeDialogJumpPlugin(pair);
|
||||
|
||||
|
|
@ -316,6 +303,24 @@ namespace Flow.Launcher.Core.Plugin
|
|||
}
|
||||
}
|
||||
|
||||
private static void RegisterPluginActionKeywords(PluginPair pair)
|
||||
{
|
||||
// set distinct on each plugin's action keywords helps only firing global(*) and action keywords once where a plugin
|
||||
// has multiple global and action keywords because we will only add them here once.
|
||||
foreach (var actionKeyword in pair.Metadata.ActionKeywords.Distinct())
|
||||
{
|
||||
switch (actionKeyword)
|
||||
{
|
||||
case Query.GlobalPluginWildcardSign:
|
||||
_globalPlugins.TryAdd(pair.Metadata.ID, pair);
|
||||
break;
|
||||
default:
|
||||
_nonGlobalPlugins.TryAdd(actionKeyword, pair);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddPluginToLists(PluginPair pair)
|
||||
{
|
||||
if (pair.Plugin is IContextMenu)
|
||||
|
|
|
|||
Loading…
Reference in a new issue