Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [imp-dev] "Interesting" case of dynamic language registration

I knew that the bundle activation registration wouldn't help in the particular case you were describing; it's intended for cases where one wants to load code from, say, a workspace bundle after the platform has been brought up.

I was just mentioning it in case it proved useful in some other context...

On Dec 7, 2010, at 10:27 AM, Jurgen Vinju wrote:

> Hi,
> 
> That service about bundle startup does not help (it's too late, since
> the editors may have already been started before the bundle does).
> 
> Instead there is now an extension point called languageRegistrar which
> calls a method in classes that implements ILanguageRegistrar at the
> right moment in time (when UniversalEditor for the first time needs to
> call findLanguage on LanguageRegistry). It's been tested and checked
> into the trunk.
> 
> Thanks!
> 
> Jurgen
> 
> On Tue, Dec 7, 2010 at 3:06 PM, Robert M. Fuhrer <rfuhrer@xxxxxxxxxxxxxx> wrote:
>> [ This conversation also took place on Bugzilla bug Bug 331751]
>> 
>> [ Ooh, the meta-ness of all of this is giving me chills. :-) You want to
>> extend the
>> extension mechanism... ]
>> This sounds entirely reasonable to me. In essence, given that we already
>> support dynamically registering languages, you now need a way to trigger
>> that
>> early enough at startup.
>> Here's my first-cut proposal:
>> Let's create an extension point for the following interface:
>>   public interface LanguageRegistrar {
>>       public void registerLanguages(LanguageRegistry registry);
>>   }
>> This would be called by the LanguageRegistry after the normal registration
>> process is complete.
>> Sound good?
>> ==============
>> BTW, I don't know that the following helps any, but I've recently committed
>> changes to support dynamic language registration when bundles are
>> activated/deactivated. I've been using this as part of my work on
>> resuscitating
>> the source formatting rule editor. The editor can now be run in the same
>> workbench as the rest of IMP!
>> Seems to work pretty well, though I still have to fix a bug or two in some
>> code
>> that asks the PDE for all the defined extensions (installed +
>> workspace-resident).
>> On Dec 2, 2010, at 3:53 PM, Jurgen Vinju wrote:
>> 
>> Hi,
>> 
>> I'm using LanguageRegistry.registerLanguage(...) to dynamically extend
>> Eclipse with editors for new languages. The extension points of such
>> languages are implemented by some "multiplexing" instances of the IMP
>> services that dynamically find the right implementation for each
>> editor, based on the language name and some lookup table. These
>> implementations are provided by Rascal programs.
>> 
>> So far so good ;-) This all works fine when you're running Eclipse and
>> you don't quit it.
>> 
>> Now when I quit Eclipse and start it up again, the editors for those
>> dynamically registered languages might still be there. However, since
>> their language is not registered by an IMP extension point, there is
>> no language registered for those editors and NullPointerExceptions
>> start jumping at you from all parts of the UniversalEditor :-(
>> 
>> The question is: where would you add some code that can re-register
>> those languages, just in time before the UniversalEditors that are
>> still open will start complaining about missing languages? I don't
>> think there is a default Eclipse way to do it, and UniversalEditor
>> does not provide a service for it either. Your advice is much
>> appreciated. (I really can't/shouldn't/won't add extension points for
>> those languages). Is there a simple solution?
>> 
>> Cheers,
>> 
>> Jurgen
>> 
>> Cheers,
>>  - Bob
>> 
>> _______________________________________________
>> imp-dev mailing list
>> imp-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/imp-dev
>> 
>> 
> 
> 
> 
> -- 
> Jurgen Vinju
> - Centrum Wiskunde & Informatica - SEN1
> - INRIA Lille - ATEAMS
> - Universiteit van Amsterdam
> 
>   www: http://jurgen.vinju.org,
> http://www.rascal-mpl.nl,http://twitter.com/jurgenvinju
> skype: jurgen.vinju
> _______________________________________________
> imp-dev mailing list
> imp-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/imp-dev
> 

Cheers,
 - Bob



Back to the top