org.eclipse.xtext.Assignment Java Examples

The following examples show how to use org.eclipse.xtext.Assignment. 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: AntlrContentAssistGrammarGenerator.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected CharSequence compileRule(final Object it, final Grammar grammar, final AntlrOptions options) {
  if (it instanceof Alternatives) {
    return _compileRule((Alternatives)it, grammar, options);
  } else if (it instanceof Group) {
    return _compileRule((Group)it, grammar, options);
  } else if (it instanceof UnorderedGroup) {
    return _compileRule((UnorderedGroup)it, grammar, options);
  } else if (it instanceof Assignment) {
    return _compileRule((Assignment)it, grammar, options);
  } else if (it instanceof EnumRule) {
    return _compileRule((EnumRule)it, grammar, options);
  } else if (it instanceof ParserRule) {
    return _compileRule((ParserRule)it, grammar, options);
  } else if (it instanceof TerminalRule) {
    return _compileRule((TerminalRule)it, grammar, options);
  } else if (it instanceof String) {
    return _compileRule((String)it, grammar, options);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(it, grammar, options).toString());
  }
}
 
Example #2
Source File: IdeContentProposalProvider.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
protected void createProposals(AbstractElement assignment, ContentAssistContext context,
		IIdeContentProposalAcceptor acceptor) {
	if (assignment instanceof Assignment) {
		_createProposals((Assignment) assignment, context, acceptor);
		return;
	} else if (assignment instanceof CrossReference) {
		_createProposals((CrossReference) assignment, context, acceptor);
		return;
	} else if (assignment instanceof Keyword) {
		_createProposals((Keyword) assignment, context, acceptor);
		return;
	} else if (assignment instanceof RuleCall) {
		_createProposals((RuleCall) assignment, context, acceptor);
		return;
	} else if (assignment != null) {
		_createProposals(assignment, context, acceptor);
		return;
	} else {
		throw new IllegalArgumentException(
				"Unhandled parameter types: " + Arrays.asList(assignment, context, acceptor).toString());
	}
}
 
Example #3
Source File: ArithmeticsProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * sets the selection on the arguments for proposed functions.
 */
@Override
public void completePrimaryExpression_Func(EObject model, Assignment assignment,
		ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	super.completePrimaryExpression_Func(model, assignment, context,
			new ICompletionProposalAcceptor.Delegate(acceptor) {
				@Override
				public void accept(ICompletionProposal proposal) {
					if (proposal instanceof ConfigurableCompletionProposal) {
						ConfigurableCompletionProposal configurableCompletionProposal = (ConfigurableCompletionProposal) proposal;
						String string = configurableCompletionProposal.getReplacementString();
						int indexOfOpenPar = string.indexOf(Character.valueOf('(').charValue());
						if (indexOfOpenPar != -1) {
							int oldSelectionStart = configurableCompletionProposal.getSelectionStart();
							int selectionStart = oldSelectionStart - string.length() + indexOfOpenPar + 1;
							int selectionLenth = oldSelectionStart - selectionStart - 1;
							configurableCompletionProposal.setSelectionStart(selectionStart);
							configurableCompletionProposal.setSelectionLength(selectionLenth);
						}
					}
					super.accept(proposal);
				}
			});
}
 
Example #4
Source File: XbaseIdeContentProposalProvider.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void createProposals(final AbstractElement assignment, final ContentAssistContext context, final IIdeContentProposalAcceptor acceptor) {
  if (assignment instanceof Assignment) {
    _createProposals((Assignment)assignment, context, acceptor);
    return;
  } else if (assignment instanceof CrossReference) {
    _createProposals((CrossReference)assignment, context, acceptor);
    return;
  } else if (assignment instanceof Keyword) {
    _createProposals((Keyword)assignment, context, acceptor);
    return;
  } else if (assignment instanceof RuleCall) {
    _createProposals((RuleCall)assignment, context, acceptor);
    return;
  } else if (assignment != null) {
    _createProposals(assignment, context, acceptor);
    return;
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(assignment, context, acceptor).toString());
  }
}
 
Example #5
Source File: AbstractAntlrGrammarWithActionsGenerator.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected String ebnf2(final AbstractElement it, final AntlrOptions options, final boolean supportActions) {
  if (it instanceof Alternatives) {
    return _ebnf2((Alternatives)it, options, supportActions);
  } else if (it instanceof Group) {
    return _ebnf2((Group)it, options, supportActions);
  } else if (it instanceof UnorderedGroup) {
    return _ebnf2((UnorderedGroup)it, options, supportActions);
  } else if (it instanceof Action) {
    return _ebnf2((Action)it, options, supportActions);
  } else if (it instanceof Assignment) {
    return _ebnf2((Assignment)it, options, supportActions);
  } else if (it instanceof EnumLiteralDeclaration) {
    return _ebnf2((EnumLiteralDeclaration)it, options, supportActions);
  } else if (it instanceof Keyword) {
    return _ebnf2((Keyword)it, options, supportActions);
  } else if (it instanceof RuleCall) {
    return _ebnf2((RuleCall)it, options, supportActions);
  } else if (it != null) {
    return _ebnf2(it, options, supportActions);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(it, options, supportActions).toString());
  }
}
 
Example #6
Source File: SemanticSequencerNfaProvider.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean isBooleanAssignment() {
	if (booleanAssignment == null) {
		Assignment assignment = GrammarUtil.containingAssignment(assignedGrammarElement);
		booleanAssignment = assignment != null && GrammarUtil.isBooleanAssignment(assignment);
	}
	return booleanAssignment;
}
 
Example #7
Source File: AbstractTypeExpressionsProposalProvider.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public void completeColonSepReturnTypeRef_ReturnTypeRef(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #8
Source File: AbstractTypesProposalProvider.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public void completeTField_Name(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #9
Source File: AbstractXmlProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeTag_Name(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #10
Source File: AbstractGamlProposalProvider.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public void completeS_Display_Facets(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #11
Source File: AbstractBacktrackingContentAssistTestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeStringLiteralExp_Values(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #12
Source File: AbstractUnorderedGroupsTestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeSimpleModel_Static(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	// subclasses may override
}
 
Example #13
Source File: AbstractXbaseProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeXFeatureCall_Feature(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor);
}
 
Example #14
Source File: XtextGrammarTestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeParserRule_Alternatives(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #15
Source File: AbstractGamlProposalProvider.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public void completeEquationRef_Ref(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor);
}
 
Example #16
Source File: AbstractUnorderedGroupsTestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeLoopedAlternativeModel_Static(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	// subclasses may override
}
 
Example #17
Source File: AbstractBug287941TestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeScopeClause_NotIn(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	// subclasses may override
}
 
Example #18
Source File: AbstractRefactoringTestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeMain_Elements(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #19
Source File: AbstractDomainmodelProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeOperation_Body(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #20
Source File: AbstractCodetemplatesProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeVariable_Parameters(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)((Alternatives)assignment.getTerminal()).getElements().get(0)), context, acceptor);
	completeRuleCall(((RuleCall)((Alternatives)assignment.getTerminal()).getElements().get(1)), context, acceptor);
}
 
Example #21
Source File: AbstractBug332217TestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeParameter_Description(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #22
Source File: AbstractBug287941TestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeStringAttributeWhereEntry_Alias(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor);
}
 
Example #23
Source File: AbstractBug289187TestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeAttribute_Visibility(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #24
Source File: AbstractXtextProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completePredicatedKeyword_Predicated(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	// subclasses may override
}
 
Example #25
Source File: AbstractBeeLangTestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeGuardExpression_GuardExpr(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #26
Source File: AbstractGamlProposalProvider.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public void completeArgumentDefinition_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #27
Source File: AbstractParameterizedExpressionsTestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeBlock_Statements(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #28
Source File: AbstractBeeLangTestLanguageProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeInfixExpression_Name(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #29
Source File: AbstractN4JSProposalProvider.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public void completeAnnotatedPropertyAssignment_DeclaredTypeRef(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
 
Example #30
Source File: AbstractXbaseProposalProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void completeXAdditiveExpression_Feature(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
	lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor);
}