我正在开发 eclipse 插件,它允许将 java bean 拖到 jsp 文件上,然后在 drop 事件中调用一些代码生成器。
我正在尝试使用扩展点“org.eclipse.ui.dropActions”,但拖放侦听器永远不会被调用。有没有办法将拖放侦听器附加到 IFile 对象。
我在 DropActionDelegate 的正确轨道上吗?
代码:
拖动监听器
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;
}
}
插件.xml
<extension point="org.eclipse.ui.dropActions">
<action
id="dream_action"
class="newdreamfileplugin.wizards.DropActionDelegate">
</action>
</extension>
谢谢。