Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/team')
-rw-r--r--plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java27
1 files changed, 23 insertions, 4 deletions
diff --git a/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java b/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java
index ee73a06fedc..39ab94d4424 100644
--- a/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java
+++ b/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java
@@ -15,8 +15,11 @@ package org.eclipse.papyrus.team.svn;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.team.FileModificationValidationContext;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.infra.emf.readonly.IReadOnlyHandler;
import org.eclipse.team.svn.core.IStateFilter;
@@ -28,9 +31,9 @@ public class SVNLockHandler implements IReadOnlyHandler {
SVNTeamModificationValidator validator = new SVNTeamModificationValidator();
- public boolean isReadOnly(IFile[] files, EditingDomain editingDomain) {
+ public boolean isReadOnly(URI[] uris, EditingDomain editingDomain) {
- IResource[] needsLockResources = FileUtility.filterResources(files, IStateFilter.SF_NEEDS_LOCK, IResource.DEPTH_ZERO);
+ IResource[] needsLockResources = FileUtility.filterResources(getIFiles(uris), IStateFilter.SF_NEEDS_LOCK, IResource.DEPTH_ZERO);
for(IResource needsLockResource : needsLockResources) {
if(!SVNRemoteStorage.instance().asLocalResource(needsLockResource).isLocked()) {
return true;
@@ -40,9 +43,25 @@ public class SVNLockHandler implements IReadOnlyHandler {
return false;
}
- public boolean enableWrite(IFile[] files, EditingDomain editingDomain) {
+ private IFile[] getIFiles(URI[] uris) {
+ IFile[] iFiles = new IFile[uris.length];
+ int i = 0;
+ for(URI uri : uris) {
+ iFiles[i++] = getFile(uri);
+ }
+ return iFiles;
+ }
+
+ private static IFile getFile(URI uri) {
+ if(uri.isPlatform()) {
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)));
+ }
+ return null;
+ }
+
+ public boolean enableWrite(URI[] uris, EditingDomain editingDomain) {
- IStatus result = validator.validateEdit(files, FileModificationValidationContext.VALIDATE_PROMPT);
+ IStatus result = validator.validateEdit(getIFiles(uris), FileModificationValidationContext.VALIDATE_PROMPT);
return result.isOK();
}

Back to the top