Source Code Cross Referenced for TextNavigationAction.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » texteditor » 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 » IDE Eclipse » ui workbench » org.eclipse.ui.texteditor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2005 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.ui.texteditor;
011:
012:        import org.eclipse.swt.SWT;
013:        import org.eclipse.swt.custom.StyledText;
014:        import org.eclipse.swt.events.HelpListener;
015:        import org.eclipse.swt.graphics.Point;
016:        import org.eclipse.swt.widgets.Event;
017:
018:        import org.eclipse.jface.action.Action;
019:        import org.eclipse.jface.action.IMenuCreator;
020:        import org.eclipse.jface.resource.ImageDescriptor;
021:        import org.eclipse.jface.util.IPropertyChangeListener;
022:
023:        /**
024:         * An <code>Action</code> wrapper for text widget navigation and selection actions.
025:         * @since 2.0
026:         */
027:        public class TextNavigationAction extends Action {
028:
029:            /** The text widget */
030:            private StyledText fTextWidget;
031:            /** The styled text action id */
032:            private int fAction;
033:            /** The action's action id */
034:            private String fActionId;
035:            /** This action's action definition id */
036:            private String fActionDefinitionId;
037:
038:            /**
039:             * Creates a new <code>TextNavigationAction</code>.
040:             * @param textWidget the text widget
041:             * @param action the styled text widget action
042:             */
043:            public TextNavigationAction(StyledText textWidget, int action) {
044:                fTextWidget = textWidget;
045:                fAction = action;
046:            }
047:
048:            /**
049:             * Returns the text widget this actions is bound to.
050:             *
051:             * @return returns the text widget this actions is bound to
052:             */
053:            protected StyledText getTextWidget() {
054:                return fTextWidget;
055:            }
056:
057:            /*
058:             * @see IAction#run()
059:             */
060:            public void run() {
061:                Point selection = fTextWidget.getSelection();
062:                fTextWidget.invokeAction(fAction);
063:                fireSelectionChanged(selection);
064:            }
065:
066:            private void doFireSelectionChanged(Point selection) {
067:                Event event = new Event();
068:                event.x = selection.x;
069:                event.y = selection.y;
070:                fTextWidget.notifyListeners(SWT.Selection, event);
071:            }
072:
073:            /**
074:             * Sends a selection event with the current selection to all
075:             * selection listeners of the action's text widget
076:             *
077:             * @since 3.0
078:             */
079:            protected void fireSelectionChanged() {
080:                fireSelectionChanged(null);
081:            }
082:
083:            /**
084:             * Fires a selection event to all selection listener of the action's
085:             * text widget if the current selection differs from the given selection.
086:             *
087:             * @param oldSelection the old selection
088:             * @since 3.0
089:             */
090:            protected void fireSelectionChanged(Point oldSelection) {
091:                Point selection = fTextWidget.getSelection();
092:                if (oldSelection == null || !selection.equals(oldSelection))
093:                    doFireSelectionChanged(selection);
094:            }
095:
096:            /*
097:             * @see IAction#runWithEvent(Event)
098:             */
099:            public void runWithEvent(Event event) {
100:                run();
101:            }
102:
103:            /*
104:             * @see IAction#setActionDefinitionId(String)
105:             */
106:            public void setActionDefinitionId(String id) {
107:                fActionDefinitionId = id;
108:            }
109:
110:            /*
111:             * @see IAction#getActionDefinitionId()
112:             */
113:            public String getActionDefinitionId() {
114:                return fActionDefinitionId;
115:            }
116:
117:            /*
118:             * @see IAction#setId(String)
119:             */
120:            public void setId(String id) {
121:                fActionId = id;
122:            }
123:
124:            /*
125:             * @see IAction#getId()
126:             */
127:            public String getId() {
128:                return fActionId;
129:            }
130:
131:            // ----------------------------------------------------------------------------------------------------------------------------------
132:            // All the subsequent methods are just empty method bodies.
133:
134:            /*
135:             * @see IAction#addPropertyChangeListener(IPropertyChangeListener)
136:             */
137:            public void addPropertyChangeListener(
138:                    IPropertyChangeListener listener) {
139:            }
140:
141:            /*
142:             * @see IAction#getAccelerator()
143:             */
144:            public int getAccelerator() {
145:                return 0;
146:            }
147:
148:            /*
149:             * @see IAction#getDescription()
150:             */
151:            public String getDescription() {
152:                return null;
153:            }
154:
155:            /*
156:             * @see IAction#getDisabledImageDescriptor()
157:             */
158:            public ImageDescriptor getDisabledImageDescriptor() {
159:                return null;
160:            }
161:
162:            /*
163:             * @see IAction#getHelpListener()
164:             */
165:            public HelpListener getHelpListener() {
166:                return null;
167:            }
168:
169:            /*
170:             * @see IAction#getHoverImageDescriptor()
171:             */
172:            public ImageDescriptor getHoverImageDescriptor() {
173:                return null;
174:            }
175:
176:            /*
177:             * @see IAction#getImageDescriptor()
178:             */
179:            public ImageDescriptor getImageDescriptor() {
180:                return null;
181:            }
182:
183:            /*
184:             * @see IAction#getMenuCreator()
185:             */
186:            public IMenuCreator getMenuCreator() {
187:                return null;
188:            }
189:
190:            /*
191:             * @see IAction#getStyle()
192:             */
193:            public int getStyle() {
194:                return 0;
195:            }
196:
197:            /*
198:             * @see IAction#getText()
199:             */
200:            public String getText() {
201:                return null;
202:            }
203:
204:            /*
205:             * @see IAction#getToolTipText()
206:             */
207:            public String getToolTipText() {
208:                return null;
209:            }
210:
211:            /*
212:             * @see IAction#isChecked()
213:             */
214:            public boolean isChecked() {
215:                return false;
216:            }
217:
218:            /*
219:             * @see IAction#isEnabled()
220:             */
221:            public boolean isEnabled() {
222:                return true;
223:            }
224:
225:            /*
226:             * @see IAction#removePropertyChangeListener(IPropertyChangeListener)
227:             */
228:            public void removePropertyChangeListener(
229:                    IPropertyChangeListener listener) {
230:            }
231:
232:            /*
233:             * @see org.eclipse.jface.action.IAction#setAccelerator(int)
234:             */
235:            public void setAccelerator(int keycode) {
236:            }
237:
238:            /*
239:             * @see IAction#setChecked(boolean)
240:             */
241:            public void setChecked(boolean checked) {
242:            }
243:
244:            /*
245:             * @see IAction#setDescription(String)
246:             */
247:            public void setDescription(String text) {
248:            }
249:
250:            /*
251:             * @see IAction#setDisabledImageDescriptor(ImageDescriptor)
252:             */
253:            public void setDisabledImageDescriptor(ImageDescriptor newImage) {
254:            }
255:
256:            /*
257:             * @see IAction#setEnabled(boolean)
258:             */
259:            public void setEnabled(boolean enabled) {
260:            }
261:
262:            /*
263:             * @see IAction#setHelpListener(HelpListener)
264:             */
265:            public void setHelpListener(HelpListener listener) {
266:            }
267:
268:            /*
269:             * @see IAction#setHoverImageDescriptor(ImageDescriptor)
270:             */
271:            public void setHoverImageDescriptor(ImageDescriptor newImage) {
272:            }
273:
274:            /*
275:             * @see IAction#setImageDescriptor(ImageDescriptor)
276:             */
277:            public void setImageDescriptor(ImageDescriptor newImage) {
278:            }
279:
280:            /*
281:             * @see IAction#setMenuCreator(IMenuCreator)
282:             */
283:            public void setMenuCreator(IMenuCreator creator) {
284:            }
285:
286:            /*
287:             * @see IAction#setText(String)
288:             */
289:            public void setText(String text) {
290:            }
291:
292:            /*
293:             * @see IAction#setToolTipText(String)
294:             */
295:            public void setToolTipText(String text) {
296:            }
297:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.