/** * Delegates to set(). * * @deprecated Provided to satisfy the {@code Function} interface; use {@link #set} instead. */ @Deprecated default void accept(@javax.annotation.Nullable T value) { set(value); }
/** * Delegates to set(). * * @deprecated Provided to satisfy the {@code Function} interface; use {@link #set} instead. */ @Deprecated default void accept(@javax.annotation.Nullable T value) { set(value); }
/** Maps one {@code Box.Nullable} to another {@code Box.Nullable}. */ default <R> Box.Nullable<R> map(Function<? super T, ? extends R> getMapper, Function<? super R, ? extends T> setMapper) { return Box.Nullable.from(() -> getMapper.apply(get()), toSet -> set(setMapper.apply(toSet))); }
/** * Performs a blocking get in the UI thread. * * @param supplier will be executed in the UI thread. * @return the value which was returned by supplier. */ public <T> T get(Supplier<T> supplier) { if (Thread.currentThread() == swtThread) { return supplier.get(); } else { Nullable<T> holder = Nullable.ofVolatileNull(); display.syncExec(() -> holder.set(supplier.get())); return holder.get(); } } }
/** Sets the given {@link Item} to have the image described by the given descriptor, maintaining proper reference counting. */ public static void set(Item widget, ImageDescriptor image) { globalSetter.forWidget(widget).set(image); }
/** Delegates to set(). */ default void accept(T value) { set(value); }
@Override public void set(R value) { delegate.set(converter.revert(value)); }
private static Map<String, String> parseFromFile(File artifactsJar) throws IOException { Box.Nullable<Map<String, String>> value = Box.Nullable.ofNull(); ZipMisc.read(artifactsJar, "artifacts.xml", input -> { value.set(Errors.rethrow().get(() -> parse(input))); }); return Objects.requireNonNull(value.get()); } }
/** Sets the given {@link Label} to have the image described by the given descriptor, maintaining proper reference counting. */ public static void set(Label widget, ImageDescriptor image) { globalSetter.forWidget(widget).set(image); }
/** Sets the given {@link Button} to have the image described by the given descriptor, maintaining proper reference counting. */ public static void set(Button widget, ImageDescriptor image) { globalSetter.forWidget(widget).set(image); }
/** Shortcut for doing a set() on the result of a get(). */ default T modify(Function<? super T, ? extends T> mutator) { T modified = mutator.apply(get()); set(modified); return modified; }
@Override public R modify(Function<? super R, ? extends R> mutator) { Objects.requireNonNull(mutator); Box.Nullable<R> result = Box.Nullable.of(null); delegate.modify(input -> { R unmappedResult = mutator.apply(converter.convertNonNull(input)); result.set(unmappedResult); return converter.revertNonNull(unmappedResult); }); return result.get(); }
@Override public void set(@javax.annotation.Nullable R value) { delegate.set(converter.revert(value)); }
@SuppressFBWarnings(value = "DMI_THREAD_PASSED_WHERE_RUNNABLE_EXPECTED", justification = "splashHandler is a thread rather than a runnable. Almost definitely a small bug, " + "but there's a lot of small bugs in the copy-pasted launcher code. It's battle-tested, FWIW.") @Override protected void invokeFramework(String[] passThruArgs, URL[] bootPath) throws Exception { context.set(EclipseStarter.startup(passThruArgs, splashHandler)); } };
/** Shortcut for doing a set() on the result of a get(). */ default T modify(Function<? super T, ? extends T> mutator) { T modified = mutator.apply(get()); set(modified); return modified; }
/** Shortcut for doing a set() on the result of a get(). */ @Override public R modify(Function<? super R, ? extends R> mutator) { Objects.requireNonNull(mutator); Box.Nullable<R> result = Box.Nullable.of(null); delegate.modify(input -> { R unmappedResult = mutator.apply(converter.convert(input)); result.set(unmappedResult); return converter.revert(unmappedResult); }); return result.get(); }
@Override public void run() { try { runnable.run(); } catch (Throwable e) { testError.set(e); } } };
/** Shortcut for doing a set() on the result of a get(). */ default T modify(Function<? super T, ? extends T> mutator) { T modified = mutator.apply(get()); set(modified); return modified; }
/** Shortcut for doing a set() on the result of a get(). */ @Override public R modify(Function<? super R, ? extends R> mutator) { Box.Nullable<R> result = Box.Nullable.of(null); delegate.modify(input -> { R unmappedResult = mutator.apply(converter.convert(input)); result.set(unmappedResult); return converter.revert(unmappedResult); }); return result.get(); }
/** Shortcut for doing a set() on the result of a get(). */ @Override public R modify(Function<? super R, ? extends R> mutator) { Box.Nullable<R> result = Box.Nullable.of(null); delegate.modify(input -> { R unmappedResult = mutator.apply(converter.convertNonNull(input)); result.set(unmappedResult); return converter.revertNonNull(unmappedResult); }); return result.get(); }