@Override public Color getBackground(Object element) { // DisplayItem 比如在接口中显示的对象的属性子节点,仅做展示用,任何属性都是只读的 if (element instanceof DisplayItem) { return COLOR_GRAY; } Parameter p = (Parameter) getOwner(element); EStructuralFeature feature = getEStructuralFeature(element); switch (p.getParamType()) { case STD_FIELD: if (BizPackage.Literals.PARAMETER__NAME.equals(feature) || BizPackage.Literals.PARAMETER__REAL_TYPE.equals(feature) || BizPackage.Literals.PARAMETER__TYPE.equals(feature) || BizPackage.Literals.PARAMETER__DESCRIPTION.equals(feature)) { return COLOR_GRAY; } break; case NON_STD_FIELD: if (feature.equals(BizPackage.Literals.PARAMETER__REAL_TYPE)) return COLOR_GRAY; break; case OBJECT: boolean hasStdObjectList = BizUtil.hasStdObjList(project); if (hasStdObjectList && (BizPackage.Literals.PARAMETER__TYPE.equals(feature) || MetadataPackage.Literals.NAMED_ELEMENT__DESCRIPTION.equals(feature) || MetadataPackage.Literals.NAMED_ELEMENT__CHINESE_NAME.equals(feature))) { return COLOR_GRAY; } if (BizPackage.Literals.PARAMETER__NAME.equals(feature) || BizPackage.Literals.PARAMETER__REAL_TYPE.equals(feature) || BizPackage.Literals.PARAMETER__DESCRIPTION.equals(feature) || BizPackage.Literals.PARAMETER__DEFAULT_VALUE.equals(feature)) { return COLOR_GRAY; } break; case COMPONENT: // 组件 if (BizPackage.Literals.PARAMETER__NAME.equals(feature) || BizPackage.Literals.PARAMETER__REAL_TYPE.equals(feature) || BizPackage.Literals.PARAMETER__DESCRIPTION.equals(feature) || BizPackage.Literals.PARAMETER__DEFAULT_VALUE.equals(feature)) { return COLOR_GRAY; } break; case PARAM_GROUP: // 参数组,只编辑类型来关联对象,其他都不可编辑 if (BizPackage.Literals.PARAMETER__NAME.equals(feature) || BizPackage.Literals.PARAMETER__ID.equals(feature) || BizPackage.Literals.PARAMETER__REAL_TYPE.equals(feature) || BizPackage.Literals.PARAMETER__DESCRIPTION.equals(feature) || BizPackage.Literals.PARAMETER__DEFAULT_VALUE.equals(feature)) { return COLOR_GRAY; } break; default: break; } if (resource != null && resource.isReadOnly()) { return COLOR_GRAY; } return super.getBackground(element); }