Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormvelten2013-03-15 13:12:50 -0400
committermvelten2013-03-15 13:12:50 -0400
commit6d9d1d3a366b23effa6ff4433d4d20321f259ad3 (patch)
treec8178651f775da4d2800dc39c7bd5d332214267e /plugins/team/org.eclipse.papyrus.team.svn/src/org
parent0af939dee2c2a1de5bd2be10820219ecec9ac582 (diff)
downloadorg.eclipse.papyrus-6d9d1d3a366b23effa6ff4433d4d20321f259ad3.tar.gz
org.eclipse.papyrus-6d9d1d3a366b23effa6ff4433d4d20321f259ad3.tar.xz
org.eclipse.papyrus-6d9d1d3a366b23effa6ff4433d4d20321f259ad3.zip
396735: [Read only] corrupted model because of half saved model
https://bugs.eclipse.org/bugs/show_bug.cgi?id=396735 397762: [ReadOnly] Unable to override a IReadOnlyHandler once register https://bugs.eclipse.org/bugs/show_bug.cgi?id=397762 397758: [PapyrusCore] ModelSet should be more extensible https://bugs.eclipse.org/bugs/show_bug.cgi?id=397758
Diffstat (limited to 'plugins/team/org.eclipse.papyrus.team.svn/src/org')
-rw-r--r--plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java29
1 files changed, 15 insertions, 14 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 2777ba14711..fd82e369c43 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
@@ -24,16 +24,17 @@ 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.papyrus.infra.emf.readonly.AbstractReadOnlyHandler;
import org.eclipse.team.svn.core.IStateFilter;
import org.eclipse.team.svn.core.svnstorage.SVNRemoteStorage;
import org.eclipse.team.svn.core.utility.FileUtility;
import org.eclipse.team.svn.ui.SVNTeamModificationValidator;
-public class SVNLockHandler implements IReadOnlyHandler {
+import com.google.common.base.Optional;
- FileModificationValidator validator = null;
+public class SVNLockHandler extends AbstractReadOnlyHandler {
+ FileModificationValidator validator = null;
public SVNLockHandler() {
try {
@@ -42,18 +43,26 @@ public class SVNLockHandler implements IReadOnlyHandler {
}
}
- public boolean isReadOnly(URI[] uris, EditingDomain editingDomain) {
+ public Optional<Boolean> anyReadOnly(URI[] uris, EditingDomain editingDomain) {
if (validator != null) {
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;
+ return Optional.of(Boolean.TRUE);
}
}
}
- return false;
+ return Optional.absent();
+ }
+
+ public Optional<Boolean> makeWritable(URI[] uris, EditingDomain editingDomain) {
+ if (validator != null) {
+ IStatus result = validator.validateEdit(getIFiles(uris), FileModificationValidationContext.VALIDATE_PROMPT);
+ return Optional.of(result.isOK());
+ }
+ return Optional.absent();
}
private IFile[] getIFiles(URI[] uris) {
@@ -73,12 +82,4 @@ public class SVNLockHandler implements IReadOnlyHandler {
}
return null;
}
-
- public boolean enableWrite(URI[] uris, EditingDomain editingDomain) {
- if (validator != null) {
- IStatus result = validator.validateEdit(getIFiles(uris), FileModificationValidationContext.VALIDATE_PROMPT);
- return result.isOK();
- }
- return false;
- }
}

Back to the top