Define save action in plugin [message #1713645] |
Thu, 05 November 2015 11:51  |
Eclipse User |
|
|
|
I've inherited a somewhat complex codebase for an Eclipse plugin for editing files for a particular configuration language.
While editing files of that type, the plugin immediately reports syntactical or semantic errors very well.
However, I noticed that there are situations where when a file is saved, it needs to run a save action to check for syntax/semantics. I can figure out how to make it run those checks, but I'm not sure how to configure save actions within the plugin.
I know how to configure save actions in the user interface, but this has to be defined within the plugin itself. I noticed some info about "cleanup actions" in the JDT, but these files aren't Java.
How would I do this, and are there some good examples of this I can see?
|
|
|
|
Re: Define save action in plugin [message #1713705 is a reply to message #1713658] |
Fri, 06 November 2015 02:06  |
Eclipse User |
|
|
|
David,
Validation is more normally (properly?) designed as a builder.
On 05/11/2015 7:53 PM, David M. Karr wrote:
> Would it be reasonable to do something like this (from Eclipse help
> pages)?:
> IResourceChangeListener listener = new MyResourceChangeReporter();
> ResourcesPlugin.getWorkspace().addResourceChangeListener(
> listener, IResourceChangeEvent.POST_CHANGE);
> However, I note that it says on the same page that the workspace is
> locked during the processing of this event. I don't believe that
> running the parser as a result of this event will write to any
> workspace files, but I'll have to make sure about that. The other
> minor annoyance is that I'll have to run the parser on all the files
> in every project being managed by this plugin, as I'll have no way to
> tell if any particular resource change would have an impact on my
> language files, or even be related at all.
|
|
|
Powered by
FUDForum. Page generated in 0.03665 seconds