Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormvelten2012-09-11 13:38:25 +0000
committermvelten2012-09-11 13:38:25 +0000
commit3ab429896e40301ad2b0f641e4a48f1caddbf1cc (patch)
tree21ce254377b5b93043ee17ebd0e9a15196fa8d9d
parentfc120bdcee075594e578b60fb26b5b28bae033cb (diff)
downloadorg.eclipse.papyrus-3ab429896e40301ad2b0f641e4a48f1caddbf1cc.tar.gz
org.eclipse.papyrus-3ab429896e40301ad2b0f641e4a48f1caddbf1cc.tar.xz
org.eclipse.papyrus-3ab429896e40301ad2b0f641e4a48f1caddbf1cc.zip
NEW - bug 382467: [Team] The dependency from Papyrus to SVN should be optional
https://bugs.eclipse.org/bugs/show_bug.cgi?id=382467 put the initialization of the validator in a try/catch NoClassDefFoundError and don't call svn api later if this fails.
-rw-r--r--plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java30
1 files changed, 21 insertions, 9 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 976c4e5ff3d..2777ba14711 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
@@ -19,6 +19,7 @@ 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.resources.team.FileModificationValidator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
@@ -31,14 +32,24 @@ import org.eclipse.team.svn.ui.SVNTeamModificationValidator;
public class SVNLockHandler implements IReadOnlyHandler {
- SVNTeamModificationValidator validator = new SVNTeamModificationValidator();
+ FileModificationValidator validator = null;
+
+
+ public SVNLockHandler() {
+ try {
+ validator = new SVNTeamModificationValidator();
+ } catch (NoClassDefFoundError e) {
+ }
+ }
public boolean isReadOnly(URI[] uris, EditingDomain editingDomain) {
- 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;
+ 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;
+ }
}
}
@@ -64,9 +75,10 @@ public class SVNLockHandler implements IReadOnlyHandler {
}
public boolean enableWrite(URI[] uris, EditingDomain editingDomain) {
-
- IStatus result = validator.validateEdit(getIFiles(uris), FileModificationValidationContext.VALIDATE_PROMPT);
-
- return result.isOK();
+ if (validator != null) {
+ IStatus result = validator.validateEdit(getIFiles(uris), FileModificationValidationContext.VALIDATE_PROMPT);
+ return result.isOK();
+ }
+ return false;
}
}

Back to the top