@SuppressWarnings("unchecked")
private List<Object> getProposalsForRegion(ITextViewer viewer,
IRegion region) {
List<Object> objects = new ArrayList<Object>();
ITypedRegion r = new TypedRegion(region.getOffset(),
region.getLength(), QVTPartitionScanner.MM_COMMENT);
try {
r = ((QVTDocument) viewer.getDocument()).getPartition(
QVTDocument.QVT_PARTITIONING, region.getOffset(), false);
} catch (Exception e) {
UiPlugin.getDefault().getLogger().log(
java.util.logging.Level.WARNING, "Unknown error", e);
}
if (r.getType() != QVTPartitionScanner.MM_COMMENT) {
if (prefix.length() > 0) {
// keywords
String[] keyword = fr.tm.elibel.smartqvt.qvteditor.editors.scanner.QVTScanner.KEYWORDS;
for (int i = 0; i < keyword.length; i++)
objects.add(keyword[i]);
// types
objects.addAll(getOclQvtTypes());
if (r.getType() != QVTPartitionScanner.MM_DECLARATION) {
objects.add(createHelperProposal(region));
}
}
if (r.getType() == QVTPartitionScanner.MM_DECLARATION) {
objects.addAll(getProposalsForOperation(region, r));
}
objects.addAll(getProposalsForTransformation(r));
}
return objects;