[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[imp-dev] Changes to UniversalEditor, IParseController
|
Hi All,
In the ongoing effort to simplify the initialization of the
UniversalEditor and
clean it up a bit, I've refactored createPartControl() and friends some
more.
To wit, createPartControl() now basically has a cleaner 3-phase sequence:
1) instantiateLanguageServices() - instantiates all of the existing
language-
specific service implementations.
2) super.createPartControl() - instantiates and initializes the
ISourceViewer
3) instantiateServiceControllers() - instantiates all of the
language-independent
"service controllers" (which mediate between the language-specific
service
implementations and the rest of the IMP/Eclipse framework)
At some point, phase 1 will likely be replaced by a lazy instantiation
mechanism per Eclipse strategy wrt plugin/service instantiation. In fact, I
plan to encapsulate the management (instantiation) of the set of language
service implementations as well as the management of the service controllers
into separate classes fairly soon. Perhaps we'll incorporate lazy
instantiation
at that point.
While I was "in the neighborhood," I also reorganized the initialization
of the
ParserScheduler, which used to unnecessarily call
IParseController.initialize()
every time the parser was run on a new source string. Now it more sensibly
initializes the IParseController once, when the ParserScheduler itself is
constructed. As a result, ParserScheduler.run() is considerably smaller and
does what you'd expect: run the parser and pass the model (AST) to all
the registered listeners.
Also, IParseController now has a getLanguage() method, whose purpose
is to allow clients to more easily obtain another service implementation for
the same language for which they already have an IParseController.
Previously, such clients would have to be explicitly given the Language,
or arrange to obtain it by some other means. Arguably, this line of thinking
applies to all services, not just parsing, and so the getLanguage() method
probably belongs on ILanguageService instead of IParseController. I think
that's the right way to go in the long run, but decided against making
change
now, due to the larger impact on existing clients.
--
Cheers,
-- Bob
--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center
IMP Project Lead (http://www.eclipse.org/imp)
X10: Productivity for High-Performance Parallel Programming (http://x10.sf.net)