Source Code Cross Referenced for ActionContext.java in  » Swing-Library » jEdit » org » gjt » sp » jedit » 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 » Swing Library » jEdit » org.gjt.sp.jedit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ActionContext.java - For code sharing between jEdit and VFSBrowser
003:         * :tabSize=8:indentSize=8:noTabs=false:
004:         * :folding=explicit:collapseFolds=1:
005:         *
006:         * Copyright (C) 1998, 2003 Slava Pestov
007:         *
008:         * This program is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU General Public License
010:         * as published by the Free Software Foundation; either version 2
011:         * of the License, or any later version.
012:         *
013:         * This program is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         * GNU General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public License
019:         * along with this program; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
021:         */
022:
023:        package org.gjt.sp.jedit;
024:
025:        import java.util.*;
026:
027:        /**
028:         * Manages a collection of action sets. There are two instances of this class
029:         * in jEdit:
030:         * <ul>
031:         * <li>{@link org.gjt.sp.jedit.jEdit#getActionContext()} - editor actions
032:         * <li>{@link org.gjt.sp.jedit.browser.VFSBrowser#getActionContext()} - browser
033:         * actions
034:         * </ul>
035:         *
036:         * @since jEdit 4.2pre1
037:         * @author Slava Pestov
038:         * @version $Id: ActionContext.java 6884 2006-09-06 02:38:55Z ezust $
039:         */
040:        public abstract class ActionContext {
041:            //{{{ invokeAction() method
042:            /**
043:             * Invokes the given action in response to a user-generated event.
044:             * @param evt The event
045:             * @param action The action
046:             * @since jEdit 4.2pre1
047:             */
048:            public abstract void invokeAction(EventObject evt, EditAction action);
049:
050:            //}}}
051:
052:            //{{{ addActionSet() method
053:            /**
054:             * Adds a new action set to the context.
055:             * @since jEdit 4.2pre1
056:             */
057:            public void addActionSet(ActionSet actionSet) {
058:                actionNames = null;
059:                actionSets.addElement(actionSet);
060:                actionSet.context = this ;
061:                String[] actions = actionSet.getActionNames();
062:                for (int i = 0; i < actions.length; i++) {
063:                    /* Is it already there? */
064:                    if (actionHash.containsKey(actions[i])) {
065:                        /* Save it for plugin unloading time */
066:                        ActionSet oldAction = actionHash.get(actions[i]);
067:                        overriddenActions.put(actions[i], oldAction);
068:                    }
069:                    actionHash.put(actions[i], actionSet);
070:                }
071:            } //}}}
072:
073:            //{{{ removeActionSet() method
074:            /**
075:             * Removes an action set from the context.
076:             * @since jEdit 4.2pre1
077:             */
078:            public void removeActionSet(ActionSet actionSet) {
079:                actionNames = null;
080:                actionSets.removeElement(actionSet);
081:                actionSet.context = null;
082:                String[] actions = actionSet.getActionNames();
083:                for (int i = 0; i < actions.length; i++) {
084:                    actionHash.remove(actions[i]);
085:                    if (overriddenActions.containsKey(actions[i])) {
086:                        ActionSet oldAction = overriddenActions
087:                                .remove(actions[i]);
088:                        actionHash.put(actions[i], oldAction);
089:                    }
090:                }
091:            } //}}}
092:
093:            //{{{ getActionSets() method
094:            /**
095:             * Returns all registered action sets.
096:             * @since jEdit 4.2pre1
097:             */
098:            public ActionSet[] getActionSets() {
099:                ActionSet[] retVal = new ActionSet[actionSets.size()];
100:                actionSets.copyInto(retVal);
101:                return retVal;
102:            } //}}}
103:
104:            //{{{ getAction() method
105:            /**
106:             * Returns the specified action.
107:             * @param name The action name
108:             * @since jEdit 4.2pre1
109:             */
110:            public EditAction getAction(String name) {
111:                ActionSet set = (ActionSet) actionHash.get(name);
112:                if (set == null)
113:                    return null;
114:                else
115:                    return set.getAction(name);
116:            } //}}}
117:
118:            //{{{ getActionSetForAction() method
119:            /**
120:             * Returns the action set that contains the specified action.
121:             *
122:             * @param action The action
123:             * @since jEdit 4.2pre1
124:             */
125:            public ActionSet getActionSetForAction(String action) {
126:                return (ActionSet) actionHash.get(action);
127:            } //}}}
128:
129:            //{{{ getActionNames() method
130:            /**
131:             * Returns all registered action names.
132:             */
133:            public String[] getActionNames() {
134:                if (actionNames == null) {
135:                    List vec = new LinkedList();
136:                    for (int i = 0; i < actionSets.size(); i++)
137:                        (actionSets.elementAt(i)).getActionNames(vec);
138:
139:                    actionNames = (String[]) vec
140:                            .toArray(new String[vec.size()]);
141:                    Arrays.sort(actionNames,
142:                            new MiscUtilities.StringICaseCompare());
143:                }
144:
145:                return actionNames;
146:            } //}}}
147:
148:            //{{{ Package-private members
149:            String[] actionNames;
150:            Hashtable<String, ActionSet> actionHash = new Hashtable<String, ActionSet>();
151:
152:            /** A map of built-in actions that were overridden by plugins. */
153:            Hashtable<String, ActionSet> overriddenActions = new Hashtable<String, ActionSet>();
154:            //}}}
155:
156:            //{{{ Private members
157:            private Vector<ActionSet> actionSets = new Vector<ActionSet>();
158:            //}}}
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.