static void DrawIncomingChangesNotification( WorkspaceInfo wkInfo, WorkspaceWindow workspaceWindow, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonViewSwitcher, IncomingChangesNotification notification, bool isGluonMode) { Images.Name iconName = notification.Status == PlasticNotification.Status.Conflicts ? Images.Name.IconConflicted : Images.Name.IconOutOfSync; DrawIcon(iconName); DrawNotificationLabel(notification.InfoText); if (DrawButton(notification.ActionText, notification.TooltipText)) { if (notification.HasUpdateAction) { workspaceWindow.UpdateWorkspace(); return; } ShowIncomingChangesForMode( wkInfo, mergeViewLauncher, gluonViewSwitcher, isGluonMode); } }
internal static bool CheckinPaths( WorkspaceInfo wkInfo, List<string> paths, IAssetStatusCache assetStatusCache, bool isGluonMode, EditorWindow parentWindow, IWorkspaceWindow workspaceWindow, ViewHost viewHost, GuiMessage.IGuiMessage guiMessage, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonViewSwitcher) { MetaCache metaCache = new MetaCache(); metaCache.Build(paths); CheckinDialog dialog = Create( wkInfo, paths, assetStatusCache, metaCache, isGluonMode, new ProgressControlsForDialogs(), workspaceWindow, viewHost, guiMessage, mergeViewLauncher, gluonViewSwitcher); return dialog.RunModal(parentWindow) == ResponseType.Ok; }
static void DoHeader( WorkspaceInfo workspaceInfo, PlasticGUIClient plasticClient, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonSwitcher, bool isGluonMode, IIncomingChangesNotificationPanel incomingChangesNotificationPanel) { EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); GUILayout.Label( plasticClient.HeaderTitle, UnityStyles.PlasticWindow.HeaderTitleLabel); GUILayout.FlexibleSpace(); DrawIncomingChangesNotificationPanel.ForMode( workspaceInfo, plasticClient, mergeViewLauncher, gluonSwitcher, isGluonMode, incomingChangesNotificationPanel.IsVisible, incomingChangesNotificationPanel.Data); //TODO: Codice - beta: hide the switcher until the update dialog is implemented //DrawGuiModeSwitcher.ForMode( // isGluonMode, plasticClient, changesTreeView, editorWindow); EditorGUILayout.EndHorizontal(); }
static CheckinDialog Create( WorkspaceInfo wkInfo, List<string> paths, IAssetStatusCache assetStatusCache, MetaCache metaCache, bool isGluonMode, ProgressControlsForDialogs progressControls, IWorkspaceWindow workspaceWindow, ViewHost viewHost, GuiMessage.IGuiMessage guiMessage, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonViewSwitcher) { var instance = CreateInstance<CheckinDialog>(); instance.IsResizable = true; instance.minSize = new Vector2(520, 370); instance.mWkInfo = wkInfo; instance.mPaths = paths; instance.mAssetStatusCache = assetStatusCache; instance.mMetaCache = metaCache; instance.mIsGluonMode = isGluonMode; instance.mProgressControls = progressControls; instance.mWorkspaceWindow = workspaceWindow; instance.mViewHost = viewHost; instance.mGuiMessage = guiMessage; instance.mMergeViewLauncher = mergeViewLauncher; instance.mGluonViewSwitcher = gluonViewSwitcher; instance.mEnterKeyAction = instance.OkButtonAction; instance.mEscapeKeyAction = instance.CancelButtonAction; return instance; }
static void DoActionButton( WorkspaceInfo workspaceInfo, WorkspaceWindow workspaceWindow, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonSwitcher, bool isGluonMode, bool isUpdateAction, GUIContent buttonContent, GUIStyle buttonStyle) { if (!GUILayout.Button( buttonContent, buttonStyle, GUILayout.ExpandHeight(true), GUILayout.MinWidth(40))) { return; } if (isUpdateAction) { workspaceWindow.UpdateWorkspace(); return; } ShowIncomingChangesForMode( workspaceInfo, mergeViewLauncher, gluonSwitcher, isGluonMode); }
internal AssetOperations( WorkspaceInfo wkInfo, IWorkspaceWindow workspaceWindow, IViewSwitcher viewSwitcher, IHistoryViewLauncher historyViewLauncher, ViewHost viewHost, NewIncomingChangesUpdater newIncomingChangesUpdater, IAssetStatusCache assetStatusCache, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonViewSwitcher, EditorWindow parentWindow, IAssetSelection assetSelection, bool isGluonMode) { mWkInfo = wkInfo; mWorkspaceWindow = workspaceWindow; mViewSwitcher = viewSwitcher; mHistoryViewLauncher = historyViewLauncher; mViewHost = viewHost; mNewIncomingChangesUpdater = newIncomingChangesUpdater; mAssetStatusCache = assetStatusCache; mMergeViewLauncher = mergeViewLauncher; mGluonViewSwitcher = gluonViewSwitcher; mAssetSelection = assetSelection; mIsGluonMode = isGluonMode; mParentWindow = parentWindow; mGuiMessage = new UnityPlasticGuiMessage(parentWindow); mProgressControls = new EditorProgressControls(mGuiMessage); }
static void DoChangesArea( WorkspaceInfo wkInfo, PendingChangesTreeView changesTreeView, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonViewSwitcher, bool isOperationRunning, bool isGluonMode, bool isCheckedInSuccessful, PlasticNotification.Status notificationStatus, string notificationInfoText, string notificationActionText) { GUI.enabled = !isOperationRunning; Rect rect = GUILayoutUtility.GetRect(0, 100000, 0, 100000); changesTreeView.OnGUI(rect); if (changesTreeView.GetTotalItemCount() == 0) { DrawEmptyState( rect, isCheckedInSuccessful, notificationStatus, notificationInfoText, notificationActionText, () => OpenIncomingChangesTab( wkInfo, mergeViewLauncher, gluonViewSwitcher, isGluonMode)); } GUI.enabled = true; }
internal static void CheckinPathsPartial( WorkspaceInfo wkInfo, List <string> paths, string comment, ViewHost viewHost, CheckinDialog dialog, GuiMessage.IGuiMessage guiMessage, IProgressControls progressControls, IGluonViewSwitcher gluonViewSwitcher) { BaseCommandsImpl baseCommands = new BaseCommandsImpl(); progressControls.ShowProgress(PlasticLocalization.GetString( PlasticLocalization.Name.CheckinInFilesProgress)); IThreadWaiter waiter = ThreadWaiter.GetWaiter(50); waiter.Execute( /*threadOperationDelegate*/ delegate { baseCommands.PartialCheckin(wkInfo, paths, comment); }, /*afterOperationDelegate*/ delegate { progressControls.HideProgress(); ((IPlasticDialogCloser)dialog).CloseDialog(); if (waiter.Exception is CheckinConflictsException) { // we need to explicitly call EditorWindow.Close() to ensure // that the dialog is closed before asking the user dialog.Close(); if (!UserWantsToShowIncomingView(guiMessage)) { return; } gluonViewSwitcher.ShowIncomingChangesView(); return; } if (waiter.Exception != null) { ExceptionsHandler.DisplayException(waiter.Exception); return; } viewHost.RefreshView(ViewType.CheckinView); viewHost.RefreshView(ViewType.HistoryView); }); }
internal static void For(WorkspaceInfo workspaceInfo, WorkspaceWindow workspaceWindow, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonSwitcher, bool isGluonMode, bool isVisible, NotificationPanelData notificationPanelData) { GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); var icon = Images.GetImage( notificationPanelData.NotificationStyle == NotificationPanelData.StyleType.Green ? Images.Name.DownloadIconGreen : Images.Name.DownloadIconRed); GUILayout.Label(icon, GUILayout.Height(16), GUILayout.Width(16)); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); GUIStyle labelStyle = new GUIStyle(EditorStyles.label); labelStyle.fontStyle = FontStyle.Bold; GUILayout.Label(notificationPanelData.InfoText, labelStyle); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); GUIStyle buttonStyle = new GUIStyle(EditorStyles.miniButtonLeft); buttonStyle.fixedWidth = 60; DoActionButton( workspaceInfo, workspaceWindow, mergeViewLauncher, gluonSwitcher, isGluonMode, notificationPanelData.HasUpdateAction, new GUIContent( notificationPanelData.ActionText, notificationPanelData.TooltipText), buttonStyle); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); }
static void ShowIncomingChangesForMode( WorkspaceInfo workspaceInfo, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonSwitcher, bool isGluonMode) { if (isGluonMode) { GluonShowIncomingChanges.FromNotificationBar( workspaceInfo, gluonSwitcher); return; } ShowIncomingChanges.FromNotificationBar( workspaceInfo, mergeViewLauncher); }
internal static void For( WorkspaceInfo workspaceInfo, WorkspaceWindow workspaceWindow, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonSwitcher, bool isGluonMode, IIncomingChangesNotificationPanel notificationPanel) { var barStyle = new GUIStyle(); var barTexture = GetBarTexture(); barTexture.SetPixel(0, 0, UnityStyles.Colors.BackgroundBar); barTexture.Apply(); barStyle.normal.background = barTexture; EditorGUILayout.BeginVertical(barStyle, GUILayout.Height(mBarHeight)); GUILayout.FlexibleSpace(); EditorGUILayout.BeginHorizontal(); if (notificationPanel.IsVisible) { DrawIncomingChangesNotificationPanel.For( workspaceInfo, workspaceWindow, mergeViewLauncher, gluonSwitcher, isGluonMode, notificationPanel.IsVisible, notificationPanel.Data); } GUILayout.FlexibleSpace(); DrawStatusBarIcon(); DrawStatusBarLabel(workspaceWindow.WorkspaceStatus); EditorGUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); }
internal void OnGUI( WorkspaceInfo wkInfo, WorkspaceWindow workspaceWindow, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonViewSwitcher, IIncomingChangesNotifier incomingChangesNotifier, bool isGluonMode) { EditorGUILayout.BeginVertical( GetBarStyle(), GUILayout.Height(UnityConstants.STATUS_BAR_HEIGHT)); GUILayout.FlexibleSpace(); EditorGUILayout.BeginHorizontal(); if (incomingChangesNotifier.HasNotification) { DrawIncomingChangesNotification( wkInfo, workspaceWindow, mergeViewLauncher, gluonViewSwitcher, incomingChangesNotifier.Notification, isGluonMode); } if (mNotification != null) { DrawNotification(mNotification); } GUILayout.FlexibleSpace(); DrawWorkspaceStatus(workspaceWindow.WorkspaceStatus); EditorGUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.EndVertical(); }
internal static void ForMode( WorkspaceInfo workspaceInfo, WorkspaceWindow workspaceWindow, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonSwitcher, bool isGluonMode, bool isVisible, NotificationPanelData notificationPanelData) { if (!isVisible) { return; } GUIContent labelContent = new GUIContent( notificationPanelData.InfoText, notificationPanelData.TooltipText); GUIContent buttonContent = new GUIContent( notificationPanelData.ActionText, notificationPanelData.TooltipText); float panelWidth = GetPanelWidth( labelContent, buttonContent, UnityStyles.Notification.Label, EditorStyles.miniButton); EditorGUILayout.BeginHorizontal( GetStyle(notificationPanelData.NotificationStyle), GUILayout.Width(panelWidth)); GUILayout.Label(labelContent, UnityStyles.Notification.Label); DoActionButton( workspaceInfo, workspaceWindow, mergeViewLauncher, gluonSwitcher, isGluonMode, notificationPanelData.HasUpdateAction, buttonContent, EditorStyles.miniButton); EditorGUILayout.EndHorizontal(); }
internal PendingChangesTab( WorkspaceInfo wkInfo, ViewHost viewHost, bool isGluonMode, WorkspaceWindow workspaceWindow, IViewSwitcher switcher, IMergeViewLauncher mergeViewLauncher, IGluonViewSwitcher gluonViewSwitcher, IHistoryViewLauncher historyViewLauncher, PlasticGui.WorkspaceWindow.PendingChanges.PendingChanges pendingChanges, NewIncomingChangesUpdater developerNewIncomingChangesUpdater, GluonNewIncomingChangesUpdater gluonNewIncomingChangesUpdater, IAssetStatusCache assetStatusCache, StatusBar statusBar, EditorWindow parentWindow) { mWkInfo = wkInfo; mViewHost = viewHost; mIsGluonMode = isGluonMode; mWorkspaceWindow = workspaceWindow; mGluonViewSwitcher = gluonViewSwitcher; mHistoryViewLauncher = historyViewLauncher; mPendingChanges = pendingChanges; mDeveloperNewIncomingChangesUpdater = developerNewIncomingChangesUpdater; mGluonNewIncomingChangesUpdater = gluonNewIncomingChangesUpdater; mAssetStatusCache = assetStatusCache; mStatusBar = statusBar; mParentWindow = parentWindow; mGuiMessage = new UnityPlasticGuiMessage(parentWindow); mMergeViewLauncher = mergeViewLauncher; mCheckedStateManager = new CheckedStateManager(); mNewChangesInWk = NewChangesInWk.Build( mWkInfo, new BuildWorkspacekIsRelevantNewChange()); BuildComponents(isGluonMode, parentWindow); mBorderColor = EditorGUIUtility.isProSkin ? (Color) new Color32(35, 35, 35, 255) : (Color) new Color32(153, 153, 153, 255); mProgressControls = new ProgressControlsForViews(); mClearCheckinSuccessAction = new CooldownWindowDelayer( ClearCheckinSuccess, UnityConstants.NOTIFICATION_CLEAR_INTERVAL); workspaceWindow.RegisterPendingChangesProgressControls(mProgressControls); mPendingChangesOperations = new PendingChangesOperations( mWkInfo, workspaceWindow, switcher, mergeViewLauncher, this, mProgressControls, workspaceWindow, null, null, null); InitIgnoreRulesAndRefreshView(mWkInfo.ClientPath, this); }