Jump to content


Eclipse validateEdit() call shows confusing pop-up when P4 is involved

eclipse

  • Please log in to reply
2 replies to this topic

#1 bugmenot

bugmenot

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 20 May 2020 - 02:25 AM

We've written an Eclipse plugin that updates files via IFile.setContents() . Prior to this we call ResourcesPlugin.getWorkspace().validateEdit() to ensure that this is an OK thing to do.

I'm seeing unexpected behavior when I call validateEdit() when the p4eclipse plugin is in play. Specifically if the file isn't in the depot (but it does exist locally) I get a dialog that states "You do not have the latest revision for all the files selected. Do you want to get the latest revision of those files before checking them out?", with the options presented being "Get Latest", "Don't Get Latest", and "Cancel". This makes no sense to me - the file is not in the depot, so what is being referenced here?

Further, I get the pop-up even if I pass null in for the context when calling validateEdit(), which seems to be a no-no - the documents state "If null is passed, the user should not be contacted; any failures should be reported via the result; the caller may chose to present these to the user however they see fit."

Given this: is there some step that I'm missing? Alternately: is there some way that I can check to see if a local IFile isn't in the depot (this would allow me to avoid making the validateEdit() call that causes confusion).

Any insight appreciated :-) Thx, Dave

Aside: the forum registration page seems to have issues - no matter how accurately I transcribe the captcha to the text feild I get a "The security code you supplied did not match the one displayed" failure. Also: the facebook & twitter OAuth buttons give errors. So apologies for the recycled account I'm using to post here :)

#2 bugmenot

bugmenot

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 20 May 2020 - 11:54 AM

Two more notes on this:
  • The call to validateEdit() seems to be needed so that 'normal' files get checked out (as per the thread @ https://forums.perfo...t-file-changes/ ) - if there is a better way to programmatically add a file ot the default changelist I'm all ears :)
  • Eclipse version 2020-03 ( 4.15 ) , p4eclipse version 2019.1.1892661


#3 bugmenot

bugmenot

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 21 May 2020 - 03:27 AM

In looking @ this further, it seems that calls to perforce's FileModificationValidatorManager.validateEdit() in turn tries to fetch the depot resource. In the case where this doesn't exist it then pops up the display mentioned above - there doesn't seem to be any way to avoid this :(

There also doesn't seem to be any simple way to detect if the file is in the depot - technically I can call P4ConnectionManager.getManager().getResource(IFile) & interpret a null as "not in the depot", but that really isn't an option I can take in something that is going to ship ...

Can anyone within perforce tell me if there's something I'm overlooking / mis-interpreting ? If not: is there an option to open a ticket to get this behavior changed?





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users