Skip to content

Passive registration fix - #157

Merged
smehrbrodt merged 1 commit into
LibreOffice:masterfrom
prrvchr:passive-registration-fix
Apr 14, 2025
Merged

Passive registration fix#157
smehrbrodt merged 1 commit into
LibreOffice:masterfrom
prrvchr:passive-registration-fix

Conversation

@prrvchr

@prrvchr prrvchr commented Apr 12, 2025

Copy link
Copy Markdown
Contributor

This passive registration registers all UNO services that are present in a component's Java or Python implementation. This fixes issue #156.

To be considered as a UNO component a Java Class must have:

  • An ctor with com.sun.star.uno.XComponentContext as unique parameter.
  • A static final field m_serviceNames of type String[] (ie: an array of String) and having as values the name of the UNO service. This field can be private, protected or public, it doesn't matter.

For a Python class to be considered a UNO component it must:

  • Exist a global variable g_ImplementationHelper declared as follows: g_ImplementationHelper = unohelper.ImplementationHelper().
  • Exist a global variable g_ImplementationName declared as follows: g_ImplementationName = 'com.sun.star.MyServiceName'.
  • Exist a global variable g_ServiceNames declared as follows: g_ServiceNames = ('com.sun.star.task.JobExecutor', ).
  • Although this is not controlled, it will also be necessary for it to have the following code:
g_ImplementationHelper.addImplementation(YourPythonClass,         # UNO object class
     g_ImplementationName,                                        # Implementation name
     g_ServiceNames)                                              # List of implemented services

res.getProject().hasNature(OOEclipsePlugin.UNO_NATURE_ID) &&
ProjectsManager.getProject(res.getProject().getName()).getLanguage() != null) {
// TODO: We need to check if the project is configured correctly and notify
// XXX: We need to check if the project is configured correctly and notify

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make my life easier because TODOs appear in Eclipse as errors...

if (root.getProject(prj.getName()).hasNature(OOEclipsePlugin.UNO_NATURE_ID) &&
prj.getLanguage() != null) {
// TODO: We need to check if the project is configured correctly and notify
// XXX: We need to check if the project is configured correctly and notify

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

@prrvchr prrvchr Apr 14, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more Eclipse yellow warning

@smehrbrodt
smehrbrodt merged commit 842cc81 into LibreOffice:master Apr 14, 2025
@prrvchr
prrvchr deleted the passive-registration-fix branch April 14, 2025 09:48
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

Successfully merging this pull request may close these issues.

2 participants