Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: allow annotation plugin not to create a menu entry #36

Open
JimSmith763268 opened this issue Dec 19, 2024 · 3 comments
Open

Comments

@JimSmith763268
Copy link

I wrote an annotation plugin that requires project-specific settings. The plugin should be active if the settings file is in the project directory, or otherwise it shouldn't do anything. To me, it's intuitive that if the settings file doesn't exist, the plugin should just not be displayed in the menu.

Yet I find that when I create an annotation plugin, I am required to create a menu entry. For instance, if I define PluginAnnotationMenuEntries as follows, then I get an exception.

public IEnumerable<PluginAnnotationMenuEntry> PluginAnnotationMenuEntries
{
	get { return new List<PluginAnnotationMenuEntry>(); }
}

The log reads:

[2024-12-19T08:22:30-06, Thread=1] - Information: Usage:  Form:  Paratext.MainForm:  Shown
[2024-12-19T08:22:31-06, Thread=1] - Error: Exception restoring window: Exception has been thrown by the target of an invocation.
[2024-12-19T08:22:31-06, Thread=1] - Error:    at System.RuntimeTypeHan

(And the text window doesn't load at all, but instead displays an error message about the exception.)

I suggest as a minimum that if PluginAnnotationMenuEntries is empty, Paratext should be able to recover from that somehow. (I would expect it to print an error to the log and proceed as if the plugin had never opened.)

Going beyond that, I would suggest at least one of the following:

  • A way to indicate to Paratext that initialization of the plugin failed, and the plugin should be ignored.
  • Failing that, the ability to disable the menu entry (i.e., grey it out). I could not find such a setting in PluginAnnotationMenuEntry.
@tombogle
Copy link
Collaborator

I agree that it seems sensible to allow the plugin to specify whether or not the menu item is available. I'm not sure we'd want to allow it to not provide a menu item at all. However, we might want to make a way, at them time the plugin is being loaded for the plugin to indicate that it should not be loaded. That would allow your plugin to detect that the required settings are not present, and just not load. All that said, I'm not sure whether the Paratext 9 team has any plans to enhance the plugin interfaces.

@JimSmith763268
Copy link
Author

All that said, I'm not sure whether the Paratext 9 team has any plans to enhance the plugin interfaces.

Just curious: do you say that because plug-ins just aren't a high priority in general, or because development is focused on Paranext?

@tombogle
Copy link
Collaborator

All that said, I'm not sure whether the Paratext 9 team has any plans to enhance the plugin interfaces.

Just curious: do you say that because plug-ins just aren't a high priority in general, or because development is focused on Paranext?

Maybe a little bit of both. For sure in Paratext 10 Studio, extension support will be a top priority. I don't set priorities, so it's just a guess. There is someone on the Paratext 9 team who is intimately acquainted with the plugin stuff, so if they do decide to prioritize this, I'm sure he'll be able to handle it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants