rsrinivasan | cf82432 | 2008-05-02 19:51:19 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2001, 2008 Oracle Corporation and others. |
| 3 | * All rights reserved. This program and the accompanying materials |
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | * which accompanies this distribution, and is available at |
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
| 7 | * |
| 8 | * Contributors: |
| 9 | * Oracle Corporation - initial API and implementation |
| 10 | *******************************************************************************/ |
cbateman | 0954b95 | 2008-01-22 02:02:11 +0000 | [diff] [blame] | 11 | package org.eclipse.jst.jsf.designtime.internal.view.model.jsp; |
| 12 | |
| 13 | import org.eclipse.core.resources.IProject; |
| 14 | import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; |
rsrinivasan | ccd5a74 | 2008-06-06 18:45:15 +0000 | [diff] [blame] | 15 | import org.eclipse.jst.jsf.designtime.internal.Messages; |
cbateman | 0954b95 | 2008-01-22 02:02:11 +0000 | [diff] [blame] | 16 | import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.analyzer.TagAnalyzer; |
| 17 | import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; |
| 18 | |
| 19 | /** |
| 20 | * A resolving strategy that uses tag introspection. |
| 21 | * |
| 22 | * @author cbateman |
| 23 | * |
| 24 | */ |
| 25 | public final class TagIntrospectingStrategy extends JSPTagResolvingStrategy |
| 26 | { |
| 27 | /** |
| 28 | * the identifier of this strategy |
| 29 | */ |
rsrinivasan | ccd5a74 | 2008-06-06 18:45:15 +0000 | [diff] [blame] | 30 | public final static String ID = "org.eclipse.jst.jsf.designtime.TagIntrospectingStrategy"; //$NON-NLS-1$ |
cbateman | 61e45ed | 2008-03-10 02:37:35 +0000 | [diff] [blame] | 31 | /** |
| 32 | * the display name |
| 33 | */ |
rsrinivasan | ccd5a74 | 2008-06-06 18:45:15 +0000 | [diff] [blame] | 34 | public final static String DISPLAY_NAME = Messages.TagIntrospectingStrategy_DisplayName; |
cbateman | 0954b95 | 2008-01-22 02:02:11 +0000 | [diff] [blame] | 35 | |
| 36 | private final IProject _project; |
| 37 | |
| 38 | /** |
cbateman | c0f9ea1 | 2008-11-04 00:04:15 +0000 | [diff] [blame] | 39 | * @return the descriptor for this resolver strategy |
| 40 | */ |
| 41 | public static StrategyDescriptor createDescriptor() |
| 42 | { |
| 43 | return new StrategyDescriptor(ID, DISPLAY_NAME); |
| 44 | } |
| 45 | |
| 46 | /** |
cbateman | 0954b95 | 2008-01-22 02:02:11 +0000 | [diff] [blame] | 47 | * @param project |
| 48 | */ |
| 49 | public TagIntrospectingStrategy(final IProject project) |
| 50 | { |
| 51 | // TODO: would it be better to have a model context on the resolve? |
| 52 | _project = project; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public String getId() |
| 57 | { |
| 58 | return ID; |
| 59 | } |
| 60 | |
cbateman | 61e45ed | 2008-03-10 02:37:35 +0000 | [diff] [blame] | 61 | public String getDisplayName() |
| 62 | { |
| 63 | return DISPLAY_NAME; |
| 64 | } |
| 65 | |
cbateman | 0954b95 | 2008-01-22 02:02:11 +0000 | [diff] [blame] | 66 | @Override |
| 67 | public ITagElement resolve(TLDElementDeclaration element) |
| 68 | { |
| 69 | return TagAnalyzer.createTLDTagElement(element, _project); |
| 70 | } |
| 71 | |
| 72 | } |