Klaus Hartlage - www.eclipseproject.de
**********************************************************************/
-import java.util.ResourceBundle;
+import net.sourceforge.phpdt.ui.actions.*;
import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.editors.text.TextEditorActionContributor;
+import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.texteditor.BasicTextEditorActionContributor;
import org.eclipse.ui.texteditor.ITextEditor;
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 {
protected RetargetTextEditorAction fContentAssistProposal;
- protected RetargetTextEditorAction fContentAssistTip;
- protected TextEditorAction fTogglePresentation;
+ // protected RetargetTextEditorAction fContentAssistTip;
+ // protected TextEditorAction fTogglePresentation;
protected PHPParserAction parserAction;
/**
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();
}
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(PHPdtActionConstants.COMMENT, getAction(textEditor, "Comment"));
+ bars.setGlobalActionHandler(PHPdtActionConstants.UNCOMMENT, getAction(textEditor, "Uncomment"));
- fTogglePresentation.setEditor(editor);
- fTogglePresentation.update();
+ if (part instanceof PHPEditor) {
+ PHPEditor cuEditor= (PHPEditor)part;
+ ActionGroup group= cuEditor.getActionGroup();
+ if (group != null)
+ group.fillActionBars(bars);
+ }
+ // fTogglePresentation.setEditor(editor);
+ // fTogglePresentation.update();
- parserAction.setEditor(editor);
+ parserAction.setEditor(textEditor);
parserAction.update();
}
* @see IEditorActionBarContributor#setActiveEditor(IEditorPart)
*/
public void setActiveEditor(IEditorPart part) {
- super.setActiveEditor(part);
- doSetActiveEditor(part);
-
+ doSetActiveEditor(part);
}
/*