EditorPropertyDisplayer.java 文件源码

java
阅读 17 收藏 0 点赞 0 评论 0

项目:incubator-netbeans 作者:
/** Basically some hacks to acquire the underlying property descriptor in
 * the case of a wrapper.  This is here because some property editors will
 * cast the result of PropertyEnv.getFeatureDescriptor() as a specific
 * implementation type, so even if we're wrapping a property model, we
 * still need to make sure we're returning the class they expect.  */
static final FeatureDescriptor findFeatureDescriptor(PropertyDisplayer pd) {
    if (pd instanceof EditorPropertyDisplayer) {
        //Issue 38004, more gunk to ensure we get the right feature
        //descriptor
        EditorPropertyDisplayer epd = (EditorPropertyDisplayer) pd;

        if (epd.modelRef != null) {
            PropertyModel pm = epd.modelRef.get();

            if (pm instanceof ExPropertyModel) {
                FeatureDescriptor fd = ((ExPropertyModel) pm).getFeatureDescriptor();

                if (fd != null) {
                    return fd;
                }
            }
        }
    }

    Property p = pd.getProperty();

    if (p instanceof ModelProperty) {
        return ((ModelProperty) p).getFeatureDescriptor();
    } else if (p instanceof ModelProperty.DPMWrapper) {
        return ((ModelProperty.DPMWrapper) p).getFeatureDescriptor();
    } else {
        return p;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号