1 /*******************************************************************************
2 * Copyright (C) 2016 Obeo.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
10 *******************************************************************************/
11 package org
.eclipse
.egit
.ui
.view
.synchronize
;
13 import org
.eclipse
.core
.resources
.IFile
;
14 import org
.eclipse
.core
.resources
.IResource
;
15 import org
.eclipse
.core
.resources
.mapping
.ModelProvider
;
16 import org
.eclipse
.core
.resources
.mapping
.RemoteResourceMappingContext
;
17 import org
.eclipse
.core
.resources
.mapping
.ResourceMapping
;
18 import org
.eclipse
.core
.resources
.mapping
.ResourceMappingContext
;
19 import org
.eclipse
.core
.runtime
.CoreException
;
20 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
23 * Mock Model Provider that requires a {@link RemoteResourceMappingContext} to
24 * perform correctly in synchronizations.
26 public class MockLogicalModelProvider
extends ModelProvider
{
27 public static final String ID
= "org.eclipse.egit.ui.test.mockLogicalModelProvider";
29 public static final String MOCK_LOGICAL_FILE_EXTENSION
= "mocklogical";
32 public ResourceMapping
[] getMappings(IResource resource
,
33 ResourceMappingContext context
, IProgressMonitor monitor
)
34 throws CoreException
{
35 if (resource
instanceof IFile
&& MOCK_LOGICAL_FILE_EXTENSION
36 .equals(resource
.getFileExtension())) {
37 return new ResourceMapping
[] { new MockLogicalResourceMapping(
38 (IFile
) resource
, ID
), };
40 return super.getMappings(resource
, context
, monitor
);