|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.javacore.jmiimpl.javamodel; import org.netbeans.jmi.javamodel.MultipartId; import org.netbeans.jmi.javamodel.TypeReference; import org.netbeans.lib.java.parser.ASTree; import org.netbeans.mdr.storagemodel.StorableObject; import java.util.*; import org.netbeans.jmi.javamodel.Element; /** * * @author Martin Matula */ public abstract class TypeReferenceImpl extends ElementReferenceImpl implements TypeReference { private MultipartId parent; /** Creates a new instance of MultipartIdImpl */ public TypeReferenceImpl(StorableObject o) { super(o); } public MultipartId getParent() { if (!childrenInited) { initChildren(); } return parent; } public void setParent(MultipartId parent) { objectChanged(CHANGED_PARENT); changeChild(getParent(), parent); this.parent = parent; } void setData(String name, MultipartId parent) { super.setData(name); changeChild(null, parent); this.parent = parent; } public List getChildren() { List list = new ArrayList(1); addIfNotNull(list, getParent()); return list; } protected void initChildren() { childrenInited = false; ASTree[] children = getASTree().getSubTrees(); if (children == null || children.length < 2) { parent = null; } else { parent = (MultipartId) initOrCreate(parent, children[0]); } childrenInited = true; } protected void _delete() { // --- delete components ------------------------------------------- if (childrenInited) { deleteChild(parent); } // --- delete links ----------------------------------------------- // no links to delete // --- call super --------------------------------------- super._delete(); } public void replaceChild(Element oldElement,Element newElement) { if (childrenInited) { if (oldElement.equals(parent)) { setParent((MultipartId)newElement); } } } public void setName(String name) { super.setName(name); childChanged(this); } void childChanged(MetadataElement element) { MetadataElement parent = (MetadataElement) refImmediateComposite(); if (parent!=null){ parent.childChanged(this); } } /** * Duplicates parent. * * @return parent copy or null if parent does not exist */ MultipartId duplicateParent() { MultipartIdImpl temp = (MultipartIdImpl) getParent(); if (temp != null) { temp = (MultipartIdImpl) temp.duplicate(); } return temp; } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.