use of com.intellij.struts2.dom.struts.strutspackage.StrutsPackage in project intellij-plugins by JetBrains.
the class StrutsPackageExtendsResolveConverterImpl method removeCurrentElementFromVariants.
private static Collection<StrutsPackage> removeCurrentElementFromVariants(final ConvertContext context, final Collection<StrutsPackage> allVariants) {
final StrutsPackage currentElement = (StrutsPackage) DomUtil.getDomElement(context.getTag());
assert currentElement != null : "currentElement was null for " + context.getTag();
final GenericDomValue currentNameElement = currentElement.getGenericInfo().getNameDomElement(currentElement);
if (currentNameElement == null) {
// skip due to XML errors
return allVariants;
}
final String currentName = currentNameElement.getStringValue();
if (currentName == null) {
// skip due to XML errors
return allVariants;
}
final StrutsPackage currentElementInVariants = DomUtil.findByName(allVariants, currentName);
if (currentElementInVariants != null) {
allVariants.remove(currentElementInVariants);
}
return allVariants;
}
use of com.intellij.struts2.dom.struts.strutspackage.StrutsPackage in project intellij-plugins by JetBrains.
the class JamParentPackageTest method checkResolve.
private static void checkResolve(@NotNull final JamParentPackage jamParentPackage) {
final StrutsPackage strutsPackage = jamParentPackage.getValue().getValue();
assertNotNull(strutsPackage);
assertEquals("myPackage", strutsPackage.getName().getStringValue());
}
use of com.intellij.struts2.dom.struts.strutspackage.StrutsPackage in project intellij-plugins by JetBrains.
the class ExceptionMappingResultResolveConverter method getVariants.
@NotNull
public Collection<? extends HasResultType> getVariants(final ConvertContext context) {
final DomElement invocationElement = context.getInvocationElement();
final Action action = invocationElement.getParentOfType(Action.class, true);
if (action == null) {
return Collections.emptySet();
}
final List<HasResultType> variants = new ArrayList<>();
// Action-local first
variants.addAll(action.getResults());
final StrutsPackage strutsPackage = action.getStrutsPackage();
final GlobalResults globalResults = strutsPackage.getGlobalResults();
variants.addAll(globalResults.getResults());
return variants;
}
use of com.intellij.struts2.dom.struts.strutspackage.StrutsPackage in project intellij-plugins by JetBrains.
the class StrutsDataModel method updateDataModel.
private void updateDataModel() {
final StrutsModel model = StrutsManager.getInstance(myProject).getModelByFile(myFile);
if (model == null) {
return;
}
for (final StrutsPackage strutsPackage : model.getStrutsPackages()) {
for (final Action action : strutsPackage.getActions()) {
final ActionNode actionNode = new ActionNode(action, action.getName().getStringValue());
addNode(actionNode);
for (final Result result : action.getResults()) {
final PathReference pathReference = result.getValue();
final String path = pathReference != null ? pathReference.getPath() : UNKNOWN;
final ResultNode resultNode = new ResultNode(result, path);
addNode(resultNode);
final String resultName = result.getName().getStringValue();
addEdge(new BasicStrutsEdge(actionNode, resultNode, resultName != null ? resultName : Result.DEFAULT_NAME));
}
}
}
}
use of com.intellij.struts2.dom.struts.strutspackage.StrutsPackage in project intellij-plugins by JetBrains.
the class DefaultInterceptorRefResolveConverterImpl method getVariants.
@NotNull
public Collection<? extends InterceptorStack> getVariants(final ConvertContext context) {
final List<InterceptorStack> results = new SmartList<>();
final Processor<StrutsPackage> processor = strutsPackage -> {
results.addAll(strutsPackage.getInterceptorStacks());
return true;
};
final StrutsPackageHierarchyWalker walker = new StrutsPackageHierarchyWalker(getCurrentStrutsPackage(context), processor);
walker.walkUp();
return results;
}
Aggregations