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.*;
14 import org.eclipse.ui.actions.ActionFactory;
16 * ActionBarContributor for the Web browser.
17 * Just adds cut, copy, paste actions.
19 public class WebBrowserEditorActionBarContributor implements IEditorActionBarContributor {
20 protected IActionBars actionBars;
23 * WebBrowserEditorActionBarContributor constructor comment.
25 public WebBrowserEditorActionBarContributor() {
30 * Initializes this contributor, which is expected to add contributions as
31 * required to the given action bars and global action handlers.
33 * @param bars the action bars
35 public void init(IActionBars bars, IWorkbenchPage page) {
36 this.actionBars = bars;
40 * Sets the active editor for the contributor.
41 * Implementors should disconnect from the old editor, connect to the
42 * new editor, and update the actions to reflect the new editor.
44 * @param targetEditor the new editor target
46 public void setActiveEditor(IEditorPart targetEditor) {
47 if (targetEditor instanceof WebBrowserEditor) {
48 WebBrowserEditor editor = (WebBrowserEditor) targetEditor;
50 actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), editor.getCopyAction());
51 actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), editor.getCutAction());
52 actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), editor.getPasteAction());
54 editor.updateActions();
59 * Disposes this contributor.
61 public void dispose() { }