本文整理汇总了Java中com.intellij.util.Producer.produce方法的典型用法代码示例。如果您正苦于以下问题:Java Producer.produce方法的具体用法?Java Producer.produce怎么用?Java Producer.produce使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.Producer
的用法示例。
在下文中一共展示了Producer.produce方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paint
import com.intellij.util.Producer; //导入方法依赖的package包/类
@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);
}
示例2: getCopiedFqn
import com.intellij.util.Producer; //导入方法依赖的package包/类
@Nullable
private static String getCopiedFqn(final DataContext context) {
Producer<Transferable> producer = PasteAction.TRANSFERABLE_PROVIDER.getData(context);
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);
}
示例3: createMap
import com.intellij.util.Producer; //导入方法依赖的package包/类
@Nonnull
public static <K, V> ConcurrentMap<K, V> createMap(@Nonnull final Function<K, V> computeValue, @Nonnull final Producer<ConcurrentMap<K,V>> mapCreator) {
//noinspection deprecation
return new ConcurrentFactoryMap<K, V>() {
@Nullable
@Override
protected V create(K key) {
return computeValue.fun(key);
}
@Nonnull
@Override
protected ConcurrentMap<K, V> createMap() {
return mapCreator.produce();
}
};
}
示例4: createMap
import com.intellij.util.Producer; //导入方法依赖的package包/类
@Nonnull
public static <K, V> Map<K, V> createMap(@Nonnull final Function<K, V> computeValue, @Nonnull final Producer<Map<K,V>> mapCreator) {
//noinspection deprecation
return new FactoryMap<K, V>() {
@Nullable
@Override
protected V create(K key) {
return computeValue.fun(key);
}
@Nonnull
@Override
protected Map<K, V> createMap() {
return mapCreator.produce();
}
};
}
示例5: getCopiedFqn
import com.intellij.util.Producer; //导入方法依赖的package包/类
@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);
}
示例6: getContentsToPasteToEditor
import com.intellij.util.Producer; //导入方法依赖的package包/类
@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();
}
}
示例7: getTransferable
import com.intellij.util.Producer; //导入方法依赖的package包/类
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;
}
示例8: accessChanges
import com.intellij.util.Producer; //导入方法依赖的package包/类
private <T> T accessChanges(@NotNull Producer<T> func) {
if (isLocked) {
//noinspection ConstantConditions
return func.produce();
}
synchronized (myChanges) {
//noinspection ConstantConditions
return func.produce();
}
}
示例9: execute
import com.intellij.util.Producer; //导入方法依赖的package包/类
protected <T> T execute(@NotNull ExternalSystemTaskId id, @NotNull 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);
}
}
示例10: callMac
import com.intellij.util.Producer; //导入方法依赖的package包/类
private static <T> T callMac(Producer<T> producer) {
if (SystemInfo.isMac) {
NSAutoreleasePool pool = new NSAutoreleasePool();
try {
return producer.produce();
}
catch (Throwable throwable) {
Logger.getInstance(MacScrollBarUI.class).warn(throwable);
}
finally {
pool.drain();
}
}
return null;
}
示例11: accessChanges
import com.intellij.util.Producer; //导入方法依赖的package包/类
private <T> T accessChanges(@Nonnull Producer<T> func) {
if (isLocked) {
//noinspection ConstantConditions
return func.produce();
}
synchronized (myChanges) {
//noinspection ConstantConditions
return func.produce();
}
}
示例12: execute
import com.intellij.util.Producer; //导入方法依赖的package包/类
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);
}
}
示例13: performWithLambdaTargetType
import com.intellij.util.Producer; //导入方法依赖的package包/类
public static <T> T performWithLambdaTargetType(PsiLambdaExpression lambdaExpression, PsiType targetType, Producer<T> producer)
{
try
{
getFunctionalTypeMap().put(lambdaExpression, targetType);
return producer.produce();
}
finally
{
getFunctionalTypeMap().remove(lambdaExpression);
}
}