001 ///////////////////////////////////////////////// 002 // This file is part of Sears project. 003 // Subtitle Editor And Re-Synch 004 // A tool to easily modify and resynch movies subtitles. 005 ///////////////////////////////////////////////// 006 //This program is free software; 007 //you can redistribute it and/or modify it under the terms 008 //of the GNU General Public License 009 //as published by the Free Software Foundation; 010 //either version 2 of the License, or (at your option) any later version. 011 ///////////////////////////////////////////////// 012 //Sears project is availbale under sourceforge 013 // at adress: http://sourceforge.net/projects/sears/ 014 //Copyright (C) 2005 Booba Skaya 015 //Mail: booba.skaya@gmail.com 016 //////////////////////////////////////////////// 017 package sears.tools; 018 019 import javax.swing.AbstractAction; 020 import javax.swing.ImageIcon; 021 import javax.swing.KeyStroke; 022 import sears.gui.resources.SearsResources; 023 024 /** 025 * Class SearsAction. 026 * <br><b>Summary:</b><br> 027 * This class is an action for Sears. 028 * It is composed by a message, a tool tip and an icon. 029 * Use the resource facility to retrieve infos. 030 */ 031 public abstract class SearsAction extends AbstractAction { 032 public SearsAction(String actionTag) { 033 super(); 034 //Set action name 035 String name = //SearsResourceBundle.getString(actionTag + "Name"); 036 SearsResourceBundle.getResource(actionTag + "Name"); 037 if (name != null) { 038 putValue(NAME, name); 039 } 040 //Set action tool tip/ 041 String tip = //SearsResourceBundle.getString(actionTag + "Tip"); 042 SearsResourceBundle.getResource(actionTag + "Tip"); 043 if (tip != null) { 044 putValue(SHORT_DESCRIPTION, tip); 045 } 046 //Set action icon/ 047 ImageIcon icon= SearsResources.getIcon(actionTag + "Icon"); 048 if (icon != null) { 049 putValue(SMALL_ICON, icon); 050 } 051 //set a shortKey 052 KeyStroke key = SearsResources.getKey(actionTag+"Key"); 053 if(key != null){ 054 putValue(ACCELERATOR_KEY, key); 055 } 056 } 057 }