Source Code Cross Referenced for ToolCategory.java in  » GIS » udig-1.1 » net » refractions » udig » project » ui » internal » tool » display » 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 » GIS » udig 1.1 » net.refractions.udig.project.ui.internal.tool.display 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    uDig - User Friendly Desktop Internet GIS client
003:         *    http://udig.refractions.net
004:         *    (C) 2004, Refractions Research Inc.
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation;
009:         *    version 2.1 of the License.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         *
016:         */
017:        package net.refractions.udig.project.ui.internal.tool.display;
018:
019:        import java.util.Iterator;
020:        import java.util.LinkedList;
021:        import java.util.List;
022:
023:        import net.refractions.udig.project.ui.internal.Messages;
024:        import net.refractions.udig.project.ui.tool.IToolManager;
025:
026:        import org.eclipse.core.commands.Command;
027:        import org.eclipse.core.commands.IHandler;
028:        import org.eclipse.core.runtime.IConfigurationElement;
029:        import org.eclipse.jface.resource.ImageDescriptor;
030:        import org.eclipse.ui.IActionBars;
031:        import org.eclipse.ui.commands.ICommandService;
032:        import org.eclipse.ui.plugin.AbstractUIPlugin;
033:
034:        /**
035:         * Representation of a category, this is a UI construct.
036:         * 
037:         * @author jeichar
038:         * @since 0.9.0
039:         */
040:        public abstract class ToolCategory implements  Iterable<ModalItem> {
041:            /** The list of items in the category */
042:            public List<ModalItem> items = new LinkedList<ModalItem>();
043:
044:            /** The tool manager instance */
045:            protected IToolManager manager;
046:            /** id of the category */
047:            protected String id;
048:            /** name of the category */
049:            protected String name;
050:            private String commandId;
051:            private ImageDescriptor icon;
052:
053:            private boolean handlersSet = false;
054:
055:            protected IConfigurationElement element;
056:
057:            /**
058:             * Construct <code>ToolCategory</code>.
059:             * 
060:             * @param element the configurationelement that declares the category
061:             * @param manager the containing manager
062:             */
063:            protected ToolCategory(IConfigurationElement element,
064:                    IToolManager manager) {
065:                id = element.getAttribute("id"); //$NON-NLS-1$
066:                commandId = element.getAttribute("commandId"); //$NON-NLS-1$
067:                name = element.getAttribute("name"); //$NON-NLS-1$
068:                String iconPath = element.getAttribute("icon"); //$NON-NLS-1$
069:                if (iconPath != null)
070:                    icon = AbstractUIPlugin.imageDescriptorFromPlugin(element
071:                            .getNamespace(), iconPath);
072:                this .element = element;
073:                this .manager = manager;
074:            }
075:
076:            /**
077:             * Construct <code>ToolCategory2</code>.
078:             * 
079:             * @param manager
080:             */
081:            public ToolCategory(IToolManager manager) {
082:                this .manager = manager;
083:                id = Messages.ToolCategory_other;
084:                name = Messages.ToolCategory_other_menu;
085:                icon = null;
086:                commandId = null;
087:            }
088:
089:            public void dispose(IActionBars bars) {
090:                for (Iterator<ModalItem> iter = items.iterator(); iter
091:                        .hasNext();) {
092:                    ModalItem item = iter.next();
093:                    List<CurrentContributionItem> contributions = item
094:                            .getContributions();
095:                    for (CurrentContributionItem item2 : contributions) {
096:                        bars.getMenuManager().remove(item2);
097:                        bars.getToolBarManager().remove(item2);
098:                        bars.getStatusLineManager().remove(item2);
099:                    }
100:                    item.clearContributions();
101:                }
102:            }
103:
104:            /**
105:             * Add an item to the category
106:             * 
107:             * @param item the new item
108:             */
109:            public void add(ModalItem item) {
110:                items.add(item);
111:            }
112:
113:            /**
114:             * @return an iterator that iterates through the items in the category
115:             */
116:            public Iterator<ModalItem> iterator() {
117:                return items.iterator();
118:            }
119:
120:            /**
121:             * Sets the commandHandler for this category.
122:             * @param ids 
123:             */
124:            public void setCommandHandlers(ICommandService service) {
125:
126:                if (!handlersSet) {
127:                    if (commandId != null) {
128:                        Command command = service.getCommand(commandId);
129:                        if (command != null && getHandler() != null)
130:                            command.setHandler(getHandler());
131:                    }
132:                    handlersSet = true;
133:                }
134:            }
135:
136:            /**
137:             * Gets the command handler for the category.
138:             * 
139:             * @return the command handler for the category.
140:             */
141:            protected abstract IHandler getHandler();
142:
143:            /**
144:             * Gets the icon for the category.
145:             * 
146:             * @return the icon for the category.
147:             */
148:            public ImageDescriptor getIcon() {
149:                return icon;
150:            }
151:
152:            /**
153:             * Returns the id of the category
154:             * 
155:             * @return the id of the category
156:             */
157:            public String getId() {
158:                return id;
159:            }
160:
161:            /**
162:             * Returns the name of the category
163:             * 
164:             * @return the name of the category
165:             */
166:            public String getName() {
167:                return name;
168:            }
169:        }
w___w___w_.ja___va_2__s__.__c_o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.