Sharing Ribbon Items Across Multiple Packages

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

Post Reply
dlerickson
Posts: 61
Joined: Tue Jan 21, 2014 11:35 am
Location: Austin, TX

Sharing Ribbon Items Across Multiple Packages

Post by dlerickson » Wed Jul 18, 2018 5:38 pm

First, a little background: We started off a few years ago with a single integration package with a top-level ribbon tab and a couple submenus/groups, as usual. It worked just fine.

Since then, we've discovered the need to create separate shell packages, with completely separate builds. The intention here was to make our shell integrations modular, and reduce dependencies between them as much as possible. There is one complicating factor in that we'd like all of the packages to share the same top-level ribbon menu item as the original package, and add their submenus into that at registration time. For a while, we were able to just copy the hierarchy in the .ctd file from the first package into the second, and just swap out the submenu bits. This seemed to work, as the registration process appeared to recognize and match the GUIDs from the previously installed package and just add in the submenu items from the new package in the correct spots. It's always been an assumption that this is what was happening internally with spregpkg.exe, with no way for us to actually confirm it.

However, with the newest upgrade to 4.3.10.1 (our previous version was 4.3.7,) this seems to have broken. After the upgrade, registering both packages caused duplicate menus to show up, from the top level down. I did find a solution to this, which involves the following:
  1. Modifying the original package (I'll refer to it as "Package A" from here on out) to set the export value on the ID we want to bind to from the second package (Package B) in the Symbols section to true
  2. Deploying and registering Package A as usual
  3. Modifying the .ctd file on the Package B to add an include alias with the href attribute set to location of the .cts file generated by Package A in its .ctd file
  4. Removing the nodes in (Package B).ctd that were copied over from Package A, and instead using <MenuRef id="PackageA:topRibbon" /> and adding the child groups and submenus accordingly.
This new method seems to work like a champ, but introduces the dependency on Package A's .cts file from Package B that we'd rather not have. One workaround that I've considered is to create a separate shell package that does nothing but provide the .cts for the top-level menu item, that all of our other packages can reference, and allow for a sort of "plugin"-style modular development. This kinda seems like a waste of a license, though.

Is there a better method for all of this?

BobRichards
Posts: 1007
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Sharing Ribbon Items Across Multiple Packages

Post by BobRichards » Thu Jul 19, 2018 11:17 am

The behavior you are describing is "as designed". At this point, you have two options:
  • Modify one of your existing packages to be core to all installations so it is always present. Your other packages will hook on to the the created ribbon.
  • Create an additional shell package that creates the ribbon. It can also hold common code class implementations used by other packages.
Bob Richards, Software Developer, SoftPro

dlerickson
Posts: 61
Joined: Tue Jan 21, 2014 11:35 am
Location: Austin, TX

Re: Sharing Ribbon Items Across Multiple Packages

Post by dlerickson » Thu Jul 19, 2018 3:21 pm

Thanks for the confirmation! One other question, does the href attribute of the include tag support URLs as well as file paths, so we could do something like this:

Code: Select all

<Using alias="bootstrapper" href="http://some.internal.codeserver/SoftPro/packages/bootstrapper.cts" />
I'm not sure we'd need it, but just in case....

BobRichards
Posts: 1007
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Sharing Ribbon Items Across Multiple Packages

Post by BobRichards » Fri Jul 20, 2018 11:29 am

I have not tried it but after looking at the code, I don't think it will work. When we read the href parameter, we pass it to a routine that determines the full file path. It uses the .NET Path.IsPathRooted method and when it sees that the first letter is not a "\" or drive letter followed by colon, it will append the href value to the cts source file directory path. That will turn your intended file path into goo.

Code: Select all

Example of mangling using your example http URL

"c:/Projects/SoftPro/Bootstrap/http://some.internal.codeserver/SoftPro/packages/bootstrapper.cts"
Bob Richards, Software Developer, SoftPro

dlerickson
Posts: 61
Joined: Tue Jan 21, 2014 11:35 am
Location: Austin, TX

Re: Sharing Ribbon Items Across Multiple Packages

Post by dlerickson » Wed Aug 01, 2018 6:58 pm

Ah, thanks. The main issue is that it's highly likely that not everyone on the team will have their source control workspace paths set up identically, but the workaround is probably to stick it on a file share that we all do have access to, and reference that.

Post Reply