Skip to main content
summaryrefslogtreecommitdiffstats
blob: fda56cf96bb1b85e62f2527022682517f90d850b (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
/*******************************************************************************
 * Copyright (c) 2007 Oracle. 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: Oracle. - initial API and implementation
 *******************************************************************************/
package org.eclipse.jpt.core.internal.platform;

import java.util.List;
import org.eclipse.jpt.core.internal.IJpaPlatform;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;

public abstract class BaseContext implements IContext
{
	private IContext parentContext;
	
	
	public BaseContext(IContext parentContext) {
		super();
		this.parentContext = parentContext;
	}
	
	/**
	 * All inter-context based initialization should be done here
	 * (i.e. all initialization based on other contexts, parent or otherwise)
	 */
	protected abstract void initialize();
	
	/**
	 * @see IContext#getParentContext()
	 */
	public IJpaPlatform getPlatform() {
		return getParentContext().getPlatform();
	}
	
	/**
	 * @see IContext#getParentContext()
	 */
	public IContext getParentContext() {
		return parentContext;
	}
	
	/**
	 * All subclass implementation {@link #refreshDefaults(DefaultsContext)} 
	 * should be preceded by a "super" call to this method
	 */
	public void refreshDefaults(DefaultsContext parentDefaults) {
		initialize();
	}
	
	/**
	 * All subclass implementation {@link #refreshDefaults(DefaultsContext)} 
	 * should be preceded by a "super" call to this method
	 */
	public void addToMessages(List<IMessage> messages) {
	}
}

Back to the top