Automatically refreshing deployed Spoofax plugins
After deploying a Spoofax plugin into a new Eclipse instance there some of the live update features are broken (tested with the example Entity project):
- The live update feature of Spoofax does not seem to work. When opening the source and generated file side-by-side the project, the generated file is not automatically updated as in the development version. You have to transfer the focus the generated file editor to for Eclipse detect the change. Additionally eclipse popup an dialog asking of the content should be loaded from disk or not.
Manually enabling the following options solve the issues:
Submitted by Vlad Vergu on 18 January 2013 at 11:20General -> Workspace -> Refresh using native hooks or polling General -> Workspace -> Refresh on access
Issue Log
Having to manually enable these options is clearly not the right way to go. There are a number of ways we can solve this:
- Manual, as in self-written Spoofax code, that refreshes a projects regularly. Drawback is that we will always be late to notice changes.
- Automatically enabling these settings Workspace-wide. Code for doing this is:
ResourcesPlugin.getPlugin().getPluginPreferences().setValue(ResourcesPlugin.PREF_AUTO_REFRESH, true)
. The drawback is that this will cause Eclipse to refresh all projects that have changes, this may be very lengthy/undesirable. The behaviour of Eclipse as documented (DOC) is to invoke the builders of all the projects included in the refresh. My opinion is that we cannot take the decision to enable these auto-refreshes on behalf of the user.- Research whether we can directly access Eclipse’s code for doing the native polling/hooks. If this is somehow possible we could use Eclipse’s hooks to define pollers for separate projects and pipe the change events through Eclipse’s notification bus.
Also, there’s a chance that Refresh using native hooks or polling does not work for projects that not located inside the workspace.
I think that the second option is not that bad. You are right that change setting without the users consent is bad. But what about having a dialog popup and informing the user that this features should be activated and set it automatically when the user agrees to enable it.
Log in to post comments