CanLinkObjects() override

Hi,
I have inheritted a control from GoView and am using it in conjunction with an own-rolled toolbox.
The toolbox contains node and link style items and I want to override CanLinkObjects in the view so that links may or may not be created according to the current context.
I have the following requirements.
1) Linking should be enabled if the selection in my toolbox is a link type.
2) Having created a link it should be possible to re-assign the end nodes by dragging the link's selection handles.
I have overriden CanLinkObjects() to achieve the first, thusly:
public override CanLinkObjects()
{
// TemplateIsEdge() returns a bool indicating whether a
// toolbox item represents a "Link"
return TemplateIsEdge(SelectedTemplate);
}
This works fine for requirement (1). However it breaks the ability to relink because it returns false when the user is trying to relink, but the selected toolbox item is not a link.
What I need next is to be able to test whether the user is trying to re-link by dragging one of the link end's selection handles. I'm sure it must be fairly straight forward, but somehow I seem unable to work out how to do it.
Can anyone help?
Cheers.

The CanLinkObjects predicate is supposed to govern whether the user can draw new links or relink existing links. The normal implementation for GoView both checks the GoView.AllowLink property and whether GoView.Document.CanLinkObjects() is true.

What I think you want to do is just affect the behavior when the user draws a new link, and whether the new-linking tool is enabled.
The way to do that is to define your own subclass of GoToolLinkingNew, and to replace the standard one with an instance of yours. Something like:
[Serializable]
public class CustomLinkingTool : GoToolLinkingNew {
public CustomLinkingTool(GoView view) : base(view) {}
public override bool CanStart() {
if (!...TemplateIsEdge...) return false;
return base.CanStart();
}
public override void Start() {
this.View.NewLinkPrototype = ...SelectedTemplate...;
base.Start();
}
}
Then you can install your tool by:
goView1.ReplaceMouseTool(typeof(GoToolLinkingNew), new CustomLinkingTool(goView1));
The standard link-relinking behavior, implemented by GoToolRelinking, remains unchanged. (Unless you want to change it, of course!)

Thanks, Walter. As always your advice is right on the money!