本文整理汇总了Java中org.eclipse.xtext.xbase.lib.Procedures.Procedure0.apply方法的典型用法代码示例。如果您正苦于以下问题:Java Procedure0.apply方法的具体用法?Java Procedure0.apply怎么用?Java Procedure0.apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.xbase.lib.Procedures.Procedure0
的用法示例。
在下文中一共展示了Procedure0.apply方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addButton
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0; //导入方法依赖的package包/类
public MyTextButton addButton(final Layout position, final Icons icon, final Procedure0 changeProcedure) {
MyTextButton _xblockexpression = null;
{
final Procedure0 _function = new Procedure0() {
@Override
public void apply() {
if ((!Widgets.this.hidden)) {
changeProcedure.apply();
}
}
};
final MyTextButton button = this.createButton(icon, _function);
button.setPosition(position.x, position.y);
final Procedure1<Boolean> _function_1 = new Procedure1<Boolean>() {
@Override
public void apply(final Boolean it) {
Widgets.this.changeText(it, icon, Widgets.this.helpLabel, Widgets.this.defaultHelpText);
}
};
button.addHoverListener(_function_1);
this.stage.addActor(button);
this.buttons.add(button);
_xblockexpression = button;
}
return _xblockexpression;
}
示例2: initializing
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0; //导入方法依赖的package包/类
private void initializing(final Procedure0 init) {
try {
this.initializing = true;
init.apply();
} finally {
this.initializing = false;
}
}
示例3: finish
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0; //导入方法依赖的package包/类
public void finish() {
final Procedure1<Procedure0> _function = new Procedure1<Procedure0>() {
@Override
public void apply(final Procedure0 it) {
it.apply();
}
};
IterableExtensions.<Procedure0>forEach(this.updateProcedures, _function);
}
示例4: isThrownBy
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0; //导入方法依赖的package包/类
private static <T extends Exception> void isThrownBy(final Class<T> expected, final Procedure0 block) {
try {
block.apply();
Assert.fail("Expected a " + expected.getName());
} catch (Exception e) {
Class<?> actual = e.getClass();
Assert.assertTrue(
"Expected a " + expected.getName() + " but got " + actual.getName(),
expected.isAssignableFrom(actual)
);
}
}
示例5: attempt
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0; //导入方法依赖的package包/类
/**
* Runs some code safely.
* Never throws an Exception.
* @return return true; on success.
*/
public static boolean attempt(final Procedure0 code) {
try {
code.apply();
return true;
} catch (final Throwable t) {
LOG.log(Level.SEVERE, t.getMessage(), t);
return false;
}
}
示例6: _executeTask
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0; //导入方法依赖的package包/类
public void _executeTask(final String name) {
Map<String, TaskDef> _tasks = this.getTasks();
final TaskDef task = _tasks.get(name);
boolean _equals = Objects.equal(task, null);
if (_equals) {
throw new UnsupportedOperationException((("A task \'" + name) + "\' does not exist."));
}
boolean _isExecuted = task.isExecuted();
if (_isExecuted) {
return;
}
boolean _isIsExecuting = task.isIsExecuting();
if (_isIsExecuting) {
throw new IllegalStateException((("Recursion detected : The task \'" + name) + "\' already running."));
}
try {
task.setIsExecuting(true);
List<String> _prerequisitedTasks = task.getPrerequisitedTasks();
final Procedure1<String> _function = new Procedure1<String>() {
public void apply(final String it) {
BuildScript.this._executeTask(it);
}
};
IterableExtensions.<String>forEach(_prerequisitedTasks, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("[Task \'");
_builder.append(name, "");
_builder.append("\']");
InputOutput.<String>println(_builder.toString());
Procedure0 _runnable = task.getRunnable();
if (_runnable!=null) {
_runnable.apply();
}
} finally {
task.setExecuted(true);
task.setIsExecuting(false);
}
}
示例7: andThen
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0; //导入方法依赖的package包/类
/**
* Returns a composed {@code Procedure1} that performs, in sequence, the {@code before}
* operation followed by the {@code after} operation. If performing either
* operation throws an exception, it is relayed to the caller of the
* composed operation. If performing the {@code before} operation throws an exception,
* the {@code after} operation will not be performed.
*
* @param before the operation to perform first
* @param after the operation to perform afterwards
* @return a composed {@code Procedure1} that performs in sequence the {@code before}
* operation followed by the {@code after} operation
* @throws NullPointerException if {@code before} or {@code after} is null
* @since 2.9
*/
public static Procedure0 andThen(final Procedure0 before, final Procedure0 after) {
if (after == null)
throw new NullPointerException("after");
if (before == null)
throw new NullPointerException("before");
return new Procedures.Procedure0() {
@Override
public void apply() {
before.apply();
after.apply();
}
};
}