Author: scabanovich
Date: 2007-10-12 11:18:23 -0400 (Fri, 12 Oct 2007)
New Revision: 4165
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
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
15:17:56 UTC (rev 4164)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java 2007-10-12
15:18:23 UTC (rev 4165)
@@ -105,6 +105,9 @@
}
String query = new
StringBuffer(KbQuery.TAG_SEPARATOR).append(tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).append(KbQuery.ENUMERATION_SEPARATOR).append(matchString).toString();
+ if(!isFacelets && tagName.indexOf(':') < 0) {
+ query = WtpKbConnector.ADD_HTML_PREFIX + query;
+ }
try {
Collection proposals = wtpKbConnector.getProposals(query);
if(proposals.size()==0 && htmlQuery!=null) {
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
15:17:56 UTC (rev 4164)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java 2007-10-12
15:18:23 UTC (rev 4165)
@@ -11,6 +11,8 @@
package org.jboss.tools.jst.jsp.outline;
import java.util.Properties;
+
+import org.jboss.tools.common.kb.wtp.WtpKbConnector;
import org.jboss.tools.common.model.ui.attribute.editor.DialogCellEditorEx;
import org.jboss.tools.common.model.ui.objecteditor.AttributeWrapper;
import org.jboss.tools.common.model.ui.objecteditor.ExtendedCellEditorProvider;
@@ -19,6 +21,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.contentassist.ContentAssistHandler;
import org.jboss.tools.common.meta.key.WizardKeys;
import org.jboss.tools.jst.jsp.contentassist.JSPDialogCellEditorContentAssistProcessor;
import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
@@ -34,7 +37,10 @@
Properties context;
ValueHelper valueHelper;
JSPDialogCellEditorContentAssistProcessor contentAssistentProcessor;
+ ContentAssistHandler handler = null;
+ boolean hasProposals = false;
+
public JSPDialogCellEditor(Composite parent, Properties context) {
super(parent);
this.context = context;
@@ -42,38 +48,47 @@
contentAssistentProcessor = new JSPDialogCellEditorContentAssistProcessor();
if(valueHelper != null) contentAssistentProcessor.setContext(context);
- ControlContentAssistHelper.createTextContentAssistant(getTextField(),
contentAssistentProcessor);
+ handler = ContentAssistHandler.createHandlerForText(getTextField(),
ControlContentAssistHelper.createJavaContentAssistant(contentAssistentProcessor));
}
public void activate() {
+ checkHasProposals();
checkButtonEnablement();
super.activate();
}
- private void checkButtonEnablement() {
+ void checkHasProposals() {
+ hasProposals = false;
if(context == null) return;
valueHelper = (ValueHelper)context.get("valueHelper");
if(valueHelper == null) return;
- Button button = getButtonControl();
- if(button == null || button.isDisposed()) return;
String attributeName = "" + context.getProperty("attributeName");
String nodeName = "" + context.getProperty("nodeName");
String query = "/";
- if(valueHelper.isFacetets()) {
+ if(valueHelper.isFacetets() && nodeName.indexOf(':') < 0) {
query += RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart;
}
query += nodeName + "@" + attributeName;
RootElement root = (RootElement)valueHelper.getInitalInput(query);
- boolean enabled = root != null && root.getChildren().length > 0;
- getButtonControl().setVisible(enabled);
+ hasProposals = root != null && root.getChildren().length > 0;
}
+
+ private void checkButtonEnablement() {
+ if(context == null) return;
+ valueHelper = (ValueHelper)context.get("valueHelper");
+ if(valueHelper == null) return;
+ Button button = getButtonControl();
+ if(button == null || button.isDisposed()) return;
+ button.setVisible(hasProposals);
+ handler.setEnabled(hasProposals);
+ }
protected Object openDialogBox(Control cellEditorWindow) {
externalEditing = true;
String attributeName = "" + context.getProperty("attributeName");
String nodeName = "" + context.getProperty("nodeName");
String query = "/";
- if(valueHelper != null && valueHelper.isFacetets()) {
+ if(valueHelper != null && valueHelper.isFacetets() &&
nodeName.indexOf(":") < 0) {
query += RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart;
}
query += nodeName + "@" + attributeName;
Show replies by date