source: java/Framclipse/com.framsticks.framclipse/src/com/framsticks/framclipse/framScript/ProposableVariableDeclarationImpl.java @ 437

Last change on this file since 437 was 437, checked in by Mateusz Poszwa, 8 years ago

Added Framclipse as developed by Bartosz Kukawka and Tomek Maciejewski in 2010

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1package com.framsticks.framclipse.framScript;
2
3import java.util.LinkedHashMap;
4import java.util.Map;
5
6import com.framsticks.framclipse.framScript.impl.VariableDeclarationImpl;
7import com.framsticks.framclipse.script.model.Element;
8import com.framsticks.framclipse.script.model.Type;
9
10public class ProposableVariableDeclarationImpl extends VariableDeclarationImpl implements Proposable {
11
12        private final boolean type;
13        private final String display, proposal;
14        private final Map<String, String> description = new LinkedHashMap<String, String>();
15
16        public ProposableVariableDeclarationImpl(Element element) {
17                assert !element.isFunction();
18                type = false;
19                name = element.getName();
20                proposal = name;
21                display = name + " : " + element.returnType();
22                createDescription(element);
23        }
24
25        public ProposableVariableDeclarationImpl(Type type) {
26                this.type = true;
27                name = type.getName();
28                proposal = name + ".";
29                display = name;
30                createDescription(type);
31        }
32
33        private void createDescription(Element element) {
34                description.put("Description", element.getDescription());
35                description.put("Returns", element.returnType());
36        }
37
38        private void createDescription(Type type) {
39                description.put("Description", type.getDescription());
40                description.put("Context", type.getContext());
41        }
42
43        @Override
44        public String display() {
45                return display;
46        }
47
48        @Override
49        public String proposal() {
50                return proposal;
51        }
52
53        @Override
54        public Map<String, String> description() {
55                return description;
56        }
57       
58        public boolean isType() {
59                return type;
60        }
61
62}
Note: See TracBrowser for help on using the repository browser.