按钮与编辑器没有直接关系。
你必须,因为
described there)
-
将commandId设置为标准命令id的情况下添加菜单贡献,可以在中找到
IWorkbenchActionDefinitionIds
例如
org.eclipse.ui.file.save
-
在中创建命令
ApplicationActionBarAdvisor.makeActions
然后注册。
:
protected void makeActions(final IWorkbenchWindow window) {
// Creates the actions and registers them.
// Registering is needed to ensure that key bindings work.
// The corresponding commands keybindings are defined in the plugin.xml
// file.
// Registering also provides automatic disposal of the actions when
// the window is closed.
saveAction = ActionFactory.SAVE.create(window);
register(saveAction);
}
-
Editor
分解与实施
isDirty()
setDirty()
和
clean()
方法。
2013年2月更新,自
user s-d
:
saveAction
在
ActionBarContributor
加上
menuContribution
,添加
getCommandStack().markSaveLocation()
给编辑的
doSave()
方法和重写
commandStackChanged()
public void commandStackChanged(EventObject event) {
firePropertyChange(PROP_DIRTY);
super.commandStackChanged(event);
}