public bool IsAvailable(IUserDataHolder cache) { var identifier = myDataProvider.GetSelectedElement <ICSharpIdentifier>(); var classLikeDeclaration = ClassLikeDeclarationNavigator.GetByNameIdentifier(identifier); if (classLikeDeclaration == null) { return(false); } ITypeElement declaredElement = classLikeDeclaration.DeclaredElement; if (declaredElement.DerivesFrom(KnownTypes.EditorWindow)) { return(false); } if (declaredElement.DerivesFrom(KnownTypes.Editor)) { return(false); } var existingAttribute = classLikeDeclaration.GetAttribute(KnownTypes.CreateAssetMenuAttribute); return(existingAttribute == null && declaredElement.DerivesFromScriptableObject()); }