1) Moved net.sourceforge.phpeclipse.ui\src\net\sourceforge\phpdt back to net.sourcefo...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / text / JavaCompositeReconcilingStrategy.java
index 2a77746..bdbe486 100644 (file)
@@ -24,53 +24,65 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
 import org.eclipse.ui.texteditor.ITextEditor;
 
 /**
- * Reconciling strategy for Java code. This is a composite strategy containing the
- * regular java model reconciler and the comment spell checking strategy. 
+ * Reconciling strategy for Java code. This is a composite strategy containing
+ * the regular java model reconciler and the comment spell checking strategy.
  * 
- * @since 3.0 
+ * @since 3.0
  */
-public class JavaCompositeReconcilingStrategy  extends CompositeReconcilingStrategy {
-       
+public class JavaCompositeReconcilingStrategy extends
+               CompositeReconcilingStrategy {
+
        private ITextEditor fEditor;
+
        private JavaReconcilingStrategy fJavaStrategy;
 
        /**
         * Creates a new Java reconciling strategy.
         * 
-        * @param editor the editor of the strategy's reconciler
-        * @param documentPartitioning the document partitioning this strategy uses for configuration
+        * @param editor
+        *            the editor of the strategy's reconciler
+        * @param documentPartitioning
+        *            the document partitioning this strategy uses for configuration
         */
-       public JavaCompositeReconcilingStrategy(ITextEditor editor, String documentPartitioning) {
-               fEditor= editor;
-               fJavaStrategy= new JavaReconcilingStrategy(editor);
+       public JavaCompositeReconcilingStrategy(ITextEditor editor,
+                       String documentPartitioning) {
+               fEditor = editor;
+               fJavaStrategy = new JavaReconcilingStrategy(editor);
                setReconcilingStrategies(new IReconcilingStrategy[] {
-                       fJavaStrategy,
-                       new SpellReconcileStrategy(editor, documentPartitioning, PreferenceConstants.getPreferenceStore())
-               });
+                               fJavaStrategy,
+                               new SpellReconcileStrategy(editor, documentPartitioning,
+                                               PreferenceConstants.getPreferenceStore()) });
        }
-       
+
        /**
         * Returns the problem requestor for the editor's input element.
         * 
         * @return the problem requestor for the editor's input element
         */
        private IProblemRequestorExtension getProblemRequestorExtension() {
-               IDocumentProvider p= fEditor.getDocumentProvider();
+               IDocumentProvider p = fEditor.getDocumentProvider();
                if (p == null) {
-                       // work around for https://bugs.eclipse.org/bugs/show_bug.cgi?id=51522
-                       p= PHPeclipsePlugin.getDefault().getCompilationUnitDocumentProvider();
+                       try {
+                               // work around for
+                               // https://bugs.eclipse.org/bugs/show_bug.cgi?id=51522
+                               p = PHPeclipsePlugin.getDefault()
+                                               .getCompilationUnitDocumentProvider();
+                       } catch (NullPointerException npe) {
+                               return null;
+                       }
                }
-               IAnnotationModel m= p.getAnnotationModel(fEditor.getEditorInput());
+               IAnnotationModel m = p.getAnnotationModel(fEditor.getEditorInput());
                if (m instanceof IProblemRequestorExtension)
                        return (IProblemRequestorExtension) m;
                return null;
        }
-       
+
        /*
-        * @see org.eclipse.jface.text.reconciler.CompositeReconcilingStrategy#reconcile(org.eclipse.jface.text.reconciler.DirtyRegion, org.eclipse.jface.text.IRegion)
+        * @see org.eclipse.jface.text.reconciler.CompositeReconcilingStrategy#reconcile(org.eclipse.jface.text.reconciler.DirtyRegion,
+        *      org.eclipse.jface.text.IRegion)
         */
        public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
-               IProblemRequestorExtension e= getProblemRequestorExtension();
+               IProblemRequestorExtension e = getProblemRequestorExtension();
                if (e != null) {
                        try {
                                e.beginReportingSequence();
@@ -82,12 +94,12 @@ public class JavaCompositeReconcilingStrategy  extends CompositeReconcilingStrat
                        super.reconcile(dirtyRegion, subRegion);
                }
        }
-       
+
        /*
         * @see org.eclipse.jface.text.reconciler.CompositeReconcilingStrategy#reconcile(org.eclipse.jface.text.IRegion)
         */
        public void reconcile(IRegion partition) {
-               IProblemRequestorExtension e= getProblemRequestorExtension();
+               IProblemRequestorExtension e = getProblemRequestorExtension();
                if (e != null) {
                        try {
                                e.beginReportingSequence();
@@ -99,21 +111,22 @@ public class JavaCompositeReconcilingStrategy  extends CompositeReconcilingStrat
                        super.reconcile(partition);
                }
        }
-       
+
        /**
         * Tells this strategy whether to inform its listeners.
         * 
-        * @param notify <code>true</code> if listeners should be notified
+        * @param notify
+        *            <code>true</code> if listeners should be notified
         */
        public void notifyListeners(boolean notify) {
                fJavaStrategy.notifyListeners(notify);
        }
-       
+
        /*
         * @see org.eclipse.jface.text.reconciler.CompositeReconcilingStrategy#initialReconcile()
         */
        public void initialReconcile() {
-               IProblemRequestorExtension e= getProblemRequestorExtension();
+               IProblemRequestorExtension e = getProblemRequestorExtension();
                if (e != null) {
                        try {
                                e.beginReportingSequence();
@@ -133,6 +146,6 @@ public class JavaCompositeReconcilingStrategy  extends CompositeReconcilingStrat
         */
        public void aboutToBeReconciled() {
                fJavaStrategy.aboutToBeReconciled();
-               
+
        }
-}
+}
\ No newline at end of file