use of org.eclipse.che.ide.ext.java.shared.dto.ConflictImportDTO in project che by eclipse.
the class CodeAssist method createListOfDTOMatches.
private List<ConflictImportDTO> createListOfDTOMatches(TypeNameMatch[][] choices) {
List<ConflictImportDTO> typeMatches = new ArrayList<>();
for (int i = 0; i < choices.length; i++) {
List<String> nameMatches = new ArrayList<>();
TypeNameMatch[] choice = choices[i];
for (int j = 0; j < choice.length; j++) {
nameMatches.add(choice[j].getFullyQualifiedName());
}
typeMatches.add(DtoFactory.newDto(ConflictImportDTO.class).withTypeMatches(nameMatches));
}
return typeMatches;
}
use of org.eclipse.che.ide.ext.java.shared.dto.ConflictImportDTO in project che by eclipse.
the class OrganizeImportsPresenter method onFinishButtonClicked.
/** {@inheritDoc} */
@Override
public void onFinishButtonClicked() {
selected.put(page, view.getSelectedImport());
ConflictImportDTO result = dtoFactory.createDto(ConflictImportDTO.class).withTypeMatches(new ArrayList<>(selected.values()));
if (file instanceof Resource) {
final Optional<Project> project = ((Resource) file).getRelatedProject();
javaCodeAssistClient.applyChosenImports(project.get().getLocation().toString(), JavaUtil.resolveFQN(file), result).then(new Operation<List<Change>>() {
@Override
public void apply(List<Change> result) throws OperationException {
applyChanges(((TextEditor) editor).getDocument(), result);
view.hide();
((TextEditor) editor).setFocus();
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
String title = locale.failedToProcessOrganizeImports();
String message = arg.getMessage();
notificationManager.notify(title, message, FAIL, FLOAT_MODE);
}
});
}
}
Aggregations