Package org.eclipse.wst.xml.core.internal.document

Examples of org.eclipse.wst.xml.core.internal.document.AttrImpl


  private FactoryBeanValidator factoryBeanAttrValidator;

  private boolean hasError(String beanName) {
    NodeList children = beansNode.getChildNodes();
    IDOMNode beanNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_BEAN, beanName, children);
    AttrImpl attr = (AttrImpl) beanNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_FACTORY_BEAN);

    IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
    Set<IResourceModelElement> contextElements = getContextElements(config);
    for (IResourceModelElement contextElement : contextElements) {
      if (factoryBeanAttrValidator.validateAttributeWithConfig(config, contextElement, attr, beanNode, reporter,
View Full Code Here


  private static void createRenameBeanRefTextEditForAttribute(String attributeName, Node node, String oldBeanId,
      String newBeanId, MultiTextEdit multiEdit) {
    if (BeansEditorUtils.hasAttribute(node, attributeName)) {
      String beanRef = BeansEditorUtils.getAttribute(node, attributeName);
      if (beanRef != null && beanRef.equals(oldBeanId)) {
        AttrImpl attr = (AttrImpl) node.getAttributes().getNamedItem(attributeName);
        int offset = attr.getValueRegionStartOffset() + 1;
        if (offset >= 0) {
          multiEdit.addChild(new ReplaceEdit(offset, beanRef.length(), newBeanId));
        }
      }
    }
View Full Code Here

    NamedNodeMap attributes = node.getAttributes();
    if (attributes != null) {
      for (int i = 0; i < attributes.getLength(); i++) {
        String attribute = attributes.item(i).getNodeValue();
        if (oldName.equals(attribute) || isGoodMatch(attribute, oldName, element instanceof IPackageFragment)) {
          AttrImpl attr = (AttrImpl) attributes.getNamedItem(attributes.item(i).getNodeName());
          int offset = attr.getValueRegionStartOffset() + 1;
          if (offset >= 0) {
            multiEdit.addChild(new ReplaceEdit(offset, oldName.length(), newName));
          }
        }
      }
View Full Code Here

public class CreateNewMethodQuickFixProposalTest extends AbstractBeanFileQuickfixTestCase {

  private IJavaProject javaProject;

  private void applyProposal(IDOMNode beanNode, String methodName, int argCount, String className) throws Exception {
    AttrImpl classAttr = (AttrImpl) beanNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_CLASS);
    ITextRegion valueRegion = classAttr.getValueRegion();

    int offset = getOffset(valueRegion, beanNode);
    int length = getLength(valueRegion, false);

    // IPackageFragmentRoot[] allPackageFragmentRoots =
View Full Code Here

  }

  public void testAddToConfigSet() {
    IDOMNode beanNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_BEAN, "addToConfigSetTest", beansNode
        .getChildNodes());
    AttrImpl parentAttr = (AttrImpl) beanNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_PARENT);
    ITextRegion valueRegion = parentAttr.getValueRegion();

    int offset = getOffset(valueRegion, beanNode);
    int length = getLength(valueRegion, false);

    BeansProject beanProject = (BeansProject) BeansCorePlugin.getModel().getProject(project);
View Full Code Here

  private boolean hasError(IDOMNode node, String attrName, boolean checkChildren) {
    if (node.getAttributes() == null) {
      return false;
    }

    AttrImpl attr = (AttrImpl) node.getAttributes().getNamedItem(attrName);
    if (attr == null && checkChildren) {
      boolean foundError = false;
      NodeList childNodes = node.getChildNodes();
      for (int i = 0; i < childNodes.getLength(); i++) {
        foundError |= hasError((IDOMNode) childNodes.item(i), attrName, checkChildren);
View Full Code Here

public class CreateImportQuickFixProposalTest extends AbstractBeanFileQuickfixTestCase {

  private void applyProposal(String importFilePath) {
    IDOMNode beanNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_BEAN, "addImportTest",
        beansNode.getChildNodes());
    AttrImpl parentAttr = (AttrImpl) beanNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_PARENT);
    ITextRegion valueRegion = parentAttr.getValueRegion();

    int offset = getOffset(valueRegion, beanNode);
    int length = getLength(valueRegion, false);

    IFile configFile = (IFile) project.findMember(importFilePath);
    IBeansConfig config = BeansCorePlugin.getModel().getConfig(configFile);
    IBean importBean = BeansModelUtils.getBean(parentAttr.getValue(), config);

    IBeansProject beanProject = BeansCorePlugin.getModel().getProject(project);

    CreateImportQuickFixProposal proposal = new CreateImportQuickFixProposal(offset, length, false, importBean,
        beanNode, beanProject, file);
View Full Code Here

    applyProposal("src2/import-test.xml");

    importNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_IMPORT, 0, beansNode.getChildNodes());
    assertNotNull("Expects import added", importNode);

    AttrImpl resourceAttr = (AttrImpl) importNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_RESOURCE);
    assertNotNull("Expects resource attribute added to import", resourceAttr);

    assertEquals("Expects resource attribute to be ../src2/import-test.xml", resourceAttr.getValue(),
        "../src2/import-test.xml");
  }
View Full Code Here

    applyProposal("src/import-test.xml");

    importNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_IMPORT, 0, beansNode.getChildNodes());
    assertNotNull("Expects import added", importNode);

    AttrImpl resourceAttr = (AttrImpl) importNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_RESOURCE);
    assertNotNull("Expects resource attribute added to import", resourceAttr);

    assertEquals("Expects resource attribute to be import-test.xml", resourceAttr.getValue(), "import-test.xml");
  }
View Full Code Here

  private ClassAttributeValidator classAttrValidator;

  private boolean hasMethodError(String beanName, BeanValidator beanValidator) {
    NodeList children = beansNode.getChildNodes();
    IDOMNode beanNode = QuickfixTestUtil.getNode(BeansSchemaConstants.ELEM_BEAN, beanName, children);
    AttrImpl attr = (AttrImpl) beanNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_FACTORY_METHOD);

    IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
    Set<IResourceModelElement> contextElements = getContextElements(config);
    for (IResourceModelElement contextElement : contextElements) {
      if (beanValidator.validateAttributeWithConfig(config, contextElement, attr, beanNode, reporter, true,
View Full Code Here

TOP

Related Classes of org.eclipse.wst.xml.core.internal.document.AttrImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.