|
What this is
Other links
The source code/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.openide.actions;
import java.io.IOException;
import org.openide.awt.StatusDisplayer;
import org.openide.ErrorManager;
import org.openide.util.HelpCtx;
import org.openide.util.actions.CookieAction;
import org.openide.nodes.Node;
import org.openide.cookies.SaveCookie;
import org.openide.util.NbBundle;
/** Save a single object.
* @see SaveCookie
*
* @author Jan Jancura, Petr Hamernik, Ian Formanek, Dafe Simonek
*/
public class SaveAction extends CookieAction {
protected Class[] cookieClasses () {
return new Class[] { SaveCookie.class };
}
protected void performAction (final Node[] activatedNodes) {
SaveCookie sc = (SaveCookie)activatedNodes[0].getCookie (SaveCookie.class);
// workaround the issue 44501, SaveAction can be invoked repeatedly
if (sc == null) return ;
try {
sc.save();
StatusDisplayer.getDefault().setStatusText(
NbBundle.getMessage(
SaveAction.class,
"MSG_saved",
getSaveMessage(activatedNodes[0])
)
);
}
catch (IOException e) {
ErrorManager err = ErrorManager.getDefault ();
err.annotate (e, NbBundle.getMessage (
SaveAction.class,
"EXC_notsaved",
getSaveMessage (activatedNodes[0])
));
err.notify (e);
}
}
protected boolean asynchronous() {
return false;
}
private static Class dataObject;
private static java.lang.reflect.Method getNodeDelegate;
/**
* Extract a suitable after-save message. Will call
*
|
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.