internal static void IfWorkspaceConfigChanged( IPlasticAPI plasticApi, WorkspaceInfo lastWkInfo, bool lastIsGluonMode, Action reloadAction) { string applicationPath = Application.dataPath; bool isGluonMode = false; WorkspaceInfo wkInfo = null; IThreadWaiter waiter = ThreadWaiter.GetWaiter(10); waiter.Execute( /*threadOperationDelegate*/ delegate { wkInfo = FindWorkspace. InfoForApplicationPath(applicationPath, plasticApi); if (wkInfo != null) { isGluonMode = plasticApi.IsGluonWorkspace(wkInfo); } }, /*afterOperationDelegate*/ delegate { if (waiter.Exception != null) { return; } if (!IsWorkspaceConfigChanged( lastWkInfo, wkInfo, lastIsGluonMode, isGluonMode)) { return; } reloadAction(); }); }
void InitializePlastic() { if (mForceToOpen) { mForceToOpen = false; return; } try { if (UnityConfigurationChecker.NeedsConfiguration()) { return; } mWkInfo = FindWorkspace.InfoForApplicationPath( Application.dataPath, mPlasticAPI); if (mWkInfo == null) { return; } AssetsProcessors.Enable(mPlasticAPI); mIsGluonMode = mPlasticAPI.IsGluonWorkspace(mWkInfo); 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, this); mPlasticClient = new PlasticGUIClient( mWkInfo, mViewSwitcher, mViewSwitcher, viewHost, pendingChanges, mDeveloperNewIncomingChangesUpdater, mGluonNewIncomingChangesUpdater, this, new UnityPlasticGuiMessage(this)); mViewSwitcher.SetPlasticGUIClient(mPlasticClient); mViewSwitcher.ShowInitialView(); mLastUpdateTime = EditorApplication.timeSinceStartup; } catch (Exception ex) { mException = ex; ExceptionsHandler.HandleException("InitializePlastic", ex); } }