1 /******************************************************************************* 2 * Copyright (c) 2000, 2008 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.ui.texteditor; 15 16 import java.util.ResourceBundle; 17 18 19 /** 20 * Action for saving recent changes made in the text editor. The action is initially associated with 21 * a text editor via the constructor, but that can be subsequently changed using 22 * <code>setEditor</code>. 23 * <p> 24 * This class may be instantiated; it is not intended to be subclassed. 25 * </p> 26 * 27 * @noextend This class is not intended to be subclassed by clients. 28 * @deprecated As of 3.5, replaced by {@link org.eclipse.ui.actions.ActionFactory#SAVE} 29 */ 30 @Deprecated 31 public class SaveAction extends TextEditorAction { 32 33 /** 34 * Creates a new action for the given text editor. The action configures its 35 * visual representation from the given resource bundle. 36 * 37 * @param bundle the resource bundle 38 * @param prefix a prefix to be prepended to the various resource keys 39 * (described in <code>ResourceAction</code> constructor), or 40 * <code>null</code> if none 41 * @param editor the text editor 42 * @see TextEditorAction#TextEditorAction(ResourceBundle, String, ITextEditor) 43 */ SaveAction(ResourceBundle bundle, String prefix, ITextEditor editor)44 public SaveAction(ResourceBundle bundle, String prefix, ITextEditor editor) { 45 super(bundle, prefix, editor); 46 } 47 48 @Override run()49 public void run() { 50 getTextEditor().getSite().getPage().saveEditor(getTextEditor(), false); 51 } 52 53 @Override update()54 public void update() { 55 setEnabled(getTextEditor().isDirty()); 56 } 57 } 58