cu.createImport("java.util.List", null, null);
}
int importOffset = getLastImportEndPosition() - oldImportPos;
LinkedModeModel model = new LinkedModeModel();
StringBuilder methodStr = new StringBuilder();
int startPos, length;
List<LinkedPositionGroup> groups = new ArrayList<LinkedPositionGroup>();
LinkedPositionGroup group;
group = new LinkedPositionGroup();
startPos = startOffset + importOffset + methodStr.length();
methodStr.append("List<");
methodStr.append(domainClass.getSimpleName());
methodStr.append(">");
length = methodStr.length();
group.addPosition(new LinkedPosition(document, startPos, length));
groups.add(group);
methodStr.append(" ");
group = new LinkedPositionGroup();
startPos = startOffset + importOffset + methodStr.length();
String methodName = getMethodName(propertyName);
methodStr.append(methodName);
length = methodName.length();
group.addPosition(new LinkedPosition(document, startPos, length));
groups.add(group);
methodStr.append("(");
group = new LinkedPositionGroup();
startPos = startOffset + importOffset + methodStr.length();
String paramTypeName = propertyClass.getSimpleName();
length = paramTypeName.length();
methodStr.append(paramTypeName);
group.addPosition(new LinkedPosition(document, startPos, length));
groups.add(group);
methodStr.append(" ");
group = new LinkedPositionGroup();
startPos = startOffset + importOffset + methodStr.length();
String paramName = propertyName.toLowerCase();
length = paramName.length();
methodStr.append(paramName);
group.addPosition(new LinkedPosition(document, startPos, length));
groups.add(group);
methodStr.append(");");
document.replace(startOffset + importOffset, endOffset - startOffset, methodStr.toString());
for (LinkedPositionGroup currGroup : groups) {
model.addGroup(currGroup);
}
model.forceInstall();
LinkedModeUI ui = new LinkedModeUI(model, viewer);
ui.setExitPosition(viewer, startOffset + importOffset + methodStr.length(), 0, Integer.MAX_VALUE);
ui.enter();
selectedRegion = ui.getSelectedRegion();