private string GetAttachedGameObjectName(AssetHierarchyProcessor processor, UnityAssetOccurrence occurrence)
        {
            var consumer = new UnityScenePathGameObjectConsumer();

            processor.ProcessSceneHierarchyFromComponentToRoot(occurrence.AttachedElementLocation, consumer, true, true);

            var parts = consumer.NameParts;

            if (parts.Count == 0)
            {
                return("...");
            }
            return(string.Join("/", consumer.NameParts));
        }
        private static AssetFindUsagesResultBase CreateRequest(FileSystemPath solutionDirPath, AssetHierarchyProcessor assetDocumentHierarchy,
                                                               LocalReference location, IPsiSourceFile sourceFile, bool needExpand = false)
        {
            if (!GetPathFromAssetFolder(solutionDirPath, sourceFile, out var pathFromAsset, out var fileName, out var extension))
            {
                return(null);
            }

            if (sourceFile.GetLocation().ExtensionWithDot.EndsWith(UnityYamlFileExtensions.AssetFileExtensionWithDot))
            {
                return(new AssetFindUsagesResult(needExpand, pathFromAsset, fileName, extension));
            }

            var consumer = new UnityScenePathGameObjectConsumer();

            assetDocumentHierarchy.ProcessSceneHierarchyFromComponentToRoot(location, consumer, true, true);

            return(new HierarchyFindUsagesResult(consumer.NameParts.ToArray(), consumer.RootIndexes.ToArray(), needExpand, pathFromAsset, fileName, extension));
        }
        private static AssetFindUsagesResultBase CreateRequest(FileSystemPath solutionDirPath,
                                                               AssetHierarchyProcessor assetDocumentHierarchy,
                                                               [NotNull]
                                                               AnimatorScriptUsagesElementContainer animatorContainer,
                                                               LocalReference location, IPsiSourceFile sourceFile,
                                                               [NotNull] IDeclaredElement declaredElement,
                                                               bool needExpand = false)
        {
            if (!GetPathFromAssetFolder(solutionDirPath, sourceFile, out var pathFromAsset, out var fileName, out var extension))
            {
                return(null);
            }

            var path = sourceFile.GetLocation();

            if (path.IsControllerFile() &&
                animatorContainer.GetElementsNames(location, declaredElement, out var names, out var isStateMachine) &&
                names != null)
            {
                return(new AnimatorFindUsagesResult(names,
                                                    isStateMachine ? AnimatorUsageType.StateMachine : AnimatorUsageType.State, needExpand,
                                                    pathFromAsset, fileName, extension));
            }
            if (path.ExtensionWithDot.EndsWith(UnityYamlFileExtensions.AssetFileExtensionWithDot))
            {
                return(new AssetFindUsagesResult(needExpand, pathFromAsset, fileName, extension));
            }

            if (path.IsAnimFile())
            {
                return(new AnimationFindUsagesResult(needExpand, pathFromAsset, fileName, extension));
            }

            var consumer = new UnityScenePathGameObjectConsumer();

            assetDocumentHierarchy.ProcessSceneHierarchyFromComponentToRoot(location, consumer, true, true);

            return(new HierarchyFindUsagesResult(consumer.NameParts.ToArray(), consumer.RootIndexes.ToArray(), needExpand, pathFromAsset, fileName, extension));
        }