Source Code Cross Referenced for CompCSConclusionTextListener.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » internal » ui » editor » cheatsheet » comp » details » 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 » Eclipse plug in development » org.eclipse.pde.internal.ui.editor.cheatsheet.comp.details 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2006, 2007 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.pde.internal.ui.editor.cheatsheet.comp.details;
011:
012:        import org.eclipse.jface.text.DocumentEvent;
013:        import org.eclipse.jface.text.IDocument;
014:        import org.eclipse.jface.text.IDocumentListener;
015:        import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSModelFactory;
016:        import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSOnCompletion;
017:        import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSTaskObject;
018:        import org.eclipse.pde.internal.core.util.PDETextHelper;
019:
020:        /**
021:         * CompCSEnclosingTextModifyListener
022:         *
023:         */
024:        public class CompCSConclusionTextListener implements  IDocumentListener {
025:
026:            private ICompCSTaskObject fDataTaskObject;
027:
028:            private boolean fBlockEvents;
029:
030:            /**
031:             * 
032:             */
033:            public CompCSConclusionTextListener() {
034:                fDataTaskObject = null;
035:                fBlockEvents = false;
036:            }
037:
038:            /**
039:             * @param block
040:             */
041:            public void setBlockEvents(boolean block) {
042:                fBlockEvents = block;
043:            }
044:
045:            /**
046:             * @return
047:             */
048:            public boolean getBlockEvents() {
049:                return fBlockEvents;
050:            }
051:
052:            /**
053:             * @param object
054:             */
055:            public void setData(ICompCSTaskObject object) {
056:                // Set data
057:                fDataTaskObject = object;
058:            }
059:
060:            /* (non-Javadoc)
061:             * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
062:             */
063:            public void documentAboutToBeChanged(DocumentEvent e) {
064:                // NO-OP
065:            }
066:
067:            /* (non-Javadoc)
068:             * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
069:             */
070:            public void documentChanged(DocumentEvent event) {
071:                // Check whether to handle this event
072:                if (fBlockEvents) {
073:                    return;
074:                }
075:                // Ensure the task object is defined
076:                if (fDataTaskObject == null) {
077:                    return;
078:                }
079:                // Get the text from the event
080:                IDocument document = event.getDocument();
081:                if (document == null) {
082:                    return;
083:                }
084:                String text = document.get().trim();
085:                // Determine whether a conclusion was specified
086:                boolean hasText = PDETextHelper.isDefined(text);
087:                if (hasText) {
088:                    // A conclusion was specified, update accordingly
089:                    updateConclusionText(text);
090:                } else {
091:                    // No conclusion was specified, remove any existing one
092:                    removeConclusionText(text);
093:                }
094:            }
095:
096:            /**
097:             * @param text
098:             */
099:            private void updateConclusionText(String text) {
100:                if (fDataTaskObject.getFieldOnCompletion() == null) {
101:                    // Create a new conclusion
102:                    addConclusionText(text);
103:                } else {
104:                    // Re-use the existing conclusion
105:                    modifyConclusionText(text);
106:                }
107:            }
108:
109:            /**
110:             * @param text
111:             */
112:            private void addConclusionText(String text) {
113:                ICompCSModelFactory factory = fDataTaskObject.getModel()
114:                        .getFactory();
115:                ICompCSOnCompletion conclusion = factory
116:                        .createCompCSOnCompletion(fDataTaskObject);
117:                conclusion.setFieldContent(text);
118:                fDataTaskObject.setFieldOnCompletion(conclusion);
119:            }
120:
121:            /**
122:             * @param text
123:             */
124:            private void modifyConclusionText(String text) {
125:                ICompCSOnCompletion conclusion = fDataTaskObject
126:                        .getFieldOnCompletion();
127:                conclusion.setFieldContent(text);
128:            }
129:
130:            /**
131:             * @param text
132:             */
133:            private void removeConclusionText(String text) {
134:                ICompCSOnCompletion conclusion = fDataTaskObject
135:                        .getFieldOnCompletion();
136:                if (conclusion != null) {
137:                    fDataTaskObject.setFieldOnCompletion(null);
138:                }
139:            }
140:
141:        }
w_w__w._j_a_va2___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.