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 251798
Collapse All | Expand All

(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 12-18 Link Here
12
 org.eclipse.wst.common.frameworks;bundle-version="1.1.102",
12
 org.eclipse.wst.common.frameworks;bundle-version="1.1.102",
13
 org.eclipse.jst.jsf.common.runtime,
13
 org.eclipse.jst.jsf.common.runtime,
14
 org.eclipse.jst.jsf.core,
14
 org.eclipse.jst.jsf.core,
15
 org.eclipse.jst.jsf.common;bundle-version="1.0.1",
15
 org.eclipse.jst.jsf.common;bundle-version="1.0.1";visibility:=reexport,
16
 org.eclipse.jface.text;bundle-version="3.4.0",
16
 org.eclipse.jface.text;bundle-version="3.4.0",
17
 org.eclipse.wst.sse.core;bundle-version="1.1.300",
17
 org.eclipse.wst.sse.core;bundle-version="1.1.300",
18
 org.eclipse.wst.html.core;bundle-version="1.1.200",
18
 org.eclipse.wst.html.core;bundle-version="1.1.200",
(-)src/org/eclipse/jst/jsf/facelet/core/internal/FaceletCorePlugin.java (-1 / +1 lines)
Lines 108-114 Link Here
108
    public static void log(final String string, final Throwable exception)
108
    public static void log(final String string, final Throwable exception)
109
    {
109
    {
110
        final IStatus status = new Status(IStatus.ERROR, PLUGIN_ID,
110
        final IStatus status = new Status(IStatus.ERROR, PLUGIN_ID,
111
                "Exception logged", exception); //$NON-NLS-1$
111
                string, exception);
112
        getDefault().getLog().log(status);
112
        getDefault().getLog().log(status);
113
    }
113
    }
114
114
(-)src/org/eclipse/jst/jsf/facelet/core/internal/cm/strategy/TagInfoStrategyComposite.java (-1 / +1 lines)
Lines 26-32 Link Here
26
 */
26
 */
27
public class TagInfoStrategyComposite
27
public class TagInfoStrategyComposite
28
        extends
28
        extends
29
        IteratorPolicyBasedStrategyComposite<TagIdentifier, ExternalTagInfo, String, IExternalMetadataStrategy>
29
        IteratorPolicyBasedStrategyComposite<TagIdentifier, ExternalTagInfo, ExternalTagInfo, String, IExternalMetadataStrategy>
30
{
30
{
31
    private final Iterable<String> _policyOrder;
31
    private final Iterable<String> _policyOrder;
32
32
(-)src/org/eclipse/jst/jsf/facelet/core/internal/facet/FaceletChangeDelegate.java (-3 / +4 lines)
Lines 50-63 Link Here
50
            {
50
            {
51
                final FacetChangeModel model = (FacetChangeModel) config;
51
                final FacetChangeModel model = (FacetChangeModel) config;
52
52
53
                // XXX: look at glassfish changes
53
                handleDesignTimeViewHandler(project);
54
                handleDesignTimeViewHandler(project);
54
55
55
                if (model.isChgViewHandler())
56
                if (model.isChgViewHandler())
56
                {
57
                {
57
                    maybeChangeFaceletViewHandler(project, monitor);
58
                    maybeChangeFaceletViewHandler(project, monitor);
58
                }
59
				}
59
60
				
60
                final WebAppConfigurator configurator = WebAppConfigurator
61
				final WebAppConfigurator configurator = WebAppConfigurator
61
                        .getConfigurator(project);
62
                        .getConfigurator(project);
62
63
63
                if (configurator != null)
64
                if (configurator != null)
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/FaceletTagRegistry.java (-1 / +1 lines)
Lines 279-285 Link Here
279
    private class MyTaglibListener extends Listener
279
    private class MyTaglibListener extends Listener
280
    {
280
    {
281
        @Override
281
        @Override
282
        public void tagLibChanged(TaglibChangedEvent event)
282
        public void changed(TaglibChangedEvent event)
283
        {
283
        {
284
            switch (event.getChangeType())
284
            switch (event.getChangeType())
285
            {
285
            {
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/AbstractFaceletTaglibLocator.java (-25 / +42 lines)
Lines 11-17 Link Here
11
package org.eclipse.jst.jsf.facelet.core.internal.registry.taglib;
11
package org.eclipse.jst.jsf.facelet.core.internal.registry.taglib;
12
12
13
import java.util.Map;
13
import java.util.Map;
14
import java.util.concurrent.CopyOnWriteArrayList;
14
15
import org.eclipse.core.resources.IProject;
16
import org.eclipse.jst.jsf.common.internal.locator.AbstractLocator;
17
import org.eclipse.jst.jsf.common.internal.locator.ILocatorChangeListener;
18
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.Listener.TaglibChangedEvent;
15
19
16
/**
20
/**
17
 * Parent of all locators of facelet taglibs.
21
 * Parent of all locators of facelet taglibs.
Lines 20-67 Link Here
20
 * 
24
 * 
21
 */
25
 */
22
public abstract class AbstractFaceletTaglibLocator
26
public abstract class AbstractFaceletTaglibLocator
27
        extends
28
        AbstractLocator<Map<String, ? extends IFaceletTagRecord>, IProject, String>
29
        implements IFaceletTaglibLocator
23
{
30
{
24
    private final CopyOnWriteArrayList<Listener>        _listeners = new CopyOnWriteArrayList<Listener>();
31
    /**
32
     * @param id
33
     * @param displayName
34
     */
35
    public AbstractFaceletTaglibLocator(final String id,
36
            final String displayName)
37
    {
38
        super(id, displayName);
39
        // new MapMergingCompositionStrategy
40
        // <IProject, Map<String, IFaceletTagRecord>, Map<String,
41
        // IFaceletTagRecord>,
42
        // ILocator<Map<String, IFaceletTagRecord>, IProject, String>>
43
        // (new HashMap<String, IFaceletTagRecord>(), Collections.EMPTY_MAP)
44
    }
25
45
26
    /**
46
    /**
27
     * @return a list of all tag libraries known to this locator
47
     * @return a list of all tag libraries known to this locator
28
     */
48
     */
29
    public abstract Map<String, ? extends IFaceletTagRecord> locate();
49
    @Override
50
    protected abstract Map<String, ? extends IFaceletTagRecord> doLocate(
51
            IProject context);
30
52
31
    /**
53
    /**
32
     * @param listener
54
     * Listener argument must be of type Listener.
55
     * 
56
     * @see org.eclipse.jst.jsf.common.internal.locator.AbstractLocator#addListener(org.eclipse.jst.jsf.common.internal.locator.ILocatorChangeListener)
33
     */
57
     */
34
    public void addListener(final Listener listener)
58
    @Override
59
    public void addListener(final ILocatorChangeListener listener)
35
    {
60
    {
36
        _listeners.addIfAbsent(listener);
61
        if (!(listener instanceof Listener))
62
        {
63
            throw new IllegalArgumentException();
64
        }
65
        super.addListener(listener);
37
    }
66
    }
38
    
67
39
    /**
68
    /**
40
     * @param listener
69
     * @param listener
41
     */
70
     */
42
    public void removeListener(final Listener listener)
71
    public void addListener(final Listener listener)
43
    {
72
    {
44
        _listeners.remove(listener);
73
        super.addListener(listener);
45
    }
74
    }
46
75
47
    /**
76
    /**
77
     * @param taglibChangedEvent
48
     */
78
     */
49
    public abstract void startLocating();
79
    protected void fireChangeEvent(final TaglibChangedEvent taglibChangedEvent)
50
51
    /**
52
     * 
53
     */
54
    public abstract void stopLocating();
55
56
    /**
57
     * @param event
58
     */
59
    protected final void fireEvent(final Listener.TaglibChangedEvent event)
60
    {
80
    {
61
        for (final Listener listener : _listeners)
81
        super.fireChangeEvent(taglibChangedEvent);
62
        {
63
            listener.tagLibChanged(event);
64
        }
65
    }
82
    }
66
    
83
67
}
84
}
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/ContextParamSpecifiedFaceletTaglibLocator.java (-10 / +12 lines)
Lines 51-56 Link Here
51
/* package */class ContextParamSpecifiedFaceletTaglibLocator extends
51
/* package */class ContextParamSpecifiedFaceletTaglibLocator extends
52
        AbstractFaceletTaglibLocator
52
        AbstractFaceletTaglibLocator
53
{
53
{
54
    private static final String ID = ContextParamSpecifiedFaceletTaglibLocator.class.getCanonicalName();
55
    private static final String DISPLAYNAME = Messages.ContextParamSpecifiedFaceletTaglibLocator_0;
54
    private final IProject                       _project;
56
    private final IProject                       _project;
55
    private final Map<String, IFaceletTagRecord> _records;
57
    private final Map<String, IFaceletTagRecord> _records;
56
    private final TagRecordFactory               _factory;
58
    private final TagRecordFactory               _factory;
Lines 59-64 Link Here
59
    public ContextParamSpecifiedFaceletTaglibLocator(final IProject project,
61
    public ContextParamSpecifiedFaceletTaglibLocator(final IProject project,
60
            final TagRecordFactory factory)
62
            final TagRecordFactory factory)
61
    {
63
    {
64
        super(ID, DISPLAYNAME);
62
        _project = project;
65
        _project = project;
63
        _records = new HashMap<String, IFaceletTagRecord>();
66
        _records = new HashMap<String, IFaceletTagRecord>();
64
        _factory = factory;
67
        _factory = factory;
Lines 73-81 Link Here
73
     * startLocating()
76
     * startLocating()
74
     */
77
     */
75
    @Override
78
    @Override
76
    public void startLocating()
79
    public void start(final IProject project)
77
    {
80
    {
78
        _fileManager.initFiles();
81
        _fileManager.initFiles();
82
        super.start(project);
79
    }
83
    }
80
84
81
    /*
85
    /*
Lines 85-99 Link Here
85
     * stopLocating()
89
     * stopLocating()
86
     */
90
     */
87
    @Override
91
    @Override
88
    public void stopLocating()
92
    public void stop()
89
    {
93
    {
90
91
        _fileManager.dispose();
94
        _fileManager.dispose();
92
    }
95
    }
93
96
94
97
95
    @Override
98
    @Override
96
    public Map<String, ? extends IFaceletTagRecord> locate()
99
    protected Map<String, ? extends IFaceletTagRecord> doLocate(IProject context)
97
    {
100
    {
98
        return findInWebRoot();
101
        return findInWebRoot();
99
    }
102
    }
Lines 325-339 Link Here
325
        @Override
328
        @Override
326
        public void checkpoint()
329
        public void checkpoint()
327
        {
330
        {
328
            // TODO Auto-generated method stub
331
            // nothing currently persisted
329
332
330
        }
333
        }
331
334
332
        @Override
335
        @Override
333
        public void destroy()
336
        public void destroy()
334
        {
337
        {
335
            // TODO Auto-generated method stub
338
            // nothing currently persisted
336
337
        }
339
        }
338
340
339
        @Override
341
        @Override
Lines 398-404 Link Here
398
                    tracker.setUri(tagRecord.getURI());
400
                    tracker.setUri(tagRecord.getURI());
399
                }
401
                }
400
402
401
                fireEvent(new TaglibChangedEvent(
403
                fireChangeEvent(new TaglibChangedEvent(
402
                        ContextParamSpecifiedFaceletTaglibLocator.this, null,
404
                        ContextParamSpecifiedFaceletTaglibLocator.this, null,
403
                        tagRecord, CHANGE_TYPE.ADDED));
405
                        tagRecord, CHANGE_TYPE.ADDED));
404
            }
406
            }
Lines 407-413 Link Here
407
        public void removed(final String uri, final IFile file)
409
        public void removed(final String uri, final IFile file)
408
        {
410
        {
409
            final IFaceletTagRecord tagRecord = _records.remove(uri);
411
            final IFaceletTagRecord tagRecord = _records.remove(uri);
410
            fireEvent(new TaglibChangedEvent(
412
            fireChangeEvent(new TaglibChangedEvent(
411
                    ContextParamSpecifiedFaceletTaglibLocator.this, tagRecord,
413
                    ContextParamSpecifiedFaceletTaglibLocator.this, tagRecord,
412
                    null, CHANGE_TYPE.REMOVED));
414
                    null, CHANGE_TYPE.REMOVED));
413
        }
415
        }
Lines 419-425 Link Here
419
            if (newValue != null)
421
            if (newValue != null)
420
            {
422
            {
421
                _records.put(uri, newValue);
423
                _records.put(uri, newValue);
422
                fireEvent(new TaglibChangedEvent(
424
                fireChangeEvent(new TaglibChangedEvent(
423
                        ContextParamSpecifiedFaceletTaglibLocator.this,
425
                        ContextParamSpecifiedFaceletTaglibLocator.this,
424
                        oldValue, newValue, CHANGE_TYPE.CHANGED));
426
                        oldValue, newValue, CHANGE_TYPE.CHANGED));
425
            }
427
            }
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/IFaceletTaglibLocator.java (+18 lines)
Added Link Here
1
package org.eclipse.jst.jsf.facelet.core.internal.registry.taglib;
2
3
import java.util.Map;
4
5
import org.eclipse.core.resources.IProject;
6
import org.eclipse.jst.jsf.common.internal.locator.ILocator;
7
8
/**
9
 * A locator that returns a name-keyed map of facelet tag records for a particular
10
 * project.
11
 * 
12
 * @author cbateman
13
 *
14
 */
15
public interface IFaceletTaglibLocator extends ILocator<Map<String, ? extends IFaceletTagRecord>, IProject, String>
16
{
17
    // do nothing
18
}
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/JarFileFaceletTaglibLocator.java (-104 / +115 lines)
Lines 20-25 Link Here
20
import java.util.Map;
20
import java.util.Map;
21
import java.util.jar.JarEntry;
21
import java.util.jar.JarEntry;
22
import java.util.jar.JarFile;
22
import java.util.jar.JarFile;
23
import java.util.regex.Pattern;
23
24
24
import javax.xml.parsers.ParserConfigurationException;
25
import javax.xml.parsers.ParserConfigurationException;
25
26
Lines 31-36 Link Here
31
import org.eclipse.jdt.core.IJavaProject;
32
import org.eclipse.jdt.core.IJavaProject;
32
import org.eclipse.jdt.core.JavaCore;
33
import org.eclipse.jdt.core.JavaCore;
33
import org.eclipse.jdt.core.JavaModelException;
34
import org.eclipse.jdt.core.JavaModelException;
35
import org.eclipse.jst.jsf.common.internal.strategy.SimpleStrategyComposite;
34
import org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin;
36
import org.eclipse.jst.jsf.facelet.core.internal.FaceletCorePlugin;
35
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.faceletTaglib.FaceletTaglibDefn;
37
import org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.faceletTaglib.FaceletTaglibDefn;
36
import org.xml.sax.SAXException;
38
import org.xml.sax.SAXException;
Lines 41-81 Link Here
41
 * @author cbateman
43
 * @author cbateman
42
 * 
44
 * 
43
 */
45
 */
44
/* package */class JarFileFaceletTaglibLocator extends
46
public class JarFileFaceletTaglibLocator extends AbstractFaceletTaglibLocator
45
        AbstractFaceletTaglibLocator
46
{
47
{
48
    /**
49
     * Default taglib finder that looks in meta-inf
50
     */
51
    public static final TaglibJarEntryFinder _taglibMetaInfFinder = new TaglibJarEntryFinder(
52
            Pattern.compile("META-INF/.*\\.taglib\\.xml")); //$NON-NLS-1$
53
    /**
54
     * Default finder that looks in the glassfish package.
55
     */
56
    public static final TaglibJarEntryFinder _taglibGlassfishFinder = new TaglibJarEntryFinder(
57
            Pattern.compile("com/sun/faces/metadata/taglib/.*\\.taglib\\.xml")); //$NON-NLS-1$
47
58
48
    private final IProject                 _project;
59
    private static final String DISPLAYNAME = Messages.JarFileFaceletTaglibLocator_0;
49
    private final TagRecordFactory         _factory;
60
    private static final String ID = JarFileFaceletTaglibLocator.class
61
            .getCanonicalName();
62
    private final TagRecordFactory _factory;
50
    private Map<String, IFaceletTagRecord> _records;
63
    private Map<String, IFaceletTagRecord> _records;
64
    private final SimpleStrategyComposite<JarEntry, JarEntry, JarEntry, String, TaglibFinder<JarEntry, JarEntry>> _finder;
51
65
52
    public JarFileFaceletTaglibLocator(final IProject project,
66
    /**
53
            final TagRecordFactory factory)
67
     * @param factory
68
     */
69
    public JarFileFaceletTaglibLocator(final TagRecordFactory factory)
54
    {
70
    {
55
        _project = project;
71
        super(ID, DISPLAYNAME);
56
        _factory = factory;
72
        _factory = factory;
57
        _records = new HashMap<String, IFaceletTagRecord>();
73
        _records = new HashMap<String, IFaceletTagRecord>();
74
75
        List<TaglibFinder<JarEntry, JarEntry>> finders = new ArrayList<TaglibFinder<JarEntry, JarEntry>>();
76
        finders.add(_taglibMetaInfFinder);
77
        finders.add(_taglibGlassfishFinder);
78
79
        _finder = new SimpleStrategyComposite<JarEntry, JarEntry, JarEntry, String, TaglibFinder<JarEntry, JarEntry>>(
80
                finders);
81
58
    }
82
    }
59
83
60
    @Override
84
    @Override
61
    public Map<String, ? extends IFaceletTagRecord> locate()
85
    public Map<String, ? extends IFaceletTagRecord> doLocate(
86
            final IProject project)
62
    {
87
    {
63
        try
88
        try
64
        {
89
        {
65
            return findInJars();
90
            return findInJars(project);
66
        }
91
        } catch (JavaModelException e)
67
        catch (JavaModelException e)
68
        {
92
        {
69
            FaceletCorePlugin
93
            FaceletCorePlugin
70
                    .log(
94
                    .log(
71
                            "Couldn't locate jar file taglibs: " + _project.getProject(), e); //$NON-NLS-1$
95
                            "Couldn't locate jar file taglibs: " + project.getProject(), e); //$NON-NLS-1$
72
        }
96
        }
73
        return Collections.EMPTY_MAP;
97
        return Collections.EMPTY_MAP;
74
    }
98
    }
75
99
76
    private Map<String, ? extends IFaceletTagRecord> findInJars() throws JavaModelException
100
    private Map<String, ? extends IFaceletTagRecord> findInJars(
101
            final IProject project) throws JavaModelException
77
    {
102
    {
78
        final IJavaProject javaProject = JavaCore.create(_project);
103
        final IJavaProject javaProject = JavaCore.create(project);
79
104
80
        final IClasspathEntry[] entries = javaProject
105
        final IClasspathEntry[] entries = javaProject
81
                .getResolvedClasspath(true);
106
                .getResolvedClasspath(true);
Lines 87-130 Link Here
87
112
88
            switch (entry.getEntryKind())
113
            switch (entry.getEntryKind())
89
            {
114
            {
90
                // this entry describes a source root in its project
115
            // this entry describes a source root in its project
91
                case IClasspathEntry.CPE_SOURCE:
116
            case IClasspathEntry.CPE_SOURCE:
92
117
93
                break;
118
                break;
94
                // - this entry describes a folder or JAR containing
119
            // - this entry describes a folder or JAR containing
95
                // binaries
120
            // binaries
96
                case IClasspathEntry.CPE_LIBRARY:
121
            case IClasspathEntry.CPE_LIBRARY:
97
                {
122
            {
98
                    tagLibsFound.addAll(processJar(entry));
123
                tagLibsFound.addAll(processJar(entry));
99
                }
124
            }
100
                break;
125
                break;
101
                // - this entry describes another project
126
            // - this entry describes another project
102
                case IClasspathEntry.CPE_PROJECT:
127
            case IClasspathEntry.CPE_PROJECT:
103
                    // {
128
                // {
104
                    // final IPath pathToProject = entry.getPath();
129
                // final IPath pathToProject = entry.getPath();
105
                    // IWorkspace wkspace = ResourcesPlugin.getWorkspace();
130
                // IWorkspace wkspace = ResourcesPlugin.getWorkspace();
106
                    // IResource res =
131
                // IResource res =
107
                    // wkspace.getRoot().findMember(pathToProject);
132
                // wkspace.getRoot().findMember(pathToProject);
108
                    // if (res instanceof IProject)
133
                // if (res instanceof IProject)
109
                    // {
134
                // {
110
                    // tagLibsFound.addAll();
135
                // tagLibsFound.addAll();
111
                    // }
136
                // }
112
                    // }
137
                // }
113
                break;
138
                break;
114
                // - this entry describes a project or library indirectly
139
            // - this entry describes a project or library indirectly
115
                // via a
140
            // via a
116
                // classpath variable in the first segment of the path *
141
            // classpath variable in the first segment of the path *
117
                case IClasspathEntry.CPE_VARIABLE:
142
            case IClasspathEntry.CPE_VARIABLE:
118
                break;
143
                break;
119
                // - this entry describes set of entries referenced
144
            // - this entry describes set of entries referenced
120
                // indirectly
145
            // indirectly
121
                // via a classpath container
146
            // via a classpath container
122
                case IClasspathEntry.CPE_CONTAINER:
147
            case IClasspathEntry.CPE_CONTAINER:
123
                break;
148
                break;
124
            }
149
            }
125
        }
150
        }
126
     
151
127
        for (final FaceletTaglibDefn tag :  tagLibsFound)
152
        for (final FaceletTaglibDefn tag : tagLibsFound)
128
        {
153
        {
129
            IFaceletTagRecord record = _factory.createRecords(tag);
154
            IFaceletTagRecord record = _factory.createRecords(tag);
130
            if (record != null)
155
            if (record != null)
Lines 132-138 Link Here
132
                _records.put(record.getURI(), record);
157
                _records.put(record.getURI(), record);
133
            }
158
            }
134
        }
159
        }
135
        
160
136
        return _records;
161
        return _records;
137
    }
162
    }
138
163
Lines 185-253 Link Here
185
                final Enumeration<JarEntry> jarEntries = jarFile.entries();
210
                final Enumeration<JarEntry> jarEntries = jarFile.entries();
186
                while (jarEntries.hasMoreElements())
211
                while (jarEntries.hasMoreElements())
187
                {
212
                {
188
                    final JarEntry jarEntry = jarEntries.nextElement();
213
                    JarEntry jarEntry = jarEntries.nextElement();
189
                    final String name = jarEntry.getName();
214
215
                    jarEntry = _finder.perform(jarEntry);
190
216
191
                    if (name.startsWith("META-INF/") //$NON-NLS-1$
217
                    if (jarEntry != null && jarEntry != _finder.getNoResult())
192
                            && name.endsWith(".taglib.xml")) //$NON-NLS-1$
193
                    {
218
                    {
194
                        InputStream is = null;
219
                        //                    if ((name.startsWith("META-INF/") //$NON-NLS-1$
195
                        try
220
                        //                            && name.endsWith(".taglib.xml")) //$NON-NLS-1$
221
                        //                            || (name.startsWith("com/sun/faces/metadata/taglib/") //$NON-NLS-1$ //ludo GlassFish v3
222
                        //                            && name.endsWith(".taglib.xml"))) //$NON-NLS-1$
196
                        {
223
                        {
197
                            is = jarFile.getInputStream(jarEntry);
224
                            InputStream is = null;
225
                            try
226
                            {
227
                                is = jarFile.getInputStream(jarEntry);
198
228
199
                            FaceletTaglibDefn tagLib = TagModelParser.loadFromInputStream(is, null);
229
                                FaceletTaglibDefn tagLib = TagModelParser
230
                                        .loadFromInputStream(is, null);
200
231
201
                            if (tagLib != null)
232
                                if (tagLib != null)
233
                                {
234
                                    tagLibsFound.add(tagLib);
235
                                }
236
                            } catch (final ParserConfigurationException e)
202
                            {
237
                            {
203
                                tagLibsFound.add(tagLib);
238
                                FaceletCorePlugin
204
                            }
239
                                        .log(
205
                        }
240
                                                "Error initializing facelet registry entry", //$NON-NLS-1$
206
                        catch (final ParserConfigurationException e)
241
                                                e);
207
                        {
242
                            } catch (final IOException ioe)
208
                            FaceletCorePlugin
243
                            {
209
                                    .log(
244
                                FaceletCorePlugin
210
                                            "Error initializing facelet registry entry", //$NON-NLS-1$
245
                                        .log(
211
                                            e);
246
                                                "Error initializing facelet registry entry", //$NON-NLS-1$
212
                        }
247
                                                ioe);
213
                        catch (final IOException ioe)
248
                            } catch (final SAXException ioe)
214
                        {
215
                            FaceletCorePlugin
216
                                    .log(
217
                                            "Error initializing facelet registry entry", //$NON-NLS-1$
218
                                            ioe);
219
                        }
220
                        catch (final SAXException ioe)
221
                        {
222
                            FaceletCorePlugin
223
                                    .log(
224
                                            "Error initializing facelet registry entry", //$NON-NLS-1$
225
                                            ioe);
226
                        }
227
                        finally
228
                        {
229
                            if (is != null)
230
                            {
249
                            {
231
                                // is.close();
250
                                FaceletCorePlugin
251
                                        .log(
252
                                                "Error initializing facelet registry entry", //$NON-NLS-1$
253
                                                ioe);
254
                            } finally
255
                            {
256
                                if (is != null)
257
                                {
258
                                    // is.close();
259
                                }
232
                            }
260
                            }
233
                        }
261
                        }
234
                    }
262
                    }
235
                }
263
                }
236
            }
264
            }
237
        }
265
        } catch (final IOException e)
238
        catch (final IOException e)
239
        {
266
        {
240
            FaceletCorePlugin.log("Error opening classpath jar file", e); //$NON-NLS-1$
267
            FaceletCorePlugin.log(
241
        }
268
                    "Error opening classpath jar file: " + entry, e); //$NON-NLS-1$
242
        finally
269
        } finally
243
        {
270
        {
244
            if (jarFile != null)
271
            if (jarFile != null)
245
            {
272
            {
246
                try
273
                try
247
                {
274
                {
248
                    jarFile.close();
275
                    jarFile.close();
249
                }
276
                } catch (final IOException ioe)
250
                catch (final IOException ioe)
251
                {
277
                {
252
                    FaceletCorePlugin.log("Error closing jar file", ioe); //$NON-NLS-1$
278
                    FaceletCorePlugin.log("Error closing jar file", ioe); //$NON-NLS-1$
253
                }
279
                }
Lines 255-273 Link Here
255
        }
281
        }
256
        return tagLibsFound;
282
        return tagLibsFound;
257
    }
283
    }
258
259
    @Override
260
    public void startLocating()
261
    {
262
        // TODO Auto-generated method stub
263
264
    }
265
266
    @Override
267
    public void stopLocating()
268
    {
269
        // TODO Auto-generated method stub
270
271
    }
272
273
}
284
}
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/LibraryClassBasedTagRecord.java (+1 lines)
Lines 121-126 Link Here
121
                    "Couldn't find type proxy for " + _model.getLibraryClass())); //$NON-NLS-1$
121
                    "Couldn't find type proxy for " + _model.getLibraryClass())); //$NON-NLS-1$
122
        }
122
        }
123
123
124
        // TODO: wrap in try per the Glassfish patch
124
        _classTypeWrapper = new BeanProxyWrapper(_project, libFactoryTypeProxy);
125
        _classTypeWrapper = new BeanProxyWrapper(_project, libFactoryTypeProxy);
125
126
126
        try
127
        try
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/Listener.java (-4 / +11 lines)
Lines 1-20 Link Here
1
package org.eclipse.jst.jsf.facelet.core.internal.registry.taglib;
1
package org.eclipse.jst.jsf.facelet.core.internal.registry.taglib;
2
2
3
import java.util.EventObject;
3
import org.eclipse.jst.jsf.common.internal.locator.ILocatorChangeListener;
4
4
5
/**
5
/**
6
 * A listener for locator detected tag library changes
6
 * A listener for locator detected tag library changes
7
 * @author cbateman
7
 * @author cbateman
8
 *
8
 *
9
 */
9
 */
10
public abstract class Listener
10
public abstract class Listener implements ILocatorChangeListener
11
{
11
{
12
    /**
12
    /**
13
     * Indicates that a tag library has changed
13
     * Indicates that a tag library has changed
14
     * @author cbateman
14
     * @author cbateman
15
     *
15
     *
16
     */
16
     */
17
    public static class TaglibChangedEvent extends EventObject
17
    public static class TaglibChangedEvent extends LocatorChangeEvent
18
    {
18
    {
19
        /**
19
        /**
20
         * TODO: what happens if one locator has a namespace collision with
20
         * TODO: what happens if one locator has a namespace collision with
Lines 97-105 Link Here
97
        }
97
        }
98
    }
98
    }
99
99
100
 
101
    public final void changed(final LocatorChangeEvent event)
102
    {
103
        changed((TaglibChangedEvent)event);
104
    }
105
106
100
    /**
107
    /**
101
     * @param event 
108
     * @param event 
102
     * 
109
     * 
103
     */
110
     */
104
    public abstract void tagLibChanged(Listener.TaglibChangedEvent event);
111
    public abstract void changed(Listener.TaglibChangedEvent event);
105
}
112
}
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/Messages.java (+31 lines)
Added Link Here
1
package org.eclipse.jst.jsf.facelet.core.internal.registry.taglib;
2
3
import org.eclipse.osgi.util.NLS;
4
5
/**
6
 * Package NLS manager.
7
 * @author cbateman
8
 *
9
 */
10
public class Messages extends NLS
11
{
12
    private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.facelet.core.internal.registry.taglib.messages"; //$NON-NLS-1$
13
    /**
14
     * see messages.properties.
15
     */
16
    public static String ContextParamSpecifiedFaceletTaglibLocator_0;
17
    /**
18
     * see messages.properties/
19
     */
20
    public static String JarFileFaceletTaglibLocator_0;
21
    static
22
    {
23
        // initialize resource bundle
24
        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
25
    }
26
27
    private Messages()
28
    {
29
        // no external instantiation.
30
    }
31
}
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/ProjectTaglibDescriptor.java (-5 / +5 lines)
Lines 59-65 Link Here
59
59
60
        final TagRecordFactory factory = new TagRecordFactory(project,
60
        final TagRecordFactory factory = new TagRecordFactory(project,
61
                _registry);
61
                _registry);
62
        _locators.add(new JarFileFaceletTaglibLocator(_project, factory));
62
        _locators.add(new JarFileFaceletTaglibLocator(factory));
63
        _locators.add(new ContextParamSpecifiedFaceletTaglibLocator(_project,
63
        _locators.add(new ContextParamSpecifiedFaceletTaglibLocator(_project,
64
                factory));
64
                factory));
65
65
Lines 99-106 Link Here
99
                        public void run() throws Exception
99
                        public void run() throws Exception
100
                        {
100
                        {
101
                            locator.addListener(_libChangeListener);
101
                            locator.addListener(_libChangeListener);
102
                            locator.startLocating();
102
                            locator.start(_project);
103
                            _tagRecords.putAll(locator.locate());
103
                            _tagRecords.putAll(locator.locate(_project));
104
                        }
104
                        }
105
                    });
105
                    });
106
                }
106
                }
Lines 162-168 Link Here
162
162
163
            for (final AbstractFaceletTaglibLocator locator : _locators)
163
            for (final AbstractFaceletTaglibLocator locator : _locators)
164
            {
164
            {
165
                locator.stopLocating();
165
                locator.stop();
166
            }
166
            }
167
        }
167
        }
168
    }
168
    }
Lines 170-176 Link Here
170
    private class MyChangeListener extends Listener
170
    private class MyChangeListener extends Listener
171
    {
171
    {
172
        @Override
172
        @Override
173
        public void tagLibChanged(final TaglibChangedEvent event)
173
        public void changed(final TaglibChangedEvent event)
174
        {
174
        {
175
            switch (event.getChangeType())
175
            switch (event.getChangeType())
176
            {
176
            {
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/TaglibFinder.java (+28 lines)
Added Link Here
1
package org.eclipse.jst.jsf.facelet.core.internal.registry.taglib;
2
3
import org.eclipse.jst.jsf.common.internal.strategy.AbstractIdentifiableStrategy;
4
5
6
/**
7
 * A finder strategy for Facelet tag libraries.
8
 * @author cbateman
9
 *
10
 * @param <INPUT>
11
 * @param <OUTPUT>
12
 */
13
public abstract class TaglibFinder<INPUT, OUTPUT> extends AbstractIdentifiableStrategy<INPUT, OUTPUT, String>
14
{
15
    /**
16
     * @param id
17
     * @param displayName
18
     * @param noResultValue
19
     */
20
    public TaglibFinder(String id, String displayName,
21
            OUTPUT noResultValue)
22
    {
23
        super(id, displayName, noResultValue);
24
    }
25
26
    @Override
27
    public abstract OUTPUT perform(INPUT input) throws Exception;
28
}
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/TaglibJarEntryFinder.java (+38 lines)
Added Link Here
1
package org.eclipse.jst.jsf.facelet.core.internal.registry.taglib;
2
3
import java.util.jar.JarEntry;
4
import java.util.regex.Pattern;
5
6
7
/**
8
 * @author cbateman
9
 *
10
 */
11
public class TaglibJarEntryFinder extends TaglibFinder<JarEntry, JarEntry>
12
{
13
    /**
14
     * Unique id of this strategy.
15
     */
16
    public static final String ID = TaglibJarEntryFinder.class.getCanonicalName();
17
    private static final String DISPLAY_NAME = "Display Name"; //$NON-NLS-1$
18
    private final Pattern _pattern;
19
    
20
    /**
21
     * @param pattern
22
     */
23
    public TaglibJarEntryFinder(final Pattern pattern)
24
    {
25
        super(ID, DISPLAY_NAME, null);
26
        _pattern = pattern;
27
    }
28
29
    @Override
30
    public JarEntry perform(JarEntry input) throws Exception
31
    {
32
        if (_pattern.matcher(input.getName()).matches())
33
        {
34
            return input;
35
        }
36
        return getNoResult();
37
    }
38
}
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/WebappConfiguration.java (-6 / +20 lines)
Lines 47-53 Link Here
47
 */
47
 */
48
public class WebappConfiguration
48
public class WebappConfiguration
49
{
49
{
50
    private static final String FACELET_LIBRARIES_CONTEXT_PARAM_NAME = "facelets.LIBRARIES"; //$NON-NLS-1$
50
    // TODO: move these to jsf core.
51
    private static final String FACELET_10_LIBRARIES_CONTEXT_PARAM_NAME = "facelets.LIBRARIES"; //$NON-NLS-1$
52
    private static final String JSF20_FACELET_LIBRARIES_CONTEXT_PARAM_NAME = "javax.faces.FACELETS_LIBRARIES"; //$NON-NLS-1$
51
    private final IProject      _project;
53
    private final IProject      _project;
52
    /**
54
    /**
53
     * Cached instance of ContextParamAdapter.
55
     * Cached instance of ContextParamAdapter.
Lines 307-313 Link Here
307
            final org.eclipse.jst.javaee.core.ParamValue paramValue = (org.eclipse.jst.javaee.core.ParamValue) itContextParams
309
            final org.eclipse.jst.javaee.core.ParamValue paramValue = (org.eclipse.jst.javaee.core.ParamValue) itContextParams
308
                    .next();
310
                    .next();
309
            if (paramValue.getParamName().equals(
311
            if (paramValue.getParamName().equals(
310
                    FACELET_LIBRARIES_CONTEXT_PARAM_NAME))
312
                    FACELET_10_LIBRARIES_CONTEXT_PARAM_NAME)||
313
                    paramValue.getParamName().equals(
314
                            JSF20_FACELET_LIBRARIES_CONTEXT_PARAM_NAME))
311
            {
315
            {
312
                filesString = paramValue.getParamValue();
316
                filesString = paramValue.getParamValue();
313
                break;
317
                break;
Lines 352-358 Link Here
352
                            final ContextParam contextParam = (ContextParam) itContexts
356
                            final ContextParam contextParam = (ContextParam) itContexts
353
                                    .next();
357
                                    .next();
354
                            if (contextParam.getParamName().equals(
358
                            if (contextParam.getParamName().equals(
355
                                    FACELET_LIBRARIES_CONTEXT_PARAM_NAME))
359
                                    FACELET_10_LIBRARIES_CONTEXT_PARAM_NAME)||
360
                                    contextParam.getParamName().equals(
361
                                            JSF20_FACELET_LIBRARIES_CONTEXT_PARAM_NAME))
362
                           // 	if (contextParam.getParamName().equals(
363
                           //        FACELET_LIBRARIES_CONTEXT_PARAM_NAME))
356
                            {
364
                            {
357
                                filesString = contextParam.getParamValue();
365
                                filesString = contextParam.getParamValue();
358
                                break;
366
                                break;
Lines 369-375 Link Here
369
                            final ParamValue paramValue = (ParamValue) itContextParams
377
                            final ParamValue paramValue = (ParamValue) itContextParams
370
                                    .next();
378
                                    .next();
371
                            if (paramValue.getName().equals(
379
                            if (paramValue.getName().equals(
372
                                    FACELET_LIBRARIES_CONTEXT_PARAM_NAME))
380
                                    FACELET_10_LIBRARIES_CONTEXT_PARAM_NAME)||
381
                                    paramValue.getName().equals(
382
                                            JSF20_FACELET_LIBRARIES_CONTEXT_PARAM_NAME))
383
                       //    if (paramValue.getName().equals(
384
                       //             FACELET_LIBRARIES_CONTEXT_PARAM_NAME))
373
                            {
385
                            {
374
                                filesString = paramValue.getValue();
386
                                filesString = paramValue.getValue();
375
                                break;
387
                                break;
Lines 611-617 Link Here
611
                            .getParamName();
623
                            .getParamName();
612
                }
624
                }
613
625
614
                if (FACELET_LIBRARIES_CONTEXT_PARAM_NAME.equals(name))
626
                if (FACELET_10_LIBRARIES_CONTEXT_PARAM_NAME.equals(name)||
627
                        JSF20_FACELET_LIBRARIES_CONTEXT_PARAM_NAME.equals(name))
615
                {
628
                {
616
                    isConfigFiles = true;
629
                    isConfigFiles = true;
617
                }
630
                }
Lines 644-650 Link Here
644
                            .getParamName();
657
                            .getParamName();
645
                }
658
                }
646
659
647
                if (FACELET_LIBRARIES_CONTEXT_PARAM_NAME.equals(name))
660
                if (FACELET_10_LIBRARIES_CONTEXT_PARAM_NAME.equals(name)||
661
                        JSF20_FACELET_LIBRARIES_CONTEXT_PARAM_NAME.equals(name))
648
                {
662
                {
649
                    isConfigFiles = true;
663
                    isConfigFiles = true;
650
                }
664
                }
(-)src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/messages.properties (+2 lines)
Added Link Here
1
ContextParamSpecifiedFaceletTaglibLocator_0=Facelet Taglib Locator for Context Params
2
JarFileFaceletTaglibLocator_0=Facelet Taglib Locator for Jar Files
(-)src/org/eclipse/jst/jsf/facelet/core/internal/view/FaceletViewDefnAdapter.java (-5 lines)
Lines 242-252 Link Here
242
            return _uri;
242
            return _uri;
243
        }
243
        }
244
244
245
        public final String getPrefix()
246
        {
247
            return _prefix;
248
        }
249
250
        @Override
245
        @Override
251
        public int hashCode()
246
        public int hashCode()
252
        {
247
        {
(-)metadata/facelet_ui.properties (-4 / +4 lines)
Lines 3-9 Link Here
3
component.display-label=Component
3
component.display-label=Component
4
component.description=Adds a new UIComponent into the view's component tree.  The new component will be the parent of the tag's component children.  Text outside the tag is removed before view rendering similar to composition.
4
component.description=Adds a new UIComponent into the view's component tree.  The new component will be the parent of the tag's component children.  Text outside the tag is removed before view rendering similar to composition.
5
5
6
composition.display-name=Composition
6
composition.display-label=Composition
7
composition.description=<p><em>Inserts a composite component that ignores content around it:</em></p> \
7
composition.description=<p><em>Inserts a composite component that ignores content around it:</em></p> \
8
<br><p><i>This text will be removed</i><br>  \
8
<br><p><i>This text will be removed</i><br>  \
9
<b>&lt;ui:composition&gt;</b><br> \
9
<b>&lt;ui:composition&gt;</b><br> \
Lines 12-21 Link Here
12
<b>&lt;/ui:composition&gt;</b><br> \
12
<b>&lt;/ui:composition&gt;</b><br> \
13
<i>This text will be removed</i></p>
13
<i>This text will be removed</i></p>
14
14
15
debug.display-name=Debug
15
debug.display-label=Debug
16
debug.description=Saves the component tree and EL variables in a view.  Accessible by hitting the hotkey (CTRL-SHIFT-D by default).
16
debug.description=Saves the component tree and EL variables in a view.  Accessible by hitting the hotkey (CTRL-SHIFT-D by default).
17
17
18
decorate.display-name=Decorate
18
decorate.display-label=Decorate
19
decorate.description=<p><em>Inserts a composite component that keeps the content around it:</em></p> \
19
decorate.description=<p><em>Inserts a composite component that keeps the content around it:</em></p> \
20
<br><p><i>This text will NOT be removed</i><br> \
20
<br><p><i>This text will NOT be removed</i><br> \
21
<b>&lt;ui:composition&gt;</b><br> \
21
<b>&lt;ui:composition&gt;</b><br> \
Lines 24-30 Link Here
24
<b>&lt;/ui:composition&gt;</b><br> \
24
<b>&lt;/ui:composition&gt;</b><br> \
25
<i>This text will NOT be removed</i></p>
25
<i>This text will NOT be removed</i></p>
26
26
27
define.display-name=Define
27
define.display-label=Define
28
define.description=Defines a template area that can be used instances using insert.
28
define.description=Defines a template area that can be used instances using insert.
29
29
30
fragment.display-label=Fragment
30
fragment.display-label=Fragment
(-)src/org/eclipse/jst/jsf/facelet/ui/internal/contentassist/XHTMLContentAssistProcessor2.java (-10 lines)
Lines 251-261 Link Here
251
        {
251
        {
252
            return _localName;
252
            return _localName;
253
        }
253
        }
254
255
        public boolean isHasColon()
256
        {
257
            return _hasColon;
258
        }
259
    }
254
    }
260
255
261
    private static class PrefixEntry
256
    private static class PrefixEntry
Lines 295-305 Link Here
295
            return _uri;
290
            return _uri;
296
        }
291
        }
297
292
298
        public final String getPrefix()
299
        {
300
            return _prefix;
301
        }
302
303
        public int hashCode()
293
        public int hashCode()
304
        {
294
        {
305
            return _uri.hashCode();
295
            return _uri.hashCode();
(-)src/org/eclipse/jst/jsf/facelet/ui/internal/validation/HTMLValidator.java (-1 / +3 lines)
Lines 198-203 Link Here
198
198
199
                    if (findUri == null)
199
                    if (findUri == null)
200
                    {
200
                    {
201
                        // XXX: Add resource locator call to find composite components,
202
                        // per the glassfish changes.
201
                        // TODO: need factory
203
                        // TODO: need factory
202
                        final Diagnostic diag = new BasicDiagnostic(
204
                        final Diagnostic diag = new BasicDiagnostic(
203
                                Diagnostic.WARNING, "", -1,
205
                                Diagnostic.WARNING, "", -1,
Lines 211-217 Link Here
211
            }
213
            }
212
        }
214
        }
213
    }
215
    }
214
216
    
215
    private boolean shouldValidate(final IFile model)
217
    private boolean shouldValidate(final IFile model)
216
    {
218
    {
217
        final IContentTypeManager manager = Platform.getContentTypeManager();
219
        final IContentTypeManager manager = Platform.getContentTypeManager();
(-)templates/templates.xml (-1 / +1 lines)
Lines 61-67 Link Here
61
	xmlns:h="http://java.sun.com/jsf/html"&#13;
61
	xmlns:h="http://java.sun.com/jsf/html"&#13;
62
	xmlns:f="http://java.sun.com/jsf/core"&gt;&#13;
62
	xmlns:f="http://java.sun.com/jsf/core"&gt;&#13;
63
&#13;
63
&#13;
64
&lt;ui:composition template=""&gt;&#13;
64
&lt;ui:composition&gt;&#13;
65
	&lt;ui:define name="header"&gt;&#13;
65
	&lt;ui:define name="header"&gt;&#13;
66
	    Add your header here or delete to use the default&#13;
66
	    Add your header here or delete to use the default&#13;
67
	&lt;/ui:define&gt;&#13;
67
	&lt;/ui:define&gt;&#13;

Return to bug 251798