/** * Adds additional syntax completion proposals to <code>additionalProposals</code> for the given * original proposal and {@link OclMetamodel}. * * @param additionalProposals the list of proposals to add to * @param proposal the original syntax completion proposal * @param oclMetamodel the metamodel URI */ protected void addAdditionalProposals( final List<SyntaxCompletionProposal> additionalProposals, final SyntaxCompletionProposal proposal, final OclMetamodel oclMetamodel) { final String uri = oclMetamodel.getUri(); additionalProposals.addAll(getEClassifiers(proposal.getPrefix(), uri, proposal.getRoot())); }
/** * Adapts the given list of proposals and returns it. * * @param proposals the list of code completion proposals * @return the adapted list of code completion proposals, or an empty list if no adaptation should * be done */ public List<SyntaxCompletionProposal> process(final List<SyntaxCompletionProposal> proposals) { final List<SyntaxCompletionProposal> additionalProposals = new ArrayList<SyntaxCompletionProposal>(); for (SyntaxCompletionProposal proposal : proposals) { final String prefix = proposal.getPrefix(); final PropertyCallType propertyCallType = getPropertyCallType(prefix); if (propertyCallType != null) { addAdditionalProposals(additionalProposals, proposal, propertyCallType); break; } else { final EObject container = proposal.getContainer(); final EObject expectedTerminalContainer = proposal.getExpectedTerminalContainer(); OclModel oclModel = null; if (container instanceof OclModelElement) { oclModel = ((OclModelElement) container).getModel(); } else if (container instanceof OclModelElementExp) { oclModel = ((OclModelElementExp) container).getModel(); } else if (container instanceof IteratorExp) { addAdditionalProposals(additionalProposals, proposal, PropertyCallType.COLLECTION); break; } else if (expectedTerminalContainer instanceof IterateExp) { addAdditionalProposals(additionalProposals, proposal, PropertyCallType.COLLECTION); break; } else if (container instanceof StaticPropertyCall) { addAdditionalProposals(additionalProposals, proposal, PropertyCallType.STATIC); break; } else if (container instanceof PropertyCall) { addAdditionalProposals(additionalProposals, proposal, PropertyCallType.REGULAR); break; } if (oclModel instanceof OclMetamodel) { addAdditionalProposals(additionalProposals, proposal, (OclMetamodel) oclModel); break; } } } return additionalProposals; }
/** * Adds additional syntax completion proposals to <code>additionalProposals</code> for the given * original proposal and {@link PropertyCallType}. * * @param additionalProposals the list of proposals to add to * @param proposal the original syntax completion proposal * @param propertyCallType the {@link PropertyCallType} */ protected void addAdditionalProposals( final List<SyntaxCompletionProposal> additionalProposals, final SyntaxCompletionProposal proposal, final PropertyCallType propertyCallType) { additionalProposals.addAll( getEFeatureProposals(proposal.getPrefix(), proposal.getRoot(), propertyCallType)); additionalProposals.addAll( getModuleProposals(proposal.getPrefix(), proposal.getRoot(), propertyCallType)); additionalProposals.addAll( getEMFTVMProposals(proposal.getPrefix(), proposal.getRoot(), propertyCallType)); }