内容如下:
1. 使用自动生成的编辑器(默认是XML的Editor)
2. 添加功能:
2.1 使用全局快捷键(如:ctrl+space 或 alt+/,任意一种即可)弹出悬浮框(hover)
2.2 悬浮框中显示三种内容:
a. 编辑器中所有内容
b. 当前行所有内容
c. 光标以及之前第一个空格中的所有字符
希望有高人可以指点如何实现该功能!
或者提供详尽的editor开发实例网页也可——我刚接触eclipse插件开发,抽象的看不懂 :oops:
建议看看Eclipse.Plug-ins这本书第八章的内容,也许对你有帮助
http://www.cs.unc.edu/Courses/jbs/lessons/eclipse/hello-popup-plugin/index.html
http://www.vogella.de/articles/EclipsePlugIn/article.html
直接为全局添加快捷键就可以 TextEditor可以识别出来的
你可以参看http://www.blogjava.net/chengang/archive/2006/04/28/43873.html添加快捷键
2.1 使用全局快捷键(如:ctrl+space 或 alt+/,任意一种即可)弹出悬浮框(hover)
在plugin.xml中添加如下代码
[code="xml"]
point="org.eclipse.ui.commands">
point="org.eclipse.ui.handlers">
point="org.eclipse.ui.bindings">
[/code]
然后,新建test1.handlers包,和MyHandler类。MyHandler源码如下
[code="java"]
package test1.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.PopupDialog;
import test1.dialog.InfoPopup;
public class MyHandler extends AbstractHandler {
public MyHandler() {
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
String headerString = "Information for you";
String footerString = "This is a special case of info popup dialog box which is similar to Eclipse InfoPopup.";
PopupDialog pd = new PopupDialog(window.getShell(),PopupDialog.HOVER_SHELLSTYLE, false, false, true, false, headerString,footerString);
pd.open();
return null;
}
}
[/code]
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/editors_hover.htm