private void ClosedViewButtons(string viewName)
        {
            if (_renamingView != "" && _renamingView != viewName)
            {
                GUI.enabled = false;
            }
            else
            {
                GUI.enabled = true;
            }

            if (_renamingView == viewName)
            {
                _tempViewName = GUILayout.TextArea(_tempViewName);
            }
            else
            {
                GUILayout.Label(viewName, EditorStyles.boldLabel);
            }

            if (IsViewBeingEdited(viewName))
            {
                GUI.enabled = false;
            }
            if (GUILayout.Button("Open", GUILayout.Width(100)))
            {
                GameObject obj = PrefabUtility.InstantiatePrefab(Resources.Load(_scaffoldingConfig.ViewPrefabPath() + viewName)) as GameObject;
#if UNITY_4_6
                obj.transform.SetParent(_scaffoldingConfig.DetermineParentGameObjectPath().transform);
#else
                obj.transform.parent = _scaffoldingConfig.DetermineParentGameObjectPath().transform;
#endif
                Selection.activeObject = obj;
            }
            GUI.enabled = true;
            if (IsViewBeingEdited(viewName))
            {
                if (GUILayout.Button("Done", GUILayout.Width(60)))
                {
                    _renamingView = "";
                    string oldNamePrefab = _scaffoldingConfig.FullViewPrefabPath() + viewName;
                    string oldNameScript = _scaffoldingConfig.ScriptsPath() + viewName;
                    string newNamePrefab = _scaffoldingConfig.FullViewPrefabPath() + _tempViewName;
                    string newNameScript = _scaffoldingConfig.ScriptsPath() + _tempViewName;

                    AssetDatabase.MoveAsset(oldNamePrefab + ".prefab", newNamePrefab + ".prefab");
                    RenameFile(oldNameScript + ".cs", viewName, _tempViewName);
                    AssetDatabase.MoveAsset(oldNameScript + ".cs", newNameScript + ".cs");


                    AssetDatabase.MoveAsset(oldNamePrefab + "Model.prefab", newNamePrefab + "Model.prefab");
                    RenameFile(oldNameScript + "Model.cs", viewName, _tempViewName);
                    AssetDatabase.MoveAsset(oldNameScript + "Model.cs", newNameScript + "Model.cs");
                    AssetDatabase.Refresh();
                    CreateAllViews();
                }
            }
            else
            {
                if (_renamingView != "" && _renamingView != viewName)
                {
                    GUI.enabled = false;
                }
                if (GUILayout.Button("Rename", GUILayout.Width(60)))
                {
                    _renamingView = viewName;
                    _tempViewName = viewName;
                }
            }

            if (_renamingView != "" && _renamingView != viewName || IsViewBeingEdited(viewName))
            {
                GUI.enabled = false;
            }
            if (GUILayout.Button("Delete", GUILayout.Width(50)))
            {
                if (EditorUtility.DisplayDialog("Delete " + viewName + " from your project?", "Deleting this view will permenantly remove it from your project, are you sure?", "Yes", "No"))
                {
                    string     name = viewName + "Model";
                    GameObject go   = GameObject.Find(name);
                    DestroyImmediate(go);

                    AssetDatabase.DeleteAsset(_scaffoldingConfig.FullViewPrefabPath() + viewName + ".prefab");
                    AssetDatabase.DeleteAsset(_scaffoldingConfig.ScriptsPath() + viewName + ".cs");
                    AssetDatabase.DeleteAsset(_scaffoldingConfig.FullViewPrefabPath() + viewName + "Model.prefab");
                    AssetDatabase.DeleteAsset(_scaffoldingConfig.ScriptsPath() + viewName + "Model.cs");
                    AssetDatabase.Refresh();
                }
            }
        }
        private void ClosedViewButtons(string viewName)
        {
            if (_renamingView != "" && _renamingView != viewName)
            {
                GUI.enabled = false;
            }
            else
            {
                GUI.enabled = true;
            }

            if (_renamingView == viewName)
            {
                _tempViewName = GUILayout.TextArea(_tempViewName);
            }
            else
            {
                GUIStyle skin = EditorStyles.boldLabel;
                skin.normal.textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black;

                GUILayout.Label(viewName, skin);
            }

            if (IsViewBeingEdited(viewName))
            {
                GUI.enabled = false;
            }
            if (GUILayout.Button("Open", GUILayout.Width(100)))
            {
                GameObject obj = PrefabUtility.InstantiatePrefab(Resources.Load <GameObject>(_scaffoldingConfig.ViewPrefabPath(viewName) + viewName)) as GameObject;
                                #if UNITY_4_6 || UNITY_5
                obj.transform.SetParent(_scaffoldingConfig.DetermineParentGameObjectPath().transform);
#else
                obj.transform.parent = _scaffoldingConfig.DetermineParentGameObjectPath().transform;
#endif
                Selection.activeObject = obj;
            }
            GUI.enabled = true;
            if (IsViewBeingEdited(viewName))
            {
                if (GUILayout.Button("Done", GUILayout.Width(60)))
                {
                    _renamingView = "";
                    string oldNamePrefab = "";
                    string oldNameScript = "";
                    var    guids         = AssetDatabase.FindAssets(viewName);
                    foreach (var guid in guids)
                    {
                        string s = AssetDatabase.GUIDToAssetPath(guid);
                        if (s.Contains(".cs"))
                        {
                            oldNameScript = s;
                        }
                        else if (s.Contains(".prefab"))
                        {
                            oldNamePrefab = s;
                        }
                    }

                    string newNamePrefab = oldNamePrefab.Replace(viewName, _tempViewName);
                    string newNameScript = oldNameScript.Replace(viewName, _tempViewName);

                    Debug.Log(newNamePrefab);

                    AssetDatabase.MoveAsset(oldNamePrefab, newNamePrefab);
                    RenameFile(oldNameScript, viewName, _tempViewName);
                    AssetDatabase.MoveAsset(oldNameScript, newNameScript);


                    AssetDatabase.MoveAsset(oldNamePrefab + "Model", newNamePrefab + "Model");
                    RenameFile(oldNameScript + "Model", viewName, _tempViewName);
                    AssetDatabase.MoveAsset(oldNameScript + "Model", newNameScript + "Model");
                    AssetDatabase.Refresh();
                    CreateAllViews();
                }
            }
            else
            {
                if (_renamingView != "" && _renamingView != viewName)
                {
                    GUI.enabled = false;
                }
                if (GUILayout.Button("Rename", GUILayout.Width(60)))
                {
                    _renamingView = viewName;
                    _tempViewName = viewName;
                }
            }

            if (_renamingView != "" && _renamingView != viewName || IsViewBeingEdited(viewName))
            {
                GUI.enabled = false;
            }
            if (GUILayout.Button("Delete", GUILayout.Width(50)))
            {
                if (EditorUtility.DisplayDialog("Delete " + viewName + " from your project?", "Deleting this view will permenantly remove it from your project, are you sure?", "Yes", "No"))
                {
                    string     name = viewName + "Model";
                    GameObject go   = GameObject.Find(name);
                    DestroyImmediate(go);

                    DeleteFile(viewName, ".prefab");
                    DeleteFile(viewName, ".cs");
                    DeleteFile(viewName, "Model.prefab");
                    DeleteFile(viewName, "Model.cs");

                    AssetDatabase.Refresh();
                }
            }
        }