blob: a096f6236b83bb8ff671277655d9903cc7225fb2 (
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
76
77
78
79
80
81
|
/*******************************************************************************
* Copyright (c) 2008 Oracle Corporation.
* 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:
* Cameron Bateman - initial API and implementation
*******************************************************************************/
package org.eclipse.jst.jsf.facelet.core.internal.registry.taglib;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jem.internal.proxy.core.ICallbackRegistry;
import org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry;
import org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin;
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.faceletTaglib.FaceletLibraryClassTagLib;
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.faceletTaglib.FaceletTaglibDefn;
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.faceletTaglib.FaceletXMLDefnTaglib;
/*package*/class TagRecordFactory
{
private final ProxyFactoryRegistry _registry;
private final IProject _project;
public TagRecordFactory(final IProject project,
final ProxyFactoryRegistry registry)
{
_registry = registry;
_project = project;
}
public IFaceletTagRecord createRecords(final FaceletTaglibDefn taglibDefn)
{
IFaceletTagRecord retValue = null;
if (taglibDefn instanceof FaceletLibraryClassTagLib)
{
if (_registry != NULL_REGISTRY)
{
final LibraryClassBasedTagRecord record = new LibraryClassBasedTagRecord(
_registry, (FaceletLibraryClassTagLib) taglibDefn, _project);
try
{
record.initURI();
retValue = record;
}
catch (CoreException e)
{
FaceletCorePlugin.log("While creating record: "+record, e); //$NON-NLS-1$
}
}
}
else if (taglibDefn instanceof FaceletXMLDefnTaglib)
{
final XMLBasedTagRecord record = new XMLBasedTagRecord(
(FaceletXMLDefnTaglib) taglibDefn);
retValue = record;
}
return retValue;
}
private final static NullProxyFactoryRegistry NULL_REGISTRY = new NullProxyFactoryRegistry();
private static class NullProxyFactoryRegistry extends ProxyFactoryRegistry
{
@Override
public ICallbackRegistry getCallbackRegistry()
{
throw new UnsupportedOperationException("This is null proxy"); //$NON-NLS-1$
}
@Override
protected void registryTerminated(final boolean wait)
{
throw new UnsupportedOperationException("This is null proxy"); //$NON-NLS-1$
}
}
}
|