IFXClass fxClass = FXPlugin.getClassmodel().findClass(ownerType.getJavaProject(), ownerType);
if (fxClass != null) {
IFXProperty p = fxClass.getStaticProperty(parts[1]);
if (p != null) {
if (p instanceof IFXObjectProperty) {
IFXObjectProperty op = (IFXObjectProperty) p;
createSubtypeProposals(contentAssistRequest, context, op.getElementType());
} else if (p instanceof IFXCollectionProperty) {
IFXCollectionProperty cp = (IFXCollectionProperty) p;
createSubtypeProposals(contentAssistRequest, context, cp.getElementType());
}
}
}
}
} else if (Character.isUpperCase(parent.getNodeName().charAt(0)) || "fx:root".equals(parent.getNodeName())) {
if (!contentAssistRequest.getMatchString().isEmpty() && Character.isUpperCase(contentAssistRequest.getMatchString().charAt(0))) {
// TODO This means we are static?
// IJavaProject jproject =
// findProject(contentAssistRequest);
// try {
// IType superType =
// jproject.findType("javafx.scene.Parent");
// if( superType != null ) {
// createSubtypeProposals(contentAssistRequest, context,
// superType);
// }
// } catch (JavaModelException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
} else {
if (parent.getParentNode() != null) {
Node n = null;
if( "fx:root".equals(parent.getNodeName()) ) {
n = parent;
} else if (Character.isUpperCase(parent.getParentNode().getNodeName().charAt(0)) || "fx:root".equals(parent.getParentNode().getNodeName())) {
n = parent.getParentNode();
} else if (parent.getParentNode().getParentNode() != null) {
if (Character.isUpperCase(parent.getParentNode().getParentNode().getNodeName().charAt(0)) || "fx:root".equals(parent.getParentNode().getParentNode().getNodeName())) {
n = parent.getParentNode().getParentNode();
}
}
if (n != null) {
IType type;
if( "fx:root".equals(n.getNodeName()) ) {
type = Util.findType(n.getAttributes().getNamedItem("type").getNodeValue(), parent.getOwnerDocument());
} else {
type = Util.findType(n.getNodeName(), parent.getOwnerDocument());
}
if (type != null) {
IFXClass fxclass = FXPlugin.getClassmodel().findClass(type.getJavaProject(), type);
if (fxclass != null) {
for (IFXProperty p : fxclass.getAllStaticProperties().values()) {
String proposalValue = fxclass.getSimpleName() + "." + p.getName() + ">" + "</" + fxclass.getSimpleName() + "." + p.getName() + ">";
String sType;
if (p instanceof IFXPrimitiveProperty) {
IFXPrimitiveProperty pp = (IFXPrimitiveProperty) p;
sType = pp.getType() == Type.STRING ? "String" : pp.getType().jvmType();
} else if (p instanceof IFXObjectProperty) {
IFXObjectProperty op = (IFXObjectProperty) p;
sType = op.getElementTypeAsString(false);
} else if (p instanceof IFXEnumProperty) {
IFXEnumProperty ep = (IFXEnumProperty) p;
sType = ep.getEnumTypeAsString(false);
} else {
sType = "<unknown>";