Syntax highlighting is changeable.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPEditor.java
index 040e974..ed584d5 100644 (file)
@@ -1681,7 +1681,11 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
    * @since 3.0
    */
   private IJavaFoldingStructureProvider fProjectionModelUpdater;
-
+  /**
+        * The override and implements indicator manager for this editor.
+        * @since 3.0
+        */
+//     protected OverrideIndicatorManager fOverrideIndicatorManager;
   /**
    * The action group for folding.
    * 
@@ -1741,18 +1745,16 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
    */
   protected void initializeEditor() {
     //jsurfer old code
-    JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
-    setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools, this, IPHPPartitions.PHP_PARTITIONING)); //, IJavaPartitions.JAVA_PARTITIONING));
-    setRangeIndicator(new DefaultRangeIndicator());
-    //         IPreferenceStore store=
-    // PHPeclipsePlugin.getDefault().getPreferenceStore();
-    //         setPreferenceStore(store);
-    IPreferenceStore store = createCombinedPreferenceStore(null);
-    setPreferenceStore(store);
-
+//    JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
+//    setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools, this, IPHPPartitions.PHP_PARTITIONING)); //, IJavaPartitions.JAVA_PARTITIONING));
+    IPreferenceStore store= createCombinedPreferenceStore(null);
+       setPreferenceStore(store);
+    JavaTextTools textTools= PHPeclipsePlugin.getDefault().getJavaTextTools();
+       setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools.getColorManager(), store, this, IPHPPartitions.PHP_PARTITIONING));
     // TODO changed in 3.x ?
-    if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE))
-      fUpdater = new OutlinePageSelectionUpdater();
+//    setRangeIndicator(new DefaultRangeIndicator());
+//    if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE))
+//      fUpdater = new OutlinePageSelectionUpdater();
     // jsurfer end
 
     //         IPreferenceStore store= createCombinedPreferenceStore(null);
@@ -1901,7 +1903,7 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
        
        super.configureSourceViewerDecorationSupport(support);
   }
-  
+       
   /**
    * Returns this document's complete text.
    * 
@@ -2668,14 +2670,11 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         return;
       }
 
-      //      if
-      // (PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE.equals(property))
-      // {
-      //               if ((event.getNewValue() instanceof Boolean) &&
-      // ((Boolean)event.getNewValue()).booleanValue())
-      //                       fEditorSelectionChangedListener.selectionChanged();
-      //               return;
-      //       }
+      if (PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE.equals(property)) {
+               if ((event.getNewValue() instanceof Boolean) && ((Boolean)event.getNewValue()).booleanValue())
+                       selectionChanged();
+               return;
+         } 
 
       if (PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE.equals(property)) {
         if (event.getNewValue() instanceof Boolean) {
@@ -2715,6 +2714,20 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
       //                       }
       //               }
       //       }
+      
+      ((PHPSourceViewerConfiguration)getSourceViewerConfiguration()).handlePropertyChangeEvent(event);
+               
+//             if (affectsOverrideIndicatorAnnotations(event)) {
+//                     if (isShowingOverrideIndicators()) {
+//                             if (fOverrideIndicatorManager == null)
+//                                     installOverrideIndicator(true);
+//                     } else {
+//                             if (fOverrideIndicatorManager != null)
+//                                     uninstallOverrideIndicator();
+//                     }
+//                     return;
+//             }
+               
       if (PreferenceConstants.EDITOR_FOLDING_PROVIDER.equals(property)) {
         if (sourceViewer instanceof ProjectionViewer) {
           ProjectionViewer projectionViewer = (ProjectionViewer) sourceViewer;
@@ -2989,19 +3002,19 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
   protected final static String MATCHING_BRACKETS_COLOR = PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR;
 
   /** Preference key for highlighting current line */
-  protected final static String CURRENT_LINE = PreferenceConstants.EDITOR_CURRENT_LINE;
+//  protected final static String CURRENT_LINE = PreferenceConstants.EDITOR_CURRENT_LINE;
 
   /** Preference key for highlight color of current line */
-  protected final static String CURRENT_LINE_COLOR = PreferenceConstants.EDITOR_CURRENT_LINE_COLOR;
+//  protected final static String CURRENT_LINE_COLOR = PreferenceConstants.EDITOR_CURRENT_LINE_COLOR;
 
   /** Preference key for showing print marging ruler */
-  protected final static String PRINT_MARGIN = PreferenceConstants.EDITOR_PRINT_MARGIN;
+//  protected final static String PRINT_MARGIN = PreferenceConstants.EDITOR_PRINT_MARGIN;
 
   /** Preference key for print margin ruler color */
-  protected final static String PRINT_MARGIN_COLOR = PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR;
+//  protected final static String PRINT_MARGIN_COLOR = PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR;
 
   /** Preference key for print margin ruler column */
-  protected final static String PRINT_MARGIN_COLUMN = PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN;
+//  protected final static String PRINT_MARGIN_COLUMN = PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN;
 
   /** Preference key for error indication */
   //  protected final static String ERROR_INDICATION =
@@ -3396,7 +3409,17 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
     return viewer;
   }
-
+  /*
+        * @see AbstractTextEditor#affectsTextPresentation(PropertyChangeEvent)
+        */
+       protected boolean affectsTextPresentation(PropertyChangeEvent event) {
+               return ((PHPSourceViewerConfiguration)getSourceViewerConfiguration()).affectsTextPresentation(event) || super.affectsTextPresentation(event);
+       }
+//
+//       protected boolean affectsTextPresentation(PropertyChangeEvent event) {
+//         JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
+//         return textTools.affectsBehavior(event);
+//       }
   /**
    * Creates and returns the preference store for this Java editor with the given input.
    * 
@@ -3432,23 +3455,6 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
     return new ChainedPreferenceStore((IPreferenceStore[]) stores.toArray(new IPreferenceStore[stores.size()]));
   }
 
-  /*
-   * @see AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler, int)
-   */
-  //   protected ISourceViewer createJavaSourceViewer(Composite parent,
-  // IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean
-  // isOverviewRulerVisible, int styles) {
-  //           return new JavaSourceViewer(parent, verticalRuler, getOverviewRuler(),
-  // isOverviewRulerVisible(), styles);
-  //   }
-  /*
-   * @see AbstractTextEditor#affectsTextPresentation(PropertyChangeEvent)
-   */
-  protected boolean affectsTextPresentation(PropertyChangeEvent event) {
-    JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
-    return textTools.affectsBehavior(event);
-  }
-
   /**
    * Jumps to the error next according to the given direction.
    */