TypeInsert anpassen

This commit is contained in:
JanUlrich 2017-07-05 20:09:09 +02:00
parent adda1db195
commit 0f6381f30b
2 changed files with 10 additions and 4 deletions

View File

@ -8,14 +8,20 @@ import java.util.List;
import java.util.Set; import java.util.Set;
public class TypeInsert { public class TypeInsert {
/**
* point wird hauptsächlich zur Anzeige einer Annotation im Eclipse-plugin benutzt.
*/
public final Token point;
Set<TypeInsertPoint> inserts; Set<TypeInsertPoint> inserts;
public TypeInsert(Token point, String toInsert){ public TypeInsert(Token point, String toInsert){
this.point = point;
inserts = new HashSet<>(); inserts = new HashSet<>();
inserts.add(new TypeInsertPoint(point, toInsert)); inserts.add(new TypeInsertPoint(point, toInsert));
} }
public TypeInsert(Set<TypeInsertPoint> points){ public TypeInsert(Token point, Set<TypeInsertPoint> points){
this.point = point;
inserts = points; inserts = points;
} }

View File

@ -25,19 +25,19 @@ public class TypeInsertFactory {
for(Field field : cl.getFieldDecl()){ for(Field field : cl.getFieldDecl()){
if(field.getType() instanceof TypePlaceholder){ if(field.getType() instanceof TypePlaceholder){
for(Set<Pair> pairs : withResults.results) for(Set<Pair> pairs : withResults.results)
ret.add(new TypeInsert(createInsertPoints( ret.add(new TypeInsert(field.getType().getOffset(), createInsertPoints(
field.getType(), field.getType().getOffset(), cl, null, pairs))); field.getType(), field.getType().getOffset(), cl, null, pairs)));
} }
} }
for(Method m : cl.getMethods()){ for(Method m : cl.getMethods()){
for(Set<Pair> pairs : withResults.results) for(Set<Pair> pairs : withResults.results)
ret.add(new TypeInsert(createInsertPoints( ret.add(new TypeInsert(m.getReturnType().getOffset(), createInsertPoints(
m.getReturnType(), m.getReturnType().getOffset(), cl, m, pairs))); m.getReturnType(), m.getReturnType().getOffset(), cl, m, pairs)));
for(FormalParameter param : m.getParameterList().getFormalparalist()){ for(FormalParameter param : m.getParameterList().getFormalparalist()){
for(Set<Pair> pairs : withResults.results) for(Set<Pair> pairs : withResults.results)
ret.add(new TypeInsert(createInsertPoints( ret.add(new TypeInsert(param.getType().getOffset(), createInsertPoints(
param.getType(), param.getType().getOffset(), cl, m, pairs))); param.getType(), param.getType().getOffset(), cl, m, pairs)));
} }
} }