Java Code Examples for com.intellij.util.Producer#produce()
The following examples show how to use
com.intellij.util.Producer#produce() .
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: OnePixelDivider.java From consulo with Apache License 2.0 | 6 votes |
@Override public void paint(Graphics g) { final Rectangle bounds = g.getClipBounds(); if (mySplitter instanceof OnePixelSplitter) { final Producer<Insets> blindZone = ((OnePixelSplitter)mySplitter).getBlindZone(); if (blindZone != null) { final Insets insets = blindZone.produce(); if (insets != null) { bounds.x += insets.left; bounds.y += insets.top; bounds.width -= insets.left + insets.right; bounds.height -= insets.top + insets.bottom; g.setColor(getBackground()); g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); return; } } } super.paint(g); }
Example 2
Source File: PasteReferenceProvider.java From consulo with Apache License 2.0 | 6 votes |
@Nullable private static String getCopiedFqn(final DataContext context) { Producer<Transferable> producer = context.getData(PasteAction.TRANSFERABLE_PROVIDER); if (producer != null) { Transferable transferable = producer.produce(); if (transferable != null) { try { return (String)transferable.getTransferData(CopyReferenceAction.ourFlavor); } catch (Exception ignored) { } } return null; } return CopyPasteManager.getInstance().getContents(CopyReferenceAction.ourFlavor); }
Example 3
Source File: EditorModificationUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public static Transferable getContentsToPasteToEditor(@Nullable Producer<Transferable> producer) { if (producer == null) { CopyPasteManager manager = CopyPasteManager.getInstance(); return manager.areDataFlavorsAvailable(DataFlavor.stringFlavor) ? manager.getContents() : null; } else { return producer.produce(); } }
Example 4
Source File: EditorModificationUtil.java From consulo with Apache License 2.0 | 5 votes |
private static Transferable getTransferable(Producer<Transferable> producer) { Transferable content = null; if (producer != null) { content = producer.produce(); } else { CopyPasteManager manager = CopyPasteManager.getInstance(); if (manager.areDataFlavorsAvailable(DataFlavor.stringFlavor)) { content = manager.getContents(); } } return content; }
Example 5
Source File: ChangeSet.java From consulo with Apache License 2.0 | 5 votes |
private <T> T accessChanges(@Nonnull Producer<T> func) { if (isLocked) { //noinspection ConstantConditions return func.produce(); } synchronized (myChanges) { //noinspection ConstantConditions return func.produce(); } }
Example 6
Source File: AbstractRemoteExternalSystemService.java From consulo with Apache License 2.0 | 5 votes |
protected <T> T execute(@Nonnull ExternalSystemTaskId id, @Nonnull Producer<T> task) { Set<ExternalSystemTaskId> tasks = myTasksInProgress.get(id.getType()); if (tasks == null) { myTasksInProgress.putIfAbsent(id.getType(), new HashSet<ExternalSystemTaskId>()); tasks = myTasksInProgress.get(id.getType()); } tasks.add(id); try { return task.produce(); } finally { tasks.remove(id); } }