Package com.intellij.struts2.dom.struts.impl

Examples of com.intellij.struts2.dom.struts.impl.ResultImpl


  @NotNull
  @Override
  public PsiReference[] getReferencesByElement(@NotNull final PsiElement psiElement,
                                               @NotNull final ProcessingContext processingContext) {
    final Result result = (Result)DomUtil.getDomElement(psiElement);
    assert result != null : psiElement.getText();
    final Action action = result.getParentOfType(Action.class, true);
    assert action != null : psiElement.getText();
    final PsiClass actionClass = action.searchActionClass();
    if (actionClass == null) {
      return PsiReference.EMPTY_ARRAY;
    }

    final int tagValueStartOffset = ElementManipulators.getOffsetInElement(result.getXmlTag());
    PsiReference[] references = new PsiReference[1];

    final String stringValue = result.getStringValue();
    if (!StringUtil.isNotEmpty(stringValue)) {
      return PsiReference.EMPTY_ARRAY;
    }

    final String resultText = StringUtil.replace(stringValue, "&", "&");
View Full Code Here


    super(identifyingElement, path);
  }

  @NotNull
  public Icon getIcon() {
    final Result result = getIdentifyingElement();
    if (!result.isValid()) {
      return UNKNOWN_RESULT_ICON;
    }

    final PathReference pathReference = result.getValue();
    if (pathReference == null) {
      return UNKNOWN_RESULT_ICON;
    }

    if (pathReference.resolve() == null) {
View Full Code Here

      return false;
    }

    // hack for STRPL-85: suppress <param>-highlighting within <result> for certain result-types
    if (converter instanceof ParamNameConverter) {
      final Result result = DomUtil.getParentOfType(value, Result.class, false);
      if (result != null) {
        final ResultType resultType = result.getEffectiveResultType();
        if (resultType == null) {
          return false; // error
        }

        final String resultTypeValue = resultType.getName().getStringValue();
View Full Code Here

  public PsiReference[] getCustomReferences(XmlAttributeValue nameAttributeValue, DomElement paramsElement) {
    if (!(paramsElement instanceof Result)) {
      return PsiReference.EMPTY_ARRAY;
    }

    Result result = (Result)paramsElement;
    Action action = DomUtil.getParentOfType(result, Action.class, true);
    assert action != null;

    return new PsiReference[]{new MergingBeanPropertyPathReference(nameAttributeValue,
                                                                   action, result)};
View Full Code Here

    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;
      }
    }
View Full Code Here

    }

    final boolean isStrutsXml = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
      @Override
      public Boolean compute() {
        final StrutsManager strutsManager = StrutsManager.getInstance(project);

        final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
        return psiFile instanceof XmlFile &&
               strutsManager.isStruts2ConfigFile((XmlFile)psiFile) &&
               strutsManager.getModelByFile((XmlFile)psiFile) != null;
      }
    });
    if (isStrutsXml) {
      return true;
    }
View Full Code Here

public class ActionReferenceProvider extends PsiReferenceProvider {

  @NotNull
  public PsiReference[] getReferencesByElement(@NotNull final PsiElement psiElement,
                                               @NotNull final ProcessingContext context) {
    final StrutsManager strutsManager = StrutsManager.getInstance(psiElement.getProject());
    final StrutsModel strutsModel = strutsManager.getCombinedModel(psiElement);
    if (strutsModel == null) {
      return PsiReference.EMPTY_ARRAY;
    }

    final XmlAttributeValue xmlAttributeValue = (XmlAttributeValue) psiElement;
View Full Code Here

  @NotNull
  public PsiReference[] getReferencesByElement(@NotNull final PsiElement psiElement,
                                               @NotNull final ProcessingContext context) {

    final StrutsManager strutsManager = StrutsManager.getInstance(psiElement.getProject());
    final StrutsModel strutsModel = strutsManager.getCombinedModel(psiElement);
    if (strutsModel == null) {
      return PsiReference.EMPTY_ARRAY;
    }

    return new PsiReference[]{new NamespaceReference((XmlAttributeValue) psiElement, strutsModel)
View Full Code Here

          StrutsBundle.message("inspections.struts2.model.validator.progress"),
          Struts2ModelInspection.class);
  }

  public Collection<VirtualFile> getFilesToProcess(final Project project, final CompileContext context) {
    final StrutsManager strutsManager = StrutsManager.getInstance(project);
    final PsiManager psiManager = PsiManager.getInstance(project);

    // cache validation settings per module
    @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
    final FactoryMap<Module, Boolean> enabledForModule = new FactoryMap<Module, Boolean>() {
      protected Boolean create(final Module module) {
        return isEnabledForModule(module);
      }
    };

    final Set<VirtualFile> files = new THashSet<VirtualFile>();
    for (final VirtualFile file : context.getCompileScope().getFiles(StdFileTypes.XML, false)) {
      final Module module = context.getModuleByFile(file);
      if (module != null &&
          enabledForModule.get(module)) {
        final PsiFile psiFile = psiManager.findFile(file);
        if (psiFile instanceof XmlFile) {
          final StrutsModel model = strutsManager.getModelByFile((XmlFile) psiFile);
          if (model != null) {
            for (final XmlFile configFile : model.getConfigFiles()) {
              ContainerUtil.addIfNotNull(configFile.getVirtualFile(), files);
            }
          }
View Full Code Here

    }

    final XmlFile xmlFile = (XmlFile)psiElement;
    final Project project = psiElement.getProject();

    final StrutsManager strutsManager = StrutsManager.getInstance(project);
    if (!strutsManager.isStruts2ConfigFile(xmlFile)) {
      return;
    }

    final VirtualFile currentVirtualFile = xmlFile.getVirtualFile();
    assert currentVirtualFile != null;

    final Set<StrutsFileSet> allConfigFileSets = strutsManager.getAllConfigFileSets(module);
    for (final StrutsFileSet configFileSet : allConfigFileSets) {
      if (configFileSet.hasFile(currentVirtualFile)) {
        return;
      }
    }
View Full Code Here

TOP

Related Classes of com.intellij.struts2.dom.struts.impl.ResultImpl

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.