Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c44d2dbfce3572c40f7b39f10634c661bb0e425c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*******************************************************************************
 * Copyright (c) 2010 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.tests.ccvs.core.mappings.model.mapping;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceMappingContext;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.tests.ccvs.core.mappings.model.ModelObject;
import org.eclipse.team.tests.ccvs.core.mappings.model.ModelProject;

/**
 * The model provider for our example
 */
public class CustomModelProvider extends
		org.eclipse.core.resources.mapping.ModelProvider {

	public static final String ID = "org.eclipse.team.tests.cvs.core.bug302163_ModelProvider";

	public CustomModelProvider() {
		super();
	}

	public IStatus validateChange(IResourceDelta delta, IProgressMonitor monitor) {
		return super.validateChange(delta, monitor);
	}

	public ResourceMapping[] getMappings(IResource resource,
			ResourceMappingContext context, IProgressMonitor monitor)
			throws CoreException {
		if (ModelProject.isModProject(resource.getProject())) {
			ModelObject object = ModelObject.create(resource);
			if (object != null)
				return new ResourceMapping[] { ModelResourceMapping
						.create(object) };
		}
		return super.getMappings(resource, context, monitor);
	}
}

Back to the top