[Japi-cvs] SF.net SVN: japi: [250] libs/swing-action/trunk/src/net/sf/japi/swing/ ReflectionAction.
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2006-12-03 22:16:24
|
Revision: 250 http://svn.sourceforge.net/japi/?rev=250&view=rev Author: christianhujer Date: 2006-12-03 14:16:22 -0800 (Sun, 03 Dec 2006) Log Message: ----------- Minor improvements. Modified Paths: -------------- libs/swing-action/trunk/src/net/sf/japi/swing/ReflectionAction.java Modified: libs/swing-action/trunk/src/net/sf/japi/swing/ReflectionAction.java =================================================================== --- libs/swing-action/trunk/src/net/sf/japi/swing/ReflectionAction.java 2006-12-03 16:23:37 UTC (rev 249) +++ libs/swing-action/trunk/src/net/sf/japi/swing/ReflectionAction.java 2006-12-03 22:16:22 UTC (rev 250) @@ -26,9 +26,10 @@ import java.lang.reflect.Method; import javax.swing.AbstractAction; import javax.swing.Icon; -import org.jetbrains.annotations.Nullable; import net.sf.japi.lang.SuperClassIterator; import static net.sf.japi.swing.ActionFactory.ACTION_ID; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** Action implementation which invokes the desired method using Reflection. * Usage example: @@ -90,6 +91,18 @@ putValue(REFLECTION_TARGET, target); } + /** Defines an <code>Action</code> object with the specified description string and a the specified icon. + * @param name description string + * @param icon icon + * @param methodName Name of method to invoke + * @param target Target object to invoke method at + */ + public ReflectionAction(final String name, final Icon icon, final String methodName, final Object target) { + super(name, icon); + putValue(REFLECTION_METHOD_NAME, methodName); + putValue(REFLECTION_TARGET, target); + } + /** {@inheritDoc} * This implementation checks the type of <var>newValue</var> if the <var>key</var> is {@link #REFLECTION_METHOD_NAME} or {@link * #REFLECTION_METHOD}, so you'll know of errors quite soon. @@ -119,18 +132,6 @@ super.putValue(key, newValue); } - /** Defines an <code>Action</code> object with the specified description string and a the specified icon. - * @param name description string - * @param icon icon - * @param methodName Name of method to invoke - * @param target Target object to invoke method at - */ - public ReflectionAction(final String name, final Icon icon, final String methodName, final Object target) { - super(name, icon); - putValue(REFLECTION_METHOD_NAME, methodName); - putValue(REFLECTION_TARGET, target); - } - /** {@inheritDoc} * The implementation of this method first looks whether the Action is enabled. * If it isn't, the method simply returns. @@ -156,7 +157,8 @@ final String dialogKey = getValue(ACTION_ID) + ".exception." + c.getName(); final String title = actionFactory.getString(dialogKey + ".title"); if (title != null) { - final Object source = e.getSource(); + // source cannot be null because the ActionEvent constructor will not allow a null source. + @NotNull final Object source = e.getSource(); final Component parent = source instanceof Component ? (Component) source : null; // TODO: find better alternative to null actionFactory.showMessageDialog(parent, dialogKey, cause.getLocalizedMessage()); return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |