Example #1
0
        static void ExecuteBootstrapSolutionMethod(
            Func <ExecutionEnvironment> environment,
            IFile descriptorPath,
            IPackageRepository packageRepository)
        {
            ResharperLogger.Debug("ExecuteBootstrapSolutionMethod: executing.");

            _instance.GetType().GetMethod("BootstrapSolution").Invoke(_instance, new object[] { environment, packageRepository });
        }
Example #2
0
        static void TryCreateIntegrationService()
        {
            try
            {
                if (_instance != null)
                {
                    ResharperLogger.Debug("TryCreateIntegrationService: _instance already set.");
                    return;
                }
                var unimportantType = Type.GetType("JetBrains.Application.Shell, JetBrains.Platform.ReSharper.Shell");
                if (unimportantType == null && _tries < 50)
                {
                    ResharperLogger.Debug("TryCreateIntegrationService: resharperType not loaded, try {0}.", _tries.ToString());

                    _tries++;
                    _timer = new Timer(x => TryCreateIntegrationService(), null, WAIT_RETRY_MS, Timeout.Infinite);
                }
                if (unimportantType == null)
                {
                    return;
                }

                var installedVersion        = unimportantType.Assembly.GetName().Version;
                var resharperIntegratorType = (from supportedResharperVersion in _integrationTypes.Keys
                                               orderby supportedResharperVersion descending
                                               where installedVersion >= supportedResharperVersion
                                               select _integrationTypes[supportedResharperVersion]).FirstOrDefault();

                if (resharperIntegratorType == null)
                {
                    return;
                }

                _instance = Activator.CreateInstance(resharperIntegratorType);
                ResharperLogger.Debug("TryCreateIntegrationService: instance loaded: '{0}'.", _instance.GetType().AssemblyQualifiedName);
                if (_queuedRegistration != null)
                {
                    ExecuteBootstrapSolutionMethod
                    (
                        _queuedRegistration.Environment,
                        _queuedRegistration.DescriptorPath,
                        _queuedRegistration.PackageRepository
                    );
                }
            }
            finally
            {
                _called = true;
            }
        }
Example #3
0
        public override bool Execute()
        {
            ResharperLogger.Debug("Initialize called on " + ProjectFilePath);
            EnsureWrapRepositoryIsInitialized();

            if (!EnableVisualStudioIntegration)
            {
                return(true);
            }
            ResharperHook.TryRegisterResharper(Environment, WrapDescriptorPath, PackageRepository);
            SolutionAddIn.Initialize();
            if (_commands == null)
            {
                lock (this)
                    if (_commands == null)
                    {
                        var repository = new CommandRepository(ReadCommands(Services.ServiceLocator.GetService <IEnvironment>()));
                        _commands = new UICommands(repository);
                        _commands.Initialize();
                    }
            }
            return(true);
        }
Example #4
0
        static void Queue(Func <ExecutionEnvironment> environment, IFile descriptorPath, IPackageRepository packageRepository)
        {
            ResharperLogger.Debug("Queue: queued registration");

            _queuedRegistration = new NotificationRegistration(environment, descriptorPath, packageRepository);
        }