1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpeclipse.phpeditor;
13 import org.eclipse.ui.IActionBars;
14 import org.eclipse.ui.IEditorPart;
15 import org.eclipse.ui.texteditor.ITextEditor;
17 import net.sourceforge.phpdt.ui.actions.PHPdtActionConstants;
19 public class CompilationUnitEditorActionContributor extends BasicEditorActionContributor {
21 public CompilationUnitEditorActionContributor() {
26 * @see IEditorActionBarContributor#setActiveEditor(IEditorPart)
28 public void setActiveEditor(IEditorPart part) {
29 super.setActiveEditor(part);
31 ITextEditor textEditor= null;
32 if (part instanceof ITextEditor)
33 textEditor= (ITextEditor) part;
36 IActionBars bars= getActionBars();
37 bars.setGlobalActionHandler(PHPdtActionConstants.COMMENT, getAction(textEditor, "Comment")); //$NON-NLS-1$
38 bars.setGlobalActionHandler(PHPdtActionConstants.UNCOMMENT, getAction(textEditor, "Uncomment")); //$NON-NLS-1$
39 bars.setGlobalActionHandler(PHPdtActionConstants.TOGGLE_COMMENT, getAction(textEditor, "ToggleComment")); //$NON-NLS-1$
40 bars.setGlobalActionHandler(PHPdtActionConstants.FORMAT, getAction(textEditor, "Format")); //$NON-NLS-1$
41 bars.setGlobalActionHandler(PHPdtActionConstants.ADD_BLOCK_COMMENT, getAction(textEditor, "AddBlockComment")); //$NON-NLS-1$
42 bars.setGlobalActionHandler(PHPdtActionConstants.REMOVE_BLOCK_COMMENT, getAction(textEditor, "RemoveBlockComment")); //$NON-NLS-1$
43 bars.setGlobalActionHandler(PHPdtActionConstants.INDENT, getAction(textEditor, "Indent")); //$NON-NLS-1$ //$NON-NLS-2$