Java 类com.intellij.util.xml.DomElement 实例源码

项目:hybris-integration-intellij-idea-plugin    文件:BeansUtils.java   
public static <T extends DomElement, V> GenericAttributeValue<V> expectDomAttributeValue(
    @NotNull final PsiElement element,
    @NotNull final Class<? extends T> domTagClass,
    @NotNull final Function<T, GenericAttributeValue<V>> domGetter
) {
    final DomManager domManager = DomManager.getDomManager(element.getProject());

    if (!(element instanceof XmlElement)) {
        return null;
    }

    final XmlAttribute xmlAttribute = PsiTreeUtil.getParentOfType(element, XmlAttribute.class, false);
    if (xmlAttribute == null) {
        return null;
    }

    final XmlTag xmlParentTag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false);
    DomElement domParentTag = domManager.getDomElement(xmlParentTag);

    return Optional.ofNullable(domParentTag)
                   .map(o -> ObjectUtils.tryCast(o, domTagClass))
                   .map(domGetter)
                   .filter(val -> val == domManager.getDomElement(xmlAttribute))
                   .orElse(null);
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureTreeElement.java   
private String localizeModifiers(final DomElement dom) {
    if (dom instanceof Modifiers) {
        final Modifiers modifiers = (Modifiers) dom;
        final List<String> modList = newArrayList();
        resolveModifier(modifiers.getDoNotOptimize(), "doNotOptimize", modList);
        resolveModifier(modifiers.getEncrypted(), "encrypted", modList);
        resolveModifier(modifiers.getInitial(), "initial", modList);
        resolveModifier(modifiers.getOptional(), "optional", modList);
        resolveModifier(modifiers.getPartOf(), "partOf", modList);
        resolveModifier(modifiers.getPrivate(), "private", modList);
        resolveModifier(modifiers.getRead(), "read", modList);
        resolveModifier(modifiers.getRemovable(), "removable", modList);
        resolveModifier(modifiers.getSearch(), "search", modList);
        resolveModifier(modifiers.getUnique(), "unique", modList);
        resolveModifier(modifiers.getWrite(), "write", modList);
        if (!modList.isEmpty()) {
            return StringUtils.join(modList, ", ");
        }
    }
    return null;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureTreeElement.java   
private String localizeAttribute(final DomElement dom) {
    if (dom instanceof Attribute) {
        final Attribute attribute = (Attribute) dom;
        String value = resolveValue(attribute.getType());
        if (value == null) {
            return null;
        }
        if (value.startsWith("localized:")) {
            value = value.substring("localized:".length());
        }
        if (value.startsWith("java.lang.")) {
            value = value.substring("java.lang.".length());
        }
        return value;
    }
    return null;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureViewTreeModel.java   
public TSStructureViewTreeModel(
    @NotNull XmlFile file,
    @NotNull Function<DomElement, DomService.StructureViewMode> descriptor,
    @Nullable Editor editor
) {
    super(
        file,
        DomElementsNavigationManager.getManager(file.getProject())
                                    .getDomElementsNavigateProvider(DomElementsNavigationManager.DEFAULT_PROVIDER_NAME),
        descriptor,
        editor
    );
    myNavigationProvider = DomElementsNavigationManager.getManager(file.getProject())
                                                       .getDomElementsNavigateProvider(DomElementsNavigationManager.DEFAULT_PROVIDER_NAME);
    myDescriptor = descriptor;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureViewTreeModel.java   
@Override
@NotNull
public StructureViewTreeElement getRoot() {
    XmlFile myFile = getPsiFile();
    final DomFileElement<DomElement> fileElement = DomManager.getDomManager(myFile.getProject()).getFileElement(
        myFile,
        DomElement.class
    );
    return fileElement == null ?
        new XmlFileTreeElement(myFile) :
        new TSStructureTreeElement(
            fileElement.getRootElement().createStableCopy(),
            myDescriptor,
            myNavigationProvider
        );
}
项目:intellij-ce-playground    文件:PsiTypeControl.java   
protected void setValue(String value) {
  final PsiType type = JvmPsiTypeConverterImpl.convertFromString(value, new AbstractConvertContext() {
    @NotNull
    public DomElement getInvocationElement() {
      return getDomElement();
    }

    public PsiManager getPsiManager() {
      return PsiTypeControl.this.getPsiManager();
    }
  });
  if (type != null) {
    value = type.getCanonicalText();
  }
  super.setValue(value);
}
项目:intellij-ce-playground    文件:AndroidUtils.java   
@Nullable
public static <T extends DomElement> T loadDomElement(@NotNull final Project project,
                                                      @NotNull final VirtualFile file,
                                                      @NotNull final Class<T> aClass) {
  return ApplicationManager.getApplication().runReadAction(new Computable<T>() {
    @Override
    @Nullable
    public T compute() {
      if (project.isDisposed()) return null;
      PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
      if (psiFile instanceof XmlFile) {
        return loadDomElementWithReadPermission(project, (XmlFile)psiFile, aClass);
      }
      else {
        return null;
      }
    }
  });
}
项目:intellij-ce-playground    文件:MavenArtifactCoordinatesGroupIdConverter.java   
@Override
public void handleInsert(final InsertionContext context, LookupElement item) {
  if (TemplateManager.getInstance(context.getProject()).getActiveTemplate(context.getEditor()) != null) {
    return; // Don't brake the template.
  }

  context.commitDocument();

  XmlFile xmlFile = (XmlFile)context.getFile();

  PsiElement element = xmlFile.findElementAt(context.getStartOffset());
  XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
  if (tag == null) return;

  XmlTag dependencyTag = tag.getParentTag();

  DomElement domElement = DomManager.getDomManager(context.getProject()).getDomElement(dependencyTag);
  if (!(domElement instanceof MavenDomDependency)) return;

  MavenDomDependency dependency = (MavenDomDependency)domElement;

  String artifactId = dependency.getArtifactId().getStringValue();
  if (StringUtil.isEmpty(artifactId)) return;

  MavenDependencyCompletionUtil.addTypeAndClassifierAndVersion(context, dependency, item.getLookupString(), artifactId);
}
项目:intellij-ce-playground    文件:MavenPluginConfigurationDomExtender.java   
private static void registerPluginParameter(boolean isInPluginManagement, DomExtensionsRegistrar r, final ParameterData data, final String parameterName) {
  DomExtension e = r.registerFixedNumberChildExtension(new XmlName(parameterName), MavenDomConfigurationParameter.class);

  if (isCollection(data.parameter)) {
    e.addExtender(new DomExtender() {
      public void registerExtensions(@NotNull DomElement domElement, @NotNull DomExtensionsRegistrar registrar) {
        for (String each : collectPossibleNameForCollectionParameter(parameterName)) {
          DomExtension inner = registrar.registerCollectionChildrenExtension(new XmlName(each), MavenDomConfigurationParameter.class);
          inner.setDeclaringElement(data.parameter);
        }
      }
    });
  }
  else {
    addValueConverter(e, data.parameter);
    if (!isInPluginManagement) {
      addRequiredAnnotation(e, data);
    }
  }

  e.setDeclaringElement(data.parameter);

  data.parameter.getXmlElement().putUserData(PLUGIN_PARAMETER_KEY, data);
}
项目:intellij-ce-playground    文件:DomElementAnnotationsManagerImpl.java   
@Override
@NotNull
public DomElementsProblemsHolder getProblemHolder(DomElement element) {
  if (element == null || !element.isValid()) return EMPTY_PROBLEMS_HOLDER;
  final DomFileElement<DomElement> fileElement = DomUtil.getFileElement(element);

  synchronized (LOCK) {
    final XmlTag tag = fileElement.getRootElement().getXmlTag();
    if (tag != null) {
      final DomElementsProblemsHolder readyHolder = tag.getUserData(DOM_PROBLEM_HOLDER_KEY);
      if (readyHolder != null) {
        return readyHolder;
      }
    }
    return EMPTY_PROBLEMS_HOLDER;
  }
}
项目:intellij-ce-playground    文件:MavenDomGutterAnnotator.java   
private static void annotateMavenDomPlugin(@NotNull MavenDomPlugin plugin, @NotNull AnnotationHolder holder) {
  XmlTag xmlTag = plugin.getArtifactId().getXmlTag();
  if (xmlTag == null) return;

  DomElement plugins = plugin.getParent();
  if (plugins == null) return;

  DomElement parent = plugins.getParent();
  if (parent instanceof MavenDomPluginManagement) {
    annotateMavenDomPluginInManagement(plugin, holder);
    return;
  }

  MavenDomPlugin managingPlugin = MavenDomProjectProcessorUtils.searchManagingPlugin(plugin);

  if (managingPlugin != null) {
    NavigationGutterIconBuilder<MavenDomPlugin> iconBuilder =
      NavigationGutterIconBuilder.create(AllIcons.General.OverridingMethod, PluginConverter.INSTANCE);

    iconBuilder.
      setTargets(Collections.singletonList(managingPlugin)).
      setTooltipText(MavenDomBundle.message("overriden.plugin.title")).
      install(holder, xmlTag);
  }
}
项目:intellij-ce-playground    文件:GenerateDomElementProvider.java   
public void navigate(final DomElement element) {
  if (element != null && element.isValid()) {
    final DomElement copy = element.createStableCopy();
    final Project project = element.getManager().getProject();
    final DomElementNavigationProvider navigateProvider = getNavigationProviderName(project);

    if (navigateProvider != null && navigateProvider.canNavigate(copy)) {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          if (!project.isDisposed()) {
            doNavigate(navigateProvider, copy);
          }
        }
      });
    }
  }
}
项目:intellij-ce-playground    文件:DomUIFactoryImpl.java   
@Override
public void setupErrorOutdatingUserActivityWatcher(final CommittablePanel panel, final DomElement... elements) {
  final UserActivityWatcher userActivityWatcher = createEditorAwareUserActivityWatcher();
  userActivityWatcher.addUserActivityListener(new UserActivityListener() {
    private boolean isProcessingChange;

    @Override
    public void stateChanged() {
      if (isProcessingChange) return;
      isProcessingChange = true;
      try {
        for (final DomElement element : elements) {
          DomElementAnnotationsManagerImpl.outdateProblemHolder(element);
        }
        CommittableUtil.updateHighlighting(panel);
      }
      finally {
        isProcessingChange = false;
      }
    }
  }, panel);
  userActivityWatcher.register(panel.getComponent());
}
项目:intellij-ce-playground    文件:CollectionElementInvocationHandler.java   
@Override
public DomElement createPathStableCopy() {
  final AbstractDomChildDescriptionImpl description = getChildDescription();
  final DomElement parent = getParent();
  assert parent != null;
  final DomElement parentCopy = parent.createStableCopy();
  final int index = description.getValues(parent).indexOf(getProxy());
  return getManager().createStableValue(new Factory<DomElement>() {
    @Override
    @Nullable
    public DomElement create() {
      if (parentCopy.isValid()) {
        final List<? extends DomElement> list = description.getValues(parentCopy);
        if (list.size() > index) {
          return list.get(index);
        }
      }
      return null;
    }
  });
}
项目:intellij-ce-playground    文件:AndroidCompletionContributor.java   
private static void addAndroidPrefixElement(PsiElement position, PsiElement parent, CompletionResultSet resultSet) {
  if (position.getText().startsWith("android:")) {
    return;
  }

  final PsiElement gp = parent.getParent();
  if (!(gp instanceof XmlTag)) {
    return;
  }

  final DomElement element = DomManager.getDomManager(gp.getProject()).getDomElement((XmlTag)gp);
  if (!(element instanceof LayoutElement) &&
      !(element instanceof PreferenceElement)) {
    return;
  }

  final String prefix = ((XmlTag)gp).getPrefixByNamespace(SdkConstants.NS_RESOURCES);
  if (prefix == null || prefix.length() < 3) {
    return;
  }
  final LookupElementBuilder e = LookupElementBuilder.create(prefix + ":").withTypeText("[Namespace Prefix]", true);
  resultSet.addElement(PrioritizedLookupElement.withPriority(e, Double.MAX_VALUE));
}
项目:intellij-ce-playground    文件:AttributeChildInvocationHandler.java   
@Override
protected void setValue(@Nullable final String value) {
  final XmlTag tag = ensureTagExists();
  final String attributeName = getXmlElementName();
  final String namespace = getXmlApiCompatibleNamespace(getParentHandler());
  final String oldValue = StringUtil.unescapeXml(tag.getAttributeValue(attributeName, namespace));
  final String newValue = XmlStringUtil.escapeString(value);
  if (Comparing.equal(oldValue, newValue, true)) return;

  getManager().runChange(new Runnable() {
    @Override
    public void run() {
      try {
        XmlAttribute attribute = tag.setAttribute(attributeName, namespace, newValue);
        setXmlElement(attribute);
        getManager().cacheHandler(DomManagerImpl.DOM_ATTRIBUTE_HANDLER_KEY, attribute, AttributeChildInvocationHandler.this);
      }
      catch (IncorrectOperationException e) {
        LOG.error(e);
      }
    }
  });
  final DomElement proxy = getProxy();
  getManager().fireEvent(oldValue != null ? new DomEvent(proxy, false) : new DomEvent(proxy, true));
}
项目:intellij-ce-playground    文件:MavenDomGutterAnnotator.java   
public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) {
  if (psiElement instanceof XmlTag) {
    final DomElement element = DomManager.getDomManager(psiElement.getProject()).getDomElement((XmlTag)psiElement);
    if (element instanceof MavenDomDependency) {
      if (element.getParentOfType(MavenDomPlugin.class, true) != null) return;

      MavenDomDependency dependency = (MavenDomDependency)element;
      if (isDependencyManagementSection(dependency)) {
        annotateDependencyUsages(dependency, holder);
      }
      else {
        annotateManagedDependency(dependency, holder);
      }
    }
    else if (element instanceof MavenDomParent) {
      annotateMavenDomParent((MavenDomParent)element, holder);
    }
    else if (element instanceof MavenDomProjectModel) {
      annotateMavenDomProjectChildren((MavenDomProjectModel)element, holder);
    }
    else if (element instanceof MavenDomPlugin) {
      annotateMavenDomPlugin((MavenDomPlugin)element, holder);
    }
  }
}
项目:hybris-integration-intellij-idea-plugin    文件:BeansPropertyNameConverter.java   
@Nullable
@Override
public PsiField fromString(@Nullable final String text, final ConvertContext context) {
    DomElement host = context.getInvocationElement();
    if (host instanceof GenericAttributeValue<?>) {
        DomElement domProperty = host.getParent();
        return domProperty instanceof Property ? BeansUtils.resolveToPsiField((Property) domProperty, text) : null;
    }
    return null;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureTreeElement.java   
public <T extends DomElement> TSStructureTreeElement(
    final T stableCopy,
    final Function<DomElement, DomService.StructureViewMode> myDescriptor,
    final DomElementNavigationProvider myNavigationProvider
) {
    super(stableCopy, myDescriptor, myNavigationProvider);
    this.myDescriptor = myDescriptor;
    this.myNavigationProvider = myNavigationProvider;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureTreeElement.java   
/**
 * Returns the location of the object (for example, the package of a class). The location
 * string is used by some renderers and usually displayed as grayed text next to the item name.
 *
 * @return the location description, or null if none is applicable.
 */
@Nullable
public String getLocationString() {
    final DomElement dom = getElement();
    final String attrValue = localizeAttribute(dom);
    if (attrValue != null) {
        return attrValue;
    }
    final String itemTypeValue = localizeItemType(dom);
    if (itemTypeValue != null) {
        return itemTypeValue;
    }
    final String modifiersValue = localizeModifiers(dom);
    if (modifiersValue != null) {
        return modifiersValue;
    }
    final String descriptionValue = localizeDescription(dom);
    if (descriptionValue != null) {
        return descriptionValue;
    }
    final String xmlElementName = dom.getXmlElementName();
    if (xmlElementName == null) {
        return null;
    }

    if (xmlElementName.equalsIgnoreCase(getPresentableText())) {
        return null;
    }
    return xmlElementName;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureTreeElement.java   
private String localizeDescription(final DomElement dom) {
    if (dom instanceof Description) {
        final XmlElement xmlElement = dom.getXmlElement();
        if (xmlElement instanceof XmlTag) {
            final XmlTagValue value = ((XmlTag) xmlElement).getValue();
            if (value != null) {
                return value.getTrimmedText();
            }
        }
    }
    return null;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureTreeElement.java   
private String localizeItemType(final DomElement dom) {
    if (dom instanceof ItemType) {
        ItemType itemType = (ItemType) dom;
        String value = resolveValue(itemType.getExtends());
        if (value == null) {
            value = "GenericItem";
        }
        return "(" + value + ")";
    }
    return null;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureTreeElement.java   
@Override
@Nullable
public Icon getIcon(boolean open) {
    final DomElement dom = getElement();
    if (dom instanceof Attribute) {
        final String value = resolveValue(((Attribute) dom).getType());
        if (StringUtils.startsWith(value, "localized:")) {
            return HybrisIcons.LOCALIZED;
        }
    }
    return null;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureViewBuilder.java   
public TSStructureViewBuilder(
    final XmlFile file,
    final Function<DomElement, DomService.StructureViewMode> descriptor
) {
    super(file, descriptor);
    myFile = file;
    myDescriptor = descriptor;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSMetaModel.java   
@Nullable
default TSMetaClassifier<? extends DomElement> findMetaClassifierByName(final @NotNull String name) {
    TSMetaClassifier<? extends DomElement> result = findMetaClassByName(name);
    if (result == null) {
        result = findMetaCollectionByName(name);
    }
    if (result == null) {
        result = findMetaEnumByName(name);
    }
    return result;
}
项目:hybris-integration-intellij-idea-plugin    文件:TypeSystemConverterBase.java   
protected static <D extends DomElement> XmlAttributeValue navigateToValue(
    @Nullable final D dom,
    @NotNull final Function<? super D, GenericAttributeValue<?>> attribute
) {

    return
        Optional.ofNullable(dom)
                .map(attribute)
                .map(GenericAttributeValue::getXmlAttributeValue)
                .orElse(null);

}
项目:hybris-integration-intellij-idea-plugin    文件:TypeSystemConverterBase.java   
protected static <D extends DomElement, R> R useAttributeValue(
    @Nullable final D dom,
    @NotNull final Function<? super D, GenericAttributeValue<R>> attribute
) {

    return
        Optional.ofNullable(dom)
                .map(attribute)
                .map(GenericAttributeValue::getValue)
                .orElse(null);

}
项目:mule-intellij-plugins    文件:FlowGoToSymbol.java   
@Override
protected void addNames(@NotNull Module module, Set<String> set) {
    set.addAll(ContainerUtil.mapNotNull(MuleConfigUtils.getFlows(module), new Function<DomElement, String>() {
        @Override
        public String fun(DomElement domElement) {
            return domElement.getXmlTag().getAttributeValue(MuleConfigConstants.NAME_ATTRIBUTE);
        }
    }));
}
项目:intellij-ce-playground    文件:AppEngineFacet.java   
@Nullable
private static <T> T getRootElement(final PsiFile file, final Class<T> domClass, final Module module) {
  if (!(file instanceof XmlFile)) return null;
  final DomManager domManager = DomManager.getDomManager(file.getProject());
  final DomFileElement<DomElement> element = domManager.getFileElement((XmlFile)file, DomElement.class);
  if (element == null) return null;
  final DomElement root = element.getRootElement();
  if (!ReflectionUtil.isAssignable(domClass, root.getClass())) return null;
  return (T)root;
}
项目:intellij-ce-playground    文件:PropertyKeyReferenceProvider.java   
private static List<String> getPluginResourceBundles(PsiElement element) {
  final DomElement domElement = DomUtil.getDomElement(element);
  if (domElement == null) return Collections.emptyList();
  final DomElement rootElement = DomUtil.getFileElement(domElement).getRootElement();
  if (!(rootElement instanceof IdeaPlugin)) return Collections.emptyList();

  IdeaPlugin plugin = (IdeaPlugin)rootElement;
  return ContainerUtil.map(plugin.getResourceBundles(), new Function<GenericDomValue<String>, String>() {
    @Override
    public String fun(GenericDomValue<String> value) {
      return value.getStringValue();
    }
  });
}
项目:intellij-ce-playground    文件:GotoDomElementDeclarationAction.java   
@Override
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode simpleNode = treeView.getTree().getSelectedNode();

  if(simpleNode instanceof BaseDomElementNode) {
    final DomElement domElement = ((BaseDomElementNode)simpleNode).getDomElement();
    final DomElementNavigationProvider provider =
      DomElementsNavigationManager.getManager(domElement.getManager().getProject()).getDomElementsNavigateProvider(DomElementsNavigationManager.DEFAULT_PROVIDER_NAME);

    provider.navigate(domElement, true);

  }
}
项目:intellij-ce-playground    文件:DomCollectionProblemDescriptorImpl.java   
public DomCollectionProblemDescriptorImpl(final DomElement domElement,
                                          final String message,
                                          final HighlightSeverity type,
                                          final DomCollectionChildDescription childDescription) {
  super(domElement, message, type);
  myChildDescription = childDescription;
}
项目:intellij-ce-playground    文件:AndroidXmlTagDescriptor.java   
@Override
public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
  final XmlElementDescriptor[] descriptors = myParentDescriptor.getElementsDescriptors(context);

  if (myBaseClassName == null || context == null) {
    return descriptors;
  }
  final AndroidFacet facet = AndroidFacet.getInstance(context);

  if (facet == null) {
    return descriptors;
  }
  final XmlElementDescriptor[] androidDescriptors = new XmlElementDescriptor[descriptors.length];
  final DomElement domElement = DomManager.getDomManager(context.getProject()).getDomElement(context);
  final PsiClass baseClass = JavaPsiFacade.getInstance(context.getProject()).findClass(
    myBaseClassName, facet.getModule().getModuleWithLibrariesScope());

  for (int i = 0; i < descriptors.length; i++) {
    final XmlElementDescriptor descriptor = descriptors[i];
    final String tagName = descriptor.getName();
    final PsiClass aClass = tagName != null && baseClass != null
                            ? SimpleClassMapConstructor.findClassByTagName(facet, tagName, baseClass)
                            : null;
    final Icon icon = AndroidDomElementDescriptorProvider.getIconForTag(tagName, domElement);
    androidDescriptors[i] = new AndroidXmlTagDescriptor(aClass, descriptor, myBaseClassName, icon);
  }
  return androidDescriptors;
}
项目:intellij-ce-playground    文件:DomCollectionWrapper.java   
@Override
public void setValue(final T value) throws IllegalAccessException, InvocationTargetException {
  final List<? extends DomElement> list = myChildDescription.getValues(myDomElement);
  final DomElement domElement;
  if (list.isEmpty()) {
    domElement = myChildDescription.addValue(myDomElement);
  } else {
    domElement = list.get(0);
  }
  mySetter.invoke(domElement, value);
}
项目:intellij-ce-playground    文件:DomPatterns.java   
/**
 * @deprecated use {@link #tagWithDom(String, ElementPattern)} and  {@link #attributeWithDom(String, ElementPattern)}
 */
public static XmlElementPattern.Capture withDom(final ElementPattern<? extends DomElement> pattern) {
  return new XmlElementPattern.Capture().with(new PatternCondition<XmlElement>("tagWithDom") {
    @Override
    public boolean accepts(@NotNull final XmlElement xmlElement, final ProcessingContext context) {
      final DomManager manager = DomManager.getDomManager(xmlElement.getProject());
      if (xmlElement instanceof XmlAttribute) {
        return pattern.accepts(manager.getDomElement((XmlAttribute)xmlElement), context);
      }
      return xmlElement instanceof XmlTag && pattern.accepts(manager.getDomElement((XmlTag)xmlElement), context);
    }
  });
}
项目:intellij-ce-playground    文件:AntReferenceInjector.java   
public String resolveString(@Nullable String unresolvedText, @NotNull ConvertContext context) {
  // todo: speed optimization: disable string resolution in places where it is not applicable
  if (unresolvedText == null) {
    return null;
  }
  final DomElement element = context.getInvocationElement();
  return AntStringResolver.computeString(element, unresolvedText);
}
项目:intellij-ce-playground    文件:DimensionConverterTest.java   
@SuppressWarnings("deprecation")
protected <T extends DomElement> T createElement(final String xml, final Class<T> aClass) throws IncorrectOperationException {
  final DomManagerImpl domManager = (DomManagerImpl)DomManager.getDomManager(getProject());
  final String name = "a.xml";
  final XmlFile file = (XmlFile)PsiFileFactory.getInstance(domManager.getProject()).createFileFromText(name, xml);
  assertNotNull(file);
  XmlDocument document = file.getDocument();
  assertNotNull(document);
  final XmlTag tag = document.getRootTag();
  final String rootTagName = tag != null ? tag.getName() : "root";
  final T element = domManager.getFileElement(file, aClass, rootTagName).getRootElement();
  assertNotNull(element);
  assertSame(tag, element.getXmlTag());
  return element;
}
项目:intellij-ce-playground    文件:DomUINavigationProvider.java   
@Override
public void navigate(DomElement domElement, boolean requestFocus) {
  final DomUIControl domUIControl = findDomControl(myComponent, domElement);
  if(domUIControl != null) {
    domUIControl.navigate(domElement);
  }
}
项目:intellij-ce-playground    文件:DomCollectionControl.java   
@Override
public boolean canNavigate(DomElement element) {
  final Class<DomElement> aClass = (Class<DomElement>)ReflectionUtil.getRawType(myChildDescription.getType());

  final DomElement domElement = element.getParentOfType(aClass, false);

  return domElement != null && myCollectionElements.contains(domElement);
}
项目:intellij-ce-playground    文件:DomElementsProblemsHolderImpl.java   
@Override
public List<DomElementProblemDescriptor> getProblems(DomElement domElement,
                                                     final boolean includeXmlProblems,
                                                     final boolean withChildren,
                                                     final HighlightSeverity minSeverity) {
  return getProblems(domElement, withChildren, minSeverity);
}