*/
@SuppressWarnings("unchecked")
private List<Object> getProposalsForObject(Object obj) {
List<Object> objects = new ArrayList<Object>();
if ((obj != null) && (obj instanceof TypedElement)) {
Type type = ((TypedElement) obj).getType();
if (type != null) {
if (type instanceof Class) {
Class cl = (Class) type;
objects.addAll(getObjectsOf(cl));
objects.addAll(getObjectsFromSuperClassOf(cl));
}
if (fCompletionType == COMPLETION_ELEMENT) {
if (type instanceof OperationalTransformation) {
for (Iterator iter = ((OperationalTransformation) type)
.getModuleImport().iterator(); iter.hasNext();) {
ModuleImport mod = (ModuleImport) iter.next();
objects
.addAll(getObjectsOf(mod
.getImportedModule()));
}
}
for (Iterator iter = getOclQvtTypes().iterator(); iter
.hasNext();) {
Type t = (Type) iter.next();
if ((t instanceof Class) && (t.getName() != null)) {
if ((type instanceof ModelType)
&& (t.getName().equals("Model"))) {
objects.addAll(getObjectsOf((Class) t));
}
if (t.getName().equals(type.getName())) {
objects.addAll(getObjectsOf((Class) t));
}
}
}
}
if ((fCompletionType == COMPLETION_COLLECTION)
|| (fCompletionType == COMPLETION_COLLECTION_COMPLETE)) {
if (type instanceof CollectionType) {
Type elementtype = ((CollectionType) type)
.getElementType();
if (elementtype instanceof Class) {
objects.addAll(getObjectsOf((Class) elementtype));
}
}
for (Iterator iter = getOclQvtTypes().iterator(); iter
.hasNext();) {
Type t = (Type) iter.next();
if (t instanceof Class) {
Class cl = (Class) t;
if ((type.getName().startsWith(cl.getName() + "("))) {
objects.addAll(getObjectsOf(cl));
}
if ("Collection".equals(t.getName())) {
objects.addAll(getObjectsOf(cl));
}
}
}
}