2 * Copyright (c) 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 - Initial API and implementation
11 package net.sourceforge.phpeclipse.webbrowser.internal;
13 import org.eclipse.ui.IActionBars;
14 import org.eclipse.ui.IEditorActionBarContributor;
15 import org.eclipse.ui.IEditorPart;
16 import org.eclipse.ui.IWorkbenchPage;
17 import org.eclipse.ui.actions.ActionFactory;
20 * ActionBarContributor for the Web browser. Just adds cut, copy, paste actions.
22 public class WebBrowserEditorActionBarContributor implements
23 IEditorActionBarContributor {
24 protected IActionBars actionBars;
27 * WebBrowserEditorActionBarContributor constructor comment.
29 public WebBrowserEditorActionBarContributor() {
34 * Initializes this contributor, which is expected to add contributions as
35 * required to the given action bars and global action handlers.
40 public void init(IActionBars bars, IWorkbenchPage page) {
41 this.actionBars = bars;
45 * Sets the active editor for the contributor. Implementors should
46 * disconnect from the old editor, connect to the new editor, and update the
47 * actions to reflect the new editor.
50 * the new editor target
52 public void setActiveEditor(IEditorPart targetEditor) {
53 if (targetEditor instanceof WebBrowserEditor) {
54 WebBrowserEditor editor = (WebBrowserEditor) targetEditor;
56 actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),
57 editor.getCopyAction());
58 actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), editor
60 actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(),
61 editor.getPasteAction());
63 editor.updateActions();
68 * Disposes this contributor.
70 public void dispose() {