JBoss Tools SVN: r11792 - trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-11-14 12:33:34 -0500 (Fri, 14 Nov 2008)
New Revision: 11792
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
Log:
corrected test
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2008-11-14 15:40:08 UTC (rev 11791)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2008-11-14 17:33:34 UTC (rev 11792)
@@ -34,10 +34,12 @@
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.VpeEditorPart;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
+import org.jboss.tools.vpe.editor.mapping.VpeElementMapping;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
import org.jboss.tools.vpe.editor.util.SelectionUtil;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -343,7 +345,18 @@
TestUtil.delay(50);
assertNotNull(xulRunnerEditor.getLastSelectedNode());
- assertEquals(nodeMapping.getVisualNode(), xulRunnerEditor
+
+ nsIDOMNode sample;
+ if (nodeMapping.getSourceNode().getNodeType() == Node.TEXT_NODE
+ && ((VpeElementMapping) nodeMapping).getElementData() != null) {
+
+ sample = ((VpeElementMapping) nodeMapping).getElementData().getNodesData().get(0).getVisualNode();
+ }
+ else {
+ sample = nodeMapping.getVisualNode();
+ }
+
+ assertEquals(sample, xulRunnerEditor
.getLastSelectedNode());
}
}
17 years, 5 months
JBoss Tools SVN: r11791 - in trunk: vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-11-14 10:40:08 -0500 (Fri, 14 Nov 2008)
New Revision: 11791
Modified:
trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/proxy/VpeNodeInvocationHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/IELService.java
Log:
JBIDE-3144
Modified: trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java 2008-11-14 15:39:37 UTC (rev 11790)
+++ trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java 2008-11-14 15:40:08 UTC (rev 11791)
@@ -53,10 +53,15 @@
}
return -1;
}
-
+ /**
+ * Returns all resources for current file
+ * @param file
+ * @return
+ */
public ResourceReference[] getAllResources(IFile file) {
- Set locations = new HashSet();
- List css = new ArrayList();
+ Set<String> locations = new HashSet<String>();
+ List<ResourceReference> css = new ArrayList<ResourceReference>();
+
if(file.getProject() != null) {
String[] dcss = getDeclaredResources(file.getProject());
for (int i = 0; i < dcss.length; i++) {
@@ -86,7 +91,7 @@
locations.add(dcss[i]);
css.add(ref);
}
- return (ResourceReference[])css.toArray(new ResourceReference[0]);
+ return css.toArray(new ResourceReference[0]);
}
private String[] getDeclaredResources(IResource resource) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java 2008-11-14 15:39:37 UTC (rev 11790)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java 2008-11-14 15:40:08 UTC (rev 11791)
@@ -72,12 +72,12 @@
//FIX FOR JBIDE-1568, added by Max Areshkau
try {
- if (ElService.getInstance().isCloneableNode(getPageContext(), sourceNode)) {
- final Node sourceNodeClone = VpeProxyUtil.createProxyForELExpressionNode(getPageContext(),
+ if (ElService.getInstance().isELNode(getPageContext(), sourceNode)) {
+ final Node sourceNodeProxy = VpeProxyUtil.createProxyForELExpressionNode(getPageContext(),
sourceNode);
try {
creationData = template.create(getPageContext(),
- sourceNodeClone, getVisualDocument());
+ sourceNodeProxy, getVisualDocument());
//Fix for JBIDE-3144, we use proxy and some template can
//try to cast for not supported interface
} catch(ClassCastException ex) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-11-14 15:39:37 UTC (rev 11790)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-11-14 15:40:08 UTC (rev 11791)
@@ -437,23 +437,23 @@
sourceNode, ifDependencySet);
VpeCreationData creationData = null;
- Node sourceNodeClone = null;
+ Node sourceNodeProxy = null;
// FIX FOR JBIDE-1568, added by Max Areshkau
try {
- if (ElService.getInstance().isCloneableNode(getPageContext(),
+ if (ElService.getInstance().isELNode(getPageContext(),
sourceNode)) {
- sourceNodeClone = VpeProxyUtil.createProxyForELExpressionNode(getPageContext(),
+ sourceNodeProxy = VpeProxyUtil.createProxyForELExpressionNode(getPageContext(),
sourceNode);
try {
creationData = template.create(getPageContext(),
- sourceNodeClone, getVisualDocument());
+ sourceNodeProxy, getVisualDocument());
//Fix for JBIDE-3144, we use proxy and some template can
//try to cast for not supported interface
} catch(ClassCastException ex) {
VpePlugin.reportProblem(ex);
- sourceNodeClone = null;
+ sourceNodeProxy = null;
//then we create template without using proxy
creationData = template.create(getPageContext(), sourceNode,
getVisualDocument());
@@ -520,7 +520,7 @@
final VpeElementData data = creationData.getElementData();
- if ((sourceNodeClone != null) && (data != null)
+ if ((sourceNodeProxy != null) && (data != null)
&& (data.getNodesData() != null)
&& (data.getNodesData().size() > 0)) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/proxy/VpeNodeInvocationHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/proxy/VpeNodeInvocationHandler.java 2008-11-14 15:39:37 UTC (rev 11790)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/proxy/VpeNodeInvocationHandler.java 2008-11-14 15:40:08 UTC (rev 11791)
@@ -52,12 +52,18 @@
}
return result;
}
-
- protected String replaceEL(String toReplace) {
+ /**
+ * Replaced string with el value
+ * @param toReplace
+ * @return
+ */
+ private String replaceEL(String toReplace) {
+
String result = toReplace;
-
- //fix for JBIDE-3030
+
result = ResourceUtil.getBundleValue(pageContext, toReplace);
+
+ //fix for JBIDE-3030
if(pageContext.getVisualBuilder().getCurrentIncludeInfo()==null) {
return result;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java 2008-11-14 15:39:37 UTC (rev 11790)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java 2008-11-14 15:40:08 UTC (rev 11791)
@@ -138,7 +138,7 @@
*
* @return true, if is cloneable node
*/
- public boolean isCloneableNode(VpePageContext pageContext,Node sourceNode) {
+ public boolean isELNode(VpePageContext pageContext,Node sourceNode) {
boolean rst = false;
// fix for JBIDE-3030
if(pageContext.getVisualBuilder().getCurrentIncludeInfo()==null) {
@@ -187,9 +187,6 @@
}
}
}
-// }else if ((sourceNode.getFirstChild() != null) && (sourceNode.getFirstChild().getNodeType() == Node.TEXT_NODE)) {
-// textValue = sourceNode.getFirstChild().getNodeValue();
-// }
if (!rst) {
final NamedNodeMap nodeMap = sourceNode.getAttributes();
@@ -237,19 +234,10 @@
*/
private boolean findForNode(Node sourceNode, IFile resourceFile) {
boolean rst = false;
- final NamedNodeMap nodeMap = sourceNode.getAttributes();
final ResourceReference[] references = getAllResources(resourceFile);
- //ELReferenceList.getInstance().getAllResources(resourceFile);
String textValue = null;
- if (sourceNode.getNodeType() == Node.TEXT_NODE/*
- * sourceNode.getFirstChild
- * () != null &&
- * sourceNode
- * .getFirstChild
- * ().getNodeType() ==
- * Node.TEXT_NODE
- */) {
+ if (sourceNode.getNodeType() == Node.TEXT_NODE) {
textValue = sourceNode.getNodeValue();
if (textValue != null) {
if (isInReferenceResourcesList(references, textValue)) {
@@ -257,12 +245,12 @@
}
}
}
-
+ final NamedNodeMap nodeMap = sourceNode.getAttributes();
if ((nodeMap != null) && (nodeMap.getLength() > 0)) {
for (int i = 0; i < nodeMap.getLength(); i++) {
if (isInReferenceResourcesList(references, ((Attr) nodeMap.item(i)).getValue())) {
- rst = true;
- break;
+ return true;
+
}
}
}
@@ -286,10 +274,6 @@
//FIXED FOR JBIDE-3149 by sdzmitrovich
if (equalsExppression(value, ref.getLocation()))
return true;
-
-// if (value.contains(ref.getLocation())) {
-// rst = true;
-// }
}
return rst;
}
@@ -331,20 +315,14 @@
int size = (gResources == null ? 0 : gResources.length);
size += (elResources == null ? 0 : elResources.length);
rst = new ResourceReference[size];
- int counter = 0;
+
if ((gResources != null) && (gResources.length > 0)) {
- for (ResourceReference r : gResources) {
- rst[counter] = r;
- counter++;
- }
+ System.arraycopy(gResources, 0, rst,0, gResources.length);
}
if ((elResources != null) && (elResources.length > 0)) {
- for (ResourceReference r : elResources) {
- rst[counter] = r;
- counter++;
- }
+ System.arraycopy(elResources, 0, rst, gResources==null?0:gResources.length, elResources.length);
}
-
+
return rst;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/IELService.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/IELService.java 2008-11-14 15:39:37 UTC (rev 11790)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/IELService.java 2008-11-14 15:40:08 UTC (rev 11791)
@@ -14,8 +14,6 @@
import org.eclipse.core.resources.IFile;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -36,7 +34,6 @@
*
* @return string where el values was substituted.
*/
- //@Deprecated
String replaceEl(IFile resourceFile, String resourceString);
/**
@@ -71,14 +68,15 @@
boolean isAvailable(IFile resourceFile);
/**
- * Checks if is cloneable node.
+ * Checks if is node contains el expressions which should be replaced
+ * from el or from resource bundles.
*
* @param sourceNode the source node
* @param pageContext the page context
*
* @return true, if is cloneable node
*/
- public boolean isCloneableNode(VpePageContext pageContext, Node sourceNode);
+ public boolean isELNode(VpePageContext pageContext, Node sourceNode);
/**
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java 2008-11-14 15:39:37 UTC (rev 11790)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java 2008-11-14 15:40:08 UTC (rev 11791)
@@ -43,7 +43,7 @@
nsIDOMNode visualNewTextNode = visualDocument
.createTextNode(visualText);
- //TODO Max Areshkau think may be we shouldn't use span
+ //Max Areshkau without this span, we can't select text element
nsIDOMElement element = visualDocument.createElement(HTML.TAG_SPAN);
element.appendChild(visualNewTextNode);
17 years, 5 months
JBoss Tools SVN: r11790 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2008-11-14 10:39:37 -0500 (Fri, 14 Nov 2008)
New Revision: 11790
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java
Log:
CODING IN PROGRESS - issue JBIDE-2877: <rich:dataTable>, <rich:column> interaction
https://jira.jboss.org/jira/browse/JBIDE-2877
Item #2 has been fixed: "Incorrect position of footer and header paths of <rich:column> (see screenshot-3)".
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java 2008-11-14 15:13:23 UTC (rev 11789)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java 2008-11-14 15:39:37 UTC (rev 11790)
@@ -63,9 +63,9 @@
encodeCaption(creationData, sourceElement, visualDocument, table);
// Encode Header
- Node header = ComponentUtil.getFacet((Element)sourceElement, RichFaces.NAME_FACET_HEADER,true);
- ArrayList<Element> columnsHeaders = getColumnsWithFacet(columns, RichFaces.NAME_FACET_HEADER);
- if(header!=null || !columnsHeaders.isEmpty()) {
+ Node header = ComponentUtil.getFacet((Element)sourceElement, RichFaces.NAME_FACET_HEADER,true);
+ final boolean hasColumnWithHeader = hasColumnWithFacet(columns, RichFaces.NAME_FACET_HEADER);
+ if(header!=null || hasColumnWithHeader) {
nsIDOMElement thead = visualDocument.createElement(HTML.TAG_THEAD);
table.appendChild(thead);
String headerClass = (String) sourceElement.getAttribute(RichFaces.ATTR_HEADER_CLASS);
@@ -76,14 +76,14 @@
"dr-table-headercell rich-table-headercell", //$NON-NLS-1$
headerClass, HTML.TAG_TD);
}
- if(!columnsHeaders.isEmpty()) {
+ if(hasColumnWithHeader) {
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
thead.appendChild(tr);
String styleClass = encodeStyleClass(null, "dr-table-subheader rich-table-subheader", null, headerClass); //$NON-NLS-1$
if(styleClass!=null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
- encodeHeaderOrFooterFacets(pageContext, creationData, tr, visualDocument, columnsHeaders,
+ encodeHeaderOrFooterFacets(pageContext, creationData, tr, visualDocument, columns,
"dr-table-subheadercell rich-table-subheadercell", //$NON-NLS-1$
headerClass, RichFaces.NAME_FACET_HEADER, HTML.TAG_TD);
}
@@ -91,19 +91,19 @@
// Encode Footer
Element footer = ComponentUtil.getFacet(sourceElement, RichFaces.NAME_FACET_FOOTER);
- ArrayList<Element> columnsFooters = getColumnsWithFacet(columns, RichFaces.NAME_FACET_FOOTER);
- if (footer != null || !columnsFooters.isEmpty()) {
+ final boolean hasColumnWithFooter = hasColumnWithFacet(columns, RichFaces.NAME_FACET_FOOTER);
+ if (footer != null || hasColumnWithFooter) {
nsIDOMElement tfoot = visualDocument.createElement(HTML.TAG_TFOOT);
table.appendChild(tfoot);
String footerClass = (String) sourceElement.getAttribute(RichFaces.ATTR_FOOTER_CLASS);
- if(!columnsFooters.isEmpty()) {
+ if(hasColumnWithFooter) {
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
tfoot.appendChild(tr);
String styleClass = encodeStyleClass(null, "dr-table-subfooter rich-table-subfooter", null, footerClass); //$NON-NLS-1$
if(styleClass!=null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
- encodeHeaderOrFooterFacets(pageContext, creationData, tr, visualDocument, columnsFooters,
+ encodeHeaderOrFooterFacets(pageContext, creationData, tr, visualDocument, columns,
"dr-table-subfootercell rich-table-subfootercell", //$NON-NLS-1$
footerClass, RichFaces.NAME_FACET_FOOTER, HTML.TAG_TD);
}
@@ -236,15 +236,19 @@
return columns;
}
- public static ArrayList<Element> getColumnsWithFacet(ArrayList<Element> columns, String facetName) {
- ArrayList<Element> columnsWithFacet = new ArrayList<Element>();
+ /**
+ * Returns true if and only if {@code columns} contains at least one column that have facet
+ * with given {@code facetName}.
+ */
+ public static boolean hasColumnWithFacet(ArrayList<Element> columns, String facetName) {
for (Element column : columns) {
- Node body = ComponentUtil.getFacet(column, facetName,true);
+ Node body = ComponentUtil.getFacet(column, facetName, true);
if(body!=null) {
- columnsWithFacet.add(column);
+ return true;
}
}
- return columnsWithFacet;
+
+ return false;
}
public static String encodeStyleClass(Object parentPredefined, Object predefined, Object parent, Object custom) {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java 2008-11-14 15:13:23 UTC (rev 11789)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java 2008-11-14 15:39:37 UTC (rev 11790)
@@ -203,15 +203,16 @@
final Element sourceElement, final nsIDOMDocument visualDocument, final nsIDOMElement parentVisualNode,
final String facetName, final String trClass, final String tdClass) {
final ArrayList<Element> columns = RichFacesDataTableTemplate.getColumns(sourceElement);
- final ArrayList<Element> columnsHeaders = RichFacesDataTableTemplate.getColumnsWithFacet(columns, facetName);
- if(!columnsHeaders.isEmpty()) {
+ //final ArrayList<Element> columnsHeaders = RichFacesDataTableTemplate.getColumnsWithFacet(columns, facetName);
+ final boolean hasColumnWithFacet = RichFacesDataTableTemplate.hasColumnWithFacet(columns, facetName);
+ if(hasColumnWithFacet) {
final nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
parentVisualNode.appendChild(tr);
final String styleClass = trClass;
if(styleClass!=null) {
tr.setAttribute(HTML.ATTR_CLASS, styleClass);
}
- RichFacesDataTableTemplate.encodeHeaderOrFooterFacets(pageContext, creationData, tr, visualDocument, columnsHeaders,
+ RichFacesDataTableTemplate.encodeHeaderOrFooterFacets(pageContext, creationData, tr, visualDocument, columns,
tdClass,
null, facetName, HTML.TAG_TD);
}
17 years, 5 months
JBoss Tools SVN: r11789 - in trunk/common/plugins/org.jboss.tools.common.model.ui: src/org/jboss/tools/common/model/ui/attribute and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-11-14 10:13:23 -0500 (Fri, 14 Nov 2008)
New Revision: 11789
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultTreeSelectionContentAssistProvider.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/AttributeContentProposalProviderFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultTreeSelectionAdapter.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringButtonFieldEditorEx.java
Log:
JBIDE-2575
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-11-14 14:25:13 UTC (rev 11788)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-11-14 15:13:23 UTC (rev 11789)
@@ -494,4 +494,9 @@
pattern="org\.jboss\.tools\.jst\.web\.ui/.*SaveProjectAsTemplateActionDelegate"/>
</extension>
+ <extension
+ point="org.jboss.tools.common.model.ui.attributeContentProposalProviders">
+ <provider class="org.jboss.tools.common.model.ui.attribute.adapter.DefaultTreeSelectionContentAssistProvider"/>
+ </extension>
+
</plugin>
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/AttributeContentProposalProviderFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/AttributeContentProposalProviderFactory.java 2008-11-14 14:25:13 UTC (rev 11788)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/AttributeContentProposalProviderFactory.java 2008-11-14 15:13:23 UTC (rev 11789)
@@ -129,6 +129,27 @@
return result;
}
+
+ public static IContentProposal makeContentProposal(final String proposal, final String label) {
+ return new IContentProposal() {
+ public String getContent() {
+ return proposal;
+ }
+
+ public String getDescription() {
+ return null;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public int getCursorPosition() {
+ return proposal.length();
+ }
+ };
+ }
+
}
/**
@@ -153,7 +174,7 @@
ArrayList<IContentProposal> ps = new ArrayList<IContentProposal>();
if(position <= contents.length() && position > 3 && "test".equals(contents.substring(position - 4, position))) {
- ps.add(makeContentProposal("aaa", ".aaa"));
+ ps.add(AttributeContentProposalProviderFactory.makeContentProposal("aaa", ".aaa"));
}
return ps.toArray(new IContentProposal[0]);
@@ -170,25 +191,4 @@
public void dispose() {
}
- private IContentProposal makeContentProposal(final String proposal, final String label) {
- return new IContentProposal() {
- public String getContent() {
- return proposal;
- }
-
- public String getDescription() {
- return null;
- }
-
- public String getLabel() {
- return label;
- }
-
- public int getCursorPosition() {
- return proposal.length();
- }
- };
- }
-
-
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultTreeSelectionAdapter.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultTreeSelectionAdapter.java 2008-11-14 14:25:13 UTC (rev 11788)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultTreeSelectionAdapter.java 2008-11-14 15:13:23 UTC (rev 11789)
@@ -87,7 +87,9 @@
if (adapter == IActionProvider.class) {
return getActionProvider();
}
+
if(adapter == IContentAssistProcessor.class) {
+ //deprecated, replaced by AttributeContentProposalProviderFactory
DefaultTreeSelectionContentAssistProcessor processor = new DefaultTreeSelectionContentAssistProcessor();
ITreeContentProvider tree = getTreeContentProvider();
if(tree instanceof DefaultXAttributeTreeContentProvider) {
@@ -97,6 +99,7 @@
return null;
}
}
+
Assert.isTrue(true, "DefaultTreeSelectionAdapter instance itself cannot provide adapter for "+adapter.getName());
return null;
}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultTreeSelectionContentAssistProvider.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultTreeSelectionContentAssistProvider.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/DefaultTreeSelectionContentAssistProvider.java 2008-11-14 15:13:23 UTC (rev 11789)
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.model.ui.attribute.adapter;
+
+import java.util.*;
+import org.eclipse.jface.fieldassist.ContentProposalAdapter;
+import org.eclipse.jface.fieldassist.IContentProposal;
+import org.eclipse.jface.fieldassist.IContentProposalProvider;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.common.meta.XAttribute;
+import org.jboss.tools.common.model.*;
+import org.jboss.tools.common.model.ui.attribute.AttributeContentProposalProviderFactory;
+import org.jboss.tools.common.model.ui.attribute.IAttributeContentProposalProvider;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+
+public class DefaultTreeSelectionContentAssistProvider implements IAttributeContentProposalProvider {
+ XModelObject object;
+ XAttribute attribute;
+
+ DefaultXAttributeTreeContentProvider treeProvider;
+
+ public DefaultTreeSelectionContentAssistProvider() {}
+
+ public boolean isRelevant(XModelObject object, XAttribute attribute) {
+ if(object == null) {
+ //TODO it looks like we need to pass model, if we do not have object
+ return false;
+ }
+ String editor = attribute.getEditor().getName();
+ return editor != null && editor.startsWith("Tree");
+ }
+
+ void addAttributeValueProposals(List<IContentProposal> proposalsList, String text, int offset) {
+ if(treeProvider == null) return;
+ XFilteredTree tree = treeProvider.getFilteredTree();
+ if(tree == null) {
+ treeProvider.getElements(null);
+ tree = treeProvider.getFilteredTree();
+ }
+ if(tree == null) return;
+ XModelObject root = tree.getRoot();
+ if(root == null) return;
+ String startText = text.substring(0, offset);
+ Map<String,Image> pathsMap = new TreeMap<String,Image>();
+ collectPaths(startText, root, tree, pathsMap);
+ String[] paths = pathsMap.keySet().toArray(new String[0]);
+ if(paths.length == 1 && text.startsWith(paths[0])) {
+ pathsMap = new TreeMap<String,Image>();
+ collectPaths(paths[0], root, tree, pathsMap);
+ paths = (String[])pathsMap.keySet().toArray(new String[0]);
+ }
+ for (int i = 0; i < paths.length; i++) {
+ String label = paths[i];
+ String replacementString = paths[i];
+ if(text.startsWith(replacementString)) {
+// replacementString = "";
+ }
+
+ IContentProposal proposal = AttributeContentProposalProviderFactory.makeContentProposal(replacementString, replacementString);
+
+ proposalsList.add(proposal);
+ }
+ }
+
+ void collectPaths(String startText, XModelObject object, XFilteredTree tree, Map<String,Image> map) {
+ String value = tree.getValue(object);
+ if(value != null && value.startsWith(startText)) {
+ if(value.length() > 0) {
+ if(value.equals(startText) && value.endsWith("/")) {
+ //skip this value
+ } else {
+ map.put(value, EclipseResourceUtil.getImage(object));
+ }
+ }
+ if(value.length() > startText.length()) return;
+ } else if(value != null && !startText.startsWith(value)) {
+ return;
+ }
+ XModelObject[] cs = tree.getChildren(object);
+ for (int i = 0; i < cs.length; i++) collectPaths(startText, cs[i], tree, map);
+ }
+
+ public IContentProposalProvider getContentProposalProvider() {
+ return new ContentProposalProvider();
+ }
+
+ public int getProposalAcceptanceStyle() {
+ return ContentProposalAdapter.PROPOSAL_REPLACE;
+ }
+
+ public void init(XModelObject object, XAttribute attribute) {
+ this.object = object;
+ this.attribute = attribute;
+ treeProvider = new DefaultXAttributeTreeContentProvider(attribute, object.getModel(), object);
+ }
+
+ public void dispose() {
+ object = null;
+ attribute = null;
+ treeProvider = null;
+ }
+
+ class ContentProposalProvider implements IContentProposalProvider {
+
+ public IContentProposal[] getProposals(String contents, int position) {
+ List<IContentProposal> proposalsList = new ArrayList<IContentProposal>();
+ addAttributeValueProposals(proposalsList, contents, position);
+ return proposalsList.toArray(new IContentProposal[0]);
+ }
+
+ }
+
+}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringButtonFieldEditorEx.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringButtonFieldEditorEx.java 2008-11-14 14:25:13 UTC (rev 11788)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringButtonFieldEditorEx.java 2008-11-14 15:13:23 UTC (rev 11789)
@@ -285,12 +285,13 @@
getLabelAction().setEnabled((value!=null && value.length()>0));
}
}
+
+// deprecated - now addContentAssist works
+// IContentAssistProcessor processor = (IContentAssistProcessor)propertyEditor.getAdapter(IContentAssistProcessor.class);
+// if(processor != null) {
+// ControlContentAssistHelper.createTextContentAssistant(getTextField(), processor);
+// }
- IContentAssistProcessor processor = (IContentAssistProcessor)propertyEditor.getAdapter(IContentAssistProcessor.class);
- if(processor != null) {
- ControlContentAssistHelper.createTextContentAssistant(getTextField(), processor);
- }
-
return composite;
}
17 years, 5 months
JBoss Tools SVN: r11788 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataTable.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2008-11-14 09:25:13 -0500 (Fri, 14 Nov 2008)
New Revision: 11788
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataTable/dataTable.css
Log:
CODING IN PROGRESS - issue JBIDE-2877: <rich:dataTable>, <rich:column> interaction
https://jira.jboss.org/jira/browse/JBIDE-2877
Item #1 has been fixed: "Incorrect behavior of "styleClass" attribute of <rich:dataTable> with the footer of <rich:column>. StyleClass aren't applied correctly to footer path (see screenshot-1) in VPE."
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataTable/dataTable.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataTable/dataTable.css 2008-11-14 13:58:31 UTC (rev 11787)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/dataTable/dataTable.css 2008-11-14 14:25:13 UTC (rev 11788)
@@ -50,6 +50,10 @@
background-color: #F1EEE9;
}
+.dr-table-subfooter {
+ background-color:#F1F1F1;
+}
+
.dr-table-subheadercell {
border-right: 1px solid;
border-bottom: 1px solid;
17 years, 5 months
JBoss Tools SVN: r11787 - in trunk/seam/plugins/org.jboss.tools.seam.ui: src/org/jboss/tools/seam/ui/views/properties and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-11-14 08:58:31 -0500 (Fri, 14 Nov 2008)
New Revision: 11787
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java
Log:
JBIDE-2575
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-11-14 13:53:08 UTC (rev 11786)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-11-14 13:58:31 UTC (rev 11787)
@@ -631,4 +631,9 @@
class="org.jboss.tools.seam.ui.refactoring.SeamComponentRenameHandler"/>
</extension-->
-</plugin>
\ No newline at end of file
+ <extension
+ point="org.jboss.tools.common.model.ui.attributeContentProposalProviders">
+ <provider class="org.jboss.tools.seam.ui.views.properties.SeamELAttributeContentProposalProvider"/>
+ </extension>
+
+</plugin>
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java 2008-11-14 13:53:08 UTC (rev 11786)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java 2008-11-14 13:58:31 UTC (rev 11787)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.seam.ui.views.properties;
import java.util.ArrayList;
@@ -22,6 +32,9 @@
import org.jboss.tools.seam.internal.core.el.SeamELCompletionEngine;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
+/**
+ * @author Viacheslav Kabanovich
+ */
public class SeamELAttributeContentProposalProvider implements
IAttributeContentProposalProvider {
XModelObject object;
@@ -29,15 +42,23 @@
IFile file;
SeamELCompletionEngine engine;
- public void dispose() {
- object = null;
- attribute = null;
- file = null;
- engine = null;
+ public boolean isRelevant(XModelObject object, XAttribute attribute) {
+ if(attribute == null) {
+ return false;
+ }
+ String module = attribute.getModelEntity().getModule();
+ if(module == null || !module.startsWith("Seam")) {
+ return false;
+ }
+ String entity = attribute.getModelEntity().getName();
+ if(entity.startsWith("File")) {
+ return false;
+ }
+ return true;
}
public IContentProposalProvider getContentProposalProvider() {
- if(file == null) return null;
+ if(file == null || engine == null) return null;
return new ContentProposalProvider();
}
@@ -87,7 +108,7 @@
List<String> suggestions = null;
try {
- suggestions = engine.getCompletions(file, null, prefix, position, true, null, 0, contents.length());
+ suggestions = engine.getCompletions(file, null, prefix, position, false, null, 0, contents.length());
} catch (BadLocationException e) {
SeamGuiPlugin.getPluginLog().logError(e);
}
@@ -142,4 +163,12 @@
ELInvocationExpression expr = ELUtil.findExpression(model1, el.length());
return (expr != null);
}
+
+ public void dispose() {
+ object = null;
+ attribute = null;
+ file = null;
+ engine = null;
+ }
+
}
17 years, 5 months
JBoss Tools SVN: r11786 - in trunk/common/plugins/org.jboss.tools.common.model.ui: schema and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-11-14 08:53:08 -0500 (Fri, 14 Nov 2008)
New Revision: 11786
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/schema/attributeContentProposalProviders.exsd
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/AttributeContentProposalProviderFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/IAttributeContentProposalProvider.java
Log:
JBIDE-2575
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-11-14 13:46:34 UTC (rev 11785)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-11-14 13:53:08 UTC (rev 11786)
@@ -9,6 +9,7 @@
<extension-point id="metaTemplates" name="Meta Templates" schema="schema/metaTemplates.exsd"/>
<extension-point id="InsertTagWizard" name="InsertTagWizard" schema="schema/InsertTagWizard.exsd"/>
<extension-point id="labelDecorator" name="Model Object Label Decorator" schema="schema/labelDecorator.exsd"/>
+ <extension-point id="attributeContentProposalProviders" name="Attribute Content Proposal Providers" schema="schema/attributeContentProposalProviders.exsd"/>
<extension point="org.eclipse.ui.elementFactories">
<factory class="org.jboss.tools.common.core.resources.XModelObjectEditorInputFactory" id="org.jboss.tools.common.core.resources.XModelObjectEditorInputFactory">
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/schema/attributeContentProposalProviders.exsd
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/schema/attributeContentProposalProviders.exsd (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/schema/attributeContentProposalProviders.exsd 2008-11-14 13:53:08 UTC (rev 11786)
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.common.model.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.jboss.tools.common.model.ui" id="attributeContentProposalProviders" name="Attribute Content Proposal Providers"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="provider" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="provider">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/AttributeContentProposalProviderFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/AttributeContentProposalProviderFactory.java 2008-11-14 13:46:34 UTC (rev 11785)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/AttributeContentProposalProviderFactory.java 2008-11-14 13:53:08 UTC (rev 11786)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.common.model.ui.attribute;
import java.util.ArrayList;
@@ -3,4 +13,9 @@
import java.util.List;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.bindings.keys.ParseException;
@@ -21,6 +36,9 @@
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
+/**
+ * @author Viacheslav Kabanovich
+ */
public class AttributeContentProposalProviderFactory {
private static List<IAttributeContentProposalProvider> EMPTY = new ArrayList<IAttributeContentProposalProvider>();
@@ -79,23 +97,54 @@
}
}
+ static String POINT_ID = ModelUIPlugin.PLUGIN_ID + ".attributeContentProposalProviders";
+
public List<IAttributeContentProposalProvider> getContentProposalProviders(XModelObject object, XAttribute attribute) {
- //TODO
- if(true) {
- List<IAttributeContentProposalProvider> list = new ArrayList<IAttributeContentProposalProvider>();
- list.add(new TestAttributeContentProposalProvider());
- return list;
+ List<IAttributeContentProposalProvider> result = EMPTY;
+
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(POINT_ID);
+
+ IExtension[] es = point.getExtensions();
+ for (int i = 0; i < es.length; i++) {
+ IConfigurationElement[] cs = es[i].getConfigurationElements();
+ for (int j = 0; j < cs.length; j++) {
+ IAttributeContentProposalProvider provider = null;
+ try {
+ Object o = cs[j].createExecutableExtension("class");
+ provider = (IAttributeContentProposalProvider)o;
+ } catch (CoreException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
+ if(provider.isRelevant(object, attribute)) {
+ if(result == EMPTY) result = new ArrayList<IAttributeContentProposalProvider>();
+ result.add(provider);
+ }
+ }
}
+
+ if(false) {
+ //Test
+ result.add(new TestAttributeContentProposalProvider());
+ }
- return EMPTY;
+ return result;
}
}
+/**
+ * Example
+ * @author glory
+ *
+ */
class TestAttributeContentProposalProvider implements IAttributeContentProposalProvider {
- public void dispose() {
+ public boolean isRelevant(XModelObject object, XAttribute attribute) {
+ return true;
}
+ public void init(XModelObject object, XAttribute attribute) {
+ }
+
public IContentProposalProvider getContentProposalProvider() {
IContentProposalProvider cpp = new IContentProposalProvider() {
@@ -103,8 +152,9 @@
int position) {
ArrayList<IContentProposal> ps = new ArrayList<IContentProposal>();
- if(position <= contents.length() && position > 0 && 'b' == contents.charAt(position - 1))
- ps.add(makeContentProposal("aaa", ".aaa"));
+ if(position <= contents.length() && position > 3 && "test".equals(contents.substring(position - 4, position))) {
+ ps.add(makeContentProposal("aaa", ".aaa"));
+ }
return ps.toArray(new IContentProposal[0]);
}
@@ -117,7 +167,7 @@
return ContentProposalAdapter.PROPOSAL_INSERT;
}
- public void init(XModelObject object, XAttribute attribute) {
+ public void dispose() {
}
private IContentProposal makeContentProposal(final String proposal, final String label) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/IAttributeContentProposalProvider.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/IAttributeContentProposalProvider.java 2008-11-14 13:46:34 UTC (rev 11785)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/IAttributeContentProposalProvider.java 2008-11-14 13:53:08 UTC (rev 11786)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.common.model.ui.attribute;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
@@ -4,8 +14,13 @@
import org.jboss.tools.common.meta.XAttribute;
import org.jboss.tools.common.model.XModelObject;
+/**
+ * @author Viacheslav Kabanovich
+ */
public interface IAttributeContentProposalProvider {
+ public boolean isRelevant(XModelObject object, XAttribute attribute);
+
public void init(XModelObject object, XAttribute attribute);
public IContentProposalProvider getContentProposalProvider();
17 years, 5 months
JBoss Tools SVN: r11785 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: template and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-11-14 08:46:34 -0500 (Fri, 14 Nov 2008)
New Revision: 11785
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLoadBundleCreator.java
Log:
JBIDE-3144
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2008-11-14 10:45:39 UTC (rev 11784)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2008-11-14 13:46:34 UTC (rev 11785)
@@ -39,9 +39,7 @@
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.model.ELModel;
import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.common.el.core.model.ELUtil;
import org.jboss.tools.common.el.core.parser.ELParser;
-import org.jboss.tools.common.el.core.parser.ELParserFactory;
import org.jboss.tools.common.el.core.parser.ELParserUtil;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.event.XModelTreeEvent;
@@ -96,7 +94,7 @@
String prefix = map.get(uri).toString();
int hash = (prefix + ":" + uri).hashCode();
removeBundle(hash);
- addBundle(hash, prefix, uri, -1000, true);
+ addBundle(hash, prefix, uri, true);
}
}
@@ -259,9 +257,9 @@
removeBundle(hashCode, true);
}
- private void addBundle(int hashCode, String prefix, String uri, int offset, boolean refresh) {
+ private void addBundle(int hashCode, String prefix, String uri,boolean refresh) {
ResourceBundle bundle = getBundleByUrl(uri);
- BundleEntry entry = new BundleEntry(bundle, uri, prefix, hashCode, offset);
+ BundleEntry entry = new BundleEntry(bundle, uri, prefix, hashCode);
if(bundle!=null) {
BundleEntry[] newBundles = new BundleEntry[bundles.length + 1];
System.arraycopy(bundles, 0, newBundles, 0, bundles.length);
@@ -271,14 +269,14 @@
if(refresh)refreshUsedKeys();
}
- public void changeBundle(int hashCode, String prefix, String uri, int offset){
+ public void changeBundle(int hashCode, String prefix, String uri){
removeBundle(hashCode, false);
- addBundle(hashCode, prefix, uri, offset, true);
+ addBundle(hashCode, prefix, uri, true);
}
- private void changeBundleWithoutRefresh(int hashCode, String prefix, String uri, int offset){
+ private void changeBundleWithoutRefresh(int hashCode, String prefix, String uri){
removeBundle(hashCode, false);
- addBundle(hashCode, prefix, uri, offset, false);
+ addBundle(hashCode, prefix, uri, false);
}
private BundleEntry getBundle(String prefix) {
@@ -286,9 +284,7 @@
BundleEntry lastBundle = null;
for (int i = 0; i < bundles.length; i++) {
if (prefix.equals(bundles[i].prefix)){
- if (lastBundle == null || lastBundle.offset > bundles[i].offset) {
- lastBundle = bundles[i];
- }
+ lastBundle = bundles[i];
}
}
return lastBundle;
@@ -306,7 +302,7 @@
for(int i=0; i<array.length;i++){
key = (UsedKey)array[i];
- changeBundleWithoutRefresh(key.hashCode, key.prefix, key.uri, key.offset);
+ changeBundleWithoutRefresh(key.hashCode, key.prefix, key.uri);
}
refreshUsedKeys();
}
@@ -412,7 +408,7 @@
try{
String value = (String)entry.bundle.getObject(propertyName);
if(!usedKeys.containsKey(name))
- usedKeys.put(name, new UsedKey(entry.uri, prefix, propertyName, value, entry.hashCode, entry.offset));
+ usedKeys.put(name, new UsedKey(entry.uri, prefix, propertyName, value, entry.hashCode));
return value;
}catch(MissingResourceException ex){
return null;
@@ -466,15 +462,13 @@
public String uri;
public String prefix;
public int hashCode;
- public int offset;
- public BundleEntry(ResourceBundle bundle, String uri, String prefix, int hashCode, int offset){
+ public BundleEntry(ResourceBundle bundle, String uri, String prefix, int hashCode){
this.bundle = bundle;
this.uri = uri;
this.prefix = prefix;
this.hashCode = hashCode;
- this.offset = offset;
- }
+ }
}
class UsedKey{
@@ -483,15 +477,14 @@
public String prefix;
public String key;
public String value;
- public int offset;
- public UsedKey(String uri, String prefix, String key, String value, int hashCode, int offset){
+ public UsedKey(String uri, String prefix, String key, String value, int hashCode){
this.uri = uri;
this.prefix = prefix;
this.key = key;
this.value = value;
this.hashCode = hashCode;
- this.offset = offset;
+
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLoadBundleCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLoadBundleCreator.java 2008-11-14 10:45:39 UTC (rev 11784)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLoadBundleCreator.java 2008-11-14 13:46:34 UTC (rev 11785)
@@ -61,9 +61,7 @@
String var = sourceElement.getAttribute(ATTR_VAR);
BundleMap bundle = pageContext.getBundle();
if (basename != null && basename.length() > 0 && var != null && var.length() > 0) {
- int offset = pageContext.getVisualBuilder().getCurrentMainIncludeOffset();
- if (offset == -1) offset = ((IndexedRegion)sourceElement).getStartOffset();
- bundle.changeBundle(sourceElement.hashCode(), var, basename, offset);
+ bundle.changeBundle(sourceElement.hashCode(), var, basename);
} else {
bundle.removeBundle(sourceElement.hashCode());
}
17 years, 5 months
JBoss Tools SVN: r11784 - in trunk/jsf: tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: izhukov
Date: 2008-11-14 05:45:39 -0500 (Fri, 14 Nov 2008)
New Revision: 11784
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml.xml
Log:
update tests for DataFilterSlider template
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java 2008-11-14 08:25:05 UTC (rev 11783)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java 2008-11-14 10:45:39 UTC (rev 11784)
@@ -179,7 +179,7 @@
nsIDOMElement br = visualDocument.createElement(HTML.TAG_BR);
style = new StringBuffer(HTML.STYLE_PARAMETER_CLEAR).append(Constants.COLON).
append(HTML.VALUE_CLEAR_BOTH).append(Constants.SEMICOLON).toString();
- br.setAttribute(HTML.ATTR_STYLE, HTML.VALUE_TYPE_TEXT);
+ br.setAttribute(HTML.ATTR_STYLE, style);
// create DOM tree in correspondence order
parentDiv.appendChild(rangeDiv);
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml.xml 2008-11-14 08:25:05 UTC (rev 11783)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataFilterSlider.xhtml.xml 2008-11-14 10:45:39 UTC (rev 11784)
@@ -13,8 +13,8 @@
</DIV>
</DIV>
</DIV>
- <INPUT TYPE="text"
- CLASS="slider-input-field rich-dataFilterSlider-input-field" VALUE="1" />
+ <INPUT TYPE="text" CLASS="slider-input-field rich-dataFilterSlider-input-field" VALUE="1" />
+ <BR STYLE="clear: both;"/>
</DIV>
</test>
<test id="dataFilterSliderCustomCSS">
@@ -33,6 +33,7 @@
</DIV>
</DIV>
<INPUT TYPE="text" CLASS="slider-input-field rich-dataFilterSlider-input-field fieldStyle" VALUE="1"/>
+ <BR STYLE="clear: both;"/>
</DIV>
</test>
</tests>
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r11783 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util.
by jbosstools-commits@lists.jboss.org
Author: izhukov
Date: 2008-11-14 03:25:05 -0500 (Fri, 14 Nov 2008)
New Revision: 11783
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
Log:
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-11-14 07:58:03 UTC (rev 11782)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-11-14 08:25:05 UTC (rev 11783)
@@ -104,6 +104,7 @@
public static final String VALUE_TYPE_HIDDEN = "hidden"; //$NON-NLS-1$
public static final String VALUE_TYPE_BUTTON= "button"; //$NON-NLS-1$
public static final String VALUE_ALIGN_CENTER = "center"; //$NON-NLS-1$
+ public static final String VALUE_CLEAR_BOTH = "both"; //$NON-NLS-1$
public static final String STYLE_PARAMETER_WIDTH = "width"; //$NON-NLS-1$
public static final String STYLE_PARAMETER_TOP = "top"; //$NON-NLS-1$
@@ -112,6 +113,5 @@
public static final String STYLE_PARAMETER_BACKGROUND_IMAGE = "background-image"; //$NON-NLS-1$
public static final String STYLE_PARAMETER_MAX_HEIGHT = "max-height"; //$NON-NLS-1$
public static final String STYLE_PARAMETER_ZINDEX = "z-index"; //$NON-NLS-1$
- public static final String STYLE_PARAMETER_CLEAR = "clear"; //$NON-NLS-1$
- public static final Object VALUE_CLEAR_BOTH = "both"; //$NON-NLS-1$
-}
\ No newline at end of file
+ public static final String STYLE_PARAMETER_CLEAR = "clear"; //$NON-NLS-1$
+}
17 years, 5 months