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
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')
-rw-r--r--plugins/team/org.eclipse.papyrus.team.svn/META-INF/MANIFEST.MF4
-rw-r--r--plugins/team/org.eclipse.papyrus.team.svn/plugin.xml1
-rw-r--r--plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java29
3 files changed, 19 insertions, 15 deletions
diff --git a/plugins/team/org.eclipse.papyrus.team.svn/META-INF/MANIFEST.MF b/plugins/team/org.eclipse.papyrus.team.svn/META-INF/MANIFEST.MF
index 2f7b0e44f2d..3e0ea8fd43c 100644
--- a/plugins/team/org.eclipse.papyrus.team.svn/META-INF/MANIFEST.MF
+++ b/plugins/team/org.eclipse.papyrus.team.svn/META-INF/MANIFEST.MF
@@ -6,7 +6,9 @@ Require-Bundle: org.eclipse.papyrus.infra.onefile;bundle-version="0.10.0",
org.eclipse.team.svn.core;resolution:=optional,
org.eclipse.papyrus.infra.emf.readonly;bundle-version="0.10.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
- org.eclipse.emf.edit
+ org.eclipse.emf.edit,
+ org.eclipse.papyrus.infra.core,
+ com.google.guava;bundle-version="10.0.1"
Export-Package: org.eclipse.papyrus.team.svn
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/plugins/team/org.eclipse.papyrus.team.svn/plugin.xml b/plugins/team/org.eclipse.papyrus.team.svn/plugin.xml
index 7e70529c9ea..403b2942f18 100644
--- a/plugins/team/org.eclipse.papyrus.team.svn/plugin.xml
+++ b/plugins/team/org.eclipse.papyrus.team.svn/plugin.xml
@@ -5,6 +5,7 @@
point="org.eclipse.papyrus.infra.emf.readonly.readOnlyHandler">
<readOnlyHandler
class="org.eclipse.papyrus.team.svn.SVNLockHandler"
+ id="org.eclipse.papyrus.team.svn.SVNLockHandler"
priority="20">
</readOnlyHandler>
</extension>
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