Deactivates a previously active sibling scope and activate a new one.
(Only a single sibling scope can be active at a time)

@param targetUnit the unit from which the scope will be derived
968299
public void activateScope(QName targetUnit) {

        Scope nextScope = getScope(targetUnit);
        int parentScopeId = getParentScope(targetUnit).getId();

        Scope activeScope = activeChildMapping.get(parentScopeId);
        if(!nextScope.equals(activeScope))
        {
            //System.out.println("Replace activation of scope "+activeScope+" with "+ nextScope);

            // root element might not have an active scope
            if(activeScope!=null)
                activeScope.setActive(false);

            nextScope.setActive(true);
            activeChildMapping.put(parentScopeId, nextScope);

        }
    }
1304867
private void unbind(IActionTarget target) {
        if (targets.remove(target) && targets.isEmpty()) {
            getEventManager().unsubscribe(eventName, this);
        }
    }
321620
final void initInvocationTarget() throws Exception {
        Member previousTargetMember = targetMember;
        T target = getInvocationTarget();
        if (target == null) {
            remote = false;
            throw newTargetNullException();
        }

        targetMember = toTargetMember(target);
        if (targetMember != null) {
            targetAddress = targetMember.getAddress();
        } else {
            targetAddress = toTargetAddress(target);
        }
        memberListVersion = context.clusterService.getMemberListVersion();

        if (targetMember == null) {
            if (previousTargetMember != null) {
                // If a target member was found earlier but current target member is null
                // then it means a member left.
                throw new MemberLeftException(previousTargetMember);
            }
            if (!(isJoinOperation(op) || isWanReplicationOperation(op))) {
                throw new TargetNotMemberException(target, op.getPartitionId(), op.getClass().getName(), op.getServiceName());
            }
        }

        if (op instanceof TargetAware) {
            ((TargetAware) op).setTarget(targetAddress);
        }

        remote = !context.thisAddress.equals(targetAddress);
    }
1069421
@Override
	protected void applyAction(final SubordinateTarget target, final Object value) {
		if (value instanceof Boolean) {
			boolean visible = ((Boolean) value);
			target.setValidate(visible);
			((AbstractWComponent) target).setHidden(!visible);
		}
	}
451310
public DelegationRequest<T> setScope(String scope) {
        request.addParameter(ParameterBuilder.SCOPE_KEY, scope);
        return this;
    }
1098629
public synchronized void deactivate() {

        synchronized (this.conditions) {
            IWatchedCondition cond = null;
            for (Iterator iterator = this.conditions.iterator(); iterator.hasNext(); ) {
                IObjectReference objRef = (IObjectReference) iterator.next();
                if (objRef.get() != null) {
                    cond = (IWatchedCondition) objRef.get();
                    cond.setActive(false);
                }
            }
        }
    }
992817
public void removeChildScope(IBasicScope scope) {
        log.debug("removeChildScope: {}", scope);
        if (children.containsKey(scope)) {
            // remove from parent
            children.remove(scope);
            if (scope instanceof Scope) {
                unregisterJMX();
            }
        }
    }
503152
public void setTargetTags(java.util.Collection<Tag> targetTags) {
        if (targetTags == null) {
            this.targetTags = null;
            return;
        }

        this.targetTags = new java.util.ArrayList<Tag>(targetTags);
    }
175840
@Override
	protected void applyAction(final SubordinateTarget target, final Object value) {
		// Should always be Boolean, but check anyway
		if (value instanceof Boolean) {
			applyMandatoryAction(target, ((Boolean) value));
		}
	}
821732
public void init(BaseField field, String targetFieldName, BaseField fldTarget)
    {
        super.init(field);

        m_bDisableTarget = false;
        this.targetFieldName = targetFieldName;
        m_fldTarget = fldTarget;
    }
32825
public void removeTargetHandler( TargetHandler targetItf ) {

		// May happen if a target could not be instantiated
		// (iPojo uses proxies). In this case, it results in a NPE here.
		if( targetItf == null ) {
			this.logger.info( "An invalid target handler is removed." );

		} else {
			synchronized( this.targetHandlers ) {
				this.targetHandlers.remove( targetItf );
			}

			this.logger.info( "Target handler '" + targetItf.getTargetId() + "' is not available anymore in Roboconf's DM." );
		}

		listTargets( this.targetHandlers, this.logger );
	}
391965
@Override
	protected void applyAction(final SubordinateTarget target, final Object value) {
		// Should always be Boolean, but check anyway
		if (value instanceof Boolean) {
			applyEnableAction(target, ((Boolean) value));
		}
	}
980722
public static <T extends AbstractJaxb> void removeDescendants(T target,
            String clazz) {
        execute(target, null, clazz);
    }
453308
public boolean isWithinActiveScope(final QName unitId) {

        final Node<Scope> self = dialog.getScopeModel().findNode(
                dialog.findUnit(unitId).getScopeId()
        );
        final Scope scopeOfUnit = self.getData();
        int parentScopeId = getParentScope(unitId).getId();

        Scope activeScope = activeChildMapping.get(parentScopeId);
        boolean selfIsActive = activeScope != null && activeScope.equals(scopeOfUnit);

        if(selfIsActive) // only verify parents if necessary
        {
            LinkedList<Scope> parentScopes = new LinkedList<Scope>();
            getParentScopes(self, parentScopes);

            boolean inActiveParent = false;
            for(Scope parent : parentScopes)
            {
                if(!parent.isActive())
                {
                    inActiveParent = true;
                    break;
                }
            }
            return inActiveParent;
        }

        return selfIsActive;
    }
634673
@Override
  public void afterExitScope(NodeTraversal t, ReferenceMap referenceMap) {
    Node scopeRoot = t.getScopeRoot();
    if (scopeRoot.isBlock() && scopeRoot.getParent().isFunction()) {
      boolean changed = false;
      for (Var v : t.getScope().getVarIterable()) {
        ReferenceCollection references = referenceMap.getReferences(v);
        Reference declaration = null;
        Reference assign = null;
        for (Reference r : references) {
          if (r.isVarDeclaration()
              && NodeUtil.isStatement(r.getNode().getParent())
              && !r.isInitializingDeclaration()) {
            declaration = r;
          } else if (assign == null
              && r.isSimpleAssignmentToName()
              && r.getScope().getClosestHoistScope().equals(t.getScope())) {
            assign = r;
          }
        }
        if (declaration != null && assign != null) {
          Node lhs = assign.getNode();
          Node assignNode = lhs.getParent();
          if (assignNode.getParent().isExprResult()) {
            Node rhs = lhs.getNext();
            assignNode
                .getGrandparent()
                .replaceChild(assignNode.getParent(), IR.var(lhs.detach(), rhs.detach()));

            Node var = declaration.getNode().getParent();
            checkState(var.isVar(), var);
            NodeUtil.removeChild(var, declaration.getNode());

            changed = true;
          }
        }
      }

      if (changed) {
        t.reportCodeChange();
      }
    }
  }
749579
public void setScope(Scope s) {
        if (s == null) Kit.codeBug();
        if (!(this instanceof Name)) {
            throw Kit.codeBug();
        }
        ((Name)this).setScope(s);
    }
112138
public void setScope(String scope) {

        if (CmsStringUtil.isNotEmpty(scope)) {
            scope = scope.trim().toLowerCase();
            m_scope = getScopeAsInt(scope);
        } else {
            // empty scope, use default "page" scope
            m_scope = PageContext.PAGE_SCOPE;
        }
    }