diff options
author | Olivier Constant | 2017-06-09 10:32:41 +0000 |
---|---|---|
committer | Olivier Constant | 2017-06-09 10:32:41 +0000 |
commit | c7c17452bbe2475836e5b2fba47330d4697e19f9 (patch) | |
tree | 793f98bebf42ca4a2124a538b39f628d6b0c97cc /plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector | |
parent | a7fca648cec4af7d04e009b5a40ba5cc65be4f29 (diff) | |
download | org.eclipse.emf.diffmerge.core-c7c17452bbe2475836e5b2fba47330d4697e19f9.tar.gz org.eclipse.emf.diffmerge.core-c7c17452bbe2475836e5b2fba47330d4697e19f9.tar.xz org.eclipse.emf.diffmerge.core-c7c17452bbe2475836e5b2fba47330d4697e19f9.zip |
Updated copyrights
Change-Id: I1dd4cb74fc5dcb9ce75b981f42460d5ee17470f1
Signed-off-by: Olivier Constant <olivier.constant@thalesgroup.com>
Diffstat (limited to 'plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector')
7 files changed, 510 insertions, 510 deletions
diff --git a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/EMFDiffMergeSVNConnectorPlugin.java b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/EMFDiffMergeSVNConnectorPlugin.java index 249206c3..1597268b 100644 --- a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/EMFDiffMergeSVNConnectorPlugin.java +++ b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/EMFDiffMergeSVNConnectorPlugin.java @@ -1,68 +1,68 @@ -/*******************************************************************************
- * Copyright (c) 2015-2016 Intel Corporation and others.
- * 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:
- * Stephane Bouchet (Intel Corporation) - initial API and implementation
- * Olivier Constant (Thales Global Services) - tight integration
- *******************************************************************************/
-package org.eclipse.emf.diffmerge.connector.svn;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-
-/**
- * The activator class for this plug-in.
- */
-public class EMFDiffMergeSVNConnectorPlugin extends AbstractUIPlugin {
-
- /** The shared instance */
- private static EMFDiffMergeSVNConnectorPlugin __plugin;
-
-
- /**
- * Constructor
- */
- public EMFDiffMergeSVNConnectorPlugin() {
- // Nothing needed
- }
-
- /**
- * Return the shared instance of this activator
- * @return a non-null object
- */
- public static EMFDiffMergeSVNConnectorPlugin getDefault() {
- return __plugin;
- }
-
- /**
- * Return the ID of this plug-in according to MANIFEST.MF
- * @return a non-null string
- */
- public String getPluginId() {
- return getBundle().getSymbolicName();
- }
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context_p) throws Exception {
- super.start(context_p);
- __plugin = this;
- }
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context_p) throws Exception {
- __plugin = null;
- super.stop(context_p);
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2015-2017 Intel Corporation and others. + * 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: + * Stephane Bouchet (Intel Corporation) - initial API and implementation + * Olivier Constant (Thales Global Services) - tight integration + *******************************************************************************/ +package org.eclipse.emf.diffmerge.connector.svn; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + + +/** + * The activator class for this plug-in. + */ +public class EMFDiffMergeSVNConnectorPlugin extends AbstractUIPlugin { + + /** The shared instance */ + private static EMFDiffMergeSVNConnectorPlugin __plugin; + + + /** + * Constructor + */ + public EMFDiffMergeSVNConnectorPlugin() { + // Nothing needed + } + + /** + * Return the shared instance of this activator + * @return a non-null object + */ + public static EMFDiffMergeSVNConnectorPlugin getDefault() { + return __plugin; + } + + /** + * Return the ID of this plug-in according to MANIFEST.MF + * @return a non-null string + */ + public String getPluginId() { + return getBundle().getSymbolicName(); + } + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context_p) throws Exception { + super.start(context_p); + __plugin = this; + } + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context_p) throws Exception { + __plugin = null; + super.stop(context_p); + } + +} diff --git a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/Messages.java b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/Messages.java index 0599e4bc..73dbc37b 100644 --- a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/Messages.java +++ b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/Messages.java @@ -1,38 +1,38 @@ -/*******************************************************************************
- * Copyright (c) 2015-2016 Intel Corporation and others.
- * 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:
- * Stephane Bouchet (Intel Corporation) - initial API and implementation
- * Olivier Constant (Thales Global Services) - tight integration
- *******************************************************************************/
-package org.eclipse.emf.diffmerge.connector.svn;
-
-import org.eclipse.osgi.util.NLS;
-
-
-/**
- * String management.
- */
-@SuppressWarnings("javadoc")
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.emf.diffmerge.connector.svn.messages"; //$NON-NLS-1$
- public static String SVNHistoryURIConverter_CannotLoad;
- public static String SVNHistoryURIConverter_CannotLoad_Located;
- public static String SVNRemoteScopeDefinitionFactory_LabelBase;
- public static String SVNRemoteScopeDefinitionFactory_LabelHead;
- public static String SVNRemoteScopeDefinitionFactory_LabelRev;
- public static String SVNRevisionScopeDefinitionFactory_LabelRevision;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- // Nothing needed
- }
-}
+/******************************************************************************* + * Copyright (c) 2015-2017 Intel Corporation and others. + * 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: + * Stephane Bouchet (Intel Corporation) - initial API and implementation + * Olivier Constant (Thales Global Services) - tight integration + *******************************************************************************/ +package org.eclipse.emf.diffmerge.connector.svn; + +import org.eclipse.osgi.util.NLS; + + +/** + * String management. + */ +@SuppressWarnings("javadoc") +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emf.diffmerge.connector.svn.messages"; //$NON-NLS-1$ + public static String SVNHistoryURIConverter_CannotLoad; + public static String SVNHistoryURIConverter_CannotLoad_Located; + public static String SVNRemoteScopeDefinitionFactory_LabelBase; + public static String SVNRemoteScopeDefinitionFactory_LabelHead; + public static String SVNRemoteScopeDefinitionFactory_LabelRev; + public static String SVNRevisionScopeDefinitionFactory_LabelRevision; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + // Nothing needed + } +} diff --git a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNHistoryURIConverter.java b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNHistoryURIConverter.java index 3aacbb3c..db7c401c 100644 --- a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNHistoryURIConverter.java +++ b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNHistoryURIConverter.java @@ -1,107 +1,107 @@ -/*******************************************************************************
- * Copyright (c) 2015-2016 Intel Corporation and others.
- * 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:
- * Stephane Bouchet (Intel Corporation) - initial API and implementation
- * Olivier Constant (Thales Global Services) - tight integration
- *******************************************************************************/
-package org.eclipse.emf.diffmerge.connector.svn.ext;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.diffmerge.connector.svn.EMFDiffMergeSVNConnectorPlugin;
-import org.eclipse.emf.diffmerge.connector.svn.Messages;
-import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
-import org.eclipse.team.svn.core.connector.SVNRevision;
-import org.eclipse.team.svn.core.operation.AbstractGetFileContentOperation;
-import org.eclipse.team.svn.core.operation.IActionOperation;
-import org.eclipse.team.svn.core.operation.local.GetLocalFileContentOperation;
-import org.eclipse.team.svn.core.operation.remote.GetFileContentOperation;
-import org.eclipse.team.svn.core.resource.IRepositoryLocation;
-import org.eclipse.team.svn.core.resource.IRepositoryResource;
-import org.eclipse.team.svn.core.svnstorage.SVNRemoteStorage;
-
-
-/**
- * A URI Converter for file revisions in the SVN history.
- */
-public class SVNHistoryURIConverter extends ExtensibleURIConverterImpl {
-
- /** The scheme for SVN repo locations */
- protected static final String SVN_SCHEME = "svn"; //$NON-NLS-1$
-
- /** The non-null repository location */
- protected final IRepositoryLocation _repoLocation;
-
- /** The non-null SVN revision */
- protected final SVNRevision _revision;
-
-
- /**
- * Constructor
- * @param repositoryLocation_p a non-null repository location
- * @param revision_p a non-null SVN revision
- */
- public SVNHistoryURIConverter(IRepositoryLocation repositoryLocation_p, SVNRevision revision_p) {
- _repoLocation = repositoryLocation_p;
- _revision = revision_p;
- }
-
- /**
- * @see org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl#createInputStream(org.eclipse.emf.common.util.URI, java.util.Map)
- */
- @Override
- public InputStream createInputStream(URI uri_p, Map<?, ?> options_p) throws IOException {
- // Strip the URI that contains the repo location
- String scheme = uri_p.scheme();
- if (scheme != null && scheme.startsWith(SVN_SCHEME)) {
- // Try to locate the file locally
- String basepath = _repoLocation.getRepositoryRootUrl();
- List<String> basePathSegmentsList = URI.createURI(basepath).segmentsList();
- List<String> newPathList = new ArrayList<String>(uri_p.segmentsList());
- newPathList.removeAll(basePathSegmentsList);
- IPath newPath = new Path(
- URI.createHierarchicalURI(newPathList.toArray(new String[] {}), uri_p.query(),
- uri_p.fragment()).devicePath());
- IResource target = ResourcesPlugin.getWorkspace().getRoot().getFile(newPath);
- if (target.exists()) {
- AbstractGetFileContentOperation op;
- if (_revision.equals(SVNRevision.BASE)) {
- op = new GetLocalFileContentOperation(target, SVNRevision.BASE.getKind());
- } else {
- IRepositoryResource res = SVNRemoteStorage.instance().asRepositoryResource(target);
- // Get the remote contents associated with the revision ID
- res.setSelectedRevision(_revision);
- op=new GetFileContentOperation(res);
- }
- op.run(new NullProgressMonitor());
- if (op.getExecutionState() != IActionOperation.OK)
- EMFDiffMergeSVNConnectorPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, EMFDiffMergeSVNConnectorPlugin.getDefault().getPluginId(),
- String.format(Messages.SVNHistoryURIConverter_CannotLoad, op.getStatus().getMessage())));
- return op.getContent();
- }
- EMFDiffMergeSVNConnectorPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, EMFDiffMergeSVNConnectorPlugin.getDefault().getPluginId(),
- String.format(Messages.SVNHistoryURIConverter_CannotLoad_Located, uri_p)));
- }
- return super.createInputStream(uri_p, options_p);
- }
-
+/******************************************************************************* + * Copyright (c) 2015-2017 Intel Corporation and others. + * 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: + * Stephane Bouchet (Intel Corporation) - initial API and implementation + * Olivier Constant (Thales Global Services) - tight integration + *******************************************************************************/ +package org.eclipse.emf.diffmerge.connector.svn.ext; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.diffmerge.connector.svn.EMFDiffMergeSVNConnectorPlugin; +import org.eclipse.emf.diffmerge.connector.svn.Messages; +import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl; +import org.eclipse.team.svn.core.connector.SVNRevision; +import org.eclipse.team.svn.core.operation.AbstractGetFileContentOperation; +import org.eclipse.team.svn.core.operation.IActionOperation; +import org.eclipse.team.svn.core.operation.local.GetLocalFileContentOperation; +import org.eclipse.team.svn.core.operation.remote.GetFileContentOperation; +import org.eclipse.team.svn.core.resource.IRepositoryLocation; +import org.eclipse.team.svn.core.resource.IRepositoryResource; +import org.eclipse.team.svn.core.svnstorage.SVNRemoteStorage; + + +/** + * A URI Converter for file revisions in the SVN history. + */ +public class SVNHistoryURIConverter extends ExtensibleURIConverterImpl { + + /** The scheme for SVN repo locations */ + protected static final String SVN_SCHEME = "svn"; //$NON-NLS-1$ + + /** The non-null repository location */ + protected final IRepositoryLocation _repoLocation; + + /** The non-null SVN revision */ + protected final SVNRevision _revision; + + + /** + * Constructor + * @param repositoryLocation_p a non-null repository location + * @param revision_p a non-null SVN revision + */ + public SVNHistoryURIConverter(IRepositoryLocation repositoryLocation_p, SVNRevision revision_p) { + _repoLocation = repositoryLocation_p; + _revision = revision_p; + } + + /** + * @see org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl#createInputStream(org.eclipse.emf.common.util.URI, java.util.Map) + */ + @Override + public InputStream createInputStream(URI uri_p, Map<?, ?> options_p) throws IOException { + // Strip the URI that contains the repo location + String scheme = uri_p.scheme(); + if (scheme != null && scheme.startsWith(SVN_SCHEME)) { + // Try to locate the file locally + String basepath = _repoLocation.getRepositoryRootUrl(); + List<String> basePathSegmentsList = URI.createURI(basepath).segmentsList(); + List<String> newPathList = new ArrayList<String>(uri_p.segmentsList()); + newPathList.removeAll(basePathSegmentsList); + IPath newPath = new Path( + URI.createHierarchicalURI(newPathList.toArray(new String[] {}), uri_p.query(), + uri_p.fragment()).devicePath()); + IResource target = ResourcesPlugin.getWorkspace().getRoot().getFile(newPath); + if (target.exists()) { + AbstractGetFileContentOperation op; + if (_revision.equals(SVNRevision.BASE)) { + op = new GetLocalFileContentOperation(target, SVNRevision.BASE.getKind()); + } else { + IRepositoryResource res = SVNRemoteStorage.instance().asRepositoryResource(target); + // Get the remote contents associated with the revision ID + res.setSelectedRevision(_revision); + op=new GetFileContentOperation(res); + } + op.run(new NullProgressMonitor()); + if (op.getExecutionState() != IActionOperation.OK) + EMFDiffMergeSVNConnectorPlugin.getDefault().getLog().log( + new Status(IStatus.ERROR, EMFDiffMergeSVNConnectorPlugin.getDefault().getPluginId(), + String.format(Messages.SVNHistoryURIConverter_CannotLoad, op.getStatus().getMessage()))); + return op.getContent(); + } + EMFDiffMergeSVNConnectorPlugin.getDefault().getLog().log( + new Status(IStatus.ERROR, EMFDiffMergeSVNConnectorPlugin.getDefault().getPluginId(), + String.format(Messages.SVNHistoryURIConverter_CannotLoad_Located, uri_p))); + } + return super.createInputStream(uri_p, options_p); + } + }
\ No newline at end of file diff --git a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNLocalScopeDefinitionFactory.java b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNLocalScopeDefinitionFactory.java index 73050d19..c2f04460 100644 --- a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNLocalScopeDefinitionFactory.java +++ b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNLocalScopeDefinitionFactory.java @@ -1,67 +1,67 @@ -/*******************************************************************************
- * Copyright (c) 2015-2016 Intel Corporation and others.
- * 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:
- * Stephane Bouchet (Intel Corporation) - initial API and implementation
- * Olivier Constant (Thales Global Services) - tight integration
- *******************************************************************************/
-package org.eclipse.emf.diffmerge.connector.svn.ext;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory;
-import org.eclipse.team.svn.ui.compare.ResourceCompareInput.ResourceElement;
-
-
-/**
- * A scope definition factory for local SVN files.
- */
-public class SVNLocalScopeDefinitionFactory extends URIScopeDefinitionFactory {
-
- /**
- * @see org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory#convertToURI(java.lang.Object)
- */
- @Override
- protected URI convertToURI(Object entrypoint_p) {
- URI result;
- if (entrypoint_p instanceof ResourceElement)
- result = getResourceElementURI((ResourceElement)entrypoint_p);
- else
- result = super.convertToURI(entrypoint_p);
- return result;
- }
-
- /**
- * @see org.eclipse.emf.diffmerge.ui.specification.AbstractScopeDefinitionFactory#getOverridenClasses()
- */
- @Override
- public Collection<? extends Class<?>> getOverridenClasses() {
- return Collections.<Class<?>> singleton(URIScopeDefinitionFactory.class);
- }
-
- /**
- * Return a URI for the given ResourceElement
- * @param resourceElement_p a non-null object
- * @return a non-null URI
- */
- protected URI getResourceElementURI(ResourceElement resourceElement_p) {
- return URI.createPlatformResourceURI(
- resourceElement_p.getLocalResource().getResource().getFullPath().toOSString(), true);
- }
-
- /**
- * @see org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory#isApplicableTo(java.lang.Object)
- */
- @Override
- public boolean isApplicableTo(Object entrypoint_p) {
- return entrypoint_p instanceof ResourceElement &&
- ((ResourceElement)entrypoint_p).isEditable();
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2015-2017 Intel Corporation and others. + * 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: + * Stephane Bouchet (Intel Corporation) - initial API and implementation + * Olivier Constant (Thales Global Services) - tight integration + *******************************************************************************/ +package org.eclipse.emf.diffmerge.connector.svn.ext; + +import java.util.Collection; +import java.util.Collections; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory; +import org.eclipse.team.svn.ui.compare.ResourceCompareInput.ResourceElement; + + +/** + * A scope definition factory for local SVN files. + */ +public class SVNLocalScopeDefinitionFactory extends URIScopeDefinitionFactory { + + /** + * @see org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory#convertToURI(java.lang.Object) + */ + @Override + protected URI convertToURI(Object entrypoint_p) { + URI result; + if (entrypoint_p instanceof ResourceElement) + result = getResourceElementURI((ResourceElement)entrypoint_p); + else + result = super.convertToURI(entrypoint_p); + return result; + } + + /** + * @see org.eclipse.emf.diffmerge.ui.specification.AbstractScopeDefinitionFactory#getOverridenClasses() + */ + @Override + public Collection<? extends Class<?>> getOverridenClasses() { + return Collections.<Class<?>> singleton(URIScopeDefinitionFactory.class); + } + + /** + * Return a URI for the given ResourceElement + * @param resourceElement_p a non-null object + * @return a non-null URI + */ + protected URI getResourceElementURI(ResourceElement resourceElement_p) { + return URI.createPlatformResourceURI( + resourceElement_p.getLocalResource().getResource().getFullPath().toOSString(), true); + } + + /** + * @see org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory#isApplicableTo(java.lang.Object) + */ + @Override + public boolean isApplicableTo(Object entrypoint_p) { + return entrypoint_p instanceof ResourceElement && + ((ResourceElement)entrypoint_p).isEditable(); + } + +} diff --git a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNRemoteScopeDefinitionFactory.java b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNRemoteScopeDefinitionFactory.java index ed5df18a..ba6bc9bc 100644 --- a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNRemoteScopeDefinitionFactory.java +++ b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNRemoteScopeDefinitionFactory.java @@ -1,114 +1,114 @@ -/*******************************************************************************
- * Copyright (c) 2015-2016 Intel Corporation and others.
- * 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:
- * Stephane Bouchet (Intel Corporation) - initial API and implementation
- * Olivier Constant (Thales Global Services) - tight integration
- *******************************************************************************/
-package org.eclipse.emf.diffmerge.connector.svn.ext;
-
-import java.io.InputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.diffmerge.connector.core.EMFDiffMergeCoreConnectorPlugin;
-import org.eclipse.emf.diffmerge.connector.core.ext.AbstractURIConvertingScopeDefinitionFactory;
-import org.eclipse.emf.diffmerge.connector.svn.Messages;
-import org.eclipse.emf.ecore.resource.URIConverter;
-import org.eclipse.team.svn.core.connector.SVNConnectorException;
-import org.eclipse.team.svn.core.connector.SVNRevision;
-import org.eclipse.team.svn.ui.compare.ResourceCompareInput.ResourceElement;
-
-
-/**
- * A scope definition factory for remote SVN files.
- */
-public class SVNRemoteScopeDefinitionFactory extends AbstractURIConvertingScopeDefinitionFactory {
-
- /**
- * @see org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory#convertToURI(java.lang.Object)
- */
- @Override
- protected URI convertToURI(Object entrypoint_p) {
- URI result;
- if (entrypoint_p instanceof ResourceElement)
- result = getResourceElementURI((ResourceElement)entrypoint_p);
- else
- result = super.convertToURI(entrypoint_p);
- return result;
- }
-
- /**
- * @see org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory#getLabelFor(java.lang.Object)
- */
- @Override
- protected String getLabelFor(Object entrypoint_p) {
- final ResourceElement res = (ResourceElement) entrypoint_p;
- SVNRevision rev = res.getRepositoryResource().getSelectedRevision();
- String result = null;
- try {
- String url = res.getRepositoryResource().getUrl();
- if (SVNRevision.BASE.equals(rev))
- result = String.format(Messages.SVNRemoteScopeDefinitionFactory_LabelBase, url);
- else if (SVNRevision.HEAD.equals(rev))
- result = String.format(Messages.SVNRemoteScopeDefinitionFactory_LabelHead, url);
- else
- result = String.format(Messages.SVNRemoteScopeDefinitionFactory_LabelRev,
- url, Long.toString(res.getRepositoryResource().getRevision()));
- } catch (SVNConnectorException e) {
- EMFDiffMergeCoreConnectorPlugin.getDefault().logError(e);
- }
- if (result == null)
- result = res.getName();
- return result;
- }
-
- /**
- * Return a URI for the given ResourceElement
- * @param resourceElement_p a non-null object
- * @return a non-null URI
- */
- protected URI getResourceElementURI(ResourceElement resourceElement_p) {
- return URI.createURI(resourceElement_p.getRepositoryResource().getUrl());
- }
-
- /**
- * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractURIConvertingScopeDefinitionFactory#getStream(java.lang.Object)
- */
- @Override
- protected InputStream getStream(Object entrypoint_p) throws CoreException {
- InputStream result;
- if (entrypoint_p instanceof ResourceElement)
- result = ((ResourceElement)entrypoint_p).getContents();
- else
- result = super.getStream(entrypoint_p);
- return result;
- }
-
- /**
- * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractURIConvertingScopeDefinitionFactory#getURIConverter(java.lang.Object)
- */
- @Override
- protected URIConverter getURIConverter(Object entrypoint_p) {
- URIConverter result = null;
- if (entrypoint_p instanceof ResourceElement) {
- ResourceElement res = (ResourceElement)entrypoint_p;
- result = new SVNHistoryURIConverter(res.getRepositoryResource().getRepositoryLocation(),
- res.getRepositoryResource().getSelectedRevision());
- }
- return result;
- }
-
- /**
- * @see org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory#isApplicableTo(java.lang.Object)
- */
- @Override
- public boolean isApplicableTo(Object entrypoint_p) {
- return entrypoint_p instanceof ResourceElement && !((ResourceElement)entrypoint_p).isEditable();
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2015-2017 Intel Corporation and others. + * 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: + * Stephane Bouchet (Intel Corporation) - initial API and implementation + * Olivier Constant (Thales Global Services) - tight integration + *******************************************************************************/ +package org.eclipse.emf.diffmerge.connector.svn.ext; + +import java.io.InputStream; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.diffmerge.connector.core.EMFDiffMergeCoreConnectorPlugin; +import org.eclipse.emf.diffmerge.connector.core.ext.AbstractURIConvertingScopeDefinitionFactory; +import org.eclipse.emf.diffmerge.connector.svn.Messages; +import org.eclipse.emf.ecore.resource.URIConverter; +import org.eclipse.team.svn.core.connector.SVNConnectorException; +import org.eclipse.team.svn.core.connector.SVNRevision; +import org.eclipse.team.svn.ui.compare.ResourceCompareInput.ResourceElement; + + +/** + * A scope definition factory for remote SVN files. + */ +public class SVNRemoteScopeDefinitionFactory extends AbstractURIConvertingScopeDefinitionFactory { + + /** + * @see org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory#convertToURI(java.lang.Object) + */ + @Override + protected URI convertToURI(Object entrypoint_p) { + URI result; + if (entrypoint_p instanceof ResourceElement) + result = getResourceElementURI((ResourceElement)entrypoint_p); + else + result = super.convertToURI(entrypoint_p); + return result; + } + + /** + * @see org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory#getLabelFor(java.lang.Object) + */ + @Override + protected String getLabelFor(Object entrypoint_p) { + final ResourceElement res = (ResourceElement) entrypoint_p; + SVNRevision rev = res.getRepositoryResource().getSelectedRevision(); + String result = null; + try { + String url = res.getRepositoryResource().getUrl(); + if (SVNRevision.BASE.equals(rev)) + result = String.format(Messages.SVNRemoteScopeDefinitionFactory_LabelBase, url); + else if (SVNRevision.HEAD.equals(rev)) + result = String.format(Messages.SVNRemoteScopeDefinitionFactory_LabelHead, url); + else + result = String.format(Messages.SVNRemoteScopeDefinitionFactory_LabelRev, + url, Long.toString(res.getRepositoryResource().getRevision())); + } catch (SVNConnectorException e) { + EMFDiffMergeCoreConnectorPlugin.getDefault().logError(e); + } + if (result == null) + result = res.getName(); + return result; + } + + /** + * Return a URI for the given ResourceElement + * @param resourceElement_p a non-null object + * @return a non-null URI + */ + protected URI getResourceElementURI(ResourceElement resourceElement_p) { + return URI.createURI(resourceElement_p.getRepositoryResource().getUrl()); + } + + /** + * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractURIConvertingScopeDefinitionFactory#getStream(java.lang.Object) + */ + @Override + protected InputStream getStream(Object entrypoint_p) throws CoreException { + InputStream result; + if (entrypoint_p instanceof ResourceElement) + result = ((ResourceElement)entrypoint_p).getContents(); + else + result = super.getStream(entrypoint_p); + return result; + } + + /** + * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractURIConvertingScopeDefinitionFactory#getURIConverter(java.lang.Object) + */ + @Override + protected URIConverter getURIConverter(Object entrypoint_p) { + URIConverter result = null; + if (entrypoint_p instanceof ResourceElement) { + ResourceElement res = (ResourceElement)entrypoint_p; + result = new SVNHistoryURIConverter(res.getRepositoryResource().getRepositoryLocation(), + res.getRepositoryResource().getSelectedRevision()); + } + return result; + } + + /** + * @see org.eclipse.emf.diffmerge.ui.specification.ext.URIScopeDefinitionFactory#isApplicableTo(java.lang.Object) + */ + @Override + public boolean isApplicableTo(Object entrypoint_p) { + return entrypoint_p instanceof ResourceElement && !((ResourceElement)entrypoint_p).isEditable(); + } + +} diff --git a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNRevisionScopeDefinitionFactory.java b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNRevisionScopeDefinitionFactory.java index d4cc071a..7de04c35 100644 --- a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNRevisionScopeDefinitionFactory.java +++ b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/ext/SVNRevisionScopeDefinitionFactory.java @@ -1,104 +1,104 @@ -/*******************************************************************************
- * Copyright (c) 2015-2016 Intel Corporation and others.
- * 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:
- * Stephane Bouchet (Intel Corporation) - initial API and implementation
- * Olivier Constant (Thales Global Services) - tight integration
- *******************************************************************************/
-package org.eclipse.emf.diffmerge.connector.svn.ext;
-
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.diffmerge.connector.core.ext.AbstractRevisionScopeDefinitionFactory;
-import org.eclipse.emf.diffmerge.connector.svn.Messages;
-import org.eclipse.emf.ecore.resource.URIConverter;
-import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.svn.core.connector.SVNRevision;
-import org.eclipse.team.svn.core.resource.ILocalResource;
-import org.eclipse.team.svn.core.resource.IRepositoryLocation;
-import org.eclipse.team.svn.core.svnstorage.SVNRemoteStorage;
-import org.eclipse.team.svn.core.synchronize.variant.BaseFileVariant;
-import org.eclipse.team.svn.core.synchronize.variant.RemoteFileVariant;
-
-
-/**
- * A scope definition factory for file revisions in SVN history.
- * It is used in the Team Synchronizing perspective for the ancestor and remote scopes.
- */
-public class SVNRevisionScopeDefinitionFactory extends AbstractRevisionScopeDefinitionFactory {
-
- /**
- * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractRevisionScopeDefinitionFactory#getLabelForRevision(org.eclipse.team.core.history.IFileRevision, org.eclipse.compare.ITypedElement)
- */
- @Override
- protected String getLabelForRevision(IFileRevision revision_p, ITypedElement entrypoint_p) {
- String result = null;
- IResourceVariant variant = getVariant(revision_p);
- if (variant != null) {
- // Ancestor or remote
- result = String.format(
- Messages.SVNRevisionScopeDefinitionFactory_LabelRevision, variant.getContentIdentifier());
- }
- return result;
- }
-
- /**
- * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractRevisionScopeDefinitionFactory#getURIConverterForRevision(org.eclipse.team.core.history.IFileRevision)
- */
- @Override
- protected URIConverter getURIConverterForRevision(IFileRevision revision_p) throws CoreException {
- URIConverter result = null;
- IResourceVariant variant = getVariant(revision_p);
- if (variant instanceof BaseFileVariant) {
- // Ancestor
- ILocalResource res =((BaseFileVariant)variant).getResource();
- IRepositoryLocation location = SVNRemoteStorage.instance().getRepositoryLocation(res.getResource());
- result = new SVNHistoryURIConverter(location, SVNRevision.fromString(variant.getContentIdentifier()));
- } else {
- // Remote
- result = new ExtensibleURIConverterImpl();
- }
- return result;
- }
-
- /**
- * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractRevisionScopeDefinitionFactory#getURIForRevision(org.eclipse.team.core.history.IFileRevision)
- */
- @Override
- protected URI getURIForRevision(IFileRevision revision_p) throws CoreException {
- URI result = null;
- IResourceVariant variant = getVariant(revision_p);
- if (variant instanceof BaseFileVariant) {
- // Ancestor
- ILocalResource res = ((BaseFileVariant)variant).getResource();
- IRepositoryLocation location = SVNRemoteStorage.instance().getRepositoryLocation(res.getResource());
- result = URI.createURI(location.getRepositoryRootUrl() +
- ((BaseFileVariant)variant).getResource().getResource().getFullPath(), true);
- } else {
- // Remote
- IStorage storage = getStorage(revision_p);
- if (storage != null)
- result = toFileURI(storage.getFullPath().toString());
- }
- return result;
- }
-
- /**
- * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractRevisionScopeDefinitionFactory#isApplicableToRevision(org.eclipse.team.core.history.IFileRevision, org.eclipse.compare.ITypedElement)
- */
- @Override
- protected boolean isApplicableToRevision(IFileRevision revision_p, ITypedElement entrypoint_p) {
- IResourceVariant variant = getVariant(revision_p);
- // Ancestor and remote
- return variant instanceof BaseFileVariant || variant instanceof RemoteFileVariant;
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2015-2017 Intel Corporation and others. + * 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: + * Stephane Bouchet (Intel Corporation) - initial API and implementation + * Olivier Constant (Thales Global Services) - tight integration + *******************************************************************************/ +package org.eclipse.emf.diffmerge.connector.svn.ext; + +import org.eclipse.compare.ITypedElement; +import org.eclipse.core.resources.IStorage; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.diffmerge.connector.core.ext.AbstractRevisionScopeDefinitionFactory; +import org.eclipse.emf.diffmerge.connector.svn.Messages; +import org.eclipse.emf.ecore.resource.URIConverter; +import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl; +import org.eclipse.team.core.history.IFileRevision; +import org.eclipse.team.core.variants.IResourceVariant; +import org.eclipse.team.svn.core.connector.SVNRevision; +import org.eclipse.team.svn.core.resource.ILocalResource; +import org.eclipse.team.svn.core.resource.IRepositoryLocation; +import org.eclipse.team.svn.core.svnstorage.SVNRemoteStorage; +import org.eclipse.team.svn.core.synchronize.variant.BaseFileVariant; +import org.eclipse.team.svn.core.synchronize.variant.RemoteFileVariant; + + +/** + * A scope definition factory for file revisions in SVN history. + * It is used in the Team Synchronizing perspective for the ancestor and remote scopes. + */ +public class SVNRevisionScopeDefinitionFactory extends AbstractRevisionScopeDefinitionFactory { + + /** + * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractRevisionScopeDefinitionFactory#getLabelForRevision(org.eclipse.team.core.history.IFileRevision, org.eclipse.compare.ITypedElement) + */ + @Override + protected String getLabelForRevision(IFileRevision revision_p, ITypedElement entrypoint_p) { + String result = null; + IResourceVariant variant = getVariant(revision_p); + if (variant != null) { + // Ancestor or remote + result = String.format( + Messages.SVNRevisionScopeDefinitionFactory_LabelRevision, variant.getContentIdentifier()); + } + return result; + } + + /** + * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractRevisionScopeDefinitionFactory#getURIConverterForRevision(org.eclipse.team.core.history.IFileRevision) + */ + @Override + protected URIConverter getURIConverterForRevision(IFileRevision revision_p) throws CoreException { + URIConverter result = null; + IResourceVariant variant = getVariant(revision_p); + if (variant instanceof BaseFileVariant) { + // Ancestor + ILocalResource res =((BaseFileVariant)variant).getResource(); + IRepositoryLocation location = SVNRemoteStorage.instance().getRepositoryLocation(res.getResource()); + result = new SVNHistoryURIConverter(location, SVNRevision.fromString(variant.getContentIdentifier())); + } else { + // Remote + result = new ExtensibleURIConverterImpl(); + } + return result; + } + + /** + * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractRevisionScopeDefinitionFactory#getURIForRevision(org.eclipse.team.core.history.IFileRevision) + */ + @Override + protected URI getURIForRevision(IFileRevision revision_p) throws CoreException { + URI result = null; + IResourceVariant variant = getVariant(revision_p); + if (variant instanceof BaseFileVariant) { + // Ancestor + ILocalResource res = ((BaseFileVariant)variant).getResource(); + IRepositoryLocation location = SVNRemoteStorage.instance().getRepositoryLocation(res.getResource()); + result = URI.createURI(location.getRepositoryRootUrl() + + ((BaseFileVariant)variant).getResource().getResource().getFullPath(), true); + } else { + // Remote + IStorage storage = getStorage(revision_p); + if (storage != null) + result = toFileURI(storage.getFullPath().toString()); + } + return result; + } + + /** + * @see org.eclipse.emf.diffmerge.connector.core.ext.AbstractRevisionScopeDefinitionFactory#isApplicableToRevision(org.eclipse.team.core.history.IFileRevision, org.eclipse.compare.ITypedElement) + */ + @Override + protected boolean isApplicableToRevision(IFileRevision revision_p, ITypedElement entrypoint_p) { + IResourceVariant variant = getVariant(revision_p); + // Ancestor and remote + return variant instanceof BaseFileVariant || variant instanceof RemoteFileVariant; + } + +} diff --git a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/messages.properties b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/messages.properties index ea34885f..20c4c28e 100644 --- a/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/messages.properties +++ b/plugins/org.eclipse.emf.diffmerge.connector.svn/src/org/eclipse/emf/diffmerge/connector/svn/messages.properties @@ -1,13 +1,13 @@ -###############################################################################
-# Copyright (c) 2015-2016 Intel Corporation and others.
-# 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
-###############################################################################
-SVNHistoryURIConverter_CannotLoad=Cannot load resource: %s
-SVNHistoryURIConverter_CannotLoad_Located=Cannot load resource at: %s
-SVNRemoteScopeDefinitionFactory_LabelBase=%1$s [BASE]
-SVNRemoteScopeDefinitionFactory_LabelHead=%1$s [HEAD]
-SVNRemoteScopeDefinitionFactory_LabelRev=%1$s [Rev:%2$s]
-SVNRevisionScopeDefinitionFactory_LabelRevision=Remote File [Rev:%s]
+############################################################################### +# Copyright (c) 2015-2017 Intel Corporation and others. +# 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 +############################################################################### +SVNHistoryURIConverter_CannotLoad=Cannot load resource: %s +SVNHistoryURIConverter_CannotLoad_Located=Cannot load resource at: %s +SVNRemoteScopeDefinitionFactory_LabelBase=%1$s [BASE] +SVNRemoteScopeDefinitionFactory_LabelHead=%1$s [HEAD] +SVNRemoteScopeDefinitionFactory_LabelRev=%1$s [Rev:%2$s] +SVNRevisionScopeDefinitionFactory_LabelRevision=Remote File [Rev:%s] |