misc changes
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPActionContributor.java
index 6f35ce5..84fdf1c 100644 (file)
@@ -26,16 +26,13 @@ import org.eclipse.ui.texteditor.RetargetTextEditorAction;
 import org.eclipse.ui.texteditor.TextEditorAction;
 
 /**
- * Contributes interesting Java actions to the desktop's Edit menu and the toolbar.
+ * Contributes interesting PHP actions to the desktop's Edit menu and the toolbar.
  */
-public class PHPActionContributor extends TextEditorActionContributor {
+public class PHPActionContributor extends BasicTextEditorActionContributor implements PHPEditorActionDefinitionIds {
 
-  public static final String COMMENT = "net.sourceforge.phpeclipse.phpeditor.comment";
-  public static final String UNCOMMENT = "net.sourceforge.phpeclipse.phpeditor.uncomment";
-  
   protected RetargetTextEditorAction fContentAssistProposal;
-  protected RetargetTextEditorAction fContentAssistTip;
-  protected TextEditorAction fTogglePresentation;
+  // protected RetargetTextEditorAction fContentAssistTip;
+  // protected TextEditorAction fTogglePresentation;
   protected PHPParserAction parserAction;
 
   /**
@@ -44,8 +41,8 @@ public class PHPActionContributor extends TextEditorActionContributor {
   public PHPActionContributor() {
     super();
     fContentAssistProposal = new RetargetTextEditorAction(PHPEditorMessages.getResourceBundle(), "ContentAssistProposal."); //$NON-NLS-1$
-    fContentAssistTip = new RetargetTextEditorAction(PHPEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$
-    fTogglePresentation = new PresentationAction();
+    //  fContentAssistTip = new RetargetTextEditorAction(PHPEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$
+    //  fTogglePresentation = new PresentationAction();
     parserAction = PHPParserAction.getInstance();
   }
 
@@ -60,34 +57,34 @@ public class PHPActionContributor extends TextEditorActionContributor {
     if (editMenu != null) {
       editMenu.add(new Separator());
       editMenu.add(fContentAssistProposal);
-      editMenu.add(fContentAssistTip);
+      //   editMenu.add(fContentAssistTip);
     }
 
-    IToolBarManager toolBarManager = bars.getToolBarManager();
-    if (toolBarManager != null) {
-      toolBarManager.add(new Separator());
-      toolBarManager.add(fTogglePresentation);
-    }
+    //    IToolBarManager toolBarManager = bars.getToolBarManager();
+    //    if (toolBarManager != null) {
+    //      toolBarManager.add(new Separator());
+    //      toolBarManager.add(fTogglePresentation);
+    //    }
   }
 
   private void doSetActiveEditor(IEditorPart part) {
     super.setActiveEditor(part);
 
-    ITextEditor editor = null;
+    ITextEditor textEditor = null;
     if (part instanceof ITextEditor)
-      editor = (ITextEditor) part;
+      textEditor = (ITextEditor) part;
+
+    fContentAssistProposal.setAction(getAction(textEditor, "ContentAssistProposal")); //$NON-NLS-1$
+    //  fContentAssistTip.setAction(getAction(editor, "ContentAssistTip")); //$NON-NLS-1$
 
-    fContentAssistProposal.setAction(getAction(editor, "ContentAssistProposal")); //$NON-NLS-1$
-    fContentAssistTip.setAction(getAction(editor, "ContentAssistTip")); //$NON-NLS-1$
+    IActionBars bars = getActionBars();
+    bars.setGlobalActionHandler(COMMENT, getAction(textEditor, "Comment"));
+    bars.setGlobalActionHandler(UNCOMMENT, getAction(textEditor, "Uncomment"));
 
-    IActionBars bars= getActionBars();    
-    bars.setGlobalActionHandler(COMMENT, getAction(editor, "Comment"));
-    bars.setGlobalActionHandler(UNCOMMENT, getAction(editor, "Uncomment"));
-    
-    fTogglePresentation.setEditor(editor);
-    fTogglePresentation.update();
+    //    fTogglePresentation.setEditor(editor);
+    //    fTogglePresentation.update();
 
-    parserAction.setEditor(editor);
+    parserAction.setEditor(textEditor);
     parserAction.update();
   }