| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,21 +31,22 @@ | |||
| 31 | 31 | import org.eclipse.jdt.core.dom.TypeDeclaration; | |
| 32 | 32 | import org.eclipse.jdt.core.dom.VariableDeclarationFragment; | |
| 33 | 33 | ||
| 34 | - public class CompletionCandidate implements Comparable<CompletionCandidate>{ | ||
| 35 | - | ||
| 36 | - private String elementName; // | ||
| 37 | 34 | ||
| 35 | + public class CompletionCandidate implements Comparable<CompletionCandidate>{ | ||
| 36 | + private String elementName; | ||
| 38 | 37 | private String label; // the toString value | |
| 39 | - | ||
| 40 | 38 | private String completionString; | |
| 41 | - | ||
| 42 | 39 | private Object wrappedObject; | |
| 43 | - | ||
| 44 | 40 | private int type; | |
| 45 | 41 | ||
| 46 | - public static final int PREDEF_CLASS = 0, PREDEF_FIELD = 1, | ||
| 47 | - PREDEF_METHOD = 2, LOCAL_CLASS = 3, LOCAL_METHOD = 4, LOCAL_FIELD = 5, | ||
| 48 | - LOCAL_VAR = 6; | ||
| 42 | + static final int PREDEF_CLASS = 0; | ||
| 43 | + static final int PREDEF_FIELD = 1; | ||
| 44 | + static final int PREDEF_METHOD = 2; | ||
| 45 | + static final int LOCAL_CLASS = 3; | ||
| 46 | + static final int LOCAL_METHOD = 4; | ||
| 47 | + static final int LOCAL_FIELD = 5; | ||
| 48 | + static final int LOCAL_VAR = 6; | ||
| 49 | + | ||
| 49 | 50 | ||
| 50 | 51 | public CompletionCandidate(Method method) { | |
| 51 | 52 | method.getDeclaringClass().getName(); | |
@@ -72,7 +73,7 @@ public CompletionCandidate(Method method) { | |||
| 72 | 73 | type = PREDEF_METHOD; | |
| 73 | 74 | wrappedObject = method; | |
| 74 | 75 | } | |
| 75 | - | ||
| 76 | + | ||
| 76 | 77 | public Object getWrappedObject() { | |
| 77 | 78 | return wrappedObject; | |
| 78 | 79 | } | |
@@ -87,7 +88,7 @@ public CompletionCandidate(SingleVariableDeclaration svd) { | |||
| 87 | 88 | label = svd.getName() + " : " + svd.getType(); | |
| 88 | 89 | wrappedObject = svd; | |
| 89 | 90 | } | |
| 90 | - | ||
| 91 | + | ||
| 91 | 92 | public CompletionCandidate(VariableDeclarationFragment vdf) { | |
| 92 | 93 | completionString = vdf.getName().toString(); | |
| 93 | 94 | elementName = vdf.getName().toString(); | |
@@ -98,16 +99,16 @@ public CompletionCandidate(VariableDeclarationFragment vdf) { | |||
| 98 | 99 | label = vdf.getName() + " : " + ASTGenerator.extracTypeInfo2(vdf); | |
| 99 | 100 | wrappedObject = vdf; | |
| 100 | 101 | } | |
| 101 | - | ||
| 102 | + | ||
| 102 | 103 | public CompletionCandidate(MethodDeclaration method) { | |
| 103 | 104 | // log("ComCan " + method.getName()); | |
| 104 | 105 | elementName = method.getName().toString(); | |
| 105 | 106 | type = LOCAL_METHOD; | |
| 106 | - | ||
| 107 | + | ||
| 107 | 108 | @SuppressWarnings("unchecked") | |
| 108 | - List<ASTNode> params = (List<ASTNode>) | ||
| 109 | + List<ASTNode> params = (List<ASTNode>) | ||
| 109 | 110 | method.getStructuralProperty(MethodDeclaration.PARAMETERS_PROPERTY); | |
| 110 | - | ||
| 111 | + | ||
| 111 | 112 | StringBuilder label = new StringBuilder(elementName + "("); | |
| 112 | 113 | StringBuilder cstr = new StringBuilder(method.getName() + "("); | |
| 113 | 114 | for (int i = 0; i < params.size(); i++) { | |
@@ -145,18 +146,18 @@ public CompletionCandidate(Field f) { | |||
| 145 | 146 | // + matchedClass + " : " + "<font color=#777777>" | |
| 146 | 147 | // + matchedClass2.substring(0, d) + "</font>", matchedClass | |
| 147 | 148 | // + "</html>" | |
| 148 | - label = "<html>" + f.getName() + " : " + f.getType().getSimpleName() + | ||
| 149 | - " - <font color=#777777>" + f.getDeclaringClass().getSimpleName() + | ||
| 149 | + label = "<html>" + f.getName() + " : " + f.getType().getSimpleName() + | ||
| 150 | + " - <font color=#777777>" + f.getDeclaringClass().getSimpleName() + | ||
| 150 | 151 | "</font></html>"; | |
| 151 | 152 | completionString = elementName; | |
| 152 | 153 | wrappedObject = f; | |
| 153 | 154 | } | |
| 154 | 155 | ||
| 155 | - public CompletionCandidate(String name, String labelStr, String completionStr, int type) { | ||
| 156 | + public CompletionCandidate(String name, String labelStr, String completionStr, int type) { | ||
| 156 | 157 | elementName = name; | |
| 157 | 158 | label = labelStr; | |
| 158 | 159 | completionString = completionStr; | |
| 159 | - this.type = type; | ||
| 160 | + this.type = type; | ||
| 160 | 161 | } | |
| 161 | 162 | ||
| 162 | 163 | public CompletionCandidate(String name, int type) { | |
@@ -181,11 +182,11 @@ public String toString() { | |||
| 181 | 182 | public int getType() { | |
| 182 | 183 | return type; | |
| 183 | 184 | } | |
| 184 | - | ||
| 185 | + | ||
| 185 | 186 | public String getLabel() { | |
| 186 | 187 | return label; | |
| 187 | 188 | } | |
| 188 | - | ||
| 189 | + | ||
| 189 | 190 | public String getNoHtmlLabel(){ | |
| 190 | 191 | if(!label.contains("<html>")) { | |
| 191 | 192 | return label; | |
@@ -217,15 +218,15 @@ public int compareTo(CompletionCandidate cc) { | |||
| 217 | 218 | } | |
| 218 | 219 | return (elementName.compareTo(cc.getElementName())); | |
| 219 | 220 | } | |
| 220 | - | ||
| 221 | + | ||
| 221 | 222 | public void regenerateCompletionString(){ | |
| 222 | 223 | if (wrappedObject instanceof MethodDeclaration) { | |
| 223 | 224 | MethodDeclaration method = (MethodDeclaration)wrappedObject; | |
| 224 | - | ||
| 225 | + | ||
| 225 | 226 | @SuppressWarnings("unchecked") | |
| 226 | - List<ASTNode> params = (List<ASTNode>) | ||
| 227 | + List<ASTNode> params = (List<ASTNode>) | ||
| 227 | 228 | method.getStructuralProperty(MethodDeclaration.PARAMETERS_PROPERTY); | |
| 228 | - | ||
| 229 | + | ||
| 229 | 230 | StringBuilder label = new StringBuilder(elementName + "("); | |
| 230 | 231 | StringBuilder cstr = new StringBuilder(method.getName() + "("); | |
| 231 | 232 | for (int i = 0; i < params.size(); i++) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments