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


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 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.jdt.internal.ui.text.java;
011:
012:        import org.eclipse.core.runtime.Assert;
013:
014:        import org.eclipse.swt.graphics.Image;
015:
016:        import org.eclipse.jface.text.IDocument;
017:
018:        import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
019:
020:        public class JavaCompletionProposal extends
021:                AbstractJavaCompletionProposal {
022:
023:            /**
024:             * Creates a new completion proposal. All fields are initialized based on the provided
025:             * information.
026:             * 
027:             * @param replacementString the actual string to be inserted into the document
028:             * @param replacementOffset the offset of the text to be replaced
029:             * @param replacementLength the length of the text to be replaced
030:             * @param image the image to display for this proposal
031:             * @param displayString the string to be displayed for the proposal If set to <code>null</code>, the replacement string will be taken as display string.
032:             * @param relevance the relevance
033:             */
034:            public JavaCompletionProposal(String replacementString,
035:                    int replacementOffset, int replacementLength, Image image,
036:                    String displayString, int relevance) {
037:                this (replacementString, replacementOffset, replacementLength,
038:                        image, displayString, relevance, false);
039:            }
040:
041:            /**
042:             * Creates a new completion proposal. All fields are initialized based on the provided
043:             * information.
044:             * 
045:             * @param replacementString the actual string to be inserted into the document
046:             * @param replacementOffset the offset of the text to be replaced
047:             * @param replacementLength the length of the text to be replaced
048:             * @param image the image to display for this proposal
049:             * @param displayString the string to be displayed for the proposal If set to <code>null</code>,
050:             *        the replacement string will be taken as display string.
051:             * @param relevance the relevance
052:             * @param inJavadoc <code>true</code> for a javadoc proposal
053:             * @since 3.2
054:             */
055:            public JavaCompletionProposal(String replacementString,
056:                    int replacementOffset, int replacementLength, Image image,
057:                    String displayString, int relevance, boolean inJavadoc) {
058:                this (replacementString, replacementOffset, replacementLength,
059:                        image, displayString, relevance, inJavadoc, null);
060:            }
061:
062:            /**
063:             * Creates a new completion proposal. All fields are initialized based on the provided
064:             * information.
065:             * 
066:             * @param replacementString the actual string to be inserted into the document
067:             * @param replacementOffset the offset of the text to be replaced
068:             * @param replacementLength the length of the text to be replaced
069:             * @param image the image to display for this proposal
070:             * @param displayString the string to be displayed for the proposal If set to <code>null</code>,
071:             *        the replacement string will be taken as display string.
072:             * @param relevance the relevance
073:             * @param inJavadoc <code>true</code> for a javadoc proposal
074:             * @param invocationContext the invocation context of this completion proposal or <code>null</code> not available
075:             * @since 3.3
076:             */
077:            public JavaCompletionProposal(String replacementString,
078:                    int replacementOffset, int replacementLength, Image image,
079:                    String displayString, int relevance, boolean inJavadoc,
080:                    JavaContentAssistInvocationContext invocationContext) {
081:                super (invocationContext);
082:                Assert.isNotNull(replacementString);
083:                Assert.isTrue(replacementOffset >= 0);
084:                Assert.isTrue(replacementLength >= 0);
085:
086:                setReplacementString(replacementString);
087:                setReplacementOffset(replacementOffset);
088:                setReplacementLength(replacementLength);
089:                setImage(image);
090:                setDisplayString(displayString == null ? replacementString
091:                        : displayString);
092:                setRelevance(relevance);
093:                setCursorPosition(replacementString.length());
094:                setInJavadoc(inJavadoc);
095:                setSortString(displayString == null ? replacementString
096:                        : displayString);
097:            }
098:
099:            /*
100:             * @see org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal#isValidPrefix(java.lang.String)
101:             */
102:            protected boolean isValidPrefix(String prefix) {
103:                String word = getDisplayString();
104:                if (isInJavadoc()) {
105:                    int idx = word.indexOf("{@link "); //$NON-NLS-1$
106:                    if (idx == 0) {
107:                        word = word.substring(7);
108:                    } else {
109:                        idx = word.indexOf("{@value "); //$NON-NLS-1$
110:                        if (idx == 0) {
111:                            word = word.substring(8);
112:                        }
113:                    }
114:                } else if (word.indexOf("this.") != -1) { //$NON-NLS-1$
115:                    word = word.substring(word.indexOf("this.") + 5); //$NON-NLS-1$
116:                }
117:                return isPrefix(prefix, word);
118:            }
119:
120:            /*
121:             * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension3#getReplacementText()
122:             */
123:            public CharSequence getPrefixCompletionText(IDocument document,
124:                    int completionOffset) {
125:                String string = getReplacementString();
126:                int pos = string.indexOf('(');
127:                if (pos > 0)
128:                    return string.subSequence(0, pos);
129:                else if (string.startsWith("this.")) //$NON-NLS-1$
130:                    return string.substring(5);
131:                else
132:                    return string;
133:            }
134:        }
w_w___w_._j___a_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.