Skip to main content
summaryrefslogtreecommitdiffstats
blob: be7fb61b5ccb25237b5ca482d84cf927bd770f5b (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*******************************************************************************
 * Copyright (c) 2009 SAP AG.
 * 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:
 *    Eduard Bartsch (SAP AG) - initial API and implementation
 *    Mathias Kinzler (SAP AG) - initial API and implementation
 *******************************************************************************/
package org.eclipse.core.resources.semantic.spi;

/**
 * The default implementation for the {@link ISemanticResourceRuleFactory}.
 * <p>
 * This will return the root store of the relevant content provider for any
 * requested rule. Content providers may chose to override
 * {@link ISemanticContentProvider#getRuleFactory()} by returning a subclass of
 * this class to achieve a different behavior.
 * <p>
 * The default behavior should be overridden if it causes too much lock
 * contention.
 * <p>
 * Note that a return value of <code>null</code> means that the workspace root
 * is used as scheduling rule. This behavior is intended as fall-back solution
 * and should be avoided wherever possible.
 * <p>
 * 
 */
public class DefaultSemanticResourceRuleFactory implements ISemanticResourceRuleFactory {

	protected final ISemanticFileStore rootStore;

	/**
	 * @param rootStore
	 *            the root store of the responsible content provider
	 */
	public DefaultSemanticResourceRuleFactory(ISemanticFileStore rootStore) {
		this.rootStore = rootStore;
	}

	public ISemanticFileStore charsetRule(ISemanticFileStore resource) {
		return this.rootStore;
	}

	public ISemanticFileStore copyRule(ISemanticFileStore source, ISemanticFileStore destination) {
		return (ISemanticFileStore) this.rootStore.getParent();
	}

	public ISemanticFileStore createRule(ISemanticFileStore resource) {
		return (ISemanticFileStore) this.rootStore.getParent();
	}

	public ISemanticFileStore deleteRule(ISemanticFileStore resource) {
		return (ISemanticFileStore) this.rootStore.getParent();
	}

	public ISemanticFileStore modifyRule(ISemanticFileStore resource) {
		return this.rootStore;
	}

	public ISemanticFileStore moveRule(ISemanticFileStore source, ISemanticFileStore destination) {
		return (ISemanticFileStore) this.rootStore.getParent();
	}

	public ISemanticFileStore refreshRule(ISemanticFileStore resource) {
		return (ISemanticFileStore) this.rootStore.getParent();
	}

	public ISemanticFileStore validateEditRule(ISemanticFileStore[] resources) {
		return (ISemanticFileStore) this.rootStore.getParent();
	}

}

Back to the top