コード例 #1
0
        // Adds about 500ms to startup time
        static AssetMenuItems()
        {
            PlasticApp.InitializeIfNeeded();
            sPlasticAPI = new PlasticAPI();

            Enable();
        }
コード例 #2
0
ファイル: AssetMenuItems.cs プロジェクト: BaseDorp/TankGame
        // 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();
        }
コード例 #3
0
        // 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();
        }
コード例 #4
0
        static AssetMenuItems()
        {
            sPlasticAPI = new PlasticAPI();

            BackgroundWorker backgroundWorker = new BackgroundWorker();

            backgroundWorker.DoWork             += new DoWorkEventHandler(BackgroundWorker_DoWork);
            backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundWorker_CompletedWork);
            backgroundWorker.RunWorkerAsync();
        }
コード例 #5
0
ファイル: PlasticApp.cs プロジェクト: fipu-nastava/dipri
        internal static void InitializeIfNeeded()
        {
            if (sIsInitialized)
            {
                return;
            }

            sIsInitialized = true;

            PlasticAPI        = new PlasticAPI();
            PlasticWebRestApi = new PlasticWebRestApi();

            ConfigureLogging();

            GuiMessage.Initialize(new UnityPlasticGuiMessage());

            RegisterExceptionHandlers();

            InitLocalization();

            ThreadWaiter.Initialize(new UnityThreadWaiterBuilder());
            ServicePointConfigurator.ConfigureServicePoint();
            CertificateUi.RegisterHandler(new ChannelCertificateUiImpl());

            SetupFsWatcher();

            EditionManager.Get().DisableCapability(
                EnumEditionCapabilities.Extensions);

            ClientHandlers.Register();

            PlasticGuiConfig.SetConfigFile(
                PlasticGuiConfig.UNITY_GUI_CONFIG_FILE);

            sEventSenderScheduler = EventTracking.Configure(
                PlasticApp.PlasticWebRestApi,
                AssetsPath.IsRunningAsUPMPackage() ?
                ApplicationIdentifier.UnityPackage :
                ApplicationIdentifier.UnityAssetStorePlugin,
                IdentifyEventPlatform.Get());

            if (sEventSenderScheduler != null)
            {
                sPingEventLoop = new PingEventLoop();
                sPingEventLoop.Start();
                sPingEventLoop.SetUnityVersion(Application.unityVersion);

                CollabPlugin.GetVersion(pluginVersion => sPingEventLoop.SetPluginVersion(pluginVersion));
            }

            PlasticMethodExceptionHandling.InitializeAskCredentialsUi(
                new CredentialsUiImpl());
            ClientEncryptionServiceProvider.SetEncryptionPasswordProvider(
                new MissingEncryptionPasswordPromptHandler());
        }
コード例 #6
0
        void Initialize(PlasticAPI plasticApi, IPlasticWebRestApi plasticWebRestApi)
        {
            ((IProgressControls)mProgressControls).ShowProgress(string.Empty);

            WorkspaceInfo[] allWorkspaces   = null;
            IList           allRepositories = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(10);

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                mDefaultServer = GetDefaultServer.ToCreateWorkspace(plasticWebRestApi);

                allWorkspaces = plasticApi.GetAllWorkspacesArray();

                allRepositories = plasticApi.GetAllRepositories(
                    mDefaultServer,
                    true);
            },
                /*afterOperationDelegate*/ delegate
            {
                ((IProgressControls)mProgressControls).HideProgress();

                if (waiter.Exception != null)
                {
                    DisplayException(mProgressControls, waiter.Exception);
                    return;
                }

                string serverSpecPart = string.Format("@{0}", mDefaultServer);

                mCreateWorkspaceState.RepositoryName = ValidRepositoryName.Get(
                    string.Format("{0}{1}",
                                  mCreateWorkspaceState.RepositoryName,
                                  serverSpecPart),
                    allRepositories);

                mCreateWorkspaceState.WorkspaceName =
                    mCreateWorkspaceState.RepositoryName.Replace(
                        serverSpecPart,
                        string.Empty);

                mDialogUserAssistant = new CreateWorkspaceDialogUserAssistant(
                    mWorkspacePath,
                    allWorkspaces);

                OnRepositoryChanged(
                    mDialogUserAssistant,
                    mCreateWorkspaceState,
                    mWorkspacePath);
            });
        }
コード例 #7
0
        internal CreateWorkspaceView(
            EditorWindow parentWindow,
            ICreateWorkspaceListener listener,
            PlasticAPI plasticApi)
        {
            mParentWindow            = parentWindow;
            mCreateWorkspaceListener = listener;
            mProgressControls        = new ProgressControlsForViews();
            mWorkspaceOperations     = new WorkspaceOperations(this, mProgressControls);
            mCreateWorkspaceState    = CreateWorkspaceViewState.BuildForProjectDefaults();

            Initialize(plasticApi);
        }
コード例 #8
0
        void OnEnable()
        {
            processor.AssetModificationProcessor.ForceCheckout = EditorPrefs.GetBool("forceCheckoutPlasticSCM");
            wantsMouseMove = true;

            if (mException != null)
            {
                return;
            }

            minSize = new Vector2(
                UnityConstants.PLASTIC_WINDOW_MIN_SIZE_WIDTH,
                UnityConstants.PLASTIC_WINDOW_MIN_SIZE_HEIGHT);

            SetupWindowTitle();

            GuiMessage.Initialize(new UnityPlasticGuiMessage(this));

            PlasticApp.InitializeIfNeeded();

            RegisterApplicationFocusHandlers(this);

            PlasticMethodExceptionHandling.InitializeAskCredentialsUi(
                new CredentialsUiImpl(this));
            ClientEncryptionServiceProvider.SetEncryptionPasswordProvider(
                new MissingEncryptionPasswordPromptHandler(this));

            if (mPlasticAPI == null)
            {
                mPlasticAPI = new PlasticAPI();
            }
            mPlasticWebRestApi = new PlasticWebRestApi();

            mEventSenderScheduler = EventTracking.Configure(
                mPlasticWebRestApi,
                AssetsPath.IsRunningAsUPMPackage() ?
                ApplicationIdentifier.UnityPackage : ApplicationIdentifier.UnityAssetStorePlugin,
                IdentifyEventPlatform.Get());

            if (mEventSenderScheduler != null)
            {
                mPingEventLoop = new PingEventLoop();
                mPingEventLoop.Start();
                mPingEventLoop.SetUnityVersion(Application.unityVersion);

                CollabPlugin.GetVersion(pluginVersion => mPingEventLoop.SetPluginVersion(pluginVersion));
            }

            InitializePlastic();
        }
コード例 #9
0
        internal WelcomeView(
            EditorWindow parentWindow,
            CreateWorkspaceView.ICreateWorkspaceListener createWorkspaceListener,
            PlasticAPI plasticApi)
        {
            mParentWindow            = parentWindow;
            mCreateWorkspaceListener = createWorkspaceListener;
            mPlasticApi = plasticApi;

            mGuiMessage        = new UnityPlasticGuiMessage(parentWindow);
            mDownloadProgress  = new ProgressControlsForViews();
            mConfigureProgress = new ProgressControlsForViews();

            mInstallerFile = GetInstallerTmpFileName.ForPlatform();
        }
コード例 #10
0
        void OnEnable()
        {
            if (mException != null)
            {
                return;
            }

            GuiMessage.Initialize(new UnityPlasticGuiMessage(this));

            ConfigureLogging();

            RegisterExceptionHandlers();
            RegisterApplicationFocusHandlers(this);

            InitLocalization();

            ThreadWaiter.Initialize(new UnityThreadWaiterBuilder());
            ServicePointConfigurator.ConfigureServicePoint();
            CertificateUi.RegisterHandler(new ChannelCertificateUiImpl());
            CredentialsUIRegistrar.RegisterCredentialsUI(
                new CredentialsUiImpl(this));
            ClientEncryptionServiceProvider.SetEncryptionPasswordProvider(
                new MissingEncryptionPasswordPromptHandler(this));
            DisableFsWatcherIfNeeded();
            EditionManager.Get().DisableCapability(
                EnumEditionCapabilities.Extensions);

            mPlasticAPI = new PlasticAPI();
            ClientHandlers.Register();

            PlasticGuiConfig.SetConfigFile(PLASTIC_GUI_CONFIG_FILE);

            mPingEventLoop      = new PingEventLoop();
            mEventSenderRestApi = new SimpleEventSenderRestApi(
                PlasticWebApiUris.GetBaseUri());
            mEventSenderScheduler = EventTracking.Configure(
                mEventSenderRestApi,
                ApplicationIdentifier.UnityPackage,
                IdentifyEventPlatform.Get());

            if (mEventSenderScheduler != null)
            {
                mPingEventLoop.Start();
            }

            InitializePlastic();
        }
コード例 #11
0
 internal PlasticFileSystem(
     WorkspaceContent content,
     string cachePath,
     PlasticAPI plasticApi,
     FileHandles handles,
     WorkspaceLocalFiles tempStorage,
     VirtualFiles virtualFiles)
 {
     mWorkspaceContent      = content;
     mChangesTreeOperations = new ChangesTreeOperations(content);
     mLocalFilesPath        = cachePath;
     mFileCache             = new FileCache(mLocalFilesPath);
     mPlasticApi            = plasticApi;
     mHandles      = handles;
     mLocalFiles   = tempStorage;
     mVirtualFiles = virtualFiles;
 }
コード例 #12
0
        internal WelcomeView(
            PlasticWindow parentWindow,
            CreateWorkspaceView.ICreateWorkspaceListener createWorkspaceListener,
            PlasticAPI plasticApi,
            CmConnection cmConnection,
            IPlasticWebRestApi plasticWebRestApi)
        {
            mParentWindow            = parentWindow;
            mCreateWorkspaceListener = createWorkspaceListener;
            mPlasticApi        = plasticApi;
            mCmConnection      = cmConnection;
            mPlasticWebRestApi = plasticWebRestApi;

            mGuiMessage        = new UnityPlasticGuiMessage(parentWindow);
            mConfigureProgress = new ProgressControlsForViews();

            mInstallerFile = GetInstallerTmpFileName.ForPlatform();
        }
コード例 #13
0
        internal CreateWorkspaceView(
            PlasticWindow parentWindow,
            ICreateWorkspaceListener listener,
            PlasticAPI plasticApi,
            IPlasticWebRestApi plasticWebRestApi,
            string workspacePath)
        {
            mParentWindow            = parentWindow;
            mCreateWorkspaceListener = listener;
            mWorkspacePath           = workspacePath;
            mPlasticWebRestApi       = plasticWebRestApi;

            mProgressControls     = new ProgressControlsForViews();
            mWorkspaceOperations  = new WorkspaceOperations(this, mProgressControls);
            mCreateWorkspaceState = CreateWorkspaceViewState.BuildForProjectDefaults();

            Initialize(plasticApi, plasticWebRestApi);
        }
コード例 #14
0
        void OnEnable()
        {
            wantsMouseMove = true;

            if (mException != null)
            {
                return;
            }

            SetupWindowTitle(false);

            GuiMessage.Initialize(new UnityPlasticGuiMessage(this));

            PlasticApp.InitializeIfNeeded();

            RegisterApplicationFocusHandlers(this);

            PlasticMethodExceptionHandling.InitializeAskCredentialsUi(
                new CredentialsUiImpl(this));
            ClientEncryptionServiceProvider.SetEncryptionPasswordProvider(
                new MissingEncryptionPasswordPromptHandler(this));

            mPlasticAPI        = new PlasticAPI();
            mPlasticWebRestApi = new PlasticWebRestApi();

            mEventSenderScheduler = EventTracking.Configure(
                mPlasticWebRestApi,
                ApplicationIdentifier.UnityPackage,
                IdentifyEventPlatform.Get());

            if (mEventSenderScheduler != null)
            {
                mPingEventLoop = new PingEventLoop();
                mPingEventLoop.Start();
                mPingEventLoop.SetUnityVersion(Application.unityVersion);
            }

            InitializePlastic();
        }
コード例 #15
0
        internal string GetFile(RepositoryInfo repInfo, RevisionInfo revInfo, PlasticAPI api)
        {
            string hash = HashToHex(revInfo.Hash);

            string subdir = Path.Combine(mBasePath, string.Concat(hash[0], hash[1]));

            if (!Directory.Exists(subdir))
            {
                Directory.CreateDirectory(subdir);
            }

            string file = Path.Combine(subdir, hash);

            if (File.Exists(file))
            {
                return(file);
            }

            api.GetFile(repInfo, revInfo, file);

            return(file);
        }
コード例 #16
0
        void OnEnable()
        {
            wantsMouseMove = true;

            if (mException != null)
            {
                return;
            }

            GuiMessage.Initialize(new UnityPlasticGuiMessage(this));

            PlasticApp.Initialize();

            RegisterApplicationFocusHandlers(this);

            CredentialsUIRegistrar.RegisterCredentialsUI(
                new CredentialsUiImpl(this));
            ClientEncryptionServiceProvider.SetEncryptionPasswordProvider(
                new MissingEncryptionPasswordPromptHandler(this));

            mPlasticAPI = new PlasticAPI();

            mPingEventLoop      = new PingEventLoop();
            mEventSenderRestApi = new SimpleEventSenderRestApi(
                PlasticWebApiUris.GetBaseUri());
            mEventSenderScheduler = EventTracking.Configure(
                mEventSenderRestApi,
                ApplicationIdentifier.UnityPackage,
                IdentifyEventPlatform.Get());

            if (mEventSenderScheduler != null)
            {
                mPingEventLoop.Start();
            }

            InitializePlastic();

            EditorApplication.update += AutoCommitOperation.AutoCommit;
        }
コード例 #17
0
            static internal int Create(
                string filename,
                FileAccess access,
                FileShare share,
                FileMode mode,
                FileOptions options,
                Node tree,
                FileCache fileCache,
                FileHandles fileHandles,
                PlasticAPI api,
                WorkspaceLocalFiles localFiles,
                Dynamic.HistoryDirectory historyDir,
                out bool bIsDirectory,
                out int error)
            {
                error        = 0;
                bIsDirectory = false;

                int handle = Dynamic.SpecNode.CreateFile(
                    filename, access, share, mode, options,
                    tree, fileCache, fileHandles, api);

                if (handle != -1)
                {
                    return(handle);
                }

                if (historyDir.CreateNewDir(
                        filename, access, tree, api))
                {
                    bIsDirectory = true;
                    return(-1);
                }

                return(LocalFile.CreateNew(
                           filename, access, share, mode, options, tree, localFiles, out error));
            }
コード例 #18
0
 static void BackgroundWorker_CompletedWork(object sender, RunWorkerCompletedEventArgs e)
 {
     sPlasticAPI = new PlasticAPI();
     Enable();
 }