Пример #1
0
 public TypeSearchForm(ITypeCache cache, Action<string, int, int> action, Action cancelAction)
 {
     InitializeComponent();
     _syncContext = AsyncOperationManager.SynchronizationContext;
     Refresh();
     _cache = cache;
     _action = action;
     _cancelAction = cancelAction;
     writeStatistics();
 }
Пример #2
0
 public FileExplorer(ITypeCache cache, string defaultLanguage, Action<string, int, int> action, Action cancelAction)
 {
     InitializeComponent();
     Refresh();
     _cache = cache;
     _defaultLanguage = defaultLanguage;
     _action = action;
     _cancelAction = cancelAction;
     _handler = new CacheSearchHandler(_cache, _defaultLanguage, treeViewFiles);
 }
Пример #3
0
 public CommandEndpoint(string editorKey, ITypeCache cache, EventEndpoint eventEndpoint)
 {
     _keyPath = editorKey;
     _cache = cache;
     _eventEndpoint = eventEndpoint;
     _server = new TcpServer();
     _server.IncomingMessage += Handle_serverIncomingMessage;
     _server.Start();
     _editor = new Editor();
     _editor.RecievedMessage += Handle_editorRecievedMessage;
     _editor.Connect(_keyPath);
 }
Пример #4
0
 public TypeSearchForm(ITypeCache cache, Action<string, int, int> action, Action cancelAction)
 {
     InitializeComponent();
     _syncContext = AsyncOperationManager.SynchronizationContext;
     Refresh();
     _cache = cache;
     _action = action;
     _cancelAction = cancelAction;
     _runSearch = true;
     writeStatistics();
     _searchThread = new System.Threading.Thread(continuousSearch);
     _searchThread.Start();
 }
Пример #5
0
 public TypeSearchForm(ITypeCache cache, Action<string, int, int> action, Action cancelAction)
 {
     InitializeComponent();
     Refresh();
     _cache = cache;
     _action = action;
     _cancelAction = cancelAction;
     writeStatistics();
     _timer = new Timer();
     _timer.Interval = 1000;
     _timer.Tick += Handle_timerTick;
     _timer.Enabled = true;
 }
Пример #6
0
 private void goToType(ITypeCache cache, Editor editor)
 {
     _ctx.Post((s) =>
         {
             if (_gotoType == null || !_gotoType.Visible)
             {
                 _gotoType = new TypeSearchForm(
                     cache,
                     (file, line, column) => { editor.GoTo(file, line, column); },
                     () => { new System.Threading.Thread(() => { System.Threading.Thread.Sleep(1000); editor.SetFocus(); }).Start(); });
                 _gotoType.Show(this);
             }
             setToForeground(_gotoType);
         }, null);
 }
Пример #7
0
 private void explore(ITypeCache cache, Editor editor)
 {
     _ctx.Post((s) =>
         {
             if (_exploreForm == null || !_exploreForm.Visible)
             {
                 _exploreForm = new FileExplorer(
                     cache,
                     _defaultLanguage,
                     (file, line, column) => { editor.GoTo(file, line, column); },
                     () => { editor.SetFocus(); });
                 _exploreForm.Show(this);
             }
             setToForeground(_exploreForm);
         }, null);
 }
Пример #8
0
        public MainViewModel(IDatabaseCommunicator communicator,
            IDbToolSettings settings,
            ITypeCache typeCache)
        {
            _dispatcher = Dispatcher.CurrentDispatcher;
            _communicator = communicator;
            _settings = settings;
            _typeCache = typeCache;

            ConnectCommand = new DelegateCommand(ToggleConnect);
            ExecuteCommand = new DelegateCommand(ExecuteStatement);

            Connection = new ConnectionViewModel(_settings);
            QueryResult = new QueryResultViewModel();
            _memoryMeter = new MemoryMeter(mem => MemoryUsage = mem.ToMemoryUsage());
            _memoryMeter.Start();
        }
Пример #9
0
 public CommandEndpoint(string editorKey, ITypeCache cache, EventEndpoint eventEndpoint)
 {
     Logger.Write("Initializing command endpoint using editor key " + editorKey);
     _keyPath = editorKey;
     _cache = cache;
     Logger.Write("Setting up event endpoint");
     _eventEndpoint = eventEndpoint;
     _eventEndpoint.DispatchThrough((m) => {
             handle(new MessageArgs(Guid.Empty, m));
         });
     _server = new TcpServer();
     _server.IncomingMessage += Handle_serverIncomingMessage;
     _server.Start();
     Logger.Write("CodeEngine started listening on port {0}", _server.Port);
     _editor = new Editor();
     Logger.Write("Binding editor RecievedMessage");
     _editor.RecievedMessage += Handle_editorRecievedMessage;
     Logger.Write("Connecting to editor");
     _editor.Connect(_keyPath);
     Logger.Write("Done - Connecting to editor");
 }
Пример #10
0
 public Registry(Registry registry, ITypeCache typeCache)
 {
     _typeCache     = typeCache;
     _registrations = new List <Registration>(registry);
 }
Пример #11
0
 private static void messageHandler(MessageArgs message, ITypeCache cache, Editor editor)
 {
     var msg = CommandMessage.New(message.Message);
     _handlers
         .Where(x => x.Handles(msg)).ToList()
         .ForEach(x => x.Handle(message.ClientID, msg));
 }
Пример #12
0
 public CacheSearchHandler(ITypeCache cache, string defaultLanguage, TreeView list)
 {
     _cache = cache;
     _defaultLanguage = defaultLanguage;
     _list = list;
 }
 public MemoryCacheTest()
 {
     _cacheManager = new DefaultMemoryCacheManager();
     _cache        = _cacheManager.GetCache("MyCacheItems").AsTyped <int, MyCacheItem>();
 }
Пример #14
0
        private static IEnumerable <string> ExtractColumnNames(this Expression expression, ITypeCache typeCache)
        {
            switch (expression.NodeType)
            {
            case ExpressionType.MemberAccess:
                return(ExtractColumnNames(expression as MemberExpression, typeCache));

            case ExpressionType.Convert:
                return(ExtractColumnNames((expression as UnaryExpression).Operand, typeCache));

            case ExpressionType.Lambda:
                return(ExtractColumnNames((expression as LambdaExpression).Body, typeCache));

            case ExpressionType.Call:
                return(ExtractColumnNames(expression as MethodCallExpression, typeCache));

            case ExpressionType.New:
                return(ExtractColumnNames(expression as NewExpression, typeCache));

            default:
                throw Utils.NotSupportedExpression(expression);
            }
        }
Пример #15
0
        private static IEnumerable <string> ExtractColumnNames(MemberExpression memberExpression, ITypeCache typeCache)
        {
            var memberName = typeCache.GetMappedName(memberExpression.Expression.Type, memberExpression.Member.Name);

            //var memberName = memberExpression.Expression.Type
            //    .GetNamedProperty(memberExpression.Member.Name)
            //    .GetMappedName();

            return(memberExpression.Expression is MemberExpression
                ? memberExpression.Expression.ExtractColumnNames(typeCache).Select(x => string.Join("/", x, memberName))
                : new[] { memberName });
        }
Пример #16
0
 public ImplementationsFinder(ITypeCache typeCache)
 {
     _typeCache = typeCache;
 }
 public DefaultActionMethodSource(Configuration configuration, ITypeCache typeCache)
 {
     _configuration = configuration;
     _typeCache     = typeCache;
 }
Пример #18
0
 public FindTypeHandler(CommandEndpoint endpoint, ITypeCache cache)
 {
     _endpoint = endpoint;
     _cache    = cache;
 }
Пример #19
0
 internal static ODataResponse EmptyFeeds(ITypeCache typeCache)
 {
     return(FromFeed(typeCache, new Dictionary <string, object>[] { }));
 }
Пример #20
0
 private ODataResponse(ITypeCache typeCache)
 {
     TypeCache = typeCache;
 }
Пример #21
0
 protected ValueConverter(ITypeCache types)
 {
     _types = types ?? throw new ArgumentNullException(nameof(types));
 }
Пример #22
0
 protected virtual ConstructorCallCache NewConstructorCallCache(ITypeCache typeCache, IConstructorDelegateFactory constructorDelegateFactory)
 {
     return(new ConstructorCallCache(typeCache, constructorDelegateFactory));
 }
Пример #23
0
 protected virtual ICodeManager NewCodeManager(ITypeCache typeCache, ITypeAssembler typeAssembler, IAssemblyContextPool assemblyContextPool)
 {
     return(new CodeManager(typeCache, typeAssembler, assemblyContextPool));
 }
Пример #24
0
 public GetCodeRefsHandler(CommandEndpoint endpoint, ITypeCache cache)
 {
     _endpoint = endpoint;
     _cache = cache;
 }
Пример #25
0
 public static T Convert <T>(this ITypeCache typeCache, object value)
 {
     return((T)typeCache.Convert(value, typeof(T)));
 }
Пример #26
0
 public MetaInfoProvider(ITypeCache typeCache)
 {
     _typeCache = typeCache;
 }
Пример #27
0
 private static IEnumerable <string> ExtractColumnNames(NewExpression newExpression, ITypeCache typeCache)
 {
     return(newExpression.Arguments.SelectMany(x => ExtractColumnNames(x, typeCache)));
 }
 internal DynamicODataEntry(IDictionary <string, object> entry, ITypeCache typeCache) : base(ToDynamicODataEntry(entry, typeCache))
 {
     TypeCache = typeCache;
 }
Пример #29
0
 public static string ExtractColumnName(this Expression expression, ITypeCache typeCache)
 {
     return(expression.ExtractColumnNames(typeCache).Single());
 }
 private static IDictionary <string, object> ToDynamicODataEntry(IDictionary <string, object> entry, ITypeCache typeCache)
 {
     return(entry == null
         ? null
         : entry.ToDictionary(
                x => x.Key,
                y => y.Value is IDictionary <string, object>
                ?new DynamicODataEntry(y.Value as IDictionary <string, object>, typeCache)
                    : y.Value is IEnumerable <object>
                    ?ToDynamicODataEntry(y.Value as IEnumerable <object>, typeCache)
                        : y.Value));
 }
Пример #31
0
        private static IEnumerable <string> ExtractColumnNames(MethodCallExpression callExpression, ITypeCache typeCache)
        {
            if (callExpression.Method.Name == "Select" && callExpression.Arguments.Count == 2)
            {
                return(ExtractColumnNames(callExpression.Arguments[0], typeCache)
                       .SelectMany(x => ExtractColumnNames(callExpression.Arguments[1], typeCache)
                                   .Select(y => string.Join("/", x, y))));
            }
            else if (callExpression.Method.Name == "OrderBy" && callExpression.Arguments.Count == 2)
            {
                if (callExpression.Arguments[0] is MethodCallExpression && ((callExpression.Arguments[0] as MethodCallExpression).Method.Name == "Select"))
                {
                    throw Utils.NotSupportedExpression(callExpression);
                }

                return(ExtractColumnNames(callExpression.Arguments[0], typeCache)
                       .SelectMany(x => ExtractColumnNames(callExpression.Arguments[1], typeCache)
                                   .OrderBy(y => string.Join("/", x, y))));
            }
            else if (callExpression.Method.Name == "OrderByDescending" && callExpression.Arguments.Count == 2)
            {
                if (callExpression.Arguments[0] is MethodCallExpression && ((callExpression.Arguments[0] as MethodCallExpression).Method.Name == "Select"))
                {
                    throw Utils.NotSupportedExpression(callExpression);
                }

                return(ExtractColumnNames(callExpression.Arguments[0], typeCache)
                       .SelectMany(x => ExtractColumnNames(callExpression.Arguments[1], typeCache)
                                   .OrderByDescending(y => string.Join("/", x, y))));
            }
            else
            {
                throw Utils.NotSupportedExpression(callExpression);
            }
        }
Пример #32
0
 public GetFilesHandler(CommandEndpoint endpoint, ITypeCache cache)
 {
     _endpoint = endpoint;
     _cache    = cache;
 }
Пример #33
0
 private void handleMessage(MessageArgs message, ITypeCache cache, Editor editor)
 {
     Logger.Write("Message trayform args: " + message.Message);
     if (message.Message == "gototype")
         goToType(cache, editor);
     if (message.Message == "explore")
         explore(cache, editor);
     if (message.Message.StartsWith("snippet-complete "))
         snippetComplete(message, editor);
     if (message.Message.StartsWith("snippet-create "))
         snippetCreate(message, editor);
     if (message.Message.StartsWith("member-lookup "))
         memberLookup(message, editor);
     if (message.Message.StartsWith("user-select \"unsupported\" "))
         userSelect(message, editor);
     if (message.Message.StartsWith("user-select-at-caret \"unsupported\" "))
         userSelect(message, editor);
     if (message.Message.StartsWith("user-input \"unsupported\" "))
         userInput(message, editor);
     if (message.Message == "shutdown")
         _terminateApplication = true;
 }
Пример #34
0
 public ReferenceMap(ITypeCache types)
 {
     _types = types ?? throw new ArgumentNullException(nameof(types));
 }
Пример #35
0
 private void goToType(ITypeCache cache, Editor editor)
 {
     Logger.Write("Preparing to open type search");
     _ctx.Post((s) =>
         {
             Logger.Write("Opening type search");
             try {
                 if (_gotoType == null || !_gotoType.Visible)
                 {
                     Logger.Write("Creating typesearch form");
                     _gotoType = new TypeSearchForm(
                         cache,
                         (file, line, column) => { editor.GoTo(file, line, column); },
                         () => { new System.Threading.Thread(() => { System.Threading.Thread.Sleep(1000); editor.SetFocus(); }).Start(); });
                     _gotoType.Show(this);
                 }
                 setToForeground(_gotoType);
             } catch (Exception ex) {
                 Logger.Write(ex);
             }
         }, null);
 }
Пример #36
0
 private void handleMessage(MessageArgs message, ITypeCache cache, Editor editor)
 {
     if (message.Message == "gototype")
         goToType(cache, editor);
     if (message.Message == "explore")
         explore(cache, editor);
     if (message.Message.StartsWith("snippet-complete "))
         snippetComplete(message, editor);
     if (message.Message.StartsWith("snippet-create "))
         snippetCreate(message, editor);
     if (message.Message.StartsWith("member-lookup "))
         memberLookup(message, editor);
 }
 private static IEnumerable <object> ToDynamicODataEntry(IEnumerable <object> entry, ITypeCache typeCache)
 {
     return(entry == null
         ? null
         : entry.Select(x => x is IDictionary <string, object>
                        ?new DynamicODataEntry(x as IDictionary <string, object>, typeCache)
                            : x).ToList());
 }
Пример #38
0
 public Registry(ITypeCache typeCache)
 {
     _typeCache     = typeCache;
     _registrations = new List <Registration>();
 }
        /// <inheritdoc />
        public virtual Func <ISession, IODataAdapter> CreateAdapterLoader(string metadataString, ITypeCache typeCache)
        {
            var modelAdapter = CreateModelAdapter(metadataString, typeCache);

            var loadAdapter = GetAdapterLoader(modelAdapter, typeCache);

            if (loadAdapter == null)
            {
                throw new NotSupportedException($"OData protocol {modelAdapter.ProtocolVersion} is not supported");
            }

            return(loadAdapter);
        }
Пример #40
0
 public FrameworkToJsiiConverter(ITypeCache types) : base(types)
 {
 }
Пример #41
0
 public GetProjectsHandler(CommandEndpoint endpoint, ITypeCache cache)
 {
     _endpoint = endpoint;
     _cache = cache;
 }
Пример #42
0
 public MetaInfoProvider(ITypeCache typeCache)
 {
     _typeCache = typeCache;
 }
Пример #43
0
 public FindTypeHandler(CommandEndpoint endpoint, ITypeCache cache)
 {
     _endpoint = endpoint;
     _cache = cache;
 }
Пример #44
0
 public GetSignatureRefsHandler(CommandEndpoint endpoint, ITypeCache cache)
 {
     _endpoint = endpoint;
     _cache    = cache;
 }
        /// <inheritdoc />
        public virtual async Task <IODataModelAdapter> CreateModelAdapterAsync(HttpResponseMessage response, ITypeCache typeCache)
        {
            var protocolVersions = (await GetSupportedProtocolVersionsAsync(response).ConfigureAwait(false)).ToArray();

            foreach (var protocolVersion in protocolVersions)
            {
                var loadModelAdapter = GetModelAdapterLoader(protocolVersion, response, typeCache);
                if (loadModelAdapter != null)
                {
                    return(loadModelAdapter());
                }
            }
            throw new NotSupportedException($"OData protocols {string.Join(",", protocolVersions)} are not supported");
        }
Пример #46
0
        public static IEnumerable <string> ExtractColumnNames <T>(this Expression <Func <T, object> > expression, ITypeCache typeCache)
        {
            var lambdaExpression = expression as LambdaExpression;

            if (lambdaExpression == null)
            {
                throw Utils.NotSupportedExpression(expression);
            }

            switch (lambdaExpression.Body.NodeType)
            {
            case ExpressionType.MemberAccess:
            case ExpressionType.Convert:
                return(ExtractColumnNames(lambdaExpression.Body, typeCache));

            case ExpressionType.Call:
                return(ExtractColumnNames(lambdaExpression.Body as MethodCallExpression, typeCache));

            case ExpressionType.New:
                return(ExtractColumnNames(lambdaExpression.Body as NewExpression, typeCache));

            default:
                throw Utils.NotSupportedExpression(lambdaExpression.Body);
            }
        }
Пример #47
0
            public override Func <ISession, IODataAdapter> CreateAdapterLoader(string metadataString, ITypeCache typeCache)
            {
                var modelAdapter = CreateModelAdapter(metadataString, typeCache);

                return(session => new CustomAdapter(session, modelAdapter));
            }
 public override Func <ISession, IODataAdapter> CreateAdapterLoader(string metadataString, ITypeCache typeCache)
 {
     return((session) => new DefaultODataAdapter(session, new ODataModelAdapter(ODataProtocolVersion.V4, metadataString)));
 }