public static void ShowProjectPreferences(PreferencesTab tab) { var window = GetWindow <SVNPreferencesWindow>(true, "Wise SVN Preferences"); window.m_PersonalPrefs = SVNPreferencesManager.Instance.PersonalPrefs.Clone(); window.m_ProjectPrefs = SVNPreferencesManager.Instance.ProjectPrefs.Clone(); window.ShowUtility(); window.position = new Rect(500f, 250f, 520f, 400f); window.minSize = new Vector2(520f, 400f); window.m_SelectedTab = tab; }
private void OnGUI() { m_SerializedObject.Update(); const float labelWidthAdd = 40; EditorGUIUtility.labelWidth += labelWidthAdd; EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Save changes:", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close", GUILayout.MaxWidth(60f))) { GUI.FocusControl(""); Close(); EditorGUIUtility.ExitGUI(); } var prevColor = GUI.backgroundColor; GUI.backgroundColor = Color.green / 1.2f; if (GUILayout.Button("Save All", GUILayout.MaxWidth(150f))) { SanitizeBeforeSave(); SVNPreferencesManager.Instance.SavePreferences(m_PersonalPrefs, m_ProjectPrefs); // When turning on the integration do instant refresh. // Works when editor started with disabled integration. Doing it here to avoid circle dependency. if (m_PersonalPrefs.EnableCoreIntegration) { SVNStatusesDatabase.Instance.InvalidateDatabase(); SVNBranchesDatabase.Instance.InvalidateDatabase(); SVNAutoLockingDatabaseStarter.TryStartIfNeeded(); } } GUI.backgroundColor = prevColor; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); m_SelectedTab = (PreferencesTab)GUILayout.Toolbar((int)m_SelectedTab, m_PreferencesTabsNames); m_ProjectPreferencesScroll = EditorGUILayout.BeginScrollView(m_ProjectPreferencesScroll); switch (m_SelectedTab) { case PreferencesTab.Personal: DrawPersonalPreferences(); break; case PreferencesTab.Project: DrawProjectPreferences(); break; case PreferencesTab.About: DrawHelpAbout(); break; } EditorGUILayout.EndScrollView(); EditorGUILayout.Space(); EditorGUIUtility.labelWidth -= labelWidthAdd; m_SerializedObject.ApplyModifiedProperties(); }
private void OnGUI() { const float labelWidthAdd = 40; EditorGUIUtility.labelWidth += labelWidthAdd; EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Save changes:", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close", GUILayout.MaxWidth(60f))) { GUI.FocusControl(""); Close(); EditorGUIUtility.ExitGUI(); } var prevColor = GUI.backgroundColor; GUI.backgroundColor = Color.green / 1.2f; if (GUILayout.Button("Save All", GUILayout.MaxWidth(150f))) { m_ProjectPrefs.SvnCLIPath = m_ProjectPrefs.SvnCLIPath.Trim(); m_ProjectPrefs.SvnCLIPathMacOS = m_ProjectPrefs.SvnCLIPathMacOS.Trim(); m_ProjectPrefs.Exclude.RemoveAll(p => string.IsNullOrWhiteSpace(p)); SVNPreferencesManager.Instance.SavePreferences(m_PersonalPrefs, m_ProjectPrefs); // When turning on the integration do instant refresh. // Works when editor started with disabled integration. Doing it here to avoid circle dependency. if (m_PersonalPrefs.EnableCoreIntegration) { SVNStatusesDatabase.Instance.InvalidateDatabase(); } } GUI.backgroundColor = prevColor; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); m_SelectedTab = (PreferencesTab)GUILayout.Toolbar((int)m_SelectedTab, m_PreferencesTabsNames); m_ProjectPreferencesScroll = EditorGUILayout.BeginScrollView(m_ProjectPreferencesScroll); switch (m_SelectedTab) { case PreferencesTab.Personal: DrawPersonalPreferences(); break; case PreferencesTab.Project: DrawProjectPreferences(); break; case PreferencesTab.About: DrawAbout(); break; } EditorGUILayout.EndScrollView(); EditorGUILayout.Space(); EditorGUIUtility.labelWidth -= labelWidthAdd; }