Java Code Examples for org.eclipse.xtext.xbase.lib.Procedures#Procedure1

The following examples show how to use org.eclipse.xtext.xbase.lib.Procedures#Procedure1 . 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: JvmTypesBuilder.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected void setCompilationStrategy(/* @Nullable */ JvmMember member, /* @Nullable */ Procedures.Procedure1<ITreeAppendable> strategy) {
	if(member == null || strategy == null)
		return;
	CompilationStrategyAdapter adapter = new CompilationStrategyAdapter();
	adapter.setCompilationStrategy(strategy);
	member.eAdapters().add(adapter);
}
 
Example 2
Source File: ClosureClient.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.3
 */
public String useProcedureForCharSequence(Procedures.Procedure1<CharSequence> proc) {
	proc.apply(null);
	return "done";
}
 
Example 3
Source File: ClosureClient.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.3
 */
public String useProcedureForCharSequence(Procedures.Procedure1<CharSequence> proc) {
	proc.apply(null);
	return "done";
}
 
Example 4
Source File: ClosureClient.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.3
 */
public String useProcedureForCharSequence(Procedures.Procedure1<CharSequence> proc) {
	proc.apply(null);
	return "done";
}
 
Example 5
Source File: SampleBuilder.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public static Child staticChild(Parent parent, Procedures.Procedure1<? super Child> init) {
	Child result = new Child();
	parent.child = result;
	init.apply(result);
	return result;
}
 
Example 6
Source File: CompilationStrategyAdapter.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public Procedures.Procedure1<ITreeAppendable> getCompilationStrategy() {
	return compilationStrategy;
}
 
Example 7
Source File: CompilationStrategyAdapter.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public void setCompilationStrategy(Procedures.Procedure1<ITreeAppendable> compilationStrategy) {
	this.compilationStrategy = compilationStrategy;
}
 
Example 8
Source File: SampleBuilder.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Child child(Parent parent, Procedures.Procedure1<? super Child> init) {
	Child result = new Child();
	parent.child = result;
	init.apply(result);
	return result;
}
 
Example 9
Source File: SampleBuilder.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public static Parent staticParent(Root root, Procedures.Procedure1<? super Parent> init) {
	Parent result = new Parent();
	root.parent = result;
	init.apply(result);
	return result;
}
 
Example 10
Source File: IJvmDeclaredTypeAcceptor.java    From xtext-extras with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Accepts a {@link JvmDeclaredType} with no container, to be added to the contents list of a {@link org.eclipse.emf.ecore.resource.Resource}.
 * The second parameter is a lazy initializer that is never executed during <i>preIndexingPhase</i>. 
 * 
 * @see IJvmModelInferrer#infer(EObject, IJvmDeclaredTypeAcceptor, boolean)
 * 
 * @param type the type to
 * @param lateInitialization the initializer
 */
<T extends JvmDeclaredType> void accept(T type, Procedures.Procedure1<? super T> lateInitialization);
 
Example 11
Source File: MutableTypeDeclaration.java    From xtext-lib with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Adds a new method with the given name to this type declaration.
 * 
 * @param name the name of the method
 * @param initializer a call back for further initialization of the method
 * @return the created method declaration
 * @throws UnsupportedOperationException if the underlying type declaration is not capable of containing methods.
 * @exception IllegalArgumentException if the <code>name</code> is not a valid java identifier or the <code>initializer</code> is <code>null</code>
 */
MutableMethodDeclaration addMethod(String name, Procedures.Procedure1<MutableMethodDeclaration> initializer);
 
Example 12
Source File: MutableTypeDeclaration.java    From xtext-lib with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Adds a new field with the given name. 
 * 
 * @param name the name of the field to be added, must be not <code>null</code>
 * @param initializer a callback for further initialization of the created field, must be not <code>null</code>
 * @return the created field declaration
 * @throws UnsupportedOperationException if the underlying type declaration is not capable of containing methods.
 * @exception IllegalArgumentException if the <code>name</code> is not a valid java identifier or the <code>initializer</code> is <code>null</code>
 */
MutableFieldDeclaration addField(String name, Procedures.Procedure1<MutableFieldDeclaration> initializer);
 
Example 13
Source File: AnnotationReferenceProvider.java    From xtext-lib with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Create a new annotation reference base on the given annotation reference.
 * 
 * @param annotationReference an annotation reference which is used as a base for a new annotation reference, must not be <code>null</code> or detached. 
 * @param initializer a callback for further initialization of the create annotation reference, must not be <code>null</code>.
 * @return a {@link AnnotationReference} constructed based on the given annotation reference, can be <code>null</code> 
 * @throws IllegalArgumentException if the given annotation reference is <code>null</code> or detached; or the <code>initializer</code> is <code>null</code>
 */
AnnotationReference newAnnotationReference(AnnotationReference annotationReference, Procedures.Procedure1<AnnotationReferenceBuildContext> initializer);
 
Example 14
Source File: AnnotationReferenceProvider.java    From xtext-lib with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Creates a new annotation reference for the given name.
 *  
 * @param annotationTypeName the name of the annotation type to point to
 * @param initializer a callback for further initialization of the create annotation reference, must not be <code>null</code>.
 * @return a {@link AnnotationReference} pointing to the type with the give name, or <code>null</code> if no such annotation type could be found.
 * @throws IllegalArgumentException if the <code>name</code> is not a valid java identifier or the <code>initializer</code> is <code>null</code>
 */
AnnotationReference newAnnotationReference(String annotationTypeName, Procedures.Procedure1<AnnotationReferenceBuildContext> initializer);
 
Example 15
Source File: JvmTypesBuilder.java    From xtext-extras with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Attaches the given compile strategy to the given {@link JvmExecutable} such that the compiler knows how to
 * implement the {@link JvmExecutable} when it is translated to Java source code.
 * 
 * @param executable the operation or constructor to add the method body to. If <code>null</code> this method does nothing.
 * @param strategy the compilation strategy. If <code>null</code> this method does nothing.
 */
public void setBody(/* @Nullable */ JvmExecutable executable, /* @Nullable */ Procedures.Procedure1<ITreeAppendable> strategy) {
	removeExistingBody(executable);
	setCompilationStrategy(executable, strategy);
}
 
Example 16
Source File: IJvmDeclaredTypeAcceptor.java    From xtext-extras with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * The passed procedure will be executed only if in post-indexing phase, and it is executed after all {@link JvmDeclaredType} are created
 * and attached to the {@link org.eclipse.emf.ecore.resource.Resource}.
 * 
 * @deprecated use {@link #accept(JvmDeclaredType, org.eclipse.xtext.xbase.lib.Procedures.Procedure1)} instead
 */
@Deprecated
void initializeLater(Procedures.Procedure1<? super T> lateInitialization);
 
Example 17
Source File: CopiedAbstractXtendFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 votes vote down vote up
public void assertFormatted(Procedures.Procedure1<? super MapBasedPreferenceValues> p, CharSequence c1, CharSequence c2) {} 
Example 18
Source File: CopiedAbstractXtendFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 votes vote down vote up
public void assertFormattedExpression(Procedures.Procedure1<? super MapBasedPreferenceValues> p, CharSequence c, CharSequence c2) {} 
Example 19
Source File: ReturnTypeUsesTypeParameter.java    From xtext-xtend with Eclipse Public License 2.0 votes vote down vote up
void useProcedure(Procedures.Procedure1<? super T> proc); 
Example 20
Source File: CopiedAbstractXtendFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 votes vote down vote up
public void assertFormattedMember(Procedures.Procedure1<? super MapBasedPreferenceValues> p, String s) {}