Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

Plugin API tree

Paolo Roth edited this page Oct 3, 2018 · 3 revisions

A develop plugin is nothing more than a class which implements an abstract class called Plugin

Every plugin receives a PluginContext instance inside the activate and deactivate overridden methods. The PluginContext describes every single and specific domain of develop

namespace Alcadica.Develop.Plugins.Entities {
  public class PluginContext {
    public ApplicationContext application;
    public BuildSystemContext build_system;
    public CommandContext command;
    public EditorContext editor;
    public TemplateContext template;
    public ProjectContext project;
    public ScmContext scm;
  }
}

A plugin context is composed of

the class PluginContext

ApplicationContext

namespace Alcadica.Develop.Plugins.Entities {
  public class ApplicationContext {
    // this child context handles the bottom bar of the application
    public Application.BottomToolbarContext bottom_toolbar;
    // this signal will show open editors
    public signal void show_editors ();
    // this signal will show application settings
    public signal void show_settings ();
    // this signal will show project creation (from project template)
    public signal void show_templates ();
  }
}

BuildSystemContext

not available atm, will be released asap

CommandContext

A Command, in develop, is a keyboard shortcut or a command invokable by the quick command palette.

namespace Alcadica.Develop.Plugins.Entities {
  public class CommandContext : Object {
    // adds a command
    public void add (Command.Command command);
    // will dispatch programmatically a command
    public void dispatch (Command.Command command);
    // dispatches programmatically a command by it's own name
    public void dispatch_by_name (string command_name);
    // gets a Command instance or null (by command name)
    public Command.Command? get_by_name (string command_name);
    // gets a Command instance or null (by shortcut)
    public Command.Command? get_by_shortcut (string shortcut);
    // checks if a command is already set
    public bool is_set (Command.Command command);
    // checks if a shortcut is already set
    public bool is_set_shortcut (string shortcut);
    // removes a command
    public bool remove (Command.Command command);
  }
}

EditorContext

Soon®

namespace Alcadica.Develop.Plugins.Entities {
  public class EditorContext : Object {
    // The context of open editors (text editors)
    public Editor.EditorList open_editors;
    // The treeview context
    public Editor.TreeviewContext treeview;
    // this signal will spawn a new Editor, with the file opened in it
    public signal void request_open_in_new_editor (string path);
  }
}

TemplateContext

Everybody love templates. The template context actually is the core context for develop. It helps you to create project templates, with a simple dynamic ui, a token system and file system utilities.

namespace Alcadica.Develop.Plugins.Entities {
  public class TemplateContext : Object {
    // gets every subscribed Template name
    public List<string> get_subscribed_templates_names ();
    // gets a subscribed Template by name
    public Template.Template? get_template_by_name (string template_name);
    // gets if a Template is subscribed
    public bool is_subscribed (Template.Template template);
    // subscribes a Template to the API layer (aka, makes it usable insides develop)
    public void subscribe (Template.Template template);
  }
}

ProjectContext

namespace Alcadica.Develop.Plugins.Entities {
  public class ProjectContext : Object {
    // is the list of currently opened projects
    public List<Project.Project> open_projects;
    // is the list of project files parsers
    public List<Project.ProjectParser> parsers;
    // triggered when a project is closed
    public signal void project_did_close ();
    // trigger it when your project creation has finished
    public signal void project_did_created (Project.Project project);
    // triggered when a project did open
    public signal void project_did_open (Project.Project project);
    // trigger it when your project creation has started
    public signal void project_is_creating (Project.Project project);
    // 
    public string[] get_registered_parsable_project_files ();
    
    // returns a Project instance with a related name and project file
    public Project.Project create (string? project_name, string? project_file);
    // closes all opened projects
    public void close_all ();
    // closes a specific project
    public void close_project (Project.Project project);
    // checks if a project is open
    public bool is_open (Project.Project project);
    // checks if a project file is open
    public bool is_open_file (string project_file);
    // opens a project (by passing a Project instance)
    public void open_project (Project.Project project);
    // opens a project (by passing a project filepath)
    public void open_project_file (string project_file);
    // checks if a ProjectParser is subscribed
    public bool is_parser_subscribed (Project.ProjectParser parser);
    // subscribes a ProjectParser
    public bool subscribe_parser (Project.ProjectParser parser);
    // unsubscribes a ProjectParser
    public bool unsubscribe_parser (Project.ProjectParser parser);
  }
}

ScmContext

Will handle the whole SCM part, not started dev yet.

Clone this wiki locally