Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 0dafb31578aad8003f2fc1855a10d34e1103e858 (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) 2009 IBM 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.jst.j2ee.internal.ui.preferences;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jem.util.RegistryReader;



public class JavaEEPreferencePageExtensionReader extends RegistryReader {

	private static JavaEEPreferencePageExtensionReader instance = null;
	private List<JavaEEPreferencePageExtension> pageExtenders = null;
	
	public JavaEEPreferencePageExtensionReader(){
		super("org.eclipse.jst.j2ee.ui", "JavaEEPreferencePageExtender"); //$NON-NLS-1$ //$NON-NLS-2$ 
	}
	

	public static JavaEEPreferencePageExtensionReader getInstance() {
		if (instance == null) {
			instance = new JavaEEPreferencePageExtensionReader();
			instance.readRegistry();
		}
		return instance;
	}
	
	@Override
	public boolean readElement(IConfigurationElement element) {
		if (JavaEEPreferencePageExtension.JAVAEE_PAGE_EXTENSION.equals(element.getName())) {
			addExtension(element);
			return true;
		}
		return false;
	}
	
	protected void addExtension(IConfigurationElement newExtension) {
		getJavaEEPageExtenders().add(new JavaEEPreferencePageExtension(newExtension));
	}
	
	public List<JavaEEPreferencePageExtension> getJavaEEPageExtenders() {
		if (pageExtenders == null)
			pageExtenders = new ArrayList();
		return pageExtenders;
	}	

}

Back to the top