Author: scabanovich
Date: 2009-10-13 06:41:17 -0400 (Tue, 13 Oct 2009)
New Revision: 18061
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/CssLinkAttributeValueLoader.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4996
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-10-13
10:34:13 UTC (rev 18060)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-10-13
10:41:17 UTC (rev 18061)
@@ -94,6 +94,7 @@
import org.jboss.tools.common.model.XModelBuffer;
import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.XModelObjectConstants;
import org.jboss.tools.common.model.XModelTransferBuffer;
import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
import org.jboss.tools.common.model.filesystems.impl.FolderImpl;
@@ -125,6 +126,7 @@
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
import org.jboss.tools.jst.jsp.editor.IVisualContext;
import org.jboss.tools.jst.jsp.editor.IVisualController;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.FileTagProposalLoader;
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPTagProposalFactory;
import org.jboss.tools.jst.jsp.jspeditor.dnd.TagProposal;
@@ -856,10 +858,17 @@
public TagAttributesComposite.AttributeDescriptorValue[] createDescriptors(KbQuery
query) {
IComponent s = findComponent(query);
if(s == null) return new TagAttributesComposite.AttributeDescriptorValue[0];
+ boolean excludeJSFC = false;
+ if(FileTagProposalLoader.FACELETS_URI.equals(query.getUri())) {
+ if(getModelObject() != null &&
"jsp".equalsIgnoreCase(getModelObject().getAttributeValue(XModelObjectConstants.ATTR_NAME_EXTENSION)))
{ //$NON-NLS-1$
+ excludeJSFC = true;
+ }
+ }
List<AttributeDescriptorValue> attributesValues = new
ArrayList<AttributeDescriptorValue>();
IAttribute[] as = s.getAttributes();
for (IAttribute a: as) {
+ if(excludeJSFC && "jsfc".equals(a.getName())) continue;
//$NON-NLS-1$
AttributeDescriptorValue value = new AttributeDescriptorValue(a.getName(),
a.isRequired(), a.isPreferable());
attributesValues.add(value);
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/CssLinkAttributeValueLoader.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/CssLinkAttributeValueLoader.java 2009-10-13
10:34:13 UTC (rev 18060)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/CssLinkAttributeValueLoader.java 2009-10-13
10:41:17 UTC (rev 18061)
@@ -11,9 +11,12 @@
package org.jboss.tools.jst.jsp.jspeditor.dnd;
import org.jboss.tools.common.model.ui.editors.dnd.AbsoluteFilePathAttributeValueLoader;
+import org.jboss.tools.common.model.ui.editors.dnd.DefaultDropWizardModel;
import org.jboss.tools.common.model.ui.editors.dnd.IDropWizardModel;
public class CssLinkAttributeValueLoader extends AbsoluteFilePathAttributeValueLoader {
+ static String ATTR_REL = "rel"; //$NON-NLS-1$
+ static String ATTR_TYPE = "type"; //$NON-NLS-1$
public CssLinkAttributeValueLoader(String pathAttributeName) {
super(pathAttributeName, null, null);
@@ -21,8 +24,12 @@
public void fillTagAttributes(IDropWizardModel model) {
super.fillTagAttributes(model);
- model.setAttributeValue("rel", "stylesheet"); //$NON-NLS-1$
//$NON-NLS-2$
- model.setAttributeValue("type", "text/css"); //$NON-NLS-1$
//$NON-NLS-2$
+ model.setAttributeValue(ATTR_REL, "stylesheet"); //$NON-NLS-1$
+ model.setAttributeValue(ATTR_TYPE, "text/css"); //$NON-NLS-1$
+ if(model instanceof DefaultDropWizardModel) {
+ ((DefaultDropWizardModel)model).setPreferable(ATTR_REL);
+ ((DefaultDropWizardModel)model).setPreferable(ATTR_TYPE);
+ }
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java 2009-10-13
10:34:13 UTC (rev 18060)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java 2009-10-13
10:41:17 UTC (rev 18061)
@@ -24,6 +24,8 @@
public class FileTagProposalLoader implements ITagProposalLoader {
+ public static String FACELETS_URI = "http://www.w3.org/1999/xhtml/facelets";
//$NON-NLS-1$
+
private static final Map<String,TagProposal[]> extensionMap = new
HashMap<String,TagProposal[]>();
static TagProposal[] IMG_TAG_PROPOSALS = new TagProposal[]{
@@ -34,7 +36,8 @@
new AbsoluteFilePathAttributeValueLoader("value","","")
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
),
new TagProposal(
- DropURI.HTML_4_0_URI,
+// DropURI.HTML_4_0_URI,
+ FACELETS_URI,
ITagProposal.EMPTY_PREFIX,
"img", //$NON-NLS-1$
new AbsoluteFilePathAttributeValueLoader("src","","")
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -63,7 +66,8 @@
static TagProposal[] CSS_TAG_PROPOSALS = new TagProposal[]{
new TagProposal(
- DropURI.HTML_4_0_URI,
+// DropURI.HTML_4_0_URI,
+ FACELETS_URI,
ITagProposal.EMPTY_PREFIX,
"link", //$NON-NLS-1$
new CssLinkAttributeValueLoader("href") //$NON-NLS-1$