Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] multiple source parsers - part 2

 
  i've just finished committing the 2nd part of the multiple source parsers implementation. there is now a generic preferences interface that can be leveraged by any dltk extension that is contributed in the same manager as a source parser or debugging engine (this has been refactored as well since it already provided a bunch of the functionality neded).

  if you only have a single source parser, the preference page to select one is completely optional. if you wish to define multiple parsers but 'force' your users to use a specific one, the preference page continues to be optional b/c you can control this by defining a higher priority in the plugin.xml. if you want to allow multiple parsers that your users can select from, you should be sure to configure one of the parser extensions with a selector that implements the IDLTKContributionSelector. a base implementation already exists (DLTKIdContributionSelector) that will check the user specified preference store for a parser and if none has been selected, it will fall back to selecting one based upon priority.

  one important change that should be noted is that the org.eclipse.dltk.core.sourceParsers extension point has changed again. part of the reason this was done is b/c the some of the attributes defined for the extension also need to be available to the preferences interface. there are various comments in the code related to this. now instead of defining an instance of the ISourceParser class, you will need to define an implementation of an ISourceParserFactory, so your plugin.xml now looks something like this:

   <extension
         point="org.eclipse.dltk.core.sourceParsers">
      <parserContribution
            natureId="org.eclipse.dltk.tcl.core.nature">
         <parser
               class="org.eclipse.dltk.tcl.internal.parser.TclSourceParserFactory"
               description="%sourceParser.description"
               id="org.eclipse.dltk.tcl.sourceParser "
               name="%sourceParser.name"
               priority="0" />
      </parserContribution>
   </extension>

  let me know if there are any questions/problems.
 
  enjoy!

--
-jae

Back to the top