avoid NullPointerException in debug
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / ui / text / PHPSourceViewerConfiguration.java
index ee2d646..9973c82 100644 (file)
@@ -24,7 +24,6 @@ import net.sourceforge.phpdt.internal.ui.text.JavaElementProvider;
 import net.sourceforge.phpdt.internal.ui.text.JavaOutlineInformationControl;
 import net.sourceforge.phpdt.internal.ui.text.JavaPresentationReconciler;
 import net.sourceforge.phpdt.internal.ui.text.JavaReconciler;
-import net.sourceforge.phpdt.internal.ui.text.PreferencesAdapter;
 import net.sourceforge.phpdt.internal.ui.text.java.JavaFormattingStrategy;
 import net.sourceforge.phpdt.internal.ui.text.java.JavaStringAutoIndentStrategyDQ;
 import net.sourceforge.phpdt.internal.ui.text.java.JavaStringAutoIndentStrategySQ;
@@ -51,9 +50,9 @@ import net.sourceforge.phpeclipse.xml.ui.text.XMLTextTools;
 
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.DefaultAutoIndentStrategy;
+import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy;
 import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.IAutoIndentStrategy;
+import org.eclipse.jface.text.IAutoEditStrategy;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.IInformationControl;
 import org.eclipse.jface.text.IInformationControlCreator;
@@ -83,12 +82,9 @@ import org.eclipse.jface.text.rules.Token;
 import org.eclipse.jface.text.source.IAnnotationHover;
 import org.eclipse.jface.text.source.ISourceViewer;
 import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.jface.util.Assert;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.texteditor.ChainedPreferenceStore;
 import org.eclipse.ui.texteditor.ITextEditor;
 
 /**
@@ -413,7 +409,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
   /*
    * (non-Javadoc) Method declared on SourceViewerConfiguration
    */
-  public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType) {
+  public IAutoEditStrategy getAutoEditStrategy(ISourceViewer sourceViewer, String contentType) {
     if (IPHPPartitions.PHP_PHPDOC_COMMENT.equals(contentType)
         || IPHPPartitions.PHP_MULTILINE_COMMENT.equals(contentType))
       return new JavaDocAutoIndentStrategy(getConfiguredDocumentPartitioning(sourceViewer));
@@ -425,7 +421,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
     return (PHPDocumentPartitioner.PHP_TEMPLATE_DATA.equals(contentType)
         || PHPDocumentPartitioner.PHP_SCRIPT_CODE.equals(contentType) || IDocument.DEFAULT_CONTENT_TYPE.equals(contentType)
         || IPHPPartitions.PHP_PARTITIONING.equals(contentType) || PHPPartitionScanner.PHP_SCRIPTING_AREA.equals(contentType) ? new PHPAutoIndentStrategy()
-        : new DefaultAutoIndentStrategy());
+        : new DefaultIndentLineAutoEditStrategy());
   }
 
   /**
@@ -601,7 +597,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
 
     IPHPPartitions.HTML, IPHPPartitions.HTML_MULTILINE_COMMENT, IPHPPartitions.PHP_PARTITIONING,
         IPHPPartitions.PHP_SINGLELINE_COMMENT, IPHPPartitions.PHP_MULTILINE_COMMENT, IPHPPartitions.PHP_PHPDOC_COMMENT,
-        IPHPPartitions.PHP_STRING_DQ, IPHPPartitions.PHP_STRING_SQ, IPHPPartitions.CSS, IPHPPartitions.CSS_MULTILINE_COMMENT,
+        IPHPPartitions.PHP_STRING_DQ, IPHPPartitions.PHP_STRING_SQ, IPHPPartitions.PHP_STRING_HEREDOC, IPHPPartitions.CSS, IPHPPartitions.CSS_MULTILINE_COMMENT,
         IPHPPartitions.JAVASCRIPT, IPHPPartitions.JS_MULTILINE_COMMENT, IPHPPartitions.SMARTY,
         IPHPPartitions.SMARTY_MULTILINE_COMMENT,
 
@@ -625,7 +621,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
   public String[] getConfiguredPHPContentTypes() {
     return new String[] { IDocument.DEFAULT_CONTENT_TYPE, IPHPPartitions.PHP_PARTITIONING, IPHPPartitions.PHP_SINGLELINE_COMMENT,
         IPHPPartitions.PHP_MULTILINE_COMMENT, IPHPPartitions.PHP_PHPDOC_COMMENT, IPHPPartitions.PHP_STRING_DQ,
-        IPHPPartitions.PHP_STRING_SQ, IPHPPartitions.CSS, IPHPPartitions.CSS_MULTILINE_COMMENT, IPHPPartitions.JAVASCRIPT,
+        IPHPPartitions.PHP_STRING_SQ, IPHPPartitions.PHP_STRING_HEREDOC, IPHPPartitions.CSS, IPHPPartitions.CSS_MULTILINE_COMMENT, IPHPPartitions.JAVASCRIPT,
         IPHPPartitions.JS_MULTILINE_COMMENT, IPHPPartitions.SMARTY, IPHPPartitions.SMARTY_MULTILINE_COMMENT, };
   }
 
@@ -668,6 +664,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
     assistant.setContentAssistProcessor(processor, IPHPPartitions.PHP_PARTITIONING);
     assistant.setContentAssistProcessor(processor, IPHPPartitions.PHP_STRING_DQ);
     assistant.setContentAssistProcessor(processor, IPHPPartitions.PHP_STRING_SQ);
+    assistant.setContentAssistProcessor(processor, IPHPPartitions.PHP_STRING_HEREDOC);
 
     assistant.setContentAssistProcessor(new PHPDocCompletionProcessor(getEditor()), IPHPPartitions.PHP_PHPDOC_COMMENT);
     //    assistant.enableAutoActivation(true);
@@ -821,6 +818,9 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
     phpDR = new DefaultDamagerRepairer(getStringSQScanner());
     phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_STRING_SQ);
     phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_STRING_SQ);
+    phpDR = new DefaultDamagerRepairer(getStringDQScanner());
+    phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_STRING_HEREDOC);
+    phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_STRING_HEREDOC);
     phpDR = new DefaultDamagerRepairer(getSinglelineCommentScanner());
     phpReconciler.setDamager(phpDR, IPHPPartitions.PHP_SINGLELINE_COMMENT);
     phpReconciler.setRepairer(phpDR, IPHPPartitions.PHP_SINGLELINE_COMMENT);