Source Code Cross Referenced for Action.java in  » UML » jrefactory » org » acm » seguin » ide » jedit » action » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » UML » jrefactory » org.acm.seguin.ide.jedit.action 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  This program is free software; you can redistribute it and/or
003:         *  modify it under the terms of the GNU General Public License
004:         *  as published by the Free Software Foundation; either version 2
005:         *  of the License, or any later version.
006:         *
007:         *  This program is distributed in the hope that it will be useful,
008:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
009:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
010:         *  GNU General Public License for more details.
011:         *
012:         *  You should have received a copy of the GNU General Public License
013:         *  along with this program; if not, write to the Free Software
014:         *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
015:         */
016:        package org.acm.seguin.ide.jedit.action;
017:
018:        import java.awt.event.ActionListener;
019:
020:        import javax.swing.Icon;
021:        import javax.swing.JMenuItem;
022:        import javax.swing.JComponent;
023:
024:        import org.gjt.sp.util.Log;
025:        import org.gjt.sp.jedit.gui.RolloverButton;
026:
027:        import org.acm.seguin.ide.jedit.JRefactory;
028:
029:        /**
030:         *  An action defines an action to be taken when the user presses some menu item
031:         *  in the tree's context menu or a button on the toolbar.
032:         *
033:         *@author     <a href="mailto:JRefactoryPlugin@ladyshot.demon.co.uk">Mike
034:         *      Atkinson</a>
035:         *@created    23 July 2003
036:         *@version    $Id: Action.java,v 1.1 2003/09/17 19:52:50 mikeatkinson Exp $
037:         *@since      0.0.1
038:         */
039:        public abstract class Action implements  ActionListener, Cloneable {
040:
041:            /**
042:             *  Description of the Field
043:             */
044:            protected JRefactory viewer;
045:            /**
046:             *  Description of the Field
047:             */
048:            protected RolloverButton tbButton;
049:            /**
050:             *  Description of the Field
051:             */
052:            protected JComponent cmItem;
053:
054:            /**
055:             *  Returns a String that will be shown as the text of the menu item or the
056:             *  tooltip of the toolbar button.
057:             *
058:             *@return    The text value
059:             */
060:            public abstract String getText();
061:
062:            /**
063:             *  Returns the icon to be shown on the toolbar button. The default
064:             *  implementation returns "null" so that actions that will only be used in
065:             *  the context menu don't need to implement this.
066:             *
067:             *@return    The icon value
068:             */
069:            public Icon getIcon() {
070:                return null;
071:            }
072:
073:            /**
074:             *  Returns the menu item that triggers this action. This returns a
075:             *  JComponent, which makes it possible to add virtually anything to the
076:             *  menu. For example, it's possible to return a sub-menu instead of a
077:             *  simple menu item. The default implementation returns a menu item, which
078:             *  is stored in the "cmItem" variable.
079:             *
080:             *@return    The menuItem value
081:             */
082:            public JComponent getMenuItem() {
083:                if (cmItem == null) {
084:                    cmItem = new JMenuItem(getText());
085:                    ((JMenuItem) cmItem).addActionListener(this );
086:                }
087:                return cmItem;
088:            }
089:
090:            /**
091:             *  Returns the toolbar button that triggers this action.
092:             *
093:             *@return    The button value
094:             */
095:            public RolloverButton getButton() {
096:                if (tbButton == null) {
097:                    Icon i = getIcon();
098:                    if (i != null) {
099:                        tbButton = new RolloverButton(getIcon());
100:                    } else {
101:                        tbButton = new RolloverButton();
102:                        tbButton.setText(getText());
103:                    }
104:                    tbButton.setToolTipText(getText());
105:                    tbButton.addActionListener(this );
106:                }
107:                return tbButton;
108:            }
109:
110:            /**
111:             *  Clones the current action, returning a copy of it.
112:             *
113:             *@return    Description of the Return Value
114:             */
115:            public Object clone() {
116:                try {
117:                    return super .clone();
118:                } catch (CloneNotSupportedException cnse) {
119:                    // should not happen
120:                    Log.log(Log.ERROR, this , cnse);
121:                    return null;
122:                }
123:            }
124:
125:            /**
126:             *  Sets the viewer where this action is being used.
127:             *
128:             *@param  viewer  The new viewer value
129:             */
130:            public void setViewer(JRefactory viewer) {
131:                this.viewer = viewer;
132:            }
133:
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.