Package com.intellij.lang.properties

Examples of com.intellij.lang.properties.IProperty


    final List<IProperty> properties = PropertiesImplUtil.findPropertiesByKey(project, name);

    String value = null;

    // 1. default.properties from struts2-core.jar
    final IProperty strutsDefaultProperty = ContainerUtil.find(properties, new Condition<IProperty>() {
      public boolean value(final IProperty property) {
        final VirtualFile virtualFile = property.getPropertiesFile().getVirtualFile();
        return virtualFile != null &&
               virtualFile.getFileSystem() instanceof JarFileSystem &&
               StringUtil.endsWith(virtualFile.getPath(), STRUTS_DEFAULT_PROPERTIES) &&
               ModuleUtilCore.moduleContainsFile(module, virtualFile, true);
      }
    });
    if (strutsDefaultProperty != null) {
      value = strutsDefaultProperty.getValue();
    }

    // 2. <constant> from StrutsModel
    final Condition<Constant> constantNameCondition = new Condition<Constant>() {
      public boolean value(final Constant constant) {
        return Comparing.equal(constant.getName().getStringValue(), name);
      }
    };

    final List<DomFileElement<StrutsRoot>> domFileElements = new ArrayList<DomFileElement<StrutsRoot>>();
    collectStrutsXmls(domFileElements, strutsModel, "struts-default.xml", true);
    collectStrutsXmls(domFileElements, strutsModel, "struts-plugin.xml", true);
    collectStrutsXmls(domFileElements, strutsModel, "struts.xml", false);
    for (final DomFileElement<StrutsRoot> domFileElement : domFileElements) {
      final Constant constant = ContainerUtil.find(domFileElement.getRootElement().getConstants(),
                                                   constantNameCondition);
      final String strutsXmlValue = constant != null ? constant.getValue().getStringValue() : null;
      if (strutsXmlValue != null) {
        value = strutsXmlValue;
      }
    }

    // 3. struts.properties in current module
    final IProperty strutsProperty = ContainerUtil.find(properties, new Condition<IProperty>() {
      public boolean value(final IProperty property) {
        final VirtualFile virtualFile = property.getPropertiesFile().getVirtualFile();
        return virtualFile != null &&
               Comparing.equal(virtualFile.getName(), STRUTS_PROPERTIES_FILENAME) &&
               ModuleUtilCore.moduleContainsFile(module, virtualFile, false);
      }
    });
    if (strutsProperty != null) {
      value = strutsProperty.getValue();
    }

    // 4. web.xml
    final WebFacet webFacet = WebUtil.getWebFacet(context);
    if (webFacet == null) {
View Full Code Here


  public void testResolveActionProperty() throws Exception {
    myFixture.copyFileToProject("jam/ActionProperty.java");
    myFixture.copyFileToProject("struts.properties");

    final JamResultPath jamResultPath = getClassJam("jam.ActionProperty", JamResultPath.META_CLASS);
    final IProperty property = jamResultPath.getProperty().getValue();
    assertNotNull(property);
    assertEquals("myProperty1", property.getName());
  }
View Full Code Here

TOP

Related Classes of com.intellij.lang.properties.IProperty

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.