/** * Checks whether specified superTypeID is super type id of specified derivedTypeID * @param superTypeID the super type id * @param derivedTypeID the possible derived typeid * @return true if the superTypeID is one of super type ids of the derivedTypeID */ public boolean isInHierarchy (TypeID superTypeID, TypeID derivedTypeID) { return isComponentDescriptorCompatibleWithTypeID (superTypeID, getComponentDescriptor (derivedTypeID)); }
private void updateDescriptorReferencesCore () { for (TimedWeakReference reference : uid2components.values ()) { DesignComponent component = reference.get (); if (component == null) continue; ComponentDescriptor descriptor = descriptorRegistry.getComponentDescriptor (component.getType ()); component.setComponentDescriptor (descriptor, true); } }
public void run() { for (ComponentElement element : componentElements) { String string = element.getTypeID().getString(); if (MidpTypes.isValidFQNClassName(string)) { if (registry.getComponentDescriptor(new TypeID(TypeID.Kind.COMPONENT, string)) == null) { unresolved.add(string); } } } } });
public void run () { ComponentDescriptor descriptor = document.getDescriptorRegistry ().getComponentDescriptor (getMainComponentTypeID ()); if (descriptor != null) { TypeID superTypeID = descriptor.getTypeDescriptor ().getSuperType (); if (superTypeID != null) producers[0] = DocumentSupport.getComponentProducer (document, superTypeID.toString ()); } } });
/** * Checks whether a component descriptor is compatible (descriptor analogy of instanceof operator) with a type id. * Means: Specified component descriptor or its super descriptor has the same type id as the specified one. * @param typeID the type id * @param componentDescriptor the component descriptor * @return true if compatible */ private boolean isComponentDescriptorCompatibleWithTypeID (TypeID typeID, ComponentDescriptor componentDescriptor) { assert isAccess (); if (typeID == null) return false; for (;;) { if (componentDescriptor == null) return false; TypeDescriptor typeDescriptor = componentDescriptor.getTypeDescriptor (); TypeID checked = typeDescriptor.getThisType (); if (checked == null) return false; if (checked.equals (typeID)) return true; componentDescriptor = getComponentDescriptor (typeDescriptor.getSuperType ()); } }
@Override public Result postInitialize (DesignDocument document, DesignComponent mainComponent) { ComponentDescriptor descriptor = document.getDescriptorRegistry ().getComponentDescriptor (getMainComponentTypeID ()); if (descriptor != null) { TypeID superTypeID = descriptor.getTypeDescriptor ().getSuperType (); if (superTypeID != null) { ComponentProducer producer = DocumentSupport.getComponentProducer (document, superTypeID.toString ()); if (producer != null) producer.postInitialize (document, mainComponent); } } return super.postInitialize (document, mainComponent); }
/** * Creates a new raw component using a component descriptor with specified typeid. * <p> * Note: It does not add the component into a tree, you have to do it manually. * <p> * Note: it just allocates the component, it does not do any post-initializion. * @param componentType the component typeid * @return the new raw component */ public DesignComponent createRawComponent (TypeID componentType) { assert Debug.isFriend (DesignDocument.class, "createComponent") || Debug.isFriend ("org.netbeans.modules.vmd.io.DocumentLoad", "loadDocumentCore"); // NOI18N assert transactionManager.isWriteAccess (); ComponentDescriptor componentDescriptor = descriptorRegistry.getComponentDescriptor (componentType); assert componentDescriptor != null : "Missing component descriptor for " + componentType; // NOI18N assert componentDescriptor.getTypeDescriptor ().isCanInstantiate (); DesignComponent component = new DesignComponent (this, componentIDCounter ++, componentDescriptor); uid2components.put (component.getComponentID (), new TimedWeakReference (component)); getListenerManager ().notifyComponentCreated (component); return component; }
long componentid = element.getUID(); loadingDocument.setPreferredComponentID(componentid); if (loadingDocument.getDescriptorRegistry().getComponentDescriptor(element.getTypeID()) == null) { if (element.getUID() == 0) { Debug.warning("Missing ComponentDescriptor in registry ", element.getTypeID()); // NOI18N