Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 167972 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/emf/validation/model/CategoryManager.java (-9 / +28 lines)
Lines 18-23 Link Here
18
18
19
import org.eclipse.core.runtime.IConfigurationElement;
19
import org.eclipse.core.runtime.IConfigurationElement;
20
import org.eclipse.core.runtime.Platform;
20
import org.eclipse.core.runtime.Platform;
21
import org.eclipse.emf.common.EMFPlugin;
21
import org.eclipse.emf.validation.internal.EMFModelValidationDebugOptions;
22
import org.eclipse.emf.validation.internal.EMFModelValidationDebugOptions;
22
import org.eclipse.emf.validation.internal.EMFModelValidationPlugin;
23
import org.eclipse.emf.validation.internal.EMFModelValidationPlugin;
23
import org.eclipse.emf.validation.internal.l10n.ValidationMessages;
24
import org.eclipse.emf.validation.internal.l10n.ValidationMessages;
Lines 229-248 Link Here
229
	 * point.
230
	 * point.
230
	 */
231
	 */
231
	private void loadCategories() {
232
	private void loadCategories() {
232
		IConfigurationElement[] elements = Platform.getExtensionRegistry().getExtensionPoint(
233
		IConfigurationElement[] elements = new IConfigurationElement[0];
234
        if (EMFPlugin.IS_ECLIPSE_RUNNING) {
235
            elements = Platform.getExtensionRegistry().getExtensionPoint(
233
				EMFModelValidationPlugin.getPluginId(),
236
				EMFModelValidationPlugin.getPluginId(),
234
				EMFModelValidationPlugin.CONSTRAINT_PROVIDERS_EXT_P_NAME)
237
				EMFModelValidationPlugin.CONSTRAINT_PROVIDERS_EXT_P_NAME)
235
					.getConfigurationElements();
238
					.getConfigurationElements();
236
		
239
        }
237
		for (int i = 0; i < elements.length; i++) {
240
		configureCategories(elements);
238
			IConfigurationElement next = elements[i];
239
			
240
			if (next.getName().equals(XmlConfig.E_CATEGORY)) {
241
				loadCategories(globalCategory, next);
242
			}
243
		}
244
	}
241
	}
245
	
242
	
243
    /**
244
     * <p>
245
     * Configures my categories from the Eclipse configuration
246
     * <code>elements</code>
247
     * </p>
248
     * <p>
249
     * <b>NOTE</b> that this method should only be called by the EMF Model
250
     * Validation Plug-in, not by any client code!
251
     * </p>
252
     * 
253
     * @param elements 
254
     */
255
    public void configureCategories(IConfigurationElement[] elements) {
256
        for (int i = 0; i < elements.length; i++) {
257
            IConfigurationElement next = elements[i];
258
            
259
            if (next.getName().equals(XmlConfig.E_CATEGORY)) {
260
                loadCategories(globalCategory, next);
261
            }
262
        }        
263
    }
264
	
246
	/**
265
	/**
247
	 * Loads subcategories of the specified <code>parent</code> category.
266
	 * Loads subcategories of the specified <code>parent</code> category.
248
	 * @param parent
267
	 * @param parent
(-)src/org/eclipse/emf/validation/preferences/EMFModelValidationPreferences.java (-1 / +2 lines)
Lines 14-19 Link Here
14
14
15
import org.eclipse.core.runtime.Preferences;
15
import org.eclipse.core.runtime.Preferences;
16
16
17
import org.eclipse.emf.common.EMFPlugin;
17
import org.eclipse.emf.validation.internal.EMFModelValidationPlugin;
18
import org.eclipse.emf.validation.internal.EMFModelValidationPlugin;
18
import org.eclipse.emf.validation.service.ConstraintRegistry;
19
import org.eclipse.emf.validation.service.ConstraintRegistry;
19
import org.eclipse.emf.validation.service.IConstraintDescriptor;
20
import org.eclipse.emf.validation.service.IConstraintDescriptor;
Lines 27-33 Link Here
27
	static final String CONSTRAINT_DISABLED_PREFIX = "con.disabled/"; //$NON-NLS-1$
28
	static final String CONSTRAINT_DISABLED_PREFIX = "con.disabled/"; //$NON-NLS-1$
28
	
29
	
29
	private static final Preferences prefs =
30
	private static final Preferences prefs =
30
		EMFModelValidationPlugin.getPlugin().getPluginPreferences();
31
		(!EMFPlugin.IS_ECLIPSE_RUNNING)?new Preferences():EMFModelValidationPlugin.getPlugin().getPluginPreferences();
31
	
32
	
32
	/**
33
	/**
33
	 * Not instantiable, as all features are static.
34
	 * Not instantiable, as all features are static.
(-)src/org/eclipse/emf/validation/internal/service/TraversalStrategyManager.java (-3 / +5 lines)
Lines 18-23 Link Here
18
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IConfigurationElement;
19
import org.eclipse.core.runtime.IConfigurationElement;
20
import org.eclipse.core.runtime.Platform;
20
import org.eclipse.core.runtime.Platform;
21
import org.eclipse.emf.common.EMFPlugin;
21
import org.eclipse.emf.ecore.EClass;
22
import org.eclipse.emf.ecore.EClass;
22
import org.eclipse.emf.ecore.EClassifier;
23
import org.eclipse.emf.ecore.EClassifier;
23
import org.eclipse.emf.ecore.EObject;
24
import org.eclipse.emf.ecore.EObject;
Lines 95-105 Link Here
95
	 * required by a validation operation.
96
	 * required by a validation operation.
96
	 */
97
	 */
97
	private void initStrategies() {
98
	private void initStrategies() {
98
		IConfigurationElement[] strats =
99
		IConfigurationElement[] strats = new IConfigurationElement[0];
99
			Platform.getExtensionRegistry().getConfigurationElementsFor(
100
		if (EMFPlugin.IS_ECLIPSE_RUNNING) {
101
			strats = Platform.getExtensionRegistry().getConfigurationElementsFor(
100
				EMFModelValidationPlugin.getPluginId(),
102
				EMFModelValidationPlugin.getPluginId(),
101
				TRAVERSAL_EXT_P_NAME);
103
				TRAVERSAL_EXT_P_NAME);
102
		
104
		}
103
		for (int i = 0; i < strats.length; i++) {
105
		for (int i = 0; i < strats.length; i++) {
104
			IConfigurationElement config = strats[i];
106
			IConfigurationElement config = strats[i];
105
			
107
			
(-)src/org/eclipse/emf/validation/internal/EMFModelValidationPlugin.java (-4 / +65 lines)
Lines 12-22 Link Here
12
12
13
package org.eclipse.emf.validation.internal;
13
package org.eclipse.emf.validation.internal;
14
14
15
import java.net.URL;
15
import java.util.Collection;
16
import java.util.Collection;
16
import java.util.HashMap;
17
import java.util.HashMap;
17
import java.util.Iterator;
18
import java.util.Iterator;
18
import java.util.Map;
19
import java.util.Map;
19
20
21
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.IConfigurationElement;
22
import org.eclipse.core.runtime.IConfigurationElement;
21
import org.eclipse.core.runtime.IStatus;
23
import org.eclipse.core.runtime.IStatus;
22
import org.eclipse.core.runtime.Platform;
24
import org.eclipse.core.runtime.Platform;
Lines 25-31 Link Here
25
import org.eclipse.emf.common.util.ResourceLocator;
27
import org.eclipse.emf.common.util.ResourceLocator;
26
import org.eclipse.emf.validation.internal.l10n.ValidationMessages;
28
import org.eclipse.emf.validation.internal.l10n.ValidationMessages;
27
import org.eclipse.emf.validation.internal.service.ClientContextManager;
29
import org.eclipse.emf.validation.internal.service.ClientContextManager;
30
import org.eclipse.emf.validation.internal.util.XmlConstraintFactory;
31
import org.eclipse.emf.validation.model.CategoryManager;
32
import org.eclipse.emf.validation.service.ConstraintFactory;
28
import org.eclipse.emf.validation.service.ModelValidationService;
33
import org.eclipse.emf.validation.service.ModelValidationService;
34
import org.eclipse.emf.validation.util.XmlConfig;
29
import org.eclipse.osgi.util.NLS;
35
import org.eclipse.osgi.util.NLS;
30
import org.osgi.framework.BundleContext;
36
import org.osgi.framework.BundleContext;
31
37
Lines 164-170 Link Here
164
		new EMFModelValidationPlugin();
170
		new EMFModelValidationPlugin();
165
171
166
	private static Implementation plugin;
172
	private static Implementation plugin;
167
173
    
174
    /**
175
     * Flag to track standalone configuration, that should happen once
176
     * to prevent multiple registration of constraint providers, parsers, 
177
     * etc. 
178
     */
179
    private boolean alreadyConfigured = false;
180
    
168
	/**
181
	/**
169
	 * Initializes me.
182
	 * Initializes me.
170
	 */
183
	 */
Lines 177-182 Link Here
177
		return plugin;
190
		return plugin;
178
	}
191
	}
179
192
193
    /**
194
     * Configures parsers, constraint providers, categories and constraint bindings
195
     * from the given XML document <code>urls</code> in standalone mode (no Eclipse).
196
     * <p>
197
     * At a minimum one URL should refer to the <code>org.eclipse.emf.validation</code> plugin descriptor. For example:
198
     * <pre>jar:file:///c:/mydir/lib/org.eclipse.emf.validation_1.0.1.v200609250852.jar!/plugin.xml</pre>
199
     * and another URL should refer to the user contributed constraint providers. For example:
200
     * <pre>file:///c:/mydir/plugin.xml</pre>
201
     * To enable support for OCL constraints, add a URL to the <code>org.eclipse.emf.validation.ocl</code> plugin descriptor. For example:
202
     * <pre>jar:file:///c:/mydir/lib/org.eclipse.emf.validation.ocl_1.0.1.v200609250852.jar!/plugin.xml</pre> 
203
     * 
204
     * @param urls the locations of the XML documents to use for standalone initialization. 
205
     * @throws CoreException on any problem parsing an XML file
206
     */
207
    public void configureStandalone(URL[] urls) throws CoreException {
208
        assert urls != null;
209
        if (!EMFPlugin.IS_ECLIPSE_RUNNING && !alreadyConfigured) {
210
            alreadyConfigured = true;
211
            for (int i=0; i < urls.length; i++) {
212
                IConfigurationElement element = XmlConfig.load(urls[i]);
213
                // Configure any defined parsers                
214
                IConfigurationElement[] parsers = 
215
                    XmlConfig.findExtensionPoint(getPluginId() + "." + XmlConstraintFactory.CONSTRAINT_PARSERS_EXT_P_NAME, element);
216
                if (parsers != null) { 
217
                    ((XmlConstraintFactory)ConstraintFactory.getInstance()).configureParsers(parsers);
218
                }
219
                // Configure any defined constraint providers and categories               
220
                IConfigurationElement[] providers = 
221
                    XmlConfig.findExtensionPoint(getPluginId() + "." + CONSTRAINT_PROVIDERS_EXT_P_NAME, element);
222
                if (providers != null) {
223
                    ModelValidationService.getInstance().configureProviders(providers);
224
                    CategoryManager.getInstance().configureCategories(providers);
225
                }
226
                // Configure any defined constraint bindings
227
                IConfigurationElement[] bindings = 
228
                    XmlConfig.findExtensionPoint(getPluginId() + "." + CONSTRAINT_BINDINGS_EXT_P_NAME, element);
229
                if (bindings != null) {
230
                    ClientContextManager.getInstance().configureConstraintBindings(bindings);
231
                }                
232
            }
233
        }
234
    }
235
180
	/**
236
	/**
181
	 * Obtains the Eclipse plug-in that I implement.
237
	 * Obtains the Eclipse plug-in that I implement.
182
	 * 
238
	 * 
Lines 192-200 Link Here
192
	 * @return my plug-in unique ID
248
	 * @return my plug-in unique ID
193
	 */
249
	 */
194
	public static String getPluginId() {
250
	public static String getPluginId() {
195
		return getPlugin().getBundle().getSymbolicName();
251
		if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
252
			return "org.eclipse.emf.validation";
253
		}
254
		else {
255
			return getPlugin().getBundle().getSymbolicName();
256
		}
196
	}
257
	}
197
258
    
198
	/**
259
	/**
199
	 * The definition of the Eclipse plug-in flavour of this EMF plug-in.
260
	 * The definition of the Eclipse plug-in flavour of this EMF plug-in.
200
	 * 
261
	 * 
Lines 274-280 Link Here
274
    	 * 
335
    	 * 
275
    	 */
336
    	 */
276
    	protected static boolean shouldTrace() {
337
    	protected static boolean shouldTrace() {
277
    		return plugin.isDebugging();
338
    		return (!EMFPlugin.IS_ECLIPSE_RUNNING)?false:plugin.isDebugging();
278
    	}
339
    	}
279
340
280
    	/**
341
    	/**
(-)src/org/eclipse/emf/validation/internal/util/ConstraintsContentHandler.java (+5 lines)
Lines 31-36 Link Here
31
import org.xml.sax.SAXParseException;
31
import org.xml.sax.SAXParseException;
32
import org.xml.sax.helpers.DefaultHandler;
32
import org.xml.sax.helpers.DefaultHandler;
33
33
34
import org.eclipse.emf.common.EMFPlugin;
34
import org.eclipse.emf.validation.internal.EMFModelValidationPlugin;
35
import org.eclipse.emf.validation.internal.EMFModelValidationPlugin;
35
import org.eclipse.emf.validation.internal.EMFModelValidationStatusCodes;
36
import org.eclipse.emf.validation.internal.EMFModelValidationStatusCodes;
36
37
Lines 524-529 Link Here
524
		if ((s == null) || !s.startsWith("%")) { //$NON-NLS-1$
525
		if ((s == null) || !s.startsWith("%")) { //$NON-NLS-1$
525
			return s;
526
			return s;
526
		} else if (resourceBundle == null) {
527
		} else if (resourceBundle == null) {
528
			// FIXME Localize in standalone mode           
529
            if (!EMFPlugin.IS_ECLIPSE_RUNNING) {                
530
                return s;               
531
            }            
527
			return Platform.getResourceString(
532
			return Platform.getResourceString(
528
					Platform.getBundle(extension.getNamespaceIdentifier()),
533
					Platform.getBundle(extension.getNamespaceIdentifier()),
529
					s);
534
					s);
(-)src/org/eclipse/emf/validation/internal/util/Log.java (-3 / +23 lines)
Lines 17-22 Link Here
17
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.Status;
18
import org.eclipse.core.runtime.Status;
19
19
20
import org.eclipse.emf.common.EMFPlugin;
20
import org.eclipse.emf.validation.internal.EMFModelValidationPlugin;
21
import org.eclipse.emf.validation.internal.EMFModelValidationPlugin;
21
22
22
/**
23
/**
Lines 142-149 Link Here
142
		
143
		
143
		Status s = new Status(severity, EMFModelValidationPlugin.getPluginId(),
144
		Status s = new Status(severity, EMFModelValidationPlugin.getPluginId(),
144
			code, message, throwable);
145
			code, message, throwable);
145
146
		if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
146
		EMFModelValidationPlugin.getPlugin().log(s);
147
			if (s.isOK()) {
148
				System.out.println(s);
149
			}
150
			else {
151
				System.err.println(s);
152
			}			
153
		}
154
		else {
155
			EMFModelValidationPlugin.getPlugin().log(s);
156
		}
147
	}
157
	}
148
158
149
	/**
159
	/**
Lines 155-161 Link Here
155
	 * @param status The status object on which to base the log.
165
	 * @param status The status object on which to base the log.
156
	 */
166
	 */
157
	public static void log(IStatus status) {
167
	public static void log(IStatus status) {
158
		EMFModelValidationPlugin.getPlugin().log(status);
168
		if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
169
			if (status.isOK()) {
170
				System.out.println(status);
171
			}
172
			else {
173
				System.err.println(status);
174
			}						
175
		}
176
		else {
177
			EMFModelValidationPlugin.getPlugin().log(status);
178
		}
159
	}
179
	}
160
180
161
	/**
181
	/**
(-)src/org/eclipse/emf/validation/internal/util/XmlConfigurationElement.java (-12 / +19 lines)
Lines 92-114 Link Here
92
	 */
92
	 */
93
	public Object createExecutableExtension(String propertyName)
93
	public Object createExecutableExtension(String propertyName)
94
			throws CoreException {
94
			throws CoreException {
95
		
95
        Object result = null;
96
		String message = EMFModelValidationPlugin.getMessage(
96
	    String className = getAttribute(propertyName);
97
        try {
98
            Class clazz = this.getClass().getClassLoader().loadClass(className);
99
            result = clazz.newInstance();
100
        }
101
        catch (Exception ex) {
102
			String message = EMFModelValidationPlugin.getMessage(
97
				EMFModelValidationStatusCodes.XML_CREATE_EXTENSION_MSG,
103
				EMFModelValidationStatusCodes.XML_CREATE_EXTENSION_MSG,
98
				new Object[] {getName()});
104
				new Object[] {getName()});
99
		
105
		
100
		CoreException ce = new CoreException(
106
			CoreException ce = new CoreException(
101
				new Status(
107
				new Status(
102
						IStatus.ERROR,
108
					IStatus.ERROR,
103
						EMFModelValidationPlugin.getPluginId(),
109
					EMFModelValidationPlugin.getPluginId(),
104
						EMFModelValidationStatusCodes.ERROR_PARSING_XML,
110
					EMFModelValidationStatusCodes.ERROR_PARSING_XML,
105
						message,
111
					message,
106
						null));
112
					ex));		
107
		
113
			Trace.throwing(getClass(), "createExecutableExtension", ce); //$NON-NLS-1$
108
		Trace.throwing(getClass(), "createExecutableExtension", ce); //$NON-NLS-1$
114
			throw ce;        
109
		throw ce;
115
        }
116
        return result;
110
	}
117
	}
111
118
	
112
	// implements the interface method
119
	// implements the interface method
113
	public String getAttribute(String name) {
120
	public String getAttribute(String name) {
114
		return (String)attributes.get(name);
121
		return (String)attributes.get(name);
(-)src/org/eclipse/emf/validation/internal/util/JavaConstraintParser.java (-2 / +7 lines)
Lines 133-140 Link Here
133
			.getNamespaceIdentifier());
133
			.getNamespaceIdentifier());
134
		
134
		
135
		try {
135
		try {
136
			Class resultType = bundle.loadClass(className);
136
            Class resultType = null;
137
137
            if (bundle == null) {
138
                resultType = this.getClass().getClassLoader().loadClass(className);
139
            }
140
            else {
141
                resultType = bundle.loadClass(className);
142
            }
138
			if (AbstractModelConstraint.class.isAssignableFrom(resultType)) {
143
			if (AbstractModelConstraint.class.isAssignableFrom(resultType)) {
139
				// instantiate the class extending AbstractModelConstraint
144
				// instantiate the class extending AbstractModelConstraint
140
				result = new ConstraintAdapter(
145
				result = new ConstraintAdapter(
(-)src/org/eclipse/emf/validation/internal/util/XmlConstraintFactory.java (-4 / +11 lines)
Lines 39-45 Link Here
39
	/**
39
	/**
40
	 * Extension point name for the model providers extension point.
40
	 * Extension point name for the model providers extension point.
41
	 */
41
	 */
42
	private static final String CONSTRAINT_PARSERS_EXT_P_NAME =
42
	public static final String CONSTRAINT_PARSERS_EXT_P_NAME =
43
			"constraintParsers"; //$NON-NLS-1$
43
			"constraintParsers"; //$NON-NLS-1$
44
44
45
	/** Mapping of language names to parser implementations. */
45
	/** Mapping of language names to parser implementations. */
Lines 85-90 Link Here
85
			return new DisabledConstraint(desc, e);
85
			return new DisabledConstraint(desc, e);
86
		}
86
		}
87
	}
87
	}
88
    
89
    public void configureParsers(IConfigurationElement[] elements) {
90
        for (int i = 0; i < elements.length; i++) {
91
            registerParser(elements[i]);
92
        }
93
    }
88
94
89
	/**
95
	/**
90
	 * Registers a parser implementation against the language that it provides.
96
	 * Registers a parser implementation against the language that it provides.
Lines 141-151 Link Here
141
	 * extension point.
147
	 * extension point.
142
	 */
148
	 */
143
	private void initializeParsers() {
149
	private void initializeParsers() {
144
		IConfigurationElement[] configs = 
150
		IConfigurationElement[] configs = new IConfigurationElement[0];
145
			Platform.getExtensionRegistry().getConfigurationElementsFor(
151
        if (Platform.getExtensionRegistry() != null) {
152
			configs = Platform.getExtensionRegistry().getConfigurationElementsFor(
146
				EMFModelValidationPlugin.getPluginId(),
153
				EMFModelValidationPlugin.getPluginId(),
147
				CONSTRAINT_PARSERS_EXT_P_NAME);
154
				CONSTRAINT_PARSERS_EXT_P_NAME);
148
155
        }
149
		for (int i = 0; i < configs.length; i++) {
156
		for (int i = 0; i < configs.length; i++) {
150
			IConfigurationElement config = configs[i];
157
			IConfigurationElement config = configs[i];
151
158
(-)src/org/eclipse/emf/validation/util/XmlConfig.java (+181 lines)
Lines 20-26 Link Here
20
20
21
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.IConfigurationElement;
22
import org.eclipse.core.runtime.IConfigurationElement;
23
import org.eclipse.core.runtime.IContributor;
24
import org.eclipse.core.runtime.IExtension;
25
import org.eclipse.core.runtime.IPluginDescriptor;
23
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.core.runtime.IStatus;
27
import org.eclipse.core.runtime.InvalidRegistryObjectException;
24
import org.eclipse.core.runtime.Platform;
28
import org.eclipse.core.runtime.Platform;
25
import org.eclipse.core.runtime.Status;
29
import org.eclipse.core.runtime.Status;
26
import org.eclipse.emf.validation.internal.EMFModelValidationDebugOptions;
30
import org.eclipse.emf.validation.internal.EMFModelValidationDebugOptions;
Lines 348-353 Link Here
348
				element.getDeclaringExtension().getNamespaceIdentifier()).getEntry("/"); //$NON-NLS-1$
352
				element.getDeclaringExtension().getNamespaceIdentifier()).getEntry("/"); //$NON-NLS-1$
349
		}
353
		}
350
	}
354
	}
355
    
356
    /**
357
     * Loads a configuration element from the specified <code>url</code>
358
     * 
359
     * @param url the location of the XML document
360
     * @return the configuration element representing the XML document
361
     * @throws CoreException on any problem parsing an XML file
362
     * @see #load(IConfigurationElement, URL)
363
     */
364
    public static IConfigurationElement load(URL url) 
365
        throws CoreException {
366
            return load(new DummyConfigurationElement(), url);
367
    }
351
368
352
	/**
369
	/**
353
	 * Loads a <tt>&lt;constraints&gt;</tt> element from the specified
370
	 * Loads a <tt>&lt;constraints&gt;</tt> element from the specified
Lines 414-417 Link Here
414
	public static void flushResourceBundles() {
431
	public static void flushResourceBundles() {
415
		ConstraintsContentHandler.flushResourceBundleCache();
432
		ConstraintsContentHandler.flushResourceBundleCache();
416
	}
433
	}
434
    
435
    /**
436
     * Returns the children of the configuration element that matches the given
437
     * <code>extensionPoint</code>, searches recursively the given parent element. 
438
     *  
439
     * @param extensionPoint The name of the extension point to match
440
     * @param parent The top level configuration element to search 
441
     * @return the matching configuration element children or null if not found
442
     */
443
    public static IConfigurationElement[] findExtensionPoint(String extensionPoint, IConfigurationElement parent) {
444
        if (parent.getAttribute("point") != null && parent.getAttribute("point").equals(extensionPoint)) {
445
            return parent.getChildren();
446
        }
447
        else {
448
            // Recurse
449
            IConfigurationElement[] children = parent.getChildren();
450
            if (children != null) {
451
                for(IConfigurationElement child: children) {
452
                    IConfigurationElement[] result = findExtensionPoint(extensionPoint, child);
453
                    if (result != null) {
454
                        return result;
455
                    }
456
                } 
457
            }
458
        }
459
        return null;
460
    }
461
    
462
    // Inner classes
463
464
    /**
465
     * A mock configuration element used to supply a valid extension namespace identifier  
466
     * <p>
467
     * This class is not intended to be used outside of the validation framework.
468
     * </p>
469
     * @see XmlConfig#load(URL)
470
     */
471
    private static class DummyConfigurationElement implements IConfigurationElement {
472
        
473
        IExtension dummyExtension = new DummyExtension("org.eclipse.emf.validation.internal");
474
        
475
        public IExtension getDeclaringExtension() throws InvalidRegistryObjectException {
476
            return dummyExtension;
477
        }
478
        
479
        // Unused Methods
480
        
481
        public Object createExecutableExtension(String propertyName) throws CoreException {
482
            return null;
483
        }
484
485
        public String getAttribute(String name) throws InvalidRegistryObjectException {
486
            return null;
487
        }
488
489
        public String getAttributeAsIs(String name) throws InvalidRegistryObjectException {
490
            return null;
491
        }
492
493
        public String[] getAttributeNames() throws InvalidRegistryObjectException {
494
            return null;
495
        }
496
497
        public IConfigurationElement[] getChildren() throws InvalidRegistryObjectException {
498
            return null;
499
        }
500
501
        public IConfigurationElement[] getChildren(String name) throws InvalidRegistryObjectException {
502
            return null;
503
        }
504
505
        public IContributor getContributor() throws InvalidRegistryObjectException {
506
            return null;
507
        }
508
509
        public String getName() throws InvalidRegistryObjectException {
510
            return null;
511
        }
512
513
        public String getNamespace() throws InvalidRegistryObjectException {
514
            return null;
515
        }
516
517
        public String getNamespaceIdentifier() throws InvalidRegistryObjectException {
518
            return null;
519
        }
520
521
        public Object getParent() throws InvalidRegistryObjectException {
522
            return null;
523
        }
524
525
        public String getValue() throws InvalidRegistryObjectException {
526
            return null;
527
        }
528
529
        public String getValueAsIs() throws InvalidRegistryObjectException {
530
            return null;
531
        }
532
533
        public boolean isValid() {
534
            return false;
535
        }
536
        
537
    }
538
539
    /**
540
     * A mock extension used to supply a valid namespace identifier  
541
     * <p>
542
     * This class is not intended to be used outside of the validation framework.
543
     * </p>
544
     * @see XmlConfig#load(URL)
545
     */
546
    private static class DummyExtension implements IExtension {
547
        
548
        String namespaceIndentifier = null;
549
        
550
        public DummyExtension(String namespaceIdentifier) {
551
            this.namespaceIndentifier = namespaceIdentifier;
552
        }
553
554
        public String getNamespaceIdentifier() throws InvalidRegistryObjectException {
555
            return namespaceIndentifier;
556
        }
557
        
558
        // Unused Methods 
559
        
560
        public IConfigurationElement[] getConfigurationElements() throws InvalidRegistryObjectException {
561
            return null;
562
        }
563
564
        public IContributor getContributor() throws InvalidRegistryObjectException {
565
            return null;
566
        }
567
568
        public IPluginDescriptor getDeclaringPluginDescriptor() throws InvalidRegistryObjectException {
569
            return null;
570
        }
571
572
        public String getExtensionPointUniqueIdentifier() throws InvalidRegistryObjectException {
573
            return null;
574
        }
575
576
        public String getLabel() throws InvalidRegistryObjectException {
577
            return null;
578
        }
579
580
        public String getNamespace() throws InvalidRegistryObjectException {
581
            return null;
582
        }
583
584
        public String getSimpleIdentifier() throws InvalidRegistryObjectException {
585
            return null;
586
        }
587
588
        public String getUniqueIdentifier() throws InvalidRegistryObjectException {
589
            return null;
590
        }
591
592
        public boolean isValid() {
593
            return false;
594
        }
595
        
596
    }
597
    
417
}
598
}
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 22-27 Link Here
22
 g.eclipse.emf.validation.marker,org.eclipse.emf.validation.model,org.
22
 g.eclipse.emf.validation.marker,org.eclipse.emf.validation.model,org.
23
 eclipse.emf.validation.preferences,org.eclipse.emf.validation.service
23
 eclipse.emf.validation.preferences,org.eclipse.emf.validation.service
24
 ,org.eclipse.emf.validation.util,org.eclipse.emf.validation.xml
24
 ,org.eclipse.emf.validation.util,org.eclipse.emf.validation.xml
25
Bundle-Version: 1.0.1.v200609250852
25
Bundle-Version: 1.0.1.v200609250852a
26
Eclipse-LazyStart: true
26
Eclipse-LazyStart: true
27
27

Return to bug 167972