1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| package fff;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
public class EditorActionDelegate1 implements IEditorActionDelegate {
private IEditorPart editor;
/**
* Creates a new EditorActionDelegate.
*/
public EditorActionDelegate1() {
// do nothing
}
/* (non-Javadoc)
* Method declared on IActionDelegate
*/
public void run(IAction action) {
MessageDialog.openInformation(editor.getSite().getShell(), MessageUtil
.getString("Readme_Editor"), //$NON-NLS-1$
MessageUtil.getString(" my Editor_Action_executed")); //$NON-NLS-1$
}
/**
* The <code>EditorActionDelegate</code> implementation of this
* <code>IActionDelegate</code> method does nothing.
*
* Selection in the desktop has changed. Plugin provider
* can use it to change the availability of the action
* or to modify other presentation properties.
*
* <p>Action delegate cannot be notified about
* selection changes before it is loaded. For that reason,
* control of action's enable state should also be performed
* through simple XML rules defined for the extension
* point. These rules allow enable state control before
* the delegate has been loaded.</p>
*/
public void selectionChanged(IAction action, ISelection selection) {
// do nothing
}
/**
* The <code>EditorActionDelegate</code> implementation of this
* <code>IEditorActionDelegate</code> method remembers the active editor.
*
* The matching editor has been activated. Notification
* guarantees that only editors that match the type for which
* this action has been registered will be tracked.
*
* @param action action proxy that represents this delegate in the desktop
* @param editor the matching editor that has been activated
*/
public void setActiveEditor(IAction action, IEditorPart editor) {
this.editor = editor;
}
} |
Partager