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


Java ConstantFunction类代码示例

本文整理汇总了Java中com.intellij.util.ConstantFunction的典型用法代码示例。如果您正苦于以下问题:Java ConstantFunction类的具体用法?Java ConstantFunction怎么用?Java ConstantFunction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConstantFunction类属于com.intellij.util包,在下文中一共展示了ConstantFunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllowedNamespaces

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
/**
 * Consider using {@link DomService#getXmlFileHeader(com.intellij.psi.xml.XmlFile)} when implementing this.
 */
@SuppressWarnings({"MethodMayBeStatic"})
@NotNull
public List<String> getAllowedNamespaces(@NotNull String namespaceKey, @NotNull XmlFile file) {
  final NotNullFunction<XmlTag, List<String>> function = myNamespacePolicies.get(namespaceKey);
  if (function instanceof ConstantFunction) {
    return function.fun(null);
  }

  if (function != null) {
    final XmlDocument document = file.getDocument();
    if (document != null) {
      final XmlTag tag = document.getRootTag();
      if (tag != null) {
        return function.fun(tag);
      }
    }
  } else {
    return Collections.singletonList(namespaceKey);
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:DomFileDescription.java

示例2: getRelatedPopover

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
@NotNull
private LineMarkerInfo getRelatedPopover(@NotNull String singleItemTitle, @NotNull String singleItemTooltipPrefix, @NotNull PsiElement lineMarkerTarget, @NotNull Collection<GotoRelatedItem> gotoRelatedItems, @NotNull Icon icon) {
    // single item has no popup
    String title = singleItemTitle;
    if(gotoRelatedItems.size() == 1) {
        String customName = gotoRelatedItems.iterator().next().getCustomName();
        if(customName != null) {
            title = String.format(singleItemTooltipPrefix, customName);
        }
    }

    return new LineMarkerInfo<>(
        lineMarkerTarget,
        lineMarkerTarget.getTextRange(),
        icon,
        6,
        new ConstantFunction<>(title),
        new RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems),
        GutterIconRenderer.Alignment.RIGHT
    );
}
 
开发者ID:Haehnchen,项目名称:idea-php-laravel-plugin,代码行数:22,代码来源:TemplateLineMarker.java

示例3: getRelatedPopover

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
private LineMarkerInfo getRelatedPopover(String singleItemTitle, String singleItemTooltipPrefix, PsiElement lineMarkerTarget, List<GotoRelatedItem> gotoRelatedItems) {

        // single item has no popup
        String title = singleItemTitle;
        if(gotoRelatedItems.size() == 1) {
            String customName = gotoRelatedItems.get(0).getCustomName();
            if(customName != null) {
                title = String.format(singleItemTooltipPrefix, customName);
            }
        }

        return new LineMarkerInfo<>(
            lineMarkerTarget,
            lineMarkerTarget.getTextRange(),
            ShopwarePluginIcons.SHOPWARE_LINEMARKER,
            6,
            new ConstantFunction<>(title),
            new fr.adrienbrault.idea.symfony2plugin.dic.RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems),
            GutterIconRenderer.Alignment.RIGHT
        );
    }
 
开发者ID:Haehnchen,项目名称:idea-php-shopware-plugin,代码行数:22,代码来源:SmartyTemplateLineMarkerProvider.java

示例4: createMarker

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
@Nullable
@RequiredReadAction
private static LineMarkerInfo createMarker(final PsiElement element)
{
	CSharpMethodDeclaration methodDeclaration = CSharpLineMarkerUtil.getNameIdentifierAs(element, CSharpMethodDeclaration.class);
	if(methodDeclaration != null)
	{
		Unity3dModuleExtension extension = ModuleUtilCore.getExtension(element, Unity3dModuleExtension.class);
		if(extension == null)
		{
			return null;
		}

		UnityFunctionManager.FunctionInfo magicMethod = findMagicMethod(methodDeclaration);
		if(magicMethod != null)
		{
			return new LineMarkerInfo<>(element, element.getTextRange(), Unity3dIcons.EventMethod, Pass.LINE_MARKERS, new ConstantFunction<>(magicMethod.getDescription()), null,
					GutterIconRenderer.Alignment.LEFT);
		}
	}

	return null;
}
 
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:24,代码来源:UnityEventCSharpMethodLineMarkerProvider.java

示例5: createLineMarkerInfo

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
public RelatedItemLineMarkerInfo<PsiElement> createLineMarkerInfo(@NotNull PsiElement element) {
  final MyNavigationGutterIconRenderer renderer = createGutterIconRenderer(element.getProject());
  final String tooltip = renderer.getTooltipText();
  NotNullLazyValue<Collection<? extends GotoRelatedItem>> gotoTargets = new NotNullLazyValue<Collection<? extends GotoRelatedItem>>() {
    @NotNull
    @Override
    protected Collection<? extends GotoRelatedItem> compute() {
      if (myGotoRelatedItemProvider != null) {
        return ContainerUtil.concat(myTargets.getValue(), myGotoRelatedItemProvider);
      }
      return Collections.emptyList();
    }
  };
  return new RelatedItemLineMarkerInfo<PsiElement>(element, element.getTextRange(), renderer.getIcon(), Pass.UPDATE_OVERRIDEN_MARKERS,
                                                   tooltip == null ? null : new ConstantFunction<PsiElement, String>(tooltip),
                                                   renderer.isNavigateAction() ? renderer : null, renderer.getAlignment(),
                                                   gotoTargets);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:NavigationGutterIconBuilder.java

示例6: getRelatedPopover

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
private LineMarkerInfo getRelatedPopover(String singleItemTitle, String singleItemTooltipPrefix, PsiElement lineMarkerTarget, List<GotoRelatedItem> gotoRelatedItems, Icon icon) {

        // single item has no popup
        String title = singleItemTitle;
        if(gotoRelatedItems.size() == 1) {
            String customName = gotoRelatedItems.get(0).getCustomName();
            if(customName != null) {
                title = String.format(singleItemTooltipPrefix, customName);
            }
        }

        return new LineMarkerInfo<>(
            lineMarkerTarget,
            lineMarkerTarget.getTextRange(),
            icon,
            6,
            new ConstantFunction<>(title),
            new RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems),
            GutterIconRenderer.Alignment.RIGHT
        );
    }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:22,代码来源:TwigLineMarkerProvider.java

示例7: createLineMarkerInfo

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
public RelatedItemLineMarkerInfo<PsiElement> createLineMarkerInfo(@Nonnull PsiElement element) {
  final MyNavigationGutterIconRenderer renderer = createGutterIconRenderer(element.getProject());
  final String tooltip = renderer.getTooltipText();
  NotNullLazyValue<Collection<? extends GotoRelatedItem>> gotoTargets = new NotNullLazyValue<Collection<? extends GotoRelatedItem>>() {
    @Nonnull
    @Override
    protected Collection<? extends GotoRelatedItem> compute() {
      if (myGotoRelatedItemProvider != null) {
        return ContainerUtil.concat(myTargets.getValue(), myGotoRelatedItemProvider);
      }
      return Collections.emptyList();
    }
  };
  return new RelatedItemLineMarkerInfo<PsiElement>(element, element.getTextRange(), renderer.getIcon(), Pass.LINE_MARKERS,
                                                   tooltip == null ? null : new ConstantFunction<PsiElement, String>(tooltip),
                                                   renderer.isNavigateAction() ? renderer : null, renderer.getAlignment(),
                                                   gotoTargets);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:NavigationGutterIconBuilder.java

示例8: createLineMakerInfo

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
@NotNull
private LineMarkerInfo<PsiElement> createLineMakerInfo(@NotNull PsiElement psiElement, @NotNull Icon icon) {
    return new LineMarkerInfo<>(
        psiElement,
        psiElement.getTextRange(),
        icon,
        6,
        new ConstantFunction<>("Run Test"),
        new MyProgramRunnerGutterIconNavigationHandler(),
        GutterIconRenderer.Alignment.LEFT
    );
}
 
开发者ID:Haehnchen,项目名称:idea-php-behat-plugin,代码行数:13,代码来源:TestRunLineMarkerProvider.java

示例9: extractExpectedLineMarkerSet

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
private void extractExpectedLineMarkerSet(Document document) {
  String text = document.getText();

  @NonNls String pat = ".*?((<" + LINE_MARKER + ")(?: descr=\"((?:[^\"\\\\]|\\\\\")*)\")?>)(.*)";
  final Pattern p = Pattern.compile(pat, Pattern.DOTALL);
  final Pattern pat2 = Pattern.compile("(.*?)(</" + LINE_MARKER + ">)(.*)", Pattern.DOTALL);

  while (true) {
    Matcher m = p.matcher(text);
    if (!m.matches()) break;
    int startOffset = m.start(1);
    final String descr = m.group(3) != null ? m.group(3) : ANY_TEXT;
    String rest = m.group(4);

    document.replaceString(startOffset, m.end(1), "");

    final Matcher matcher2 = pat2.matcher(rest);
    LOG.assertTrue(matcher2.matches(), "Cannot find closing </" + LINE_MARKER + ">");
    String content = matcher2.group(1);
    int endOffset = startOffset + matcher2.start(3);
    String endTag = matcher2.group(2);

    document.replaceString(startOffset, endOffset, content);
    endOffset -= endTag.length();

    LineMarkerInfo markerInfo = new LineMarkerInfo<PsiElement>(myFile, new TextRange(startOffset, endOffset), null, Pass.LINE_MARKERS,
                                                               new ConstantFunction<PsiElement, String>(descr), null,
                                                               GutterIconRenderer.Alignment.RIGHT);

    lineMarkerInfos.put(document.createRangeMarker(startOffset, endOffset), markerInfo);
    text = document.getText();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:ExpectedHighlightingData.java

示例10: createLineMarkerInfo

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
public RelatedItemLineMarkerInfo<PsiElement> createLineMarkerInfo(@NotNull PsiElement element) {
  final MyNavigationGutterIconRenderer renderer = createGutterIconRenderer(element.getProject());
  final String tooltip = renderer.getTooltipText();
  NotNullLazyValue<Collection<? extends GotoRelatedItem>> gotoTargets = createGotoTargetsThunk(myLazy, myGotoRelatedItemProvider,
                                                                                               evaluateAndForget(myTargets));
  return new RelatedItemLineMarkerInfo<PsiElement>(element, element.getTextRange(), renderer.getIcon(), Pass.UPDATE_OVERRIDEN_MARKERS,
                                                   tooltip == null ? null : new ConstantFunction<PsiElement, String>(tooltip),
                                                   renderer.isNavigateAction() ? renderer : null, renderer.getAlignment(),
                                                   gotoTargets);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:NavigationGutterIconBuilder.java

示例11: doGetLineMarkerInfo

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
private static LineMarkerInfo doGetLineMarkerInfo(PsiElement element) {
  final MyMarkerInfo info = getMarkerInfo(element);

  if (info == null) {
    return null;
  }
  final PsiElement anchor = info.myElement;
  final String tooltip = info.myTooltip;

  return new LineMarkerInfo<PsiElement>(
    anchor, anchor.getTextOffset(), info.myIcon, Pass.UPDATE_OVERRIDEN_MARKERS,
    new ConstantFunction<PsiElement, String>(tooltip), new MyNavigationHandler(info));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AndroidLineMarkerProvider.java

示例12: getRelatedPopover

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
private LineMarkerInfo getRelatedPopover(String singleItemTitle, String singleItemTooltipPrefix, PsiElement lineMarkerTarget, List<GotoRelatedItem> gotoRelatedItems) {

        // single item has no popup
        String title = singleItemTitle;
        if(gotoRelatedItems.size() == 1) {
            String customName = gotoRelatedItems.get(0).getCustomName();
            if(customName != null) {
                title = String.format(singleItemTooltipPrefix, customName);
            }
        }

        return new LineMarkerInfo<PsiElement>(lineMarkerTarget, lineMarkerTarget.getTextOffset(), OxidPluginIcons.OXID_LINEMARKER, 6, new ConstantFunction<PsiElement, String>(title), new fr.adrienbrault.idea.symfony2plugin.dic.RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems));
    }
 
开发者ID:Haehnchen,项目名称:idea-php-oxid-plugin,代码行数:14,代码来源:SmartyTemplateLineMarkerProvider.java

示例13: getLineMarkerInfo

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element)
{
	if(element.getNode().getElementType() == JSTokenTypes.IDENTIFIER && element.getParent() instanceof JSReferenceExpression && element.getParent().getParent() instanceof JSFunction)
	{
		UnityFunctionManager functionManager = UnityFunctionManager.getInstance();
		Map<String, UnityFunctionManager.FunctionInfo> map = functionManager.getFunctionsByType().get(Unity3dTypes.UnityEngine.MonoBehaviour);
		if(map == null)
		{
			return null;
		}
		UnityFunctionManager.FunctionInfo functionInfo = map.get(element.getText());
		if(functionInfo == null)
		{
			return null;
		}
		Unity3dModuleExtension extension = ModuleUtilCore.getExtension(element, Unity3dModuleExtension.class);
		if(extension == null)
		{
			return null;
		}
		JSFunction jsFunction = (JSFunction) element.getParent().getParent();
		if(jsFunction.getParent() instanceof JSFile)
		{
			if(!isEqualParameters(functionInfo.getParameters(), jsFunction))
			{
				return null;
			}

			return new LineMarkerInfo<>(element, element.getTextRange(), Unity3dIcons.EventMethod, Pass.LINE_MARKERS, new ConstantFunction<>(functionInfo.getDescription()), null,
					GutterIconRenderer.Alignment.LEFT);
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:38,代码来源:UnityScriptEventFunctionLineMarkerProvider.java

示例14: collectSlowLineMarkers

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> elements, @NotNull Collection<LineMarkerInfo> result) {

    for(PsiElement psiElement : elements) {

        List<GotoRelatedItem> gotoRelatedItems = new ArrayList<GotoRelatedItem>();
        List<PsiFile> psiFiles = new ArrayList<PsiFile>();

        // android studio provide line marker with xml targets only on root classes not on class inside classes like fragments
        // we support all of them :)
        if(psiElement instanceof PsiIdentifier && psiElement.getParent() instanceof PsiClass && !(psiElement.getParent().getParent() instanceof PsiFile)) {

            // simple hack activity provide this on core
            if(isFragmentClass((PsiClass) psiElement.getParent())) {
                Collection<PsiMethodCallExpression> PsiMethodCallExpressions = PsiTreeUtil.collectElementsOfType(psiElement.getParent(), PsiMethodCallExpression.class);
                for(PsiMethodCallExpression methodCallExpression: PsiMethodCallExpressions) {
                    PsiMethod psiMethod = methodCallExpression.resolveMethod();
                    if(psiMethod != null && psiMethod.getName().equals("inflate")) {
                        PsiExpression[] expressions = methodCallExpression.getArgumentList().getExpressions();
                        if(expressions.length > 0 && expressions[0] instanceof PsiReferenceExpression) {
                            PsiFile xmlFile = AndroidUtils.findXmlResource((PsiReferenceExpression) expressions[0]);
                            if(xmlFile != null && !psiFiles.contains(xmlFile)) {
                                psiFiles.add(xmlFile);
                                gotoRelatedItems.add(new GotoRelatedItem(xmlFile));
                            }
                        }
                    }
                }
            }

        }

        if(gotoRelatedItems.size() > 0) {
            result.add(new LineMarkerInfo<PsiElement>(psiElement, psiElement.getTextOffset(), AndroidIcons.AndroidToolWindow, 6, new ConstantFunction<PsiElement, String>("Related Files"), new RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems)));
        }

    }

}
 
开发者ID:Haehnchen,项目名称:idea-android-studio-plugin,代码行数:40,代码来源:FragmentRelatedFileLineMarker.java

示例15: getLineMarkerInfo

import com.intellij.util.ConstantFunction; //导入依赖的package包/类
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement)
{
	PlayBaseTemplateFile templateFile = findTemplateFile(psiElement);
	if(templateFile != null)
	{

		return new LineMarkerInfo<>(psiElement, psiElement.getTextRange(), PlayJavaIcons.PlayLineMarker, Pass.LINE_MARKERS,
				new ConstantFunction<>("Navigate to template"), GUTTER_ICON_NAVIGATION_HANDLER, GutterIconRenderer.Alignment.LEFT);
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-play,代码行数:14,代码来源:PlayBaseTemplateLineMarkerProvider.java


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