Jump to content

How does p4eclipse detect file changes?


  • Please log in to reply
3 replies to this topic

#1 philippe.faes



  • Members
  • Pip
  • 2 posts

Posted 27 March 2013 - 01:36 PM

We build a commercial Eclipse plugin for VHDL development and some of our customers use the p4eclipse perforce plugin.

When they change a file in their eclipse project, the file is automatically checked out from Perforce by p4eclipse. Also, when they make changes to the project that reflect in changes in the ".project" file, this file is correctly checked out, as expected.

Now: when our plugin modifies a hidden XML file (through the standard Eclipse IFile interface) the p4eclipse plugin does not detect this and the XML files is not marked as "<edit>". This was unexpected.

My question: Which listener does p4eclipse use to be notified of changes? In other words, how can we notifiy p4eclipse of changes to this hidden XML file?


#2 P4Matt


    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 28 March 2013 - 10:33 PM

Good question. I'll drag the P4Eclipse developer in here.

#3 alex



  • Members
  • Pip
  • 8 posts

Posted 29 March 2013 - 12:44 AM

Hi, Philippe:

What you may do is to call IWorkspace.validateEdit(IFile[] files, Object context) after you change your .xml file, e.g.

IFile myxml=...
myxml.getWorkspace().validateEdit(new IFile[]{myxml}, null);...
P4Eclipse register as FileModificationValidator, which will be notified when you change the .xml file from UI. However, if you change in headless mode, you have to make a call to notify the change.

Hope this helps.

#4 philippe.faes



  • Members
  • Pip
  • 2 posts

Posted 29 March 2013 - 09:16 AM

Thanks Alex. We'll try this!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users