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


Java PomNamedTarget类代码示例

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


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

示例1: processImport

import com.intellij.pom.PomNamedTarget; //导入依赖的package包/类
@Nullable
private HighlightInfo processImport(@NotNull PsiImportStatementBase importStatement, @NotNull HighlightDisplayKey unusedImportKey) {
  // jsp include directive hack
  if (importStatement.isForeignFileImport()) return null;

  if (PsiUtilCore.hasErrorElementChild(importStatement)) return null;

  boolean isRedundant = myRefCountHolder.isRedundant(importStatement);
  if (!isRedundant && !(importStatement instanceof PsiImportStaticStatement)) {
    //check import from same package
    String packageName = ((PsiClassOwner)importStatement.getContainingFile()).getPackageName();
    PsiJavaCodeReferenceElement reference = importStatement.getImportReference();
    PsiElement resolved = reference == null ? null : reference.resolve();
    if (resolved instanceof PsiPackage) {
      isRedundant = packageName.equals(((PsiQualifiedNamedElement)resolved).getQualifiedName());
    }
    else if (resolved instanceof PsiClass && !importStatement.isOnDemand()) {
      String qName = ((PsiClass)resolved).getQualifiedName();
      if (qName != null) {
        String name = ((PomNamedTarget)resolved).getName();
        isRedundant = qName.equals(packageName + '.' + name);
      }
    }
  }

  if (isRedundant) {
    return registerRedundantImport(importStatement, unusedImportKey);
  }

  int entryIndex = JavaCodeStyleManager.getInstance(myProject).findEntryIndex(importStatement);
  if (entryIndex < myCurrentEntryIndex) {
    myHasMissortedImports = true;
  }
  myCurrentEntryIndex = entryIndex;

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:PostHighlightingVisitor.java

示例2: getElementDescription

import com.intellij.pom.PomNamedTarget; //导入依赖的package包/类
@Override
public String getElementDescription(@NotNull PomTarget element, @NotNull ElementDescriptionLocation location) {
  if (element instanceof PsiElement) return null;
  
  if (location == UsageViewTypeLocation.INSTANCE) {
    return getTypeName(element);
  }
  if (location == UsageViewNodeTextLocation.INSTANCE) {
    return getTypeName(element) + " " + StringUtil.notNullize(element instanceof PomNamedTarget ? ((PomNamedTarget)element).getName() : null, "''");
  }
  if (location instanceof HighlightUsagesDescriptionLocation) {
    return getTypeName(element);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:DefaultPomTargetDescriptionProvider.java

示例3: compareType

import com.intellij.pom.PomNamedTarget; //导入依赖的package包/类
private void compareType(PsiType beforeType, PsiType afterType, PomNamedTarget whereTarget) {
  if (null != beforeType && null != afterType) {
    final String afterText = stripJavaLang(afterType.getCanonicalText());
    final String beforeText = stripJavaLang(beforeType.getCanonicalText());
    assertEquals(String.format("Types are not equal for element: %s", whereTarget.getName()), afterText, beforeText);
  }
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:8,代码来源:AbstractLombokParsingTestCase.java

示例4: getElementDescription

import com.intellij.pom.PomNamedTarget; //导入依赖的package包/类
@Override
public String getElementDescription(@Nonnull PomTarget element, @Nonnull ElementDescriptionLocation location) {
  if (element instanceof PsiElement) return null;

  if (location == UsageViewTypeLocation.INSTANCE) {
    return getTypeName(element);
  }
  if (location == UsageViewNodeTextLocation.INSTANCE) {
    return getTypeName(element) + " " + StringUtil.notNullize(element instanceof PomNamedTarget ? ((PomNamedTarget)element).getName() : null, "''");
  }
  if (location instanceof HighlightUsagesDescriptionLocation) {
    return getTypeName(element);
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:DefaultPomTargetDescriptionProvider.java

示例5: getName

import com.intellij.pom.PomNamedTarget; //导入依赖的package包/类
@RequiredReadAction
@Override
public String getName() {
  if (myTarget instanceof PomNamedTarget) {
    return ((PomNamedTarget)myTarget).getName();
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:PomTargetPsiElementImpl.java

示例6: processImport

import com.intellij.pom.PomNamedTarget; //导入依赖的package包/类
@Nullable
private HighlightInfo processImport(@NotNull PsiImportStatementBase importStatement, @NotNull HighlightDisplayKey unusedImportKey)
{
	// jsp include directive hack
	if(importStatement.isForeignFileImport())
	{
		return null;
	}

	if(PsiUtilCore.hasErrorElementChild(importStatement))
	{
		return null;
	}

	boolean isRedundant = myRefCountHolder.isRedundant(importStatement);
	if(!isRedundant && !(importStatement instanceof PsiImportStaticStatement))
	{
		//check import from same package
		String packageName = ((PsiClassOwner) importStatement.getContainingFile()).getPackageName();
		PsiJavaCodeReferenceElement reference = importStatement.getImportReference();
		PsiElement resolved = reference == null ? null : reference.resolve();
		if(resolved instanceof PsiPackage)
		{
			isRedundant = packageName.equals(((PsiQualifiedNamedElement) resolved).getQualifiedName());
		}
		else if(resolved instanceof PsiClass && !importStatement.isOnDemand())
		{
			String qName = ((PsiClass) resolved).getQualifiedName();
			if(qName != null)
			{
				String name = ((PomNamedTarget) resolved).getName();
				isRedundant = qName.equals(packageName + '.' + name);
			}
		}
	}

	if(isRedundant)
	{
		return registerRedundantImport(importStatement, unusedImportKey);
	}

	int entryIndex = JavaCodeStyleManager.getInstance(myProject).findEntryIndex(importStatement);
	if(entryIndex < myCurrentEntryIndex)
	{
		myHasMissortedImports = true;
	}
	myCurrentEntryIndex = entryIndex;

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


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