private void OnEnable() { GitWindows.AddWindow(this); compareOptions = new CompareOptions() { Algorithm = DiffAlgorithm.Myers, ContextLines = 0 }; explicitPathsOptions = new ExplicitPathsOptions(); titleContent = new GUIContent("Diff Inspector", GitGUI.Textures.ZoomTool); uberRegex = new UberRegex(new ColoredRegex[] { new ColoredRegex("Comments", comments, "green"), new ColoredRegex("Strings", strings, "brown"), new ColoredRegex("Keywords", keywords, "blue"), new ColoredRegex("Types", types, "blue"), new ColoredRegex("Methods", methods, "teal"), new ColoredRegex("Attributes", attributes, "blue"), new ColoredRegex("Defines", defines, "olive"), new ColoredRegex("Values", values, "brown"), new ColoredRegex("NUmbers", numbers, "brown"), }); }
protected virtual void OnEnable() { GitWindows.AddWindow(this); if (gitManager != null) { titleContent.image = gitManager.GetGitStatusIcon(); } }
protected virtual void OnEnable() { GitWindows.AddWindow(this); if (gitManager != null) { titleContent.image = gitManager.GetGitStatusIcon(); } ConstructGUI(rootVisualElement); }
public static T GetGitWindow <T>(bool utility) where T : EditorWindow { var editorWindow = GitWindows.GetWindow <T>(); if (editorWindow != null) { editorWindow.Show(); return(editorWindow); } var newWindow = Resources.FindObjectsOfTypeAll <T>().FirstOrDefault() ?? ScriptableObject.CreateInstance <T>(); if (utility) { newWindow.ShowUtility(); } else { newWindow.Show(); } return(newWindow); }
private void OnDisable() { GitWindows.RemoveWindow(this); }
private void OnEnable() { GitWindows.AddWindow(this); createButtonName = "Save"; titleContent = new GUIContent("Stash Save", GitOverlay.icons.stashIcon.image); }
protected void OnDisable() { GitWindows.RemoveWindow(this); }
private void OnEnable() { titleContent = GitGUI.IconContent("UnityEditor.ConsoleWindow", "GitLog"); GitWindows.AddWindow(this); }
private void OnEnable() { GitWindows.AddWindow(this); }
protected virtual void OnEnable() { GitWindows.AddWindow(this); serializedObject = new SerializedObject(this); Repaint(); }
static UniGitLoader() { Profiler.BeginSample("UniGit Initialization"); try { injectionHelper = new InjectionHelper(); GitWindows.Init(); var recompileChecker = ScriptableObject.CreateInstance <AssemblyReloadScriptableChecker>(); recompileChecker.OnBeforeReloadAction = OnBeforeAssemblyReload; string repoPath = Application.dataPath.Replace(UniGitPath.UnityDeirectorySeparatorChar + "Assets", "").Replace(UniGitPath.UnityDeirectorySeparatorChar, Path.DirectorySeparatorChar); string settingsPath = UniGitPath.Combine(repoPath, ".git", "UniGit", "Settings.json"); injectionHelper.Bind <string>().FromInstance(repoPath).WithId("repoPath"); injectionHelper.Bind <string>().FromInstance(settingsPath).WithId("settingsPath"); injectionHelper.Bind <GitCallbacks>().FromMethod(() => { var c = new GitCallbacks(); EditorApplication.update += c.IssueEditorUpdate; c.RefreshAssetDatabase += AssetDatabase.Refresh; c.SaveAssetDatabase += AssetDatabase.SaveAssets; EditorApplication.projectWindowItemOnGUI += c.IssueProjectWindowItemOnGUI; //asset postprocessing GitAssetPostprocessors.OnWillSaveAssetsEvent += c.IssueOnWillSaveAssets; GitAssetPostprocessors.OnPostprocessImportedAssetsEvent += c.IssueOnPostprocessImportedAssets; GitAssetPostprocessors.OnPostprocessDeletedAssetsEvent += c.IssueOnPostprocessDeletedAssets; GitAssetPostprocessors.OnPostprocessMovedAssetsEvent += c.IssueOnPostprocessMovedAssets; return(c); }); injectionHelper.Bind <IGitPrefs>().To <UnityEditorGitPrefs>(); injectionHelper.Bind <GitManager>(); injectionHelper.Bind <GitSettingsJson>(); injectionHelper.Bind <GitSettingsManager>(); injectionHelper.Bind <GitAsyncManager>(); GitManager = injectionHelper.GetInstance <GitManager>(); GitManager.Callbacks.RepositoryCreate += OnRepositoryCreate; GitUnityMenu.Init(GitManager); GitResourceManager.Initilize(); GitOverlay.Initlize(); //credentials injectionHelper.Bind <ICredentialsAdapter>().To <WincredCredentialsAdapter>(); injectionHelper.Bind <GitCredentialsManager>(); //externals injectionHelper.Bind <IExternalAdapter>().To <GitExtensionsAdapter>(); injectionHelper.Bind <IExternalAdapter>().To <TortoiseGitAdapter>(); injectionHelper.Bind <GitExternalManager>(); injectionHelper.Bind <GitLfsManager>(); //hooks injectionHelper.Bind <GitPushHookBase>().To <GitLfsPrePushHook>(); injectionHelper.Bind <GitHookManager>(); //helpers injectionHelper.Bind <GitLfsHelper>(); injectionHelper.Bind <FileLinesReader>(); //project window overlays injectionHelper.Bind <GitProjectOverlay>(); if (!Repository.IsValid(repoPath)) { EditorApplication.delayCall += OnDelayedInit; } else { Rebuild(injectionHelper); EditorApplication.delayCall += OnDelayedInit; } } finally { Profiler.EndSample(); } }
static UniGitLoader() { HandlePaths(); GitProfilerProxy.BeginSample("UniGit Initialization"); try { GitWindows.OnWindowAddedEvent += OnWindowAdded; EditorApplication.update += OnEditorUpdate; injectionHelper = new InjectionHelper(); GitWindows.Init(); uniGitData = CreateUniGitData(); //data must be created manually to not call unity methods from constructors string projectPath = UniGitPathHelper.FixUnityPath( Application.dataPath.Replace(UniGitPathHelper.UnityDeirectorySeparatorChar + "Assets", "")); string repoPath = projectPath; if (EditorPrefs.HasKey(RepoPathKey)) { repoPath = UniGitPathHelper.FixUnityPath(UniGitPathHelper.Combine(repoPath, EditorPrefs.GetString(RepoPathKey))); } injectionHelper.Bind <UniGitPaths>().FromInstance(new UniGitPaths(repoPath, projectPath)); injectionHelper.Bind <GitInitializer>().NonLazy(); injectionHelper.Bind <UniGitData>().FromMethod(c => uniGitData); //must have a getter so that it can be injected injectionHelper.Bind <GitCallbacks>().FromMethod(GetGitCallbacks); injectionHelper.Bind <IGitPrefs>().To <UnityEditorGitPrefs>(); injectionHelper.Bind <GitManager>().NonLazy(); injectionHelper.Bind <GitSettingsJson>(); injectionHelper.Bind <GitSettingsManager>(); injectionHelper.Bind <GitAsyncManager>(); injectionHelper.Bind <GitFileWatcher>().NonLazy(); injectionHelper.Bind <GitReflectionHelper>(); injectionHelper.Bind <IGitResourceManager>().To <GitResourceManager>(); injectionHelper.Bind <GitOverlay>(); injectionHelper.Bind <GitAutoFetcher>().NonLazy(); injectionHelper.Bind <GitLog>(); injectionHelper.Bind <ILogger>().FromMethod(c => new Logger(c.injectionHelper.GetInstance <GitLog>())); injectionHelper.Bind <GitAnimation>(); injectionHelper.Bind <ICredentialsAdapter>().To <WincredCredentialsAdapter>(); injectionHelper.Bind <GitCredentialsManager>().NonLazy(); injectionHelper.Bind <IExternalAdapter>().To <GitExtensionsAdapter>(); injectionHelper.Bind <IExternalAdapter>().To <TortoiseGitAdapter>(); injectionHelper.Bind <GitExternalManager>(); injectionHelper.Bind <GitLfsManager>().NonLazy(); //must be non lazy as it add itself as a filter injectionHelper.Bind <GitPushHookBase>().To <GitLfsPrePushHook>(); injectionHelper.Bind <GitHookManager>().NonLazy(); injectionHelper.Bind <GitLfsHelper>(); injectionHelper.Bind <FileLinesReader>(); injectionHelper.Bind <GitProjectOverlay>().NonLazy(); injectionHelper.Bind <GitConflictsHandler>(); //diff window injectionHelper.Bind <GitDiffWindowToolbarRenderer>().AsTransient(); injectionHelper.Bind <GitDiffElementContextFactory>().AsTransient(); injectionHelper.Bind <GitDiffWindowCommitRenderer>().AsTransient(); injectionHelper.Bind <GitDiffWindowDiffElementRenderer>().AsTransient(); Rebuild(injectionHelper); } finally { GitProfilerProxy.EndSample(); } }