com.intellij.util.ThrowableConsumer Java Examples
The following examples show how to use
com.intellij.util.ThrowableConsumer.
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: Unity3dLocalFileSystemComponent.java From consulo-unity3d with Apache License 2.0 | 6 votes |
public static boolean doActionOnSuffixFile(VirtualFile parentFile, ThrowableConsumer<VirtualFile, IOException> consumer, String suffix) { VirtualFile parent = parentFile.getParent(); if(parent == null) { return false; } VirtualFile metaFile = parent.findChild(parentFile.getName() + suffix); if(metaFile != null) { try { consumer.consume(metaFile); } catch(IOException e) { LOGGER.error(e); } } return false; }
Example #2
Source File: Unity3dLocalFileSystemComponent.java From consulo-unity3d with Apache License 2.0 | 5 votes |
private static boolean doActionOnMetaFile(VirtualFile parentFile, ThrowableConsumer<VirtualFile, IOException> consumer) { if(parentFile.getFileType() == Unity3dMetaFileType.INSTANCE) { return false; } return doActionOnSuffixFile(parentFile, consumer, ourMetaSuffix); }
Example #3
Source File: VcsLogData.java From consulo with Apache License 2.0 | 5 votes |
private void runInBackground(@Nonnull ThrowableConsumer<ProgressIndicator, VcsException> task) { Task.Backgroundable backgroundable = new Task.Backgroundable(myProject, "Loading History...", false) { @Override public void run(@Nonnull ProgressIndicator indicator) { indicator.setIndeterminate(true); try { task.consume(indicator); } catch (VcsException e) { throw new RuntimeException(e); // TODO } } }; myDataLoaderQueue.run(backgroundable, null, myRefresher.getProgress().createProgressIndicator()); }
Example #4
Source File: SequentialLimitedLifoExecutor.java From consulo with Apache License 2.0 | 5 votes |
public SequentialLimitedLifoExecutor(Disposable parentDisposable, int maxTasks, @Nonnull ThrowableConsumer<Task, ? extends Throwable> loadProcess) { myMaxTasks = maxTasks; myLoadProcess = loadProcess; myLoader = new QueueProcessor<>(new DetailsLoadingTask()); Disposer.register(parentDisposable, this); }
Example #5
Source File: DataInputOutputUtilRt.java From consulo with Apache License 2.0 | 5 votes |
/** * Writes the given collection to the output using the given procedure to write each element. * Should be coupled with {@link #readSeq} */ public static <T> void writeSeq(@Nonnull DataOutput out, @Nonnull Collection<? extends T> collection, @SuppressWarnings("BoundedWildcard") @Nonnull ThrowableConsumer<T, IOException> writeElement) throws IOException { writeINT(out, collection.size()); for (T t : collection) { writeElement.consume(t); } }
Example #6
Source File: DataInputOutputUtilRt.java From consulo with Apache License 2.0 | 5 votes |
/** * Writes the given map to the output using the given procedure to write each key and value. * Should be coupled with {@link #readMap} */ public static <K, V> void writeMap(@Nonnull DataOutput out, @Nonnull Map<? extends K, ? extends V> map, @Nonnull ThrowableConsumer<K, ? extends IOException> writeKey, @Nonnull ThrowableConsumer<V, ? extends IOException> writeValue) throws IOException { writeINT(out, map.size()); for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) { writeKey.consume(e.getKey()); writeValue.consume(e.getValue()); } }
Example #7
Source File: VcsFileUtil.java From consulo with Apache License 2.0 | 5 votes |
/** * Execute function for each chunk of arguments. Check for being cancelled in process. * * @param arguments the arguments to chunk * @param groupSize size of argument groups that should be put in the same chunk (like a name and a value) * @param consumer consumer to feed each chunk * @throws VcsException */ public static void foreachChunk(@Nonnull List<String> arguments, int groupSize, @Nonnull ThrowableConsumer<List<String>, VcsException> consumer) throws VcsException { List<List<String>> chunks = chunkArguments(arguments, groupSize); for (List<String> chunk : chunks) { ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); if (indicator != null) indicator.checkCanceled(); consumer.consume(chunk); } }
Example #8
Source File: TFSFileSystemListener.java From azure-devops-intellij with MIT License | 4 votes |
@Override public void afterDone(final ThrowableConsumer<LocalFileOperationsHandler, IOException> throwableConsumer) { // nothing to do }
Example #9
Source File: Unity3dLocalFileSystemComponent.java From consulo-unity3d with Apache License 2.0 | 4 votes |
@Override public void afterDone(ThrowableConsumer<LocalFileOperationsHandler, IOException> invoker) { }
Example #10
Source File: LocalFileSystemBase.java From consulo with Apache License 2.0 | 4 votes |
private void auxNotifyCompleted(@Nonnull ThrowableConsumer<LocalFileOperationsHandler, IOException> consumer) { for (LocalFileOperationsHandler handler : myHandlers) { handler.afterDone(consumer); } }
Example #11
Source File: DataInputOutputUtil.java From consulo with Apache License 2.0 | 4 votes |
/** * Writes the given (possibly null) element to the output using the given procedure to write the element if it's not null. * Should be coupled with {@link #readNullable} */ public static <T> void writeNullable(@Nonnull DataOutput out, @Nullable T value, @Nonnull ThrowableConsumer<T, IOException> writeValue) throws IOException { out.writeBoolean(value != null); if (value != null) writeValue.consume(value); }
Example #12
Source File: LocalFileOperationsHandler.java From consulo with Apache License 2.0 | votes |
void afterDone(final ThrowableConsumer<LocalFileOperationsHandler, IOException> invoker);