Java Code Examples for org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor#accept()

The following examples show how to use org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor#accept() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodetemplatesProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void completeCodetemplate_KeywordContext(EObject model, Assignment assignment, ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {
	Codetemplate template = EcoreUtil2.getContainerOfType(model, Codetemplate.class);
	if (template != null) {
		Codetemplates templates = EcoreUtil2.getContainerOfType(template, Codetemplates.class);
		if (templates != null) {
			Grammar language = templates.getLanguage();
			if (language != null && !language.eIsProxy()) {
				Set<String> keywords = GrammarUtil.getAllKeywords(language);
				for(String keyword: keywords) {
					String proposalText = keyword;
					proposalText = getValueConverter().toString(proposalText, ((RuleCall)assignment.getTerminal()).getRule().getName());
					StyledString displayText = new StyledString(proposalText).append(" - Keyword", StyledString.QUALIFIER_STYLER);
					ICompletionProposal proposal = createCompletionProposal(proposalText, displayText, null, context);
					getPriorityHelper().adjustCrossReferencePriority(proposal, context.getPrefix());
					if (proposal instanceof ConfigurableCompletionProposal) {
						((ConfigurableCompletionProposal) proposal).setPriority(((ConfigurableCompletionProposal) proposal).getPriority() - 1);
					}
					acceptor.accept(proposal);
				}
			}
		}
	}
}
 
Example 2
Source File: DotHtmlLabelProposalProvider.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
private void proposeHtmlAttributeValues(ContentAssistContext context,
		ICompletionProposalAcceptor acceptor, String... proposals) {
	for (String proposal : proposals) {
		ICompletionProposal completionProposal = createCompletionProposal(
				proposal, context);
		String text = context.getCurrentNode().getText();
		if ((text.startsWith("\"") || text.startsWith("'"))//$NON-NLS-1$ //$NON-NLS-2$
				&& completionProposal instanceof ConfigurableCompletionProposal) {
			// ensure that the single quote / double quote at the beginning
			// of an attribute
			// value is not overridden when applying the proposal
			ConfigurableCompletionProposal configurableCompletionProposal = (ConfigurableCompletionProposal) completionProposal;
			configurableCompletionProposal.setReplacementOffset(
					configurableCompletionProposal.getReplacementOffset()
							+ 1);
			configurableCompletionProposal.setReplacementLength(
					configurableCompletionProposal.getReplacementLength()
							- 1);
			configurableCompletionProposal.setReplaceContextLength(
					configurableCompletionProposal.getReplaceContextLength()
							- 1);
		}
		acceptor.accept(completionProposal);
	}
}
 
Example 3
Source File: JSONProposalProvider.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Propose an empty string literal {@code ""} to complete rule {@code STRING}.
 * 
 * The cursor is set inside the two double quotes.
 */
@Override
public void complete_STRING(EObject model, RuleCall ruleCall, ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {

	// do not propose a string literal, if a name-value-pair is expected
	if (ruleCall.eContainer() instanceof Assignment
			&& ((Assignment) ruleCall.eContainer()).getFeature().equals("name")) {
		return;
	}

	// only propose if context does not specify a prefix
	if (!context.getPrefix().isEmpty()) {
		return;
	}

	for (IJSONProposalProvider pe : registry.getProposalProviderExtensions()) {
		if (pe.isResponsible(model)) {
			pe.complete_STRING(model, ruleCall, context, acceptor);
		}
	}

	acceptor.accept(new ConfigurableCompletionProposal("\"\"", context.getOffset(), 0, 1, null,
			JSONProposalFactory.createStyledString("\"...\"", "String"), null, ""));
}
 
Example 4
Source File: DotHtmlLabelProposalProvider.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
private void proposeHtmlColorAttributeValues(ContentAssistContext context,
		ICompletionProposalAcceptor acceptor, String text,
		int beginReplacementOffset, int contextOffset) {
	String subgrammarName = DotActivator.ORG_ECLIPSE_GEF_DOT_INTERNAL_LANGUAGE_DOTCOLOR;

	List<ConfigurableCompletionProposal> configurableCompletionProposals = new DotProposalProviderDelegator(
			subgrammarName).computeConfigurableCompletionProposals(text,
					contextOffset - beginReplacementOffset);

	for (ConfigurableCompletionProposal configurableCompletionProposal : configurableCompletionProposals) {
		// adapt the replacement offset determined within the
		// sub-grammar context to be valid within the context of the
		// original text
		configurableCompletionProposal.setReplacementOffset(
				beginReplacementOffset + configurableCompletionProposal
						.getReplacementOffset());
		acceptor.accept(configurableCompletionProposal);
	}
}
 
Example 5
Source File: DotHtmlLabelProposalProvider.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
private void proposeHtmlBgColorAttributeValues(ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {
	INode currentNode = context.getCurrentNode();
	String fullText = currentNode.getText();
	String text = fullText;
	int beginReplacementOffset = currentNode.getOffset();

	if (context.getPrefix().contains(":")) { //$NON-NLS-1$
		int colonOffset = fullText.indexOf(':') + 1;
		text = fullText.substring(colonOffset);
		beginReplacementOffset += colonOffset;
	} else {
		beginReplacementOffset += beginsWithQuote(text) ? 1 : 0;
	}
	proposeHtmlColorAttributeValues(context, acceptor,
			text.replaceAll("['\"]", ""), //$NON-NLS-1$ //$NON-NLS-2$
			beginReplacementOffset, context.getOffset());
	if (!fullText.contains(":")) { //$NON-NLS-1$
		acceptor.accept(new ConfigurableCompletionProposal(":", //$NON-NLS-1$
				context.getOffset(), 0, 1));
	}
}
 
Example 6
Source File: CodetemplatesProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void complete_Variable(EObject model, RuleCall ruleCall, ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {
	if ((mode & NORMAL) != 0) {
		String proposalText = "${}";
		StyledString displayText = new StyledString(proposalText, StyledString.DECORATIONS_STYLER).append(" - Create a new template variable", StyledString.QUALIFIER_STYLER);
		ICompletionProposal proposal = createCompletionProposal(proposalText, displayText, null, context);
		if (proposal instanceof ConfigurableCompletionProposal) {
			ConfigurableCompletionProposal configurable = (ConfigurableCompletionProposal) proposal;
			configurable.setSelectionStart(configurable.getReplacementOffset() + 2);
			configurable.setSelectionLength(0);
			configurable.setAutoInsertable(false);
			configurable.setSimpleLinkedMode(context.getViewer(), '\t', ' ');
		}
		acceptor.accept(proposal);
	}
}
 
Example 7
Source File: CheckCfgProposalProvider.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
// CHECKSTYLE:OFF
public void completeConfiguredLanguageValidator_Language(final EObject model, final Assignment assignment, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) {
  // CHECKSTYLE:ON
  for (String language : checkCfgUtil.getAllLanguages()) {
    acceptor.accept(createCompletionProposal(language, language, null, context));
  }
}
 
Example 8
Source File: XtextProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private void createAliasProposal(ContentAssistContext context, ICompletionProposalAcceptor acceptor,
		EPackage ePackage, String proposal) {
	if (!Strings.isEmpty(proposal)) {
		ConfigurableCompletionProposal completionProposal = (ConfigurableCompletionProposal) createCompletionProposal(
				proposal, proposal + " - alias", ePackage != null ? getImage(ePackage) : null, context);
		if (completionProposal != null) {
			completionProposal.setPriority(completionProposal.getPriority() * 2);
			acceptor.accept(completionProposal);
		}
	}
}
 
Example 9
Source File: DotHtmlLabelProposalProvider.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void completeHtmlAttr_Name(EObject model, Assignment assignment,
		ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {
	super.completeHtmlAttr_Name(model, assignment, context, acceptor);

	if (model instanceof HtmlTag) {
		HtmlTag htmlTag = (HtmlTag) model;
		String htmlTagName = htmlTag.getName();
		Map<String, Set<String>> validAttributes = DotHtmlLabelHelper
				.getValidAttributes();
		if (validAttributes.containsKey(htmlTagName)) {
			Image image = imageHelper.getImage("attribute.png"); //$NON-NLS-1$
			Set<String> validAttributeNames = validAttributes
					.get(htmlTagName);
			for (String validAttributeName : validAttributeNames) {
				String proposal = validAttributeName;
				String format = "%s: Attribute"; //$NON-NLS-1$
				StyledString displayString = DotEditorUtils.style(format,
						proposal);

				ICompletionProposal completionProposal = createCompletionProposal(
						proposal, displayString, image, context);

				// insert the ="" symbols after the html attribute name and
				// place the cursor between the two "" symbols
				if (completionProposal instanceof ConfigurableCompletionProposal) {
					ConfigurableCompletionProposal configurableCompletionProposal = (ConfigurableCompletionProposal) completionProposal;
					String replacementString = validAttributeName + "=\"\""; //$NON-NLS-1$
					configurableCompletionProposal
							.setReplacementString(replacementString);
					configurableCompletionProposal.setCursorPosition(
							replacementString.length() - 1);
					acceptor.accept(configurableCompletionProposal);
				}

			}
		}
	}
}
 
Example 10
Source File: TerminalsProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public void complete_ID(EObject model, RuleCall ruleCall, final ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {
	if (doCreateIdProposals()) {
		PrefixMatcher newMatcher = new PrefixMatcher() {
			@Override
			public boolean isCandidateMatchingPrefix(String name, String prefix) {
				String strippedName = name;
				if (name.startsWith("^") && !prefix.startsWith("^")) {
					strippedName = name.substring(1);
				}
				return context.getMatcher().isCandidateMatchingPrefix(strippedName, prefix);
			}
		};
		ContentAssistContext myContext = context.copy().setMatcher(newMatcher).toContext();
		String feature = getAssignedFeature(ruleCall);
		String proposalText = feature != null ? feature : Strings.toFirstUpper(ruleCall.getRule().getName().toLowerCase());
		String displayText = proposalText;
		if (feature != null)
			displayText = proposalText + " - " + ruleCall.getRule().getName();
		proposalText = getValueConverter().toString(proposalText, ruleCall.getRule().getName());
		ICompletionProposal proposal = createCompletionProposal(proposalText, displayText, null, myContext);
		if (proposal instanceof ConfigurableCompletionProposal) {
			ConfigurableCompletionProposal configurable = (ConfigurableCompletionProposal) proposal;
			configurable.setSelectionStart(configurable.getReplacementOffset());
			configurable.setSelectionLength(proposalText.length());
			configurable.setAutoInsertable(false);
			configurable.setSimpleLinkedMode(myContext.getViewer(), '\t', ' ');
		}
		acceptor.accept(proposal);
	}
}
 
Example 11
Source File: DotProposalProvider.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
private void proposeAttributeNames(Context attributeContext,
		ContentAssistContext contentAssistContext,
		ICompletionProposalAcceptor acceptor) {

	Image attributeImage = imageHelper.getImage("attribute.png"); //$NON-NLS-1$
	String format = "%s: Attribute"; //$NON-NLS-1$

	for (String attributeName : dotAttributeNames.get(attributeContext)) {
		StyledString displayString = DotEditorUtils.style(format,
				attributeName);
		ICompletionProposal completionProposal = createCompletionProposal(
				attributeName, displayString, attributeImage,
				contentAssistContext);
		if (completionProposal instanceof ConfigurableCompletionProposal) {
			ConfigurableCompletionProposal configurableCompletionProposal = (ConfigurableCompletionProposal) completionProposal;

			// ensure that the '=' symbol is inserted after the attribute
			// name when applying the proposal
			configurableCompletionProposal.setReplacementString(
					configurableCompletionProposal.getReplacementString()
							+ "="); //$NON-NLS-1$
			configurableCompletionProposal.setCursorPosition(
					configurableCompletionProposal.getCursorPosition() + 1);
		}
		acceptor.accept(completionProposal);
	}
}
 
Example 12
Source File: CheckCfgProposalProvider.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
// CHECKSTYLE:OFF
public void completeConfiguredParameter_NewValue(final EObject model, final Assignment assignment, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) {
  // CHECKSTYLE:ON
  // TODO filter depending on type of linked parameter
  FormalParameter parameter = ((ConfiguredParameter) model).getParameter();
  ICheckCfgPropertySpecification propertySpecification = null;
  String[] validValues = null;
  if (parameter != null) {
    propertySpecification = CheckCfgUtil.getPropertySpecification(parameter.getName());
    if (propertySpecification != null) {
      validValues = propertySpecification.getExpectedValues();
    }
  }
  if (validValues != null && validValues.length > 0) {
    String info = propertySpecification.getInfo();
    for (String validValue : validValues) {
      ICompletionProposal proposal = createCompletionProposal(String.format("\"%s\"", validValue), new StyledString(validValue), getImage(model), 0, context.getPrefix(), context);
      if (proposal instanceof ConfigurableCompletionProposal) {
        ((ConfigurableCompletionProposal) proposal).setAdditionalProposalInfo(info);
      }
      acceptor.accept(proposal);
    }
    return;
  }
  super.completeConfiguredParameter_NewValue(model, assignment, context, acceptor);
}
 
Example 13
Source File: XtextProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected void completeSpecialAttributeAssignment(String specialAttribute, int priorityFactor, Iterable<String> processedFeatures,
		Function<IEObjectDescription, ICompletionProposal> factory, ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {
	if(!contains(processedFeatures, specialAttribute)) {
		EAttribute dummyAttribute = EcoreFactory.eINSTANCE.createEAttribute();
		dummyAttribute.setName(specialAttribute);
		dummyAttribute.setEType(EcorePackage.Literals.ESTRING);
		acceptor.accept(createFeatureProposal(dummyAttribute, priorityFactor, factory, context));
	}
}
 
Example 14
Source File: BromiumProposalProvider.java    From bromium with MIT License 5 votes vote down vote up
@Override
public void complete_WebDriverAction(final EObject model, final RuleCall ruleCall, final ContentAssistContext context, final ICompletionProposalAcceptor acceptor) {
  acceptor.accept(this.createCompletionProposal("click on element with css selector \'selector\'", context));
  acceptor.accept(this.createCompletionProposal("click on element with class \'class\' and text \'text\'", context));
  acceptor.accept(this.createCompletionProposal("load page \'subpath\'", context));
  acceptor.accept(this.createCompletionProposal("type text \'text\' in element with css selector \'selector\'", context));
  acceptor.accept(this.createCompletionProposal("click on element with dataId \'id\'", context));
  acceptor.accept(this.createCompletionProposal("set variable \'variable\' to the text of element with css selector \'selector\'", context));
  acceptor.accept(this.createCompletionProposal("click on element with id \'id\'", context));
  acceptor.accept(this.createCompletionProposal("click on element with name \'name\'", context));
  acceptor.accept(this.createCompletionProposal("select value \'value\' in element with css selector \'selector\'", context));
  super.complete_WebDriverAction(model, ruleCall, context, acceptor);
}
 
Example 15
Source File: XtextProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private void createClassifierProposals(AbstractMetamodelDeclaration declaration, EObject model,
		ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	String alias = declaration.getAlias();
	QualifiedName prefix = (!Strings.isEmpty(alias)) ? QualifiedName.create(getValueConverter().toString(alias,
			grammarAccess.getValidIDRule().getName())) : null;
	boolean createDatatypeProposals = !(model instanceof AbstractElement)
			&& modelOrContainerIs(model, AbstractRule.class);
	boolean createEnumProposals = !(model instanceof AbstractElement) && modelOrContainerIs(model, EnumRule.class);
	boolean createClassProposals = modelOrContainerIs(model, ParserRule.class, CrossReference.class, Action.class);
	Function<IEObjectDescription, ICompletionProposal> factory = new DefaultProposalCreator(context, null, classifierQualifiedNameConverter);
	for (EClassifier classifier : declaration.getEPackage().getEClassifiers()) {
		if (classifier instanceof EDataType && createDatatypeProposals || classifier instanceof EEnum
				&& createEnumProposals || classifier instanceof EClass && createClassProposals) {
			String classifierName = getValueConverter().toString(classifier.getName(), grammarAccess.getValidIDRule().getName());
			QualifiedName proposalQualifiedName = (prefix != null) ? prefix.append(classifierName) : QualifiedName
					.create(classifierName);
			IEObjectDescription description = EObjectDescription.create(proposalQualifiedName, classifier);
			ConfigurableCompletionProposal proposal = (ConfigurableCompletionProposal) factory.apply(description);
			if (proposal != null) {
				if (prefix != null)
					proposal.setDisplayString(classifier.getName() + " - " + alias);
				proposal.setPriority(proposal.getPriority() * 2);
			}
			acceptor.accept(proposal);
		}
	}
}
 
Example 16
Source File: DotProposalProvider.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
private void proposeAttributeValues(String subgrammarName,
		ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {
	INode currentNode = context.getCurrentNode();
	String nodeText = currentNode.getText();
	String prefix = context.getPrefix();

	int offset = currentNode.getOffset();
	String text = nodeText.trim();

	if (!nodeText.contains(prefix)) {
		text = prefix;
		offset = context.getOffset() - prefix.length();
	} else {
		boolean quoted = text.startsWith("\"") //$NON-NLS-1$
				&& text.endsWith("\""); //$NON-NLS-1$
		boolean html = text.startsWith("<") && text.endsWith(">"); //$NON-NLS-1$ //$NON-NLS-2$

		if (quoted || html) {
			if (quoted) {
				text = ID.fromString(text, Type.QUOTED_STRING).toValue();
			} else {
				text = text.substring(1, text.length() - 1);
			}
			offset++;
		}
	}

	List<ConfigurableCompletionProposal> configurableCompletionProposals = new DotProposalProviderDelegator(
			subgrammarName).computeConfigurableCompletionProposals(text,
					context.getOffset() - offset);

	for (ConfigurableCompletionProposal configurableCompletionProposal : configurableCompletionProposals) {
		// adapt the replacement offset determined within the
		// sub-grammar context to be valid within the context of the
		// original text
		configurableCompletionProposal.setReplacementOffset(offset
				+ configurableCompletionProposal.getReplacementOffset());

		acceptor.accept(configurableCompletionProposal);
	}
}
 
Example 17
Source File: DotHtmlLabelProposalProvider.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void complete_HtmlTag(EObject model, RuleCall ruleCall,
		ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {

	String parentName = null;
	List<HtmlContent> siblings = new ArrayList<>();

	if (model instanceof HtmlTag) {
		HtmlTag tag = (HtmlTag) model;
		parentName = tag.getName();
		siblings = tag.getChildren();
	} else {
		parentName = DotHtmlLabelHelper.getRootTagKey();
		if (model instanceof HtmlLabel) {
			siblings = ((HtmlLabel) model).getParts();
		}
		if (model instanceof HtmlContent) {
			siblings.add((HtmlContent) model);
		}
	}

	Image image = imageHelper.getImage("html_tag.png"); //$NON-NLS-1$
	for (String tagName : DotHtmlLabelHelper.getValidTags()
			.get(parentName)) {
		if (isValidSibling(tagName, siblings)) {

			String proposal = calculateProposalString(tagName);
			String format = "%s: Tag"; //$NON-NLS-1$
			StyledString displayString = DotEditorUtils.style(format,
					proposal);

			ICompletionProposal completionProposal = createCompletionProposal(
					proposal, displayString, image, context);

			if (completionProposal instanceof ConfigurableCompletionProposal) {
				ConfigurableCompletionProposal configurableCompletionProposal = (ConfigurableCompletionProposal) completionProposal;
				int cursorPosition = calculateCursorPosition(proposal);
				String tagDescription = DotHtmlLabelHelper
						.getTagDescription(tagName);
				// place the cursor between the opening and the closing html
				// tag
				// after the proposal has been applied
				configurableCompletionProposal
						.setCursorPosition(cursorPosition);
				// add tag description to the proposal
				configurableCompletionProposal
						.setAdditionalProposalInfo(tagDescription);
				acceptor.accept(configurableCompletionProposal);
			}
		}
	}
}
 
Example 18
Source File: XtendProposalProvider.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
protected void addGuillemotsProposal(ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	acceptor.accept(new ConfigurableCompletionProposal("\u00AB\u00BB", context.getOffset(), context
			.getSelectedText().length(), 1));
}
 
Example 19
Source File: AbstractHelloWorldProposalProvider.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
public void complete_KeyOne(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
  acceptor.accept(createCompletionProposal("one", context));
}
 
Example 20
Source File: ImportsAwareReferenceProposalCreator.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Retrieves possible reference targets from scope, including erroneous solutions (e.g., not visible targets). This
 * list is further filtered here. This is a general pattern: Do not change or modify scoping for special content
 * assist requirements, instead filter here.
 *
 * @param proposalFactory
 *            usually this will be an instance of
 *            {@link AbstractJavaBasedContentProposalProvider.DefaultProposalCreator DefaultProposalCreator}.
 * @param filter
 *            by default an instance of {@link N4JSCandidateFilter} will be provided here.
 */
@SuppressWarnings("javadoc")
public void lookupCrossReference(
		EObject model,
		EReference reference,
		ContentAssistContext context,
		ICompletionProposalAcceptor acceptor,
		Predicate<IEObjectDescription> filter,
		Function<IEObjectDescription, ICompletionProposal> proposalFactory) {

	if (model != null) {
		final IScope scope = getScopeForContentAssist(model, reference);

		final Iterable<IEObjectDescription> candidates = getAllElements(scope);
		try (Measurement m = contentAssistDataCollectors.dcIterateAllElements().getMeasurement()) {
			for (IEObjectDescription candidate : candidates) {
				if (!acceptor.canAcceptMoreProposals())
					return;

				if (filter.apply(candidate)) {
					final QualifiedName qfn = candidate.getQualifiedName();
					final int qfnSegmentCount = qfn.getSegmentCount();
					final String tmodule = (qfnSegmentCount >= 2) ? qfn.getSegment(qfnSegmentCount - 2) : null;

					final ICompletionProposal proposal = getProposal(candidate,
							model,
							scope,
							reference,
							context,
							filter,
							proposalFactory);

					if (proposal instanceof ConfigurableCompletionProposal
							&& candidate.getName().getSegmentCount() > 1) {

						QualifiedName candidateName = getCandidateName(candidate, tmodule);
						ConfigurableCompletionProposal castedProposal = (ConfigurableCompletionProposal) proposal;
						castedProposal.setAdditionalData(N4JSReplacementTextApplier.KEY_QUALIFIED_NAME,
								candidateName);

						// Original qualified name is the qualified name before adjustment
						castedProposal.setAdditionalData(N4JSReplacementTextApplier.KEY_ORIGINAL_QUALIFIED_NAME,
								qfn);
					}
					acceptor.accept(proposal);
				}
			}
		}
	}
}