Ejemplo n.º 1
0
        public AnnotationsLoader(SimpleExtensionManager extensionManager)
        {
            this.extensionManager = extensionManager;

            var location = FileSystemPath.CreateByCanonicalPath(Assembly.GetExecutingAssembly().Location)
                           .Directory.Combine("ExternalAnnotations");

            myAnnotations = new OneToSetMap <string, FileSystemPath>(StringComparer.OrdinalIgnoreCase);

            // Cache the annotation filenames to save scanning the directory multiple times.
            // Safe to cache as the user shouldn't be changing files in the install dir. If
            // they want to add extra annotations, use an extension.
            // The rules are simple: either the file is named after the assembly, or the folder
            // is (or both, but that doesn't matter)
            foreach (var file in location.GetChildFiles("*.xml"))
            {
                myAnnotations.Add(file.NameWithoutExtension, file);
            }
            foreach (var directory in location.GetChildDirectories())
            {
                foreach (var file in directory.GetChildFiles("*.xml", PathSearchFlags.RecurseIntoSubdirectories))
                {
                    myAnnotations.Add(file.NameWithoutExtension, file);
                    myAnnotations.Add(file.Directory.Name, file);
                }
            }
        }
Ejemplo n.º 2
0
        public void Execute(IDataContext context, DelegateExecute nextExecute)
        {
            var store    = Shell.Instance.GetComponent <ISettingsStore>();
            var ctx      = store.BindToContextTransient(ContextRange.ApplicationWide);
            var settings = ctx.GetKey <ZenSharpSettings>(SettingsOptimization.DoMeSlowly);

            var solution = context.GetData(ProjectModelDataConstants.SOLUTION).NotNull("solution != null");
            var fsp      = FileSystemPath.CreateByCanonicalPath(ZenSharpSettings.GetTreePath(settings.TreeFilename));

            EditorManager.GetInstance(solution).OpenFileAsync(fsp, OpenFileOptions.DefaultActivate);
        }
Ejemplo n.º 3
0
        public void Execute(IDataContext context, DelegateExecute nextExecute)
        {
            var store    = Shell.Instance.GetComponent <ISettingsStore>();
            var ctx      = store.BindToContextTransient(ContextRange.ApplicationWide);
            var settings = ctx.GetKey <ZenSharpSettings>(SettingsOptimization.DoMeSlowly);

            var solution = context.GetData(DataConstants.SOLUTION);

            EditorManager.GetInstance(solution)
            .OpenFile(
                FileSystemPath.CreateByCanonicalPath(ZenSharpSettings.GetTreePath(settings.TreeFilename)),
                true,
                TabOptions.Default);
        }
        public void Initialise(string extensionId)
        {
            Plugin plugin = pluginsDirectory.Plugins.FirstOrDefault(p => p.ID == extensionId);

            if (plugin == null)
            {
                plugin = (from p in pluginsDirectory.Plugins
                          from a in p.AssemblyPaths
                          where a == FileSystemPath.CreateByCanonicalPath(GetType().Assembly.Location)
                          select p).FirstOrDefault();
            }

            if (plugin != null)
            {
                extensions.Add(lifetime, new ExtensionFromPlugin(lifetime, plugin, this, extensionLocations));
            }
        }