开发者

How to enable save action in Eclipse toolbar?

开发者 https://www.devze.com 2023-02-04 00:58 出处:网络
I am working under Eclipse plug-in development. I have implemented two view parts to view and change some objects. Each view part implements ISaveablePart to save modified objects and enable save butt

I am working under Eclipse plug-in development. I have implemented two view parts to view and change some objects. Each view part implements ISaveablePart to save modified objects and enable save button on toolbar.

The problem is: when I select my objects in Project Explorer, Save button isn't enabled, only Save All is enabled.

So I'd like to know is there any ability to enable Save butto开发者_如何学Cn in this case?


You must first implement ISaveablePart, as you have mentioned above.

You have to fire an event (see IWorkbenchPartConstants.PROP_DIRTY), which will in turn ask your editor whether it's dirty (ISaveablePart#isDirty()). If the answer is true, then the save button will be enabled.

See FormEditor#editorDirtyStateChanged() for an example.

0

精彩评论

暂无评论...
验证码 换一张
取 消