public TypeSearchForm(ITypeCache cache, Action<string, int, int> action, Action cancelAction) { InitializeComponent(); _syncContext = AsyncOperationManager.SynchronizationContext; Refresh(); _cache = cache; _action = action; _cancelAction = cancelAction; writeStatistics(); }
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); }
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); }
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(); }
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; }
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); }
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); }
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(); }
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"); }
public Registry(Registry registry, ITypeCache typeCache) { _typeCache = typeCache; _registrations = new List <Registration>(registry); }
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)); }
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>(); }
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); } }
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 }); }
public ImplementationsFinder(ITypeCache typeCache) { _typeCache = typeCache; }
public DefaultActionMethodSource(Configuration configuration, ITypeCache typeCache) { _configuration = configuration; _typeCache = typeCache; }
public FindTypeHandler(CommandEndpoint endpoint, ITypeCache cache) { _endpoint = endpoint; _cache = cache; }
internal static ODataResponse EmptyFeeds(ITypeCache typeCache) { return(FromFeed(typeCache, new Dictionary <string, object>[] { })); }
private ODataResponse(ITypeCache typeCache) { TypeCache = typeCache; }
protected ValueConverter(ITypeCache types) { _types = types ?? throw new ArgumentNullException(nameof(types)); }
protected virtual ConstructorCallCache NewConstructorCallCache(ITypeCache typeCache, IConstructorDelegateFactory constructorDelegateFactory) { return(new ConstructorCallCache(typeCache, constructorDelegateFactory)); }
protected virtual ICodeManager NewCodeManager(ITypeCache typeCache, ITypeAssembler typeAssembler, IAssemblyContextPool assemblyContextPool) { return(new CodeManager(typeCache, typeAssembler, assemblyContextPool)); }
public GetCodeRefsHandler(CommandEndpoint endpoint, ITypeCache cache) { _endpoint = endpoint; _cache = cache; }
public static T Convert <T>(this ITypeCache typeCache, object value) { return((T)typeCache.Convert(value, typeof(T))); }
public MetaInfoProvider(ITypeCache typeCache) { _typeCache = typeCache; }
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; }
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)); }
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); } }
public GetFilesHandler(CommandEndpoint endpoint, ITypeCache cache) { _endpoint = endpoint; _cache = cache; }
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; }
public ReferenceMap(ITypeCache types) { _types = types ?? throw new ArgumentNullException(nameof(types)); }
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); }
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()); }
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); }
public FrameworkToJsiiConverter(ITypeCache types) : base(types) { }
public GetProjectsHandler(CommandEndpoint endpoint, ITypeCache cache) { _endpoint = endpoint; _cache = cache; }
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"); }
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); } }
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))); }