01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui;
11:
12: /**
13: * A editor action bar contributor defines the actions for
14: * one or more editors.
15: * <p>
16: * Within the workbench there may be more than one open editor of a particular
17: * type. For instance, there may be 1 or more open Java Editors. To avoid the
18: * creation of duplicate actions and action images the editor concept has been
19: * split into two. An action contributor is responsable for the creation of
20: * actions. The editor is responsible for action implementation. Furthermore,
21: * the contributor is shared by each open editor. As a result of this design
22: * there is only 1 set of actions for 1 or more open editors.
23: * </p><p>
24: * The relationship between editor and contributor is defined by
25: * the <code>org.eclipse.ui.editors</code> extension point in the plugin registry.
26: * For each extension an editor class and a contributor class must be defined.
27: * </p><p>
28: * This interface should not be implemented directly. An implementation of this
29: * interface has been created in <code>EditorActionBarContributor</code>.
30: * Implementors should subclass this and specialize as required.
31: * </p>
32: *
33: * @see IEditorActionBarContributor
34: */
35: public interface IEditorActionBarContributor {
36: /**
37: * Initializes this contributor, which is expected to add contributions as
38: * required to the given action bars and global action handlers.
39: * <p>
40: * The page is passed to support the use of <code>RetargetAction</code> by
41: * the contributor. In this case the init method implementors should:
42: * </p>
43: * <p><ul>
44: * <li>1) set retarget actions as global action handlers</li>
45: * <li>2) add the retarget actions as part listeners</li>
46: * <li>3) get the active part and if not <code>null</code>
47: * call partActivated on the retarget actions</li>
48: * </ul></p>
49: * <p>
50: * And in the dispose method the retarget actions should be removed as part listeners.
51: * </p>
52: *
53: * @param bars the action bars
54: * @param page the workbench page for this contributor
55: * @since 2.0
56: */
57: public void init(IActionBars bars, IWorkbenchPage page);
58:
59: /**
60: * Sets the active editor for the contributor.
61: * Implementors should disconnect from the old editor, connect to the
62: * new editor, and update the actions to reflect the new editor.
63: *
64: * @param targetEditor the new editor target
65: */
66: public void setActiveEditor(IEditorPart targetEditor);
67:
68: /**
69: * Disposes this contributor.
70: *
71: * @since 2.0
72: */
73: public void dispose();
74: }
|