JBoss Tools SVN: r14371 - in trunk/jst/plugins/org.jboss.tools.jst.web: src/org/jboss/tools/jst/web/webapp/model and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-03-30 11:19:40 -0400 (Mon, 30 Mar 2009)
New Revision: 14371
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/strutstld12.meta
trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/tld20.meta
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppLoader.java
Log:
JBIDE-4101
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/strutstld12.meta
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/strutstld12.meta 2009-03-30 15:18:54 UTC (rev 14370)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/strutstld12.meta 2009-03-30 15:19:40 UTC (rev 14371)
@@ -88,7 +88,7 @@
<XModelAttribute name="display-name" xmlname="display-name.#text"/>
<XModelAttribute name="small-icon" xmlname="small-icon.#text"/>
<XModelAttribute name="large-icon" xmlname="large-icon.#text"/>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute name="id" xmlname="id"/>
@@ -355,7 +355,7 @@
<XModelAttribute name="type" xmlname="type.#text">
<Editor name="AccessibleJava"/>
</XModelAttribute>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
@@ -497,7 +497,7 @@
<XModelAttribute name="display-name" xmlname="display-name.#text"/>
<XModelAttribute name="small-icon" xmlname="small-icon.#text"/>
<XModelAttribute name="large-icon" xmlname="large-icon.#text"/>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute name="example" xmlname="example.#text">
@@ -610,7 +610,7 @@
<XModelAttribute name="validator-class" xmlname="validator-class.#text">
<Editor name="AccessibleJava"/>
</XModelAttribute>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute name="id" visibility="false" xmlname="id"/>
@@ -688,7 +688,7 @@
</Constraint>
<Editor name="List"/>
</XModelAttribute>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/tld20.meta
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/tld20.meta 2009-03-30 15:18:54 UTC (rev 14370)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/tld20.meta 2009-03-30 15:19:40 UTC (rev 14371)
@@ -68,12 +68,12 @@
name="xsi:schemaLocation" xmlname="xsi:schemaLocation"/>
<XModelAttribute PROPERTIES="save=always" default="2.0"
name="version" visibility="false" xmlname="version"/>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute name="display-name" xmlname="display-name.#text"/>
- <XModelAttribute name="small-icon" xmlname="small-icon.#text"/>
- <XModelAttribute name="large-icon" xmlname="large-icon.#text"/>
+ <XModelAttribute name="small-icon" xmlname="icon.small-icon.#text"/>
+ <XModelAttribute name="large-icon" xmlname="icon.large-icon.#text"/>
<XModelAttribute PROPERTIES="save=always" default="1.1"
name="tlibversion" xmlname="tlib-version.#text"/>
<XModelAttribute PROPERTIES="save=always" name="shortname" xmlname="short-name.#text"/>
@@ -301,12 +301,12 @@
name="xsi:schemaLocation" xmlname="xsi:schemaLocation"/>
<XModelAttribute PROPERTIES="save=always" default="2.1"
name="version" visibility="false" xmlname="version"/>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute name="display-name" xmlname="display-name.#text"/>
- <XModelAttribute name="small-icon" xmlname="small-icon.#text"/>
- <XModelAttribute name="large-icon" xmlname="large-icon.#text"/>
+ <XModelAttribute name="small-icon" xmlname="icon.small-icon.#text"/>
+ <XModelAttribute name="large-icon" xmlname="icon.large-icon.#text"/>
<XModelAttribute PROPERTIES="save=always" default="1.1"
name="tlibversion" xmlname="tlib-version.#text"/>
<XModelAttribute PROPERTIES="save=always" name="shortname" xmlname="short-name.#text"/>
@@ -491,7 +491,7 @@
<XModelAttribute default="attribute" loader="ElementType" name="element type">
<Editor name="Uneditable"/>
</XModelAttribute>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute PROPERTIES="id=true" name="name" xmlname="name.#text"/>
@@ -555,7 +555,7 @@
<XModelAttribute default="attribute" loader="ElementType" name="element type">
<Editor name="Uneditable"/>
</XModelAttribute>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute PROPERTIES="id=true" name="name" xmlname="name.#text"/>
@@ -622,7 +622,7 @@
<XModelAttribute default="attribute" loader="ElementType" name="element type">
<Editor name="Uneditable"/>
</XModelAttribute>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute PROPERTIES="id=true" name="name" xmlname="name.#text"/>
@@ -679,7 +679,7 @@
<XModelAttribute default="function" loader="ElementType" name="element type">
<Editor name="Uneditable"/>
</XModelAttribute>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute name="display-name" xmlname="display-name.#text"/>
@@ -779,6 +779,12 @@
<XModelAttribute default="tag" loader="ElementType" name="element type">
<Editor name="Uneditable"/>
</XModelAttribute>
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ <XModelAttribute name="display-name" xmlname="display-name.#text"/>
+ <XModelAttribute name="small-icon" xmlname="icon.small-icon.#text"/>
+ <XModelAttribute name="large-icon" xmlname="icon.large-icon.#text"/>
<XModelAttribute PROPERTIES="save=always;id=true" name="name" xmlname="name.#text"/>
<XModelAttribute PROPERTIES="save=always" name="tagclass" xmlname="tag-class.#text">
<Constraint loader="QClassName"/>
@@ -797,12 +803,6 @@
</Constraint>
<Editor name="List"/>
</XModelAttribute>
- <XModelAttribute name="display-name" xmlname="display-name.#text"/>
- <XModelAttribute name="small-icon" xmlname="small-icon.#text"/>
- <XModelAttribute name="large-icon" xmlname="large-icon.#text"/>
- <XModelAttribute name="description" xmlname="description.#text">
- <Editor name="Note"/>
- </XModelAttribute>
<XModelAttribute name="example" xmlname="example.#text">
<Editor name="Note"/>
</XModelAttribute>
@@ -885,6 +885,12 @@
<XModelAttribute default="tag" loader="ElementType" name="element type">
<Editor name="Uneditable"/>
</XModelAttribute>
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ <XModelAttribute name="display-name" xmlname="display-name.#text"/>
+ <XModelAttribute name="small-icon" xmlname="icon.small-icon.#text"/>
+ <XModelAttribute name="large-icon" xmlname="icon.large-icon.#text"/>
<XModelAttribute PROPERTIES="save=always;id=true" name="name" xmlname="name.#text"/>
<XModelAttribute PROPERTIES="save=always" name="tagclass" xmlname="tag-class.#text">
<Constraint loader="QClassName"/>
@@ -903,12 +909,6 @@
</Constraint>
<Editor name="List"/>
</XModelAttribute>
- <XModelAttribute name="display-name" xmlname="display-name.#text"/>
- <XModelAttribute name="small-icon" xmlname="small-icon.#text"/>
- <XModelAttribute name="large-icon" xmlname="large-icon.#text"/>
- <XModelAttribute name="description" xmlname="description.#text">
- <Editor name="Note"/>
- </XModelAttribute>
<XModelAttribute name="example" xmlname="example.#text">
<Editor name="Note"/>
</XModelAttribute>
@@ -985,7 +985,7 @@
<XModelAttribute default="tag-file" loader="ElementType" name="element type">
<Editor name="Uneditable"/>
</XModelAttribute>
- <XModelAttribute name="description" xmlname="description.#text">
+ <XModelAttribute TRIM="no" name="description" xmlname="description.#text">
<Editor name="Note"/>
</XModelAttribute>
<XModelAttribute name="display-name" xmlname="display-name.#text"/>
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppLoader.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppLoader.java 2009-03-30 15:18:54 UTC (rev 14370)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppLoader.java 2009-03-30 15:19:40 UTC (rev 14371)
@@ -61,7 +61,7 @@
return super.isSaveable(entity, n, v, dv);
}
- public String getAttribute(Element element, String xmlname) {
+ public String getAttribute(Element element, String xmlname, XAttribute attr) {
if("distributable".equals(xmlname))
return (XMLUtil.getUniqueChild(element, "distributable") != null) ? "yes" : "no";
if("role-names".equals(xmlname))
@@ -76,7 +76,7 @@
return loadArray(element, "port-component-ref");
if("dispatchers".equals(xmlname))
return loadArray(element, "dispatcher");
- return super.getAttribute(element, xmlname);
+ return super.getAttribute(element, xmlname, attr);
}
public void saveAttributes(Element element, XModelObject o) {
15 years, 9 months
JBoss Tools SVN: r14370 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-03-30 11:18:54 -0400 (Mon, 30 Mar 2009)
New Revision: 14370
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java
Log:
JBIDE-4101
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java 2009-03-30 14:52:26 UTC (rev 14369)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java 2009-03-30 15:18:54 UTC (rev 14370)
@@ -217,7 +217,7 @@
String xmlname = as[i].getXMLName();
if (xmlname == null || xmlname.length() == 0) continue;
String n = as[i].getName();
- String value = getAttribute(element, xmlname);
+ String value = getAttribute(element, xmlname, as[i]);
if (value != null) o.setAttributeValue(n, value);
String commentName = getAttributeCommentName(xmlname);
if(commentName != null) {
@@ -257,9 +257,14 @@
return xmlname;
}
+ //TODO final. getAttribute(Element, String, XAttribute) should be overridden
public String getAttribute(Element element, String xmlname) {
+ return getAttribute(element, xmlname, null);
+ }
+
+ public String getAttribute(Element element, String xmlname, XAttribute attr) {
if (xmlname.equals("CDATA") || xmlname.equals("#text")) {
- return getCDATA(element, true);
+ return getCDATA(element, attr == null || attr.isTrimmable());
} else if (xmlname.equals("#comment")) {
return getComment(element);
} else {
@@ -273,7 +278,7 @@
childName = namespace + ":" + childName;
}
Element child = XMLUtil.getFirstChild(element, childName);
- if (child != null) return getAttribute(child, xmlname.substring(ind+1));
+ if (child != null) return getAttribute(child, xmlname.substring(ind+1), attr);
} else {
xmlname = applyNamespaceToAttribute(xmlname);
if (XMLUtil.hasAttribute(element, xmlname)) {
15 years, 9 months
JBoss Tools SVN: r14369 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/templates.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-03-30 10:52:26 -0400 (Mon, 30 Mar 2009)
New Revision: 14369
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/templates/vpe-templates-jstl.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-3548, Template for fmt, sql, xml taglibs were added.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/templates/vpe-templates-jstl.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/templates/vpe-templates-jstl.xml 2009-03-30 14:06:45 UTC (rev 14368)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/templates/vpe-templates-jstl.xml 2009-03-30 14:52:26 UTC (rev 14369)
@@ -3,7 +3,13 @@
<vpe:templates xmlns:vpe="http://org.jboss.org/tools/vpe/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<vpe:template-taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" />
+ <vpe:template-taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" />
+ <vpe:template-taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" />
+ <vpe:template-taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" />
<vpe:template-taglib uri="http://java.sun.com/jstl/core" prefix="c" />
+ <vpe:template-taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" />
+ <vpe:template-taglib uri="http://java.sun.com/jstl/sql" prefix="sql" />
+ <vpe:template-taglib uri="http://java.sun.com/jstl/xml" prefix="x" />
<vpe:tag name="c:catch" case-sensitive="yes">
<vpe:template children="yes" modify="yes">
@@ -83,6 +89,138 @@
</vpe:template>
</vpe:tag>
+ <vpe:tag name="fmt:requestEncoding" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="fmt:setLocale" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="fmt:timeZone" case-sensitive="yes">
+ <vpe:template children="yes" modify="no" >
+ <div />
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="fmt:setTimeZone" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="fmt:bundle" case-sensitive="yes">
+ <vpe:template children="yes" modify="no" >
+ <div />
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="fmt:setBundle" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="fmt:message" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="fmt:param" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="fmt:formatNumber" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="fmt:parseNumber" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="fmt:formatDate" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="fmt:parseDate" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="sql:transaction" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes">
+ <div />
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="sql:query" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="sql:update" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="sql:param" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="sql:dateParam" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="sql:setDataSource" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="x:choose" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes">
+ <div />
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="x:when" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes">
+ <div />
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="x:otherwise" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes">
+ <div />
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="x:if" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes">
+ <div />
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="x:forEach" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.jsf.vpe.jstl.template.JstlForEachTemplate">
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="x:out" case-sensitive="yes">
+ <vpe:template children="no" modify="no"
+ class="org.jboss.tools.jsf.vpe.jstl.template.JstlOutTemplate">
+ <vpe:textFormatting use-default-formats="yes">
+ </vpe:textFormatting>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="x:param" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="x:parse" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="x:set" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="x:transform" case-sensitive="yes">
+ <vpe:template children="no" modify="no" />
+ </vpe:tag>
+
<!-- Default template
<vpe:template children="yes" modify="no">
<vpe:any value="{name()}" title="{tagstring()}" />
15 years, 9 months
JBoss Tools SVN: r14368 - 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: 2009-03-30 10:06:45 -0400 (Mon, 30 Mar 2009)
New Revision: 14368
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java
Log:
RESOLVED - issue JBIDE-4058: Tool Bar and item separator
https://jira.jboss.org/jira/browse/JBIDE-4058
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java 2009-03-30 12:55:41 UTC (rev 14367)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java 2009-03-30 14:06:45 UTC (rev 14368)
@@ -456,25 +456,17 @@
}
}
- if (isItemSeparatorExists() && !isLeftItemsExists()) {
- if (rightToolBarItems.size() > 0)
+ // yradtsevich: JBIDE-4058:
+ // There should be no trailing separator after the left toolbar group
+ // and no leading separator at the beginning of the right toolbar group
+ if (isItemSeparatorExists() && !leftToolBarItems.isEmpty()) {
+ leftToolBarItems.remove(leftToolBarItems.size()-1);
+ }
+ if (isItemSeparatorExists() && !rightToolBarItems.isEmpty()) {
rightToolBarItems.remove(0);
}
-
- if (isItemSeparatorExists() && !isRightItemsExists()) {
- if (leftToolBarItems.size() > 0)
- leftToolBarItems.remove(leftToolBarItems.size()-1);
- }
}
-
- public boolean isLeftItemsExists() {
- return !leftToolBarItems.isEmpty();
- }
- public boolean isRightItemsExists() {
- return !rightToolBarItems.isEmpty();
- }
-
public Iterator<SourceToolBarItem> getLeftItemsIterator() {
return leftToolBarItems.iterator();
}
15 years, 9 months
JBoss Tools SVN: r14367 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-03-30 08:55:41 -0400 (Mon, 30 Mar 2009)
New Revision: 14367
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
Log:
JBIDE-3889 Resource Bundle Open-Ons aren't working for <message-bundle> tag of faces-config.xml opened from a jar.
Issue is fixed
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2009-03-30 12:15:27 UTC (rev 14366)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2009-03-30 12:55:41 UTC (rev 14367)
@@ -16,23 +16,31 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.model.util.FindObjectHelper;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
+import org.jboss.tools.common.text.ext.hyperlink.ClassHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.jsf.model.FileFacesConfigImpl;
import org.jboss.tools.jsf.model.pv.JSFProjectsRoot;
import org.jboss.tools.jsf.model.pv.JSFProjectsTree;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
@@ -45,17 +53,27 @@
/**
* @author Jeremy
*/
-public class BundleBasenameHyperlink extends AbstractHyperlink {
-
+public class BundleBasenameHyperlink extends ClassHyperlink {
+ private static final String FILESYSTEMS = "/FileSystems/";
+ private static final String LIB = "/lib-";
+ private static final String SEPARATOR = "/";
+
protected void doHyperlink(IRegion region) {
try {
String fileName = getBundleBasename(region);
- IFile fileToOpen = getFileToOpen(fileName, "properties");
- if (fileToOpen != null) {
- IWorkbenchPage workbenchPage = JSFExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditor(workbenchPage,fileToOpen,true);
- } else
- openFileFailed();
+ XModelObject mo = getXModelObjectToOpen(fileName);
+ if (mo != null) {
+ // Open XModelObject in editor
+ FindObjectHelper.findModelObject(mo, FindObjectHelper.IN_EDITOR_ONLY);
+ } else {
+ IFile fileToOpen = getFileToOpen(fileName, "properties");
+ if (fileToOpen != null) {
+ IWorkbenchPage workbenchPage = JSFExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IDE.openEditor(workbenchPage,fileToOpen,true);
+ } else {
+ super.doHyperlink(region);
+ }
+ }
} catch (CoreException x) {
// could not open editor
openFileFailed();
@@ -72,8 +90,7 @@
}
}
- private String[] getBundles() {
- XModelObject fcObject = EclipseResourceUtil.createObjectForResource(getFile());
+ private XModelObject[] getBundles(XModelObject fcObject) {
if (fcObject == null)
return null;
@@ -91,11 +108,30 @@
((WebProjectNode)rbObjects).invalidate();
- ArrayList<String> bundlesPaths = new ArrayList<String>();
+ ArrayList<XModelObject> resourceBundles = new ArrayList<XModelObject>();
XModelObject[] bundles = ((WebProjectNode)rbObjects).getTreeChildren();
for (int i = 0; bundles != null && i < bundles.length; i++) {
String res = XModelObjectLoaderUtil.getResourcePath(bundles[i]);
if (res != null) {
+ resourceBundles.add(bundles[i]);
+ }
+ }
+
+ return (resourceBundles.size() == 0 ?
+ null : resourceBundles.toArray(new XModelObject[0]));
+
+ }
+
+ private String[] getBundles() {
+ XModelObject fcObject = EclipseResourceUtil.createObjectForResource(getFile());
+ if (fcObject == null)
+ return null;
+
+ ArrayList<String> bundlesPaths = new ArrayList<String>();
+ XModelObject[] bundles = getBundles(fcObject);
+ for (int i = 0; bundles != null && i < bundles.length; i++) {
+ String res = XModelObjectLoaderUtil.getResourcePath(bundles[i]);
+ if (res != null) {
res = res.substring(1, res.length() - 11).replace('/', '.');
bundlesPaths.add(res);
}
@@ -106,14 +142,21 @@
}
private String[] getOrderedLocales() {
- HashSet<String> allLocales = new HashSet<String>();
- ArrayList<String> supportedLocales = new ArrayList<String>();
- ArrayList<String> langs = new ArrayList<String>();
-
XModelObject fcObject = EclipseResourceUtil.createObjectForResource(getFile());
if (fcObject == null)
return null;
+ return getOrderedLocales(fcObject);
+ }
+
+ private String[] getOrderedLocales(XModelObject fcObject) {
+ if (fcObject == null)
+ return null;
+
+ HashSet<String> allLocales = new HashSet<String>();
+ ArrayList<String> supportedLocales = new ArrayList<String>();
+ ArrayList<String> langs = new ArrayList<String>();
+
XModelObject lcObject = (fcObject != null ?
fcObject.getChildByPath("application/Locale Config") : null);
@@ -203,6 +246,53 @@
return supportedLocales.toArray(new String[0]);
}
+ private XModelObject getXModelObjectToOpen(String fileName) {
+ // Search thru the XModelObject for Faces Config
+ String baseLocation = getBaseLocation();
+ if (baseLocation == null)
+ return null;
+
+ int index = baseLocation.indexOf(FILESYSTEMS);
+ if (index == -1)
+ return null;
+
+ String projectName = baseLocation.substring(1, index);
+ String path = baseLocation.substring(index + 1);
+
+ IProject project = null;
+ try {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ } catch (Throwable x) {
+ return null;
+ }
+ IModelNature modelNature = EclipseResourceUtil.getModelNature(project);
+ if (modelNature == null || modelNature.getModel() == null)
+ return null;
+
+ XModelObject xmo = modelNature.getModel().getByPath(path);
+
+ if (xmo instanceof FileFacesConfigImpl) {
+ XModelObject fcObject = xmo;
+
+ String[] orderedLocales = getOrderedLocales(fcObject);
+ XModelObject[] bundles = getBundles(fcObject);
+ for (int l = 0; orderedLocales != null && l < orderedLocales.length; l++) {
+ String name = fileName + (orderedLocales[l].length() == 0 ? "" :
+ "_" + orderedLocales[l]);
+
+ for (int i = 0; bundles != null && i < bundles.length; i++) {
+ String bundleName = XModelObjectLoaderUtil.getResourcePath(bundles[i]);
+
+ if (bundleName.equals(name)) {
+ return bundles[i];
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
private IFile getFileToOpen(String fileName, String fileExt) {
if (fileName == null)
return null;
@@ -280,7 +370,7 @@
return fLastRegion;
}
- private IRegion getRegion(int offset) {
+ public IRegion getRegion(int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(getDocument());
try {
15 years, 9 months
JBoss Tools SVN: r14366 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-03-30 08:15:27 -0400 (Mon, 30 Mar 2009)
New Revision: 14366
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ExtendedFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaFavoritesFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/PropertyEditorDialog.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TabbedJavaChoicerFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TreeSelectionFieldEditor.java
Log:
JBIDE-4100
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ExtendedFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ExtendedFieldEditor.java 2009-03-28 18:33:28 UTC (rev 14365)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ExtendedFieldEditor.java 2009-03-30 12:15:27 UTC (rev 14366)
@@ -48,6 +48,9 @@
private Label label;
private boolean enabled = Boolean.TRUE.booleanValue();
private IAttributeErrorProvider errorProvider;
+
+ // Introduced to give opportunities of submitting or cancelling dialog from within editor controls.
+ private PropertyEditorDialog ownerDialog;
//
protected IWidgetSettings settings;
@@ -57,6 +60,14 @@
this.settings = settings;
}
+ public void setOwnerDialog(PropertyEditorDialog dialog) {
+ ownerDialog = dialog;
+ }
+
+ public PropertyEditorDialog getOwnerDialog() {
+ return ownerDialog;
+ }
+
protected abstract void adjustForNumColumns(int numColumns);
protected void applyFont() {}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerFieldEditor.java 2009-03-28 18:33:28 UTC (rev 14365)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerFieldEditor.java 2009-03-30 12:15:27 UTC (rev 14366)
@@ -28,6 +28,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
@@ -163,6 +164,14 @@
tree.addSelectionChangedListener(this);
tree.setAutoExpandLevel(2);
+ tree.getControl().addMouseListener(new MouseAdapter() {
+ public void mouseDoubleClick(MouseEvent e) {
+ if(getOwnerDialog() != null) {
+ getOwnerDialog().okPressed();
+ }
+ }
+ });
+
label = new Label(composite, SWT.NONE);
label.setText(EditorMessages.getString("JavaChoicerFieldEditor.Tab1.Text.Label"));
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java 2009-03-28 18:33:28 UTC (rev 14365)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java 2009-03-30 12:15:27 UTC (rev 14366)
@@ -12,6 +12,7 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.lang.reflect.Field;
import java.util.ArrayList;
import org.eclipse.core.resources.IProject;
@@ -27,12 +28,17 @@
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.core.search.TypeNameMatch;
+import org.eclipse.jdt.internal.ui.dialogs.TypeInfoViewer;
import org.eclipse.jdt.internal.ui.dialogs.TypeSelectionComponent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.ui.IValueChangeListener;
@@ -136,9 +142,37 @@
if(hasFocus(tc)) handle(tc.getSelection());
}
});
+
+ Table table = getTable();
+ if(table != null) {
+ table.addMouseListener(new MouseAdapter() {
+ public void mouseDoubleClick(MouseEvent e) {
+ if(getOwnerDialog() != null) {
+ getOwnerDialog().okPressed();
+ }
+ }
+ });
+ }
return composite;
}
-
+
+ Table getTable() {
+ try {
+ Field f = TypeSelectionComponent.class.getDeclaredField("fViewer");
+ if(f == null) return null;
+ f.setAccessible(true);
+ TypeInfoViewer v = (TypeInfoViewer)f.get(tc);
+ return v == null ? null : v.getTable();
+ } catch (NoSuchFieldException ee) {
+
+ } catch (IllegalArgumentException e2) {
+
+ } catch (IllegalAccessException e3) {
+
+ }
+ return null;
+ }
+
boolean hasFocus(Composite c) {
if(c.isFocusControl()) return true;
Control[] cs = c.getChildren();
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaFavoritesFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaFavoritesFieldEditor.java 2009-03-28 18:33:28 UTC (rev 14365)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaFavoritesFieldEditor.java 2009-03-30 12:15:27 UTC (rev 14366)
@@ -25,6 +25,8 @@
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -125,6 +127,14 @@
}
});
+ classList.getControl().addMouseListener(new MouseAdapter() {
+ public void mouseDoubleClick(MouseEvent e) {
+ if(getOwnerDialog() != null) {
+ getOwnerDialog().okPressed();
+ }
+ }
+ });
+
return classList;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/PropertyEditorDialog.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/PropertyEditorDialog.java 2009-03-28 18:33:28 UTC (rev 14365)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/PropertyEditorDialog.java 2009-03-30 12:15:27 UTC (rev 14366)
@@ -41,7 +41,7 @@
public PropertyEditorDialog(Shell parentShell, IPropertyEditor editor) {
super(parentShell);
this.propertyEditor = editor;
- initValue = editor.getValue();
+ initValue = editor.getValue();
}
protected Control createDialogArea(Composite parent) {
@@ -84,8 +84,17 @@
parent.setLayout(layout);
} else cn = 2;
editor.fillIntoGrid(parent, cn);
+ editor.setOwnerDialog(this);
}
-
+
+ public void okPressed() {
+ Button b = getButton(IDialogConstants.OK_ID);
+ if(b == null || !b.isEnabled()) {
+ return;
+ }
+ super.okPressed();
+ }
+
protected void buttonPressed(int buttonId) {
if (IDialogConstants.OK_ID == buttonId) {
editor.store();
@@ -98,6 +107,7 @@
adapter.removeValueChangeListener(listener);
adapter = null;
}
+ if(editor != null) editor.setOwnerDialog(null);
}
class VCL implements PropertyChangeListener {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TabbedJavaChoicerFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TabbedJavaChoicerFieldEditor.java 2009-03-28 18:33:28 UTC (rev 14365)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TabbedJavaChoicerFieldEditor.java 2009-03-30 12:15:27 UTC (rev 14366)
@@ -48,6 +48,12 @@
favoritesEditor = new JavaFavoritesFieldEditor(settings);
}
+ public void setOwnerDialog(PropertyEditorDialog dialog) {
+ classicEditor.setOwnerDialog(dialog);
+ eclipseEditor.setOwnerDialog(dialog);
+ favoritesEditor.setOwnerDialog(dialog);
+ }
+
protected void adjustForNumColumns(int numColumns) {
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TreeSelectionFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TreeSelectionFieldEditor.java 2009-03-28 18:33:28 UTC (rev 14365)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TreeSelectionFieldEditor.java 2009-03-30 12:15:27 UTC (rev 14366)
@@ -17,6 +17,8 @@
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -97,6 +99,13 @@
if (selectionChangedListener!=null) {
treeViewer.addSelectionChangedListener(selectionChangedListener);
}
+ treeViewer.getTree().addMouseListener(new MouseAdapter() {
+ public void mouseDoubleClick(MouseEvent e) {
+ if(getOwnerDialog() != null) {
+ getOwnerDialog().okPressed();
+ }
+ }
+ });
}
return treeViewer.getTree();
}
15 years, 9 months
JBoss Tools SVN: r14364 - in trunk/vpe/plugins/org.jboss.tools.vpe: src/org/jboss/tools/vpe/editor/util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2009-03-28 09:39:21 -0400 (Sat, 28 Mar 2009)
New Revision: 14364
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/resources/htmlCodes.properties
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java
Log:
JBIDE-3810, fixed with help of yzhishko
Added: trunk/vpe/plugins/org.jboss.tools.vpe/resources/htmlCodes.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/resources/htmlCodes.properties (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/resources/htmlCodes.properties 2009-03-28 13:39:21 UTC (rev 14364)
@@ -0,0 +1,252 @@
+34="
+38=&
+60=<
+62=>
+160=
+161=¡
+162=¢
+163=£
+164=¤
+165=¥
+166=¦
+167=§
+168=¨
+169=©
+170=ª
+171=«
+172=¬
+173=­
+174=®
+175=¯
+176=°
+177=±
+178=²
+179=³
+180=´
+181=µ
+182=¶
+183=·
+184=¸
+185=¹
+186=º
+187=»
+188=¼
+189=½
+190=¾
+191=¿
+192=À
+193=Á
+194=Â
+195=Ã
+196=Ä
+197=Å
+198=Æ
+199=Ç
+200=È
+201=É
+202=Ê
+203=Ë
+204=Ì
+205=Í
+206=Î
+207=Ï
+208=Ð
+209=Ñ
+210=Ò
+211=Ó
+212=Ô
+213=Õ
+214=Ö
+215=×
+216=Ø
+217=Ù
+218=Ú
+219=Û
+220=Ü
+221=Ý
+222=Þ
+223=ß
+224=à
+225=á
+226=â
+227=ã
+228=ä
+229=å
+230=æ
+231=ç
+232=è
+233=é
+234=ê
+235=ë
+236=ì
+237=í
+238=î
+239=ï
+240=ð
+241=ñ
+242=ò
+243=ó
+244=ô
+245=õ
+246=ö
+247=÷
+248=ø
+249=ù
+250=ú
+251=û
+252=ü
+253=ý
+254=þ
+255=ÿ
+338=Œ
+339=œ
+352=Š
+353=š
+376=Ÿ
+710=ˆ
+732=˜
+8194= 
+8195= 
+8201= 
+8204=‌
+8205=‍
+8206=‎
+8207=‏
+8211=–
+8212=—
+8216=‘
+8217=’
+8218=‚
+8220=“
+8221=”
+8222=„
+8224=†
+8225=‡
+8240=‰
+8249=‹
+8250=›
+8364=€
+402=ƒ
+913=Α
+914=Β
+915=Γ
+916=Δ
+917=Ε
+918=Ζ
+919=Η
+920=Θ
+921=Ι
+922=Κ
+923=Λ
+924=Μ
+925=Ν
+926=Ξ
+927=Ο
+928=Π
+929=Ρ
+931=Σ
+932=Τ
+933=Υ
+934=Φ
+935=Χ
+936=Ψ
+937=Ω
+945=α
+946=β
+947=γ
+948=δ
+949=ε
+950=ζ
+951=η
+952=θ
+953=ι
+954=κ
+955=λ
+956=μ
+957=ν
+958=ξ
+959=ο
+960=π
+961=ρ
+962=ς
+963=σ
+964=τ
+965=υ
+966=φ
+967=χ
+968=ψ
+969=ω
+977=ϑ
+978=ϒ
+982=ϖ
+8226=•
+8230=…
+8242=′
+8243=″
+8254=‾
+8260=⁄
+8472=℘
+8465=ℑ
+8476=ℜ
+8482=™
+8501=ℵ
+8592=←
+8593=↑
+8594=→
+8595=↓
+8596=↔
+8629=↵
+8656=⇐
+8657=⇑
+8658=⇒
+8659=⇓
+8660=⇔
+8704=∀
+8706=∂
+8707=∃
+8709=∅
+8711=∇
+8712=∈
+8713=∉
+8715=∋
+8719=∏
+8721=∑
+8722=−
+8727=∗
+8730=√
+8733=∝
+8734=∞
+8736=∠
+8743=∧
+8744=∨
+8745=∩
+8746=∪
+8747=∫
+8756=∴
+8764=∼
+8773=≅
+8776=≈
+8800=≠
+8801=≡
+8804=≤
+8805=≥
+8834=⊂
+8835=⊃
+8836=⊄
+8838=⊆
+8839=⊇
+8853=⊕
+8855=⊗
+8869=⊥
+8901=⋅
+8968=⌈
+8969=⌉
+8970=⌊
+8971=⌋
+9001=⟨
+9002=⟩
+9674=◊
+9824=♠
+9827=♣
+9829=♥
+9830=♦
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java 2009-03-27 21:33:55 UTC (rev 14363)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java 2009-03-28 13:39:21 UTC (rev 14364)
@@ -1,383 +1,335 @@
-/*******************************************************************************
- * 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.vpe.editor.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.mozilla.interfaces.nsIDOMKeyEvent;
-
-public class TextUtil {
- private final static String SOURCE_BREAK = "\r\n"; //$NON-NLS-1$
- private final static String VISUAL_BREAK = "\n"; //$NON-NLS-1$
- private final static char SOURCE_SPACE = ' ';
- private final static char VISUAL_SPACE = 160;
- private final static int CHR_ESC_START = '&';
- private final static int CHR_ESC_STOP = ';';
- private final static String SPCHARS = "\f\n\r\t\u0020\u2028\u2029"; //$NON-NLS-1$
- private final static Map<Character,String> textSet = new HashMap<Character,String>();
- static{
- textSet.put(new Character('"'), """); //$NON-NLS-1$
- textSet.put(new Character('&'),"&"); //$NON-NLS-1$
- textSet.put(new Character('<'),"<"); //$NON-NLS-1$
- textSet.put(new Character('>'),">"); //$NON-NLS-1$
- textSet.put(new Character('\u00A0')," "); //$NON-NLS-1$
- textSet.put(new Character('\u00A1'),"¡"); //$NON-NLS-1$
- textSet.put(new Character('\u00A2'),"¢"); //$NON-NLS-1$
- textSet.put(new Character('\u00A3'),"£"); //$NON-NLS-1$
- textSet.put(new Character('\u00A4'),"¤"); //$NON-NLS-1$
- textSet.put(new Character('\u00A5'),"¥"); //$NON-NLS-1$
- textSet.put(new Character('\u00A6'),"¦"); //$NON-NLS-1$
- textSet.put(new Character('\u00A7'),"§"); //$NON-NLS-1$
- textSet.put(new Character('\u00A8'),"¨"); //$NON-NLS-1$
- textSet.put(new Character('\u00A9'),"©"); //$NON-NLS-1$
- textSet.put(new Character('\u00AA'),"ª"); //$NON-NLS-1$
- textSet.put(new Character('\u00AB'),"«"); //$NON-NLS-1$
- textSet.put(new Character('\u00AC'),"¬"); //$NON-NLS-1$
- //textSet.put(new Character('\u00AD'),"­");
- textSet.put(new Character('\u2022'), "•"); //$NON-NLS-1$
- textSet.put(new Character('\u00AE'),"®"); //$NON-NLS-1$
- textSet.put(new Character('\u00AF'),"¯"); //$NON-NLS-1$
- textSet.put(new Character('\u00B0'),"°"); //$NON-NLS-1$
- textSet.put(new Character('\u00B1'),"±"); //$NON-NLS-1$
- textSet.put(new Character('\u00B2'),"²"); //$NON-NLS-1$
- textSet.put(new Character('\u00B3'),"³"); //$NON-NLS-1$
- textSet.put(new Character('\u00B4'),"´"); //$NON-NLS-1$
- textSet.put(new Character('\u00B5'),"µ"); //$NON-NLS-1$
- textSet.put(new Character('\u00B6'),"¶"); //$NON-NLS-1$
- textSet.put(new Character('\u00B7'),"·"); //$NON-NLS-1$
- textSet.put(new Character('\u00B8'),"¸"); //$NON-NLS-1$
- textSet.put(new Character('\u00B9'),"¹"); //$NON-NLS-1$
- textSet.put(new Character('\u00BA'),"º"); //$NON-NLS-1$
- textSet.put(new Character('\u00BB'),"»"); //$NON-NLS-1$
- textSet.put(new Character('\u00BC'),"¼"); //$NON-NLS-1$
- textSet.put(new Character('\u00BD'),"½"); //$NON-NLS-1$
- textSet.put(new Character('\u00BE'),"¾"); //$NON-NLS-1$
- textSet.put(new Character('\u00BF'),"¿"); //$NON-NLS-1$
- textSet.put(new Character('\u00C0'),"À"); //$NON-NLS-1$
- textSet.put(new Character('\u00E0'),"à"); //$NON-NLS-1$
- textSet.put(new Character('\u00C1'),"Á"); //$NON-NLS-1$
- textSet.put(new Character('\u00E1'),"á"); //$NON-NLS-1$
- textSet.put(new Character('\u00C2'),"Â"); //$NON-NLS-1$
- textSet.put(new Character('\u00E2'),"â"); //$NON-NLS-1$
- textSet.put(new Character('\u00C3'),"Ã"); //$NON-NLS-1$
- textSet.put(new Character('\u00E3'),"ã"); //$NON-NLS-1$
- textSet.put(new Character('\u00C4'),"Ä"); //$NON-NLS-1$
- textSet.put(new Character('\u00E4'),"ä"); //$NON-NLS-1$
- textSet.put(new Character('\u00C5'),"Å"); //$NON-NLS-1$
- textSet.put(new Character('\u00E5'),"å"); //$NON-NLS-1$
- textSet.put(new Character('\u00C6'),"Æ"); //$NON-NLS-1$
- textSet.put(new Character('\u00E6'),"æ"); //$NON-NLS-1$
- textSet.put(new Character('\u00C7'),"Ç"); //$NON-NLS-1$
- textSet.put(new Character('\u00E7'),"ç"); //$NON-NLS-1$
- textSet.put(new Character('\u00C8'),"È"); //$NON-NLS-1$
- textSet.put(new Character('\u00E8'),"è"); //$NON-NLS-1$
- textSet.put(new Character('\u00C9'),"É"); //$NON-NLS-1$
- textSet.put(new Character('\u00E9'),"é"); //$NON-NLS-1$
- textSet.put(new Character('\u00CA'),"Ê"); //$NON-NLS-1$
- textSet.put(new Character('\u00EA'),"ê"); //$NON-NLS-1$
- textSet.put(new Character('\u00CB'),"Ë"); //$NON-NLS-1$
- textSet.put(new Character('\u00EB'),"ë"); //$NON-NLS-1$
- textSet.put(new Character('\u00CC'),"Ì"); //$NON-NLS-1$
- textSet.put(new Character('\u00EC'),"ì"); //$NON-NLS-1$
- textSet.put(new Character('\u00CD'),"Í"); //$NON-NLS-1$
- textSet.put(new Character('\u00ED'),"í"); //$NON-NLS-1$
- textSet.put(new Character('\u00CE'),"Î"); //$NON-NLS-1$
- textSet.put(new Character('\u00EE'),"î"); //$NON-NLS-1$
- textSet.put(new Character('\u00CF'),"Ï"); //$NON-NLS-1$
- textSet.put(new Character('\u00EF'),"ï"); //$NON-NLS-1$
- textSet.put(new Character('\u00D0'),"Ð"); //$NON-NLS-1$
- textSet.put(new Character('\u00F0'),"ð"); //$NON-NLS-1$
- textSet.put(new Character('\u00D1'),"Ñ"); //$NON-NLS-1$
- textSet.put(new Character('\u00F1'),"ñ"); //$NON-NLS-1$
- textSet.put(new Character('\u00D2'),"Ò"); //$NON-NLS-1$
- textSet.put(new Character('\u00F2'),"ò"); //$NON-NLS-1$
- textSet.put(new Character('\u00D3'),"Ó"); //$NON-NLS-1$
- textSet.put(new Character('\u00F3'),"ó"); //$NON-NLS-1$
- textSet.put(new Character('\u00D4'),"Ô"); //$NON-NLS-1$
- textSet.put(new Character('\u00F4'),"ô"); //$NON-NLS-1$
- textSet.put(new Character('\u00D5'),"Õ"); //$NON-NLS-1$
- textSet.put(new Character('\u00F5'),"õ"); //$NON-NLS-1$
- textSet.put(new Character('\u00D6'),"Ö"); //$NON-NLS-1$
- textSet.put(new Character('\u00F6'),"ö"); //$NON-NLS-1$
- textSet.put(new Character('\u00D7'),"×"); //$NON-NLS-1$
- textSet.put(new Character('\u00F7'),"÷"); //$NON-NLS-1$
- textSet.put(new Character('\u00D8'),"Ø"); //$NON-NLS-1$
- textSet.put(new Character('\u00F8'),"ø"); //$NON-NLS-1$
- textSet.put(new Character('\u00D9'),"Ù"); //$NON-NLS-1$
- textSet.put(new Character('\u00F9'),"ù"); //$NON-NLS-1$
- textSet.put(new Character('\u00DA'),"Ú"); //$NON-NLS-1$
- textSet.put(new Character('\u00FA'),"ú"); //$NON-NLS-1$
- textSet.put(new Character('\u00DB'),"Û"); //$NON-NLS-1$
- textSet.put(new Character('\u00FB'),"û"); //$NON-NLS-1$
- textSet.put(new Character('\u00DC'),"Ü"); //$NON-NLS-1$
- textSet.put(new Character('\u00FC'),"ü"); //$NON-NLS-1$
- textSet.put(new Character('\u00DD'),"Ý"); //$NON-NLS-1$
- textSet.put(new Character('\u00FD'),"ý"); //$NON-NLS-1$
- textSet.put(new Character('\u00DE'),"Þ"); //$NON-NLS-1$
- textSet.put(new Character('\u00FE'),"þ"); //$NON-NLS-1$
- textSet.put(new Character('\u00DF'),"ß"); //$NON-NLS-1$
- textSet.put(new Character('\u00FF'),"ÿ"); //$NON-NLS-1$
- textSet.put(new Character('\u2013'),"–"); //$NON-NLS-1$
- textSet.put(new Character('\u2014'),"—"); //$NON-NLS-1$
- textSet.put(new Character('\u2018'),"‘"); //$NON-NLS-1$
- textSet.put(new Character('\u2019'),"’"); //$NON-NLS-1$
- textSet.put(new Character('\u201C'),"“"); //$NON-NLS-1$
- textSet.put(new Character('\u201D'),"”"); //$NON-NLS-1$
- textSet.put(new Character('\u20AC'),"€"); //$NON-NLS-1$
- }
-
- public static boolean containsKey(char key){
-
- return textSet.containsKey(new Character(key));
- }
-
- public static String getValue(char key){
- return (String)textSet.get(new Character(key));
- }
-
- public static String isEcsToLeft(String sourceText, int sourcePosition) {
- String s1 = sourceText;
-
- String s2 = s1.substring(0, Math.min(sourcePosition, s1.length()));
- int startIndex = s2.lastIndexOf(CHR_ESC_START);
- int endIndex = s2.lastIndexOf(CHR_ESC_STOP);
- if(startIndex >= 0 && endIndex >= 0 && endIndex == s2.length()-1){
- String value = s2.substring(startIndex, endIndex+1);
- if(textSet.containsValue(value)) return value;
- }
-
- return null;
- }
-
- public static String isEcsToRight(String sourceText, int sourcePosition) {
- String s1 = sourceText;
-
- String s2 = s1.substring(sourcePosition, s1.length());
- int startIndex = s2.indexOf(CHR_ESC_START);
- int endIndex = s2.indexOf(CHR_ESC_STOP);
- if(startIndex >= 0 && endIndex >= 0 && startIndex == 0){
- String value = s2.substring(startIndex, endIndex+1);
- if(textSet.containsValue(value)) return value;
- }
-
- return null;
- }
-
- public static boolean isEcs(String sourceText, String visualText, int visualPosition) {
- String s1 = visualText;
-
- String s3 = s1.substring(0, Math.min(visualPosition+1, s1.length()));
- s3 = sourceText(s3);
-
- Character ch;
- int sourceIndex = 0;
- int visualIndex = 0;
- for(visualIndex=0;visualIndex<s3.length();visualIndex++){
- ch = new Character(s3.charAt(visualIndex));
-
- String value = (String)textSet.get(ch);
- char sourceChar = sourceText.charAt(sourceIndex);
- if(value != null){
- if(sourceChar != ch.charValue() || (ch.charValue() == '&' && sourceText.indexOf("&",sourceIndex) >= 0)){ //$NON-NLS-1$
- if(visualIndex == visualPosition) return true;
- sourceIndex += value.length()-1;
- }
- }else if(s3.charAt(visualIndex) == 160){
- if(sourceChar != ' ' && sourceChar != 160){
- if(visualIndex == visualPosition) return true;
- sourceIndex += 5;
- }
- }
- sourceIndex++;
- }
- return false;
- }
-
-// public static int sourcePosition(String sourceText, String visualText, int visualPosition) {
-// String s1 = visualText;
-//
-// String s3 = s1.substring(0, Math.min(visualPosition, s1.length()));
-// s3 = sourceText(s3);
-//
-// Character ch;
-// int sourceIndex = 0;
-// int visualIndex = 0;
-// for(visualIndex=0;visualIndex<s3.length();visualIndex++){
-// ch = new Character(s3.charAt(visualIndex));
-//
-// String value = (String)textSet.get(ch);
-// char sourceChar = sourceText.charAt(sourceIndex);
-// if(value != null){
-// if(sourceChar != ch.charValue() || (ch.charValue() == '&' && sourceText.indexOf("&",sourceIndex) >= 0)){
-// sourceIndex += value.length()-1;
-// }
-// }else if(s3.charAt(visualIndex) == 160){
-// if(sourceChar != ' ' && sourceChar != 160){
-// sourceIndex += 5;
-// }
-// }
-// sourceIndex++;
-// }
-// return s3.length()+(sourceIndex-visualIndex);
-// }
- public static int sourcePosition(String sourceText, String visualText, int visualPosition) {
- int sourceIndex = 0;
- int visualIndex = 0;
- while (sourceIndex < sourceText.length() && visualIndex < visualPosition) {
- char sourceChar = sourceText.charAt(sourceIndex);
- if (sourceChar == '\r') {
- if (visualText.charAt(visualIndex) == '\r') {
- visualIndex++;
- }
- sourceIndex++;
- } else if (sourceChar == CHR_ESC_START) {
- int end = sourceText.indexOf(CHR_ESC_STOP, sourceIndex + 1);
- if (end != -1 && textSet.containsValue(sourceText.substring(sourceIndex, end + 1))) {
- sourceIndex += end - sourceIndex;
- }
- sourceIndex++;
- visualIndex++;
- } else {
- sourceIndex++;
- visualIndex++;
- }
- }
- return sourceIndex;
- }
-
- public static int sourceInnerPosition(String visualText, long visualPosition) {
- visualText = visualText.substring(0, (int)Math.min(visualPosition, visualText.length()));
- String sourceText = visualText.replaceAll(VISUAL_BREAK, SOURCE_BREAK);
- return sourceText.length();
- }
-
- public static int visualPosition(String sourceText, int sourcePosition) {
- int calcPosition = sourcePosition;
- if(sourceText==null) {
- return 0;
- }
- int start = sourceText.indexOf(CHR_ESC_START);
- while (start != -1 && start < sourcePosition && start + 1 < sourceText.length()) {
- int stop = sourceText.indexOf(CHR_ESC_STOP, start + 1);
- if (stop == -1) {
- break;
- } else if (stop < sourcePosition) {
- if (textSet.containsValue(sourceText.substring(start, stop + 1))) {
- calcPosition -= stop - start;
- }
- if (stop + 1 < sourceText.length()) {
- start = sourceText.indexOf(CHR_ESC_START, stop + 1);
- } else {
- break;
- }
- } else {
- calcPosition -= sourcePosition - start;
- break;
- }
- }
- String s1 = sourceText.substring(0, sourcePosition);
- String s2 = s1.replaceAll(SOURCE_BREAK, VISUAL_BREAK);
- return calcPosition - (s1.length() - s2.length());
- }
-
- public static int visualInnerPosition(String sourceText, int sourcePosition) {
- sourceText = sourceText.substring(0, Math.min(sourcePosition, sourceText.length()));
- String visualText = sourceText.replaceAll(SOURCE_BREAK, VISUAL_BREAK);
- return visualText.length();
- }
-
- public static int _visualPosition(String sourceText, int sourcePosition) {
- int delta = 7;
- if(sourcePosition+delta > sourceText.length()) delta = sourceText.length()-sourcePosition;
- int position = Math.min(sourcePosition+delta, sourceText.length());
-
- String s1 = sourceText.substring(0, position);
- int start1 = s1.length()-delta;
- if(position < sourceText.length()){
- while(position > sourcePosition){
- int ampersandPosition = s1.lastIndexOf("&"); //$NON-NLS-1$
- int semicolonPosition = s1.lastIndexOf(";"); //$NON-NLS-1$
- if(ampersandPosition > 0 && semicolonPosition > 0 && ampersandPosition < semicolonPosition && (semicolonPosition+1) > sourcePosition){
- String value = s1.substring(ampersandPosition, semicolonPosition+1);
- if(textSet.containsValue(value))
- position = ampersandPosition;
- else
- position--;
- }else if(ampersandPosition > 0 && semicolonPosition > 0 && semicolonPosition > sourcePosition){
- position = semicolonPosition+1;
- }else{
- position--;
- }
- s1 = s1.substring(0, position);
- }
- }else{
- position -= delta;
- s1 = s1.substring(0, position);
- }
- int start2 = s1.length();
- int startLength = s1.length();
-
- String[] strings = (String[]) textSet.values().toArray(new String[]{});
- for(int i=0;i<strings.length;i++){
- s1 = s1.replaceAll(strings[i]," "); //$NON-NLS-1$
- }
- s1 = visualText(s1);
- return sourcePosition-(startLength - s1.length())-(start1-start2);
- }
-
- public static String visualText(String sourceText) {
- return sourceText.replaceAll(SOURCE_BREAK, VISUAL_BREAK);
- }
-
- public static String sourceText(String visualText) {
- return visualText.replaceAll(VISUAL_BREAK, SOURCE_BREAK).replace(VISUAL_SPACE, SOURCE_SPACE);
- }
-
- public static boolean isWhitespace(char sourceString) {
- String visualString = visualText((new Character(sourceString)).toString());
- return SPCHARS.indexOf(sourceString) != -1;
- }
-
- public static boolean isWhitespaceText(String sourceString) {
- if (sourceString != null && sourceString.length() > 0) {
- char[] chars = sourceString.toCharArray();
- for (int i = 0; i < sourceString.length(); i++) {
- if (!TextUtil.isWhitespace(sourceString.charAt(i)))
- return false;
- }
- }
- return true;
- }
-
- public static String getChar(nsIDOMKeyEvent keyEvent) {
- // get inserted string
- long charCode = keyEvent.getCharCode();
- char[] s = new char[1];
- s[0] = (char) charCode;
- String str = new String(s);
- if (TextUtil.containsKey(s[0])) {
- str = TextUtil.getValue(s[0]);
- }
-
- return str;
- }
-
-
- /**
- * @param value
- * @return
- */
- public static boolean isContainsEl(final String value) {
- return (value.contains("#{") || value.contains("${")); //$NON-NLS-1$//$NON-NLS-2$
- }
-
-}
+/*******************************************************************************
+ * 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.vpe.editor.util;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Map.Entry;
+
+import org.jboss.tools.vpe.VpePlugin;
+import org.mozilla.interfaces.nsIDOMKeyEvent;
+
+public class TextUtil {
+
+
+ // ISO codes are contained in interval [0,2^31 -1]
+ private final static int MIN_ISO_CODE_RANGE = 0;
+ private final static int MAX_ISO_CODE_RANGE = Integer.MAX_VALUE;
+
+ private final static String CODES_FILE = "htmlCodes.properties"; //$NON-NLS-1$
+
+ private final static String SOURCE_BREAK = "\r\n"; //$NON-NLS-1$
+ private final static String VISUAL_BREAK = "\n"; //$NON-NLS-1$
+ private final static char SOURCE_SPACE = ' ';
+ private final static char VISUAL_SPACE = 160;
+ private final static char CHR_ESC_START = '&';
+ private final static char CHR_SHARP = '#';
+ private final static char CHR_ESC_STOP = ';';
+ private final static char CHR_HEX_FLAG = 'x';
+ private final static String SPCHARS = "\f\n\r\t\u0020\u2028\u2029"; //$NON-NLS-1$
+ private final static Map<Character,String> textSet = new HashMap<Character,String>();
+ static{
+ try {
+ InputStream is = VpePlugin.getDefault().getBundle().getResource(CODES_FILE).openStream();
+ Properties prop = new Properties();
+ prop.load(is);
+ for (Entry<Object, Object> e : prop.entrySet()) {
+ textSet.put((char)Integer.parseInt((String) e.getKey()), (String) e.getValue());
+ }
+ is.close();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static boolean containsKey(char key){
+
+ return textSet.containsKey(new Character(key));
+ }
+
+ public static String getValue(char key){
+ return (String)textSet.get(new Character(key));
+ }
+
+ public static String isEcsToLeft(String sourceText, int sourcePosition) {
+ String s1 = sourceText;
+
+ String s2 = s1.substring(0, Math.min(sourcePosition, s1.length()));
+ int startIndex = s2.lastIndexOf(CHR_ESC_START);
+ int endIndex = s2.lastIndexOf(CHR_ESC_STOP);
+ if(startIndex >= 0 && endIndex >= 0 && endIndex == s2.length()-1){
+ String value = s2.substring(startIndex, endIndex+1);
+ if(textSet.containsValue(value)) return value;
+ }
+
+ return null;
+ }
+
+ public static String isEcsToRight(String sourceText, int sourcePosition) {
+ String s1 = sourceText;
+
+ String s2 = s1.substring(sourcePosition, s1.length());
+ int startIndex = s2.indexOf(CHR_ESC_START);
+ int endIndex = s2.indexOf(CHR_ESC_STOP);
+ if(startIndex >= 0 && endIndex >= 0 && startIndex == 0){
+ String value = s2.substring(startIndex, endIndex+1);
+ if(textSet.containsValue(value)) return value;
+ }
+
+ return null;
+ }
+
+ public static boolean isEcs(String sourceText, String visualText, int visualPosition) {
+ String s1 = visualText;
+
+ String s3 = s1.substring(0, Math.min(visualPosition+1, s1.length()));
+ s3 = sourceText(s3);
+
+ Character ch;
+ int sourceIndex = 0;
+ int visualIndex = 0;
+ for(visualIndex=0;visualIndex<s3.length();visualIndex++){
+ ch = new Character(s3.charAt(visualIndex));
+
+ String value = (String)textSet.get(ch);
+ char sourceChar = sourceText.charAt(sourceIndex);
+ if(value != null){
+ if(sourceChar != ch.charValue() || (ch.charValue() == '&' && sourceText.indexOf("&",sourceIndex) >= 0)){ //$NON-NLS-1$
+ if(visualIndex == visualPosition) return true;
+ sourceIndex += value.length()-1;
+ }
+ }else if(s3.charAt(visualIndex) == 160){
+ if(sourceChar != ' ' && sourceChar != 160){
+ if(visualIndex == visualPosition) return true;
+ sourceIndex += 5;
+ }
+ }
+ sourceIndex++;
+ }
+ return false;
+ }
+
+// public static int sourcePosition(String sourceText, String visualText, int visualPosition) {
+// String s1 = visualText;
+//
+// String s3 = s1.substring(0, Math.min(visualPosition, s1.length()));
+// s3 = sourceText(s3);
+//
+// Character ch;
+// int sourceIndex = 0;
+// int visualIndex = 0;
+// for(visualIndex=0;visualIndex<s3.length();visualIndex++){
+// ch = new Character(s3.charAt(visualIndex));
+//
+// String value = (String)textSet.get(ch);
+// char sourceChar = sourceText.charAt(sourceIndex);
+// if(value != null){
+// if(sourceChar != ch.charValue() || (ch.charValue() == '&' && sourceText.indexOf("&",sourceIndex) >= 0)){
+// sourceIndex += value.length()-1;
+// }
+// }else if(s3.charAt(visualIndex) == 160){
+// if(sourceChar != ' ' && sourceChar != 160){
+// sourceIndex += 5;
+// }
+// }
+// sourceIndex++;
+// }
+// return s3.length()+(sourceIndex-visualIndex);
+// }
+ public static int sourcePosition(String sourceText, String visualText, int visualPosition) {
+ int sourceIndex = 0;
+ int visualIndex = 0;
+ while (sourceIndex < sourceText.length() && visualIndex < visualPosition) {
+ char sourceChar = sourceText.charAt(sourceIndex);
+ if (sourceChar == '\r') {
+ if (visualText.charAt(visualIndex) == '\r') {
+ visualIndex++;
+ }
+ sourceIndex++;
+ } else if (sourceChar == CHR_ESC_START) {
+ // find index of the escape sequence's end
+ int end = sourceText.indexOf(CHR_ESC_STOP, sourceIndex + 1);
+
+ // if next symbol is '#' then escape sequence may be iso code
+ if (end != -1 && (sourceIndex + 2 < sourceText.length())
+ && sourceText.charAt(sourceIndex + 1) == CHR_SHARP) {
+
+ //convert string to number
+
+ int isoCode = MIN_ISO_CODE_RANGE - 1;
+
+ // if number has prefix 'x' means that it is hex number
+ int radix = sourceText.charAt(sourceIndex + 2) == CHR_HEX_FLAG ? 16
+ : 10;
+ int offcet = sourceText.charAt(sourceIndex + 2) == CHR_HEX_FLAG ? 3
+ : 2;
+
+ try {
+ isoCode = Integer.parseInt(sourceText.substring(
+ sourceIndex + offcet, end), radix);
+ } catch (NumberFormatException exception) {
+ }
+
+ // if escape sequence is iso code
+ if (isoCode >= MIN_ISO_CODE_RANGE
+ && isoCode <= MAX_ISO_CODE_RANGE) {
+ sourceIndex += end - sourceIndex;
+ }
+
+ }
+ // check is escape sequence is contained in the list
+ else if (end != -1
+ && textSet.containsValue(sourceText.substring(
+ sourceIndex, end + 1))) {
+ sourceIndex += end - sourceIndex;
+ }
+
+ sourceIndex++;
+ visualIndex++;
+ }
+ else {
+ sourceIndex++;
+ visualIndex++;
+ }
+ }
+ return sourceIndex;
+ }
+
+ public static int sourceInnerPosition(String visualText, long visualPosition) {
+ visualText = visualText.substring(0, (int)Math.min(visualPosition, visualText.length()));
+ String sourceText = visualText.replaceAll(VISUAL_BREAK, SOURCE_BREAK);
+ return sourceText.length();
+ }
+
+ public static int visualPosition(String sourceText, int sourcePosition) {
+ int calcPosition = sourcePosition;
+ if(sourceText==null) {
+ return 0;
+ }
+ int start = sourceText.indexOf(CHR_ESC_START);
+ while (start != -1 && start < sourcePosition && start + 1 < sourceText.length()) {
+ int stop = sourceText.indexOf(CHR_ESC_STOP, start + 1);
+ if (stop == -1) {
+ break;
+ } else if (stop < sourcePosition) {
+ if (textSet.containsValue(sourceText.substring(start, stop + 1))) {
+ calcPosition -= stop - start;
+ }
+ if (stop + 1 < sourceText.length()) {
+ start = sourceText.indexOf(CHR_ESC_START, stop + 1);
+ } else {
+ break;
+ }
+ } else {
+ calcPosition -= sourcePosition - start;
+ break;
+ }
+ }
+ String s1 = sourceText.substring(0, sourcePosition);
+ String s2 = s1.replaceAll(SOURCE_BREAK, VISUAL_BREAK);
+ return calcPosition - (s1.length() - s2.length());
+ }
+
+ public static int visualInnerPosition(String sourceText, int sourcePosition) {
+ sourceText = sourceText.substring(0, Math.min(sourcePosition, sourceText.length()));
+ String visualText = sourceText.replaceAll(SOURCE_BREAK, VISUAL_BREAK);
+ return visualText.length();
+ }
+
+ public static int _visualPosition(String sourceText, int sourcePosition) {
+ int delta = 7;
+ if(sourcePosition+delta > sourceText.length()) delta = sourceText.length()-sourcePosition;
+ int position = Math.min(sourcePosition+delta, sourceText.length());
+
+ String s1 = sourceText.substring(0, position);
+ int start1 = s1.length()-delta;
+ if(position < sourceText.length()){
+ while(position > sourcePosition){
+ int ampersandPosition = s1.lastIndexOf("&"); //$NON-NLS-1$
+ int semicolonPosition = s1.lastIndexOf(";"); //$NON-NLS-1$
+ if(ampersandPosition > 0 && semicolonPosition > 0 && ampersandPosition < semicolonPosition && (semicolonPosition+1) > sourcePosition){
+ String value = s1.substring(ampersandPosition, semicolonPosition+1);
+ if(textSet.containsValue(value))
+ position = ampersandPosition;
+ else
+ position--;
+ }else if(ampersandPosition > 0 && semicolonPosition > 0 && semicolonPosition > sourcePosition){
+ position = semicolonPosition+1;
+ }else{
+ position--;
+ }
+ s1 = s1.substring(0, position);
+ }
+ }else{
+ position -= delta;
+ s1 = s1.substring(0, position);
+ }
+ int start2 = s1.length();
+ int startLength = s1.length();
+
+ String[] strings = (String[]) textSet.values().toArray(new String[]{});
+ for(int i=0;i<strings.length;i++){
+ s1 = s1.replaceAll(strings[i]," "); //$NON-NLS-1$
+ }
+ s1 = visualText(s1);
+ return sourcePosition-(startLength - s1.length())-(start1-start2);
+ }
+
+ public static String visualText(String sourceText) {
+ return sourceText.replaceAll(SOURCE_BREAK, VISUAL_BREAK);
+ }
+
+ public static String sourceText(String visualText) {
+ return visualText.replaceAll(VISUAL_BREAK, SOURCE_BREAK).replace(VISUAL_SPACE, SOURCE_SPACE);
+ }
+
+ public static boolean isWhitespace(char sourceString) {
+ String visualString = visualText((new Character(sourceString)).toString());
+ return SPCHARS.indexOf(sourceString) != -1;
+ }
+
+ public static boolean isWhitespaceText(String sourceString) {
+ if (sourceString != null && sourceString.length() > 0) {
+ char[] chars = sourceString.toCharArray();
+ for (int i = 0; i < sourceString.length(); i++) {
+ if (!TextUtil.isWhitespace(sourceString.charAt(i)))
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static String getChar(nsIDOMKeyEvent keyEvent) {
+ // get inserted string
+ long charCode = keyEvent.getCharCode();
+ char[] s = new char[1];
+ s[0] = (char) charCode;
+ String str = new String(s);
+ if (TextUtil.containsKey(s[0])) {
+ str = TextUtil.getValue(s[0]);
+ }
+
+ return str;
+ }
+
+
+ /**
+ * @param value
+ * @return
+ */
+ public static boolean isContainsEl(final String value) {
+ return (value.contains("#{") || value.contains("${")); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+}
15 years, 9 months
JBoss Tools SVN: r14363 - in branches/jbosstools-3.0.x/portlet/plugins/org.jboss.tools.portlet.ui: icons and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-03-27 17:33:55 -0400 (Fri, 27 Mar 2009)
New Revision: 14363
Added:
branches/jbosstools-3.0.x/portlet/plugins/org.jboss.tools.portlet.ui/icons/portlet_wiz_small.gif
Modified:
branches/jbosstools-3.0.x/portlet/plugins/org.jboss.tools.portlet.ui/plugin.xml
Log:
JBIDE-4078 Portlet icons are too large for New submenu.
Added: branches/jbosstools-3.0.x/portlet/plugins/org.jboss.tools.portlet.ui/icons/portlet_wiz_small.gif
===================================================================
(Binary files differ)
Property changes on: branches/jbosstools-3.0.x/portlet/plugins/org.jboss.tools.portlet.ui/icons/portlet_wiz_small.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/jbosstools-3.0.x/portlet/plugins/org.jboss.tools.portlet.ui/plugin.xml
===================================================================
--- branches/jbosstools-3.0.x/portlet/plugins/org.jboss.tools.portlet.ui/plugin.xml 2009-03-27 21:26:23 UTC (rev 14362)
+++ branches/jbosstools-3.0.x/portlet/plugins/org.jboss.tools.portlet.ui/plugin.xml 2009-03-27 21:33:55 UTC (rev 14363)
@@ -27,7 +27,7 @@
name="%Java_portlet_wizard_name"
class="org.jboss.tools.portlet.ui.internal.wizard.NewPortletWizard"
category="org.jboss.tools.jst.web/org.jboss.tools.portlet"
- icon="icons/portlet_wiz.gif">
+ icon="icons/portlet_wiz_small.gif">
<description>%Portlet_wizard_description</description>
<selection class="org.eclipse.core.resources.IResource" />
</wizard>
@@ -36,7 +36,7 @@
name="%JSFSeam_portlet_wizard_name"
class="org.jboss.tools.portlet.ui.internal.wizard.NewJSFPortletWizard"
category="org.jboss.tools.jst.web/org.jboss.tools.portlet"
- icon="icons/portlet_wiz.gif">
+ icon="icons/portlet_wiz_small.gif">
<description>%JSFSeam_portlet_wizard_description</description>
<selection class="org.eclipse.core.resources.IResource" />
</wizard>
15 years, 9 months
JBoss Tools SVN: r14362 - in trunk/portlet/plugins/org.jboss.tools.portlet.ui: icons and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-03-27 17:26:23 -0400 (Fri, 27 Mar 2009)
New Revision: 14362
Added:
trunk/portlet/plugins/org.jboss.tools.portlet.ui/icons/portlet_wiz_small.gif
Modified:
trunk/portlet/plugins/org.jboss.tools.portlet.ui/plugin.xml
Log:
JBIDE-4078 Portlet icons are too large for New submenu.
Added: trunk/portlet/plugins/org.jboss.tools.portlet.ui/icons/portlet_wiz_small.gif
===================================================================
(Binary files differ)
Property changes on: trunk/portlet/plugins/org.jboss.tools.portlet.ui/icons/portlet_wiz_small.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/plugin.xml
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/plugin.xml 2009-03-27 19:11:06 UTC (rev 14361)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/plugin.xml 2009-03-27 21:26:23 UTC (rev 14362)
@@ -27,7 +27,7 @@
name="%Java_portlet_wizard_name"
class="org.jboss.tools.portlet.ui.internal.wizard.NewPortletWizard"
category="org.jboss.tools.jst.web/org.jboss.tools.portlet"
- icon="icons/portlet_wiz.gif">
+ icon="icons/portlet_wiz_small.gif">
<description>%Portlet_wizard_description</description>
<selection class="org.eclipse.core.resources.IResource" />
</wizard>
@@ -36,7 +36,7 @@
name="%JSFSeam_portlet_wizard_name"
class="org.jboss.tools.portlet.ui.internal.wizard.NewJSFPortletWizard"
category="org.jboss.tools.jst.web/org.jboss.tools.portlet"
- icon="icons/portlet_wiz.gif">
+ icon="icons/portlet_wiz_small.gif">
<description>%JSFSeam_portlet_wizard_description</description>
<selection class="org.eclipse.core.resources.IResource" />
</wizard>
15 years, 9 months