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


Java PsiMetaOwner.getMetaData方法代码示例

本文整理汇总了Java中com.intellij.psi.meta.PsiMetaOwner.getMetaData方法的典型用法代码示例。如果您正苦于以下问题:Java PsiMetaOwner.getMetaData方法的具体用法?Java PsiMetaOwner.getMetaData怎么用?Java PsiMetaOwner.getMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.meta.PsiMetaOwner的用法示例。


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

示例1: getStringToReplace

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
private static String getStringToReplace(PsiElement element, String newName, boolean nonJava, final RenamePsiElementProcessor theProcessor) {
  if (element instanceof PsiMetaOwner) {
    final PsiMetaOwner psiMetaOwner = (PsiMetaOwner)element;
    final PsiMetaData metaData = psiMetaOwner.getMetaData();
    if (metaData != null) {
      return metaData.getName();
    }
  }

  if (theProcessor != null) {
    String result = theProcessor.getQualifiedNameAfterRename(element, newName, nonJava);
    if (result != null) {
      return result;
    }
  }

  if (element instanceof PsiNamedElement) {
    return newName;
  }
  else {
    LOG.error("Unknown element type : " + element);
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RenameUtil.java

示例2: bindToElement

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
@Override
public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
  PsiMetaData metaData = null;

  if (element instanceof PsiMetaOwner){
    final PsiMetaOwner owner = (PsiMetaOwner)element;
    metaData = owner.getMetaData();

    if (metaData instanceof XmlElementDescriptor){
      return getTagElement().setName(metaData.getName(getElement())); // TODO: need to evaluate new ns prefix
    }
  } else if (element instanceof PsiFile) {
    final XmlTag tagElement = getTagElement();
    if (tagElement == null || !myStartTagFlag) return tagElement;
    String newElementName = ((PsiFile)element).getName();
    final int index = newElementName.lastIndexOf('.');

    // TODO: need to evaluate new ns prefix
    newElementName = prependNamespacePrefix(newElementName.substring(0, index), tagElement.getNamespacePrefix());

    return getTagElement().setName(newElementName);
  }

  final XmlTag tag = getTagElement();
  throw new IncorrectOperationException("Cant bind to not a xml element definition!"+element+","+metaData + "," + tag + "," + (tag != null ? tag.getDescriptor() : "unknown descriptor"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:TagNameReference.java

示例3: getStringToReplace

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
private static String getStringToReplace(PsiElement element, String newName, boolean nonJava, final RenamePsiElementProcessor theProcessor) {
  if (element instanceof PsiMetaOwner) {
    final PsiMetaOwner psiMetaOwner = (PsiMetaOwner)element;
    final PsiMetaData metaData = psiMetaOwner.getMetaData();
    if (metaData != null) {
      return metaData.getName();
    }
  }

  if (theProcessor != null) {
    String result = theProcessor.getQualifiedNameAfterRename(element, newName, nonJava);
    if (result != null) {
      return result;
    }
  }

  if (element instanceof PsiNamedElement) {
    return newName;
  }
  else {
    LOG.error("Unknown element type");
    return null;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:RenameUtil.java

示例4: bindToElement

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
  PsiMetaData metaData = null;

  if (element instanceof PsiMetaOwner){
    final PsiMetaOwner owner = (PsiMetaOwner)element;
    metaData = owner.getMetaData();

    if (metaData instanceof XmlElementDescriptor){
      return getTagElement().setName(metaData.getName(getElement())); // TODO: need to evaluate new ns prefix
    }
  } else if (element instanceof PsiFile) {
    final XmlTag tagElement = getTagElement();
    if (tagElement == null || !myStartTagFlag) return tagElement;
    String newElementName = ((PsiFile)element).getName();
    final int index = newElementName.lastIndexOf('.');

    // TODO: need to evaluate new ns prefix
    newElementName = prependNamespacePrefix(newElementName.substring(0, index), tagElement.getNamespacePrefix());

    return getTagElement().setName(newElementName);
  }

  final XmlTag tag = getTagElement();
  throw new IncorrectOperationException("Cant bind to not a xml element definition!"+element+","+metaData + "," + tag + "," + (tag != null ? tag.getDescriptor() : "unknown descriptor"));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:TagNameReference.java

示例5: getNSDescriptorFromMetaData

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
@Nullable
private XmlNSDescriptor getNSDescriptorFromMetaData(@Nullable PsiMetaOwner metaOwner, boolean nonEmpty)
{
	if(metaOwner == null)
	{
		return null;
	}
	XmlNSDescriptor descriptor = (XmlNSDescriptor) metaOwner.getMetaData();
	if(descriptor == null)
	{
		return null;
	}
	if(nonEmpty && descriptor.getRootElementsDescriptors(this).length == 0)
	{
		return null;
	}
	return descriptor;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:19,代码来源:XmlDocumentImpl.java

示例6: update

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
private void update(PsiElement element) {
  if (element != null && element.isValid()) {
    final ItemPresentation presentation = ((NavigationItem)element).getPresentation();
    myIconOpen = presentation == null ? null : ComputableIcon.create(presentation, true);
    myIconClosed = presentation == null ? null : ComputableIcon.create(presentation, false);
    myPresentableText = presentation == null ? UsageViewUtil.createNodeText(element) : presentation.getPresentableText();
    if (myIconOpen == null || myIconClosed == null) {
      if (element instanceof PsiMetaOwner) {
        final PsiMetaOwner psiMetaOwner = (PsiMetaOwner)element;
        final PsiMetaData metaData = psiMetaOwner.getMetaData();
        if (metaData instanceof PsiPresentableMetaData) {
          final PsiPresentableMetaData psiPresentableMetaData = (PsiPresentableMetaData)metaData;
          if (myIconOpen == null) myIconOpen = ComputableIcon.create(psiPresentableMetaData);
          if (myIconClosed == null) myIconClosed = ComputableIcon.create(psiPresentableMetaData);
        }
      }
      else if (element instanceof PsiFile) {
        final PsiFile psiFile = (PsiFile)element;
        final VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile != null) {
          myIconOpen = ComputableIcon.create(virtualFile);
          myIconClosed = ComputableIcon.create(virtualFile);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:PsiElement2UsageTargetAdapter.java

示例7: getElementDescription

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
@Override
public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
  if (!(location instanceof NonCodeSearchDescriptionLocation)) return null;
  final NonCodeSearchDescriptionLocation ncdLocation = (NonCodeSearchDescriptionLocation)location;

  if (element instanceof PsiDirectory) {
    if (ncdLocation.isNonJava()) {
      final String qName = PsiDirectoryFactory.getInstance(element.getProject()).getQualifiedName((PsiDirectory)element, false);
      if (qName.length() > 0) return qName;
      return null;
    }
    return ((PsiDirectory) element).getName();
  }

  if (element instanceof PsiMetaOwner) {
    final PsiMetaOwner psiMetaOwner = (PsiMetaOwner)element;
    final PsiMetaData metaData = psiMetaOwner.getMetaData();
    if (metaData != null) {
      return metaData.getName();
    }
  }
  if (element instanceof PsiNamedElement) {
    return ((PsiNamedElement)element).getName();
  }
  else {
   // LOG.error("Unknown element type: " + element);
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:DefaultNonCodeSearchElementDescriptionProvider.java

示例8: getNSDescriptorFromMetaData

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
@Nullable
private XmlNSDescriptor getNSDescriptorFromMetaData(@Nullable PsiMetaOwner metaOwner, boolean nonEmpty) {
  if (metaOwner == null) return null;
  XmlNSDescriptor descriptor = (XmlNSDescriptor)metaOwner.getMetaData();
  if (descriptor == null) return null;
  if (nonEmpty && descriptor.getRootElementsDescriptors(this).length == 0) {
    return null;
  }
  return descriptor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:XmlDocumentImpl.java

示例9: bindToElement

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
@Override
public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
  if (element instanceof PsiMetaOwner) {
    final PsiMetaOwner owner = (PsiMetaOwner)element;
    if (owner.getMetaData() instanceof XmlElementDescriptor) {
      myAttribute.setName(owner.getMetaData().getName());
    }
  }
  throw new IncorrectOperationException("Cant bind to not a xml element definition!");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:XmlAttributeReference.java

示例10: update

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
public void update() {
  final PsiElement element = getElement();
  if (element != null && element.isValid()) {
    final ItemPresentation presentation = ((NavigationItem)element).getPresentation();
    myIconOpen = presentation != null ? ComputableIcon.create(presentation, true) : null;
    myIconClosed = presentation != null ? ComputableIcon.create(presentation, false) : null;
    myPresentableText = presentation != null ? presentation.getPresentableText() : UsageViewUtil.createNodeText(element);
    if (myIconOpen == null || myIconClosed == null) {
      if (element instanceof PsiMetaOwner) {
        final PsiMetaOwner psiMetaOwner = (PsiMetaOwner)element;
        final PsiMetaData metaData = psiMetaOwner.getMetaData();
        if (metaData instanceof PsiPresentableMetaData) {
          final PsiPresentableMetaData psiPresentableMetaData = (PsiPresentableMetaData)metaData;
          if (myIconOpen == null) myIconOpen = ComputableIcon.create(psiPresentableMetaData);
          if (myIconClosed == null) myIconClosed = ComputableIcon.create(psiPresentableMetaData);
        }
      }
      else if (element instanceof PsiFile) {
        final PsiFile psiFile = (PsiFile)element;
        final VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile != null) {
          myIconOpen = ComputableIcon.create(virtualFile);
          myIconClosed = ComputableIcon.create(virtualFile);
        }
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:PsiElement2UsageTargetAdapter.java

示例11: bindToElement

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
  if (element instanceof PsiMetaOwner) {
    final PsiMetaOwner owner = (PsiMetaOwner)element;
    if (owner.getMetaData() instanceof XmlElementDescriptor) {
      myAttribute.setName(owner.getMetaData().getName());
    }
  }
  throw new IncorrectOperationException("Cant bind to not a xml element definition!");
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:XmlAttributeReference.java

示例12: getElementDescription

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
@Override
public String getElementDescription(@Nonnull final PsiElement element, @Nonnull final ElementDescriptionLocation location) {
  if (!(location instanceof NonCodeSearchDescriptionLocation)) return null;
  final NonCodeSearchDescriptionLocation ncdLocation = (NonCodeSearchDescriptionLocation)location;

  if (element instanceof PsiDirectory) {
    if (ncdLocation.isNonJava()) {
      final String qName = PsiPackageHelper.getInstance(element.getProject()).getQualifiedName((PsiDirectory)element, false);
      if (qName.length() > 0) return qName;
      return null;
    }
    return ((PsiDirectory) element).getName();
  }

  if (element instanceof PsiMetaOwner) {
    final PsiMetaOwner psiMetaOwner = (PsiMetaOwner)element;
    final PsiMetaData metaData = psiMetaOwner.getMetaData();
    if (metaData != null) {
      return metaData.getName();
    }
  }
  if (element instanceof PsiNamedElement) {
    return ((PsiNamedElement)element).getName();
  }
  else {
   // LOG.error("Unknown element type: " + element);
    return null;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:DefaultNonCodeSearchElementDescriptionProvider.java

示例13: bindToElement

import com.intellij.psi.meta.PsiMetaOwner; //导入方法依赖的package包/类
@Override
public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException
{
	PsiMetaData metaData = null;

	if(element instanceof PsiMetaOwner)
	{
		final PsiMetaOwner owner = (PsiMetaOwner) element;
		metaData = owner.getMetaData();

		if(metaData instanceof XmlElementDescriptor)
		{
			return getTagElement().setName(metaData.getName(getElement())); // TODO: need to evaluate new ns prefix
		}
	}
	else if(element instanceof PsiFile)
	{
		final XmlTag tagElement = getTagElement();
		if(tagElement == null || !myStartTagFlag)
		{
			return tagElement;
		}
		String newElementName = ((PsiFile) element).getName();
		final int index = newElementName.lastIndexOf('.');

		// TODO: need to evaluate new ns prefix
		newElementName = prependNamespacePrefix(newElementName.substring(0, index), tagElement.getNamespacePrefix());

		return getTagElement().setName(newElementName);
	}

	final XmlTag tag = getTagElement();
	throw new IncorrectOperationException("Cant bind to not a xml element definition!" + element + "," + metaData + "," + tag + "," + (tag != null ? tag.getDescriptor() : "unknown descriptor"));
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:35,代码来源:TagNameReference.java


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