コード例 #1
0
ファイル: BplContextNode.cs プロジェクト: borkaborka/gmit
      // attaches a node to the given context
      private void _attachToContext(BplContextNode node, BplContext context) {
         // check that the node can and needs to be attached to the context
         // assumptions: node and context are not null and node.Context != context
         if (node.Context != null) {
            _verifyContextCompatibility(node.Context, context);
            return;
         }
         if (context.IsA<BplGlobalContext>() && !node.IsA<BplTaxonomy>()) {
            return;
         }

         // attach node to context, and index/seal it as needed
         context.AttachNode(node);

         // recursively attach the node's children
         foreach (var child in node.Children.Where(child => child.Context != context)) {
            _attachToContext(child, context);
         }

         // recursively attach the node's target associations
         if (node.HasTargets) {
            foreach (var target in node.Targets.Where(target => target.Context != context)) {
               _attachToContext(target, context);
            }
         }

         // recursively attach the node's source associations
         if (node.HasSources) {
            foreach (var source in node.Sources.Where(source => BplContext.GetOwner(source) != context)) {
               if (source.IsA<BplContext>()) {
                  _verifyContextCompatibility((BplContext)source, context);
               } else {
                  _attachToContext((BplContextNode)source, context);
               }
            }
         }
      }
コード例 #2
0
ファイル: BplContextNode.cs プロジェクト: borkaborka/gmit
 // verifies that two contexts are compatible for association
 private void _verifyContextCompatibility(BplContext context1, BplContext context2) {
    if (context1 == context2 || context1 == null || context2 == null) return;
    if (!(context1.IsA<BplGlobalContext>() ^ context2.IsA<BplGlobalContext>())) {
       BplRuntimeException.Throw("Attempt to associate objects from different contexts '{0}' and '{1}'".Substitute(context1, context2), this);
    }
 }
コード例 #3
0
ファイル: BplContextProxy.cs プロジェクト: borkaborka/gmit
 /// <summary>Creates a new <see cref="BplContextProxy"/> instance that wraps the given BPL context.</summary>
 /// <param name="source">The source BPL context on the debuggee-side.</param>
 protected internal BplContextProxy(BplContext source) : base(source) {
    ImageKey = SelectedImageKey = "BplContext";
    Text = source.Name;
 }