Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to find out if a resource has been committed
How to find out if a resource has been committed [message #119174] Fri, 29 August 2003 08:03 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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;
}
Previous Topic:Eclipse file deletion
Next Topic:Cannot exclude plugins from runtime workbench in 2.1
Goto Forum:
  


Current Time: Mon Dec 30 16:47:26 GMT 2024

Powered by FUDForum. Page generated in 0.02742 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top