JBoss Tools SVN: r8854 - trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-06-19 12:42:58 -0400 (Thu, 19 Jun 2008)
New Revision: 8854
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-2339
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2008-06-19 15:42:59 UTC (rev 8853)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2008-06-19 16:42:58 UTC (rev 8854)
@@ -338,6 +338,13 @@
}
}
+ try {
+ ((nsIBaseWindow) getWebBrowser().queryInterface(
+ nsIBaseWindow.NS_IBASEWINDOW_IID)).repaint(true);
+ } catch (XPCOMException ex) {
+ // just ignore its
+ BrowserPlugin.getDefault().logInfo("repaint failed", ex);
+ }
} else if (element != null) {
17 years, 6 months
JBoss Tools SVN: r8853 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist: xpl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-06-19 11:42:59 -0400 (Thu, 19 Jun 2008)
New Revision: 8853
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2317 Problems with code complete in JSF editor
http://jira.jboss.com/jira/browse/JBIDE-2334 JSF EL Code assist should add EL to attribute value but not replace whole not-EL value.
Imports are organized
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java 2008-06-19 15:42:16 UTC (rev 8852)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java 2008-06-19 15:42:59 UTC (rev 8853)
@@ -13,9 +13,6 @@
import java.util.Collection;
import java.util.Iterator;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
import org.eclipse.wst.sse.core.utils.StringUtils;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
@@ -25,7 +22,6 @@
import org.jboss.tools.common.kb.KbProposal;
import org.jboss.tools.common.kb.KbQuery;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.contentassist.xpl.JSPBaseContentAssistProcessor;
import org.w3c.dom.Attr;
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java 2008-06-19 15:42:16 UTC (rev 8852)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java 2008-06-19 15:42:59 UTC (rev 8853)
@@ -16,7 +16,6 @@
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.sse.core.utils.StringUtils;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
17 years, 6 months
JBoss Tools SVN: r8852 - in branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp: contentassist/xpl and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-06-19 11:42:16 -0400 (Thu, 19 Jun 2008)
New Revision: 8852
Modified:
branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java
branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java
branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2317 Problems with code complete in JSF editor
http://jira.jboss.com/jira/browse/JBIDE-2334 JSF EL Code assist should add EL to attribute value but not replace whole not-EL value.
Issues are fixed
Modified: branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java
===================================================================
--- branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java 2008-06-19 14:19:31 UTC (rev 8851)
+++ branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java 2008-06-19 15:42:16 UTC (rev 8852)
@@ -13,6 +13,7 @@
import java.util.Collection;
import java.util.Iterator;
+import org.eclipse.wst.sse.core.utils.StringUtils;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
import org.eclipse.wst.xml.ui.internal.contentassist.XMLRelevanceConstants;
@@ -21,7 +22,6 @@
import org.jboss.tools.common.kb.KbProposal;
import org.jboss.tools.common.kb.KbQuery;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.contentassist.xpl.JSPBaseContentAssistProcessor;
import org.w3c.dom.Attr;
@@ -73,7 +73,42 @@
tagName = FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName;
}
- String query = new StringBuffer(KbQuery.TAG_SEPARATOR).append(tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).append(KbQuery.ENUMERATION_SEPARATOR).append(matchString).toString();
+ if(!currentValue.startsWith("\"") && !currentValue.startsWith("'")) {
+ // Do not show any value proposals if the attribute value is not started with a quote/double-quote character
+ return;
+ }
+
+ String matchStringForQuery = matchString;
+ String strippedValueForQuery = strippedValue;
+ int elStartPosition = getELStartPosition(matchString);
+ int delta = 0;
+ String proposalPrefix = "";
+ String proposalSufix = "";
+ if (elStartPosition == -1) {
+ if(isCharSharp(matchString, offset-1)) {
+ proposalPrefix = "{"; //$NON-NLS-1$
+ } else {
+ proposalPrefix = "#{"; //$NON-NLS-1$
+ }
+ }
+
+ if (elStartPosition == -1) {
+ matchStringForQuery = "#{";
+ strippedValueForQuery = "";
+ delta = matchString.length();
+ } else {
+ matchStringForQuery = matchString.substring(elStartPosition);
+ strippedValueForQuery = matchStringForQuery;
+ delta = matchString.length() - matchStringForQuery.length();
+ }
+
+ // Correct delta if matchString starts with a quote (exclude that quote)
+ if (matchString.startsWith("\"") || matchString.startsWith("'")) {
+ strippedValueForQuery = matchString.substring(0,1) + strippedValueForQuery;
+ delta--;
+ }
+
+ String query = new StringBuffer(KbQuery.TAG_SEPARATOR).append(tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).append(KbQuery.ENUMERATION_SEPARATOR).append(matchStringForQuery).toString();
try {
Collection proposals = wtpKbConnector.getProposals(query);
if(proposals.size()==0 && htmlQuery!=null) {
@@ -81,7 +116,7 @@
}
for (Iterator iter = proposals.iterator(); iter.hasNext();) {
KbProposal kbProposal = cleanFaceletProposal((KbProposal)iter.next());
- kbProposal.postProcess(strippedValue, offset);
+ kbProposal.postProcess(strippedValueForQuery, offset - delta);
int relevance = kbProposal.getRelevance();
if(relevance==KbProposal.R_NONE) {
relevance = XMLRelevanceConstants.R_XML_ATTRIBUTE_VALUE;
@@ -89,59 +124,39 @@
if(kbProposal.getStart() >= 0) {
String replacementString = kbProposal.getReplacementString();
- int replacementBeginPosition = contentAssistRequest.getReplacementBeginPosition() + kbProposal.getStart();
+ int replacementBeginPosition = contentAssistRequest.getReplacementBeginPosition() + kbProposal.getStart() + delta;
int replacementLength = kbProposal.getEnd() - kbProposal.getStart();
int cursorPositionDelta = 0;
- if(currentValue.startsWith("\"") || currentValue.startsWith("'")) {
- replacementBeginPosition = replacementBeginPosition +1;
+
+ // Add an EL-starting quotation characters if needed
+ if (elStartPosition == -1) {
+ replacementString = proposalPrefix + replacementString;
+ cursorPositionDelta += proposalPrefix.length();
+ }
+
+ if((currentValue.length() > StringUtils.strip(currentValue).length()) &&
+ (currentValue.endsWith("\"") || currentValue.endsWith("'")) ) {
+ if(!currentValue.endsWith("}\"")) {
+ replacementString += "}";
+ }
} else {
- cursorPositionDelta++;
- replacementString = "\"" + replacementString;
- }
- if(currentValue.endsWith("\"") || currentValue.endsWith("'")) {
- if(currentValue.endsWith(".}\"") && replacementString.endsWith("}")) {
- replacementLength--;
- replacementString = replacementString.substring(0, replacementString.length()-1);
+ if(elStartPosition == -1 && !currentValue.endsWith("}")) {
+ replacementString += "}";
}
- } else {
- replacementString += ("\"");
+// replacementString += ("\"");
}
int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
- AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
- replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
- kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
+ String displayString = elStartPosition == -1 ?
+ proposalPrefix + kbProposal.getReplacementString() + "}" :
+ kbProposal.getReplacementString();
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(
+ kbProposal.autoActivationContentAssistantAfterApplication(),
+ replacementString,
+ replacementBeginPosition, replacementLength, cursorPosition,
+ SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
+ displayString, null, kbProposal.getContextInfo(), relevance);
contentAssistRequest.addProposal(proposal);
-
- continue;
}
-
-
- StringBuffer replacementStringBuffer = new StringBuffer(kbProposal.getReplacementString());
- int replacementBeginPosition = contentAssistRequest.getReplacementBeginPosition();
- int replacementLength = contentAssistRequest.getReplacementLength();
- int cursorPositionDelta = 0;
- if(currentValue.startsWith("\"") || currentValue.startsWith("'")) {
- replacementBeginPosition = replacementBeginPosition +1;
- replacementLength--;
- } else {
- cursorPositionDelta++;
- replacementStringBuffer.insert(0, "\"");
- }
- if(currentValue.endsWith("\"") || currentValue.endsWith("'")) {
- replacementLength--;
- if(currentValue.endsWith(".}\"") && replacementStringBuffer.toString().endsWith("}")) {
- replacementLength--;
- replacementStringBuffer = new StringBuffer(replacementStringBuffer.toString().substring(0, replacementStringBuffer.length()-1));
- }
- } else {
- replacementStringBuffer.append("\"");
- }
- String replacementString = replacementStringBuffer.toString();
- int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
- AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
- replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
- kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
- contentAssistRequest.addProposal(proposal);
}
} catch (KbException e) {
JspEditorPlugin.getPluginLog().logError(e);
@@ -174,4 +189,49 @@
public void setFacelets(boolean isFacelets) {
this.isFacelets = isFacelets;
}
+
+ /*
+ * Checks if the EL start starting characters are present
+ * @return
+ */
+ private int getELStartPosition(String matchString) {
+ if (matchString == null || matchString.length() == 0)
+ return -1;
+
+ int offset = matchString.length();
+
+ while (--offset >= 0) {
+ if ('}' == matchString.charAt(offset))
+ return -1;
+
+ if ('"' == matchString.charAt(offset) || '\'' == matchString.charAt(offset)) {
+ int backslashCount = 0;
+ while ((offset - 1 - backslashCount) >= 0 && matchString.charAt(offset - 1 - backslashCount) == '\\') {
+ backslashCount++;
+ }
+
+ if (backslashCount % 2 == 0)
+ return -1;
+ }
+
+ if ('{' == matchString.charAt(offset) &&
+ (offset - 1) >= 0 &&
+ ('#' == matchString.charAt(offset - 1) ||
+ '$' == matchString.charAt(offset - 1))) {
+ return (offset - 1);
+ }
+ }
+ return -1;
+ }
+
+ /* Checks if the preceding character is a Sharp-character
+ */
+ private boolean isCharSharp(String matchString, int offset) {
+ if (matchString == null || offset > matchString.length() || offset < 0) {
+ return false;
+ }
+
+ return '#' == matchString.charAt(offset);
+ }
+
}
\ No newline at end of file
Modified: branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java
===================================================================
--- branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java 2008-06-19 14:19:31 UTC (rev 8851)
+++ branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java 2008-06-19 15:42:16 UTC (rev 8852)
@@ -67,16 +67,19 @@
}
String matchString = null;
+
+ // JBIDE-2334: Do not need any fix-ups here
+
// fixups
- if (currentValue.length() > StringUtils.strip(currentValue).length() && (currentValue.startsWith("\"") || currentValue.startsWith("'")) && contentAssistRequest.getMatchString().length() > 0) {
- matchString = currentValue.substring(1, contentAssistRequest.getMatchString().length());
- strippedValue = currentValue.substring(1);
- offset = contentAssistRequest.getMatchString().length() - 1;
- } else {
+// if (currentValue.length() > StringUtils.strip(currentValue).length() && (currentValue.startsWith("\"") || currentValue.startsWith("'")) && contentAssistRequest.getMatchString().length() > 0) {
+// matchString = currentValue.substring(0, contentAssistRequest.getMatchString().length());
+// strippedValue = currentValue;
+// offset = contentAssistRequest.getMatchString().length();
+// } else {
matchString = currentValue.substring(0, contentAssistRequest.getMatchString().length());
strippedValue = currentValue;
offset = contentAssistRequest.getMatchString().length();
- }
+// }
addFaceletAttributeValueProposals(
contentAssistRequest,tagName,node, attributeName,matchString,strippedValue,offset,currentValue);
}
Modified: branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java
===================================================================
--- branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java 2008-06-19 14:19:31 UTC (rev 8851)
+++ branches/jbosstools-2.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java 2008-06-19 15:42:16 UTC (rev 8852)
@@ -200,18 +200,22 @@
if(callStart != null) proposal.setStart(callStart.start); else proposal.setStart(offset);
ELParser.Token callEnd = ELParser.getCallEnd(c);
if(callEnd != null && callEnd.end >= offset) proposal.setEnd(callEnd.end); else proposal.setEnd(offset);
+ int pos = proposal.getReplacementString().length();
+
+ // JBIDE-2334: JSPAciveContentAssistProcessor (a class which calls this method)
+ // is to process opening and closing EL charachers
+/*
String[][] ws = getWrappers();
- int pos = proposal.getReplacementString().length();
if(ws.length > 0 && ws[0][0].length() > 0) {
ELParser.Token open = ELParser.getPrecedingOpen(c, offset);
if(open == null && !proposal.getReplacementString().startsWith(ws[0][0])) {
- pos += ws[0][0].length();
- proposal.setReplacementString(ws[0][0] + proposal.getReplacementString());
- proposal.setLabel(ws[0][0] + proposal.getLabel() + ws[0][1]);
+// pos += ws[0][0].length();
+// proposal.setReplacementString(ws[0][0] + proposal.getReplacementString());
+// proposal.setLabel(ws[0][0] + proposal.getLabel() + ws[0][1]);
} else if(open != null && !proposal.getReplacementString().startsWith(ws[0][0]) && open.end - open.start == 1) {
if(ws[0][0].endsWith("{")) {
- pos += 1;
- proposal.setReplacementString("{" + proposal.getReplacementString());
+// pos += 1;
+// proposal.setReplacementString("{" + proposal.getReplacementString());
}
} else if(open != null && open.end - open.start == 2 && offset < open.end && offset > open.start) {
proposal.setStart(proposal.getStart() + 1);
@@ -219,9 +223,10 @@
proposal.setPosition(proposal.getStart());
}
if(!ELParser.isFollowedByClose(c, offset) && !proposal.getReplacementString().endsWith(ws[0][1])) {
- proposal.setReplacementString(proposal.getReplacementString() + ws[0][1]);
+// proposal.setReplacementString(proposal.getReplacementString() + ws[0][1]);
}
}
+*/
proposal.setPosition(pos);
}
}
17 years, 6 months
JBoss Tools SVN: r8851 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-06-19 10:19:31 -0400 (Thu, 19 Jun 2008)
New Revision: 8851
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
Log:
Fix bug http://jira.jboss.com/jira/browse/JBIDE-2366
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java 2008-06-19 13:29:07 UTC (rev 8850)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java 2008-06-19 14:19:31 UTC (rev 8851)
@@ -119,9 +119,16 @@
height = PERCENT_100;
}
// added by estherbin fix not worked junit JBIDE1713Test
- final Integer iHeight = ComponentUtil.parseWidthHeightValue(height);
-
- return "height: " + String.valueOf(iHeight) + ComponentUtil.PX_SUFFIX + SEMI_COLON; //$NON-NLS-1$
+ Integer iHeight = null;
+ //Added by estherbin
+ //fix http://jira.jboss.com/jira/browse/JBIDE-2366
+ try {
+ iHeight = ComponentUtil.parseWidthHeightValue(height);
+ } catch (NumberFormatException e) {
+ height = PERCENT_100;
+ }
+
+ return "height: " + getValue(height, iHeight); //$NON-NLS-1$
}
/**
@@ -135,11 +142,30 @@
width = PERCENT_100;
}
// added by estherbin fix not worked junit JBIDE1713Test
- final Integer iWidth = ComponentUtil.parseWidthHeightValue(width);
+ Integer iWidth = null;
- return "width: " + String.valueOf(iWidth) + ComponentUtil.PX_SUFFIX + SEMI_COLON; //$NON-NLS-1$
+ //Added by estherbin
+ //http://jira.jboss.com/jira/browse/JBIDE-2366
+ try {
+ iWidth = ComponentUtil.parseWidthHeightValue(width);
+ } catch (NumberFormatException e) {
+ width = PERCENT_100;
+ }
+
+ return "width: " + getValue(width,iWidth); //$NON-NLS-1$
}
+ private String getValue(String width, Integer iWidth) {
+ String rst = "";
+
+ if (width.equals(PERCENT_100)) {
+ rst = width + SEMI_COLON;
+ } else {
+ rst = String.valueOf(iWidth) + ComponentUtil.PX_SUFFIX + SEMI_COLON;
+ }
+ return rst;
+ }
+
/**
*
*/
17 years, 6 months
JBoss Tools SVN: r8850 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp: contentassist/xpl and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-06-19 09:29:07 -0400 (Thu, 19 Jun 2008)
New Revision: 8850
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2317 Problems with code complete in JSF editor
http://jira.jboss.com/jira/browse/JBIDE-2334 JSF EL Code assist should add EL to attribute value but not replace whole not-EL value.
Issues are fixed
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java 2008-06-19 10:49:46 UTC (rev 8849)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java 2008-06-19 13:29:07 UTC (rev 8850)
@@ -13,6 +13,10 @@
import java.util.Collection;
import java.util.Iterator;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.wst.sse.core.utils.StringUtils;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
import org.eclipse.wst.xml.ui.internal.contentassist.XMLRelevanceConstants;
@@ -73,7 +77,42 @@
tagName = FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName;
}
- String query = new StringBuffer(KbQuery.TAG_SEPARATOR).append(tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).append(KbQuery.ENUMERATION_SEPARATOR).append(matchString).toString();
+ if(!currentValue.startsWith("\"") && !currentValue.startsWith("'")) {
+ // Do not show any value proposals if the attribute value is not started with a quote/double-quote character
+ return;
+ }
+
+ String matchStringForQuery = matchString;
+ String strippedValueForQuery = strippedValue;
+ int elStartPosition = getELStartPosition(matchString);
+ int delta = 0;
+ String proposalPrefix = "";
+ String proposalSufix = "";
+ if (elStartPosition == -1) {
+ if(isCharSharp(matchString, offset-1)) {
+ proposalPrefix = "{"; //$NON-NLS-1$
+ } else {
+ proposalPrefix = "#{"; //$NON-NLS-1$
+ }
+ }
+
+ if (elStartPosition == -1) {
+ matchStringForQuery = "#{";
+ strippedValueForQuery = "";
+ delta = matchString.length();
+ } else {
+ matchStringForQuery = matchString.substring(elStartPosition);
+ strippedValueForQuery = matchStringForQuery;
+ delta = matchString.length() - matchStringForQuery.length();
+ }
+
+ // Correct delta if matchString starts with a quote (exclude that quote)
+ if (matchString.startsWith("\"") || matchString.startsWith("'")) {
+ strippedValueForQuery = matchString.substring(0,1) + strippedValueForQuery;
+ delta--;
+ }
+
+ String query = new StringBuffer(KbQuery.TAG_SEPARATOR).append(tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).append(KbQuery.ENUMERATION_SEPARATOR).append(matchStringForQuery).toString();
try {
Collection proposals = wtpKbConnector.getProposals(query);
if(proposals.size()==0 && htmlQuery!=null) {
@@ -81,7 +120,7 @@
}
for (Iterator iter = proposals.iterator(); iter.hasNext();) {
KbProposal kbProposal = cleanFaceletProposal((KbProposal)iter.next());
- kbProposal.postProcess(strippedValue, offset);
+ kbProposal.postProcess(strippedValueForQuery, offset - delta);
int relevance = kbProposal.getRelevance();
if(relevance==KbProposal.R_NONE) {
relevance = XMLRelevanceConstants.R_XML_ATTRIBUTE_VALUE;
@@ -89,59 +128,39 @@
if(kbProposal.getStart() >= 0) {
String replacementString = kbProposal.getReplacementString();
- int replacementBeginPosition = contentAssistRequest.getReplacementBeginPosition() + kbProposal.getStart();
+ int replacementBeginPosition = contentAssistRequest.getReplacementBeginPosition() + kbProposal.getStart() + delta;
int replacementLength = kbProposal.getEnd() - kbProposal.getStart();
int cursorPositionDelta = 0;
- if(currentValue.startsWith("\"") || currentValue.startsWith("'")) {
- replacementBeginPosition = replacementBeginPosition +1;
+
+ // Add an EL-starting quotation characters if needed
+ if (elStartPosition == -1) {
+ replacementString = proposalPrefix + replacementString;
+ cursorPositionDelta += proposalPrefix.length();
+ }
+
+ if((currentValue.length() > StringUtils.strip(currentValue).length()) &&
+ (currentValue.endsWith("\"") || currentValue.endsWith("'")) ) {
+ if(!currentValue.endsWith("}\"")) {
+ replacementString += "}";
+ }
} else {
- cursorPositionDelta++;
- replacementString = "\"" + replacementString;
- }
- if(currentValue.endsWith("\"") || currentValue.endsWith("'")) {
- if(currentValue.endsWith(".}\"") && replacementString.endsWith("}")) {
- replacementLength--;
- replacementString = replacementString.substring(0, replacementString.length()-1);
+ if(elStartPosition == -1 && !currentValue.endsWith("}")) {
+ replacementString += "}";
}
- } else {
- replacementString += ("\"");
+// replacementString += ("\"");
}
int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
- AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
- replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
- kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
+ String displayString = elStartPosition == -1 ?
+ proposalPrefix + kbProposal.getReplacementString() + "}" :
+ kbProposal.getReplacementString();
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(
+ kbProposal.autoActivationContentAssistantAfterApplication(),
+ replacementString,
+ replacementBeginPosition, replacementLength, cursorPosition,
+ SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
+ displayString, null, kbProposal.getContextInfo(), relevance);
contentAssistRequest.addProposal(proposal);
-
- continue;
}
-
-
- StringBuffer replacementStringBuffer = new StringBuffer(kbProposal.getReplacementString());
- int replacementBeginPosition = contentAssistRequest.getReplacementBeginPosition();
- int replacementLength = contentAssistRequest.getReplacementLength();
- int cursorPositionDelta = 0;
- if(currentValue.startsWith("\"") || currentValue.startsWith("'")) {
- replacementBeginPosition = replacementBeginPosition +1;
- replacementLength--;
- } else {
- cursorPositionDelta++;
- replacementStringBuffer.insert(0, "\"");
- }
- if(currentValue.endsWith("\"") || currentValue.endsWith("'")) {
- replacementLength--;
- if(currentValue.endsWith(".}\"") && replacementStringBuffer.toString().endsWith("}")) {
- replacementLength--;
- replacementStringBuffer = new StringBuffer(replacementStringBuffer.toString().substring(0, replacementStringBuffer.length()-1));
- }
- } else {
- replacementStringBuffer.append("\"");
- }
- String replacementString = replacementStringBuffer.toString();
- int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
- AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
- replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
- kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
- contentAssistRequest.addProposal(proposal);
}
} catch (KbException e) {
JspEditorPlugin.getPluginLog().logError(e);
@@ -174,4 +193,49 @@
public void setFacelets(boolean isFacelets) {
this.isFacelets = isFacelets;
}
+
+ /*
+ * Checks if the EL start starting characters are present
+ * @return
+ */
+ private int getELStartPosition(String matchString) {
+ if (matchString == null || matchString.length() == 0)
+ return -1;
+
+ int offset = matchString.length();
+
+ while (--offset >= 0) {
+ if ('}' == matchString.charAt(offset))
+ return -1;
+
+ if ('"' == matchString.charAt(offset) || '\'' == matchString.charAt(offset)) {
+ int backslashCount = 0;
+ while ((offset - 1 - backslashCount) >= 0 && matchString.charAt(offset - 1 - backslashCount) == '\\') {
+ backslashCount++;
+ }
+
+ if (backslashCount % 2 == 0)
+ return -1;
+ }
+
+ if ('{' == matchString.charAt(offset) &&
+ (offset - 1) >= 0 &&
+ ('#' == matchString.charAt(offset - 1) ||
+ '$' == matchString.charAt(offset - 1))) {
+ return (offset - 1);
+ }
+ }
+ return -1;
+ }
+
+ /* Checks if the preceding character is a Sharp-character
+ */
+ private boolean isCharSharp(String matchString, int offset) {
+ if (matchString == null || offset > matchString.length() || offset < 0) {
+ return false;
+ }
+
+ return '#' == matchString.charAt(offset);
+ }
+
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java 2008-06-19 10:49:46 UTC (rev 8849)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/xpl/JSPBaseContentAssistProcessor.java 2008-06-19 13:29:07 UTC (rev 8850)
@@ -67,16 +67,19 @@
}
String matchString = null;
+
+ // JBIDE-2334: Do not need any fix-ups here
+
// fixups
- if (currentValue.length() > StringUtils.strip(currentValue).length() && (currentValue.startsWith("\"") || currentValue.startsWith("'")) && contentAssistRequest.getMatchString().length() > 0) {
- matchString = currentValue.substring(1, contentAssistRequest.getMatchString().length());
- strippedValue = currentValue.substring(1);
- offset = contentAssistRequest.getMatchString().length() - 1;
- } else {
+// if (currentValue.length() > StringUtils.strip(currentValue).length() && (currentValue.startsWith("\"") || currentValue.startsWith("'")) && contentAssistRequest.getMatchString().length() > 0) {
+// matchString = currentValue.substring(0, contentAssistRequest.getMatchString().length());
+// strippedValue = currentValue;
+// offset = contentAssistRequest.getMatchString().length();
+// } else {
matchString = currentValue.substring(0, contentAssistRequest.getMatchString().length());
strippedValue = currentValue;
offset = contentAssistRequest.getMatchString().length();
- }
+// }
addFaceletAttributeValueProposals(
contentAssistRequest,tagName,node, attributeName,matchString,strippedValue,offset,currentValue);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java 2008-06-19 10:49:46 UTC (rev 8849)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/WTPKbdBeanPropertyResource.java 2008-06-19 13:29:07 UTC (rev 8850)
@@ -200,18 +200,22 @@
if(callStart != null) proposal.setStart(callStart.start); else proposal.setStart(offset);
ELParser.Token callEnd = ELParser.getCallEnd(c);
if(callEnd != null && callEnd.end >= offset) proposal.setEnd(callEnd.end); else proposal.setEnd(offset);
+ int pos = proposal.getReplacementString().length();
+
+ // JBIDE-2334: JSPAciveContentAssistProcessor (a class which calls this method)
+ // is to process opening and closing EL charachers
+/*
String[][] ws = getWrappers();
- int pos = proposal.getReplacementString().length();
if(ws.length > 0 && ws[0][0].length() > 0) {
ELParser.Token open = ELParser.getPrecedingOpen(c, offset);
if(open == null && !proposal.getReplacementString().startsWith(ws[0][0])) {
- pos += ws[0][0].length();
- proposal.setReplacementString(ws[0][0] + proposal.getReplacementString());
- proposal.setLabel(ws[0][0] + proposal.getLabel() + ws[0][1]);
+// pos += ws[0][0].length();
+// proposal.setReplacementString(ws[0][0] + proposal.getReplacementString());
+// proposal.setLabel(ws[0][0] + proposal.getLabel() + ws[0][1]);
} else if(open != null && !proposal.getReplacementString().startsWith(ws[0][0]) && open.end - open.start == 1) {
if(ws[0][0].endsWith("{")) {
- pos += 1;
- proposal.setReplacementString("{" + proposal.getReplacementString());
+// pos += 1;
+// proposal.setReplacementString("{" + proposal.getReplacementString());
}
} else if(open != null && open.end - open.start == 2 && offset < open.end && offset > open.start) {
proposal.setStart(proposal.getStart() + 1);
@@ -219,9 +223,10 @@
proposal.setPosition(proposal.getStart());
}
if(!ELParser.isFollowedByClose(c, offset) && !proposal.getReplacementString().endsWith(ws[0][1])) {
- proposal.setReplacementString(proposal.getReplacementString() + ws[0][1]);
+// proposal.setReplacementString(proposal.getReplacementString() + ws[0][1]);
}
}
+*/
proposal.setPosition(pos);
}
}
17 years, 6 months
JBoss Tools SVN: r8849 - branches/jbosstools-2.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-06-19 06:49:46 -0400 (Thu, 19 Jun 2008)
New Revision: 8849
Modified:
branches/jbosstools-2.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java
Log:
JBIDE-2367
Modified: branches/jbosstools-2.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java
===================================================================
--- branches/jbosstools-2.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java 2008-06-19 10:46:45 UTC (rev 8848)
+++ branches/jbosstools-2.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java 2008-06-19 10:49:46 UTC (rev 8849)
@@ -25,7 +25,7 @@
protected String workspaceHome = null;
protected IProject project = null;
protected XModel model = null;
-
+
public ModelNature() {}
public void configure() throws CoreException {
@@ -64,12 +64,17 @@
private void updateListener() {
if(listener != null) return;
listener = new Listener();
- ModelPlugin.getWorkspace().addResourceChangeListener(listener);
+ ModelPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.PRE_CLOSE);
}
static class Listener implements IResourceChangeListener {
public void resourceChanged(IResourceChangeEvent event) {
- if(event.getType() == IResourceChangeEvent.PRE_DELETE) {
+ if(event.getType() == IResourceChangeEvent.PRE_DELETE
+ //TODO It will be good to clean cache on close project,
+ //but it will need extensive testing, so let's do it later
+ //when having more time before another release.
+// || event.getType() == IResourceChangeEvent.PRE_CLOSE
+ ) {
IProject p = event.getResource().getProject();
if(p != null && models.containsKey(p)) {
models.remove(p);
@@ -79,21 +84,8 @@
}
private void createProject() {
-//@S_CHECK@
ClassLoaderUtil.init();
- model = (XModel)models.get(project);
- if(model != null) {
- String home = getWorkspaceHome();
- String h = XModelConstants.getWorkspace(model);
- if(home == null || !home.equals(h)) {
- ModelPlugin.getPluginLog().logInfo("WARNING:" + " workspace home changed from " + h + " to " + home);
- model.getProperties().setProperty(XModelConstants.WORKSPACE, home);
- model.getProperties().setProperty(XModelConstants.WORKSPACE_OLD, home);
- model.getProperties().setProperty("nature", getID());
- model.load();
- }
- return;
- }
+
Properties p = new Properties();
p.putAll(System.getProperties());
@@ -115,6 +107,20 @@
p.setProperty(ECLIPSE_PROJECT_OLD, project.getLocation().toString());
p.put("project", project);
p.setProperty("nature", getID());
+
+ model = (XModel)models.get(project);
+ if(model != null) {
+ home = p.getProperty(XModelConstants.WORKSPACE);
+ String h = XModelConstants.getWorkspace(model);
+ if(home == null || !home.equals(h)) {
+ ModelPlugin.getPluginLog().logInfo("WARNING:" + " workspace home changed from " + h + " to " + home);
+ model.getProperties().setProperty(XModelConstants.WORKSPACE, home);
+ model.getProperties().setProperty(XModelConstants.WORKSPACE_OLD, home);
+ model.getProperties().setProperty("nature", getID());
+ model.load();
+ }
+ return;
+ }
model = XModelFactory.getModel(p);
if(model.getService() == null) {
model.setService(createServiceDialog());
17 years, 6 months
JBoss Tools SVN: r8848 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-06-19 06:46:45 -0400 (Thu, 19 Jun 2008)
New Revision: 8848
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java
Log:
JBIDE-2367
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java 2008-06-19 09:29:01 UTC (rev 8847)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNature.java 2008-06-19 10:46:45 UTC (rev 8848)
@@ -25,7 +25,7 @@
protected String workspaceHome = null;
protected IProject project = null;
protected XModel model = null;
-
+
public ModelNature() {}
public void configure() throws CoreException {
@@ -64,12 +64,17 @@
private void updateListener() {
if(listener != null) return;
listener = new Listener();
- ModelPlugin.getWorkspace().addResourceChangeListener(listener);
+ ModelPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.PRE_CLOSE);
}
static class Listener implements IResourceChangeListener {
public void resourceChanged(IResourceChangeEvent event) {
- if(event.getType() == IResourceChangeEvent.PRE_DELETE) {
+ if(event.getType() == IResourceChangeEvent.PRE_DELETE
+ //TODO It will be good to clean cache on close project,
+ //but it will need extensive testing, so let's do it later
+ //when having more time before another release.
+// || event.getType() == IResourceChangeEvent.PRE_CLOSE
+ ) {
IProject p = event.getResource().getProject();
if(p != null && models.containsKey(p)) {
models.remove(p);
@@ -80,19 +85,7 @@
private void createProject() {
ClassLoaderUtil.init();
- model = (XModel)models.get(project);
- if(model != null) {
- String home = getWorkspaceHome();
- String h = XModelConstants.getWorkspace(model);
- if(home == null || !home.equals(h)) {
- ModelPlugin.getPluginLog().logInfo("WARNING:" + " workspace home changed from " + h + " to " + home);
- model.getProperties().setProperty(XModelConstants.WORKSPACE, home);
- model.getProperties().setProperty(XModelConstants.WORKSPACE_OLD, home);
- model.getProperties().setProperty("nature", getID());
- model.load();
- }
- return;
- }
+
Properties p = new Properties();
p.putAll(System.getProperties());
@@ -114,6 +107,20 @@
p.setProperty(ECLIPSE_PROJECT_OLD, project.getLocation().toString());
p.put("project", project);
p.setProperty("nature", getID());
+
+ model = (XModel)models.get(project);
+ if(model != null) {
+ home = p.getProperty(XModelConstants.WORKSPACE);
+ String h = XModelConstants.getWorkspace(model);
+ if(home == null || !home.equals(h)) {
+ ModelPlugin.getPluginLog().logInfo("WARNING:" + " workspace home changed from " + h + " to " + home);
+ model.getProperties().setProperty(XModelConstants.WORKSPACE, home);
+ model.getProperties().setProperty(XModelConstants.WORKSPACE_OLD, home);
+ model.getProperties().setProperty("nature", getID());
+ model.load();
+ }
+ return;
+ }
model = XModelFactory.getModel(p);
if(model.getService() == null) {
model.setService(createServiceDialog());
17 years, 6 months
JBoss Tools SVN: r8847 - in trunk/ws/tests/org.jboss.tools.ws.core.test: src/org/jboss/tools/ws/core/test/command and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2008-06-19 05:29:01 -0400 (Thu, 19 Jun 2008)
New Revision: 8847
Modified:
trunk/ws/tests/org.jboss.tools.ws.core.test/META-INF/MANIFEST.MF
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java
Log:
JBIDE-2323: add unit test for commands
Modified: trunk/ws/tests/org.jboss.tools.ws.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.core.test/META-INF/MANIFEST.MF 2008-06-19 08:12:32 UTC (rev 8846)
+++ trunk/ws/tests/org.jboss.tools.ws.core.test/META-INF/MANIFEST.MF 2008-06-19 09:29:01 UTC (rev 8847)
@@ -17,5 +17,11 @@
org.jboss.tools.ws.creation.core,
org.eclipse.wst.command.env.ui,
org.eclipse.wst.ws,
- org.jboss.tools.ws.creation.ui
+ org.jboss.tools.ws.creation.ui,
+ org.eclipse.jst.j2ee,
+ org.eclipse.jst.j2ee.core,
+ org.eclipse.emf.common,
+ org.eclipse.jem,
+ org.eclipse.emf.ecore,
+ org.eclipse.wst.server.core
Eclipse-LazyStart: true
Modified: trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java 2008-06-19 08:12:32 UTC (rev 8846)
+++ trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java 2008-06-19 09:29:01 UTC (rev 8847)
@@ -18,22 +18,28 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.j2ee.webapplication.ServletType;
+import org.eclipse.jst.javaee.web.Servlet;
+import org.eclipse.jst.javaee.web.ServletMapping;
+import org.eclipse.jst.javaee.web.WebApp;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.command.internal.env.ui.widgets.DynamicWizard;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.ws.internal.common.WSDLUtility;
+import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.ws.internal.wsrt.IWebService;
import org.eclipse.wst.ws.internal.wsrt.WebServiceInfo;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
@@ -44,11 +50,15 @@
import org.jboss.tools.ws.core.classpath.JbossWSRuntimeManager;
import org.jboss.tools.ws.core.facet.delegate.IJBossWSFacetDataModelProperties;
import org.jboss.tools.ws.core.facet.delegate.JBossWSFacetInstallDataModelProvider;
+import org.jboss.tools.ws.creation.core.commands.ImplementationClassCreationCommand;
import org.jboss.tools.ws.creation.core.commands.InitialCommand;
+import org.jboss.tools.ws.creation.core.commands.MergeWebXMLCommand;
import org.jboss.tools.ws.creation.core.commands.WSDL2JavaCommand;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.ui.wsrt.JBossWebService;
+import com.sun.jmx.remote.internal.ServerCommunicatorAdmin;
+
public class AbstractJBossWSCommandTest extends TestCase {
protected static final IWorkspace ws = ResourcesPlugin.getWorkspace();
protected static final IWorkbench wb = PlatformUI.getWorkbench();
@@ -71,7 +81,7 @@
static String wsdlFileName = "hello_world.wsdl";
static String BUNDLE = "org.jboss.tools.ws.core.test";
- IProject project;
+ IFacetedProject fproject;
TestProjectProvider provider;
static {
@@ -91,6 +101,12 @@
protected void setUp() throws Exception {
super.setUp();
JbossWSRuntimeManager.getInstance().addRuntime(RuntimeName, getJBossWSHomeFolder().toString(), "", true);
+
+ //create jbossws web project
+ fproject = createJBossWSProject("JBossWSTestProject", isServerSupplied());
+ IFile wsdlFile = fproject.getProject().getFile(wsdlFileName);
+
+ assertTrue(wsdlFile.exists());
try { EditorTestHelper.joinBackgroundActivities(); }
catch (Exception e) { JUnitUtils.fail(e.getMessage(), e); }
EditorTestHelper.runEventQueue(3000);
@@ -129,42 +145,123 @@
super.tearDown();
}
- public void testCommands() throws CoreException, ExecutionException{
- IFacetedProject fproject = createJBossWSProject("JBossWSTestProject", false);
+
+ public void testInitialCommand() throws CoreException, ExecutionException{
+
IFile wsdlFile = fproject.getProject().getFile(wsdlFileName);
-
- assertTrue(wsdlFile.exists());
-
ServiceModel model = new ServiceModel();
model.setWebProjectName(fproject.getProject().getName());
- model.setWsdlURI(wsdlFile.getLocation().toOSString());
+ //model.setWsdlURI(wsdlFile.getLocation().toOSString());
WebServiceInfo info = new WebServiceInfo();
- info.setWsdlURL(wsdlFile.getFullPath().toOSString());
+ info.setWsdlURL(wsdlFile.getLocation().toOSString());
IWebService ws = new JBossWebService(info);
//test initial command
- /*InitialCommand cmdInitial = new InitialCommand(model, ws, WebServiceScenario.TOPDOWN);
+ InitialCommand cmdInitial = new InitialCommand(model, ws, WebServiceScenario.TOPDOWN);
IStatus status = cmdInitial.execute(null, null);
assertTrue(status.getMessage(), status.isOK());
assertTrue(model.getServiceNames().contains("SOAPService"));
- assertEquals(wsdlFile.getFullPath().toOSString(), model.getWsdlURI());
+ assertEquals(wsdlFile.getLocation().toOSString(), model.getWsdlURI());
assertTrue(model.getPortTypes().contains("Greeter"));
assertEquals("org.apache.hello_world_soap_http", model.getCustomPackage());
+ }
+
+
+ public void testCodeGenerationCommand() throws ExecutionException{
+
+ ServiceModel model = createServiceModel();
+ IProject project = fproject.getProject();
//test wsdl2Javacommand
-
WSDL2JavaCommand cmdW2j = new WSDL2JavaCommand(model);
- status = cmdW2j.execute(null, null);
- assertTrue("failed to execute WSDL2JavaCommand,namely failed to generate web service code", status.isOK());*/
+ IStatus status = cmdW2j.execute(null, null);
+ assertTrue(status.getMessage(), status.isOK());
+ assertTrue(project.getFile("src/org/apache/hello_world_soap_http/Greeter.java").exists());
+ // test ImplementationClassCreationCommand
+ model.setGenerateImplementatoin(false);
+ ImplementationClassCreationCommand cmdImpl = new ImplementationClassCreationCommand(model);
+ status = cmdImpl.execute(null, null);
+ assertTrue(status.getMessage(), status.isOK());
+ assertFalse(project.getFile("src/org/apache/hello_world_soap_http/GreeterImpl.java").exists());
+ model.setGenerateImplementatoin(true);
+ cmdImpl = new ImplementationClassCreationCommand(model);
+ status = cmdImpl.execute(null, null);
+ assertTrue(status.getMessage(), status.isOK());
+ assertTrue("failed to generate implemenatation class", project.getFile("src/org/apache/hello_world_soap_http/GreeterImpl.java").exists());
+
}
+ public void testMergeWebXMLCommand() throws ExecutionException{
+ ServiceModel model = createServiceModel();
+ model.setGenerateImplementatoin(true);
+ model.setUpdateWebxml(true);
+ model.setWebProjectName(fproject.getProject().getName());
+ model.addServiceClasses("org.apache.hello_world_soap_http.GreeterImpl");
+ MergeWebXMLCommand cmdweb = new MergeWebXMLCommand(model);
+ IStatus status = cmdweb.execute(null, null);
+ assertTrue(status.getMessage(), status.isOK());
+
+ IProject project = fproject.getProject();
+ IFile webxml = project.getFile("WebContent/WEB-INF/web.xml");
+ assertTrue(webxml.exists());
+ IModelProvider provider = ModelProviderManager
+ .getModelProvider(project);
+ Object object = provider.getModelObject();
+ if (object instanceof WebApp) {
+ WebApp webApp = (WebApp) object;
+ assertTrue("failed to update web.xml ", webApp.getServlets().size() > 0);
+ Servlet servlet = (Servlet)webApp.getServlets().get(0);
+ assertEquals("the servlet with the name 'Greeger' was not created", servlet.getServletName(), "Greeter");
+ assertTrue("the servlet display names should contain 'Greeter'", servlet.getDisplayNames().contains("Greeter"));
+ assertEquals("org.apache.hello_world_soap_http.GreeterImpl", servlet.getServletClass());
+
+ ServletMapping mapping = (ServletMapping)webApp.getServletMappings().get(0);
+ assertTrue("url patterns should contain '/Greeter'", mapping.getUrlPatterns().contains("/Greeter"));
+ assertEquals("Greeter", mapping.getServletName());
+ }else if(object instanceof org.eclipse.jst.j2ee.webapplication.WebApp){
+ org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) object;
+ assertTrue("failed to update web.xml ", webApp.getServlets().size() > 0);
+ org.eclipse.jst.j2ee.webapplication.Servlet servlet = (org.eclipse.jst.j2ee.webapplication.Servlet)webApp.getServlets().get(0);
+ assertEquals("a servlet with the name 'Greeger' should be created", servlet.getServletName(), "Greeter");
+ assertEquals("servlet display name:","Greeter", servlet.getDisplayName());
+ if(servlet.getWebType() instanceof ServletType){
+ ServletType webtype = (ServletType)servlet.getWebType();
+ assertEquals("org.apache.hello_world_soap_http.GreeterImpl", webtype.getClassName());
+ }
+
+ org.eclipse.jst.j2ee.webapplication.ServletMapping mapping = (org.eclipse.jst.j2ee.webapplication.ServletMapping)webApp.getServletMappings().get(0);
+ assertEquals("url pattern: ","/Greeter", mapping.getUrlPattern());
+ assertEquals("Greeter", mapping.getServlet().getServletName());
+ }
+
+
+ }
+
+ protected ServiceModel createServiceModel(){
+ ServiceModel model = new ServiceModel();
+ model.setWebProjectName(fproject.getProject().getName());
+ IFile wsdlFile = fproject.getProject().getFile(wsdlFileName);
+ model.setWsdlURI(wsdlFile.getLocation().toOSString());
+ model.addServiceName("SOAPService");
+ model.addPortTypes("Greeter");
+ model.setCustomPackage("org.apache.hello_world_soap_http");
+
+ return model;
+
+ }
+
+ protected boolean isServerSupplied(){
+ return true;
+ }
+
+
protected IFacetedProject createJBossWSProject(String baseProjectName, boolean isServerSupplied) throws CoreException {
IProject project = createProject("JBossWSTestProject");
final IFacetedProject fproj = ProjectFacetsManager.create(project);
@@ -211,15 +308,18 @@
protected File getJBossWSHomeFolder() {
- return new File(System.getProperty(JBOSSWS_HOME, JBOSSWS_HOME_DEFAULT));
+
+ String jbosshome = System.getProperty("jbosstools.test.jboss.home.4.2", JBOSSWS_HOME_DEFAULT);
+ File runtimelocation = new File(jbosshome);
+ assertTrue("Please set Jboss EAP Home in system property:" + JBOSSWS_HOME, runtimelocation.exists());
+
+ String cmdFileLocation = jbosshome + File.separator + "bin" + File.separator + "wsconsume.sh";
+ assertTrue(jbosshome + " is not a valid jboss EAP home", new File(cmdFileLocation).exists());
+ return runtimelocation;
}
- protected String getPackagePath(String packageName) {
- return (packageName == null ? "" : packageName.replace('.', '/'));
- }
-
-
+
}
17 years, 6 months
JBoss Tools SVN: r8846 - in trunk/ws/plugins: org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2008-06-19 04:12:32 -0400 (Thu, 19 Jun 2008)
New Revision: 8846
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JBossWSFacetInstallDataModelProvider.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF
Log:
JBIDE-2370: set servlet name to the port typename in the wsdl file,
prompt error message dialog while generating code failure
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JBossWSFacetInstallDataModelProvider.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JBossWSFacetInstallDataModelProvider.java 2008-06-19 08:05:07 UTC (rev 8845)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JBossWSFacetInstallDataModelProvider.java 2008-06-19 08:12:32 UTC (rev 8846)
@@ -13,6 +13,7 @@
import java.util.Set;
import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
public class JBossWSFacetInstallDataModelProvider extends
@@ -54,5 +55,7 @@
return super.getDefaultProperty(propertyName);
}
-
+ public Object create() {
+ return DataModelFactory.createDataModel(this);
+ }
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java 2008-06-19 08:05:07 UTC (rev 8845)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java 2008-06-19 08:12:32 UTC (rev 8846)
@@ -57,6 +57,7 @@
/*
* just ensure that the file is a readable xml file to avoid breaking code generation
+ * so the xml file is not validated with xml schema
*/
private IStatus validateXMLFile(XMLReader reader, String filename){
try {
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2008-06-19 08:05:07 UTC (rev 8845)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2008-06-19 08:12:32 UTC (rev 8846)
@@ -349,7 +349,10 @@
PrimitiveType.BOOLEAN)) {
BooleanLiteral bl = ast.newBooleanLiteral(false);
rs.setExpression(bl);
- } else {
+ }else if(((PrimitiveType) returnType).getPrimitiveTypeCode().equals(
+ PrimitiveType.VOID)) {
+ // do nothing
+ }else {
NumberLiteral nl = ast.newNumberLiteral();
nl.setToken("0");
rs.setExpression(nl);
@@ -363,9 +366,7 @@
StringLiteral sl = ast.newStringLiteral();
sl.setLiteralValue("");
rs.setExpression(sl);
- } else if("void".equals(typeName)){
- // do nothing
- }else{
+ } else{
rs.setExpression(ast.newNullLiteral());
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2008-06-19 08:05:07 UTC (rev 8845)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2008-06-19 08:12:32 UTC (rev 8846)
@@ -135,8 +135,12 @@
private ServletDescriptor getServletDescriptor(String clsName) {
+ String servletName = JBossWSCreationUtils.classNameFromQualifiedName(clsName);
+ if(servletName.endsWith("Impl") && servletName.length() > 4){
+ servletName = servletName.substring(0, servletName.length() - 4);
+ }
ServletDescriptor sd = new ServletDescriptor();
- sd._name = JBossWSCreationUtils.classNameFromQualifiedName(clsName);
+ sd._name = servletName;
sd._displayName = sd._name;
sd._className = clsName;
sd._mappings = JBossWSCreationCoreMessages.Separator_Java + sd._name;
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java 2008-06-19 08:05:07 UTC (rev 8845)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java 2008-06-19 08:12:32 UTC (rev 8846)
@@ -80,7 +80,17 @@
}
// log the result of the command execution
- JBossWSCreationCore.getDefault().logInfo(convertInputStreamToString(proc.getInputStream()));
+ String resultOutput = convertInputStreamToString(proc.getInputStream());
+ if(resultOutput != null && resultOutput.indexOf("[ERROR]") >= 0){
+ JBossWSCreationCore.getDefault().logError(resultOutput);
+ IStatus errorStatus = StatusUtils.errorStatus(resultOutput);
+ status = StatusUtils
+ .errorStatus(
+ JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
+ new CoreException(errorStatus));
+ }else{
+ JBossWSCreationCore.getDefault().logInfo(resultOutput);
+ }
} catch (IOException e) {
JBossWSCreationCore.getDefault().logError(e);
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-06-19 08:05:07 UTC (rev 8845)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-06-19 08:12:32 UTC (rev 8846)
@@ -12,7 +12,7 @@
Error_Message_Invalid_Binding_File={0} is not a valid JAX-WS or JAXB binding file
Error_Read_Binding_File=Exception occurred while reading binding file
-Error_Message_Failed_To_Generate_Code=Failed to Generate code, please read the log for more details
+Error_Message_Failed_To_Generate_Code=Failed to Generate Web Service code, please check the log for more details
Error_Message_Failed_to_Generate_Implementation=Failed to generate implementation class
Error_Message_Command_File_Not_Found=The command file: "{0}" does not exist, please check the JBoss Web Service runtime setting to make sure the location of JBoss Web Service runtime is valid.
Error_Message_Execute_Command=Exception occurred while execute JBossWS tool command
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF 2008-06-19 08:05:07 UTC (rev 8845)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF 2008-06-19 08:12:32 UTC (rev 8846)
@@ -26,3 +26,4 @@
org.eclipse.wst.common.project.facet.ui,
org.jboss.tools.ws.ui
Eclipse-LazyStart: true
+Export-Package: org.jboss.tools.ws.creation.ui.wsrt
17 years, 6 months
JBoss Tools SVN: r8845 - trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2008-06-19 04:05:07 -0400 (Thu, 19 Jun 2008)
New Revision: 8845
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
Log:
JBIDE-2369: fixed a nullpointerexception
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2008-06-19 06:04:51 UTC (rev 8844)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2008-06-19 08:05:07 UTC (rev 8845)
@@ -284,9 +284,10 @@
public static String getJbossWSRuntimeLocation(IProject project) throws CoreException{
String isServerSupplied = project.getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_SERVER_SUPPLIED_RUNTIME);
- if(isServerSupplied != null &&
+ String jbwsRuntimeName = project.getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME);
+
+ if(jbwsRuntimeName != null &&
!IJBossWSFacetDataModelProperties.DEFAULT_VALUE_IS_SERVER_SUPPLIED.equals(isServerSupplied)){
- String jbwsRuntimeName = project.getPersistentProperty(IJBossWSFacetDataModelProperties.PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME);
JbossWSRuntime jbws = JbossWSRuntimeManager.getInstance().findRuntimeByName(jbwsRuntimeName);
if(jbws != null){
return jbws.getHomeDir();
@@ -300,9 +301,8 @@
IFacetedProject facetedPrj = ProjectFacetsManager.create(project);
org.eclipse.wst.common.project.facet.core.runtime.IRuntime prjFacetRuntime = facetedPrj.getPrimaryRuntime();
- IRuntime serverRuntime = getRuntime(prjFacetRuntime);
-
- if(serverRuntime != null){
+ if(prjFacetRuntime != null){
+ IRuntime serverRuntime = getRuntime(prjFacetRuntime);
String runtimeTypeName = serverRuntime.getRuntimeType().getName();
if(runtimeTypeName == null){
runtimeTypeName = "";
17 years, 6 months