当前位置: 首页>>代码示例>>Java>>正文


Java Producer.produce方法代码示例

本文整理汇总了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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:OnePixelDivider.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PasteReferenceProvider.java

示例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();
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:ConcurrentFactoryMap.java

示例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();
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:FactoryMap.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:PasteReferenceProvider.java

示例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();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:EditorModificationUtil.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:EditorModificationUtil.java

示例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();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ChangeSet.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AbstractRemoteExternalSystemService.java

示例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;
}
 
开发者ID:JetBrains,项目名称:jediterm,代码行数:16,代码来源:MacScrollBarUI.java

示例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();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:ChangeSet.java

示例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);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:AbstractRemoteExternalSystemService.java

示例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);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:13,代码来源:LambdaUtil.java


注:本文中的com.intellij.util.Producer.produce方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。