1 /**********************************************************************
 
   2  Copyright (c) 2000, 2002 IBM Corp. and others.
 
   3  All rights reserved. This program and the accompanying materials
 
   4  are made available under the terms of the Common Public License v1.0
 
   5  which accompanies this distribution, and is available at
 
   6  http://www.eclipse.org/legal/cpl-v10.html
 
   9  IBM Corporation - Initial implementation
 
  11  **********************************************************************/
 
  12 package net.sourceforge.phpdt.ui.text;
 
  14 import java.util.Vector;
 
  16 import net.sourceforge.phpdt.core.JavaCore;
 
  17 //import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
 
  18 import net.sourceforge.phpdt.internal.ui.text.AbstractJavaScanner;
 
  19 import net.sourceforge.phpdt.internal.ui.text.ContentAssistPreference;
 
  20 import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter;
 
  21 import net.sourceforge.phpdt.internal.ui.text.IPHPPartitions;
 
  22 import net.sourceforge.phpdt.internal.ui.text.JavaAnnotationHover;
 
  23 import net.sourceforge.phpdt.internal.ui.text.JavaCompositeReconcilingStrategy;
 
  24 import net.sourceforge.phpdt.internal.ui.text.JavaElementProvider;
 
  25 import net.sourceforge.phpdt.internal.ui.text.JavaOutlineInformationControl;
 
  26 import net.sourceforge.phpdt.internal.ui.text.JavaPresentationReconciler;
 
  27 import net.sourceforge.phpdt.internal.ui.text.JavaReconciler;
 
  28 import net.sourceforge.phpdt.internal.ui.text.java.JavaFormattingStrategy;
 
  29 import net.sourceforge.phpdt.internal.ui.text.java.JavaStringAutoIndentStrategyDQ;
 
  30 import net.sourceforge.phpdt.internal.ui.text.java.JavaStringAutoIndentStrategySQ;
 
  31 import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaEditorTextHoverDescriptor;
 
  32 import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy;
 
  33 import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaInformationProvider;
 
  34 import net.sourceforge.phpdt.internal.ui.text.phpdoc.JavaDocAutoIndentStrategy;
 
  35 import net.sourceforge.phpdt.internal.ui.text.phpdoc.PHPDocCodeScanner;
 
  36 import net.sourceforge.phpdt.internal.ui.text.phpdoc.PHPDocCompletionProcessor;
 
  37 import net.sourceforge.phpdt.ui.PreferenceConstants;
 
  38 import net.sourceforge.phpeclipse.IPreferenceConstants;
 
  39 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 
  40 import net.sourceforge.phpeclipse.phpeditor.php.HTMLCompletionProcessor;
 
  41 import net.sourceforge.phpeclipse.phpeditor.php.PHPAutoIndentStrategy;
 
  42 import net.sourceforge.phpeclipse.phpeditor.php.PHPCodeScanner;
 
  43 import net.sourceforge.phpeclipse.phpeditor.php.PHPCompletionProcessor;
 
  44 import net.sourceforge.phpeclipse.phpeditor.php.PHPDocumentPartitioner;
 
  45 import net.sourceforge.phpeclipse.phpeditor.php.PHPDoubleClickSelector;
 
  46 import net.sourceforge.phpeclipse.phpeditor.php.PHPPartitionScanner;
 
  47 //import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
 
  48 import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLConfiguration;
 
  49 import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLPartitionScanner;
 
  50 import net.sourceforge.phpeclipse.xml.ui.text.XMLTextTools;
 
  52 import org.eclipse.core.runtime.NullProgressMonitor;
 
  53 import org.eclipse.jface.preference.IPreferenceStore;
 
  54 import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy;
 
  55 import org.eclipse.jface.text.DefaultInformationControl;
 
  56 import org.eclipse.jface.text.IAutoEditStrategy;
 
  57 import org.eclipse.jface.text.IDocument;
 
  58 import org.eclipse.jface.text.IInformationControl;
 
  59 import org.eclipse.jface.text.IInformationControlCreator;
 
  60 import org.eclipse.jface.text.ITextDoubleClickStrategy;
 
  61 import org.eclipse.jface.text.ITextHover;
 
  62 import org.eclipse.jface.text.ITextViewerExtension2;
 
  63 import org.eclipse.jface.text.TextAttribute;
 
  64 import org.eclipse.jface.text.contentassist.ContentAssistant;
 
  65 import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
 
  66 import org.eclipse.jface.text.contentassist.IContentAssistant;
 
  67 import org.eclipse.jface.text.formatter.ContentFormatter;
 
  68 import org.eclipse.jface.text.formatter.IContentFormatter;
 
  69 import org.eclipse.jface.text.formatter.IFormattingStrategy;
 
  70 import org.eclipse.jface.text.information.IInformationPresenter;
 
  71 import org.eclipse.jface.text.information.IInformationProvider;
 
  72 import org.eclipse.jface.text.information.InformationPresenter;
 
  73 import org.eclipse.jface.text.presentation.IPresentationDamager;
 
  74 import org.eclipse.jface.text.presentation.IPresentationReconciler;
 
  75 import org.eclipse.jface.text.presentation.IPresentationRepairer;
 
  76 import org.eclipse.jface.text.presentation.PresentationReconciler;
 
  77 import org.eclipse.jface.text.reconciler.IReconciler;
 
  78 import org.eclipse.jface.text.rules.BufferedRuleBasedScanner;
 
  79 import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
 
  80 import org.eclipse.jface.text.rules.DefaultPartitioner;
 
  81 import org.eclipse.jface.text.rules.RuleBasedScanner;
 
  82 import org.eclipse.jface.text.rules.Token;
 
  83 import org.eclipse.jface.text.source.IAnnotationHover;
 
  84 import org.eclipse.jface.text.source.ISourceViewer;
 
  85 import org.eclipse.jface.text.source.SourceViewerConfiguration;
 
  86 import org.eclipse.jface.util.PropertyChangeEvent;
 
  87 import org.eclipse.swt.SWT;
 
  88 import org.eclipse.swt.widgets.Shell;
 
  89 import org.eclipse.ui.texteditor.ITextEditor;
 
  92  * Configuration for an <code>SourceViewer</code> which shows PHP code.
 
  94 public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
 
  96          * Preference key used to look up display tab width.
 
 100         public final static String PREFERENCE_TAB_WIDTH = PreferenceConstants.EDITOR_TAB_WIDTH;
 
 103          * Preference key for inserting spaces rather than tabs.
 
 107         public final static String SPACES_FOR_TABS = PreferenceConstants.EDITOR_SPACES_FOR_TABS;
 
 109         // public static final String HTML_DEFAULT =
 
 110         // IPHPPartitionScannerConstants.HTML;
 
 111         // IDocument.DEFAULT_CONTENT_TYPE;
 
 112         // private JavaTextTools fJavaTextTools;
 
 114         private ITextEditor fTextEditor;
 
 117          * The document partitioning.
 
 121         private String fDocumentPartitioning;
 
 123         private ContentFormatter fFormatter;
 
 126          * Single token scanner.
 
 128         static class SingleTokenScanner extends BufferedRuleBasedScanner {
 
 129                 public SingleTokenScanner(TextAttribute attribute) {
 
 130                         setDefaultReturnToken(new Token(attribute));
 
 135          * The document partitioning.
 
 139         // private String fDocumentPartitioning;
 
 141          * The Java source code scanner
 
 145         private AbstractJavaScanner fCodeScanner;
 
 148          * The Java multi-line comment scanner
 
 152         private AbstractJavaScanner fMultilineCommentScanner;
 
 155          * The Java single-line comment scanner
 
 159         private AbstractJavaScanner fSinglelineCommentScanner;
 
 162          * The PHP double quoted string scanner
 
 164         private AbstractJavaScanner fStringDQScanner;
 
 167          * The PHP single quoted string scanner
 
 169         private AbstractJavaScanner fStringSQScanner;
 
 172          * The Javadoc scanner
 
 176         private AbstractJavaScanner fJavaDocScanner;
 
 179          * The preference store, can be read-only
 
 183         private IPreferenceStore fPreferenceStore;
 
 190         private IColorManager fColorManager;
 
 192         private XMLTextTools fXMLTextTools;
 
 194         private XMLConfiguration xmlConfiguration;
 
 197          * Creates a new Java source viewer configuration for viewers in the given
 
 198          * editor using the given preference store, the color manager and the
 
 199          * specified document partitioning.
 
 201          * Creates a Java source viewer configuration in the new setup without text
 
 202          * tools. Clients are allowed to call
 
 203          * {@link JavaSourceViewerConfiguration#handlePropertyChangeEvent(PropertyChangeEvent)}and
 
 205          * {@link JavaSourceViewerConfiguration#getPreferenceStore()}on the
 
 206          * resulting Java source viewer configuration.
 
 209          * @param colorManager
 
 211          * @param preferenceStore
 
 212          *            the preference store, can be read-only
 
 214          *            the editor in which the configured viewer(s) will reside
 
 215          * @param partitioning
 
 216          *            the document partitioning for this configuration
 
 219         public PHPSourceViewerConfiguration(IColorManager colorManager,
 
 220                         IPreferenceStore preferenceStore, ITextEditor editor,
 
 221                         String partitioning) {
 
 222                 fColorManager = colorManager;
 
 223                 fPreferenceStore = preferenceStore;
 
 224                 fTextEditor = editor;
 
 225                 fDocumentPartitioning = partitioning;
 
 226                 // fJavaTextTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
 
 227                 fXMLTextTools = new XMLTextTools(getPreferenceStore());
 
 228                 //XMLPlugin.getDefault().getXMLTextTools();
 
 229                 xmlConfiguration = new XMLConfiguration(fXMLTextTools);
 
 230                 fColorManager = colorManager;
 
 231                 fPreferenceStore = preferenceStore;
 
 232                 fTextEditor = editor;
 
 233                 fDocumentPartitioning = partitioning;
 
 235                 initializeScanners();
 
 239          * Creates a new Java source viewer configuration for viewers in the given
 
 240          * editor using the given Java tools.
 
 243          *            the Java text tools to be used
 
 245          *            the editor in which the configured viewer(s) will reside
 
 247          * @deprecated As of 3.0, replaced by
 
 248          *             {@link JavaSourceViewerConfiguration#JavaSourceViewerConfiguration(IColorManager, IPreferenceStore, ITextEditor, String)}
 
 250         // public PHPSourceViewerConfiguration(JavaTextTools tools, PHPEditor
 
 251         // editor, String partitioning) {
 
 252         // fJavaTextTools = tools;
 
 253         // fColorManager = tools.getColorManager();
 
 254         // fPreferenceStore = createPreferenceStore();
 
 255         // fDocumentPartitioning = partitioning;
 
 256         // fCodeScanner = (AbstractJavaScanner) fJavaTextTools.getCodeScanner();
 
 257         // fMultilineCommentScanner = (AbstractJavaScanner)
 
 258         // fJavaTextTools.getMultilineCommentScanner();
 
 259         // fSinglelineCommentScanner = (AbstractJavaScanner)
 
 260         // fJavaTextTools.getSinglelineCommentScanner();
 
 261         // fStringDQScanner = (AbstractJavaScanner)
 
 262         // fJavaTextTools.getStringScanner();
 
 263         // fJavaDocScanner = (AbstractJavaScanner)
 
 264         // fJavaTextTools.getJavaDocScanner();
 
 265         // fTextEditor = editor;
 
 266         // fXMLTextTools = XMLPlugin.getDefault().getXMLTextTools();
 
 267         // xmlConfiguration = new XMLConfiguration(fXMLTextTools);
 
 270          * Returns the color manager for this configuration.
 
 272          * @return the color manager
 
 274         protected IColorManager getColorManager() {
 
 275                 return fColorManager;
 
 279          * Initializes the scanners.
 
 283         private void initializeScanners() {
 
 284                 // Assert.isTrue(isNewSetup());
 
 285                 fCodeScanner = new PHPCodeScanner(getColorManager(), fPreferenceStore);
 
 286                 fMultilineCommentScanner = new SingleTokenPHPScanner(getColorManager(),
 
 287                                 fPreferenceStore, IPreferenceConstants.PHP_MULTILINE_COMMENT);
 
 288                 fSinglelineCommentScanner = new SingleTokenPHPScanner(
 
 289                                 getColorManager(), fPreferenceStore,
 
 290                                 IPreferenceConstants.PHP_SINGLELINE_COMMENT);
 
 291                 // fStringDQScanner = new SingleTokenPHPScanner(getColorManager(),
 
 292                 // fPreferenceStore, IPreferenceConstants.PHP_STRING_DQ);
 
 293                 fStringDQScanner = new PHPStringDQCodeScanner(getColorManager(),
 
 295                 fStringSQScanner = new SingleTokenPHPScanner(getColorManager(),
 
 296                                 fPreferenceStore, IPreferenceConstants.PHP_STRING_SQ);
 
 297                 fJavaDocScanner = new PHPDocCodeScanner(getColorManager(),
 
 302          * Determines whether the preference change encoded by the given event
 
 303          * changes the behavior of one of its contained components.
 
 306          *            the event to be investigated
 
 307          * @return <code>true</code> if event causes a behavioral change
 
 310         public boolean affectsTextPresentation(PropertyChangeEvent event) {
 
 311                 return fCodeScanner.affectsBehavior(event)
 
 312                                 || fMultilineCommentScanner.affectsBehavior(event)
 
 313                                 || fSinglelineCommentScanner.affectsBehavior(event)
 
 314                                 || fStringDQScanner.affectsBehavior(event)
 
 315                                 || fStringSQScanner.affectsBehavior(event)
 
 316                                 || fJavaDocScanner.affectsBehavior(event);
 
 320          * Adapts the behavior of the contained components to the change encoded in
 
 323          * Clients are not allowed to call this method if the old setup with text
 
 328          *            the event to which to adapt
 
 329          * @see JavaSourceViewerConfiguration#JavaSourceViewerConfiguration(IColorManager,
 
 330          *      IPreferenceStore, ITextEditor, String)
 
 333         public void handlePropertyChangeEvent(PropertyChangeEvent event) {
 
 334                 // Assert.isTrue(isNewSetup());
 
 335                 if (fCodeScanner.affectsBehavior(event))
 
 336                         fCodeScanner.adaptToPreferenceChange(event);
 
 337                 if (fMultilineCommentScanner.affectsBehavior(event))
 
 338                         fMultilineCommentScanner.adaptToPreferenceChange(event);
 
 339                 if (fSinglelineCommentScanner.affectsBehavior(event))
 
 340                         fSinglelineCommentScanner.adaptToPreferenceChange(event);
 
 341                 if (fStringDQScanner.affectsBehavior(event))
 
 342                         fStringDQScanner.adaptToPreferenceChange(event);
 
 343                 if (fStringSQScanner.affectsBehavior(event))
 
 344                         fStringSQScanner.adaptToPreferenceChange(event);
 
 345                 if (fJavaDocScanner.affectsBehavior(event))
 
 346                         fJavaDocScanner.adaptToPreferenceChange(event);
 
 350          * @see SourceViewerConfiguration#getContentFormatter(ISourceViewer)
 
 352         public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
 
 353                 // if (fFormatter == null) {
 
 354                 // fFormatter = new ContentFormatter();
 
 355                 // fFormattingStrategy = new HTMLFormattingStrategy(this,
 
 357                 // fFormatter.setFormattingStrategy(fFormattingStrategy, HTML_DEFAULT);
 
 358                 // fFormatter.enablePartitionAwareFormatting(false);
 
 359                 // fFormatter.setPartitionManagingPositionCategories(getConfiguredContentTypes(null));
 
 361                 // return fFormatter;
 
 362                 if (fFormatter == null) {
 
 364                         fFormatter = new ContentFormatter();
 
 365                         IFormattingStrategy strategy = new JavaFormattingStrategy(
 
 367                         fFormatter.setFormattingStrategy(strategy,
 
 368                                         IDocument.DEFAULT_CONTENT_TYPE);
 
 369                         fFormatter.enablePartitionAwareFormatting(false);
 
 371                                         .setPartitionManagingPositionCategories(getPartitionManagingPositionCategories());
 
 377          * Returns the names of the document position categories used by the
 
 378          * document partitioners created by this object to manage their partition
 
 379          * information. If the partitioners don't use document position categories,
 
 380          * the returned result is <code>null</code>.
 
 382          * @return the partition managing position categories or <code>null</code>
 
 385         public String[] getPartitionManagingPositionCategories() {
 
 386                 return new String[] { DefaultPartitioner.CONTENT_TYPES_CATEGORY };
 
 390         // * Returns the names of the document position categories used by the
 
 392         // * partitioners created by this object to manage their partition
 
 394         // * If the partitioners don't use document position categories, the
 
 396         // * result is <code>null</code>.
 
 398         // * @return the partition managing position categories or
 
 400         // * if there is none
 
 402         // private String[] getPartitionManagingPositionCategories() {
 
 403         // return new String[] { DefaultPartitioner.CONTENT_TYPES_CATEGORY };
 
 405         public ITextEditor getEditor() {
 
 410          * Returns the preference store used by this configuration to initialize the
 
 411          * individual bits and pieces.
 
 413          * @return the preference store used to initialize this configuration
 
 417         protected IPreferenceStore getPreferenceStore() {
 
 418                 return PHPeclipsePlugin.getDefault().getPreferenceStore();
 
 422         // * Method declared on SourceViewerConfiguration
 
 424         // public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
 
 425         // return new PHPAnnotationHover();
 
 428          * @see SourceViewerConfiguration#getAnnotationHover(ISourceViewer)
 
 430         public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
 
 431                 return new JavaAnnotationHover(JavaAnnotationHover.VERTICAL_RULER_HOVER);
 
 435          * @see SourceViewerConfiguration#getOverviewRulerAnnotationHover(ISourceViewer)
 
 438         public IAnnotationHover getOverviewRulerAnnotationHover(
 
 439                         ISourceViewer sourceViewer) {
 
 440                 return new JavaAnnotationHover(JavaAnnotationHover.OVERVIEW_RULER_HOVER);
 
 443         public IAutoEditStrategy[] getAutoEditStrategies(
 
 444                         ISourceViewer sourceViewer, String contentType) {
 
 445                 IAutoEditStrategy strategy = new DefaultIndentLineAutoEditStrategy();
 
 446                 if (IPHPPartitions.PHP_PHPDOC_COMMENT.equals(contentType)
 
 447                                 || IPHPPartitions.PHP_MULTILINE_COMMENT.equals(contentType))
 
 448                         strategy = new JavaDocAutoIndentStrategy(
 
 449                                         getConfiguredDocumentPartitioning(sourceViewer));
 
 450                 else if (IPHPPartitions.PHP_STRING_DQ.equals(contentType))
 
 451                         strategy = new JavaStringAutoIndentStrategyDQ(
 
 452                                         getConfiguredDocumentPartitioning(sourceViewer));
 
 453                 else if (IPHPPartitions.PHP_STRING_SQ.equals(contentType))
 
 454                         strategy = new JavaStringAutoIndentStrategySQ(
 
 455                                         getConfiguredDocumentPartitioning(sourceViewer));
 
 457                         strategy = (PHPDocumentPartitioner.PHP_TEMPLATE_DATA
 
 459                                         || PHPDocumentPartitioner.PHP_SCRIPT_CODE
 
 461                                         || IDocument.DEFAULT_CONTENT_TYPE.equals(contentType)
 
 462                                         || IPHPPartitions.PHP_PARTITIONING.equals(contentType)
 
 463                                         || PHPPartitionScanner.PHP_SCRIPTING_AREA
 
 464                                                         .equals(contentType) ? new PHPAutoIndentStrategy()
 
 465                                         : new DefaultIndentLineAutoEditStrategy());
 
 466                 IAutoEditStrategy[] result = new IAutoEditStrategy[1];
 
 467                 result[0] = strategy;
 
 472          * Returns the PHP source code scanner for this configuration.
 
 474          * @return the PHP source code scanner
 
 476         protected RuleBasedScanner getCodeScanner() {
 
 477                 return fCodeScanner; // fJavaTextTools.getCodeScanner();
 
 481          * Returns the Java multi-line comment scanner for this configuration.
 
 483          * @return the Java multi-line comment scanner
 
 486         protected RuleBasedScanner getMultilineCommentScanner() {
 
 487                 return fMultilineCommentScanner;
 
 491          * Returns the Java single-line comment scanner for this configuration.
 
 493          * @return the Java single-line comment scanner
 
 496         protected RuleBasedScanner getSinglelineCommentScanner() {
 
 497                 return fSinglelineCommentScanner;
 
 501          * Returns the PHP double quoted string scanner for this configuration.
 
 503          * @return the PHP double quoted string scanner
 
 505         protected RuleBasedScanner getStringDQScanner() {
 
 506                 return fStringDQScanner;
 
 510          * Returns the PHP single quoted string scanner for this configuration.
 
 512          * @return the PHP single quoted string scanner
 
 514         protected RuleBasedScanner getStringSQScanner() {
 
 515                 return fStringSQScanner;
 
 519          * Returns the HTML source code scanner for this configuration.
 
 521          * @return the HTML source code scanner
 
 523         // protected RuleBasedScanner getHTMLScanner() {
 
 524         // return fJavaTextTools.getHTMLScanner();
 
 527          * Returns the Smarty source code scanner for this configuration.
 
 529          * @return the Smarty source code scanner
 
 531         // protected RuleBasedScanner getSmartyScanner() {
 
 532         // return fJavaTextTools.getSmartyScanner();
 
 535          * @see SourceViewerConfiguration#getReconciler(ISourceViewer)
 
 538          * @see SourceViewerConfiguration#getReconciler(ISourceViewer)
 
 540         public IReconciler getReconciler(ISourceViewer sourceViewer) {
 
 542                 final ITextEditor editor = getEditor();
 
 543                 if (editor != null && editor.isEditable()) {
 
 545                         JavaCompositeReconcilingStrategy strategy = new JavaCompositeReconcilingStrategy(
 
 546                                         editor, getConfiguredDocumentPartitioning(sourceViewer));
 
 547                         JavaReconciler reconciler = new JavaReconciler(editor, strategy,
 
 549                         reconciler.setIsIncrementalReconciler(false);
 
 550                         reconciler.setProgressMonitor(new NullProgressMonitor());
 
 551                         reconciler.setDelay(500);
 
 559          * @see SourceViewerConfiguration#getConfiguredTextHoverStateMasks(ISourceViewer,
 
 563         public int[] getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer,
 
 564                         String contentType) {
 
 565                 JavaEditorTextHoverDescriptor[] hoverDescs = PHPeclipsePlugin
 
 566                                 .getDefault().getJavaEditorTextHoverDescriptors();
 
 567                 int stateMasks[] = new int[hoverDescs.length];
 
 568                 int stateMasksLength = 0;
 
 569                 for (int i = 0; i < hoverDescs.length; i++) {
 
 570                         if (hoverDescs[i].isEnabled()) {
 
 572                                 int stateMask = hoverDescs[i].getStateMask();
 
 573                                 while (j < stateMasksLength) {
 
 574                                         if (stateMasks[j] == stateMask)
 
 578                                 if (j == stateMasksLength)
 
 579                                         stateMasks[stateMasksLength++] = stateMask;
 
 582                 if (stateMasksLength == hoverDescs.length)
 
 584                 int[] shortenedStateMasks = new int[stateMasksLength];
 
 585                 System.arraycopy(stateMasks, 0, shortenedStateMasks, 0,
 
 587                 return shortenedStateMasks;
 
 591          * @see SourceViewerConfiguration#getTextHover(ISourceViewer, String, int)
 
 594         public ITextHover getTextHover(ISourceViewer sourceViewer,
 
 595                         String contentType, int stateMask) {
 
 596                 JavaEditorTextHoverDescriptor[] hoverDescs = PHPeclipsePlugin
 
 597                                 .getDefault().getJavaEditorTextHoverDescriptors();
 
 599                 while (i < hoverDescs.length) {
 
 600                         if (hoverDescs[i].isEnabled()
 
 601                                         && hoverDescs[i].getStateMask() == stateMask)
 
 602                                 return new JavaEditorTextHoverProxy(hoverDescs[i], getEditor());
 
 606                 // if (fEditor != null) {
 
 607                 // IEditorInput editorInput = fEditor.getEditorInput();
 
 608                 // if (editorInput instanceof IFileEditorInput) {
 
 610                 // IFile f = ((IFileEditorInput) editorInput).getFile();
 
 611                 // return new PHPTextHover(f.getProject());
 
 612                 // } catch (NullPointerException e) {
 
 613                 // // this exception occurs, if getTextHover is called by
 
 614                 // // preference pages !
 
 618                 // return new PHPTextHover(null);
 
 622          * @see SourceViewerConfiguration#getTextHover(ISourceViewer, String)
 
 624         public ITextHover getTextHover(ISourceViewer sourceViewer,
 
 625                         String contentType) {
 
 626                 return getTextHover(sourceViewer, contentType,
 
 627                                 ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
 
 631          * Returns the SmartyDoc source code scanner for this configuration.
 
 633          * @return the SmartyDoc source code scanner
 
 635         // protected RuleBasedScanner getSmartyDocScanner() {
 
 636         // return fJavaTextTools.getSmartyDocScanner();
 
 639          * Returns the PHPDoc source code scanner for this configuration.
 
 641          * @return the PHPDoc source code scanner
 
 643         protected RuleBasedScanner getPHPDocScanner() {
 
 644                 return fJavaDocScanner; // fJavaTextTools.getJavaDocScanner();
 
 648          * (non-Javadoc) Method declared on SourceViewerConfiguration
 
 650         public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
 
 651                 return new String[] { 
 
 652                                 IDocument.DEFAULT_CONTENT_TYPE,
 
 653                                 PHPPartitionScanner.PHP_SCRIPTING_AREA,
 
 656                                 IPHPPartitions.HTML_MULTILINE_COMMENT,
 
 657                                 IPHPPartitions.PHP_PARTITIONING,
 
 658                                 IPHPPartitions.PHP_SINGLELINE_COMMENT,
 
 659                                 IPHPPartitions.PHP_MULTILINE_COMMENT,
 
 660                                 IPHPPartitions.PHP_PHPDOC_COMMENT,
 
 661                                 IPHPPartitions.PHP_STRING_DQ, 
 
 662                                 IPHPPartitions.PHP_STRING_SQ,
 
 663                                 IPHPPartitions.PHP_STRING_HEREDOC, 
 
 665                                 IPHPPartitions.CSS_MULTILINE_COMMENT,
 
 666                                 IPHPPartitions.JAVASCRIPT, 
 
 667                                 IPHPPartitions.JS_MULTILINE_COMMENT,
 
 668                                 IPHPPartitions.SMARTY, 
 
 669                                 IPHPPartitions.SMARTY_MULTILINE_COMMENT,
 
 671                                 XMLPartitionScanner.XML_PI, 
 
 672                                 XMLPartitionScanner.XML_COMMENT,
 
 673                                 XMLPartitionScanner.XML_DECL, 
 
 674                                 XMLPartitionScanner.XML_TAG,
 
 675                                 XMLPartitionScanner.XML_ATTRIBUTE,
 
 676                                 XMLPartitionScanner.XML_CDATA,
 
 678                                 XMLPartitionScanner.DTD_INTERNAL,
 
 679                                 XMLPartitionScanner.DTD_INTERNAL_PI,
 
 680                                 XMLPartitionScanner.DTD_INTERNAL_COMMENT,
 
 681                                 XMLPartitionScanner.DTD_INTERNAL_DECL,
 
 683                                 PHPDocumentPartitioner.PHP_TEMPLATE_DATA,
 
 684                                 PHPDocumentPartitioner.PHP_SCRIPT_CODE };
 
 687         public String[] getConfiguredHTMLContentTypes() {
 
 688                 return new String[] { 
 
 689                                 XMLPartitionScanner.XML_PI,
 
 690                                 XMLPartitionScanner.XML_COMMENT, 
 
 691                                 XMLPartitionScanner.XML_DECL,
 
 692                                 XMLPartitionScanner.XML_TAG, 
 
 693                                 XMLPartitionScanner.XML_ATTRIBUTE,
 
 694                                 XMLPartitionScanner.XML_CDATA,
 
 696                                 XMLPartitionScanner.DTD_INTERNAL,
 
 697                                 XMLPartitionScanner.DTD_INTERNAL_PI,
 
 698                                 XMLPartitionScanner.DTD_INTERNAL_COMMENT,
 
 699                                 XMLPartitionScanner.DTD_INTERNAL_DECL, };
 
 702         public String[] getConfiguredPHPContentTypes() {
 
 703                 return new String[] { 
 
 704                                 IDocument.DEFAULT_CONTENT_TYPE,
 
 705                                 IPHPPartitions.PHP_PARTITIONING,
 
 706                                 IPHPPartitions.PHP_SINGLELINE_COMMENT,
 
 707                                 IPHPPartitions.PHP_MULTILINE_COMMENT,
 
 708                                 IPHPPartitions.PHP_PHPDOC_COMMENT,
 
 709                                 IPHPPartitions.PHP_STRING_DQ, 
 
 710                                 IPHPPartitions.PHP_STRING_SQ,
 
 711                                 IPHPPartitions.PHP_STRING_HEREDOC, 
 
 713                                 IPHPPartitions.CSS_MULTILINE_COMMENT,
 
 714                                 IPHPPartitions.JAVASCRIPT, 
 
 715                                 IPHPPartitions.JS_MULTILINE_COMMENT,
 
 716                                 IPHPPartitions.SMARTY, 
 
 717                                 IPHPPartitions.SMARTY_MULTILINE_COMMENT, };
 
 721          * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer)
 
 724         public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
 
 725                 if (fDocumentPartitioning != null)
 
 726                         return fDocumentPartitioning;
 
 727                 return super.getConfiguredDocumentPartitioning(sourceViewer);
 
 731          * (non-Javadoc) Method declared on SourceViewerConfiguration
 
 733         public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
 
 734                 ContentAssistant assistant = new ContentAssistant();
 
 735                 IContentAssistProcessor processor = new HTMLCompletionProcessor (getEditor());
 
 736                 assistant.setDocumentPartitioning (getConfiguredDocumentPartitioning(sourceViewer));
 
 737                 assistant.setContentAssistProcessor (processor, IPHPPartitions.HTML);
 
 738                 assistant.setContentAssistProcessor (processor, IPHPPartitions.HTML_MULTILINE_COMMENT);
 
 740                 assistant.setContentAssistProcessor (processor, IPHPPartitions.CSS);
 
 741                 assistant.setContentAssistProcessor (processor, IPHPPartitions.CSS_MULTILINE_COMMENT);
 
 742                 assistant.setContentAssistProcessor (processor, IPHPPartitions.JAVASCRIPT);
 
 743                 assistant.setContentAssistProcessor (processor, IPHPPartitions.JS_MULTILINE_COMMENT);
 
 744                 // TODO define special smarty partition content assist
 
 745                 assistant.setContentAssistProcessor (processor, IPHPPartitions.SMARTY);
 
 746                 assistant.setContentAssistProcessor (processor, IPHPPartitions.SMARTY_MULTILINE_COMMENT);
 
 748                 assistant.setContentAssistProcessor (processor, PHPDocumentPartitioner.PHP_TEMPLATE_DATA);
 
 749                 String[] htmlTypes = getConfiguredHTMLContentTypes();
 
 751                 for (int i = 0; i < htmlTypes.length; i++) {
 
 752                         assistant.setContentAssistProcessor(processor, htmlTypes[i]);
 
 754                 processor = new PHPCompletionProcessor (getEditor());
 
 756                 assistant.setContentAssistProcessor (processor, PHPDocumentPartitioner.PHP_SCRIPT_CODE);
 
 757                 assistant.setContentAssistProcessor (processor, IPHPPartitions.PHP_PARTITIONING);
 
 758                 assistant.setContentAssistProcessor (processor, IPHPPartitions.PHP_STRING_DQ);
 
 759                 assistant.setContentAssistProcessor (processor, IPHPPartitions.PHP_STRING_SQ);
 
 760                 assistant.setContentAssistProcessor (processor, IPHPPartitions.PHP_STRING_HEREDOC);
 
 762                 assistant.setContentAssistProcessor (new PHPDocCompletionProcessor(
 
 763                                 getEditor()), IPHPPartitions.PHP_PHPDOC_COMMENT);
 
 764                 // assistant.enableAutoActivation(true);
 
 765                 // assistant.setAutoActivationDelay(500);
 
 766                 // assistant.setProposalPopupOrientation(ContentAssistant.PROPOSAL_OVERLAY);
 
 767                 // ContentAssistPreference.configure(assistant, getPreferenceStore());
 
 768                 // assistant.setContextInformationPopupOrientation(
 
 769                 // ContentAssistant.CONTEXT_INFO_ABOVE);
 
 770                 // assistant.setContextInformationPopupBackground(
 
 771                 // PHPEditorEnvironment.getPHPColorProvider().getColor(
 
 772                 // new RGB(150, 150, 0)));
 
 773                 ContentAssistPreference.configure (assistant, getPreferenceStore());
 
 774                 assistant.setContextInformationPopupOrientation (ContentAssistant.CONTEXT_INFO_ABOVE);
 
 775                 assistant.setInformationControlCreator (getInformationControlCreator(sourceViewer));
 
 780          * (non-Javadoc) Method declared on SourceViewerConfiguration
 
 782         // public String getDefaultPrefix(ISourceViewer sourceViewer, String
 
 784         // return (PHPPartitionScanner.PHP.equals(contentType) ? "//" : null);
 
 786         // // return (IDocument.DEFAULT_CONTENT_TYPE.equals(contentType) ? "//" :
 
 787         // null); //$NON-NLS-1$
 
 790          * @see SourceViewerConfiguration#getDefaultPrefix(ISourceViewer, String)
 
 793         public String[] getDefaultPrefixes(ISourceViewer sourceViewer,
 
 794                         String contentType) {
 
 795                 return new String[] { "//", "" }; //$NON-NLS-1$ //$NON-NLS-2$
 
 799          * (non-Javadoc) Method declared on SourceViewerConfiguration
 
 801         public ITextDoubleClickStrategy getDoubleClickStrategy(
 
 802                         ISourceViewer sourceViewer, String contentType) {
 
 803                 return new PHPDoubleClickSelector();
 
 807          * @see SourceViewerConfiguration#getIndentPrefixes(ISourceViewer, String)
 
 809         public String[] getIndentPrefixes(ISourceViewer sourceViewer,
 
 810                         String contentType) {
 
 811                 Vector vector = new Vector();
 
 812                 // prefix[0] is either '\t' or ' ' x tabWidth, depending on useSpaces
 
 813                 final IPreferenceStore preferences = PHPeclipsePlugin.getDefault()
 
 814                                 .getPreferenceStore();
 
 815                 int tabWidth = preferences.getInt(JavaCore.FORMATTER_TAB_SIZE);
 
 816                 boolean useSpaces = getPreferenceStore().getBoolean(SPACES_FOR_TABS);
 
 817                 for (int i = 0; i <= tabWidth; i++) {
 
 818                         StringBuffer prefix = new StringBuffer();
 
 820                                 for (int j = 0; j + i < tabWidth; j++)
 
 825                                 for (int j = 0; j < i; j++)
 
 830                         vector.add(prefix.toString());
 
 832                 vector.add(""); //$NON-NLS-1$
 
 833                 return (String[]) vector.toArray(new String[vector.size()]);
 
 837          * @return <code>true</code> iff the new setup without text tools is in
 
 842         // private boolean isNewSetup() {
 
 843         // return fJavaTextTools == null;
 
 846          * Creates and returns a preference store which combines the preference
 
 847          * stores from the text tools and which is read-only.
 
 849          * @return the read-only preference store
 
 852         // private IPreferenceStore createPreferenceStore() {
 
 853         // Assert.isTrue(!isNewSetup());
 
 854         // IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
 
 855         // if (fJavaTextTools.getCorePreferenceStore() == null)
 
 856         // return new ChainedPreferenceStore(new IPreferenceStore[] {
 
 857         // fJavaTextTools.getPreferenceStore(), generalTextStore });
 
 859         // return new ChainedPreferenceStore(new IPreferenceStore[] {
 
 860         // fJavaTextTools.getPreferenceStore(),
 
 861         // new PreferencesAdapter(fJavaTextTools.getCorePreferenceStore()),
 
 862         // generalTextStore });
 
 865          * (non-Javadoc) Method declared on SourceViewerConfiguration
 
 867         public IPresentationReconciler getPresentationReconciler(
 
 868                         ISourceViewer sourceViewer) {
 
 869                 // PHPColorProvider provider =
 
 870                 // PHPEditorEnvironment.getPHPColorProvider();
 
 871                 // JavaColorManager provider =
 
 872                 // PHPEditorEnvironment.getPHPColorProvider();
 
 873                 PresentationReconciler phpReconciler = new JavaPresentationReconciler();
 
 875                                 .setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
 
 877                 // DefaultDamagerRepairer dr = new
 
 878                 // DefaultDamagerRepairer(getHTMLScanner());
 
 879                 // reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
 
 880                 // reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
 
 881                 // dr = new DefaultDamagerRepairer(getHTMLScanner());
 
 882                 // reconciler.setDamager(dr, IPHPPartitions.HTML);
 
 883                 // reconciler.setRepairer(dr, IPHPPartitions.HTML);
 
 884                 // dr = new DefaultDamagerRepairer(getHTMLScanner());
 
 885                 // reconciler.setDamager(dr, IPHPPartitions.CSS);
 
 886                 // reconciler.setRepairer(dr, IPHPPartitions.CSS);
 
 887                 // dr = new DefaultDamagerRepairer(getHTMLScanner());
 
 888                 // reconciler.setDamager(dr, IPHPPartitions.CSS_MULTILINE_COMMENT);
 
 889                 // reconciler.setRepairer(dr, IPHPPartitions.CSS_MULTILINE_COMMENT);
 
 890                 // dr = new DefaultDamagerRepairer(getHTMLScanner());
 
 891                 // reconciler.setDamager(dr, IPHPPartitions.JAVASCRIPT);
 
 892                 // reconciler.setRepairer(dr, IPHPPartitions.JAVASCRIPT);
 
 893                 // dr = new DefaultDamagerRepairer(getHTMLScanner());
 
 894                 // reconciler.setDamager(dr, IPHPPartitions.JS_MULTILINE_COMMENT);
 
 895                 // reconciler.setRepairer(dr, IPHPPartitions.JS_MULTILINE_COMMENT);
 
 896                 // DefaultDamagerRepairer phpDR = new
 
 897                 // DefaultDamagerRepairer(getSmartyScanner());
 
 898                 // phpReconciler.setDamager(phpDR, IPHPPartitions.SMARTY);
 
 899                 // phpReconciler.setRepairer(phpDR, IPHPPartitions.SMARTY);
 
 900                 // phpDR = new DefaultDamagerRepairer(getSmartyDocScanner());
 
 901                 // phpReconciler.setDamager(phpDR,
 
 902                 // IPHPPartitions.SMARTY_MULTILINE_COMMENT);
 
 903                 // phpReconciler.setRepairer(phpDR,
 
 904                 // IPHPPartitions.SMARTY_MULTILINE_COMMENT);
 
 905                 // dr = new DefaultDamagerRepairer(new SingleTokenScanner(new
 
 906                 // TextAttribute(fJavaTextTools.getColorManager().getColor(
 
 907                 // PHPColorProvider.MULTI_LINE_COMMENT))));
 
 908                 // reconciler.setDamager(dr, IPHPPartitions.HTML_MULTILINE_COMMENT);
 
 909                 // reconciler.setRepairer(dr, IPHPPartitions.HTML_MULTILINE_COMMENT);
 
 911                 DefaultDamagerRepairer phpDR = new DefaultDamagerRepairer(
 
 913                 phpReconciler.setDamager(phpDR, IDocument.DEFAULT_CONTENT_TYPE);
 
 914                 phpReconciler.setRepairer(phpDR, IDocument.DEFAULT_CONTENT_TYPE);
 
 916                 phpDR = new DefaultDamagerRepairer(getCodeScanner());
 
 917                 phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_PARTITIONING);
 
 918                 phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_PARTITIONING);
 
 920                 phpDR = new DefaultDamagerRepairer(getPHPDocScanner());
 
 921                 phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_PHPDOC_COMMENT);
 
 922                 phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_PHPDOC_COMMENT);
 
 924                 phpDR = new DefaultDamagerRepairer(getStringDQScanner());
 
 925                 phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_STRING_DQ);
 
 926                 phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_STRING_DQ);
 
 927                 phpDR = new DefaultDamagerRepairer(getStringSQScanner());
 
 928                 phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_STRING_SQ);
 
 929                 phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_STRING_SQ);
 
 930                 phpDR = new DefaultDamagerRepairer(getStringDQScanner());
 
 931                 phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_STRING_HEREDOC);
 
 932                 phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_STRING_HEREDOC);
 
 933                 phpDR = new DefaultDamagerRepairer(getSinglelineCommentScanner());
 
 934                 phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_SINGLELINE_COMMENT);
 
 935                 phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_SINGLELINE_COMMENT);
 
 936                 phpDR = new DefaultDamagerRepairer(getMultilineCommentScanner());
 
 937                 phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_MULTILINE_COMMENT);
 
 938                 phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_MULTILINE_COMMENT);
 
 940                 PresentationReconciler reconciler = new PresentationReconciler();
 
 942                                 .setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
 
 944                 // JavaTextTools jspTextTools =
 
 945                 // PHPeclipsePlugin.getDefault().getJavaTextTools();
 
 946                 DefaultDamagerRepairer dr = new DefaultDamagerRepairer(
 
 947                                 getPHPDocScanner());// jspTextTools.getJSPTextScanner());
 
 948                 reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
 
 949                 reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
 
 951                 // dr = new DefaultDamagerRepairer(new SingleTokenScanner(new
 
 952                 // TextAttribute(fJavaTextTools.getColorManager().getColor(
 
 953                 // PHPColorProvider.PHPDOC_TAG))));//jspTextTools.getJSPBracketScanner());
 
 954                 // reconciler.setDamager(dr, JSPScriptScanner.JSP_BRACKET);
 
 955                 // reconciler.setRepairer(dr, JSPScriptScanner.JSP_BRACKET);
 
 958                 configureEmbeddedPresentationReconciler(reconciler, xmlConfiguration
 
 959                                 .getPresentationReconciler(sourceViewer), xmlConfiguration
 
 960                                 .getConfiguredContentTypes(sourceViewer),
 
 961                                 PHPDocumentPartitioner.PHP_TEMPLATE_DATA);
 
 964                 configureEmbeddedPresentationReconciler(reconciler, phpReconciler,
 
 965                                 getConfiguredPHPContentTypes(),
 
 966                                 PHPDocumentPartitioner.PHP_SCRIPT_CODE);
 
 971         private void configureEmbeddedPresentationReconciler(
 
 972                         PresentationReconciler reconciler,
 
 973                         IPresentationReconciler embedded, String[] types, String defaultType) {
 
 974                 for (int i = 0; i < types.length; i++) {
 
 975                         String type = types[i];
 
 977                         IPresentationDamager damager = embedded.getDamager(type);
 
 978                         IPresentationRepairer repairer = embedded.getRepairer(type);
 
 980                         if (type == IDocument.DEFAULT_CONTENT_TYPE) {
 
 984                         reconciler.setDamager(damager, type);
 
 985                         reconciler.setRepairer(repairer, type);
 
 990          * (non-Javadoc) Method declared on SourceViewerConfiguration
 
 992         public int getTabWidth(ISourceViewer sourceViewer) {
 
 993                 return getPreferenceStore().getInt(PREFERENCE_TAB_WIDTH);
 
 997          * (non-Javadoc) Method declared on SourceViewerConfiguration
 
 999         // public ITextHover getTextHover(ISourceViewer sourceViewer, String
 
1001         // if (fEditor != null) {
 
1002         // IEditorInput editorInput = fEditor.getEditorInput();
 
1003         // if (editorInput instanceof IFileEditorInput) {
 
1005         // IFile f = ((IFileEditorInput) editorInput).getFile();
 
1006         // return new PHPTextHover(f.getProject());
 
1007         // } catch (NullPointerException e) {
 
1008         // // this exception occurs, if getTextHover is called by preference pages
 
1013         // return new PHPTextHover(null);
 
1016          * @see SourceViewerConfiguration#getInformationControlCreator(ISourceViewer)
 
1019         public IInformationControlCreator getInformationControlCreator(
 
1020                         ISourceViewer sourceViewer) {
 
1021                 return new IInformationControlCreator() {
 
1022                         public IInformationControl createInformationControl(Shell parent) {
 
1024                                 //                              return new DefaultInformationControl(parent, SWT.NONE,
 
1025 //                                              new HTMLTextPresenter(true));
 
1026                                 return new DefaultInformationControl(parent,
 
1027                                                 new HTMLTextPresenter(true));
 
1028                                 // return new HoverBrowserControl(parent);
 
1034          * @see SourceViewerConfiguration#getInformationPresenter(ISourceViewer)
 
1037         public IInformationPresenter getInformationPresenter(
 
1038                         ISourceViewer sourceViewer) {
 
1039                 InformationPresenter presenter = new InformationPresenter(
 
1040                                 getInformationPresenterControlCreator(sourceViewer));
 
1042                                 .setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
 
1043                 IInformationProvider provider = new JavaInformationProvider(getEditor());
 
1044                 presenter.setInformationProvider(provider,
 
1045                                 IDocument.DEFAULT_CONTENT_TYPE);
 
1046                 presenter.setInformationProvider(provider,
 
1047                                 IPHPPartitions.PHP_PHPDOC_COMMENT);
 
1048                 // presenter.setInformationProvider(provider,
 
1049                 // IPHPPartitions.JAVA_CHARACTER);
 
1050                 presenter.setSizeConstraints(60, 10, true, true);
 
1055          * @see SourceViewerConfiguration#getInformationPresenter(ISourceViewer)
 
1058         // public IInformationPresenter getInformationPresenter(ISourceViewer
 
1060         // InformationPresenter presenter= new
 
1061         // InformationPresenter(getInformationPresenterControlCreator(sourceViewer));
 
1062         // IInformationProvider provider= new JavaInformationProvider(getEditor());
 
1063         // presenter.setInformationProvider(provider,
 
1064         // IDocument.DEFAULT_CONTENT_TYPE);
 
1065         // presenter.setInformationProvider(provider, IJavaPartitions.JAVA_DOC);
 
1066         // presenter.setSizeConstraints(60, 10, true, true);
 
1067         // return presenter;
 
1070          * Returns the information presenter control creator. The creator is a
 
1071          * factory creating the presenter controls for the given source viewer. This
 
1072          * implementation always returns a creator for
 
1073          * <code>DefaultInformationControl</code> instances.
 
1075          * @param sourceViewer
 
1076          *            the source viewer to be configured by this configuration
 
1077          * @return an information control creator
 
1080         private IInformationControlCreator getInformationPresenterControlCreator(
 
1081                         ISourceViewer sourceViewer) {
 
1082                 return new IInformationControlCreator() {
 
1083                         public IInformationControl createInformationControl(Shell parent) {
 
1084                                 int shellStyle = SWT.RESIZE;
 
1085                                 int style = SWT.V_SCROLL | SWT.H_SCROLL;
 
1086                                 return new DefaultInformationControl(parent, shellStyle, style,
 
1087                                                 new HTMLTextPresenter(false));
 
1088                                 // return new HoverBrowserControl(parent);
 
1094          * Returns the outline presenter control creator. The creator is a factory
 
1095          * creating outline presenter controls for the given source viewer. This
 
1096          * implementation always returns a creator for
 
1097          * <code>JavaOutlineInformationControl</code> instances.
 
1099          * @param sourceViewer
 
1100          *            the source viewer to be configured by this configuration
 
1101          * @return an information control creator
 
1104         private IInformationControlCreator getOutlinePresenterControlCreator(
 
1105                         ISourceViewer sourceViewer) {
 
1106                 return new IInformationControlCreator() {
 
1107                         public IInformationControl createInformationControl(Shell parent) {
 
1108                                 int shellStyle = SWT.RESIZE;
 
1109                                 int treeStyle = SWT.V_SCROLL | SWT.H_SCROLL;
 
1110                                 return new JavaOutlineInformationControl(parent, shellStyle,
 
1117          * Returns the outline presenter which will determine and shown information
 
1118          * requested for the current cursor position.
 
1120          * @param sourceViewer
 
1121          *            the source viewer to be configured by this configuration
 
1122          * @param doCodeResolve
 
1123          *            a boolean which specifies whether code resolve should be used
 
1124          *            to compute the Java element
 
1125          * @return an information presenter
 
1128         public IInformationPresenter getOutlinePresenter(
 
1129                         ISourceViewer sourceViewer, boolean doCodeResolve) {
 
1130                 InformationPresenter presenter = new InformationPresenter(
 
1131                                 getOutlinePresenterControlCreator(sourceViewer));
 
1132                 presenter.setAnchor(InformationPresenter.ANCHOR_GLOBAL);
 
1133                 IInformationProvider provider = new JavaElementProvider(getEditor(),
 
1135                 presenter.setInformationProvider(provider,
 
1136                                 IDocument.DEFAULT_CONTENT_TYPE);
 
1137                 presenter.setInformationProvider(provider,
 
1138                                 PHPDocumentPartitioner.PHP_SCRIPT_CODE);
 
1139                 presenter.setInformationProvider(provider,
 
1140                                 IPHPPartitions.PHP_PARTITIONING);
 
1141                 presenter.setInformationProvider(provider,
 
1142                                 IPHPPartitions.PHP_PHPDOC_COMMENT);
 
1143                 presenter.setInformationProvider(provider,
 
1144                                 IPHPPartitions.SMARTY_MULTILINE_COMMENT);
 
1145                 presenter.setInformationProvider(provider, IPHPPartitions.HTML);
 
1146                 presenter.setInformationProvider(provider,
 
1147                                 IPHPPartitions.HTML_MULTILINE_COMMENT);
 
1148                 presenter.setSizeConstraints(40, 20, true, false);