// TODO: do this after calling plastic workspace internal static void Enable() { if (sPlasticAPI == null) { sPlasticAPI = new PlasticAPI(); } WorkspaceInfo wkInfo = FindWorkspace.InfoForApplicationPath( Application.dataPath, sPlasticAPI); if (wkInfo == null) { return; } sOperations = new AssetMenuRoutingOperations(); sAssetStatusCache = new AssetStatusCache( wkInfo, sPlasticAPI.IsGluonWorkspace(wkInfo), RepaintProjectWindow); sAssetSelection = new InspectorAssetSelection(); AddMenuItems(); }
// TODO: do this after calling plastic workspace internal static void Enable() { if (sPlasticAPI == null) { sPlasticAPI = new PlasticAPI(); } WorkspaceInfo wkInfo = FindWorkspace.InfoForApplicationPath( Application.dataPath, sPlasticAPI); if (wkInfo == null) { return; } sOperations = new AssetMenuRoutingOperations(); sAssetStatusCache = new AssetStatusCache( wkInfo, sPlasticAPI.IsGluonWorkspace(wkInfo), RepaintProjectWindow); sAssetSelection = new InspectorAssetSelection(UpdateFilterMenuItems); sFilterMenuBuilder = new AssetFilesFilterPatternsMenuBuilder( sOperations, IGNORE_MENU_ITEMS_PRIORITY, HIDDEN_MENU_ITEMS_PRIORITY); AddMenuItems(); }
void UpdateProgress() { if (mProgress == 0) { return; } mProgressBar.style.display = DisplayStyle.Flex; if (mProgress == 1) { mProgressBar.value = 20f; mProgressBar.title = mProgressBar.value.ToString() + "%"; mTurnedOffLabel.text = PlasticLocalization.GetString( PlasticLocalization.Name.TurnOffPlasticSCMClosingWindow); mPlasticWindow = Resources.FindObjectsOfTypeAll <PlasticWindow>().First(); mPlasticWindow.Close(); mProgress = 2; return; } if (mProgress == 2) { mProgressBar.value = 50f; mProgressBar.title = mProgressBar.value.ToString() + "%"; mTurnedOffLabel.text = PlasticLocalization.GetString( PlasticLocalization.Name.TurnOffPlasticSCMCleaning); SetupCloudProjectId.SetCloudProjectId(""); mProgress = 3; return; } if (mProgress == 3) { mProgressBar.value = 75f; mProgressBar.title = mProgressBar.value.ToString() + "%"; mTurnedOffLabel.text = PlasticLocalization.GetString( PlasticLocalization.Name.TurnOffPlasticSCMDeleting); WorkspaceInfo workspaceInfo = FindWorkspace.InfoForApplicationPath( Application.dataPath, PlasticApp.PlasticAPI); Plastic.API.RemoveWorkspace(workspaceInfo); DrawInspectorOperations.Disable(); DrawSceneOperations.Disable(); mProgress = 4; return; } if (mProgress == 4) { mProgressBar.value = 100f; mProgressBar.title = mProgressBar.value.ToString() + "%"; mTurnedOffLabel.text = PlasticLocalization.GetString( PlasticLocalization.Name.Done); mProgress = 9999; return; } }
static void Checkin() { WorkspaceInfo wkInfo = FindWorkspace.InfoForApplicationPath( Application.dataPath, PlasticApp.PlasticAPI); if (wkInfo != null) { TrackFeatureUseEvent.For( PlasticGui.Plastic.API.GetRepositorySpec(wkInfo), TrackFeatureUseEvent.Features.ContextMenuCheckinOption); } ((IAssetMenuOperations)sOperations).Checkin(); }
static void MergeToMain() { try { WorkspaceInfo mWkInfo = FindWorkspace.InfoForApplicationPath(Application.dataPath, Plastic.API); if (mWkInfo == null) { return; } RepositorySpec repSpec = Plastic.API.GetRepositorySpec(mWkInfo); RepositoryInfo repInfo = Plastic.API.GetRepositoryInfo(repSpec); BranchInfo workingBranchInfo = Plastic.API.GetWorkingBranch(mWkInfo); BranchInfo mainBranchInfo = Plastic.API.GetMainBranch(repSpec); if (workingBranchInfo.BranchId == mainBranchInfo.BranchId) { return; } SpecGenerator specGenerator = new SpecGenerator(repInfo); BranchSpec sourceSpec = specGenerator.GenBranchSpec(false, workingBranchInfo.BranchName); BranchSpec destinationSpec = specGenerator.GenBranchSpec(false, mainBranchInfo.BranchName); MergeSource mergeSource = MergeSourceBuilder.BuildMergeSource(repInfo, null, sourceSpec, destinationSpec, new MergeParameters()); BuildMerge.ApplyMergeForMerge(mWkInfo, null).MergeTo(mergeSource, mMergeComments); } finally { string plasticIniFilePah = Path.Combine(Application.dataPath, "../plastic.ini"); File.Delete(plasticIniFilePah); } }
static void Editor_finishedDefaultHeaderGUI(UnityEditor.Editor inspector) { if (!sIsEnabled) { return; } WorkspaceInfo wkInfo = FindWorkspace.InfoForApplicationPath( Application.dataPath, PlasticApp.PlasticAPI); if (wkInfo == null) { Disable(); return; } sAssetSelection.SetActiveInspector(inspector); AssetList assetList = ((AssetOperations.IAssetSelection) sAssetSelection).GetSelectedAssets(); if (assetList.Count == 0 || string.IsNullOrEmpty(assetList[0].path)) { return; } string selectionFullPath = Path.GetFullPath(assetList[0].path); AssetsOverlays.AssetStatus assetStatus = (assetList.Count > 1) ? AssetsOverlays.AssetStatus.None : PlasticPlugin.AssetStatusCache.GetStatusForPath(selectionFullPath); LockStatusData lockStatusData = PlasticPlugin.AssetStatusCache.GetLockStatusDataForPath( selectionFullPath); SelectedAssetGroupInfo selectedGroupInfo = SelectedAssetGroupInfo. BuildFromAssetList(assetList, PlasticPlugin.AssetStatusCache); AssetMenuOperations assetOperations = AssetMenuUpdater.GetAvailableMenuOperations(selectedGroupInfo); bool guiEnabledBck = GUI.enabled; GUI.enabled = true; try { DrawBackRectangle(guiEnabledBck); GUILayout.BeginHorizontal(); DrawStatusLabel(assetStatus, lockStatusData); GUILayout.FlexibleSpace(); DrawButtons(assetList, assetOperations); GUILayout.EndHorizontal(); } finally { GUI.enabled = guiEnabledBck; } }