Example usage for org.eclipse.jface.viewers StyledString StyledString

List of usage examples for org.eclipse.jface.viewers StyledString StyledString

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers StyledString StyledString.

Prototype

public StyledString() 

Source Link

Document

Creates an empty StyledString .

Usage

From source file:at.bestsolution.efxclipse.tooling.css.ui.contentassist.CssDslRealtimeProposalProvider.java

License:Open Source License

public void complete_css_property(ruleset model, RuleCall ruleCall, ContentAssistContext context,
        ICompletionProposalAcceptor acceptor) {
    URI uri = model.eResource().getURI();

    List<CssProperty> properties = extension.getAllProperties(uri);
    if (properties != null) {

        Map<Integer, String> alternateSource = new HashMap<Integer, String>();
        Map<Integer, CssProperty> filterMap = new HashMap<Integer, CssProperty>();

        for (CssProperty property : properties) {
            CssProperty old = filterMap.put(property.eqHash, property);
            if (old != null) {
                String x = alternateSource.get(property.eqHash);
                if (x != null) {
                    alternateSource.put(property.eqHash, x + ", " + property.parent.fQName);
                } else {
                    alternateSource.put(property.eqHash, old.parent.fQName + ", " + property.parent.fQName);
                }//from  w  w w . j  a  v a 2 s  .c o  m
            }
        }

        for (CssProperty property : filterMap.values()) {

            StyledString displayString = new StyledString();
            String name = property.name + " ";
            String nfo = "";
            String alternate = alternateSource.get(property.eqHash);
            if (alternate == null) {
                nfo = "(" + property.parent.fQName + ")";
            } else {
                nfo = "( " + alternate + " )";
            }

            displayString.append(name);
            displayString.append(nfo);

            displayString.setStyle(name.length(), nfo.length(), new Styler() {
                @Override
                public void applyStyles(TextStyle textStyle) {
                    textStyle.foreground = Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
                }
            });

            Image img = labelProvider.getImage(CssDslFactory.eINSTANCE.createcss_property());

            ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) createCompletionProposal(
                    property.name, displayString, img, context);

            if (cp != null) {
                cp.setAdditionalProposalInfo(model);
                cp.setHover(new PropertyHover(property));
                cp.setTriggerCharacters(new char[] { ' ' });
                cp.setTextApplier(new IReplacementTextApplier() {

                    @Override
                    public void apply(IDocument document, ConfigurableCompletionProposal proposal)
                            throws BadLocationException {
                        document.replace(proposal.getReplacementOffset(), proposal.getReplacementLength(),
                                proposal.getReplacementString() + ": ");
                        proposal.setCursorPosition(proposal.getCursorPosition() + 2);
                    }
                });

                acceptor.accept(cp);
            }
        }
    }

    //      List<Property> properties = extension.getProperties(uri);
    //      
    //      
    //      if (properties != null) {
    //      
    //         for (Property property : properties) {
    //            
    //            
    //            ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) createCompletionProposal(property.getName(), property.getName(), null, context);
    //            cp.setAdditionalProposalInfo(model);
    //            //cp.setHover(new HoverImpl(extension.getDocForProperty(model.eResource().getURI(), property.getName())));
    //         
    //            cp.setHover(new PropertyHover(uri, property.getName()));
    //            
    //            cp.setImage(labelProvider.getImage(CssDslFactory.eINSTANCE.createcss_property()));
    //            
    //            StyledString displayString = new StyledString();
    //            String name = property.getName() + " ";
    //            String nfo = "(" + "defined in package lala" + ")";
    //            
    //            displayString.append(name);
    //            displayString.append(nfo);
    //            
    //            displayString.setStyle(name.length(), nfo.length(), new Styler() {
    //               @Override
    //               public void applyStyles(TextStyle textStyle) {
    //                  textStyle.foreground = Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
    //               }
    //            });
    //            
    //            
    //            cp.setDisplayString(displayString);
    //            acceptor.accept(cp);
    //         }
    //      }
}

From source file:at.bestsolution.efxclipse.tooling.css.ui.contentassist.CssDslRealtimeProposalProvider.java

License:Open Source License

private void handlePropertyCompletion(URI uri, EObject model, List<CssTok> prefixToks, String prefix,
        String elementName, String propertyName, ContentAssistContext context,
        ICompletionProposalAcceptor acceptor) {

    List<Proposal> proposals = extension.findProposals(uri, elementName, propertyName, prefixToks, prefix);

    for (Proposal p : proposals) {

        StyledString displayString = new StyledString();
        String name = p.getLabel() + " ";
        String nfo = "( " + p.getLabel() + " )";

        displayString.append(name);/*w w w. ja  va2  s . co  m*/
        displayString.append(nfo);

        displayString.setStyle(name.length(), nfo.length(), new Styler() {
            @Override
            public void applyStyles(TextStyle textStyle) {
                textStyle.foreground = Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
            }
        });

        // TODO fix image
        Image img = labelProvider.getImage(CssDslFactory.eINSTANCE.createcss_property());

        ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) createCompletionProposal(
                p.getProposal(), displayString, img, context);

        if (cp != null) {
            cp.setAdditionalProposalInfo(model);
            //cp.setHover(new PropertyHover(property));
            cp.setAutoInsertable(true);
            cp.setTriggerCharacters(new char[] { ' ' });
            if (p instanceof DialogProposal) {
                final DialogProposal dProp = (DialogProposal) p;
                cp.setTextApplier(new ReplacementTextApplier() {
                    //                  
                    @Override
                    public String getActualReplacementString(ConfigurableCompletionProposal proposal) {
                        return dProp.openProposal();
                    }
                });
            } else {
                cp.setTextApplier(new IReplacementTextApplier() {

                    @Override
                    public void apply(IDocument document, ConfigurableCompletionProposal proposal)
                            throws BadLocationException {
                        //                     proposal.setReplaceContextLength((proposal.getReplacementString() + " ").length());

                        System.err.println("apply " + proposal.getReplacementString());

                        if (",".equals(proposal.getReplacementString())) {
                            document.replace(proposal.getReplacementOffset() - 1,
                                    proposal.getReplacementLength() + 1, proposal.getReplacementString() + " ");
                            //                        proposal.setCursorPosition(proposal.getCursorPosition() + 1);
                        } else if (",".equals(proposal.getReplacementString())) {
                            document.replace(proposal.getReplacementOffset() - 1,
                                    proposal.getReplacementLength() + 1,
                                    proposal.getReplacementString() + "\n");
                        } else {
                            document.replace(proposal.getReplacementOffset(), proposal.getReplacementLength(),
                                    proposal.getReplacementString() + " ");
                            proposal.setCursorPosition(proposal.getCursorPosition() + 1);

                        }

                    }
                });
            }

            acceptor.accept(cp);
        }
    }
}

From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.contentassist.FXGraphProposalProvider.java

License:Open Source License

private void createEnumPropnameProposals(IFXEnumProperty prop, EObject model, ContentAssistContext context,
        EStructuralFeature typeReference, ICompletionProposalAcceptor acceptor) {
    if (prop.isStatic() && typeReference.equals(FXGraphPackage.Literals.ELEMENT__STATIC_PROPERTIES)) {
        StyledString s = new StyledString();
        s.append("(static) ", StyledString.COUNTER_STYLER);
        s.append(prop.getFXClass().getSimpleName() + "." + prop.getName() + " : "
                + prop.getEnumTypeAsString(false));
        s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);

        context = context.copy().setMatcher(new StaticPrefixMatcher(context.getMatcher())).toContext();

        ICompletionProposal p = createCompletionProposal("static " + prop.getName() + " : ", s,
                IconKeys.getIcon(IconKeys.FIELD_KEY), getPropertiesProposalsProposals() - 10,
                context.getPrefix(), context);

        if (p instanceof ConfigurableCompletionProposal) {
            ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
            cp.setAdditionalProposalInfo(model);
            cp.setHover(new HoverImpl(prop.getJavaElement()));
        }// w w  w.j a  v  a 2s  . co m

        acceptor.accept(p);
    } else {
        StyledString s = new StyledString(prop.getName() + " : " + prop.getEnumTypeAsString(false));
        s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
        ICompletionProposal p = createCompletionProposal(prop.getName() + " : ", s,
                IconKeys.getIcon(IconKeys.FIELD_KEY), getPropertiesProposalsProposals(), context.getPrefix(),
                context);

        if (p instanceof ConfigurableCompletionProposal) {
            ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
            cp.setAdditionalProposalInfo(model);
            cp.setHover(new HoverImpl(prop.getJavaElement()));
        }

        acceptor.accept(p);
    }
}

From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.contentassist.FXGraphProposalProvider.java

License:Open Source License

private void createObjectPropnameProposals(IFXObjectProperty prop, EObject model, ContentAssistContext context,
        EStructuralFeature typeReference, ICompletionProposalAcceptor acceptor) {
    if (prop.isStatic() && typeReference.equals(FXGraphPackage.Literals.ELEMENT__STATIC_PROPERTIES)) {
        StyledString s = new StyledString();
        s.append("(static) ", StyledString.COUNTER_STYLER);
        s.append(prop.getFXClass().getSimpleName() + "." + prop.getName() + " : "
                + prop.getElementTypeAsString(false));
        s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);

        context = context.copy().setMatcher(new StaticPrefixMatcher(context.getMatcher())).toContext();

        ICompletionProposal p = createCompletionProposal("static " + prop.getName() + " : ", s,
                IconKeys.getIcon(IconKeys.FIELD_KEY), getPropertiesProposalsProposals() - 10,
                context.getPrefix(), context);

        if (p instanceof ConfigurableCompletionProposal) {
            ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
            cp.setAdditionalProposalInfo(model);
            cp.setHover(new HoverImpl(prop.getJavaElement()));
        }/*  w  w  w. j  a va2  s  . c  o m*/

        acceptor.accept(p);
    } else {
        StyledString s = new StyledString(prop.getName() + " : " + prop.getElementTypeAsString(false));
        s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
        ICompletionProposal p = createCompletionProposal(prop.getName() + " : ", s,
                IconKeys.getIcon(IconKeys.FIELD_KEY), getPropertiesProposalsProposals(), context.getPrefix(),
                context);

        if (p instanceof ConfigurableCompletionProposal) {
            ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
            cp.setAdditionalProposalInfo(model);
            cp.setHover(new HoverImpl(prop.getJavaElement()));
        }

        acceptor.accept(p);
    }
}

From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.contentassist.FXGraphProposalProvider.java

License:Open Source License

private void createPrimitivePropnameProposals(IFXPrimitiveProperty prop, EObject model,
        ContentAssistContext context, EStructuralFeature typeReference, ICompletionProposalAcceptor acceptor) {
    String typeName;//from   www  . java  2  s .c o  m
    String proposalValue = prop.getName() + " : ";
    switch (prop.getType()) {
    case BOOLEAN:
        typeName = "boolean";
        break;
    case BYTE:
        typeName = "byte";
        break;
    case CHAR:
        typeName = "char";
        break;
    case DOUBLE:
        typeName = "double";
        break;
    case FLOAT:
        typeName = "float";
        break;
    case INTEGER:
        typeName = "integer";
        break;
    case LONG:
        typeName = "long";
        break;
    case SHORT:
        typeName = "short";
        break;
    default:
        typeName = "String";
        proposalValue += "\"\"";
        break;
    }

    if (prop.isStatic() && typeReference.equals(FXGraphPackage.Literals.ELEMENT__STATIC_PROPERTIES)) {
        StyledString s = new StyledString();
        s.append("(static) ", StyledString.COUNTER_STYLER);
        s.append(prop.getFXClass().getSimpleName() + "." + prop.getName() + " : " + typeName);
        s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);

        proposalValue = "static " + proposalValue;

        context = context.copy().setMatcher(new StaticPrefixMatcher(context.getMatcher())).toContext();

        ICompletionProposal p = createCompletionProposal(proposalValue, s, IconKeys.getIcon(IconKeys.FIELD_KEY),
                getPropertiesProposalsProposals() - 10, context.getPrefix(), context);

        if (p instanceof ConfigurableCompletionProposal) {
            ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
            cp.setAdditionalProposalInfo(model);
            cp.setHover(new HoverImpl(prop.getJavaElement()));
        }

        acceptor.accept(p);
    } else {
        StyledString s = new StyledString(prop.getName() + " : " + typeName);
        s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);

        if (proposalValue.equals("id : \"\"")) {
            proposalValue = "^" + proposalValue;
        }

        context = context.copy().setMatcher(new EscapePrefixMatcher(context.getMatcher())).toContext();
        ICompletionProposal p = createCompletionProposal(proposalValue, s, IconKeys.getIcon(IconKeys.FIELD_KEY),
                getPropertiesProposalsProposals(), context.getPrefix(), context);

        if (p instanceof ConfigurableCompletionProposal) {
            ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
            cp.setAdditionalProposalInfo(model);
            cp.setHover(new HoverImpl(prop.getJavaElement()));
            if (prop.getType() == Type.STRING) {
                cp.setCursorPosition(cp.getCursorPosition() - 1);
            }
        }

        acceptor.accept(p);
    }
}

From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.outline.FXGraphOutlineTreeProvider.java

License:Open Source License

public Object _text(Element element) {
    if (element.getValue() != null || element.getName() != null || element.getFactory() != null) {
        StyledString s = new StyledString();

        s.append(element.getType().getSimpleName());

        if (element.getValue() != null) {
            s.append("(" + getSimplePropertValue(element.getValue()) + ")");
        }// w ww  . jav  a  2 s  .c  o m

        if (element.getFactory() != null) {
            s.append("#", StyledString.QUALIFIER_STYLER);
            s.append(element.getFactory(), StyledString.QUALIFIER_STYLER);
        }

        if (element.getName() != null) {
            s.append(" - " + element.getName(), StyledString.QUALIFIER_STYLER);
        }

        return s;
    }

    return element.getType() != null ? element.getType().getSimpleName() : "";
}

From source file:at.bestsolution.efxclipse.tooling.fxml.editors.FXMLCompletionProposalComputer.java

License:Open Source License

private void createEnumPropnameProposals(ContentAssistRequest contentAssistRequest,
        CompletionProposalInvocationContext context, IFXEnumProperty prop) {
    FXMLCompletionProposal cp;/*from w  ww. ja  v a 2 s  .co  m*/

    if (prop.isStatic()) {
        StyledString s = new StyledString();
        s.append("(static) ", StyledString.COUNTER_STYLER);
        s.append(prop.getFXClass().getSimpleName() + "." + prop.getName() + " : "
                + prop.getEnumTypeAsString(false));
        s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);

        String proposalValue = prop.getFXClass().getSimpleName() + "." + prop.getName() + "=\"\"";

        cp = createAttributeProposal(contentAssistRequest, context, proposalValue, s,
                IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY - 10, STATIC_ATTRIBUTE_MATCHER);
    } else {
        StyledString s = new StyledString(prop.getName() + " : " + prop.getEnumTypeAsString(false));
        s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);

        String propValue = prop.getName() + "=\"\"";

        cp = createAttributeProposal(contentAssistRequest, context, propValue, s,
                IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY, MATCHER);
    }

    if (cp != null) {
        cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
        cp.setHover(new HoverImpl(prop.getJavaElement()));

        contentAssistRequest.addProposal(cp);
    }
}

From source file:at.bestsolution.efxclipse.tooling.fxml.editors.FXMLCompletionProposalComputer.java

License:Open Source License

private void createObjectPropnameProposals(ContentAssistRequest contentAssistRequest,
        CompletionProposalInvocationContext context, IFXObjectProperty prop) {
    String type = prop.getElementTypeAsString(true);

    // TODO Should we allow other elements because one can use $... to
    // reference elements
    if ("java.lang.Boolean".equals(type) || isIntegerType(type) || isDoubleType(type) || prop.hasValueOf()) {
        FXMLCompletionProposal cp;/*from ww  w.  j av  a  2 s . c  o  m*/

        if (prop.isStatic()) {
            StyledString s = new StyledString();
            s.append("(static) ", StyledString.COUNTER_STYLER);
            s.append(prop.getFXClass().getSimpleName() + "." + prop.getName() + " : "
                    + prop.getElementTypeAsString(false));
            s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);

            String proposalValue = prop.getFXClass().getSimpleName() + "." + prop.getName() + "=\"\"";

            cp = createAttributeProposal(contentAssistRequest, context, proposalValue, s,
                    IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY - 10, STATIC_ATTRIBUTE_MATCHER);
        } else {
            StyledString s = new StyledString(prop.getName() + " : " + prop.getElementTypeAsString(false));
            s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);

            String propValue = prop.getName() + "=\"\"";
            cp = createAttributeProposal(contentAssistRequest, context, propValue, s,
                    IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY, MATCHER);
        }

        if (cp != null) {
            cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
            cp.setHover(new HoverImpl(prop.getJavaElement()));

            contentAssistRequest.addProposal(cp);
        }
    }
}

From source file:at.bestsolution.efxclipse.tooling.fxml.editors.FXMLCompletionProposalComputer.java

License:Open Source License

private void createPrimitivePropnameProposal(ContentAssistRequest contentAssistRequest,
        CompletionProposalInvocationContext context, IFXPrimitiveProperty fxProperty) {
    String typeName;//w  w w . j  a  v a  2  s. co  m
    switch (fxProperty.getType()) {
    case BOOLEAN:
        typeName = "boolean";
        break;
    case BYTE:
        typeName = "byte";
        break;
    case CHAR:
        typeName = "char";
        break;
    case DOUBLE:
        typeName = "double";
        break;
    case FLOAT:
        typeName = "float";
        break;
    case INTEGER:
        typeName = "integer";
        break;
    case LONG:
        typeName = "long";
        break;
    case SHORT:
        typeName = "short";
        break;
    default:
        typeName = "String";
        break;
    }

    FXMLCompletionProposal cp;
    if (fxProperty.isStatic()) {
        StyledString s = new StyledString();
        s.append("(static) ", StyledString.COUNTER_STYLER);
        s.append(fxProperty.getFXClass().getSimpleName() + "." + fxProperty.getName() + " : " + typeName);
        s.append(" - " + fxProperty.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);

        String proposalValue = fxProperty.getFXClass().getSimpleName() + "." + fxProperty.getName() + "=\"\"";

        cp = createAttributeProposal(contentAssistRequest, context, proposalValue, s,
                IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY - 10, STATIC_ATTRIBUTE_MATCHER);
    } else {
        StyledString s = new StyledString(fxProperty.getName() + " : " + typeName);
        s.append(" - " + fxProperty.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);

        String proposalValue = fxProperty.getName() + "=\"\"";

        cp = createAttributeProposal(contentAssistRequest, context, proposalValue, s,
                IconKeys.getIcon(IconKeys.FIELD_KEY), DEFAULT_PRIORITY, MATCHER);
    }

    if (cp != null) {
        cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
        cp.setHover(new HoverImpl(fxProperty.getJavaElement()));

        contentAssistRequest.addProposal(cp);
    }
}

From source file:at.bestsolution.efxclipse.tooling.fxml.editors.FXMLCompletionProposalComputer.java

License:Open Source License

@Override
protected void addTagNameProposals(ContentAssistRequest contentAssistRequest, int childPosition,
        CompletionProposalInvocationContext context) {
    Node parent = contentAssistRequest.getParent();

    if (parent.getNodeType() == Node.ELEMENT_NODE) {
        if (parent.getNodeName().contains(".")) {
            String[] parts = parent.getNodeName().split("\\.");
            IType ownerType = Util.findType(parts[0], parent.getOwnerDocument());
            if (ownerType != null) {
                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());
                        }/*ww  w. j  av a  2  s. co  m*/
                    }
                }
            }
        } 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>";
                                    }

                                    FXMLCompletionProposal cp = createElementProposal(contentAssistRequest,
                                            context, proposalValue,
                                            new StyledString().append("(static) ", StyledString.COUNTER_STYLER)
                                                    .append(p.getFXClass().getSimpleName() + "." + p.getName())
                                                    .append(" - " + sType, StyledString.QUALIFIER_STYLER),
                                            true, PRIORITY_LOWER_1, null, STATIC_ELEMENT_MATCHER);
                                    if (cp != null) {
                                        cp.setAdditionalProposalInfo(EcoreFactory.eINSTANCE.createEClass());
                                        cp.setHover(new HoverImpl(p.getJavaElement()));
                                        contentAssistRequest.addProposal(cp);
                                    }
                                }
                            }
                        }
                    }
                }
                IType type;

                if ("fx:root".equals(parent.getNodeName())) {
                    type = Util.findType(parent.getAttributes().getNamedItem("type").getNodeValue(),
                            parent.getOwnerDocument());
                } else {
                    type = Util.findType(parent.getNodeName(), parent.getOwnerDocument());
                }

                if (type != null) {
                    IFXClass fxClass = FXPlugin.getClassmodel().findClass(type.getJavaProject(), type);
                    if (fxClass != null) {
                        for (IFXProperty property : fxClass.getAllProperties().values()) {
                            createPropertyElementNameProposal(contentAssistRequest, context, property);
                        }
                    }
                }
            }

            IType type;

            if ("fx:root".equals(parent.getNodeName())) {
                type = Util.findType(parent.getAttributes().getNamedItem("type").getNodeValue(),
                        parent.getOwnerDocument());
            } else {
                type = Util.findType(parent.getNodeName(), parent.getOwnerDocument());
            }

            if (type != null) {
                IFXClass fxClass = FXPlugin.getClassmodel().findClass(type.getJavaProject(), type);
                if (fxClass != null) {
                    IFXProperty p = fxClass.getDefaultProperty();
                    if (p instanceof IFXObjectProperty) {
                        createSubtypeProposals(contentAssistRequest, context,
                                ((IFXObjectProperty) p).getElementType());
                    } else if (p instanceof IFXCollectionProperty) {
                        createSubtypeProposals(contentAssistRequest, context,
                                ((IFXCollectionProperty) p).getElementType());
                    }
                }
            }
        } else {
            createClassElementNameProposal(contentAssistRequest, context);
        }
    }
}