It's all about the answers!

Ask a question

[closed] After undo unresolved changes in local sandbox EWM client require to be repaired!!!

MJ Ranji (153) | asked Jul 26, 7:01 a.m.
closed Jul 26, 8:43 a.m. by Ralph Schoon (61.1k33643)

Hi Guys,

After Undoing changes using java API in sandbox EWM need to be repaired to work further with after opening EWM. How can I correctly undo unresolved changes. I did dig all related forum question related to undo changes  until I reach to this solution. but it need  rapair interaction process afterward in EWM. Thank you in advance :).  how can I do  clean undo changeset in plain java  just like scm command : scm.exe repair "BRM Stream Workspace"
p.s. Also resolver0 as in before last line did not work for me so I use resolver to get repository. 

        List<IWorkspaceHandle> workspaceHandles = ...

IWorkspaceHandle wh = workspaceHandles.get(0);

ArrayList<String> target = getAvailableComponentPath(); //like JKEJAVAUI, JKEBUSSINESLOGIC

ISharingManager sm = FileSystemCore.getSharingManager();
ILocalChangeManager lcm = sm.getLocalChangeManager();

PathLocation pathlocation = new PathLocation(sandBoxLocation);
ILocation sandBoxLocation = pathlocation.getCanonicalForm();

String[] targetPaths = new String[target.size()];
targetPaths = target.toArray(targetPaths);

for (int i = 0; i < targetPaths.length; i++) {

ISandbox sbox = sm.getSandbox(sandBoxLocation, false);
IRelativeLocation relativeLocation = new RelativeLocation(

IShareable shareable = sbox.findShareable(relativeLocation,
lcm.refreshChanges(new ISandbox[] { sbox },
ILocalChange[] localChanges = lcm.getPendingChanges(
new IShareable[] { shareable }, null);

IRepositoryResolver resolver = new IRepositoryResolver() {

public ITeamRepository getRepoFor(String uri, UUID id) {

// Return the repository to be used

return repo;



if (localChanges.length > 0) {

IRepositoryResolver resolver0 = IRepositoryResolver.EXISTING_SHARED; //This one did not work

lcm.undoChanges(localChanges, resolver, true, null, monitor);

The question has been closed for the following reason: "Duplicate Question" by rschoon Jul 26, 8:43 a.m.

Accepted answer

permanent link
Ralph Schoon (61.1k33643) | answered Jul 26, 8:42 a.m.
MJ Ranji selected this answer as the correct answer

MJ Ranji commented Jul 26, 10:54 a.m. | edited Jul 26, 11:21 a.m.
As I explain on the duplicated link. I only loaded this project once in EWM.

Do you mean requirement to repair local workspace after undoing changes is because of parallel load of workspace? if that is the case then you can mark this question as duplicate else I'll need to know my mistake in the code that lead to repair message in EWM client hence not duplicated question. But  the thing is that I have loaded this repository workspace only once in my local workspace(sandbox)!
Thanks in advance

Ralph Schoon commented Jul 27, 1:57 a.m. | edited Jul 27, 1:57 a.m.

It does not matter how often you load the repository workspace, if you mess with the API. The repository workspace tracks the state of the files on the server and on the sandbox. If you load the repo workspace once and then update the server files using the API, the one loaded repo workspace detects the discrepancy between the sandbox and the repo workspaces and tells you they are out of sync.