GEF-whole-upload 实验随笔一:搭建编辑器
2011-12-16 04:21
218 查看
看了dengues,突发奇想,如果能用gef-whole-upload的例子,也开发一个类似的studio,那对于学习和工作,帮助应该都很大
那么,从跟着gef-whole-upload开始,算是实验课吧,就记录在这里吧
首先,建立一个plugin工程,设置为rcp模式
1.new->plugin project
2.选择hello rcp
3.出来了一个包,里面存放着Activator.java(控制插件的生命周期),Application.java(控制程序执行的各个方面),ApplicationActionBar.java(应用程序的按钮等),ApplicationWorkbenchWindowAdvisor.java(显示程序启动的方式及初始状态等),ApplicationWorkbenchAdvisor(这个不知道是用来做什么的),perspective.java(程序的属性)
4.在extensions中加入org.eclipse.ui.editors插件,用来新建一个编辑器,并设置id作为该编辑器的标示符,设置一个class:editor.class,放在xxx.ui包中
5.在Application中实现IPlatformRunable接口及IApplication接口,在start方法中加入
Application中的start方法
并且在run方法中加入
ApplicationActionBarAdvisor中加入按钮
8.设置编辑器的输入类:新建类:EditorInput
在Perspective.java中设置可见
11.设置gef命令堆栈的存放位置
editor中的构造方法加入
这样一个编辑器基本搭建好了
那么,从跟着gef-whole-upload开始,算是实验课吧,就记录在这里吧
首先,建立一个plugin工程,设置为rcp模式
1.new->plugin project
2.选择hello rcp
3.出来了一个包,里面存放着Activator.java(控制插件的生命周期),Application.java(控制程序执行的各个方面),ApplicationActionBar.java(应用程序的按钮等),ApplicationWorkbenchWindowAdvisor.java(显示程序启动的方式及初始状态等),ApplicationWorkbenchAdvisor(这个不知道是用来做什么的),perspective.java(程序的属性)
4.在extensions中加入org.eclipse.ui.editors插件,用来新建一个编辑器,并设置id作为该编辑器的标示符,设置一个class:editor.class,放在xxx.ui包中
5.在Application中实现IPlatformRunable接口及IApplication接口,在start方法中加入
Application中的start方法
public Object start(IApplicationContext context) throws Exception { Display display = PlatformUI.createDisplay(); try { int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) return IApplication.EXIT_RESTART; else return IApplication.EXIT_OK; } finally { display.dispose(); } }
并且在run方法中加入
ApplicationActionBarAdvisor中加入按钮
protected void makeActions(IWorkbenchWindow window) { exitAction = ActionFactory.QUIT.create(window); register(exitAction); aboutAction = ActionFactory.ABOUT.create(window); register(aboutAction); editorAction = new EditorAction(window); register(editorAction); } protected void fillMenuBar(IMenuManager menuBar) { MenuManager fileMenu = new MenuManager("&New", "New"); fileMenu.add(editorAction); fileMenu.add(new Separator()); fileMenu.add(exitAction); MenuManager helpMenu = new MenuManager("&Help","help"); helpMenu.add(aboutAction); menuBar.add(fileMenu); menuBar.add(helpMenu); }
8.设置编辑器的输入类:新建类:EditorInput
在Perspective.java中设置可见
public void createInitialLayout(IPageLayout layout) { layout.setEditorAreaVisible(true); }
11.设置gef命令堆栈的存放位置
editor中的构造方法加入
setEditDomain(new DefaultEditDomain(this));
这样一个编辑器基本搭建好了
相关文章推荐
- GEF-whole-upload教程中遇到的问题及解决方案
- GEF-whole-upload教程中遇到的问题及解决方案
- GEF-whole-upload教程中遇到的问题及解决方案
- GEF插件开发(一,空白编辑器搭建)
- GEF插件开发(一,空白编辑器搭建)
- 搭建一个大型网站架构的实验环境(Squid缓存服务器篇)第1/2页
- 搭建GNS3模拟实验环境
- 基于Windows Server 2008 系统的DNS服务器搭建与FTP服务器实现-《网络协议分析》实验
- VirtualBox 虚拟机下搭建SDN实验平台(安装mininet网络仿真器 + OpenDayLight控制器)
- 如何在VMware Workstation搭建vCAC 6.2实验环境 - 第一部分
- tiny6410裸机实验第0章--------------开发环境的搭建(交叉编译工具链制作)
- 用 KVM 搭建web集群实验笔记 - memcached
- 搭建Web服务(课堂随笔)
- Win32ASM备忘之搭建UltraEdit实验环境
- Maven随笔之一:Maven环境搭建与第一个maven项目
- 高可用集群实验一:lvs的NAT模式、DR模式搭建及性能对比
- 图层控制界面实现记录-类框架搭建和初步实验
- 随身Wifi+win7 搭建http代理 域名劫持 抓包 内容篡改实验环境
- 从0搭建RAC实验环境(一)