Avoid NPE for "mark occurences"
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / internal / registry / RefreshScopeVariableRegistry.java
1 package net.sourceforge.phpdt.externaltools.internal.registry;
2
3 /**********************************************************************
4 Copyright (c) 2002 IBM Corp. and others. All rights reserved.
5 This file is made available under the terms of the Common Public License v1.0
6 which accompanies this distribution, and is available at
7 http://www.eclipse.org/legal/cpl-v10.html
8
9 Contributors:
10 **********************************************************************/
11
12 import net.sourceforge.phpdt.externaltools.model.IExternalToolConstants;
13
14 import org.eclipse.core.runtime.IConfigurationElement;
15
16 /**
17  * Registry of all available refresh scope variables.
18  */
19 public class RefreshScopeVariableRegistry extends ExternalToolVariableRegistry {
20
21         /**
22          * Creates the registry and loads the variables.
23          */
24         public RefreshScopeVariableRegistry() {
25                 super(IExternalToolConstants.EXTENSION_POINT_REFRESH_VARIABLES);
26         }
27
28         /**
29          * Returns the refresh scope variable for the given tag
30          * or <code>null</code> if none.
31          */
32         public RefreshScopeVariable getRefreshVariable(String tag) {
33                 return (RefreshScopeVariable) findVariable(tag);
34         }
35         
36         /**
37          * Returns the list of refresh scope variables in the registry.
38          */
39         public RefreshScopeVariable[] getRefreshVariables() {
40                 RefreshScopeVariable[] results = new RefreshScopeVariable[getVariableCount()];
41                 copyVariables(results);
42                 return results;
43         }
44         
45         /* (non-Javadoc)
46          * Method declared on ExternalToolVariableRegistry.
47          */
48         protected ExternalToolVariable newVariable(String tag, String description, IConfigurationElement element) {
49                 return new RefreshScopeVariable(tag, description, element);
50         }
51 }