Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-03-19 14:34:55 +0000
committercletavernie2012-03-19 14:34:55 +0000
commitc445e29ffd86d825a5ab669aebe9d0fb8866882f (patch)
treecde03041c3ef21ee3ec1efb4ba7f22abcb486dbc /plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse
parenta8392fee09e0de5e6d6480be2ab2f1387fbc69b7 (diff)
downloadorg.eclipse.papyrus-c445e29ffd86d825a5ab669aebe9d0fb8866882f.tar.gz
org.eclipse.papyrus-c445e29ffd86d825a5ab669aebe9d0fb8866882f.tar.xz
org.eclipse.papyrus-c445e29ffd86d825a5ab669aebe9d0fb8866882f.zip
359058: [Refactoring - Architecture] Identify the layers and sub-layers for the Papyrus architecture
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359058
Diffstat (limited to 'plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse')
-rw-r--r--plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/svn/Activator.java45
-rw-r--r--plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/svn/SVNLockHandler.java48
2 files changed, 93 insertions, 0 deletions
diff --git a/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/svn/Activator.java b/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/svn/Activator.java
new file mode 100644
index 00000000000..74536d136fa
--- /dev/null
+++ b/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/svn/Activator.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.svn;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/svn/SVNLockHandler.java b/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/svn/SVNLockHandler.java
new file mode 100644
index 00000000000..d909cae3f15
--- /dev/null
+++ b/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/svn/SVNLockHandler.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2011 Atos Origin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.svn;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.team.FileModificationValidationContext;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.papyrus.readonly.IReadOnlyHandler;
+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 {
+
+ SVNTeamModificationValidator validator = new SVNTeamModificationValidator();
+
+ public boolean isReadOnly(IFile[] files) {
+
+ IResource[] needsLockResources = FileUtility.filterResources(files, IStateFilter.SF_NEEDS_LOCK, IResource.DEPTH_ZERO);
+ for(IResource needsLockResource : needsLockResources) {
+ if(!SVNRemoteStorage.instance().asLocalResource(needsLockResource).isLocked()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public boolean enableWrite(IFile[] files) {
+
+ IStatus result = validator.validateEdit(files, FileModificationValidationContext.VALIDATE_PROMPT);
+
+ return result.isOK();
+ }
+}

Back to the top