我正在研究
eclipse插件,它允许将
java bean拖到jsp文件上,然后在drop事件中调用一些代码生成器.
我正在尝试使用扩展点“org.eclipse.ui.dropActions”但拖放监听器永远不会被调用.是否有任何方法可以将监听器拖放到IFile对象.
我是否与DropActionDelegate在正确的轨道上?
码:
DragListener
class DragListener implements DragSourceListener {
@Override
public void dragFinished(DragSourceEvent event) {
System.out.println("Finish");
}
@Override
public void dragSetData(DragSourceEvent event) {
PluginTransferData p;
p = new PluginTransferData (
"dream_action", // must be id of registered drop action
"some_data".getBytes() // may be of arbitrary type
);
event.data = p;
}
@Override
public void dragStart(DragSourceEvent event) {
// TODO Auto-generated method stub
System.out.println("Start");
}
}
DropActionDelegate
class DropActionDelegate implements IDropActionDelegate {
@Override
public boolean run(Object source, Object target) {
String Data= (String) target;
return true;
}
}
plugin.xml中
<extension point="org.eclipse.ui.dropActions">
<action
id="dream_action"
class="newdreamfileplugin.wizards.DropActionDelegate">
</action>
</extension>
谢谢.
最佳答案 解决了它.最后我使用org.eclipse.ui.navigator.navigatorContent扩展创建了我自己的导航器,它具有属性dropAssistant.