Example usage for org.springframework.ide.eclipse.beans.core.internal.model BeansTypedString getString

List of usage examples for org.springframework.ide.eclipse.beans.core.internal.model BeansTypedString getString

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.beans.core.internal.model BeansTypedString getString.

Prototype

public String getString() 

Source Link

Usage

From source file:org.dozer.eclipse.plugin.sourcepage.util.DozerPluginUtils.java

public static BeansMapEntry getCCIModelElementForMappingFile(IBean bean, String customConverterId) {
    if (bean == null || customConverterId == null || "".equals(customConverterId))
        return null;

    IModelElement[] ccwiPropertyMapEntries = getPossibleCCIMappingForMappingFile(bean);

    //map entries not found, at least return bean;
    if (ccwiPropertyMapEntries == null)
        return null;

    //find the custom-converter-id property
    for (IModelElement beansMapEntry : ccwiPropertyMapEntries) {
        BeansMapEntry entry = (BeansMapEntry) beansMapEntry;
        BeansTypedString key = (BeansTypedString) entry.getKey();
        if (key.getString().equals(customConverterId)) {
            return entry;
        }/*from w  ww. j a v a 2  s . co m*/
    }

    return null;
}

From source file:org.dozer.eclipse.plugin.sourcepage.contentassist.DozerContentAssistProcessor.java

@SuppressWarnings("restriction")
protected ContentAssistRequest computeDozerBeanContentProposals(int documentPosition, String matchString,
        ITextRegion completionRegion, IDOMNode nodeAtOffset, IDOMNode node) {
    int offset = nodeAtOffset.getStartOffset() + nodeAtOffset.getNodeName().length() + 2;
    int len = nodeAtOffset.getLength() - nodeAtOffset.getNodeName().length() - 3;

    ContentAssistRequest contentAssistRequest = new ContentAssistRequest(nodeAtOffset, node,
            getStructuredDocumentRegion(documentPosition), completionRegion, offset, len, matchString);
    IFile file = BeansEditorUtils.getFile(this.fTextViewer.getDocument());
    IBean bean = DozerPluginUtils.getDozerBeanForMappingFile(file);
    IModelElement[] ccwiPropertyMapEntries = DozerPluginUtils.getPossibleCCIMappingForMappingFile(bean);

    if (ccwiPropertyMapEntries != null) {
        for (IModelElement beansMapEntry : ccwiPropertyMapEntries) {
            BeansMapEntry entry = (BeansMapEntry) beansMapEntry;
            BeansTypedString key = (BeansTypedString) entry.getKey();

            if (key.getString() != null && !key.getString().equals("")) {
                DozerJavaCompletionProposal newProposal = new DozerJavaCompletionProposal(
                        "\"" + key.getString(), offset, len, 0, BeansModelImages.getImage(entry),
                        key.getString(), (IContextInformation) null, 0, true, bean);
                contentAssistRequest.addProposal(newProposal);
            }/*from   w  ww  . j  a va 2s  .c o  m*/
        }
    }

    return contentAssistRequest;
}