package com.framsticks.framclipse.framScript; import java.util.LinkedHashMap; import java.util.Map; import com.framsticks.framclipse.framScript.impl.VariableDeclarationImpl; import com.framsticks.framclipse.script.model.Element; import com.framsticks.framclipse.script.model.Type; public class ProposableVariableDeclarationImpl extends VariableDeclarationImpl implements Proposable { private final boolean type; private final String display, proposal; private final Map description = new LinkedHashMap(); public ProposableVariableDeclarationImpl(Element element) { assert !element.isFunction(); type = false; name = element.getName(); proposal = name; display = name + " : " + element.returnType(); createDescription(element); } public ProposableVariableDeclarationImpl(Type type) { this.type = true; name = type.getName(); proposal = name + "."; display = name; createDescription(type); } private void createDescription(Element element) { description.put("Description", element.getDescription()); description.put("Returns", element.returnType()); } private void createDescription(Type type) { description.put("Description", type.getDescription()); description.put("Context", type.getContext()); } @Override public String display() { return display; } @Override public String proposal() { return proposal; } @Override public Map description() { return description; } public boolean isType() { return type; } }