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

LT-21787: Fix hyperlink to another project #94

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Src/xWorks/LinkListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,13 @@ private bool FollowActiveLink(bool suspendLoadingRecord)
{
try
{
var cache = m_propertyTable.GetValue<LcmCache>("cache");
//Debug.Assert(!(m_lnkActive is FwAppArgs), "Beware: This will not handle link requests for other databases/applications." +
// " To handle other databases or applications, pass the FwAppArgs to the IFieldWorksManager.HandleLinkRequest method.");
if (m_lnkActive.ToolName == "default")
{
// Need some smarts here. The link creator was not sure what tool to use.
// The object may also be a child we don't know how to jump to directly.
var cache = m_propertyTable.GetValue<LcmCache>("cache");
ICmObject target;
if (!cache.ServiceLocator.ObjectRepository.TryGetObject(m_lnkActive.TargetGuid, out target))
return false; // or message?
Expand Down Expand Up @@ -500,6 +500,12 @@ private bool FollowActiveLink(bool suspendLoadingRecord)
m_lnkActive = new FwLinkArgs(realTool, realTarget.Guid);
// Todo JohnT: need to do something special here if we c
}
// Return false if the link is to a different database
var databases = m_lnkActive.PropertyTableEntries.Where(p => p.name == "database");
if (databases.FirstOrDefault()?.name != cache.LangProject.ShortName)
{
return false;
}
// It's important to do this AFTER we set the real tool name if it is "default". Otherwise, the code that
// handles the jump never realizes we have reached the desired tool (as indicated by the value of
// SuspendLoadingRecordUntilOnJumpToRecord) and we stop recording context history and various similar problems.
Expand All @@ -518,7 +524,6 @@ private bool FollowActiveLink(bool suspendLoadingRecord)
// or more likely, when the HVO was set to -1.
if (m_lnkActive.TargetGuid != Guid.Empty)
{
LcmCache cache = m_propertyTable.GetValue<LcmCache>("cache");
ICmObject obj = cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(m_lnkActive.TargetGuid);
if (obj is IReversalIndexEntry && m_lnkActive.ToolName == "reversalToolEditComplete")
{
Expand Down
Loading