use of org.eclipse.jst.jsp.core.internal.contenttype.DeploymentDescriptorPropertyCache.PropertyGroup in project webtools.sourceediting by eclipse.
the class JSPTranslator method translatePreludes.
private void translatePreludes() {
fProcessIncludes = false;
IPath modelpath = getModelPath();
if (modelpath != null) {
PropertyGroup[] propertyGroups = DeploymentDescriptorPropertyCache.getInstance().getPropertyGroups(modelpath);
for (int j = 0; j < propertyGroups.length; j++) {
IPath[] preludes = propertyGroups[j].getIncludePrelude();
for (int i = 0; i < preludes.length; i++) {
if (!getIncludes().contains(preludes[i].toString()) && !preludes[i].equals(modelpath)) {
getIncludes().push(preludes[i]);
JSPIncludeRegionHelper helper = new JSPIncludeRegionHelper(this, true);
helper.parse(preludes[i].toString());
getIncludes().pop();
}
}
}
}
fProcessIncludes = true;
}
use of org.eclipse.jst.jsp.core.internal.contenttype.DeploymentDescriptorPropertyCache.PropertyGroup in project webtools.sourceediting by eclipse.
the class TLDCMDocumentManager method handlePreludes.
void handlePreludes() {
IStructuredDocumentRegion anchor = new ZeroStructuredDocumentRegion(null, -1);
fProcessIncludes = false;
IPath currentPath = getCurrentParserPath();
if (currentPath != null) {
PropertyGroup[] propertyGroups = DeploymentDescriptorPropertyCache.getInstance().getPropertyGroups(currentPath);
for (int k = 0; k < propertyGroups.length; k++) {
IPath[] preludes = propertyGroups[k].getIncludePrelude();
for (int i = 0; i < preludes.length; i++) {
if (!getIncludes().contains(preludes[i]) && !preludes[i].equals(currentPath)) {
getIncludes().push(preludes[i]);
if (getParser() != null) {
IncludeHelper includeHelper = new IncludeHelper(anchor, getParser());
includeHelper.parse(preludes[i]);
List references = includeHelper.taglibReferences;
fTLDCMReferencesMap.put(preludes[i], references);
if (getParser() instanceof JSPCapableParser) {
for (int j = 0; j < references.size(); j++) {
TLDCMDocumentReference reference = (TLDCMDocumentReference) references.get(j);
// $NON-NLS-1$
((JSPCapableParser) getParser()).addNestablePrefix(new TagMarker(reference.prefix + ":"));
}
}
} else
// $NON-NLS-1$ //$NON-NLS-2$
Logger.log(Logger.WARNING, "Warning: parser text was requested by " + getClass().getName() + " but none was available; taglib support disabled");
getIncludes().pop();
}
}
}
}
fProcessIncludes = true;
}
use of org.eclipse.jst.jsp.core.internal.contenttype.DeploymentDescriptorPropertyCache.PropertyGroup in project webtools.sourceediting by eclipse.
the class JSPActionValidator method isElIgnored.
/**
* Determines if EL should be ignored. Checks
* <ol>
* <li>JSP version</li>
* <li>Page directive isELIgnored</li>
* <li>Deployment descriptor's el-ignored</li>
* </ol>
* @return true if EL should be ignored, false otherwise. If the JSP version is < 2.0, EL is ignored by default
*/
private boolean isElIgnored(IPath path, IStructuredModel model) {
if (DeploymentDescriptorPropertyCache.getInstance().getJSPVersion(path) < 2.0f)
return true;
PageDirectiveAdapter pdAdapter = ((PageDirectiveAdapter) (((IDOMModel) model).getDocument().getAdapterFor(PageDirectiveAdapter.class)));
if (pdAdapter == null) {
// double-check the factory (although there just might not be a page directive in the file)
if (model.getFactoryRegistry().getFactoryFor(PageDirectiveAdapter.class) == null) {
model.getFactoryRegistry().addFactory(new PageDirectiveAdapterFactory());
pdAdapter = ((PageDirectiveAdapter) (((IDOMModel) model).getDocument().getAdapterFor(PageDirectiveAdapter.class)));
}
}
if (pdAdapter != null) {
String directiveIsELIgnored = pdAdapter.getElIgnored();
// isELIgnored directive found
if (directiveIsELIgnored != null)
return Boolean.valueOf(directiveIsELIgnored).booleanValue();
}
// Check the deployment descriptor for el-ignored
PropertyGroup[] groups = DeploymentDescriptorPropertyCache.getInstance().getPropertyGroups(path);
if (groups.length > 0)
return groups[0].isELignored();
// JSP version >= 2.0 defaults to evaluating EL
return false;
}
use of org.eclipse.jst.jsp.core.internal.contenttype.DeploymentDescriptorPropertyCache.PropertyGroup in project webtools.sourceediting by eclipse.
the class JSPBatchValidator method validate.
public ValidationResult validate(final IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
if (resource.getType() != IResource.FILE)
return null;
if (!shouldValidate((IFile) resource))
return null;
final ValidationResult result = new ValidationResult();
final IReporter reporter = result.getReporter(monitor);
if (result.getDependsOn() != null) {
fDependsOn = new HashSet(Arrays.asList(result.getDependsOn()));
} else {
fDependsOn = new HashSet();
}
// add web.xml as a dependency
addDependsOn(DeploymentDescriptorPropertyCache.getInstance().getWebXML(resource.getFullPath()));
// List relevant JSP 2.0 preludes/codas as dependencies
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
PropertyGroup[] propertyGroups = DeploymentDescriptorPropertyCache.getInstance().getPropertyGroups(resource.getFullPath());
for (int j = 0; j < propertyGroups.length; j++) {
IPath[] preludes = propertyGroups[j].getIncludePrelude();
for (int i = 0; i < preludes.length; i++) {
addDependsOn(workspaceRoot.getFile(preludes[i]));
}
IPath[] codas = propertyGroups[j].getIncludeCoda();
for (int i = 0; i < codas.length; i++) {
addDependsOn(workspaceRoot.getFile(codas[i]));
}
}
IWorkspaceRunnable validationRunnable = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
if (fragmentCheck((IFile) resource)) {
validateFile((IFile) resource, reporter);
}
IResource[] resources = (IResource[]) fDependsOn.toArray(new IResource[fDependsOn.size()]);
result.setDependsOn(resources);
fDependsOn.clear();
}
};
Job currentJob = Job.getJobManager().currentJob();
ISchedulingRule rule = null;
if (currentJob != null) {
rule = currentJob.getRule();
}
try {
JavaCore.run(validationRunnable, rule, new NullProgressMonitor());
} catch (CoreException e) {
Logger.logException(e);
}
return result;
}
use of org.eclipse.jst.jsp.core.internal.contenttype.DeploymentDescriptorPropertyCache.PropertyGroup in project webtools.sourceediting by eclipse.
the class JSPTranslator method translateCodas.
private void translateCodas() {
fProcessIncludes = false;
IPath modelpath = getModelPath();
if (modelpath != null) {
PropertyGroup[] propertyGroups = DeploymentDescriptorPropertyCache.getInstance().getPropertyGroups(modelpath);
for (int j = 0; j < propertyGroups.length; j++) {
IPath[] codas = propertyGroups[j].getIncludeCoda();
for (int i = 0; i < codas.length; i++) {
if (!getIncludes().contains(codas[i].toString()) && !codas[i].equals(modelpath)) {
getIncludes().push(codas[i]);
JSPIncludeRegionHelper helper = new JSPIncludeRegionHelper(this, true);
helper.parse(codas[i].toString());
getIncludes().pop();
}
}
}
}
fProcessIncludes = true;
}
Aggregations