Added more Wikipedia configurations
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPEditor.java
index 2c916d6..d5eeb74 100644 (file)
@@ -9,7 +9,7 @@ package net.sourceforge.phpeclipse.phpeditor;
 
  Contributors:
  IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
+ www.phpeclipse.de
  **********************************************************************/
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -158,6 +158,7 @@ import org.eclipse.ui.views.contentoutline.ContentOutline;
 import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
 import org.eclipse.ui.views.tasklist.TaskList;
 
+
 /**
  * PHP specific text editor.
  */
@@ -1907,10 +1908,18 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
 
     if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE))
       enableOverwriteMode(false);
-
+    
+    setWordWrap();
     // getEditorSite().getShell().addShellListener(fActivationListener);
   }
 
+  private void setWordWrap() {
+    if (getSourceViewer() != null) {
+      getSourceViewer().getTextWidget().setWordWrap(
+          PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_WRAP_WORDS));
+    }
+  }
+
   protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
 
     support.setCharacterPairMatcher(fBracketMatcher);
@@ -2153,8 +2162,8 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
     if (fProjectionModelUpdater != null)
       fProjectionModelUpdater.initialize();
 
-//        if (isShowingOverrideIndicators())
-//             installOverrideIndicator(false);
+    //        if (isShowingOverrideIndicators())
+    //                 installOverrideIndicator(false);
   }
 
   /*
@@ -2736,7 +2745,12 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
         if (value instanceof Integer) {
           sourceViewer.getTextWidget().setTabs(((Integer) value).intValue());
         } else if (value instanceof String) {
-          sourceViewer.getTextWidget().setTabs(Integer.parseInt((String) value));
+          try {
+            sourceViewer.getTextWidget().setTabs(Integer.parseInt((String) value));
+          } catch (NumberFormatException e){
+            // bug #1038071 - set default tab:
+            sourceViewer.getTextWidget().setTabs(80);
+          }
         }
         return;
       }
@@ -2969,6 +2983,9 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
               .getNewValue())))
         sourceViewer.invalidateTextPresentation();
     }
+    if (PreferenceConstants.EDITOR_WRAP_WORDS.equals(event.getProperty())) {
+      setWordWrap();
+    }
   }
 
   /**
@@ -3834,55 +3851,56 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements I
   }
 
   protected void uninstallOverrideIndicator() {
-//     if (fOverrideIndicatorManager != null) {
-//             fOverrideIndicatorManager.removeAnnotations();
-//             fOverrideIndicatorManager= null;
-//     }
+    //         if (fOverrideIndicatorManager != null) {
+    //                 fOverrideIndicatorManager.removeAnnotations();
+    //                 fOverrideIndicatorManager= null;
+    //         }
   }
 
   protected void installOverrideIndicator(boolean waitForReconcilation) {
-       uninstallOverrideIndicator();
-       IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput());
-       final IJavaElement inputElement= getInputJavaElement();
-
-       if (model == null || inputElement == null)
-               return;
-
-//     fOverrideIndicatorManager= new OverrideIndicatorManager(model, inputElement, null);
-//     
-//     if (provideAST) {
-//             Job job= new Job(JavaEditorMessages.getString("OverrideIndicatorManager.intallJob")) { //$NON-NLS-1$
-//                     /*
-//                      * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
-//                      * @since 3.0
-//                      */
-//                     protected IStatus run(IProgressMonitor monitor) {
-//                             CompilationUnit ast= JavaPlugin.getDefault().getASTProvider().getAST(inputElement, true, null);
-//                             if (fOverrideIndicatorManager != null) // editor might have been closed in the meanwhile
-//                                     fOverrideIndicatorManager.reconciled(ast, true, monitor);
-//                             return Status.OK_STATUS;
-//                     }
-//             };
-//             job.setPriority(Job.DECORATE);
-//             job.setSystem(true);
-//             job.schedule();
-//     }
-  }
-
-       /**
-        * Tells whether override indicators are shown.
-        * 
-        * @return <code>true</code> if the override indicators are shown
-        * @since 3.0
-        */
-//     protected boolean isShowingOverrideIndicators() {
-//             AnnotationPreference preference= getAnnotationPreferenceLookup().getAnnotationPreference(OverrideIndicatorManager.ANNOTATION_TYPE);
-//             IPreferenceStore store= getPreferenceStore();
-//             return getBoolean(store, preference.getHighlightPreferenceKey())
-//                     || getBoolean(store, preference.getVerticalRulerPreferenceKey())
-//                     || getBoolean(store, preference.getOverviewRulerPreferenceKey())
-//                     || getBoolean(store, preference.getTextPreferenceKey());
-//     }
+    uninstallOverrideIndicator();
+    IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
+    final IJavaElement inputElement = getInputJavaElement();
+
+    if (model == null || inputElement == null)
+      return;
+
+    // fOverrideIndicatorManager= new OverrideIndicatorManager(model, inputElement, null);
+    // 
+    // if (provideAST) {
+    //         Job job= new Job(JavaEditorMessages.getString("OverrideIndicatorManager.intallJob")) { //$NON-NLS-1$
+    //                 /*
+    //                  * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+    //                  * @since 3.0
+    //                  */
+    //                 protected IStatus run(IProgressMonitor monitor) {
+    //                         CompilationUnit ast= JavaPlugin.getDefault().getASTProvider().getAST(inputElement, true, null);
+    //                         if (fOverrideIndicatorManager != null) // editor might have been closed in the meanwhile
+    //                                 fOverrideIndicatorManager.reconciled(ast, true, monitor);
+    //                         return Status.OK_STATUS;
+    //                 }
+    //         };
+    //         job.setPriority(Job.DECORATE);
+    //         job.setSystem(true);
+    //         job.schedule();
+    // }
+  }
+
+  /**
+   * Tells whether override indicators are shown.
+   * 
+   * @return <code>true</code> if the override indicators are shown
+   * @since 3.0
+   */
+  //   protected boolean isShowingOverrideIndicators() {
+  //           AnnotationPreference preference=
+  // getAnnotationPreferenceLookup().getAnnotationPreference(OverrideIndicatorManager.ANNOTATION_TYPE);
+  //           IPreferenceStore store= getPreferenceStore();
+  //           return getBoolean(store, preference.getHighlightPreferenceKey())
+  //                   || getBoolean(store, preference.getVerticalRulerPreferenceKey())
+  //                   || getBoolean(store, preference.getOverviewRulerPreferenceKey())
+  //                   || getBoolean(store, preference.getTextPreferenceKey());
+  //   }
   /**
    * Returns the boolean preference for the given key.
    *