• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DomTarget类的典型用法和代码示例

java 1次浏览

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

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

示例1: resolve

点赞 3

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
public PsiElement resolve(@NotNull PsiReference psiReference, boolean incompleteCode) {
  final PsiElement element = psiReference.getElement();
  if (element == null) {
    return null;
  }
  final DomElement domElement = DomUtil.getDomElement(element);
  if (domElement == null) {
    return null;
  }
  final AntDomMacroDef macrodef = domElement.getParentOfType(AntDomMacroDef.class, false);
  if (macrodef == null) {
    return null;
  }
  final String name = AntStringResolver.computeString(domElement, psiReference.getCanonicalText());
  for (AntDomMacrodefAttribute attribute : macrodef.getMacroAttributes()) {
    if (name.equals(attribute.getName().getStringValue())) {
      final DomTarget target = DomTarget.getTarget(attribute);
      return target != null? PomService.convertToPsi(target) : null;
    }
  }
  return null;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:23,
代码来源:AntDomMacrodefAttributeReference.java

示例2: AntBuildTargetImpl

点赞 3

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
public AntBuildTargetImpl(final AntDomTarget target, final AntBuildModelBase buildModel, final VirtualFile sourceFile, final boolean isImported, final boolean isDefault) {
  myModel = buildModel;
  myFile = sourceFile;
  myIsDefault = isDefault;
  myHashCode = target.hashCode();
  myName = target.getName().getRawText();
  String name = target.getName().getRawText();
  if (isImported) {
    final String projectName = target.getAntProject().getName().getRawText();
    name = projectName + "." + name;
  }
  myDisplayName = name;
  myProject = target.getManager().getProject();
  final DomTarget domTarget = DomTarget.getTarget(target);
  if (domTarget != null) {
    myTextOffset = domTarget.getTextOffset();
  }
  else {
    myTextOffset = target.getXmlTag().getTextOffset();
  }
  
  final String desc = target.getDescription().getRawText();
  myDescription = (desc != null && desc.trim().length() > 0) ? desc : null;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:25,
代码来源:AntBuildTargetImpl.java

示例3: getAdditionalUseScope

点赞 3

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
@Override
public SearchScope getAdditionalUseScope(@NotNull PsiElement element) {
  if (element instanceof PomTargetPsiElement) {
    PomTarget target = ((PomTargetPsiElement)element).getTarget();
    if (target instanceof DomTarget) {
      DomElement domElement = ((DomTarget)target).getDomElement();
      if (domElement instanceof ExtensionPoint) {
        return createProjectXmlFilesScope(element);
      }
    }
  }

  if (element instanceof PsiClass &&
      PsiUtil.isIdeaProject(element.getProject()) &&
      ((PsiClass)element).hasModifierProperty(PsiModifier.PUBLIC)) {
    return createProjectXmlFilesScope(element);
  }
  return null;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:20,
代码来源:DevKitUseScopeEnlarger.java

示例4: AntBuildTargetImpl

点赞 3

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
public AntBuildTargetImpl(final AntDomTarget target, final AntBuildModelBase buildModel, final VirtualFile sourceFile, final boolean isImported, final boolean isDefault) {
  myModel = buildModel;
  myFile = sourceFile;
  myIsDefault = isDefault;
  myHashCode = target.hashCode();
  myName = target.getName().getRawText();
  String name = target.getName().getRawText();
  if (isImported) {
    final String projectName = target.getAntProject().getName().getRawText();
    name = projectName + "" + name;
  }
  myDisplayName = name;
  myProject = target.getManager().getProject();
  final DomTarget domTarget = DomTarget.getTarget(target);
  if (domTarget != null) {
    myTextOffset = domTarget.getTextOffset();
  }
  else {
    myTextOffset = target.getXmlTag().getTextOffset();
  }
  
  final String desc = target.getDescription().getRawText();
  myDescription = (desc != null && desc.trim().length() > 0) ? desc : null;
}
 

开发者ID:consulo,
项目名称:consulo-apache-ant,
代码行数:25,
代码来源:AntBuildTargetImpl.java

示例5: createDomTarget

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
@Override
@Nullable
protected DomTarget createDomTarget(DomElement parent, DomElement nameElement) {
  final NameValue nameValue = nameElement.getAnnotation(NameValue.class);
  if (nameValue != null && nameValue.referencable()) {
    return DomTarget.getTarget(parent);
  }
  return null;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:10,
代码来源:DomDeclarationSearcher.java

示例6: withDomTarget

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
public static ElementPattern<DomTarget> withDomTarget(final ElementPattern<? extends DomElement> pattern) {
  return new ObjectPattern.Capture<DomTarget>(DomTarget.class).with(new PatternCondition<DomTarget>("withDomTarget") {
    @Override
    public boolean accepts(@NotNull final DomTarget target, final ProcessingContext context) {
      return pattern.accepts(target.getDomElement(), context);
    }
  });
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:9,
代码来源:DomPatterns.java

示例7: toDomElement

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
@Nullable 
public static DomElement toDomElement(PsiElement resolve) {
  if (resolve instanceof PomTargetPsiElement) {
    final PomTarget target = ((PomTargetPsiElement)resolve).getTarget();
    if(target instanceof DomTarget) {
      return ((DomTarget)target).getDomElement();
    }
    return null;
  }
  return DomUtil.getDomElement(resolve);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:12,
代码来源:AntDomReferenceBase.java

示例8: convertToAntDomElement

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
@Nullable 
private static AntDomElement convertToAntDomElement(PsiElement element) {
  if (element instanceof PomTargetPsiElement) {
    final PomTarget target = ((PomTargetPsiElement)element).getTarget();
    if (target instanceof DomTarget) {
      final DomElement domElement = ((DomTarget)target).getDomElement();
      if (domElement instanceof AntDomElement) {
        return (AntDomElement)domElement;
      }
    }
  }
  return null;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:14,
代码来源:AntRenameProcessor.java

示例9: createDomTarget

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
protected DomTarget createDomTarget(DomElement parent, DomElement nameElement) {
  if (parent instanceof AntDomElement && nameElement.equals(((AntDomElement)parent).getId())) { // id attrib is defined
    return DomTarget.getTarget(parent, (GenericDomValue)nameElement);
  }
  if (parent instanceof AntDomProperty && nameElement.equals(((AntDomProperty)parent).getEnvironment())) { // environment attrib is defined
    return DomTarget.getTarget(parent, (GenericDomValue)nameElement);
  }
  return null;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:10,
代码来源:AntDomDeclarationSearcher.java

示例10: resolve

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
public PsiElement resolve(@NotNull PsiReference psiReference, boolean incompleteCode) {
  final TargetResolver.Result result = ((AntDomTargetReference)psiReference).doResolve(psiReference.getCanonicalText());
  if (result == null) {
    return null;
  }
  final Pair<AntDomTarget,String> pair = result.getResolvedTarget(psiReference.getCanonicalText());
  final DomTarget domTarget = pair != null && pair.getFirst() != null ? DomTarget.getTarget(pair.getFirst()) : null;
  return domTarget != null? PomService.convertToPsi(domTarget) : null;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:10,
代码来源:AntDomTargetReference.java

示例11: getNavigationElement

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
public PsiElement getNavigationElement(final String propertyName) {
  DomTarget domTarget = DomTarget.getTarget(this);
  if (domTarget == null) {
    final GenericAttributeValue<String> environment = getEnvironment();
    if (environment.getRawText() != null) {
      domTarget = DomTarget.getTarget(this, environment);
    }
    if (domTarget == null) {
      final GenericAttributeValue<String> resource = getResource();
      if (resource.getRawText() != null) {
        domTarget = DomTarget.getTarget(this, resource);
      }
    }
  }
  
  if (domTarget != null) {
    final PsiElement psi = PomService.convertToPsi(domTarget);
    if (psi != null) {
      return psi;
    }
  }

  final PsiFileSystemItem psiFile = getFile().getValue();
  if (psiFile != null) {
    final String prefix = getPropertyPrefixValue();
    String _propertyName = propertyName;
    if (prefix != null) {
      if (!propertyName.startsWith(prefix)) {
        return null;
      }
      _propertyName = propertyName.substring(prefix.length());
    }
    final PropertiesFile pf = toPropertiesFile(psiFile);
    if (pf != null) {
      final IProperty property = pf.findPropertyByKey(_propertyName);
      return property != null? property.getPsiElement() : null;
    }
  }
  return null;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:41,
代码来源:AntDomProperty.java

示例12: BuildTask

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
public BuildTask(final AntBuildTargetBase target, final AntDomElement task) {
  myTarget = target;
  myName = task.getXmlElementName();
  final DomTarget domTarget = DomTarget.getTarget(task);
  if (domTarget != null) {
    myOffset = domTarget.getTextOffset();
  }
  else {
    myOffset = task.getXmlTag().getTextOffset();
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:12,
代码来源:BuildTask.java

示例13: testPropertyInMacrodefParam

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
public void testPropertyInMacrodefParam() throws Exception {
  PsiReference ref = configure();
  final PsiElement result = ref.resolve();
  assertTrue(result instanceof PomTargetPsiElement);
  final PsiElement naviElem = ((DomTarget)((PomTargetPsiElement)result).getTarget()).getNavigationElement();
  final DomElement domElement = DomUtil.getDomElement(naviElem);
  assertNotNull(domElement);
  assertNotNull(domElement.getParentOfType(AntDomMacrodefAttribute.class, false));
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:10,
代码来源:AntResolveTest.java

示例14: findExtensionPoint

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
@Nullable
private static ExtensionPoint findExtensionPoint(PsiElement element) {
  if (element instanceof PomTargetPsiElement &&
      DescriptorUtil.isPluginXml(element.getContainingFile())) {
    final PomTarget pomTarget = ((PomTargetPsiElement)element).getTarget();
    if (pomTarget instanceof DomTarget) {
      final DomElement domElement = ((DomTarget)pomTarget).getDomElement();
      if (domElement instanceof ExtensionPoint) {
        return (ExtensionPoint)domElement;
      }
    }
  }
  return null;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:15,
代码来源:ExtensionPointDocumentationProvider.java

示例15: createDomTarget

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
@Nullable
protected DomTarget createDomTarget(DomElement parent, DomElement nameElement) {
  final NameValue nameValue = nameElement.getAnnotation(NameValue.class);
  if (nameValue != null && nameValue.referencable()) {
    return DomTarget.getTarget(parent);
  }
  return null;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:9,
代码来源:DomDeclarationSearcher.java

示例16: getNavigationElement

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
public PsiElement getNavigationElement(final String propertyName) {
  DomTarget domTarget = DomTarget.getTarget(this);
  if (domTarget == null) {
    final GenericAttributeValue<String> environment = getEnvironment();
    if (environment.getRawText() != null) {
      domTarget = DomTarget.getTarget(this, environment);
    }
    if (domTarget == null) {
      final GenericAttributeValue<String> resource = getResource();
      if (resource.getRawText() != null) {
        domTarget = DomTarget.getTarget(this, resource);
      }
    }
  }
  
  if (domTarget != null) {
    final PsiElement psi = PomService.convertToPsi(domTarget);
    if (psi != null) {
      return psi;
    }
  }

  final PsiFileSystemItem psiFile = getFile().getValue();
  if (psiFile != null) {
    final String prefix = getPropertyPrefixValue();
    String _propertyName = propertyName;
    if (prefix != null) {
      if (!propertyName.startsWith(prefix)) {
        return null;
      }
      _propertyName = propertyName.substring(prefix.length());
    }
    if (psiFile instanceof PropertiesFile) {
      final IProperty property = ((PropertiesFile)psiFile).findPropertyByKey(_propertyName);
      return property != null? property.getPsiElement() : null;
    }
  }
  return null;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:40,
代码来源:AntDomProperty.java

示例17: getExtensionPoint

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
@Override
public ExtensionPoint getExtensionPoint() {
  PsiElement declaration = getChildDescription().getDeclaration(getManager().getProject());
  if (declaration instanceof PomTargetPsiElement) {
    PomTarget target = ((PomTargetPsiElement)declaration).getTarget();
    return target instanceof DomTarget ? (ExtensionPoint)((DomTarget)target).getDomElement() : null;
  }
  return null;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:10,
代码来源:ExtensionImpl.java

示例18: getAdditionalUseScope

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
@Override
public SearchScope getAdditionalUseScope(@NotNull PsiElement element) {
  if (element instanceof PomTargetPsiElement) {
    PomTarget target = ((PomTargetPsiElement)element).getTarget();
    if (target instanceof DomTarget) {
      DomElement domElement = ((DomTarget)target).getDomElement();
      if (domElement instanceof ExtensionPoint) {
        return GlobalSearchScope.allScope(element.getProject());
      }
    }
  }
  return null;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:14,
代码来源:DevKitUseScopeEnlarger.java

示例19: doFindDeclaration

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
@Nullable
private static PomTarget doFindDeclaration(DomElement parent, XmlName xmlName) {
  if (!(parent instanceof AntDomElement)) {
    return null;
  }
  final AntDomElement parentElement = (AntDomElement)parent;
  final AntDomProject antDomProject = parentElement.getAntProject();
  if (antDomProject == null) {
    return null;
  }
  final CustomAntElementsRegistry registry = CustomAntElementsRegistry.getInstance(antDomProject);
  final AntDomElement declaringElement = registry.findDeclaringElement(parentElement, xmlName);
  if (declaringElement == null) {
    return null;
  }
  DomTarget target = DomTarget.getTarget(declaringElement);
  if (target == null && declaringElement instanceof AntDomTypeDef) {
    final AntDomTypeDef typedef = (AntDomTypeDef)declaringElement;
    final GenericAttributeValue<PsiFileSystemItem> resource = typedef.getResource();
    if (resource != null) {
      target = DomTarget.getTarget(declaringElement, resource);
    }
    if (target == null) {
      final GenericAttributeValue<PsiFileSystemItem> file = typedef.getFile();
      if (file != null) {
        target = DomTarget.getTarget(declaringElement, file);
      }
    }
  }
  return target;
}
 

开发者ID:consulo,
项目名称:consulo-apache-ant,
代码行数:32,
代码来源:AntDomExtender.java

示例20: getNavigationElement

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
@Nullable
public PsiElement getNavigationElement(String propertyName) {
  final DomTarget target = DomTarget.getTarget(this);
  final PsiElement nameElementPsi = target != null ? PomService.convertToPsi(target) : null;
  if (nameElementPsi != null) {
    return nameElementPsi;
  }
  final XmlElement xmlElement = getXmlElement();
  return xmlElement != null? xmlElement.getNavigationElement() : null;
}
 

开发者ID:consulo,
项目名称:consulo-apache-ant,
代码行数:11,
代码来源:AntDomProject.java

示例21: getModelObject

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
@Nullable
public static Object getModelObject(PsiElement element)
{
	if(!(element instanceof PomTargetPsiElement))
	{
		return null;
	}
	final PomTarget target = ((PomTargetPsiElement) element).getTarget();
	return target instanceof CommonModelTarget ? ((CommonModelTarget) target).getCommonElement() : target instanceof JamPomTarget ? ((JamPomTarget) target).getJamElement() : target instanceof
			DomTarget ? ((DomTarget) target).getDomElement() : null;
}
 

开发者ID:consulo,
项目名称:consulo-javaee,
代码行数:12,
代码来源:JamCommonUtil.java

示例22: getIdentifyingPsiElement

点赞 2

import com.intellij.util.xml.DomTarget; //导入依赖的package包/类
public PsiElement getIdentifyingPsiElement() {
  final DomTarget target = DomTarget.getTarget(this);
  return target == null? getXmlElement() : PomService.convertToPsi(target);
}
 

开发者ID:consulo,
项目名称:consulo-javaee,
代码行数:5,
代码来源:BaseImpl.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)