public void Set(UnassignedBehavior target, VoosEngine.BehaviorLogItem?error = null)
    {
        Clear();
        Debug.Assert(target.IsValid(), "Given target was not valid?");

        this.target = target;

        // Use draft code if it's there.
        liveCode = Util.IsNotNullNorEmpty(target.GetDraftCode()) ?
                   target.GetDraftCode().NormalizeLineEndings() :
                   target.GetCode().NormalizeLineEndings();

        lastCompiledCode = target.GetCode().NormalizeLineEndings();

        browser.SetCode(liveCode);

        // Restore scroll pos if this is the same as before
        if (scrollPosByUri.ContainsKey(target.GetBehaviorUri()))
        {
            browser.SetScrollTop(scrollPosByUri[target.GetBehaviorUri()]);
        }

        browser.SetReadOnly(target.IsBehaviorReadOnly());

        if (error.HasValue)
        {
            AddErrorToMonaco(error.Value.lineNum, error.Value.message);
        }
    }
 bool IsTargetValid()
 {
     return(target != null && target.IsValid());
 }
 public bool IsValid()
 {
     return(item.IsValid());
 }