Skip to content

Commit f66a5f3

Browse files
committed
removed code that is not used anymore
1 parent 2d86e09 commit f66a5f3

File tree

1 file changed

+0
-206
lines changed

1 file changed

+0
-206
lines changed

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/beans/DependsOnCompletionProcessor.java

Lines changed: 0 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -37,212 +37,6 @@ public DependsOnCompletionProcessor(SpringMetamodelIndex springIndex) {
3737
this.springIndex = springIndex;
3838
}
3939

40-
// @Override
41-
// public void provideCompletions(ASTNode node, Annotation annotation, ITypeBinding type, int offset, TextDocument doc, Collection<ICompletionProposal> completions) {
42-
//
43-
// Optional<IJavaProject> optionalProject = projectFinder.find(doc.getId());
44-
// if (!optionalProject.isPresent()) {
45-
// return;
46-
// }
47-
//
48-
// IJavaProject project = optionalProject.get();
49-
//
50-
// try {
51-
//
52-
// // case: @DependsOn(<*>)
53-
// if (node == annotation && doc.get(offset - 1, 2).endsWith("()")) {
54-
// Bean[] beans = this.springIndex.getBeansOfProject(project.getElementName());
55-
//
56-
// for (Bean bean : beans) {
57-
//
58-
// DocumentEdits edits = new DocumentEdits(doc, false);
59-
// edits.replace(offset, offset, "\"" + bean.getName() + "\"");
60-
//
61-
// DependsOnCompletionProposal proposal = new DependsOnCompletionProposal(edits, bean.getName(), bean.getName(), null);
62-
//
63-
// completions.add(proposal);
64-
// }
65-
// }
66-
// // case: @DependsOn(prefix<*>)
67-
// else if (node instanceof SimpleName && node.getParent() instanceof Annotation) {
68-
// computeProposalsForSimpleName(project, node, completions, offset, doc);
69-
// }
70-
// // case: @DependsOn(value=<*>)
71-
// else if (node instanceof SimpleName && node.getParent() instanceof MemberValuePair
72-
// && "value".equals(((MemberValuePair)node.getParent()).getName().toString())) {
73-
// computeProposalsForSimpleName(project, node, completions, offset, doc);
74-
// }
75-
// // case: @DependsOn("prefix<*>")
76-
// else if (node instanceof StringLiteral && node.getParent() instanceof Annotation) {
77-
// if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
78-
// computeProposalsForStringLiteral(project, node, completions, offset, doc);
79-
// }
80-
// }
81-
// else if (node instanceof StringLiteral && node.getParent() instanceof ArrayInitializer) {
82-
// if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
83-
// computeProposalsForInsideArrayInitializer(project, node, completions, offset, doc);
84-
// }
85-
// }
86-
// // case: @DependsOn(value="prefix<*>")
87-
// else if (node instanceof StringLiteral && node.getParent() instanceof MemberValuePair
88-
// && "value".equals(((MemberValuePair)node.getParent()).getName().toString())) {
89-
// if (node.toString().startsWith("\"") && node.toString().endsWith("\"")) {
90-
// computeProposalsForStringLiteral(project, node, completions, offset, doc);
91-
// }
92-
// }
93-
// // case: @DependsOn({<*>})
94-
// else if (node instanceof ArrayInitializer && node.getParent() instanceof Annotation) {
95-
// computeProposalsForArrayInitializr(project, (ArrayInitializer) node, completions, offset, doc);
96-
// }
97-
// }
98-
// catch (Exception e) {
99-
// e.printStackTrace();
100-
// }
101-
// }
102-
//
103-
// private void computeProposalsForSimpleName(IJavaProject project, ASTNode node, Collection<ICompletionProposal> completions, int offset, IDocument doc) {
104-
// String prefix = identifyPropertyPrefix(node.toString(), offset - node.getStartPosition());
105-
//
106-
// int startOffset = node.getStartPosition();
107-
// int endOffset = node.getStartPosition() + node.getLength();
108-
//
109-
// String proposalPrefix = "\"";
110-
// String proposalPostfix = "\"";
111-
//
112-
// Set<String> mentionedBeans = alreadyMentionedBeans(node);
113-
//
114-
// Bean[] beans = this.springIndex.getBeansOfProject(project.getElementName());
115-
// List<Bean> matchingBeans = Arrays.stream(beans)
116-
// .filter(bean -> bean.getName().toLowerCase().startsWith(prefix.toLowerCase()))
117-
// .filter(bean -> !mentionedBeans.contains(bean.getName()))
118-
// .collect(Collectors.toList());
119-
//
120-
// for (Bean bean : matchingBeans) {
121-
//
122-
// DocumentEdits edits = new DocumentEdits(doc, false);
123-
// edits.replace(startOffset, endOffset, proposalPrefix + bean.getName() + proposalPostfix);
124-
//
125-
// DependsOnCompletionProposal proposal = new DependsOnCompletionProposal(edits, bean.getName(), bean.getName(), null);
126-
//
127-
// completions.add(proposal);
128-
// }
129-
// }
130-
//
131-
// private void computeProposalsForStringLiteral(IJavaProject project, ASTNode node, Collection<ICompletionProposal> completions, int offset, IDocument doc) throws BadLocationException {
132-
// int length = offset - (node.getStartPosition() + 1);
133-
//
134-
// String prefix = identifyPropertyPrefix(doc.get(node.getStartPosition() + 1, length), length);
135-
// int startOffset = offset - prefix.length();
136-
// int endOffset = offset;
137-
//
138-
// Set<String> mentionedBeans = alreadyMentionedBeans(node);
139-
//
140-
// Bean[] beans = this.springIndex.getBeansOfProject(project.getElementName());
141-
//
142-
// final String filterPrefix = prefix;
143-
// List<Bean> matchingBeans = Arrays.stream(beans)
144-
// .filter(bean -> bean.getName().toLowerCase().startsWith(filterPrefix.toLowerCase()))
145-
// .filter(bean -> !mentionedBeans.contains(bean.getName()))
146-
// .collect(Collectors.toList());
147-
//
148-
// for (Bean bean : matchingBeans) {
149-
//
150-
// DocumentEdits edits = new DocumentEdits(doc, false);
151-
// edits.replace(startOffset, endOffset, bean.getName());
152-
//
153-
// DependsOnCompletionProposal proposal = new DependsOnCompletionProposal(edits, bean.getName(), bean.getName(), null);
154-
//
155-
// completions.add(proposal);
156-
// }
157-
// }
158-
//
159-
// private void computeProposalsForArrayInitializr(IJavaProject project, ArrayInitializer node, Collection<ICompletionProposal> completions, int offset, IDocument doc) {
160-
// Set<String> mentionedBeans = alreadyMentionedBeans(node);
161-
//
162-
// Bean[] beans = this.springIndex.getBeansOfProject(project.getElementName());
163-
// List<Bean> filteredBeans = Arrays.stream(beans)
164-
// .filter(bean -> !mentionedBeans.contains(bean.getName()))
165-
// .collect(Collectors.toList());
166-
//
167-
// for (Bean bean : filteredBeans) {
168-
//
169-
// DocumentEdits edits = new DocumentEdits(doc, false);
170-
// edits.replace(offset, offset, "\"" + bean.getName() + "\"");
171-
//
172-
// DependsOnCompletionProposal proposal = new DependsOnCompletionProposal(edits, bean.getName(), bean.getName(), null);
173-
//
174-
// completions.add(proposal);
175-
// }
176-
// }
177-
//
178-
// private void computeProposalsForInsideArrayInitializer(IJavaProject project, ASTNode node, Collection<ICompletionProposal> completions, int offset, TextDocument doc) throws BadLocationException {
179-
// int length = offset - (node.getStartPosition() + 1);
180-
// if (length >= 0) {
181-
// computeProposalsForStringLiteral(project, node, completions, offset, doc);
182-
// }
183-
// else {
184-
// Set<String> mentionedBeans = alreadyMentionedBeans(node);
185-
//
186-
// Bean[] beans = this.springIndex.getBeansOfProject(project.getElementName());
187-
// List<Bean> filteredBeans = Arrays.stream(beans)
188-
// .filter(bean -> !mentionedBeans.contains(bean.getName()))
189-
// .collect(Collectors.toList());
190-
//
191-
// for (Bean bean : filteredBeans) {
192-
//
193-
// DocumentEdits edits = new DocumentEdits(doc, false);
194-
// edits.replace(offset, offset, "\"" + bean.getName() + "\",");
195-
//
196-
// DependsOnCompletionProposal proposal = new DependsOnCompletionProposal(edits, bean.getName(), bean.getName(), null);
197-
//
198-
// completions.add(proposal);
199-
// }
200-
// }
201-
// }
202-
//
203-
// private String identifyPropertyPrefix(String nodeContent, int offset) {
204-
// String result = nodeContent.substring(0, offset);
205-
//
206-
// int i = offset - 1;
207-
// while (i >= 0) {
208-
// char c = nodeContent.charAt(i);
209-
// if (c == '}' || c == '{' || c == '$' || c == '#') {
210-
// result = result.substring(i + 1, offset);
211-
// break;
212-
// }
213-
// i--;
214-
// }
215-
//
216-
// return result;
217-
// }
218-
//
219-
// private Set<String> alreadyMentionedBeans(ASTNode node) {
220-
// Set<String> result = new HashSet<>();
221-
//
222-
// ArrayInitializer arrayNode = null;
223-
// while (node != null && arrayNode == null && !(node instanceof Annotation)) {
224-
// if (node instanceof ArrayInitializer) {
225-
// arrayNode = (ArrayInitializer) node;
226-
// }
227-
// else {
228-
// node = node.getParent();
229-
// }
230-
// }
231-
//
232-
// if (arrayNode != null) {
233-
// List<?> expressions = arrayNode.expressions();
234-
// for (Object expression : expressions) {
235-
// if (expression instanceof StringLiteral) {
236-
// StringLiteral stringExr = (StringLiteral) expression;
237-
// String value = stringExr.getLiteralValue();
238-
// result.add(value);
239-
// }
240-
// }
241-
// }
242-
//
243-
// return result;
244-
// }
245-
24640
@Override
24741
public List<AnnotationAttributeProposal> getCompletionCandidates(IJavaProject project, ASTNode node) {
24842
Collection<String> beanNameFromCodeElement = getBeanNameFromSourceCodePosition(node);

0 commit comments

Comments
 (0)