use of org.eclipse.jst.jsp.core.taglib.ITaglibRecord in project webtools.sourceediting by eclipse.
the class TLDCMDocumentManager method getModificationStamp.
private long getModificationStamp(String reference) {
IPath currentParserPath = getCurrentParserPath();
if (currentParserPath == null) {
return IResource.NULL_STAMP;
}
ITaglibRecord record = TaglibIndex.resolve(currentParserPath.toString(), reference, false);
long modificationStamp = IResource.NULL_STAMP;
if (record != null) {
switch(record.getRecordType()) {
case (ITaglibRecord.TLD):
{
IFile tldfile = ResourcesPlugin.getWorkspace().getRoot().getFile(((ITLDRecord) record).getPath());
if (tldfile.isAccessible()) {
modificationStamp = tldfile.getModificationStamp();
}
}
break;
case (ITaglibRecord.JAR):
{
File jarfile = new File(((IJarRecord) record).getLocation().toOSString());
if (jarfile.exists()) {
try {
modificationStamp = jarfile.lastModified();
} catch (SecurityException e) {
modificationStamp = IResource.NULL_STAMP;
}
}
}
break;
case (ITaglibRecord.TAGDIR):
{
IFolder tagFolder = ResourcesPlugin.getWorkspace().getRoot().getFolder(((ITagDirRecord) record).getPath());
if (tagFolder.isAccessible()) {
IResource[] members;
try {
members = tagFolder.members();
for (int i = 0; i < members.length; i++) {
modificationStamp = Math.max(modificationStamp, members[i].getModificationStamp());
}
} catch (CoreException e) {
modificationStamp = IResource.NULL_STAMP;
}
}
}
break;
case (ITaglibRecord.URL):
{
String loc = ((IURLRecord) record).getBaseLocation();
if (loc != null && loc.endsWith(".jar")) {
// $NON-NLS-1$
File jarfile = new File(loc);
if (jarfile.exists()) {
try {
modificationStamp = jarfile.lastModified();
} catch (SecurityException e) {
modificationStamp = IResource.NULL_STAMP;
}
}
}
}
break;
default:
break;
}
}
return modificationStamp;
}
Aggregations