mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 10:30:44 +01:00
completion panel type bugfix
This commit is contained in:
@@ -5,6 +5,7 @@ import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jdt.core.dom.ASTNode;
|
||||
import org.eclipse.jdt.core.dom.FieldDeclaration;
|
||||
import org.eclipse.jdt.core.dom.MethodDeclaration;
|
||||
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
|
||||
import org.eclipse.jdt.core.dom.TypeDeclaration;
|
||||
@@ -27,7 +28,6 @@ public class CompletionCandidate implements Comparable<CompletionCandidate>{
|
||||
public CompletionCandidate(Method method) {
|
||||
method.getDeclaringClass().getName();
|
||||
elementName = method.getName();
|
||||
type = LOCAL_METHOD;
|
||||
StringBuffer label = new StringBuffer(method.getName() + "(");
|
||||
StringBuffer cstr = new StringBuffer(method.getName() + "(");
|
||||
for (int i = 0; i < method.getParameterTypes().length; i++) {
|
||||
@@ -53,14 +53,20 @@ public class CompletionCandidate implements Comparable<CompletionCandidate>{
|
||||
public CompletionCandidate(SingleVariableDeclaration svd) {
|
||||
completionString = svd.getName().toString();
|
||||
elementName = svd.getName().toString();
|
||||
type = LOCAL_VAR;
|
||||
if(svd.getParent() instanceof FieldDeclaration)
|
||||
type = LOCAL_FIELD;
|
||||
else
|
||||
type = LOCAL_VAR;
|
||||
label = svd.getName() + " : " + svd.getType();
|
||||
}
|
||||
|
||||
public CompletionCandidate(VariableDeclarationFragment vdf) {
|
||||
completionString = vdf.getName().toString();
|
||||
elementName = vdf.getName().toString();
|
||||
type = LOCAL_VAR;
|
||||
if(vdf.getParent() instanceof FieldDeclaration)
|
||||
type = LOCAL_FIELD;
|
||||
else
|
||||
type = LOCAL_VAR;
|
||||
label = vdf.getName() + " : " + ASTGenerator.extracTypeInfo2(vdf);
|
||||
}
|
||||
|
||||
|
||||
@@ -214,6 +214,9 @@ public class CompletionPanel {
|
||||
if (value instanceof CompletionCandidate) {
|
||||
CompletionCandidate cc = (CompletionCandidate) value;
|
||||
switch (cc.getType()) {
|
||||
case CompletionCandidate.LOCAL_VAR:
|
||||
label.setIcon(editor.dmode.localVarIcon);
|
||||
break;
|
||||
case CompletionCandidate.LOCAL_FIELD:
|
||||
case CompletionCandidate.PREDEF_FIELD:
|
||||
label.setIcon(editor.dmode.fieldIcon);
|
||||
@@ -228,10 +231,14 @@ public class CompletionPanel {
|
||||
break;
|
||||
|
||||
default:
|
||||
log("(CustomListRenderer)Unknown CompletionCandidate type " + cc.getType());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
log("(CustomListRenderer)Unknown CompletionCandidate object " + value);
|
||||
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class ExperimentalMode extends JavaMode {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
protected ImageIcon classIcon, fieldIcon, methodIcon;
|
||||
protected ImageIcon classIcon, fieldIcon, methodIcon, localVarIcon;
|
||||
protected void loadIcons(){
|
||||
String iconPath = getContentFile("data")
|
||||
.getAbsolutePath()
|
||||
@@ -171,6 +171,8 @@ public class ExperimentalMode extends JavaMode {
|
||||
+ "methpub_obj.png");
|
||||
fieldIcon = new ImageIcon(iconPath + File.separator
|
||||
+ "field_protected_obj.png");
|
||||
localVarIcon = new ImageIcon(iconPath + File.separator
|
||||
+ "field_default_obj.png");
|
||||
log("Icons loaded");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user