How to find out if a resource has been committed [message #119174] |
Fri, 29 August 2003 08:03 |
Eclipse User |
|
|
|
Originally posted by: om.icu.unizh.ch
Hi,
I'm writing a plugin that allows an eclipse user (business user, not
programmer) to upload a file from the resource perspective to a webserver,
mounted as a samba share. As I don't want them to be able to upload
uncommitted resources to the *productive* environment, I want to find out
whether the resource has uncommitted changes. the cvs decorators show this
nicely, but I have no clue where to start. how can I 'access' a decorator
on a resource? do I have to write the plug-in base on the cvs plug-in?
we are working with the regular cvs. we also use the watch/edit mode,
hence as a workaround I could also check if a resouce is read-only, but a
smart user may manually set the file to read-only and be able to upload
anyway...
ciao!
- ollie
|
|
|
Re: How to find out if a resource has been committed [message #119212 is a reply to message #119174] |
Fri, 29 August 2003 11:15 |
Eclipse User |
|
|
|
Originally posted by: om.icu.unizh.ch
found out by now... seems to work like this.
/**
* Checks if the given resource has been committed to CVS
* @param resource
* @return
*/
public boolean isResourceCVSCommited( IResource resource ) {
boolean isCommited = false;
if ( CVSWorkspaceRoot.hasRemote( resource ) ) {
try {
ICVSFile cvsFile = (ICVSFile) CVSWorkspaceRoot.getCVSFileFor( (IFile)
resource );
isCommited = ! cvsFile.isEdited() && ! cvsFile.isModified( null );
} catch (CVSException e) {
_summaryInformations.add(
new PropertyUploaderSummaryInfo(
PropertyUploaderSummaryInfo.DATABASE_PROBLEM,
resource.getName(),
e )
);
_unsuccessfulCounter++;
}
}
return isCommited;
}
|
|
|
Powered by
FUDForum. Page generated in 0.02742 seconds