internal static void EnableForWorkspace() { if (sIsEnabledForWorkspace) { return; } WorkspaceInfo wkInfo = FindWorkspace.InfoForApplicationPath( Application.dataPath, PlasticApp.PlasticAPI); if (wkInfo == null) { return; } sIsEnabledForWorkspace = true; PlasticApp.SetWorkspace(wkInfo); AssetStatusCache = new AssetStatusCache( wkInfo, PlasticApp.PlasticAPI.IsGluonWorkspace(wkInfo)); AssetMenuItems.Enable(); AssetsProcessors.Enable(); DrawAssetOverlay.Enable(); DrawInspectorOperations.Enable(); }
void IWorkspacesRefreshableView.RefreshAndSelect(WorkspaceInfo wkInfo) { PerformInitialCheckin.IfRepositoryIsEmpty( wkInfo, mWkCreationData.Repository, mWkCreationData.IsGluonWorkspace, PlasticGui.Plastic.API, mProgressControls, mCreateWorkspaceListener, mParentWindow); AssetMenuItems.Enable(); }
internal void DownloadRepositoryToPathIfNeeded( string cloudRepository, string cloudOrganization, string projectPath, string unityAccessToken) { AssetDatabase.DisallowAutoRefresh(); try { BuildProgressSpeedAndRemainingTime.ProgressData progressData = new BuildProgressSpeedAndRemainingTime.ProgressData(DateTime.Now); ThreadPool.QueueUserWorkItem( DownloadRepository, new DownloadRepositoryParameters() { CloudOrganization = cloudOrganization, CloudRepository = cloudRepository, ProjectPath = projectPath, AccessToken = unityAccessToken }); while (!mOperationFinished) { if (mDisplayProgress) { DisplayProgress( mUpdateNotifier.GetUpdateStatus(), progressData, cloudRepository); } Thread.Sleep(150); } } finally { EditorUtility.ClearProgressBar(); AssetDatabase.AllowAutoRefresh(); RefreshAsset.UnityAssetDatabase(); if (!mOperationFailed) { AssetMenuItems.Enable(); ShowWindow.PlasticAfterDownloadingProject(); } } }
void InitializePlastic() { if (mForceToOpen) { mForceToOpen = false; return; } try { if (UnityConfigurationChecker.NeedsConfiguration()) { return; } mWkInfo = FindWorkspace.InfoForApplicationPath( Application.dataPath, mPlasticAPI); if (mWkInfo == null) { AssetMenuItems.Disable(); return; } // SetupCloudProjectId.ForWorkspace(mWkInfo, mPlasticAPI); DisableVCSIfEnabled(mWkInfo.ClientPath); mIsGluonMode = mPlasticAPI.IsGluonWorkspace(mWkInfo); IAssetStatusCache assetStatusCache = new AssetStatusCache( mWkInfo, mIsGluonMode, RepaintProjectWindow); AssetsProcessors.Enable( mPlasticAPI, assetStatusCache); mPingEventLoop.SetWorkspace(mWkInfo); mEventSenderRestApi.SetToken(BuildToken.FromServerProfile( ClientConfig.Get().GetDefaultProfile())); InitializeNewIncomingChanges(mWkInfo, mIsGluonMode); ViewHost viewHost = new ViewHost(); PlasticGui.WorkspaceWindow.PendingChanges.PendingChanges pendingChanges = new PlasticGui.WorkspaceWindow.PendingChanges.PendingChanges(mWkInfo); mViewSwitcher = new ViewSwitcher( mWkInfo, viewHost, mIsGluonMode, pendingChanges, mDeveloperNewIncomingChangesUpdater, mGluonNewIncomingChangesUpdater, mIncomingChangesNotificationPanel, assetStatusCache, this); mPlasticClient = new PlasticGUIClient( mWkInfo, mViewSwitcher, mViewSwitcher, viewHost, pendingChanges, mDeveloperNewIncomingChangesUpdater, mGluonNewIncomingChangesUpdater, this, new UnityPlasticGuiMessage(this)); mViewSwitcher.SetPlasticGUIClient(mPlasticClient); mViewSwitcher.ShowInitialView(); UnityStyles.Initialize(Repaint); AssetOperations.IAssetSelection inspectorAssetSelection = new InspectorAssetSelection(); AssetOperations.IAssetSelection projectViewAssetSelection = new ProjectViewAssetSelection(); AssetOperations inspectorAssetOperations = new AssetOperations( mWkInfo, mPlasticClient, mViewSwitcher, mViewSwitcher, viewHost, mDeveloperNewIncomingChangesUpdater, assetStatusCache, mViewSwitcher, mViewSwitcher, this, inspectorAssetSelection, mIsGluonMode); AssetOperations projectViewAssetOperations = new AssetOperations( mWkInfo, mPlasticClient, mViewSwitcher, mViewSwitcher, viewHost, mDeveloperNewIncomingChangesUpdater, assetStatusCache, mViewSwitcher, mViewSwitcher, this, projectViewAssetSelection, mIsGluonMode); AssetMenuItems.Enable( projectViewAssetOperations, assetStatusCache, projectViewAssetSelection); DrawInspectorOperations.Enable( inspectorAssetOperations, assetStatusCache, inspectorAssetSelection); DrawAssetOverlay.Initialize( assetStatusCache, RepaintProjectWindow); AutoCommitOperation.SetPlasticGUIClient(mPlasticClient); mLastUpdateTime = EditorApplication.timeSinceStartup; } catch (Exception ex) { mException = ex; ExceptionsHandler.HandleException("InitializePlastic", ex); } }
void InitializePlastic() { if (mForceToOpen) { mForceToOpen = false; return; } try { if (UnityConfigurationChecker.NeedsConfiguration()) { return; } mWkInfo = FindWorkspace.InfoForApplicationPath( Application.dataPath, mPlasticAPI); if (mWkInfo == null) { AssetMenuItems.Disable(); return; } MonoFileSystemWatcher.IsEnabled = true; SetupCloudProjectIdIfNeeded(mWkInfo, mPlasticAPI); DisableVCSIfEnabled(mWkInfo.ClientPath); mIsGluonMode = mPlasticAPI.IsGluonWorkspace(mWkInfo); IAssetStatusCache assetStatusCache = new AssetStatusCache( mWkInfo, mIsGluonMode, RepaintProjectWindow); AssetsProcessors.Enable( mPlasticAPI, assetStatusCache); if (mEventSenderScheduler != null) { mPingEventLoop.SetWorkspace(mWkInfo); ((IPlasticWebRestApi)mPlasticWebRestApi).SetToken( CmConnection.Get().BuildWebApiTokenForCloudEditionDefaultUser()); } InitializeNewIncomingChanges(mWkInfo, mIsGluonMode); ViewHost viewHost = new ViewHost(); PlasticGui.WorkspaceWindow.PendingChanges.PendingChanges pendingChanges = new PlasticGui.WorkspaceWindow.PendingChanges.PendingChanges(mWkInfo); mViewSwitcher = new ViewSwitcher( mWkInfo, viewHost, mIsGluonMode, pendingChanges, mDeveloperNewIncomingChangesUpdater, mGluonNewIncomingChangesUpdater, mIncomingChangesNotificationPanel, assetStatusCache, this); mCooldownAutoRefreshPendingChangesAction = new CooldownWindowDelayer( mViewSwitcher.AutoRefreshPendingChangesView, UnityConstants.AUTO_REFRESH_PENDING_CHANGES_DELAYED_INTERVAL); mPlasticClient = new PlasticGUIClient( mWkInfo, mViewSwitcher, mViewSwitcher, viewHost, pendingChanges, mDeveloperNewIncomingChangesUpdater, mGluonNewIncomingChangesUpdater, this, new UnityPlasticGuiMessage(this)); mViewSwitcher.SetPlasticGUIClient(mPlasticClient); mViewSwitcher.ShowInitialView(); UnityStyles.Initialize(Repaint); AssetOperations.IAssetSelection inspectorAssetSelection = new InspectorAssetSelection(); AssetOperations.IAssetSelection projectViewAssetSelection = new ProjectViewAssetSelection(); AssetOperations inspectorAssetOperations = new AssetOperations( mWkInfo, mPlasticClient, mViewSwitcher, mViewSwitcher, viewHost, mDeveloperNewIncomingChangesUpdater, assetStatusCache, mViewSwitcher, mViewSwitcher, this, inspectorAssetSelection, mIsGluonMode); AssetOperations projectViewAssetOperations = new AssetOperations( mWkInfo, mPlasticClient, mViewSwitcher, mViewSwitcher, viewHost, mDeveloperNewIncomingChangesUpdater, assetStatusCache, mViewSwitcher, mViewSwitcher, this, projectViewAssetSelection, mIsGluonMode); AssetMenuItems.Enable( projectViewAssetOperations, assetStatusCache, projectViewAssetSelection); DrawInspectorOperations.Enable( inspectorAssetOperations, assetStatusCache, inspectorAssetSelection); DrawAssetOverlay.Initialize( assetStatusCache, RepaintProjectWindow); mLastUpdateTime = EditorApplication.timeSinceStartup; } catch (Exception ex) { mException = ex; ExceptionsHandler.HandleException("InitializePlastic", ex); } }