1 package net.sourceforge.phpdt.ui.text;
 
   4  * (c) Copyright IBM Corp. 2000, 2001.
 
   8 import net.sourceforge.phpdt.internal.ui.text.FastJavaPartitionScanner;
 
   9 import net.sourceforge.phpdt.internal.ui.text.IPHPPartitions;
 
  10 import net.sourceforge.phpdt.internal.ui.text.JavaColorManager;
 
  11 import net.sourceforge.phpdt.internal.ui.text.phpdoc.PHPDocCodeScanner;
 
  12 import net.sourceforge.phpeclipse.IPreferenceConstants;
 
  13 import net.sourceforge.phpeclipse.phpeditor.php.HTMLPartitionScanner;
 
  14 import net.sourceforge.phpeclipse.phpeditor.php.PHPCodeScanner;
 
  15 import net.sourceforge.phpeclipse.phpeditor.php.PHPDocumentPartitioner;
 
  16 import net.sourceforge.phpeclipse.phpeditor.php.PHPPartitionScanner;
 
  17 import net.sourceforge.phpeclipse.phpeditor.php.SmartyCodeScanner;
 
  18 import net.sourceforge.phpeclipse.phpeditor.php.SmartyDocCodeScanner;
 
  19 import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
 
  20 import net.sourceforge.phpeclipse.xml.ui.text.XMLTextTools;
 
  22 import org.eclipse.core.runtime.Preferences;
 
  23 import org.eclipse.jface.preference.IPreferenceStore;
 
  24 import org.eclipse.jface.text.IDocument;
 
  25 import org.eclipse.jface.text.IDocumentExtension3;
 
  26 import org.eclipse.jface.text.IDocumentPartitioner;
 
  27 //import org.eclipse.jface.text.rules.DefaultPartitioner;
 
  28 import org.eclipse.jface.text.rules.FastPartitioner;
 
  29 //import org.eclipse.jface.text.rules.RuleBasedScanner;
 
  30 import org.eclipse.jface.util.IPropertyChangeListener;
 
  31 import org.eclipse.jface.util.PropertyChangeEvent;
 
  34 // import org.phpeclipse.phpdt.internal.ui.text.FastJavaPartitionScanner;
 
  35 // import org.phpeclipse.phpdt.internal.ui.text.JavaColorManager;
 
  36 // import org.phpeclipse.phpdt.internal.ui.text.JavaPartitionScanner;
 
  37 // import org.phpeclipse.phpdt.internal.ui.text.SingleTokenJavaScanner;
 
  38 // import org.phpeclipse.phpdt.internal.ui.text.php.JavaCodeScanner;
 
  39 // import org.phpeclipse.phpdt.internal.ui.text.phpdoc.JavaDocScanner;
 
  42  * Tools required to configure a Java text viewer. The color manager and all
 
  43  * scanner exist only one time, i.e. the same instances are returned to all
 
  44  * clients. Thus, clients share those tools.
 
  46  * This class may be instantiated; it is not intended to be subclassed.
 
  49 public class JavaTextTools implements IPHPPartitions {
 
  50         // private static final String[] TOKENS = {
 
  51         // JSPScriptScanner.JSP_DEFAULT,
 
  52         // JSPScriptScanner.JSP_BRACKET };
 
  53         private final static String[] LEGAL_CONTENT_TYPES = new String[] {
 
  54                         PHP_PHPDOC_COMMENT, PHP_MULTILINE_COMMENT, PHP_SINGLELINE_COMMENT,
 
  55                         PHP_STRING_DQ, PHP_STRING_SQ, PHP_STRING_HEREDOC };
 
  57         // private static XMLPartitionScanner HTML_PARTITION_SCANNER = null;
 
  59         // private static FastJavaPartitionScanner PHP_PARTITION_SCANNER = null;
 
  61         private static HTMLPartitionScanner SMARTY_PARTITION_SCANNER = null;
 
  63         // private static XMLPartitionScanner XML_PARTITION_SCANNER = null;
 
  65         // private final static String[] TYPES= new String[] {
 
  66         // PHPPartitionScanner.PHP, PHPPartitionScanner.JAVA_DOC,
 
  67         // PHPPartitionScanner.JAVA_MULTILINE_COMMENT };
 
  68         // private final static String[] TYPES = new String[] {
 
  69         // IPHPPartitions.PHP_PARTITIONING,
 
  70         // IPHPPartitions.PHP_PHPDOC_COMMENT,
 
  71         // // IPHPPartitions.HTML,
 
  72         // // IPHPPartitions.HTML_MULTILINE_COMMENT,
 
  73         // IPHPPartitions.JAVASCRIPT,
 
  74         // IPHPPartitions.CSS,
 
  75         // IPHPPartitions.SMARTY,
 
  76         // IPHPPartitions.SMARTY_MULTILINE_COMMENT };
 
  79          * This tools' preference listener.
 
  81         private class PreferenceListener implements IPropertyChangeListener,
 
  82                         Preferences.IPropertyChangeListener {
 
  83                 public void propertyChange(PropertyChangeEvent event) {
 
  84                         adaptToPreferenceChange(event);
 
  87                 public void propertyChange(Preferences.PropertyChangeEvent event) {
 
  88                         adaptToPreferenceChange(new PropertyChangeEvent(event.getSource(),
 
  89                                         event.getProperty(), event.getOldValue(), event
 
  94         // /** The color manager */
 
  95         private JavaColorManager colorManager;
 
  97         /** The PHP source code scanner */
 
  98         private PHPCodeScanner fCodeScanner;
 
 100         /** The PHP multiline comment scanner */
 
 101         private SingleTokenPHPScanner fMultilineCommentScanner;
 
 103         /** The Java singleline comment scanner */
 
 104         private SingleTokenPHPScanner fSinglelineCommentScanner;
 
 106         /** The PHP double quoted string scanner */
 
 107         // private SingleTokenPHPScanner fStringDQScanner;
 
 108         /** The PHP single quoted string scanner */
 
 109         // private SingleTokenPHPScanner fStringSQScanner;
 
 110         /** The PHPDoc scanner */
 
 111         private PHPDocCodeScanner fPHPDocScanner;
 
 113         /** The HTML scanner */
 
 114         // private HTMLCodeScanner fHTMLScanner;
 
 115         /** The Smarty scanner */
 
 116         private SmartyCodeScanner fSmartyScanner;
 
 118         /** The SmartyDoc scanner */
 
 119         private SmartyDocCodeScanner fSmartyDocScanner;
 
 121         /** The Java partitions scanner. */
 
 122         private FastJavaPartitionScanner fPartitionScanner;
 
 124         /** The preference store */
 
 125         private IPreferenceStore fPreferenceStore;
 
 127         /** The XML Language text tools */
 
 128         private XMLTextTools xmlTextTools;
 
 131          * The core preference store.
 
 135         private Preferences fCorePreferenceStore;
 
 137         /** The preference change listener */
 
 138         private PreferenceListener fPreferenceListener = new PreferenceListener();
 
 140         /** The JSP partitions scanner */
 
 141         private PHPPartitionScanner jspPartitionScanner = null;
 
 143         /** The JSP script subpartitions scanner */
 
 144         // private JSPScriptScanner jspScriptScanner;
 
 145         /** The PHP plain text scanner */
 
 146         // private RuleBasedScanner jspTextScanner;
 
 147         /** The PHP brackets scanner */
 
 148         // private RuleBasedScanner jspBracketScanner;
 
 150          * Creates a new Java text tools collection.
 
 153          *            the preference store to initialize the text tools. The text
 
 154          *            tool instance installs a listener on the passed preference
 
 155          *            store to adapt itself to changes in the preference store. In
 
 156          *            general <code>PreferenceConstants.
 
 157          *                      getPreferenceStore()</code>
 
 158          *            should be used to initialize the text tools.
 
 160          *            optional preference store to initialize the text tools. The
 
 161          *            text tool instance installs a listener on the passed
 
 162          *            preference store to adapt itself to changes in the preference
 
 164          * @see net.sourceforge.phpdt.ui.PreferenceConstants#getPreferenceStore()
 
 167         public JavaTextTools(IPreferenceStore store, Preferences coreStore) {
 
 168                 this(store, coreStore, true);
 
 172          * Creates a new Java text tools collection.
 
 175          *            the preference store to initialize the text tools. The text
 
 176          *            tool instance installs a listener on the passed preference
 
 177          *            store to adapt itself to changes in the preference store. In
 
 178          *            general <code>PreferenceConstants.
 
 179          *                      getPreferenceStore()</code>
 
 180          *            shoould be used to initialize the text tools.
 
 182          *            optional preference store to initialize the text tools. The
 
 183          *            text tool instance installs a listener on the passed
 
 184          *            preference store to adapt itself to changes in the preference
 
 186          * @param autoDisposeOnDisplayDispose
 
 187          *            if <code>true</code> the color manager automatically
 
 188          *            disposes all managed colors when the current display gets
 
 189          *            disposed and all calls to
 
 190          *            {@link org.eclipse.jface.text.source.ISharedTextColors#dispose()}are
 
 192          * @see net.sourceforge.phpdt.ui.PreferenceConstants#getPreferenceStore()
 
 195         public JavaTextTools(IPreferenceStore store, Preferences coreStore,
 
 196                         boolean autoDisposeOnDisplayDispose) {
 
 197                 // super(store, TOKENS, );
 
 198                 // REVISIT: preference store
 
 199                 xmlTextTools = new XMLTextTools(XMLPlugin.getDefault()
 
 200                                 .getPreferenceStore());
 
 202                 colorManager = new JavaColorManager(autoDisposeOnDisplayDispose);
 
 203                 fPreferenceStore = store;
 
 204                 fPreferenceStore.addPropertyChangeListener(fPreferenceListener);
 
 206                 fCorePreferenceStore = coreStore;
 
 207                 if (fCorePreferenceStore != null)
 
 208                         fCorePreferenceStore.addPropertyChangeListener(fPreferenceListener);
 
 210                 fCodeScanner = new PHPCodeScanner((JavaColorManager) colorManager,
 
 212                 fMultilineCommentScanner = new SingleTokenPHPScanner(
 
 213                                 (JavaColorManager) colorManager, store,
 
 214                                 IPreferenceConstants.PHP_MULTILINE_COMMENT);
 
 215                 fSinglelineCommentScanner = new SingleTokenPHPScanner(
 
 216                                 (JavaColorManager) colorManager, store,
 
 217                                 IPreferenceConstants.PHP_SINGLELINE_COMMENT);
 
 218                 // fStringDQScanner = new SingleTokenPHPScanner((JavaColorManager)
 
 219                 // colorManager, store, IPreferenceConstants.PHP_STRING);
 
 220                 // fStringSQScanner = new SingleTokenPHPScanner((JavaColorManager)
 
 221                 // colorManager, store, IPreferenceConstants.PHP_STRING);
 
 223                 fPHPDocScanner = new PHPDocCodeScanner((JavaColorManager) colorManager,
 
 225                 // fHTMLScanner = new HTMLCodeScanner((JavaColorManager)fColorManager,
 
 227                 fSmartyScanner = new SmartyCodeScanner((JavaColorManager) colorManager,
 
 229                 fSmartyDocScanner = new SmartyDocCodeScanner(
 
 230                                 (JavaColorManager) colorManager, store);
 
 232                 fPartitionScanner = new FastJavaPartitionScanner();
 
 234                 // jspScriptScanner = new JSPScriptScanner();
 
 235                 // fPartitionScanner = new FastJavaPartitionScanner();
 
 236                 // fPartitionScanner = new PHPPartitionScanner();
 
 238                 // jspBracketScanner = new RuleBasedScanner();
 
 239                 // jspBracketScanner.setDefaultReturnToken(new
 
 240                 // Token(JSPScriptScanner.JSP_BRACKET));
 
 241                 // jspTextScanner = new RuleBasedScanner();
 
 242                 // jspTextScanner.setDefaultReturnToken(new
 
 243                 // Token(JSPScriptScanner.JSP_DEFAULT));
 
 249         public XMLTextTools getXMLTextTools() {
 
 254          * Disposes all the individual tools of this tools collection.
 
 256         public void dispose() {
 
 259                 fMultilineCommentScanner = null;
 
 260                 fSinglelineCommentScanner = null;
 
 261                 // fStringDQScanner = null;
 
 262                 // fStringSQScanner = null;
 
 263                 fPHPDocScanner = null;
 
 264                 // fPartitionScanner = null;
 
 266                 if (colorManager != null) {
 
 267                         colorManager.dispose();
 
 271                 if (fPreferenceStore != null) {
 
 272                         fPreferenceStore.removePropertyChangeListener(fPreferenceListener);
 
 273                         fPreferenceStore = null;
 
 275                         if (fCorePreferenceStore != null) {
 
 277                                                 .removePropertyChangeListener(fPreferenceListener);
 
 278                                 fCorePreferenceStore = null;
 
 281                         fPreferenceListener = null;
 
 286          * Returns the color manager which is used to manage any Java-specific
 
 287          * colors needed for such things like syntax highlighting.
 
 289          * @return the color manager to be used for Java text viewers
 
 291         public JavaColorManager getColorManager() {
 
 292                 return (JavaColorManager) colorManager;
 
 296          * Returns a scanner which is configured to scan Java source code.
 
 298          * @return a Java source code scanner
 
 300 //      public RuleBasedScanner getCodeScanner() {
 
 301 //              return fCodeScanner;
 
 305          * Returns a scanner which is configured to scan Java multiline comments.
 
 307          * @return a Java multiline comment scanner
 
 311 //      public RuleBasedScanner getMultilineCommentScanner() {
 
 312 //              return fMultilineCommentScanner;
 
 316          * Returns a scanner which is configured to scan HTML code.
 
 318          * @return a HTML scanner
 
 322         // public RuleBasedScanner getHTMLScanner() {
 
 323         // return fHTMLScanner;
 
 326          * Returns a scanner which is configured to scan Smarty code.
 
 328          * @return a Smarty scanner
 
 332 //      public RuleBasedScanner getSmartyScanner() {
 
 333 //              return fSmartyScanner;
 
 337          * Returns a scanner which is configured to scan Smarty code.
 
 339          * @return a Smarty scanner
 
 343 //      public RuleBasedScanner getSmartyDocScanner() {
 
 344 //              return fSmartyDocScanner;
 
 348          * Returns a scanner which is configured to scan Java singleline comments.
 
 350          * @return a Java singleline comment scanner
 
 354 //      public RuleBasedScanner getSinglelineCommentScanner() {
 
 355 //              return fSinglelineCommentScanner;
 
 359          * Returns a scanner which is configured to scan Java strings.
 
 361          * @return a Java string scanner
 
 365         // public RuleBasedScanner getStringScanner() {
 
 366         // return fStringDQScanner;
 
 369          * Returns a scanner which is configured to scan JavaDoc compliant comments.
 
 370          * Notes that the start sequence "/**" and the corresponding end sequence
 
 371          * are part of the JavaDoc comment.
 
 373          * @return a JavaDoc scanner
 
 375 //      public RuleBasedScanner getJavaDocScanner() {
 
 376 //              return fPHPDocScanner;
 
 380          * Returns a scanner which is configured to scan Java-specific partitions,
 
 381          * which are multi-line comments, JavaDoc comments, and regular Java source
 
 384          * @return a Java partition scanner
 
 386         // public IPartitionTokenScanner getPartitionScanner() {
 
 387         // return fPartitionScanner;
 
 390          * Factory method for creating a PHP-specific document partitioner using
 
 391          * this object's partitions scanner. This method is a convenience method.
 
 393          * @return a newly created Java document partitioner
 
 395         public IDocumentPartitioner createDocumentPartitioner() {
 
 396                 return createDocumentPartitioner(".php");
 
 400          * Factory method for creating a PHP-specific document partitioner using
 
 401          * this object's partitions scanner. This method is a convenience method.
 
 403          * @return a newly created Java document partitioner
 
 405         public IDocumentPartitioner createDocumentPartitioner(String extension) {
 
 409                 // FastJavaPartitionScanner.JAVA_DOC,
 
 410                 // FastJavaPartitionScanner.JAVA_MULTI_LINE_COMMENT,
 
 411                 // FastJavaPartitionScanner.JAVA_SINGLE_LINE_COMMENT,
 
 412                 // FastJavaPartitionScanner.JAVA_STRING };
 
 414                 // return new DefaultPartitioner(getPartitionScanner(), types);
 
 415                 IDocumentPartitioner partitioner = null;
 
 416                 // System.out.println(extension);
 
 417                 if (extension.equalsIgnoreCase(".html")
 
 418                                 || extension.equalsIgnoreCase(".htm")) {
 
 420                         partitioner = createHTMLPartitioner();
 
 421                         partitioner = createJSPPartitioner();
 
 422                 } else if (extension.equalsIgnoreCase(".xml")) {
 
 424                         partitioner = createXMLPartitioner();
 
 425                         // } else if (extension.equalsIgnoreCase(".js")) {
 
 427                         // partitioner = createJavaScriptPartitioner();
 
 428                         // } else if (extension.equalsIgnoreCase(".css")) {
 
 429                         // // cascading style sheets
 
 430                         // partitioner = createCSSPartitioner();
 
 431                 } else if (extension.equalsIgnoreCase(".tpl")) {
 
 433                         partitioner = createSmartyPartitioner();
 
 434                         // } else if (extension.equalsIgnoreCase(".inc")) {
 
 435                         // // php include files ?
 
 436                         // partitioner = createIncludePartitioner();
 
 439                 if (partitioner == null) {
 
 440                         partitioner = createJSPPartitioner();
 
 447          * Sets up the Java document partitioner for the given document for the
 
 448          * given partitioning.
 
 451          *            the document to be set up
 
 452          * @param partitioning
 
 453          *            the document partitioning
 
 459         // public void setupJavaDocumentPartitioner(IDocument document, String
 
 460         // partitioning, Object element) {
 
 461         // IDocumentPartitioner partitioner = createDocumentPartitioner(".php");
 
 463         // // if (document instanceof IDocumentExtension3) {
 
 464         // // IDocumentExtension3 extension3= (IDocumentExtension3) document;
 
 465         // // extension3.setDocumentPartitioner(partitioning, partitioner);
 
 467         // document.setDocumentPartitioner(partitioner);
 
 469         // partitioner.connect(document);
 
 471         public void setupHTMLDocumentPartitioner(IDocument document,
 
 472                         String partitioning, Object element) {
 
 473                 IDocumentPartitioner partitioner = createDocumentPartitioner(".html");
 
 475                 // if (document instanceof IDocumentExtension3) {
 
 476                 // IDocumentExtension3 extension3= (IDocumentExtension3) document;
 
 477                 // extension3.setDocumentPartitioner(partitioning, partitioner);
 
 479                 document.setDocumentPartitioner(partitioner);
 
 481                 partitioner.connect(document);
 
 484         public void setupSmartyDocumentPartitioner(IDocument document,
 
 485                         String partitioning, Object element) {
 
 486                 IDocumentPartitioner partitioner = createDocumentPartitioner(".tpl");
 
 488                 // if (document instanceof IDocumentExtension3) {
 
 489                 // IDocumentExtension3 extension3= (IDocumentExtension3) document;
 
 490                 // extension3.setDocumentPartitioner(partitioning, partitioner);
 
 492                 document.setDocumentPartitioner(partitioner);
 
 494                 partitioner.connect(document);
 
 498          * Returns the names of the document position categories used by the
 
 499          * document partitioners created by this object to manage their partition
 
 500          * information. If the partitioners don't use document position categories,
 
 501          * the returned result is <code>null</code>.
 
 503          * @return the partition managing position categories or <code>null</code>
 
 506 //      public String[] getPartitionManagingPositionCategories() {
 
 507 //              return new String[] { DefaultPartitioner.CONTENT_TYPES_CATEGORY };
 
 511          * Determines whether the preference change encoded by the given event
 
 512          * changes the behavior of one its contained components.
 
 515          *            the event to be investigated
 
 516          * @return <code>true</code> if event causes a behavioral change
 
 518          * @deprecated As of 3.0, replaced by
 
 519          *             {@link net.sourceforge.phpdt.ui.text.JavaSourceViewerConfiguration#affectsTextPresentation(PropertyChangeEvent)}
 
 521         // public boolean affectsBehavior(PropertyChangeEvent event) {
 
 522         // return fCodeScanner.affectsBehavior(event)
 
 523         // || fMultilineCommentScanner.affectsBehavior(event)
 
 524         // || fSinglelineCommentScanner.affectsBehavior(event)
 
 525         // || fStringDQScanner.affectsBehavior(event)
 
 526         // || fPHPDocScanner.affectsBehavior(event);
 
 529          * Adapts the behavior of the contained components to the change encoded in
 
 533          *            the event to which to adapt
 
 536         protected void adaptToPreferenceChange(PropertyChangeEvent event) {
 
 537                 if (fCodeScanner.affectsBehavior(event))
 
 538                         fCodeScanner.adaptToPreferenceChange(event);
 
 539                 if (fMultilineCommentScanner.affectsBehavior(event))
 
 540                         fMultilineCommentScanner.adaptToPreferenceChange(event);
 
 541                 if (fSinglelineCommentScanner.affectsBehavior(event))
 
 542                         fSinglelineCommentScanner.adaptToPreferenceChange(event);
 
 543                 // if (fStringDQScanner.affectsBehavior(event))
 
 544                 // fStringDQScanner.adaptToPreferenceChange(event);
 
 545                 if (fPHPDocScanner.affectsBehavior(event))
 
 546                         fPHPDocScanner.adaptToPreferenceChange(event);
 
 547                 // if (fHTMLScanner.affectsBehavior(event))
 
 548                 // fHTMLScanner.adaptToPreferenceChange(event);
 
 549                 if (fSmartyScanner.affectsBehavior(event))
 
 550                         fSmartyScanner.adaptToPreferenceChange(event);
 
 551                 if (fSmartyDocScanner.affectsBehavior(event))
 
 552                         fSmartyDocScanner.adaptToPreferenceChange(event);
 
 553                 // if (XMLPlugin.getDefault().getXMLTextTools().affectsBehavior(event))
 
 555                 // XMLPlugin.getDefault().getXMLTextTools().adaptToPreferenceChange(event);
 
 560          * Return a partitioner for .html files.
 
 562         public IDocumentPartitioner createHTMLPartitioner() {
 
 563                 // return new DefaultPartitioner(getHTMLPartitionScanner(), TYPES);
 
 564                 return xmlTextTools.createXMLPartitioner();
 
 567         // private static IDocumentPartitioner createIncludePartitioner() {
 
 568         // // return new DefaultPartitioner(getPHPPartitionScanner(), TYPES);
 
 569         // return new DefaultPartitioner(getPHPPartitionScanner(),
 
 570         // FastJavaPartitionScanner.PHP_PARTITION_TYPES);
 
 574         // private static IDocumentPartitioner createJavaScriptPartitioner() {
 
 575         // return new DefaultPartitioner(getHTMLPartitionScanner(), TYPES);
 
 579          * Return a partitioner for .php files.
 
 581         public IDocumentPartitioner createPHPPartitioner() {
 
 582                 // return new DefaultPartitioner(getPHPPartitionScanner(), TYPES);
 
 583                 return new /*DefaultPartitioner*/FastPartitioner(getPHPPartitionScanner(),
 
 584                                 LEGAL_CONTENT_TYPES);
 
 587         private IDocumentPartitioner createJSPPartitioner() {
 
 588                 return new PHPDocumentPartitioner(getJSPPartitionScanner());
 
 589                 // return new JSPDocumentPartitioner(getJSPPartitionScanner(),
 
 590                 // jspScriptScanner);
 
 596         // public IPartitionTokenScanner getJSPScriptScanner() {
 
 597         // return jspScriptScanner;
 
 599         private IDocumentPartitioner createSmartyPartitioner() {
 
 600                 return new /*DefaultPartitioner*/FastPartitioner(getSmartyPartitionScanner(),
 
 604         private IDocumentPartitioner createXMLPartitioner() {
 
 605                 // return new DefaultPartitioner(getXMLPartitionScanner(),
 
 606                 // XMLTextTools.TYPES);
 
 607                 return xmlTextTools.createXMLPartitioner();
 
 610         // private IDocumentPartitioner createCSSPartitioner() {
 
 611         // return new DefaultPartitioner(getHTMLPartitionScanner(),
 
 612         // XMLTextTools.TYPES);
 
 616          * Return a scanner for creating html partitions.
 
 618         // private static XMLPartitionScanner getHTMLPartitionScanner() {
 
 619         // // if (HTML_PARTITION_SCANNER == null)
 
 620         // // HTML_PARTITION_SCANNER = new
 
 621         // HTMLPartitionScanner(IPHPPartitions.HTML_FILE);
 
 622         // // return HTML_PARTITION_SCANNER;^
 
 623         // if (HTML_PARTITION_SCANNER == null)
 
 624         // HTML_PARTITION_SCANNER = new XMLPartitionScanner(false);
 
 625         // return HTML_PARTITION_SCANNER;
 
 628          * Return a scanner for creating php partitions.
 
 630         private FastJavaPartitionScanner getPHPPartitionScanner() {
 
 631                 // if (PHP_PARTITION_SCANNER == null)
 
 632                 // PHP_PARTITION_SCANNER = new FastJavaPartitionScanner(); //new
 
 633                 // PHPPartitionScanner(IPHPPartitions.PHP_FILE);
 
 634                 // return PHP_PARTITION_SCANNER;
 
 635                 return fPartitionScanner;
 
 639          * Returns a scanner which is configured to scan plain text in JSP.
 
 641          * @return a JSP text scanner
 
 643         // public RuleBasedScanner getJSPTextScanner() {
 
 644         // return jspTextScanner;
 
 647          * Returns a scanner which is configured to scan plain text in JSP.
 
 649          * @return a JSP text scanner
 
 651         // public RuleBasedScanner getJSPBracketScanner() {
 
 652         // return jspBracketScanner;
 
 655          * Return a scanner for creating smarty partitions.
 
 657         private static HTMLPartitionScanner getSmartyPartitionScanner() {
 
 658                 if (SMARTY_PARTITION_SCANNER == null)
 
 659                         SMARTY_PARTITION_SCANNER = new HTMLPartitionScanner(
 
 660                                         IPHPPartitions.SMARTY_FILE);
 
 661                 return SMARTY_PARTITION_SCANNER;
 
 665          * Return a scanner for creating xml partitions.
 
 667         // private static XMLPartitionScanner getXMLPartitionScanner() {
 
 668         // // if (XML_PARTITION_SCANNER == null)
 
 669         // // XML_PARTITION_SCANNER = new
 
 670         // HTMLPartitionScanner(IPHPPartitions.XML_FILE);
 
 671         // // return XML_PARTITION_SCANNER;
 
 672         // if (XML_PARTITION_SCANNER == null)
 
 673         // XML_PARTITION_SCANNER = new XMLPartitionScanner(false);
 
 674         // return XML_PARTITION_SCANNER;
 
 676         private PHPPartitionScanner getJSPPartitionScanner() {
 
 677                 if (jspPartitionScanner == null)
 
 678                         jspPartitionScanner = new PHPPartitionScanner();
 
 679                 return jspPartitionScanner;
 
 683          * Sets up the Java document partitioner for the given document for the
 
 684          * default partitioning.
 
 687          *            the document to be set up
 
 690         public void setupJavaDocumentPartitioner(IDocument document) {
 
 691                 setupJavaDocumentPartitioner(document,
 
 692                                 IDocumentExtension3.DEFAULT_PARTITIONING);
 
 696          * Sets up the Java document partitioner for the given document for the
 
 697          * given partitioning.
 
 700          *            the document to be set up
 
 701          * @param partitioning
 
 702          *            the document partitioning
 
 705         public void setupJavaDocumentPartitioner(IDocument document,
 
 706                         String partitioning) {
 
 707                 IDocumentPartitioner partitioner = createDocumentPartitioner();
 
 708                 if (document instanceof IDocumentExtension3) {
 
 709                         IDocumentExtension3 extension3 = (IDocumentExtension3) document;
 
 710                         extension3.setDocumentPartitioner(partitioning, partitioner);
 
 712                         document.setDocumentPartitioner(partitioner);
 
 714                 partitioner.connect(document);
 
 718          * Returns this text tool's preference store.
 
 720          * @return the preference store
 
 723         protected IPreferenceStore getPreferenceStore() {
 
 724                 return fPreferenceStore;
 
 728          * Returns this text tool's core preference store.
 
 730          * @return the core preference store
 
 733 //      protected Preferences getCorePreferenceStore() {
 
 734 //              return fCorePreferenceStore;