下面的调用实现了我正在执行的ViewPart拖放
public class DiagramWindow extends ViewPart implements ISaveablePart2 {
private boolean isDirty;
private boolean saveNeeded;
public void setDirty(boolean isDirty, boolean saveNeeded) {
this.isDirty = isDirty;
this.saveNeeded = saveNeeded;
firePropertyChange(PROP_DIRTY);
}
}
对于菜单项,我在扩展ActionBarAdvisor的类中注册它:
saveFileAction = ActionFactory.SAVE.create(window);
register(saveFileAction);
我打电话的代码部分
@Override
public void drop(DropTargetEvent event) {
//DiagramWindow view
view.setDirty(true, true);
}
答案 0 :(得分:0)
greg-449是对的。 isDirty
方法中的内容是什么?您应该在类DiagramWindow
中覆盖isDirty方法。据我所知,默认情况下它是假的。我想你所要做的就是 -
public boolean isDirty()
{
return this.isDirty;
}