View Javadoc
1 package org.argosfields.action; 2 3 import org.argosfields.ArgosFields; 4 import org.argosfields.resource.ResourceManager; 5 import org.eclipse.jface.action.Action; 6 import org.eclipse.jface.action.IAction; 7 import org.eclipse.swt.SWT; 8 9 /*** 10 * BaseAction.java 11 * @author Xavier Cho 12 * @version $Revision: 1.2 $ $Date: 2003/10/21 14:59:48 $ 13 */ 14 public abstract class BaseAction extends Action { 15 public static final String ACCELERATOR = "accelerator"; 16 17 private ArgosFields application; 18 19 private BaseAction() { 20 } 21 22 public BaseAction(final ArgosFields application) { 23 this(application, IAction.AS_UNSPECIFIED); 24 } 25 26 public BaseAction(final ArgosFields application, final int style) { 27 super(null, style); 28 29 if (application == null) { 30 SWT.error(SWT.ERROR_NULL_ARGUMENT); 31 } 32 33 this.application = application; 34 35 ResourceManager resources = ResourceManager.getInstance(); 36 37 String prefix = getId().concat("."); 38 39 setText(resources.getString(prefix.concat(TEXT))); 40 setDescription(resources.getString(prefix.concat(DESCRIPTION))); 41 setImageDescriptor(resources.getImageDescriptor(prefix.concat(IMAGE))); 42 setToolTipText(getDescription()); 43 44 String accelerator = resources.getString(prefix.concat(ACCELERATOR)); 45 if (accelerator != null) { 46 setAccelerator(Action.convertAccelerator(accelerator)); 47 } 48 } 49 50 protected ArgosFields getApplication() { 51 return application; 52 } 53 54 public String getId() { 55 return getClass().getName(); 56 } 57 }

This page was automatically generated by Maven