#325 Exceptions in clear case plugins

develop
closed-fixed
6
2012-12-16
2012-02-14
No

we have installed both clearcase and SVN plugins in eclipse . we have an SVN project checked out and edited the file , then clearcase listener was fired and throws an exception like state change exception etc This happens because in the code there is a check for file linked to a Repository and code always assumes there is only Clear Case Repository provider.

So we observed that adding an instance of check , in the plugin net.sourceforge.eclipseccase ,in the StateCacheFactory class ( in the function public void resourceChanged(IResourceChangeEvent event) ) will fix the problem as shown below .

if(ClearCaseProvider.getClearCaseProvider(projectDelta.getResource()) == null)
continue;

Below shows the change made to the function .

/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org
* .eclipse.core.resources.IResourceChangeEvent)
*/
public void resourceChanged(IResourceChangeEvent event) {

try {
IResourceDelta rootDelta = event.getDelta();
if (null != rootDelta) {
IResourceDelta[] projectDeltas = rootDelta
.getAffectedChildren();

// determine resources to refresh
final List<IResource> toRefresh = new ArrayList<IResource>();

for (int i = 0; i < projectDeltas.length; i++) {
IResourceDelta projectDelta = projectDeltas[i];

//check if the resource is attached to clearcase if not continue with next resource
//this is to avoid projects shared with other repository.
if(ClearCaseProvider.getClearCaseProvider(projectDelta.getResource()) == null)
continue;
// filter only shared projects
if (RepositoryProvider.isShared((IProject) projectDelta
.getResource())) {
if (!isAffectedBy(rootDelta)) {
continue;
}

if (projectDelta.getKind() == IResourceDelta.CHANGED
&& (projectDelta.getFlags() & IResourceDelta.OPEN) != 0) {
continue;
}
projectDelta.accept(new IResourceDeltaVisitor() {

public boolean visit(IResourceDelta delta)
throws CoreException {
switch (delta.getKind()) {
case IResourceDelta.REMOVED:
// only remove cache
removeSingle(delta.getResource());
break;

default:
if (needsRefresh(delta)) {
// refresh cache
toRefresh.add(delta.getResource());
}
}

return true;
}
});
}
}

if (!toRefresh.isEmpty()) {
refreshStateAsync(toRefresh.toArray(new IResource[toRefresh
.size()]));
}
}
} catch (CoreException e) {
ClearCasePlugin.log(IStatus.ERROR,
"Unable to do a update of resource", e); //$NON-NLS-1$
}
}

please check the change and make the fix in your plugin.

Regards
Ajay

Discussion

  • ajay chandrahasan

    • priority: 5 --> 6
    • assigned_to: nobody --> achim66
     
  • Mikael Petterson

    • assigned_to: achim66 --> eraonel
    • status: open --> pending-fixed
     
  • Mikael Petterson

    Thanks for contributing to the plugin.
    I implemented the suggested solution. Included in release 2.2.13.

    //mike

     
  • Mikael Petterson

    • status: pending-fixed --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks