SharpDevelop插件开发手册部分内容摘取自:http://www.cnblogs.com/CBuilder的SharpDevelop开发教程
SharpDevelop插件开发手册
第一章 Pad
Pad(面板)就是插件框架中的停靠窗口。有这些特点:Pad不能关闭,但可以隐藏或显示。每种类型的Pad只能打开一个,不能在运行时添加,标题唯一。可以显示图标,由插件框架中的布局管理器负责管理。通常不显示文件内容,而是辅助用户完成任务。
下面进入我们的实战流程,先新建一个类库型的项目,命名为CSPadDemoPlug,把Class1.cs改名为Main.cs,修改为如下内容:

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

记得要在项目中加入插件框架中的ICSharpCode.Core.dll和SharpDevelop.Base.dll引用。这两个文件在插件框架下的Bin目录下。写插件框架的插件需要包含。
在项目中添加新建项à用户控件。改名为CSPadControl。各位可以在CSPadControl上添加一些相关的内容。
在工程中添加一个DemoPlug.addin文件,这是插件配置文件,很重要,内容如下:

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

OK!把编译后的PadDemo.dll和DemoPlug.addin文件拷贝到的/AddIns/目录下,运行插件框架就可以看到我们创建的Pad了(如下图),同时在插件框架的菜单【查看】-【工具】下也出现了TestPanel菜单项。
如果需要指定pad的图标时,可以改更改base("TestPanel")为 base("TestPanel", "IconID")。
InconID为图标的资源号,作为演示你可以用Class的图标“Icons.16x16.Class”来替代。
要点分析:
制作Pad的时候要从AbstractPadContent继承。所以要using ICSharpCode.SharpDevelop.Gui;
第二章 工作区
第一节 创建工区作
View(工作区)是SD的基础部分,View通常包含编辑器,如代码编辑器,资源编辑器。基本上,它是显示于MPI窗口选项卡页面上的面板。
制作View要从AbstractViewContent继承下来。下面就进入我们的实战操作流程,首先新建一个类库行的项目,SDViewDemoPlug,把Class1.cs改名为Main.cs,修改为如下内容:

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

添加一个新类,SDViewContent,文件名为SDViewContent.cs,修改内容如下:

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

在项目中添加新建项用户控件。改名为SDViewControl。各位可以在SDViewControl上添加一些相关的内容。最后添加插件配置文件ViewDemoPlug.addin,内容如下:

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

还有不要忘记把ICSharpCode.Core.dll和SharpDevelop.Base.dll引用进项目中来。编译后把ViewDemoPlug.addin和SDViewDemoPlug.dll拷贝到SD的/AddIns/目录下。运行SD,就可以看到在【工具】菜单下出现了【ShowMyView】菜单项。Click【ShowMyView】菜单项后显示如图,再click【ShowMyView】菜单项后就会又显示一个TestView。各位如果问:“需要做象“启动页”一样的View,如果已经有打开的了就会激活打开的View该如何处理呢?”。其实很简单,你可以把ShowViewCommand类中的Run函数更改为:

2

3

4

5

6

7

8

9

10

此Demo演示了如何在SD添加一个View,同时也演示了如何在SD中更改菜单项。每添加一个菜单项时都要继承一个AbstractMenuCommand,并且改写Run()函数,当然你的XXXCommand也可以从SD的AbstractCommand继承,但要实现IMenuCommand接口。因为添加菜单项和添加工具条按钮比较简单,在以后的内容中我会一起讲,在此我就不多说了。
第二节 工作区关闭控制
插件框架的工作区(AbstractViewContent)和主窗体(WorkbenchSingleton.MainForm)在是否关闭可能通过窗体的Closing事件来进行控制,和普通窗体关闭事件没有太大区别。
MainForm和常用的窗体没有什么区别,这里就不做特殊说明。
由于工作区本身不是一窗体,所以它没有Closing事件,但是它本身是有父窗体(AbstractViewContent.WorkbenchWindow)的,我们完全可以通过它父窗体的Closing事件来进行控制,示例如下:

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

第三章 配置文件
一、菜单配置

2

3

4

5

6

7

8

1)id:代表唯一标识
2)label:是菜单的标题,它即可以从资源文件中读取,也可以直接进行设置,如果要设置热键,格式如下:(&字母)
3)icon:表示,菜单的图标,该图标在resource格式的文件中定义
4)shortcut:设置快捷键
5)link:这里就是当前菜单项要链接的网址,也可以链接外部文件,示例如下:link = "home://doc/ReadMe.rtf",表示主程序上级的doc目录下的ReadMe.rtf文件。
6)class:表示该菜单对应的命令。
7)insertafter:表示插在哪个菜单项之后
如果要建立子菜单只需要添加MenuItem子节点即可,格式如下:

2

3

4

5

二、MenuItem类型
MenuItem共有四种类型
1) type = "Menu" 普通父菜单
2) type = "Separator" 分隔符
3) type = "Item" 菜单项
4) type = "Builder" 由代码购建的菜单,如文件历史列表
三、状态控制
插件框架中生成的工具栏按钮和菜单项都可以通过配置文件来进行控制。
示例如下:

2

3

4

5

6

7

8

9

10

11

12

13

14

配置的关键字为:Condition ,它含两个属性(name 和action),name 的名称对应 runtime中定义的ConditionEvaluator的name,它和程序中从IConditionEvaluator接口继承的状态控制类形成对应关系

2

3

4

5

6

7

8

IConditionEvaluator接口非常简单,只有一个IsValid方法。
配置文件中的条件在“IsValid”返回false时执行,执行结果由来action决定。
action共有3种状态:

2

3

4

5

6

Nothing:表示什么都不做
Execlude:表示一笔移除
Disable:表示改变状态为不可用
默认为:Execlude
SharpDevelop插件开发手册的更多相关文章
-
Discuz! X 插件开发手册
文件命名规范 Discuz! 按照如下的规范对程序和模板进行命名,请在设计插件时尽量遵循此命名规范: 可以直接通过浏览器访问的普通程序文件,以 .php 后缀命名. 被普通程序文件引用的程序文件, ...
-
【miscellaneous】 GStreamer应用开发手册学习笔记之基础概念介绍
第3章. 基础概念介绍 本章将介绍GStreamer的基本概念. 理解这些概念对于你后续的学习非常重要,因为后续深入的讲解我们都假定你已经完全理解了这些概念. 3.1. 元件(Elements) 元件 ...
-
Dynamics CRM 开发模板使用手册(插件开发)
CRM开发手册 本手册介绍在Visual Studio 2015 + Dynamics CRM Developer Extensions模板开发环境下,插件和JS脚本的开发.部署与调试过程. 手册中提 ...
-
Sonar Java 规则插件开发 (基于阿里开发手册)
引言 最近在做Sonar静态代码扫描管理,以此顺手接了Sonar的插件开发,基于阿里开发手册进行开发,在整体开发过程中,其中还是遇到不少坑位,也以此给大家做相应借鉴官网Demo演示插件开发地址:htt ...
-
sublime text 插件开发
前言:术语和参考资料 sublime text 2的扩展模式相当的丰富.有多种方法可以修改语法高亮模式以及所有的菜单等.它还可以创建一个新的build系统,自动补全,语言定义,代码片段,宏定义,快捷键 ...
-
sublime插件开发手记
原:http://blog.hickwu.com/sublime插件开发手记 标题: sublime插件开发手记 时间: 2014-01-05 14:58:02 正文: 插件基本结构 基本插件实现 ...
-
MyBean 框架入门手册<;感谢[青铜]整理的如此细致和系统>;
MyBean 框架入门手册 2014/9/15 by lighttop 目 录 MyBean 框架学习笔记............................................... ...
-
MyBatis实现与插件开发
分析源码之前也需要源码下载并安装到本地仓库和开发工具中,方便给代码添加注释:安装过程和mybatis源码的安装过程是一样的,这里就不再重复描述了:下载地址:https://github.com/myb ...
-
方案设计:基于IDEA插件开发和字节码插桩技术,实现研发交付质量自动分析
作者:小傅哥 博客:https://bugstack.cn 沉淀.分享.成长,让自己和他人都能有所收获! 一.前言 如何保证代码质量? 业务提需求,产品定方案,研发做实现,测试验流程.四种角色的相互配 ...
随机推荐
-
linux文件及文件夹权限
以前上学的时候简单了解了下linux,现在对它的认识也只停留在一些小白命令上.以为我只要不是做服务器端开发的应该不会去碰吧,工作了才知道做开发的多少还是要熟悉一些linux的,至少你的项目会部署在li ...
-
8VC Venture Cup 2016 - Elimination Round
在家补补题 模拟 A - Robot Sequence #include <bits/stdc++.h> char str[202]; void move(int &x, in ...
-
CSS3属性transition
CSS3 Transitions 指定过渡 语法: transition: property duration timing-function delay; 参数一: transition-p ...
-
iOS开发之身份证号码校验
// // Card.h // THCStore // // Created by Mac on 15/7/15. // Copyright (c) 2015年 Mac. All rights ...
-
使用jsonpath解析json内容
JsonPath提供的json解析非常强大,它提供了类似正则表达式的语法,基本上可以满足所有你想要获得的json内容.下面我把官网介绍的每个表达式用代码实现,可以更直观的知道该怎么用它. 一.首先需要 ...
-
『转载』C# winform 中dataGridView的重绘(进度条,虚线,单元格合并等)
原文转载自:http://hi.baidu.com/suming/item/81e45b1ab9b4585f2a3e2243 最近比较浅的研究了一下dataGridView的重绘,发现里面还是有很多东 ...
-
js判空
2014年9月3日 11:36:10 转载的: http://blog.sina.com.cn/s/blog_755168af0100vsik.html typeof用法 typeof的运算数未定义, ...
-
教程-Delphi MSComm 实时串口通讯
Delphi MSComm 实时串口通讯 MSComm控件具有丰富的与串口通信密切相关的属性,提供了对串口进行的多种操作,进而使串行通信变得十分简便.MSComm的控件属性较多,常用的属性如下:1) ...
-
将使用netTcp绑定的WCF服务寄宿到IIS7上全记录 (这文章也不错)
原文地址:http://www.cnblogs.com/wengyuli/archive/2010/11/22/wcf-tcp-host-to-iis.html 摘要 在项目开发中,我们可能会适时的选 ...
-
报文分析2、IP头的结构
IP头的结构 版本(4位) 头长度(4位) 服务类型(8位) 封包总长度(16位) 封包标识(16位) 标志(3位) 片断偏移地址(13位) 存活时间(8位) 协议(8位) 校验和(16位) 来源IP ...