* Added browser like links (Ctrl+Mouseclick on identifier; same as F3 shortcut)
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPUnitEditor.java
index 56229b2..d1a3355 100644 (file)
@@ -17,7 +17,10 @@ import net.sourceforge.phpdt.core.JavaCore;
 import net.sourceforge.phpdt.core.JavaModelException;
 import net.sourceforge.phpdt.core.dom.CompilationUnit;
 import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
+import net.sourceforge.phpdt.internal.ui.actions.AddBlockCommentAction;
 import net.sourceforge.phpdt.internal.ui.actions.CompositeActionGroup;
+import net.sourceforge.phpdt.internal.ui.actions.IndentAction;
+import net.sourceforge.phpdt.internal.ui.actions.RemoveBlockCommentAction;
 import net.sourceforge.phpdt.internal.ui.text.ContentAssistPreference;
 import net.sourceforge.phpdt.internal.ui.text.IPHPPartitions;
 import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher;
@@ -44,7 +47,6 @@ import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Preferences;
-import net.sourceforge.phpeclipse.phpeditor.ICompilationUnitDocumentProvider;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuManager;
@@ -1318,7 +1320,7 @@ public class PHPUnitEditor extends PHPEditor { //implements
   private final static String ADD_JAVADOC_TAGS = PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS;
 
   /** Preference key for automatically formatting phpdocs */
-  private final static String FORMAT_JAVADOCS = PreferenceConstants.EDITOR_FORMAT_JAVADOCS;
+//  private final static String FORMAT_JAVADOCS = PreferenceConstants.EDITOR_FORMAT_JAVADOCS;
 
   /** Preference key for automatically closing strings */
   private final static String CLOSE_STRINGS_HTML = PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML;
@@ -1516,21 +1518,51 @@ public class PHPUnitEditor extends PHPEditor { //implements
     //         markAsStateDependentAction("IndentOnTab", true); //$NON-NLS-1$
     //         markAsSelectionDependentAction("IndentOnTab", true); //$NON-NLS-1$
     //         
+    
+    action= new AddBlockCommentAction(PHPEditorMessages.getResourceBundle(), "AddBlockComment.", this);  //$NON-NLS-1$
+       action.setActionDefinitionId(PHPEditorActionDefinitionIds.ADD_BLOCK_COMMENT);           
+       setAction("AddBlockComment", action); //$NON-NLS-1$
+       markAsStateDependentAction("AddBlockComment", true); //$NON-NLS-1$
+       markAsSelectionDependentAction("AddBlockComment", true); //$NON-NLS-1$          
+//     WorkbenchHelp.setHelp(action, IJavaHelpContextIds.ADD_BLOCK_COMMENT_ACTION);
+
+       action= new RemoveBlockCommentAction(PHPEditorMessages.getResourceBundle(), "RemoveBlockComment.", this);  //$NON-NLS-1$
+       action.setActionDefinitionId(PHPEditorActionDefinitionIds.REMOVE_BLOCK_COMMENT);                
+       setAction("RemoveBlockComment", action); //$NON-NLS-1$
+       markAsStateDependentAction("RemoveBlockComment", true); //$NON-NLS-1$
+       markAsSelectionDependentAction("RemoveBlockComment", true); //$NON-NLS-1$               
+//     WorkbenchHelp.setHelp(action, IJavaHelpContextIds.REMOVE_BLOCK_COMMENT_ACTION);
+       
+//     action= new IndentAction(PHPEditorMessages.getResourceBundle(), "Indent.", this, false); //$NON-NLS-1$
+//     action.setActionDefinitionId(PHPEditorActionDefinitionIds.INDENT);              
+//     setAction("Indent", action); //$NON-NLS-1$
+//     markAsStateDependentAction("Indent", true); //$NON-NLS-1$
+//     markAsSelectionDependentAction("Indent", true); //$NON-NLS-1$
+////   WorkbenchHelp.setHelp(action, IJavaHelpContextIds.INDENT_ACTION);
+//     
+       action= new IndentAction(PHPEditorMessages.getResourceBundle(), "Indent.", this, true); //$NON-NLS-1$
+       setAction("IndentOnTab", action); //$NON-NLS-1$
+       markAsStateDependentAction("IndentOnTab", true); //$NON-NLS-1$
+       markAsSelectionDependentAction("IndentOnTab", true); //$NON-NLS-1$
+       
     if (getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SMART_TAB)) {
       // don't replace Shift Right - have to make sure their enablement is
       // mutually exclusive
       //                       removeActionActivationCode(ITextEditorActionConstants.SHIFT_RIGHT);
       setActionActivationCode("IndentOnTab", '\t', -1, SWT.NONE); //$NON-NLS-1$
     }
-    fGenerateActionGroup = new GenerateActionGroup(this, ITextEditorActionConstants.GROUP_EDIT);
-    fActionGroups = new CompositeActionGroup(new ActionGroup[] { fGenerateActionGroup });
-    //   We have to keep the context menu group separate to have better
-    // control
-    // over positioning
-    fContextMenuGroup = new CompositeActionGroup(new ActionGroup[] { fGenerateActionGroup });
-    //      rg,
-    //      new LocalHistoryActionGroup(this,
-    // ITextEditorActionConstants.GROUP_EDIT)});
+    fGenerateActionGroup= new GenerateActionGroup(this, ITextEditorActionConstants.GROUP_EDIT);
+//    ActionGroup rg= new RefactorActionGroup(this, ITextEditorActionConstants.GROUP_EDIT);
+       
+//     fActionGroups.addGroup(rg);
+       fActionGroups.addGroup(fGenerateActionGroup);
+       
+       // We have to keep the context menu group separate to have better control over positioning
+       fContextMenuGroup= new CompositeActionGroup(new ActionGroup[] {
+               fGenerateActionGroup
+//             rg, 
+//             new LocalHistoryActionGroup(this, ITextEditorActionConstants.GROUP_EDIT)
+               });
 
   }
 
@@ -1715,78 +1747,6 @@ public class PHPUnitEditor extends PHPEditor { //implements
 //    return store.getBoolean(PRINT_MARGIN);
 //  }
 
-  //  private void startAnnotationIndication(AnnotationType annotationType) {
-  //    if (fProblemPainter == null) {
-  //      fProblemPainter = new ProblemPainter(this, getSourceViewer());
-  //// fPaintManager.addPainter(fProblemPainter);
-  //    }
-  //    fProblemPainter.setColor(annotationType, getColor(annotationType));
-  //    fProblemPainter.paintAnnotations(annotationType, true);
-  //    fProblemPainter.paint(IPainter.CONFIGURATION);
-  //  }
-  //
-  //  private void shutdownAnnotationIndication() {
-  //    if (fProblemPainter != null) {
-  //
-  //      if (!fProblemPainter.isPaintingAnnotations()) {
-  //// fPaintManager.removePainter(fProblemPainter);
-  //        fProblemPainter.deactivate(true);
-  //        fProblemPainter.dispose();
-  //        fProblemPainter = null;
-  //      } else {
-  //        fProblemPainter.paint(IPainter.CONFIGURATION);
-  //      }
-  //    }
-  //  }
-  //
-  //  private void stopAnnotationIndication(AnnotationType annotationType) {
-  //    if (fProblemPainter != null) {
-  //      fProblemPainter.paintAnnotations(annotationType, false);
-  //      shutdownAnnotationIndication();
-  //    }
-  //  }
-  //
-  //  private boolean isAnnotationIndicationEnabled(AnnotationType
-  // annotationType) {
-  //    IPreferenceStore store = getPreferenceStore();
-  //    AnnotationInfo info = (AnnotationInfo)
-  // ANNOTATION_MAP.get(annotationType);
-  //    if (info != null)
-  //      return store.getBoolean(info.fEditorPreference);
-  //    return false;
-  //  }
-  //
-  //  private boolean
-  // isAnnotationIndicationInOverviewRulerEnabled(AnnotationType
-  // annotationType) {
-  //    IPreferenceStore store = getPreferenceStore();
-  //    AnnotationInfo info = (AnnotationInfo)
-  // ANNOTATION_MAP.get(annotationType);
-  //    if (info != null)
-  //      return store.getBoolean(info.fOverviewRulerPreference);
-  //    return false;
-  //  }
-  //
-  //  private void showAnnotationIndicationInOverviewRuler(AnnotationType
-  // annotationType, boolean show) {
-  //    AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
-  //    OverviewRuler ruler = asv.getOverviewRuler();
-  //    if (ruler != null) {
-  //      ruler.setColor(annotationType, getColor(annotationType));
-  //      ruler.showAnnotation(annotationType, show);
-  //      ruler.update();
-  //    }
-  //  }
-  //
-  //  private void setColorInOverviewRuler(AnnotationType annotationType, Color
-  // color) {
-  //    AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
-  //    OverviewRuler ruler = asv.getOverviewRuler();
-  //    if (ruler != null) {
-  //      ruler.setColor(annotationType, color);
-  //      ruler.update();
-  //    }
-  //  }
 
   private int getTabSize() {
     Preferences preferences = PHPeclipsePlugin.getDefault().getPluginPreferences();
@@ -1798,30 +1758,6 @@ public class PHPUnitEditor extends PHPEditor { //implements
     return store.getBoolean(SPACES_FOR_TABS);
   }
 
-  //  private void showOverviewRuler() {
-  //    AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
-  //    asv.showOverviewRuler();
-  //
-  //    OverviewRuler overviewRuler = asv.getOverviewRuler();
-  //    if (overviewRuler != null) {
-  //      for (int i = 0; i < ANNOTATION_LAYERS.length; i++) {
-  //        AnnotationType type = ANNOTATION_LAYERS[i];
-  //        overviewRuler.setLayer(type, i);
-  //        if (isAnnotationIndicationInOverviewRulerEnabled(type))
-  //          showAnnotationIndicationInOverviewRuler(type, true);
-  //      }
-  //    }
-  //  }
-  //
-  //  private void hideOverviewRuler() {
-  //    AdaptedSourceViewer asv = (AdaptedSourceViewer) getSourceViewer();
-  //    asv.hideOverviewRuler();
-  //  }
-  //
-  //  private boolean isOverviewRulerVisible() {
-  //    IPreferenceStore store = getPreferenceStore();
-  //    return store.getBoolean(OVERVIEW_RULER);
-  //  }
   private Color getColor(String key) {
     RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), key);
     return getColor(rgb);