Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-core-dev] Autorefresh Example

Enclosed is a zip of two plugins, com.example.autorefresh and
com.example.autorefresh.ui.  To install them, unzip the plugins and copy
them into your plugins directory.  They provide a utility that
automatically searches the filesystem for changes and updates the workspace
model accordingly.  This means no more "refresh local" when ant scribbles
all over your project.

The plugin can run in four different configurations:
Auto Search, Auto Refresh:
      Once activated (by clicking the search button) the plugin searches
the workspace periodically for changes.  All changes found are refreshed in
the background.

Manual Search, Auto Refresh:
      Every time the user clicks the search button the plugin searches the
workspace.  All changes found are refreshed in the background.

Auto Search, Manual Refresh:
      Once activated (by clicking the search button) the plugin searches
the workspace periodically for changes.  The refresh button becomes active
when resources need to be refreshed.  When the user clicks the refresh
button, the resources are refreshed in the background.

Manual Search, Manual Refresh:
      Every time the user clicks the search button the plugin searches the
workspace.  The refresh button becomes active when the search finds
resources that need to be refreshed.  When the user clicks the refresh
button, the resources are refreshed in the background.

The search button is always active.  The user may request a search at any
time by clicking the button.

NOTE: While the resources are refreshed in the background, the workspace is
blocked from running any IWorkspaceRunnables.  This means that you can edit
files, but once you save, build, etc. the workspace will wait until the
refresh completes.

Once you have run the plugin once, you can edit the preferences in the
prop.ini file located in the com.example.autorefresh metadata location.
The preferences default to the following values:

search.delay=60000
auto.search=true
auto.refresh=true

Changing the search.delay value changes the amount of time between
automatic searches.  I would recommend no less than 10000 (milliseconds).

Developers who are interested in providing their own scanning facilities
can register an IScanner with the AutoRefreshPlugin.  When a scanner is
registered, it is registered with a path.  The path helps the
AutoRefreshPlugin pick which scanner should scan a given resource for
changes.  The scanner that is registered with the most specific path that
matches the start of the resource location is chosen to search inside the
resource.  For more details see IScanner, ISearchCollector and
AutoRefreshPlugin.

Developers may also wish to run searches on resources they know their tools
have changed.  This can be done by creating a search on resources and
posting it to the AutoRefreshPlugin.  For more details see ISearch and
AutoRefreshPlugin.

Note: This code is experimental.  If any of this becomes real API it will
have to move out of the com.example namespace.  All APIs are subject to
flux.

Feedback is welcome.  :)

jkca

(See attached file: com.example.autorefresh.zip)

Attachment: com.example.autorefresh.zip
Description: Zip archive


Back to the top