Author: scabanovich
Date: 2007-10-12 08:19:52 -0400 (Fri, 12 Oct 2007)
New Revision: 4152
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/VpeProperties.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPTextJspKbConnector.java
Log:
JBIDE-525
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java 2007-10-12
12:18:04 UTC (rev 4151)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java 2007-10-12
12:19:52 UTC (rev 4152)
@@ -128,6 +128,17 @@
replacementBeginPosition, replacementLength, cursorPosition,
SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
proposalsList.add(proposal);
+ } else {
+ StringBuffer replacementStringBuffer = new
StringBuffer(kbProposal.getReplacementString());
+ int replacementBeginPosition = 0;
+ int replacementLength = text.length();
+ int cursorPositionDelta = 0;
+ String replacementString = replacementStringBuffer.toString();
+ int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
+ RedHatCustomCompletionProposal proposal = new
RedHatCustomCompletionProposal(kbProposal.autoActivationContentAssistantAfterApplication(),
replacementString,
+ replacementBeginPosition, replacementLength, cursorPosition,
SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
+ kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
+ proposalsList.add(proposal);
}
}
} catch (KbException e) {
@@ -149,15 +160,8 @@
}
void updateFacelets() {
- VpeTaglibManager tldManager = valueHelper.getTaglibManager();
- if(tldManager == null) return;
- List list = tldManager.getTagLibs();
- if(list == null) return;
- isFacelets = false;
- for(int i = 0; i < list.size(); i++) {
- TaglibData data = (TaglibData)list.get(i);
- isFacelets = isFacelets ||
data.getUri().equals(RedHatHtmlContentAssistProcessor.faceletUri);
- }
+ valueHelper.updateFacelets();
+ isFacelets = valueHelper.isFacetets();
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java 2007-10-12
12:18:04 UTC (rev 4151)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java 2007-10-12
12:19:52 UTC (rev 4152)
@@ -21,6 +21,7 @@
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.common.meta.key.WizardKeys;
import org.jboss.tools.jst.jsp.contentassist.JSPDialogCellEditorContentAssistProcessor;
+import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.RootElement;
/**
@@ -57,7 +58,11 @@
if(button == null || button.isDisposed()) return;
String attributeName = "" + context.getProperty("attributeName");
String nodeName = "" + context.getProperty("nodeName");
- String query = "/" + nodeName + "@" + attributeName;
+ String query = "/";
+ if(valueHelper.isFacetets()) {
+ query += RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart;
+ }
+ query += nodeName + "@" + attributeName;
RootElement root = (RootElement)valueHelper.getInitalInput(query);
boolean enabled = root != null && root.getChildren().length > 0;
getButtonControl().setVisible(enabled);
@@ -67,7 +72,11 @@
externalEditing = true;
String attributeName = "" + context.getProperty("attributeName");
String nodeName = "" + context.getProperty("nodeName");
- String query = "/" + nodeName + "@" + attributeName;
+ String query = "/";
+ if(valueHelper != null && valueHelper.isFacetets()) {
+ query += RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart;
+ }
+ query += nodeName + "@" + attributeName;
context.setProperty("query", query);
context.setProperty("help", query);
context.setProperty("title", "Edit " +
WizardKeys.toDisplayName(attributeName));
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2007-10-12
12:18:04 UTC (rev 4151)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2007-10-12
12:19:52 UTC (rev 4152)
@@ -11,6 +11,7 @@
package org.jboss.tools.jst.jsp.outline;
import java.util.*;
+
import org.eclipse.core.resources.*;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.jspeditor.*;
@@ -29,6 +30,7 @@
import org.jboss.tools.jst.jsp.editor.IVisualController;
import org.jboss.tools.jst.jsp.editor.IVisualEditor;
+import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.AttributeValueResource;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.AttributeValueResourceFactory;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.ModelElement;
@@ -40,6 +42,7 @@
import org.jboss.tools.common.kb.KbException;
import org.jboss.tools.common.kb.KbTldResource;
import org.jboss.tools.common.kb.TagDescriptor;
+import org.jboss.tools.common.kb.wtp.JspWtpKbConnector;
import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
import org.jboss.tools.common.model.plugin.ModelPlugin;
@@ -47,12 +50,14 @@
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.util.ModelFeatureFactory;
import org.jboss.tools.jst.jsp.support.kb.WTPTextJspKbConnector;
+import org.jboss.tools.jst.web.tld.TaglibData;
import org.jboss.tools.jst.web.tld.TaglibMapping;
import org.jboss.tools.jst.web.tld.VpeTaglibManager;
public class ValueHelper {
private IEditorInput editorInput = null;
private WTPTextJspKbConnector wtpTextJspKbConnector = null;
+ private boolean isFacelets = false;
public static IPromptingProvider seamPromptingProvider;
@@ -94,6 +99,10 @@
editorInput = jspEditor.getEditorInput();
wtpTextJspKbConnector = jspEditor.getWTPTextJspKbConnector();
+
+ if(pageContext != null) {
+ updateFacelets();
+ }
return pageContext != null || pageConnector != null;
}
@@ -285,5 +294,28 @@
IWorkbenchWindow window = (workbench == null) ? null :
workbench.getActiveWorkbenchWindow();
return (window == null) ? null : window.getActivePage();
}
+
+ public boolean isFacetets() {
+ return isFacelets;
+ }
+ public void updateFacelets() {
+ VpeTaglibManager tldManager = getTaglibManager();
+ if(tldManager == null) return;
+ List<TaglibData> list = tldManager.getTagLibs();
+ if(list == null) return;
+ isFacelets = false;
+ IDocument document = getDocument();
+ JspWtpKbConnector kbConnector =
(JspWtpKbConnector)wtpTextJspKbConnector.getConnector();
+ kbConnector.unregisterAllResources(true);
+ for(int i = 0; i < list.size(); i++) {
+ TaglibData data = list.get(i);
+ RedHatHtmlContentAssistProcessor.registerTld(data, kbConnector, document,
editorInput);
+ isFacelets = isFacelets ||
data.getUri().equals(RedHatHtmlContentAssistProcessor.faceletUri);
+ }
+ if(isFacelets) {
+ kbConnector.registerResource(RedHatHtmlContentAssistProcessor.faceletHtmlResource);
+ kbConnector.unregisterJspResource();
+ }
+ }
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/VpeProperties.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/VpeProperties.java 2007-10-12
12:18:04 UTC (rev 4151)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/VpeProperties.java 2007-10-12
12:19:52 UTC (rev 4152)
@@ -96,6 +96,10 @@
public String getNodeName() {
return node == null ? "" : node.getNodeName();
}
+
+ public Node getNode() {
+ return node;
+ }
public ExtendedCellEditorProvider createCellEditorProvider() {
return new ExtendedCellEditorProviderImpl();
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPTextJspKbConnector.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPTextJspKbConnector.java 2007-10-12
12:18:04 UTC (rev 4151)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPTextJspKbConnector.java 2007-10-12
12:19:52 UTC (rev 4152)
@@ -168,6 +168,10 @@
public boolean registerResource(KbResource resource) {
return kbConnector.registerResource(resource);
}
+
+ public KbConnector getConnector() {
+ return kbConnector;
+ }
/**
* @see
org.jboss.tools.common.kb.KbConnector#unregisterResource(org.jboss.tools.common.kb.KbResource)