3
我正在開發一個eclipse插件,它將允許將java bean拖放到jsp文件上,然後在drop事件中調用一些代碼生成器。DragSourceListener從未在Eclipse中拖放文件時調用項目瀏覽器
我正在嘗試使用擴展點「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>
感謝。