JBoss Tools SVN: r3121 - in branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces: template and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ezheleznyakov
Date: 2007-08-14 10:23:00 -0400 (Tue, 14 Aug 2007)
New Revision: 3121
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
Log:
http://jira.jboss.com/jira/browse/EXIN-435
change using Node to nsIDOMNode and Element to nsIDOMElement for classes:
RichFacesTreeTemplate
Change method revertTableRows(nsIDOMNode node)
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2007-08-14 13:32:04 UTC (rev 3120)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2007-08-14 14:23:00 UTC (rev 3121)
@@ -175,7 +175,6 @@
return children;
}
- //TODO: Evgeny Zheleznyakov remove if not references
/**
* Returns all child source elements of component but facets.
* @param sourceElement
@@ -251,8 +250,7 @@
String style = "background-image: url(file:///" + imgPath.replace('\\', '/') + ");";
return style;
}
-
- //TODO: Evgeny zheleznyakov remove or not references
+
/**
* Returns value of attribute.
* @param sourceElement
@@ -349,31 +347,6 @@
}
return inputPath;
}
-
- //TODO: Evgeny zheleznyakov remove or not references
- /**
- * Move attributes from sourceNode to html
- *
- * @param sourceNode
- * @param visualNode
- * @param attrName
- * @param htmlAttrName
- * @param prefValue
- * @param defValue
- */
- public static void correctAttribute(Element sourceNode, Element visualNode,
- String attrName, String htmlAttrName, String prefValue, String defValue) {
- String attrValue = ((Element) sourceNode).getAttribute(attrName);
- if (prefValue != null && prefValue.trim().length() > 0 && attrValue != null) {
- attrValue = prefValue.trim() + " " + attrValue;
- }
- if (attrValue != null) {
- visualNode.setAttribute(htmlAttrName, attrValue);
- } else if (defValue != null) {
- visualNode.setAttribute(htmlAttrName, defValue);
- } else
- visualNode.removeAttribute(attrName);
- }
/**
* Move attributes from sourceNode to html
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2007-08-14 13:32:04 UTC (rev 3120)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2007-08-14 14:23:00 UTC (rev 3121)
@@ -241,9 +241,10 @@
* @param node
*/
private void revertTableRows(nsIDOMNode node) {
- if (!(node instanceof nsIDOMElement)) {
- return;
- }
+
+ //if (!(node instanceof nsIDOMElement)) {
+ // return;
+ //}
nsIDOMNodeList list = node.getChildNodes();
if (node.getNodeName().equalsIgnoreCase(
18 years, 4 months
JBoss Tools SVN: r3120 - trunk/documentation/GettingStartedGuide/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2007-08-14 09:32:04 -0400 (Tue, 14 Aug 2007)
New Revision: 3120
Modified:
trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml
Log:
http://jira.jboss.com/jira/browse/EXIN-445 links update
Modified: trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml
===================================================================
--- trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml 2007-08-14 13:25:48 UTC (rev 3119)
+++ trunk/documentation/GettingStartedGuide/docs/userguide/en/modules/GettingStartedWithRHDS.xml 2007-08-14 13:32:04 UTC (rev 3120)
@@ -114,10 +114,10 @@
<title>Installing from the downloaded version</title>
<itemizedlist>
<listitem>
- <para>Download the appropriate installation file for your platform from http://www.redhat.com/developers/rhds/</para>
+ <para>Download the appropriate installation file for your platform from <ulink url="http://www.redhat.com/developers/rhds/index.html">Red Hat website</ulink>.</para>
</listitem>
<listitem>
- <para>Run install.jar and follow the instructions presented by the installation wizard</para>
+ <para>Run rhdevstudio-linux-gtk-1.0.0.beta1.jar and follow the instructions presented by the installation wizard</para>
</listitem>
</itemizedlist>
@@ -204,7 +204,7 @@
<section id="Downloading">
<title>Downloading</title>
<para><emphasis role="bold">Where can I download a copy of Red Hat Developer Studio?</emphasis></para>
- <para>Go to <ulink url="http://redhat.com/developers/rhds">Download Page</ulink></para>
+ <para>Go to <ulink url="http://www.redhat.com/developers/rhds/index.html">Download Page</ulink></para>
</section>
<section id="Installation_Issues">
<title>Installation Issues</title>
18 years, 4 months
JBoss Tools SVN: r3119 - branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: ezheleznyakov
Date: 2007-08-14 09:25:48 -0400 (Tue, 14 Aug 2007)
New Revision: 3119
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
Log:
http://jira.jboss.com/jira/browse/EXIN-435
change using Node to nsIDOMNode and Element to nsIDOMElement for classes:
RichFacesTreeTemplate
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2007-08-14 13:22:42 UTC (rev 3118)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2007-08-14 13:25:48 UTC (rev 3119)
@@ -241,7 +241,6 @@
* @param node
*/
private void revertTableRows(nsIDOMNode node) {
- try {
if (!(node instanceof nsIDOMElement)) {
return;
}
@@ -261,9 +260,6 @@
for (int i = 0; i < list2.getLength(); i++) {
revertTableRows(list2.item(i));
}
- }catch(Throwable t) {
- t.printStackTrace();
- }
}
/**
18 years, 4 months
JBoss Tools SVN: r3118 - in branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces: template and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ezheleznyakov
Date: 2007-08-14 09:22:42 -0400 (Tue, 14 Aug 2007)
New Revision: 3118
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToggleControlTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTogglePanelTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
Log:
http://jira.jboss.com/jira/browse/EXIN-435
change using Node to nsIDOMNode and Element to nsIDOMElement for classes:
RichFacesToggleControlTemplate
RichFacesTreeTemplate
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2007-08-14 13:12:54 UTC (rev 3117)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2007-08-14 13:22:42 UTC (rev 3118)
@@ -146,19 +146,7 @@
throw new RuntimeException("Can't get path for " + resourcePathInPlugin);
}
}
-
- // TDOD: Evgeny Zheleznyakov delete after work all components
- /**
- * Adds image as attribute to IMG tag
- *
- * @param img
- * @param fileImageName
- */
- public static void setImg(Element img, String fileImageName) {
- img.setAttribute("src", "file://" + getAbsoluteResourcePath(fileImageName));
- }
- // TDOD: Evgeny Zheleznyakov Do not delete
/**
* Adds image as attribute to IMG tag
*
@@ -225,25 +213,11 @@
return getChildren(visualElement, false);
}
- //TODO: Evgeny zheleznyakov remove or not references
/**
* Copies all attributes from source node to visual node.
* @param sourceNode
* @param visualNode
*/
- public static void copyAttributes(Node sourceNode, Element visualElement) {
- NamedNodeMap namedNodeMap = sourceNode.getAttributes();
- for (int i = 0; i < namedNodeMap.getLength(); i++) {
- Node attribute = namedNodeMap.item(i);
- visualElement.setAttribute(attribute.getNodeName(), attribute.getNodeValue());
- }
- }
-
- /**
- * Copies all attributes from source node to visual node.
- * @param sourceNode
- * @param visualNode
- */
public static void copyAttributes(Node sourceNode, nsIDOMElement visualElement) {
NamedNodeMap namedNodeMap = sourceNode.getAttributes();
for (int i = 0; i < namedNodeMap.getLength(); i++) {
@@ -335,26 +309,6 @@
String s = style.trim();
return style + (s.length() == 0 || s.endsWith(";") ? "" : ";") + element;
}
-
- //TODO: Evgeny zheleznyakov remove or not references
- /** Adds image as attribute to IMG tag from users worcpace
- * @param pageContext Page Context
- * @param img img element to which set picture
- * @param fileImageName image name
- * @param undefinedImgName default image when image is undefined
- */
- public static void setImgFromResources(VpePageContext pageContext,Element img, String fileImageName, String undefinedImgName) {
- IEditorInput input = pageContext.getEditPart().getEditorInput();
- IPath inputPath = getInputParentPath(input);
- File file=new File(inputPath.toOSString()+File.separator+fileImageName);
- if(file.exists()){
- img.setAttribute(HtmlComponentUtil.HTML_ATR_SRC,
- HtmlComponentUtil.FILE_PROTOCOL+inputPath.toOSString()+
- File.separator+fileImageName);
- } else {
- img.setAttribute(HtmlComponentUtil.HTML_ATR_SRC, undefinedImgName);
- }
- }
/** Adds image as attribute to IMG tag from users worcpace
* @param pageContext Page Context
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java 2007-08-14 13:12:54 UTC (rev 3117)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java 2007-08-14 13:22:42 UTC (rev 3118)
@@ -19,10 +19,8 @@
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* Template for Rich Faces separator
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToggleControlTemplate.java
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToggleControlTemplate.java 2007-08-14 13:12:54 UTC (rev 3117)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToggleControlTemplate.java 2007-08-14 13:22:42 UTC (rev 3118)
@@ -27,7 +27,8 @@
import org.jboss.tools.vpe.editor.template.VpeTemplate;
import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -35,24 +36,16 @@
public class RichFacesToggleControlTemplate extends VpeAbstractTemplate implements VpeToggableTemplate {
private static Map toggleMap = new HashMap();
- private static Element storedSwitchSpan = null;
-
- // TODO A. Yukhovich please fix it
- /*
- @Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement, Document visualDocument, Node visualNode, Object data, String name, String value) {
- return true;
- }
- */
+ private static nsIDOMElement storedSwitchSpan = null;
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, Document visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
Element sourceElement = (Element)sourceNode;
- Element span = visualDocument.createElement("span");
+ nsIDOMElement span = visualDocument.createElement("span");
storedSwitchSpan = span;
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*span*/);
+
+ VpeCreationData creationData = new VpeCreationData(span);
String forIds = sourceElement.getAttribute("for");
String value = sourceElement.getAttribute("value");
@@ -69,13 +62,12 @@
span.setAttribute("vpe-user-toggle-id", (switchToState == null ? "" : switchToState.trim()));
List<Node> children = ComponentUtil.getChildren(sourceElement);
- // TODO A. Yukhovich please fix it
- VpeChildrenInfo bodyInfo = new VpeChildrenInfo(null/*span*/);
+ VpeChildrenInfo bodyInfo = new VpeChildrenInfo(span);
//string shoudn't be null, if then it's crash application
if(value==null){
value="";
}
- Node valueText = visualDocument.createTextNode(value);
+ nsIDOMNode valueText = visualDocument.createTextNode(value);
span.appendChild(valueText);
for (Node child : children) {
@@ -93,9 +85,9 @@
* @param visualDocument The document of the visual tree.
* @param data Object <code>VpeCreationData</code>, built by a method <code>create</code>
*/
- public void validate(VpePageContext pageContext, Node sourceNode, Document visualDocument, VpeCreationData data) {
- // TODO A. Yukhovich please fix it
- // super.validate(pageContext, sourceNode, visualDocument, data);
+ public void validate(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument, VpeCreationData data) {
+
+ super.validate(pageContext, sourceNode, visualDocument, data);
if (storedSwitchSpan == null) return;
String value = storedSwitchSpan.getAttribute("vpe-user-toggle-id");
@@ -103,12 +95,13 @@
applyAttributeValueOnChildren("vpe-user-toggle-lookup-parent", "true", ComponentUtil.getChildren(storedSwitchSpan));
}
- private void applyAttributeValueOnChildren(String attrName, String attrValue, List<Node> children) {
+ private void applyAttributeValueOnChildren(String attrName, String attrValue, List<nsIDOMNode> children) {
if (children == null || attrName == null || attrValue == null) return;
- for (Node child : children) {
- if (child instanceof Element) {
- Element childElement = (Element)child;
+ for (nsIDOMNode child : children) {
+ if (child instanceof nsIDOMElement) {
+ nsIDOMElement childElement = (nsIDOMElement)child
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
childElement.setAttribute(attrName, attrValue);
applyAttributeValueOnChildren(attrName, attrValue, ComponentUtil.getChildren(childElement));
}
@@ -145,8 +138,6 @@
}
}
}
-
-
}
private List<Element> findElementsById (Element root, String id) {
@@ -173,11 +164,4 @@
public void stopToggling(Node sourceNode) {
toggleMap.remove(sourceNode);
}
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
-
}
\ No newline at end of file
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTogglePanelTemplate.java
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTogglePanelTemplate.java 2007-08-14 13:12:54 UTC (rev 3117)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTogglePanelTemplate.java 2007-08-14 13:22:42 UTC (rev 3118)
@@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
@@ -21,10 +20,8 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2007-08-14 13:12:54 UTC (rev 3117)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2007-08-14 13:22:42 UTC (rev 3118)
@@ -165,9 +165,8 @@
public void validate(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument, VpeCreationData data) {
super.validate(pageContext, sourceNode, visualDocument, data);
- //TODO: Evgeny Zheleznyakov
- nsIDOMNode node = data.getNode();
- revertTableRows(node);
+ data.getChildrenInfoList().get(0);
+ revertTableRows(data.getNode());
}
/**
@@ -242,9 +241,11 @@
* @param node
*/
private void revertTableRows(nsIDOMNode node) {
+ try {
if (!(node instanceof nsIDOMElement)) {
return;
}
+
nsIDOMNodeList list = node.getChildNodes();
if (node.getNodeName().equalsIgnoreCase(
HtmlComponentUtil.HTML_TAG_TABLE)
@@ -260,6 +261,9 @@
for (int i = 0; i < list2.getLength(); i++) {
revertTableRows(list2.item(i));
}
+ }catch(Throwable t) {
+ t.printStackTrace();
+ }
}
/**
@@ -357,11 +361,8 @@
.equals(name)) {
correctImage(pageContext, sourceElement, visualNode);
}
- }
+ }
-
-
-
@Override
public void removeAttribute(VpePageContext pageContext,
Element sourceElement, nsIDOMDocument visualDocument, nsIDOMNode visualNode,
18 years, 4 months
JBoss Tools SVN: r3117 - branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor.
by jbosstools-commits@lists.jboss.org
Author: ayukhovich
Date: 2007-08-14 09:12:54 -0400 (Tue, 14 Aug 2007)
New Revision: 3117
Added:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/DOMElementUtils.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/ElementPositionAndDimention.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizeListener.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizer.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizer.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseMotionListener.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java
Log:
http://jira.jboss.com/jira/browse/EXIN-436
Add initial classes from protptype
Added: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/DOMElementUtils.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/DOMElementUtils.java (rev 0)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/DOMElementUtils.java 2007-08-14 13:12:54 UTC (rev 3117)
@@ -0,0 +1,29 @@
+package org.jboss.tools.vpe.xulrunner.editor;
+
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNSHTMLElement;
+
+/**
+ * @author A. Yukhovich
+ */
+public class DOMElementUtils {
+
+ /**
+ * @param domElement
+ * @return
+ */
+ static public ElementPositionAndDimention getElementPositionAndDimention(nsIDOMElement domElement) {
+ ElementPositionAndDimention elementPositionAndDimention = new ElementPositionAndDimention();
+
+ nsIDOMNSHTMLElement nsElement = (nsIDOMNSHTMLElement) domElement.queryInterface(nsIDOMNSHTMLElement.NS_IDOMNSHTMLELEMENT_IID);
+
+ if (nsElement != null) {
+ elementPositionAndDimention.setWidth(nsElement.getOffsetWidth());
+ elementPositionAndDimention.setHeight(nsElement.getOffsetHeight());
+ elementPositionAndDimention.setTop(nsElement.getOffsetTop());
+ elementPositionAndDimention.setLeft(nsElement.getOffsetLeft());
+ }
+
+ return elementPositionAndDimention;
+ }
+}
Added: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/ElementPositionAndDimention.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/ElementPositionAndDimention.java (rev 0)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/ElementPositionAndDimention.java 2007-08-14 13:12:54 UTC (rev 3117)
@@ -0,0 +1,116 @@
+package org.jboss.tools.vpe.xulrunner.editor;
+
+/**
+ * @author A. Yukhovich
+ *
+ */
+public class ElementPositionAndDimention {
+ private int top;
+ private int left;
+ private int height;
+ private int width;
+
+ private int borderLeft;
+ private int borderTop;
+ private int marginTop;
+ private int marginLeft;
+
+ /**
+ * @return the top
+ */
+ public int getTop() {
+ return top;
+ }
+ /**
+ * @param top the top to set
+ */
+ public void setTop(int top) {
+ this.top = top;
+ }
+ /**
+ * @return the left
+ */
+ public int getLeft() {
+ return left;
+ }
+ /**
+ * @param left the left to set
+ */
+ public void setLeft(int left) {
+ this.left = left;
+ }
+ /**
+ * @return the height
+ */
+ public int getHeight() {
+ return height;
+ }
+ /**
+ * @param height the height to set
+ */
+ public void setHeight(int height) {
+ this.height = height;
+ }
+ /**
+ * @return the width
+ */
+ public int getWidth() {
+ return width;
+ }
+ /**
+ * @param width the width to set
+ */
+ public void setWidth(int width) {
+ this.width = width;
+ }
+ /**
+ * @return the borderLeft
+ */
+ public int getBorderLeft() {
+ return borderLeft;
+ }
+ /**
+ * @param borderLeft the borderLeft to set
+ */
+ public void setBorderLeft(int borderLeft) {
+ this.borderLeft = borderLeft;
+ }
+ /**
+ * @return the borderTop
+ */
+ public int getBorderTop() {
+ return borderTop;
+ }
+ /**
+ * @param borderTop the borderTop to set
+ */
+ public void setBorderTop(int borderTop) {
+ this.borderTop = borderTop;
+ }
+ /**
+ * @return the marginTop
+ */
+ public int getMarginTop() {
+ return marginTop;
+ }
+ /**
+ * @param marginTop the marginTop to set
+ */
+ public void setMarginTop(int marginTop) {
+ this.marginTop = marginTop;
+ }
+ /**
+ * @return the marginLeft
+ */
+ public int getMarginLeft() {
+ return marginLeft;
+ }
+ /**
+ * @param marginLeft the marginLeft to set
+ */
+ public void setMarginLeft(int marginLeft) {
+ this.marginLeft = marginLeft;
+ }
+
+}
+
Added: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizeListener.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizeListener.java (rev 0)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizeListener.java 2007-08-14 13:12:54 UTC (rev 3117)
@@ -0,0 +1,21 @@
+package org.jboss.tools.vpe.xulrunner.editor;
+
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsISupports;
+
+/**
+ * a IVpeResizeListener interface
+ * @author A. Yukhovich
+ */
+public interface IVpeResizeListener extends nsISupports {
+ /**
+ * Event handler for 'object end resizing'
+ * @param usedResizeMarkerHandle a used resize marker handle
+ * @param top a new top position
+ * @param left a new left position
+ * @param width a new width
+ * @param height a new height
+ * @param resizedDomElement a resized nsIDOMElement
+ */
+ public void onEndResizing(int usedResizeMarkerHandle, int top, int left, int width, int height, nsIDOMElement resizedDomElement);
+}
Added: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizer.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizer.java (rev 0)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizer.java 2007-08-14 13:12:54 UTC (rev 3117)
@@ -0,0 +1,84 @@
+package org.jboss.tools.vpe.xulrunner.editor;
+
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMEvent;
+
+/**
+ * IVpeResize interface class
+ * @author A. Yukhovich
+ */
+public interface IVpeResizer {
+ /** RESIZER_MARKER_TOPLEFT */
+ final static public int RESIZER_MARKER_TOPLEFT = 1;
+
+ /** RESIZER_MARKER_TOP */
+ final static public int RESIZER_MARKER_TOP = 2;
+
+ /** RESIZER_MARKER_TOPRIGHT */
+ final static public int RESIZER_MARKER_TOPRIGHT = 4;
+
+ /** RESIZER_MARKER_LEFT */
+ final static public int RESIZER_MARKER_LEFT = 8;
+
+ /** RESIZER_MARKER_RIGHT */
+ final static public int RESIZER_MARKER_RIGHT = 16;
+
+ /** RESIZER_MARKER_BOTTOMLEFT */
+ final static public int RESIZER_MARKER_BOTTOMLEFT = 32;
+
+ /** RESIZER_MARKER_BOTTOM */
+ final static public int RESIZER_MARKER_BOTTOM = 64;
+
+ /** RESIZER_MARKER_BOTTOMRIGHT */
+ final static public int RESIZER_MARKER_BOTTOMRIGHT = 128;
+
+
+ public void init(nsIDOMDocument domDocument);
+
+ /**
+ * Show resize markers
+ * @param domElement
+ * @param resizers
+ */
+ public void show(nsIDOMElement domElement, int resizers);
+
+ /**
+ * Hide resize markers
+ */
+ public void hide();
+
+ /**
+ * Event handler MouseDown
+ * @param clientX
+ * @param clientY
+ * @param domElement a target nsIDOMElement
+ */
+ public void mouseDown(int clientX, int clientY, nsIDOMElement domElement);
+
+ /**
+ * Event handler MouseMove
+ * @param event
+ */
+ public void mouseMove(nsIDOMEvent event);
+
+ /**
+ * Event handler MouseUp
+ * @param clientX
+ * @param clientY
+ * @param target a target nsIDOMElement
+ */
+ public void mouseUp(int clientX, int clientY, nsIDOMElement target);
+
+ /**
+ * add resize listener to queue
+ * @param aListener a IVpeResizeListener object
+ */
+ public void addResizeListener(IVpeResizeListener aListener);
+
+ /**
+ * remove resize listener from queue
+ * @param aListener a IVpeResizeListener object
+ */
+ public void removeResizeListener(IVpeResizeListener aListener);
+}
Added: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizer.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizer.java (rev 0)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizer.java 2007-08-14 13:12:54 UTC (rev 3117)
@@ -0,0 +1,790 @@
+package org.jboss.tools.vpe.xulrunner.editor;
+
+import java.util.ArrayList;
+
+import org.mozilla.interfaces.nsIDOMCSSStyleDeclaration;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMElementCSSInlineStyle;
+import org.mozilla.interfaces.nsIDOMEvent;
+import org.mozilla.interfaces.nsIDOMEventListener;
+import org.mozilla.interfaces.nsIDOMEventTarget;
+import org.mozilla.interfaces.nsIDOMHTMLDocument;
+import org.mozilla.interfaces.nsIDOMHTMLElement;
+import org.mozilla.interfaces.nsIDOMMouseEvent;
+import org.mozilla.interfaces.nsIDOMNode;
+
+/**
+ * IVPEResizer implementation
+ * @author A. Yukhovich
+ */
+public class VpeResizer implements IVpeResizer {
+ /** COEFFICIENT_TYPE */
+ enum COEFFICIENT_TYPE { X, Y, WIDTH, HEIGHT };
+
+
+ /** RESIZER_MARKER_STRING_TOPLEFT */
+ final static private String RESIZER_MARKER_STRING_TOPLEFT = "nw";
+
+ /** RESIZER_MARKER_STRING_TOP */
+ final static private String RESIZER_MARKER_STRING_TOP = "n";
+
+ /** RESIZER_MARKER_STRING_TOPRIGHT */
+ final static private String RESIZER_MARKER_STRING_TOPRIGHT = "ne";
+
+ /** RESIZER_MARKER_STRING_LEFT */
+ final static private String RESIZER_MARKER_STRING_LEFT = "w";
+
+ /** RESIZER_MARKER_STRING_BOTTOMLEFT */
+ final static private String RESIZER_MARKER_STRING_RIGHT = "e";
+
+ /** RESIZER_MARKER_STRING_BOTTOMLEFT */
+ final static private String RESIZER_MARKER_STRING_BOTTOMLEFT = "sw";
+
+ /** RESIZER_MARKER_STRING_BOTTOM */
+ final static private String RESIZER_MARKER_STRING_BOTTOM = "s";
+
+ /** RESIZER_MARKER_STRING_BOTTOMRIGHT */
+ final static private String RESIZER_MARKER_STRING_BOTTOMRIGHT = "se";
+
+ /** MAX_SIZE */
+ final static private int MAX_SIZE = 20000000;
+
+
+ nsIDOMEventListener mouseListener;
+ nsIDOMEventListener mouseMotionListener;
+
+
+ private ArrayList<IVpeResizeListener> objectResizeEventListeners = new ArrayList<IVpeResizeListener>();
+
+ private boolean isResizing;
+ private int originalX;
+ private int originalY;
+
+ private int usedEResizeMarkerHandle;
+
+ private int incrementFactorX;
+ private int incrementFactorY;
+ private int incrementFactorWidth;
+ private int incrementFactorHeight;
+
+
+ /** resizingObject */
+ private nsIDOMElement resizingObject;
+
+ /** resizingShadow */
+ private nsIDOMElement resizingShadow;
+
+ /** domDocument */
+ private nsIDOMDocument domDocument;
+
+ private nsIDOMElement activeHandle;
+
+ private ElementPositionAndDimention elementPositionAndDimention;
+
+ /** resizer marker top-left */
+ private nsIDOMElement markerTopLeft = null;
+
+ /** resizer marker top */
+ private nsIDOMElement markerTop = null;
+
+ /** resizer marker top-right */
+ private nsIDOMElement markerTopRight = null;
+
+ /** resizer marker left */
+ private nsIDOMElement markerLeft = null;
+
+ /** resizer marker right */
+ private nsIDOMElement markerRight = null;
+
+ /** resizer marker bottom */
+ private nsIDOMElement markerBottom = null;
+
+ /** resizer marker bottom-left */
+ private nsIDOMElement markerBottomLeft = null;
+
+ /** resizer marker bottom-right */
+ private nsIDOMElement markerBottomRight = null;
+
+
+ /**
+ *
+ * @param domDocument
+ */
+ public void init(nsIDOMDocument domDocument)
+ {
+
+ this.domDocument = domDocument;
+
+ mouseListener = new VpeResizerMouseListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#show(org.mozilla.interfaces.nsIDOMElement,
+ * int)
+ */
+ public void show(nsIDOMElement domElement, int resizers) {
+ resizingObject = domElement;
+
+ elementPositionAndDimention = DOMElementUtils.getElementPositionAndDimention(domElement);
+
+ if ((elementPositionAndDimention.getWidth() <= 0) ||
+ (elementPositionAndDimention.getWidth() > MAX_SIZE) ||
+ (elementPositionAndDimention.getHeight() <= 0) ||
+ (elementPositionAndDimention.getHeight() > MAX_SIZE)) return;
+
+ nsIDOMElement bodyElement = getRootElement();
+
+ if (bodyElement == null ) return;
+
+ if ((resizers & RESIZER_MARKER_TOPLEFT) == RESIZER_MARKER_TOPLEFT) {
+ markerTopLeft = createResizer( RESIZER_MARKER_STRING_TOPLEFT, bodyElement);
+ if (markerTopLeft == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_TOP) == RESIZER_MARKER_TOP) {
+ markerTop = createResizer( RESIZER_MARKER_STRING_TOP, bodyElement);
+ if (markerTop == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_TOPRIGHT) == RESIZER_MARKER_TOPRIGHT) {
+ markerTopRight = createResizer(RESIZER_MARKER_STRING_TOPRIGHT, bodyElement);
+ if (markerTopRight == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_LEFT) == RESIZER_MARKER_LEFT) {
+ markerLeft = createResizer(RESIZER_MARKER_STRING_LEFT, bodyElement);
+ if (markerLeft == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_RIGHT) == RESIZER_MARKER_RIGHT) {
+ markerRight = createResizer(RESIZER_MARKER_STRING_RIGHT, bodyElement);
+ if (markerRight == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_BOTTOMLEFT) == RESIZER_MARKER_BOTTOMLEFT) {
+ markerBottomLeft = createResizer(RESIZER_MARKER_STRING_BOTTOMLEFT, bodyElement);
+ if (markerBottomLeft == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_BOTTOM) == RESIZER_MARKER_BOTTOM) {
+ markerBottom = createResizer(RESIZER_MARKER_STRING_BOTTOM, bodyElement);
+ if (markerBottom == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_BOTTOMRIGHT) == RESIZER_MARKER_BOTTOMRIGHT) {
+ markerBottomRight = createResizer(RESIZER_MARKER_STRING_BOTTOMRIGHT, bodyElement);
+ if (markerBottomRight == null) {
+ return ;
+ }
+ }
+
+ setAllResizersPosition();
+
+ resizingShadow = createShadow(bodyElement, resizingObject);
+
+ setShadowPosition(resizingShadow, elementPositionAndDimention.getLeft(), elementPositionAndDimention.getTop());
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#hide()
+ */
+ public void hide()
+ {
+ nsIDOMElement bodyElement;
+
+ bodyElement = getRootElement();
+ if ( bodyElement == null ) {
+ return;
+ }
+
+ nsIDOMNode parentNode = (nsIDOMNode) bodyElement.queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+
+ if ( parentNode == null) {
+ return;
+ }
+
+ if ( markerTopLeft != null) {
+ parentNode.removeChild(markerTopLeft);
+ }
+
+ if ( markerTop != null) {
+ parentNode.removeChild(markerTop);
+ }
+
+
+ if ( markerTopRight != null) {
+ parentNode.removeChild(markerTopRight);
+ }
+
+ if ( markerLeft != null) {
+ parentNode.removeChild(markerLeft);
+ }
+
+ if ( markerRight != null) {
+ parentNode.removeChild(markerRight);
+ }
+
+ if ( markerBottomLeft != null) {
+ parentNode.removeChild(markerBottomLeft);
+ }
+
+ if ( markerBottom != null) {
+ parentNode.removeChild(markerBottom);
+ }
+
+ if ( markerBottomRight != null) {
+ parentNode.removeChild(markerBottomRight);
+ }
+
+
+ if ( resizingShadow != null ) {
+ parentNode.removeChild(resizingShadow);
+ }
+
+ markerBottom = null;
+ markerTop = null;
+ markerLeft = null;
+ markerRight = null;
+ markerBottomRight = null;
+ markerBottomLeft = null;
+ markerTopRight = null;
+ markerTopLeft = null;
+
+ resizingShadow = null;
+ resizingObject = null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#mouseDown(int, int, org.mozilla.interfaces.nsIDOMElement)
+ */
+ public void mouseDown(int clientX, int clientY, nsIDOMElement domElement) {
+
+
+ if ( domElement != null ) {
+
+ boolean isAnonElement = domElement.hasAttribute(XulRunnerConstants.STRING_MOZ_ANONCLASS);
+
+ if (isAnonElement) {
+ String anonclass = domElement.getAttribute(XulRunnerConstants.STRING_MOZ_ANONCLASS);
+
+ if ( anonclass != null ) {
+ if ( anonclass.equals(XulRunnerConstants.VPE_CLASSNAME_MOZ_RESIZER) ) {
+ originalX = clientX;
+ originalY = clientY;
+ startResizing(domElement);
+ } // if
+ } // if
+ } // if
+ } // if
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#mouseMove(org.mozilla.interfaces.nsIDOMEvent)
+ */
+ public void mouseMove(nsIDOMEvent event) {
+ if (isResizing) {
+ nsIDOMMouseEvent mouseEvent = (nsIDOMMouseEvent)event.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID);
+ int clientX, clientY;
+
+ clientX = mouseEvent.getClientX();
+ clientY = mouseEvent.getClientY();
+
+ int newX = getNewResizingX(clientX, clientY);
+ int newY = getNewResizingY(clientX, clientY);
+ int newWidth = getNewResizingWidth(clientX, clientY);
+ int newHeight = getNewResizingHeight(clientX, clientY);
+
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_LEFT, newX);
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_TOP, newY);
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_WIDTH, newWidth);
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_HEIGHT, newHeight);
+ } // if
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#mouseUp(int, int, org.mozilla.interfaces.nsIDOMElement)
+ */
+ public void mouseUp(int aX, int aY, nsIDOMElement target) {
+ if (isResizing) {
+ isResizing = false;
+
+
+ hideShadow();
+ endResizing(aX, aY);
+
+ nsIDOMEventTarget erP = getDOMEventTarget();
+
+ if (erP != null) {
+ erP.removeEventListener(XulRunnerConstants.EVENT_NAME_MOUSEMOVE, mouseMotionListener, true);
+ erP.removeEventListener(XulRunnerConstants.EVENT_NAME_MOUSEUP, mouseListener, true);
+ mouseMotionListener = null;
+ }
+ }
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#addResizeListener(org.jboss.vpe.mozilla.resizer.IVpeResizeListener)
+ */
+ public void addResizeListener(IVpeResizeListener listener) {
+ if ( (objectResizeEventListeners.size() != 0 ) &&
+ ( objectResizeEventListeners.indexOf(listener) != -1)) {
+ return;
+ }
+ objectResizeEventListeners.add(listener);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#removeResizeListener(org.jboss.vpe.mozilla.resizer.IVpeResizeListener)
+ */
+ public void removeResizeListener(IVpeResizeListener listener) {
+ if ( (objectResizeEventListeners.size() == 0 ) ||
+ ( objectResizeEventListeners.indexOf(listener) == -1)) {
+ return;
+ }
+ objectResizeEventListeners.remove(listener);
+ }
+
+ /**
+ * Setting a position of shadow
+ * @param shadowElement
+ * @param aOriginalObjectX
+ * @param aOriginalObjectY
+ */
+ private void setShadowPosition(nsIDOMElement shadowElement, int aOriginalObjectX, int aOriginalObjectY)
+ {
+ setAnonymousElementPosition(aOriginalObjectX, aOriginalObjectY, shadowElement);
+ }
+
+
+ /**
+ * create a anonymous dom-element
+ *
+ * @param aTag
+ * a tag of dom element
+ * @param aParentNode
+ * @param aAnonClass
+ * @param isCreatedHidden
+ * @return
+ */
+ private nsIDOMElement createAnonymousElement(String aTag, nsIDOMNode aParentNode, String aAnonClass, boolean isCreatedHidden) {
+ nsIDOMElement returnElement = null;
+
+ returnElement = domDocument.createElement(aTag);
+
+ // add the "hidden" class if needed
+ if (isCreatedHidden) {
+ returnElement.setAttribute(XulRunnerConstants.HTML_ATTR_CLASS, XulRunnerConstants.HTML_VALUE_HIDDEN);
+ }
+
+ // add an _moz_anonclass attribute if needed
+ if ( aAnonClass.length() != 0 ) {
+ returnElement.setAttribute(XulRunnerConstants.STRING_MOZ_ANONCLASS, aAnonClass);
+ }
+
+ aParentNode.appendChild(returnElement);
+
+ return returnElement;
+ }
+
+ /**
+ *
+ * @param parentNode
+ * @param originalObject
+ * @return
+ */
+ private nsIDOMElement createShadow(nsIDOMNode parentNode, nsIDOMElement originalObject) {
+ nsIDOMElement returnElement = null;
+
+ returnElement = createAnonymousElement(XulRunnerConstants.HTML_TAG_SPAN, parentNode, XulRunnerConstants.VPE_CLASS_NAME_MOZ_RESIZING_SHADOW, true );
+
+ return returnElement;
+ }
+
+ /**
+ *
+ * @param domElement
+ */
+ private void startResizing(nsIDOMElement domElement) {
+ isResizing = true;
+
+ activeHandle = domElement;
+ activeHandle.setAttribute(XulRunnerConstants.STRING_MOZ_ACTIVATED, XulRunnerConstants.HTML_VALUE_TRUE);
+
+
+ String locationStr = activeHandle.getAttribute(XulRunnerConstants.HTML_ATTR_ANONLOCATION);
+
+ if (locationStr == null ) {
+ return;
+ }
+
+ if (locationStr.equals(RESIZER_MARKER_STRING_TOPLEFT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_TOPLEFT;
+ setResizeIncrements(1, 1, -1, -1, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_TOP)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_TOP;
+ setResizeIncrements(0, 1, 0, -1, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_TOPRIGHT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_TOPRIGHT;
+ setResizeIncrements(0, 1, 1, -1, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_LEFT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_LEFT;
+ setResizeIncrements(1, 0, -1, 0, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_RIGHT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_RIGHT;
+ setResizeIncrements(0, 0, 1, 0, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_BOTTOMLEFT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_BOTTOMLEFT;
+ setResizeIncrements(1, 0, -1, 1, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_BOTTOM)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_BOTTOM;
+ setResizeIncrements(0, 0, 0, 1, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_BOTTOMRIGHT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_BOTTOMRIGHT;
+ setResizeIncrements(0, 0, 1, 1, false);
+ }
+
+ // make the shadow appear
+ resizingShadow.removeAttribute(XulRunnerConstants.HTML_ATTR_CLASS);
+
+ // position it
+ setShadowPosition(resizingShadow, elementPositionAndDimention.getLeft(), elementPositionAndDimention.getTop());
+
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_WIDTH, elementPositionAndDimention.getWidth() );
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_HEIGHT, elementPositionAndDimention.getTop() );
+
+
+ if (mouseMotionListener != null) {
+ return;
+ }
+
+ mouseMotionListener = new VpeResizerMouseMotionListener(this);
+ if ( mouseMotionListener != null ) {
+ return;
+ }
+
+ nsIDOMEventTarget eventTarget = getDOMEventTarget();
+
+ if ( eventTarget != null ) {
+ eventTarget.addEventListener(XulRunnerConstants.EVENT_NAME_MOUSEMOVE, mouseMotionListener, true);
+ eventTarget.addEventListener(XulRunnerConstants.EVENT_NAME_MOUSEUP, mouseListener, true);
+ }
+
+ return;
+ }
+
+ /**
+ * getting a nsIDOMEventTarget from nsIDOMDocument
+ * @return nsIDOMEventTarget from nsIDOMDocument
+ */
+ private nsIDOMEventTarget getDOMEventTarget() {
+
+ nsIDOMEventTarget eventTarget = (nsIDOMEventTarget) domDocument.queryInterface(nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID);
+ if (eventTarget == null) {
+ throw new RuntimeException("nsIDOMEventTarget is null");
+ }
+
+ return eventTarget;
+ }
+
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @return
+ */
+ private int getNewResizingX(int aX, int aY)
+ {
+ int resized = elementPositionAndDimention.getLeft() + getNewResizingIncrement(aX, aY, COEFFICIENT_TYPE.X) * incrementFactorX;
+ int max = elementPositionAndDimention.getLeft() + elementPositionAndDimention.getWidth();
+ return Math.min(resized, max);
+ }
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @return
+ */
+ private int getNewResizingY(int aX, int aY)
+ {
+ int resized = elementPositionAndDimention.getTop() + getNewResizingIncrement(aX, aY, COEFFICIENT_TYPE.Y) * incrementFactorY;
+ int max = elementPositionAndDimention.getTop() + elementPositionAndDimention.getHeight();
+ return Math.min(resized, max);
+ }
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @return
+ */
+ private int getNewResizingWidth(int aX, int aY)
+ {
+ int resized = elementPositionAndDimention.getWidth() + getNewResizingIncrement(aX, aY, COEFFICIENT_TYPE.WIDTH) * incrementFactorWidth;
+ return Math.max(resized, 1);
+ }
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @return
+ */
+ private int getNewResizingHeight(int aX, int aY)
+ {
+ int resized = elementPositionAndDimention.getHeight() + getNewResizingIncrement(aX, aY, COEFFICIENT_TYPE.HEIGHT) * incrementFactorHeight;
+ return Math.max(resized, 1);
+ }
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @param coefficient_type
+ * @return
+ */
+ private int getNewResizingIncrement(int aX, int aY, COEFFICIENT_TYPE coefficient_type)
+ {
+ int result = 0;
+
+ switch (coefficient_type) {
+ case X:
+ case WIDTH:
+ result = aX - originalX;
+ break;
+ case Y:
+ case HEIGHT:
+ result = aY - originalY;
+ break;
+ }
+ return result;
+ }
+
+
+ /**
+ * Get root element
+ *
+ * @return root element
+ */
+ private nsIDOMElement getRootElement() {
+
+ nsIDOMElement bodyElement = null;
+
+ nsIDOMHTMLDocument htmlDocument = (nsIDOMHTMLDocument) domDocument.queryInterface(nsIDOMHTMLDocument.NS_IDOMHTMLDOCUMENT_IID);
+
+ if ( htmlDocument != null ) {
+ nsIDOMHTMLElement htmlBody = htmlDocument.getBody();
+
+ if ( htmlBody != null ) {
+ bodyElement = (nsIDOMElement) htmlBody.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ } // if
+ } // if
+
+ return bodyElement;
+ }
+
+ /**
+ * Create a new resizer element
+ * @param resizerMarkerString
+ * @param parentNode
+ * @return a new resizer element
+ */
+ private nsIDOMElement createResizer(String resizerMarkerString, nsIDOMNode parentNode) {
+ nsIDOMElement aNewResizer = createAnonymousElement(XulRunnerConstants.HTML_TAG_SPAN, parentNode, XulRunnerConstants.VPE_CLASSNAME_MOZ_RESIZER, false );
+
+ nsIDOMEventTarget evtTarget = (nsIDOMEventTarget) aNewResizer.queryInterface(nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID);
+
+ evtTarget.addEventListener(XulRunnerConstants.EVENT_NAME_MOUSEDOWN, mouseListener, true);
+
+ aNewResizer.setAttribute(XulRunnerConstants.HTML_ATTR_ANONLOCATION, resizerMarkerString);
+
+ return aNewResizer;
+ }
+
+
+ /**
+ * Set all positions of resizer's markers
+ */
+ private void setAllResizersPosition() {
+ int left = elementPositionAndDimention.getLeft();
+ int top = elementPositionAndDimention.getTop();
+ int width = elementPositionAndDimention.getWidth();
+ int height = elementPositionAndDimention.getHeight();
+
+ int resizerWidth = 5;
+ int resizerHeight = 5;
+
+ int rw = (int)((resizerWidth + 1) / 2);
+ int rh = (int)((resizerHeight+ 1) / 2);
+
+ if (markerTopLeft != null) {
+ setAnonymousElementPosition(left-resizerWidth-2, top-resizerHeight-2, markerTopLeft);
+ }
+
+ if (markerTop != null) {
+ setAnonymousElementPosition(left+width/2-rw, top-resizerHeight-2, markerTop);
+ }
+
+ if (markerTopRight != null) {
+ setAnonymousElementPosition(left+width, top-resizerHeight-2, markerTopRight);
+ }
+
+ if (markerLeft != null) {
+ setAnonymousElementPosition(left-resizerWidth-2, top+height/2-rh, markerLeft);
+ }
+
+ if (markerRight != null) {
+ setAnonymousElementPosition(left+width, top+height/2-rh, markerRight);
+ }
+
+ if (markerBottomLeft != null) {
+ setAnonymousElementPosition(left-resizerWidth-2, top+height, markerBottomLeft);
+ }
+
+ if (markerBottom != null) {
+ setAnonymousElementPosition(left+width/2-rw, top+height, markerBottom);
+ }
+
+ if (markerBottomRight != null) {
+ setAnonymousElementPosition(left+width, top+height, markerBottomRight);
+ }
+
+ }
+
+ /**
+ *
+ * @param left
+ * @param top
+ * @param domElement
+ */
+ private void setAnonymousElementPosition(int left, int top,nsIDOMElement domElement) {
+ setStylePropertyPixels(domElement,XulRunnerConstants.HTML_ATTR_LEFT, left);
+ setStylePropertyPixels(domElement,XulRunnerConstants.HTML_ATTR_TOP, top);
+ }
+
+ /**
+ *
+ * @param aElement
+ * @param aProperty
+ * @param aValue
+ */
+ private void setStylePropertyPixels(nsIDOMElement aElement, String aProperty, int aValue) {
+ setStyle(aElement, aProperty, aValue + "px");
+ }
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @param aW
+ * @param aH
+ * @param aPreserveRatio
+ */
+ private void setResizeIncrements(int aX, int aY, int aW, int aH, boolean aPreserveRatio) {
+ incrementFactorX = aX;
+ incrementFactorY = aY;
+ incrementFactorWidth = aW;
+ incrementFactorHeight = aH;
+ // mPreserveRatio = aPreserveRatio;
+ }
+
+
+ /**
+ * Set style for nsIDOMElement
+ * @param domElement
+ * @param cssPropertyName
+ * @param cssPropertyValue
+ */
+ private void setStyle(nsIDOMElement domElement, String cssPropertyName, String cssPropertyValue) {
+ nsIDOMElementCSSInlineStyle inlineStyles = (nsIDOMElementCSSInlineStyle) domElement.queryInterface(nsIDOMElementCSSInlineStyle.NS_IDOMELEMENTCSSINLINESTYLE_IID);
+
+ if ( inlineStyles == null) {
+ return;
+ }
+
+ nsIDOMCSSStyleDeclaration cssDecl = inlineStyles.getStyle();
+
+ if ( cssDecl == null) {
+ return;
+ }
+
+ if (cssPropertyValue.length() == 0 ) {
+ // an empty value means we have to remove the property
+ cssDecl.removeProperty(cssPropertyName);
+ } else {
+ // let's recreate the declaration as it was
+ String priority = cssDecl.getPropertyPriority(cssPropertyName);
+ cssDecl.setProperty(cssPropertyName, cssPropertyValue, priority);
+ }
+ }
+
+
+ /**
+ *
+ * @param aClientX
+ * @param aClientY
+ */
+ private void endResizing(int aClientX, int aClientY)
+ {
+ if (resizingShadow == null) {
+ return;
+ }
+
+ if( activeHandle != null) {
+ activeHandle.removeAttribute(XulRunnerConstants.STRING_MOZ_ACTIVATED);
+ activeHandle = null;
+ }
+
+ int left = getNewResizingX(aClientX, aClientY);
+ int top = getNewResizingY(aClientX, aClientY);
+ int width = getNewResizingWidth(aClientX, aClientY);
+ int height = getNewResizingHeight(aClientX, aClientY);
+
+ int listenersCount = objectResizeEventListeners.size();
+ if (listenersCount != 0) {
+ IVpeResizeListener listener;
+ int index;
+ for (index = 0; index < listenersCount; index++) {
+ listener = objectResizeEventListeners.get(index);
+ listener.onEndResizing(usedEResizeMarkerHandle,top,left,width,height,resizingObject);
+ }
+ }
+
+ usedEResizeMarkerHandle = 0;
+ }
+
+ /**
+ * Hide of shadow box
+ */
+ private void hideShadow() {
+ if (resizingShadow != null ) {
+ resizingShadow.setAttribute(XulRunnerConstants.HTML_ATTR_CLASS, XulRunnerConstants.HTML_VALUE_HIDDEN);
+ }
+ }
+
+}
Added: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java (rev 0)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java 2007-08-14 13:12:54 UTC (rev 3117)
@@ -0,0 +1,133 @@
+package org.jboss.tools.vpe.xulrunner.editor;
+
+import org.eclipse.core.runtime.Platform;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMEvent;
+import org.mozilla.interfaces.nsIDOMEventListener;
+import org.mozilla.interfaces.nsIDOMEventTarget;
+import org.mozilla.interfaces.nsIDOMMouseEvent;
+import org.mozilla.interfaces.nsIDOMNSEvent;
+import org.mozilla.interfaces.nsISupports;
+import org.mozilla.xpcom.Mozilla;
+
+/**
+ *
+ * @author A. Yukhovich
+ */
+public class VpeResizerMouseListener implements nsIDOMEventListener {
+
+ private IVpeResizer vpeResizer;
+
+ /**
+ * Default contructor
+ */
+ public VpeResizerMouseListener(IVpeResizer vpeResizer) {
+ super();
+ this.vpeResizer = vpeResizer;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.mozilla.interfaces.nsIDOMEventListener#handleEvent(org.mozilla.interfaces.nsIDOMEvent)
+ */
+ public void handleEvent(nsIDOMEvent event) {
+ nsIDOMMouseEvent mouseEvent = (nsIDOMMouseEvent) event
+ .queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID);
+
+ if (mouseEvent == null) {
+ return;
+ }
+
+ if (XulRunnerConstants.EVENT_NAME_MOUSEDOWN.equals(mouseEvent.getType())) {
+ mouseDown(mouseEvent);
+ } else if (XulRunnerConstants.EVENT_NAME_MOUSEUP.equals(mouseEvent.getType())) {
+ mouseUp(mouseEvent);
+ } else if (XulRunnerConstants.EVENT_NAME_MOUSEMOVE.equals(mouseEvent.getType())) {
+ mouseMove(mouseEvent);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.mozilla.interfaces.nsISupports#queryInterface(java.lang.String)
+ */
+ public nsISupports queryInterface(String aIID) {
+ if (aIID.equals(nsIDOMEventListener.NS_IDOMEVENTLISTENER_IID)) {
+ return this;
+ } // if
+
+ return Mozilla.queryInterface(this, aIID);
+ }
+
+ /**
+ * processing event of mouseDown
+ *
+ * @param mouseEvent
+ * a nsIDOMMouseEvent object
+ */
+ private void mouseDown(nsIDOMMouseEvent mouseEvent) {
+ boolean isContextClick = false;
+
+ if (Platform.getOS().equals("SunOS")) {
+ isContextClick = mouseEvent.getCtrlKey();
+ } else {
+ isContextClick = (mouseEvent.getButton() == 2);
+ }
+
+ if (!isContextClick && (mouseEvent.getButton() == 0)
+ && (mouseEvent.getDetail() == 1)) {
+ nsIDOMNSEvent internalEvent = (nsIDOMNSEvent) mouseEvent
+ .queryInterface(nsIDOMNSEvent.NS_IDOMNSEVENT_IID);
+ if (internalEvent != null) {
+ org.mozilla.interfaces.nsIDOMEventTarget eventTarget = internalEvent
+ .getExplicitOriginalTarget();
+ if (eventTarget != null) {
+ nsIDOMElement domElement = (nsIDOMElement) eventTarget
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ if (domElement != null) {
+ System.out.println("ELEMENT IS: " + domElement.getNodeName());
+ int clientX = mouseEvent.getClientX();
+ int clientY = mouseEvent.getClientY();
+
+ vpeResizer.mouseDown(clientX, clientY, domElement);
+ } else {
+ System.out.println("ELEMENT IS NULL ");
+ }
+
+ } // if
+ } // if
+
+ }
+ }
+
+ /**
+ * processing event of mouseUp
+ *
+ * @param mouseEvent
+ * a nsIDOMMouseEvent object
+ */
+ private void mouseUp(nsIDOMMouseEvent mouseEvent) {
+ nsIDOMEventTarget target = mouseEvent.getTarget();
+
+ if (target != null ) {
+ nsIDOMElement domElement = (nsIDOMElement) target.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ if (domElement != null) {
+ int clientX = mouseEvent.getClientX();
+ int clientY = mouseEvent.getClientY();
+ vpeResizer.mouseUp(clientX, clientY, domElement);
+ }
+ }
+ }
+
+ /**
+ * processing event of mouseMove
+ *
+ * @param mouseEvent
+ * a nsIDOMMouseEvent object
+ */
+ private void mouseMove(nsIDOMMouseEvent mouseEvent) {
+ vpeResizer.mouseMove(mouseEvent);
+ }
+}
Added: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseMotionListener.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseMotionListener.java (rev 0)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseMotionListener.java 2007-08-14 13:12:54 UTC (rev 3117)
@@ -0,0 +1,56 @@
+package org.jboss.tools.vpe.xulrunner.editor;
+
+import org.mozilla.interfaces.nsIDOMEvent;
+import org.mozilla.interfaces.nsIDOMEventListener;
+import org.mozilla.interfaces.nsIDOMMouseEvent;
+import org.mozilla.interfaces.nsISupports;
+import org.mozilla.xpcom.Mozilla;
+
+/**
+ * @author A. Yukhovich
+ */
+public class VpeResizerMouseMotionListener implements nsIDOMEventListener {
+ /** vpeRezizer */
+ private IVpeResizer vpeResizer;
+
+ /**
+ * Default constructor
+ * @param vpeResizer a IVpeResizer object
+ */
+ public VpeResizerMouseMotionListener(IVpeResizer vpeResizer) {
+ this.vpeResizer = vpeResizer;
+ }
+
+ /**
+ * mouse move
+ * @param event a nsIDOMEvent object
+ */
+ public void mouseMove(nsIDOMEvent event) {
+ nsIDOMMouseEvent mouseEvent = (nsIDOMMouseEvent) event.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID);
+
+ if ( mouseEvent == null ) {
+ return;
+ }
+
+ vpeResizer.mouseMove(mouseEvent);
+ }
+
+ public void dragMove(nsIDOMEvent event) {
+
+ }
+
+ public void handleEvent(nsIDOMEvent event) {
+ if ("mousemove".equals(event.getType())) {
+ mouseMove(event);
+ }
+ }
+
+ public nsISupports queryInterface(String aIID) {
+ if (aIID.equals(nsIDOMEventListener.NS_IDOMEVENTLISTENER_IID)) {
+ return this;
+ } // if
+
+ return Mozilla.queryInterface(this, aIID);
+ }
+
+}
Added: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java (rev 0)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java 2007-08-14 13:12:54 UTC (rev 3117)
@@ -0,0 +1,73 @@
+package org.jboss.tools.vpe.xulrunner.editor;
+
+/**
+ * @author A. Yukhovich
+ *
+ */
+public class XulRunnerConstants {
+ /** HTML tags */
+
+ /** HTML_TAG_SPAN */
+ public static final String HTML_TAG_SPAN = "span";
+
+
+ /** HTML attributes */
+
+ /** HTML_ATTR_CLASS */
+ public static final String HTML_ATTR_CLASS = "class";
+
+ /** HTML_ATTR_ANONLOCATION */
+ public static final String HTML_ATTR_ANONLOCATION = "anonlocation";
+
+
+ /** HTML_ATTR_LEFT */
+ public static final String HTML_ATTR_LEFT = "left";
+
+ /** HTML_ATTR_TOP */
+ public static final String HTML_ATTR_TOP = "top";
+
+ /** HTML_ATTR_WIDTH */
+ public static final String HTML_ATTR_WIDTH = "width";
+
+ /** HTML_ATTR_HEIGHT */
+ public static final String HTML_ATTR_HEIGHT = "height";
+
+ /** HTML values */
+
+ /** HTML_VALUE_HIDDEN */
+ public static final String HTML_VALUE_HIDDEN = "hidden";
+
+ /** HTML_VALUE_TRUE */
+ public static final String HTML_VALUE_TRUE = "true";
+
+ /** HTML_VALUE_FALSE */
+ public static final String HTML_VALUE_FALSE = "false";
+
+ /** EVENT NAMES */
+
+ /** EVENT_NAME_MOUSEDOWN */
+ public static final String EVENT_NAME_MOUSEDOWN = "mousedown";
+
+ /** EVENT_NAME_MOUSEUP */
+ public static final String EVENT_NAME_MOUSEUP = "mouseup";
+
+ /** EVENT_NAME_MOUSEMOVE */
+ public static final String EVENT_NAME_MOUSEMOVE = "mousemove";
+
+ /** */
+
+ /** STRING_MOZ_ACTIVATED */
+ public static final String STRING_MOZ_ACTIVATED = "_moz_activated";
+
+ /** STRING_MOZ_ANONCLASS */
+ public static final String STRING_MOZ_ANONCLASS = "_moz_anonclass";
+
+ /** VPE_CLASSNAME_MOZ_RESIZER */
+ public static final String VPE_CLASSNAME_MOZ_RESIZER = "mozResizer";
+
+ /** VPE_CLASS_NAME_MOZ_RESIZING_SHADOW */
+ public static final String VPE_CLASS_NAME_MOZ_RESIZING_SHADOW = "mozResizingShadow";
+
+
+
+}
18 years, 4 months
JBoss Tools SVN: r3116 - branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2007-08-14 07:47:46 -0400 (Tue, 14 Aug 2007)
New Revision: 3116
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java
Log:
http://jira.jboss.org/jira/browse/EXIN-235 AppFileLocProvider was updated
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java 2007-08-14 11:47:16 UTC (rev 3115)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java 2007-08-14 11:47:46 UTC (rev 3116)
@@ -40,7 +40,7 @@
return new File(userDataPath, XPTI_FILE);
} else if ("GreD".equals(prop)) { // $NON-NLS-1$
return xulRunnerPath;
- } else if ("GreComsD".equals(prop) || "ComsD".equals(prop)) { // $NON-NLS-1$
+ } else if ("GreComsD".equals(prop) || "ComsD".equals(prop)) { // $NON-NLS-1$ $NON-NLS-1$
return new File(xulRunnerPath, COMPONENTS_DIRECTORY);
}
18 years, 4 months
JBoss Tools SVN: r3115 - branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2007-08-14 07:47:16 -0400 (Tue, 14 Aug 2007)
New Revision: 3115
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java
Log:
http://jira.jboss.org/jira/browse/EXIN-235 AppFileLocProvider was updated
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java 2007-08-14 11:25:12 UTC (rev 3114)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java 2007-08-14 11:47:16 UTC (rev 3115)
@@ -10,11 +10,13 @@
private File xulRunnerPath;
private File userDataPath;
- private final String PLUGINS_DIRECTORY = "plugins";
- private final String HISTORY_FILE = "history.dat";
- private final String COMPREG_FILE = "compreg.dat";
- private final String XPTI_FILE = "xpti.dat";
+ private static final String PLUGINS_DIRECTORY = "plugins"; // $NON-NLS-1$
+ private static final String HISTORY_FILE = "history.dat"; // $NON-NLS-1$
+ private static final String COMPREG_FILE = "compreg.dat"; // $NON-NLS-1$
+ private static final String XPTI_FILE = "xpti.dat"; // $NON-NLS-1$
+ private static final String COMPONENTS_DIRECTORY = "components"; //$NON-NLS-1$
+
public AppFileLocProvider(File xulRunnerPath) {
this.xulRunnerPath = xulRunnerPath;
this.userDataPath = Platform.getLocation().append(".metadata/.plugins") // $NON-NLS-1$
@@ -36,6 +38,10 @@
return new File(userDataPath, COMPREG_FILE);
} else if ("XptiRegF".equals(prop)) { // $NON-NLS-1$
return new File(userDataPath, XPTI_FILE);
+ } else if ("GreD".equals(prop)) { // $NON-NLS-1$
+ return xulRunnerPath;
+ } else if ("GreComsD".equals(prop) || "ComsD".equals(prop)) { // $NON-NLS-1$
+ return new File(xulRunnerPath, COMPONENTS_DIRECTORY);
}
return null;
18 years, 4 months
JBoss Tools SVN: r3114 - in branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner: browser and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2007-08-14 07:25:12 -0400 (Tue, 14 Aug 2007)
New Revision: 3114
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/XPCOM.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
Log:
http://jira.jboss.org/jira/browse/EXIN-450 nsIAppShell and nsIWindowCreator were added
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/XPCOM.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/XPCOM.java 2007-08-14 11:04:01 UTC (rev 3113)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/XPCOM.java 2007-08-14 11:25:12 UTC (rev 3114)
@@ -21,5 +21,9 @@
* Contract IDs
*/
public static final String NS_DRAGSERVICE_CONTRACTID = "@mozilla.org/widget/dragservice;1;"; //$NON-NLS-1$
- public static final String NS_ITRANSFERABLE_CONTRACTID = "@mozilla.org/widget/transferable;1"; //$NON-NLS-1$
+ public static final String NS_TRANSFERABLE_CONTRACTID = "@mozilla.org/widget/transferable;1"; //$NON-NLS-1$
+ public static final String NS_WINDOWWATCHER_CONTRACTID = "@mozilla.org/embedcomp/window-watcher;1"; //$NON-NLS-1$
+
+ public static final String NS_IWEBBROWSER_CID = "F1EAC761-87E9-11d3-AF80-00A024FFC08C"; // $NON-NLS-1$
+ public static final String NS_IAPPSHELL_CID = "2d96b3df-c051-11d1-a827-0040959a28c9"; // $NON-NLS-1$
}
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java 2007-08-14 11:04:01 UTC (rev 3113)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/AppFileLocProvider.java 2007-08-14 11:25:12 UTC (rev 3114)
@@ -17,21 +17,24 @@
public AppFileLocProvider(File xulRunnerPath) {
this.xulRunnerPath = xulRunnerPath;
- this.userDataPath = Platform.getLocation().append(".metadata/.plugins")
+ this.userDataPath = Platform.getLocation().append(".metadata/.plugins") // $NON-NLS-1$
.append(BrowserPlugin.PLUGIN_ID)
- .append("xulrunner").toFile();
+ .append("xulrunner").toFile(); // $NON-NLS-1$
}
public File getFile(String prop, boolean[] persistent) {
persistent[0] = false;
- if ("ProfD".equals(prop)) {
+ // TODO Sergey Vasilyev remove debug output
+ System.out.println("AppFileLocProvider.getFile(" + prop + ")");
+
+ if ("ProfD".equals(prop)) { // $NON-NLS-1$
return userDataPath;
- } else if ("UHist".equals(prop)) {
+ } else if ("UHist".equals(prop)) { // $NON-NLS-1$
return new File(userDataPath, HISTORY_FILE);
- } else if ("ComRegF".equals(prop)) {
+ } else if ("ComRegF".equals(prop)) { // $NON-NLS-1$
return new File(userDataPath, COMPREG_FILE);
- } else if ("XptiRegF".equals(prop)) {
+ } else if ("XptiRegF".equals(prop)) { // $NON-NLS-1$
return new File(userDataPath, XPTI_FILE);
}
@@ -39,7 +42,10 @@
}
public File[] getFiles(String prop) {
- if("APluginsDL".equals(prop)) {
+ // TODO Sergey Vasilyev remove debug output
+ System.out.println("AppFileLocProvider.getFiles(" + prop + ")");
+
+ if("APluginsDL".equals(prop)) { // $NON-NLS-1$
return new File[] {new File(xulRunnerPath, PLUGINS_DIRECTORY)};
}
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2007-08-14 11:04:01 UTC (rev 3113)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2007-08-14 11:25:12 UTC (rev 3114)
@@ -22,7 +22,9 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
+import org.jboss.tools.vpe.xulrunner.XPCOM;
import org.jboss.tools.vpe.xulrunner.XulRunnerException;
+import org.mozilla.interfaces.nsIAppShell;
import org.mozilla.interfaces.nsIBaseWindow;
import org.mozilla.interfaces.nsIComponentManager;
import org.mozilla.interfaces.nsIRequest;
@@ -36,6 +38,7 @@
import org.mozilla.interfaces.nsIWebNavigation;
import org.mozilla.interfaces.nsIWebProgress;
import org.mozilla.interfaces.nsIWebProgressListener;
+import org.mozilla.interfaces.nsIWindowWatcher;
import org.mozilla.xpcom.Mozilla;
import org.osgi.framework.Bundle;
@@ -76,7 +79,15 @@
}
nsIComponentManager componentManager = mozilla.getComponentManager();
- webBrowser = (nsIWebBrowser) componentManager.createInstance("F1EAC761-87E9-11d3-AF80-00A024FFC08C", null, nsIWebBrowser.NS_IWEBBROWSER_IID); //$NON-NLS-1$
+ nsIAppShell appShell = (nsIAppShell) componentManager.createInstance(XPCOM.NS_IAPPSHELL_CID, null, nsIAppShell.NS_IAPPSHELL_IID);
+ appShell.create(null, null);
+ appShell.spinup();
+
+ nsIServiceManager serviceManager = mozilla.getServiceManager();
+ nsIWindowWatcher windowWatcher = (nsIWindowWatcher) serviceManager.getServiceByContractID(XPCOM.NS_WINDOWWATCHER_CONTRACTID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID);
+ windowWatcher.setWindowCreator(new WindowCreator());
+
+ webBrowser = (nsIWebBrowser) componentManager.createInstance(XPCOM.NS_IWEBBROWSER_CID, null, nsIWebBrowser.NS_IWEBBROWSER_IID); //$NON-NLS-1$
webBrowser.setContainerWindow(this);
nsIBaseWindow baseWindow = (nsIBaseWindow) webBrowser.queryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID);
@@ -358,15 +369,4 @@
*/
public void onShowTooltip(int aXCoords, int aYCoords, String aTipText) {
}
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Widget#dispose()
- */
- @Override
- public void dispose() {
- if (mozilla != null) {
- mozilla.termEmbedding();
- }
- super.dispose();
- }
}
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2007-08-14 11:04:01 UTC (rev 3113)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2007-08-14 11:25:12 UTC (rev 3114)
@@ -143,6 +143,6 @@
public nsITransferable createTransferable() {
nsIComponentManager componentManager = getComponentManager();
- return (nsITransferable) componentManager.createInstanceByContractID(XPCOM.NS_ITRANSFERABLE_CONTRACTID, this, nsITransferable.NS_ITRANSFERABLE_IID);
+ return (nsITransferable) componentManager.createInstanceByContractID(XPCOM.NS_TRANSFERABLE_CONTRACTID, this, nsITransferable.NS_ITRANSFERABLE_IID);
}
}
18 years, 4 months
JBoss Tools SVN: r3113 - in trunk: jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2007-08-14 07:04:01 -0400 (Tue, 14 Aug 2007)
New Revision: 3113
Modified:
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashForm.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
Log:
add functionality for http://jira.jboss.com/jira/browse/JBIDE-600
Modified: trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta 2007-08-14 10:44:57 UTC (rev 3112)
+++ trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta 2007-08-14 11:04:01 UTC (rev 3113)
@@ -1490,6 +1490,20 @@
</Constraint>
<Editor name="CheckBox"/>
</XModelAttribute>
+ <XModelAttribute default="yes" name="show selection tag bar" xmlname="show_selection_tag_bar">
+ <Constraint loader="List">
+ <value name="yes"/>
+ <value name="no"/>
+ </Constraint>
+ <Editor name="CheckBox"/>
+ </XModelAttribute>
+ <XModelAttribute default="no" name="always hide selection bar without prompt" xmlname="always_hide_selection_bar_without_prompt">
+ <Constraint loader="List">
+ <value name="yes"/>
+ <value name="no"/>
+ </Constraint>
+ <Editor name="CheckBox"/>
+ </XModelAttribute>
<XModelAttribute default="Visual/Source" name="option list" xmlname="option_list">
<Constraint loader="List">
<value name="Visual/Source"/>
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java 2007-08-14 10:44:57 UTC (rev 3112)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java 2007-08-14 11:04:01 UTC (rev 3113)
@@ -21,6 +21,8 @@
public static String ATT_USE_ABSOLUTE_POSITION = "";
public static String ATT_ALWAYS_PROMPT_FOR_TAG_ATTRIBUTES_DURING_TAG_INSERT = "always prompt for tag attributes during tag insert";
public static String ATT_OPTION_LIST = "option list";
+ public static String ATT_SHOW_SELECTION_TAG_BAR = "show selection tag bar";
+ public static String ATT_ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT="always hide selection bar without prompt";
public static String VPE_EDITOR_PATH = "%Options%/Struts Studio/Editors/Visual Page Editor"; //$NON-NLS-1$
public static final Preference SHOW_COMMENTS = new VpePreference(VPE_EDITOR_PATH, ATT_SHOW_COMMENTS);
@@ -31,7 +33,9 @@
public static final Preference USE_ABSOLUTE_POSITION = new VpePreference(VPE_EDITOR_PATH, ATT_USE_ABSOLUTE_POSITION);
public static final Preference ALWAYS_REQUEST_FOR_ATTRIBUTE = new VpePreference(VPE_EDITOR_PATH, ATT_ALWAYS_PROMPT_FOR_TAG_ATTRIBUTES_DURING_TAG_INSERT);
public static final Preference EDITOR_VIEW_OPTION = new VpePreference(VPE_EDITOR_PATH, ATT_OPTION_LIST);
-
+ public static final Preference SHOW_SELECTION_TAG_BAR = new VpePreference(VPE_EDITOR_PATH,ATT_SHOW_SELECTION_TAG_BAR);
+ public static final Preference ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT = new VpePreference(VPE_EDITOR_PATH,ATT_ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT);
+
protected VpePreference(String optionPath, String attributeName) {
super(optionPath, attributeName);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-08-14 10:44:57 UTC (rev 3112)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-08-14 11:04:01 UTC (rev 3113)
@@ -2407,7 +2407,7 @@
}
public void selectionChanged(SelectionChangedEvent event) {
- if (editPart.getVisualMode() != VpeEditorPart.SOURCE_MODE) {
+ if (editPart.getVisualMode() != VpeEditorPart.PREVIEW_MODE) {
if(toolbarFormatControllerManager != null) toolbarFormatControllerManager.selectionChanged();
if(selectionBar != null) selectionBar.selectionChanged();
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2007-08-14 10:44:57 UTC (rev 3112)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2007-08-14 11:04:01 UTC (rev 3113)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.vpe.editor;
import java.beans.PropertyChangeEvent;
@@ -26,6 +26,8 @@
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
@@ -47,517 +49,641 @@
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorExtension;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.event.XModelTreeEvent;
+import org.jboss.tools.common.model.event.XModelTreeListener;
+import org.jboss.tools.common.model.ui.util.ModelUtilities;
+import org.jboss.tools.common.model.util.XModelTreeListenerSWTSync;
import org.jboss.tools.jst.jsp.editor.IVisualEditor;
+import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.mozilla.EditorLoadWindowListener;
import org.jboss.tools.vpe.editor.mozilla.MozillaEditor;
import org.jboss.tools.vpe.editor.mozilla.MozillaPreview;
import org.jboss.tools.vpe.editor.xpl.SashForm;
+import org.jboss.tools.vpe.selbar.SelectionBar;
-public class VpeEditorPart extends EditorPart implements ITextEditor, ITextEditorExtension, IReusableEditor, IVisualEditor {
- private SashForm container;
- private StructuredTextEditor sourceEditor=null;
- private MozillaEditor visualEditor;
- private IEditorPart activeEditor;
- private VpeController controller;
- private ActivationListener activationListener = new ActivationListener();
- private int visualMode=0;
- private EditorPart multiPageEditor;
- private static final QualifiedName SPLITTER_POSITION_KEY1 = new QualifiedName("", "splitter_position1");
- private static final QualifiedName SPLITTER_POSITION_KEY2 = new QualifiedName("", "splitter_position2");
- private static final QualifiedName SPLITTER_POSITION_KEY3 = new QualifiedName("", "splitter_position3");
- private int controlCount = 0;
-
- /** default web-browser */
- private MozillaPreview previewWebBrowser = null;
-
- /** preview content */
- private Composite previewContent = null;
+public class VpeEditorPart extends EditorPart implements ITextEditor,
+ ITextEditorExtension, IReusableEditor, IVisualEditor {
+ private SashForm container;
+ private StructuredTextEditor sourceEditor = null;
+ private MozillaEditor visualEditor;
+ private IEditorPart activeEditor;
+ private VpeController controller;
+ private XModelTreeListener listener;
+ XModelObject optionsObject;
+ private SelectionBar selectionBar = new SelectionBar();
+ private ActivationListener activationListener = new ActivationListener();
+ private int visualMode = 0;
+ private EditorPart multiPageEditor;
+ private static final QualifiedName SPLITTER_POSITION_KEY1 = new QualifiedName(
+ "", "splitter_position1");
+ private static final QualifiedName SPLITTER_POSITION_KEY2 = new QualifiedName(
+ "", "splitter_position2");
+ private static final QualifiedName SPLITTER_POSITION_KEY3 = new QualifiedName(
+ "", "splitter_position3");
+ private int controlCount = 0;
- public StructuredTextEditor getSourceEditor(){
- return sourceEditor;
+ /** default web-browser */
+ private MozillaPreview previewWebBrowser = null;
+
+ /** preview content */
+ private Composite previewContent = null;
+
+ public StructuredTextEditor getSourceEditor() {
+ return sourceEditor;
+ }
+
+ // returns JSPMultipageEditor for closing by ctrl+F4 and ctrl+shift+F4 keys
+ public EditorPart getParentEditor() {
+ return multiPageEditor;
+ }
+
+ public void close(boolean save) {
+ if (sourceEditor != null)
+ sourceEditor.close(save);
+ }
+
+ public void doRevertToSaved() {
+ if (sourceEditor != null)
+ sourceEditor.doRevertToSaved();
+ }
+
+ public IDocumentProvider getDocumentProvider() {
+ if (sourceEditor != null)
+ return sourceEditor.getDocumentProvider();
+ else {
+ return null;
}
-
- // returns JSPMultipageEditor for closing by ctrl+F4 and ctrl+shift+F4 keys
- public EditorPart getParentEditor(){
- return multiPageEditor;
+ }
+
+ public IRegion getHighlightRange() {
+ if (sourceEditor != null)
+ return sourceEditor.getHighlightRange();
+ else {
+ return null;
}
-
- public void close(boolean save) {
- if(sourceEditor!=null)sourceEditor.close(save);
+ }
+
+ public ISelectionProvider getSelectionProvider() {
+ if (sourceEditor != null)
+ return sourceEditor.getSelectionProvider();
+ else {
+ return null;
}
- public void doRevertToSaved() {
- if(sourceEditor!=null)sourceEditor.doRevertToSaved();
+ }
+
+ public boolean isEditable() {
+ if (sourceEditor != null)
+ return sourceEditor.isEditable();
+ else {
+ return false;
}
- public IDocumentProvider getDocumentProvider() {
- if(sourceEditor!=null)return sourceEditor.getDocumentProvider();
- else{
- return null;
- }
+ }
+
+ public void removeActionActivationCode(String actionId) {
+ if (sourceEditor != null)
+ sourceEditor.removeActionActivationCode(actionId);
+ }
+
+ public void resetHighlightRange() {
+ if (sourceEditor != null)
+ sourceEditor.resetHighlightRange();
+ }
+
+ public void selectAndReveal(int offset, int length) {
+ if (sourceEditor != null)
+ sourceEditor.selectAndReveal(offset, length);
+ }
+
+ public void setAction(String actionID, IAction action) {
+ if (sourceEditor != null)
+ sourceEditor.setAction(actionID, action);
+ }
+
+ public void setActionActivationCode(String actionId,
+ char activationCharacter, int activationKeyCode,
+ int activationStateMask) {
+ if (sourceEditor != null)
+ sourceEditor.setActionActivationCode(actionId, activationCharacter,
+ activationKeyCode, activationStateMask);
+ }
+
+ public void setHighlightRange(int offset, int length, boolean moveCursor) {
+ if (sourceEditor != null)
+ sourceEditor.setHighlightRange(offset, length, moveCursor);
+ }
+
+ public void showHighlightRangeOnly(boolean showHighlightRangeOnly) {
+ if (sourceEditor != null)
+ sourceEditor.showHighlightRangeOnly(showHighlightRangeOnly);
+ }
+
+ public boolean showsHighlightRangeOnly() {
+ if (sourceEditor != null)
+ return sourceEditor.showsHighlightRangeOnly();
+ else {
+ return false;
}
- public IRegion getHighlightRange() {
- if(sourceEditor!=null)return sourceEditor.getHighlightRange();
- else{
- return null;
- }
+ }
+
+ public void addRulerContextMenuListener(IMenuListener listener) {
+ if (sourceEditor != null)
+ sourceEditor.addRulerContextMenuListener(listener);
+ }
+
+ public boolean isEditorInputReadOnly() {
+ if (sourceEditor != null)
+ return sourceEditor.isEditorInputReadOnly();
+ else {
+ return false;
}
- public ISelectionProvider getSelectionProvider() {
- if(sourceEditor!=null)return sourceEditor.getSelectionProvider();
- else{
- return null;
- }
+ }
+
+ public void removeRulerContextMenuListener(IMenuListener listener) {
+ if (sourceEditor != null)
+ sourceEditor.removeRulerContextMenuListener(listener);
+ }
+
+ public void setStatusField(IStatusField field, String category) {
+ if (visualMode == VISUAL_MODE) {
+ if (field != null) {
+ field.setImage(null);
+ field.setText(null);
+ }
+ } else if (sourceEditor != null)
+ sourceEditor.setStatusField(field, category);
+ }
+
+ public VpeEditorPart(EditorPart multiPageEditor,
+ StructuredTextEditor textEditor, boolean visualMode) {
+ sourceEditor = textEditor;
+ // this.visualMode = visualMode;
+ this.multiPageEditor = multiPageEditor;
+ }
+
+ public IAction getAction(String actionID) {
+ return sourceEditor.getAction(actionID);
+ }
+
+ public VpeEditorPart() {
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+ if (sourceEditor != null) {
+ sourceEditor.doSave(monitor);
}
- public boolean isEditable() {
- if(sourceEditor!=null)return sourceEditor.isEditable();
- else{
- return false;
- }
+ }
+
+ public void doSaveAs() {
+ if (sourceEditor != null) {
+ sourceEditor.doSaveAs();
+ setInput(sourceEditor.getEditorInput());
}
- public void removeActionActivationCode(String actionId) {
- if(sourceEditor!=null)sourceEditor.removeActionActivationCode(actionId);
+ }
+
+ public void init(IEditorSite site, IEditorInput input)
+ throws PartInitException {
+ setSite(site);
+ setInput(input);
+ }
+
+ public void setInput(IEditorInput input) {
+ super.setInput(input);
+ if (visualEditor != null && visualEditor.getEditorInput() != null
+ && visualEditor.getEditorInput() != getEditorInput()) {
+ visualEditor.setInput(input);
}
- public void resetHighlightRange() {
- if(sourceEditor!=null)sourceEditor.resetHighlightRange();
+ }
+
+ public boolean isDirty() {
+ if (sourceEditor != null) {
+ return sourceEditor.isDirty();
+ } else {
+ return false;
}
- public void selectAndReveal(int offset, int length) {
- if(sourceEditor!=null)sourceEditor.selectAndReveal(offset, length);
+ }
+
+ public boolean isSaveAsAllowed() {
+ if (sourceEditor != null) {
+ return sourceEditor.isSaveAsAllowed();
+ } else {
+ return false;
}
- public void setAction(String actionID, IAction action) {
- if(sourceEditor!=null)sourceEditor.setAction(actionID, action);
+ }
+
+ protected int[] loadSplitterPosition() {
+ int[] sizes = new int[3];
+ try {
+ IEditorInput input = getEditorInput();
+ if (!(input instanceof IFileEditorInput))
+ return null;
+ IFile file = ((IFileEditorInput) input).getFile();
+ String s = file.getPersistentProperty(SPLITTER_POSITION_KEY1);
+ if (s != null) {
+ sizes[0] = Integer.parseInt(s);
+ } else
+ return null;
+ s = file.getPersistentProperty(SPLITTER_POSITION_KEY2);
+ if (s != null) {
+ sizes[1] = Integer.parseInt(s);
+ } else
+ return null;
+ s = file.getPersistentProperty(SPLITTER_POSITION_KEY3);
+ if (s != null) {
+ sizes[2] = Integer.parseInt(s);
+ } else
+ return null;
+ } catch (Exception e) {
+ VpePlugin.getPluginLog().logError(e);
+ return null;
}
- public void setActionActivationCode(String actionId,
- char activationCharacter, int activationKeyCode,
- int activationStateMask) {
- if(sourceEditor!=null)sourceEditor.setActionActivationCode(actionId, activationCharacter, activationKeyCode, activationStateMask);
+ return sizes;
+ }
+
+ protected void saveSplitterPosition(int[] weights) {
+ IEditorInput input = getEditorInput();
+ if (!(input instanceof IFileEditorInput))
+ return;
+ IFile file = ((IFileEditorInput) input).getFile();
+ try {
+ String s = String.valueOf(weights[0]);
+ file.setPersistentProperty(SPLITTER_POSITION_KEY1, s);
+ s = String.valueOf(weights[1]);
+ file.setPersistentProperty(SPLITTER_POSITION_KEY2, s);
+ s = String.valueOf(weights[2]);
+ file.setPersistentProperty(SPLITTER_POSITION_KEY3, s);
+ } catch (Exception e) {
+ VpePlugin.getPluginLog().logError(e);
}
- public void setHighlightRange(int offset, int length, boolean moveCursor) {
- if(sourceEditor!=null)sourceEditor.setHighlightRange(offset, length, moveCursor);
- }
- public void showHighlightRangeOnly(boolean showHighlightRangeOnly) {
- if(sourceEditor!=null)sourceEditor.showHighlightRangeOnly(showHighlightRangeOnly);
- }
- public boolean showsHighlightRangeOnly() {
- if(sourceEditor!=null)return sourceEditor.showsHighlightRangeOnly();
- else{
- return false;
- }
- }
+ }
- public void addRulerContextMenuListener(IMenuListener listener) {
- if(sourceEditor!=null)sourceEditor.addRulerContextMenuListener(listener);
+ Composite sourceContent = null;
+ Composite visualContent = null;
+
+ public void setVisualMode(int type) {
+ String showSelectionBar = VpePreference.SHOW_SELECTION_TAG_BAR
+ .getValue();
+ switch (type) {
+ case VISUALSOURCE_MODE:
+ selectionBar.showBar(showSelectionBar);
+ if (sourceContent != null)
+ sourceContent.setVisible(true);
+ if (visualContent != null)
+ visualContent.setVisible(true);
+ if (previewContent != null) {
+ previewContent.setVisible(false);
+ }
+ break;
+
+ case VISUAL_MODE:
+ selectionBar.showBar(showSelectionBar);
+ if (sourceContent != null)
+ sourceContent.setVisible(false);
+ if (visualContent != null)
+ visualContent.setVisible(true);
+ if (previewContent != null) {
+ previewContent.setVisible(false);
+ }
+ break;
+
+ case SOURCE_MODE:
+ selectionBar.showBar(showSelectionBar);
+ if (sourceContent != null)
+ sourceContent.setVisible(true);
+ if (visualContent != null)
+ visualContent.setVisible(false);
+ if (previewContent != null) {
+ previewContent.setVisible(false);
+ }
+ break;
+
+ case PREVIEW_MODE:
+ if (selectionBar != null) {
+ selectionBar.showBar("no");
+ }
+ if (sourceContent != null) {
+ sourceContent.setVisible(false);
+ }
+
+ if (visualContent != null) {
+ visualContent.setVisible(false);
+ }
+
+ if (previewContent != null) {
+ previewWebBrowser.rebuildDom();
+ previewContent.setVisible(true);
+ }
+ break;
}
- public boolean isEditorInputReadOnly() {
- if(sourceEditor!=null)return sourceEditor.isEditorInputReadOnly();
- else{
- return false;
- }
+ container.layout();
+ if (visualMode == SOURCE_MODE && type != SOURCE_MODE) {
+ visualMode = type;
+ if (controller != null) {
+ controller.visualRefresh();
+ controller.sourceSelectionChanged();
+ }
}
- public void removeRulerContextMenuListener(IMenuListener listener) {
- if(sourceEditor!=null)sourceEditor.removeRulerContextMenuListener(listener);
- }
- public void setStatusField(IStatusField field, String category) {
- if(visualMode == VISUAL_MODE) {
- if(field != null) {
- field.setImage(null);
- field.setText(null);
- }
- }else
- if(sourceEditor!=null)sourceEditor.setStatusField(field, category);
- }
-
-
- public VpeEditorPart(EditorPart multiPageEditor, StructuredTextEditor textEditor, boolean visualMode){
- sourceEditor = textEditor;
- //this.visualMode = visualMode;
- this.multiPageEditor = multiPageEditor;
- }
-
- public IAction getAction(String actionID){
- return sourceEditor.getAction(actionID);
- }
-
- public VpeEditorPart(){
- }
-
- public void doSave(IProgressMonitor monitor) {
- if (sourceEditor != null) {
- sourceEditor.doSave(monitor);
- }
- }
+ visualMode = type;
+ }
- public void doSaveAs() {
- if (sourceEditor != null) {
- sourceEditor.doSaveAs();
- setInput(sourceEditor.getEditorInput());
- }
- }
+ public int getVisualMode() {
+ return visualMode;
+ }
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- setSite(site);
- setInput(input);
- }
+ public void createPartControl(Composite parent) {
+ controlCount++;
+ if (controlCount > 1)
+ return;
+ // //////////////////////////////////////////////////////////////
- public void setInput(IEditorInput input) {
- super.setInput(input);
- if(visualEditor != null && visualEditor.getEditorInput() != null && visualEditor.getEditorInput() != getEditorInput()) {
- visualEditor.setInput(input);
- }
- }
+ Composite cmpEdTl = new Composite(parent, SWT.NONE);
+ GridLayout layoutEdTl = new GridLayout(1, false);
+ layoutEdTl.verticalSpacing = 0;
+ layoutEdTl.marginHeight = 0;
+ layoutEdTl.marginBottom = 3;
+ layoutEdTl.marginWidth = 0;
+ cmpEdTl.setLayout(layoutEdTl);
+ cmpEdTl.setLayoutData(new GridData(GridData.FILL_BOTH));
- public boolean isDirty() {
- if (sourceEditor != null) {
- return sourceEditor.isDirty();
- } else {
- return false;
- }
- }
+ Composite cmpEd = new Composite(cmpEdTl, SWT.NATIVE);
+ GridLayout layoutEd = new GridLayout(1, false);
+ layoutEd.marginBottom = 0;
+ layoutEd.marginHeight = 1;
+ layoutEd.marginWidth = 0;
+ layoutEd.marginRight = 0;
+ layoutEd.marginLeft = 1;
+ layoutEd.verticalSpacing = 0;
+ layoutEd.horizontalSpacing = 0;
+ cmpEd.setLayout(layoutEd);
+ cmpEd.setLayoutData(new GridData(GridData.FILL_BOTH));
+ // /////////////////////////////////////////////////////////////////
+ container = new SashForm(cmpEd, SWT.VERTICAL);
+ container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ sourceContent = new Composite(container, SWT.NONE);
+ sourceContent.setLayout(new FillLayout());
+ visualContent = new Composite(container, SWT.NONE);
+ visualContent.setLayout(new FillLayout());
- public boolean isSaveAsAllowed() {
- if (sourceEditor != null) {
- return sourceEditor.isSaveAsAllowed();
- } else {
- return false;
+ // Create a preview content
+ previewContent = new Composite(container, SWT.NONE);
+ previewContent.setLayout(new FillLayout());
+
+ // ////////////////////////////////////////////////////
+
+ selectionBar.createToolBarComposite(cmpEdTl, true);
+ // ///////////////////////////////////////////////////
+ if (sourceEditor == null)
+ sourceEditor = new StructuredTextEditor() {
+ public void safelySanityCheckState(IEditorInput input) {
+ super.safelySanityCheckState(input);
}
- }
-
- protected int[] loadSplitterPosition() {
- int[] sizes = new int[3];
- try {
- IEditorInput input = getEditorInput();
- if(!(input instanceof IFileEditorInput)) return null;
- IFile file = ((IFileEditorInput)input).getFile();
- String s = file.getPersistentProperty(SPLITTER_POSITION_KEY1);
- if (s != null) {
- sizes[0] = Integer.parseInt(s);
- }else return null;
- s = file.getPersistentProperty(SPLITTER_POSITION_KEY2);
- if (s != null) {
- sizes[1] = Integer.parseInt(s);
- }else return null;
- s = file.getPersistentProperty(SPLITTER_POSITION_KEY3);
- if (s != null) {
- sizes[2] = Integer.parseInt(s);
- }else return null;
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
- return null;
- }
- return sizes;
- }
+ };
+ int[] weights = loadSplitterPosition();
+ if (weights != null)
+ container.setWeights(weights);
+ container.addWeightsChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ saveSplitterPosition(container.getWeights());
+ }
+ });
+ parent.addControlListener(new ControlListener() {
+ public void controlMoved(ControlEvent event) {
- protected void saveSplitterPosition(int[] weights) {
- IEditorInput input = getEditorInput();
- if(!(input instanceof IFileEditorInput)) return;
- IFile file = ((IFileEditorInput)input).getFile();
- try {
- String s = String.valueOf(weights[0]);
- file.setPersistentProperty(SPLITTER_POSITION_KEY1, s);
- s = String.valueOf(weights[1]);
- file.setPersistentProperty(SPLITTER_POSITION_KEY2, s);
- s = String.valueOf(weights[2]);
- file.setPersistentProperty(SPLITTER_POSITION_KEY3, s);
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
- }
- }
- Composite sourceContent=null;
- Composite visualContent=null;
-
- public void setVisualMode(int type){
- switch(type){
- case VISUALSOURCE_MODE:
- if(sourceContent!= null)sourceContent.setVisible(true);
- if(visualContent!= null)visualContent.setVisible(true);
- if(previewContent != null) {
- previewContent.setVisible(false);
- }
- break;
-
- case VISUAL_MODE:
- if(sourceContent!= null)sourceContent.setVisible(false);
- if(visualContent!= null)visualContent.setVisible(true);
- if(previewContent != null) {
- previewContent.setVisible(false);
- }
- break;
-
- case SOURCE_MODE:
- if(sourceContent!= null)sourceContent.setVisible(true);
- if(visualContent!= null)visualContent.setVisible(false);
- if(previewContent != null) {
- previewContent.setVisible(false);
- }
- break;
-
- case PREVIEW_MODE:
- if(sourceContent!= null) {
- sourceContent.setVisible(false);
- }
-
- if(visualContent!= null) {
- visualContent.setVisible(false);
- }
-
- if(previewContent != null) {
- previewWebBrowser.rebuildDom();
- previewContent.setVisible(true);
- }
- break;
- }
+ }
+
+ public void controlResized(ControlEvent event) {
container.layout();
- if(visualMode == SOURCE_MODE && type != SOURCE_MODE) {
- visualMode = type;
- if(controller!=null) {
- controller.visualRefresh();
- controller.sourceSelectionChanged();
- }
- }
- visualMode = type;
+ }
+ });
+ visualEditor = new MozillaEditor();
+ try {
+ visualEditor.init(getEditorSite(), getEditorInput());
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
}
-
- public int getVisualMode(){
- return visualMode;
+
+ previewWebBrowser = new MozillaPreview(this, sourceEditor);
+ try {
+ previewWebBrowser.init(getEditorSite(), getEditorInput());
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
}
- public void createPartControl(Composite parent) {
- controlCount++;
- if(controlCount > 1)return;
-
- container = new SashForm(parent, SWT.VERTICAL);
- sourceContent = new Composite(container, SWT.NONE);
- sourceContent.setLayout(new FillLayout());
- visualContent = new Composite(container, SWT.NONE);
- visualContent.setLayout(new FillLayout());
-
-
- // Create a preview content
- previewContent = new Composite(container, SWT.NONE);
- previewContent.setLayout(new FillLayout());
-
- if(sourceEditor == null)sourceEditor = new StructuredTextEditor() {
- public void safelySanityCheckState(IEditorInput input) {
- super.safelySanityCheckState(input);
+ try {
+ sourceEditor.addPropertyListener(new IPropertyListener() {
+ public void propertyChanged(Object source, int propId) {
+ if (propId == IWorkbenchPartConstants.PROP_TITLE) {
+ VpeEditorPart.this.setPartName(sourceEditor.getTitle());
+ }
+ VpeEditorPart.this.firePropertyChange(propId);
+ }
+ });
+ sourceEditor.init(getEditorSite(), getEditorInput());
+
+ if (sourceContent != null) {
+ sourceEditor.createPartControl(sourceContent);
+ }
+ if (visualEditor != null) {
+ visualEditor
+ .setEditorLoadWindowListener(new EditorLoadWindowListener() {
+ public void load() {
+ visualEditor.setEditorLoadWindowListener(null);
+ controller = new VpeController(
+ VpeEditorPart.this);
+ selectionBar.setVpeController(controller);
+ controller
+ .setSelectionBarController(selectionBar);
+ try {
+ controller.init(sourceEditor, visualEditor);
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
}
- };
- int[] weights = loadSplitterPosition();
- if(weights != null)
- container.setWeights(weights);
- container.addWeightsChangeListener(new PropertyChangeListener(){
- public void propertyChange(PropertyChangeEvent event){
- saveSplitterPosition(container.getWeights());
- }
+ }
});
- parent.addControlListener(new ControlListener(){
- public void controlMoved(ControlEvent event){
-
- }
- public void controlResized(ControlEvent event){
- container.layout();
- }
- });
- visualEditor = new MozillaEditor();
- try {
- visualEditor.init(getEditorSite(), getEditorInput());
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
- }
+ visualEditor.createPartControl(visualContent);
+ }
- previewWebBrowser = new MozillaPreview(this, sourceEditor);
- try {
- previewWebBrowser.init(getEditorSite(), getEditorInput());
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
- }
+ if (previewWebBrowser != null) {
+ previewWebBrowser
+ .setEditorLoadWindowListener(new EditorLoadWindowListener() {
+ public void load() {
+ previewWebBrowser
+ .setEditorLoadWindowListener(null);
+ previewWebBrowser.buildDom();
+ }
+ });
+ previewWebBrowser.createPartControl(previewContent);
+ }
- try {
- sourceEditor.addPropertyListener(
- new IPropertyListener() {
- public void propertyChanged(Object source, int propId) {
- if (propId == IWorkbenchPartConstants.PROP_TITLE) {
- VpeEditorPart.this.setPartName(sourceEditor.getTitle());
- }
- VpeEditorPart.this.firePropertyChange(propId);
- }
- });
- sourceEditor.init(getEditorSite(), getEditorInput());
+ activeEditor = sourceEditor;
- if(sourceContent!=null){
- sourceEditor.createPartControl(sourceContent);
+ sourceContent.addListener(SWT.Activate, new Listener() {
+ public void handleEvent(Event event) {
+ if (event.type == SWT.Activate) {
+ if (activeEditor != sourceEditor) {
+ activeEditor = sourceEditor;
+ setFocus();
}
- if(visualEditor!=null) {
- visualEditor.setEditorLoadWindowListener(new EditorLoadWindowListener() {
- public void load() {
- visualEditor.setEditorLoadWindowListener(null);
- controller = new VpeController(VpeEditorPart.this);
- try {
- controller.init(sourceEditor, visualEditor);
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
- }
- }
- });
- visualEditor.createPartControl(visualContent);
+ }
+ }
+ });
+
+ visualContent.addListener(SWT.Activate, new Listener() {
+ public void handleEvent(Event event) {
+ if (event.type == SWT.Activate) {
+ if (visualEditor != null
+ && activeEditor != visualEditor) {
+ activeEditor = visualEditor;
+ setFocus();
}
-
-
- if(previewWebBrowser!=null) {
- previewWebBrowser.setEditorLoadWindowListener(new EditorLoadWindowListener() {
- public void load() {
- previewWebBrowser.setEditorLoadWindowListener(null);
- previewWebBrowser.buildDom();
- }
- });
- previewWebBrowser.createPartControl(previewContent);
+ }
+ }
+ });
+
+ previewContent.addListener(SWT.Activate, new Listener() {
+ public void handleEvent(Event event) {
+ if (event.type == SWT.Activate) {
+ if (previewWebBrowser != null
+ && activeEditor != previewWebBrowser) {
+ activeEditor = previewWebBrowser;
+ setFocus();
}
-
- activeEditor = sourceEditor;
+ }
+ }
+ });
- sourceContent.addListener(SWT.Activate, new Listener() {
- public void handleEvent(Event event) {
- if (event.type == SWT.Activate) {
- if (activeEditor != sourceEditor) {
- activeEditor = sourceEditor;
- setFocus();
- }
- }
- }
- });
+ IWorkbenchWindow window = getSite().getWorkbenchWindow();
+ window.getPartService().addPartListener(activationListener);
+ window.getShell().addShellListener(activationListener);
- visualContent.addListener(SWT.Activate, new Listener() {
- public void handleEvent(Event event) {
- if (event.type == SWT.Activate) {
- if (visualEditor!=null && activeEditor != visualEditor) {
- activeEditor = visualEditor;
- setFocus();
- }
- }
- }
- });
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ }
+ // setVisualMode(visualMode);
+ // ///////////////////////////////////////
+ // ///// Add preference listener
+ optionsObject = ModelUtilities.getPreferenceModel().getByPath(
+ VpePreference.EDITOR_PATH);
+ listener = new XModelTreeListener() {
-
- previewContent.addListener(SWT.Activate, new Listener() {
- public void handleEvent(Event event) {
- if (event.type == SWT.Activate) {
- if (previewWebBrowser!=null && activeEditor != previewWebBrowser) {
- activeEditor = previewWebBrowser;
- setFocus();
- }
- }
- }
- });
-
+ public void nodeChanged(XModelTreeEvent event) {
+ String showSelectionBar = VpePreference.SHOW_SELECTION_TAG_BAR
+ .getValue();
+ selectionBar.showBar(showSelectionBar);
+ }
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- window.getPartService().addPartListener(activationListener);
- window.getShell().addShellListener(activationListener);
+ public void structureChanged(XModelTreeEvent event) {
+ }
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
- }
- //setVisualMode(visualMode);
+ };
+ optionsObject.getModel().addModelTreeListener(listener);
+ // ///////////////////////////////////////
+ cmpEd.layout();
+ }
+
+ public void setFocus() {
+ if (activeEditor != null) {
+ activeEditor.setFocus();
}
+ }
- public void setFocus() {
- if (activeEditor != null) {
- activeEditor.setFocus();
- }
+ public void dispose() {
+ super.dispose();
+ if (optionsObject != null) {
+ optionsObject.getModel().removeModelTreeListener(listener);
}
+ if (activationListener != null) {
+ IWorkbenchWindow window = getSite().getWorkbenchWindow();
+ window.getPartService().removePartListener(activationListener);
+ Shell shell = window.getShell();
+ if (shell != null && !shell.isDisposed())
+ shell.removeShellListener(activationListener);
+ activationListener = null;
+ }
+ if (controller != null) {
+ controller.dispose();
+ controller = null;
+ }
- public void dispose() {
- super.dispose();
+ // editor will disposed as part of multipart editor
+ if (sourceEditor != null) {
+ sourceEditor.dispose();
+ sourceEditor = null;
+ }
- if (activationListener != null) {
- IWorkbenchWindow window= getSite().getWorkbenchWindow();
- window.getPartService().removePartListener(activationListener);
- Shell shell= window.getShell();
- if (shell != null && !shell.isDisposed())
- shell.removeShellListener(activationListener);
- activationListener = null;
- }
- if (controller != null) {
- controller.dispose();
- controller = null;
- }
+ if (visualEditor != null) {
+ visualEditor.dispose();
+ visualEditor = null;
+ }
-
-// editor will disposed as part of multipart editor
- if (sourceEditor != null) {
- sourceEditor.dispose();
- sourceEditor = null;
- }
+ if (previewContent != null) {
+ previewContent.dispose();
+ previewContent = null;
+ }
+ }
- if (visualEditor != null) {
- visualEditor.dispose();
- visualEditor = null;
- }
-
- if (previewContent != null) {
- previewContent.dispose();
- previewContent = null;
- }
+ public Object getAdapter(Class adapter) {
+ if (sourceEditor != null) {
+ return sourceEditor.getAdapter(adapter);
+ } else {
+ return null;
}
+ }
- public Object getAdapter(Class adapter) {
- if (sourceEditor != null) {
- return sourceEditor.getAdapter(adapter);
- } else {
- return null;
+ private class ActivationListener extends ShellAdapter implements
+ IPartListener {
+ private IWorkbenchPart fActivePart;
+ private boolean fIsHandlingActivation = false;
+
+ public void partActivated(IWorkbenchPart part) {
+ fActivePart = part;
+ handleActivation();
+ }
+
+ public void partBroughtToTop(IWorkbenchPart part) {
+ }
+
+ public void partClosed(IWorkbenchPart part) {
+ }
+
+ public void partDeactivated(IWorkbenchPart part) {
+ fActivePart = null;
+ }
+
+ public void partOpened(IWorkbenchPart part) {
+ }
+
+ public void shellActivated(ShellEvent e) {
+ e.widget.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ handleActivation();
}
+ });
}
-
-
- private class ActivationListener extends ShellAdapter implements IPartListener {
- private IWorkbenchPart fActivePart;
- private boolean fIsHandlingActivation = false;
-
- public void partActivated(IWorkbenchPart part) {
- fActivePart = part;
- handleActivation();
- }
-
- public void partBroughtToTop(IWorkbenchPart part) {
- }
-
- public void partClosed(IWorkbenchPart part) {
- }
-
- public void partDeactivated(IWorkbenchPart part) {
- fActivePart = null;
- }
-
- public void partOpened(IWorkbenchPart part) {
- }
-
- public void shellActivated(ShellEvent e) {
- e.widget.getDisplay().asyncExec(new Runnable() {
- public void run() {
- handleActivation();
- }
- });
- }
-
- private void handleActivation() {
- if (fIsHandlingActivation)
- return;
-
- if (fActivePart == multiPageEditor) {
- fIsHandlingActivation = true;
- try {
- if (sourceEditor != null) {
- if (controller != null) {
- controller.refreshTemplates();
- }
- sourceEditor.safelySanityCheckState(getEditorInput());
- }
- } finally {
- fIsHandlingActivation = false;
- }
+
+ private void handleActivation() {
+ if (fIsHandlingActivation)
+ return;
+
+ if (fActivePart == multiPageEditor) {
+ fIsHandlingActivation = true;
+ try {
+ if (sourceEditor != null) {
+ if (controller != null) {
+ controller.refreshTemplates();
}
+ sourceEditor.safelySanityCheckState(getEditorInput());
+ }
+ } finally {
+ fIsHandlingActivation = false;
}
+ }
}
-
- public VpeController getController() {
- return controller;
- }
-
+ }
+
+ public VpeController getController() {
+ return controller;
+ }
+
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2007-08-14 10:44:57 UTC (rev 3112)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2007-08-14 11:04:01 UTC (rev 3113)
@@ -85,8 +85,7 @@
private EditorDomEventListener editorDomEventListener;
private IVpeToolBarManager vpeToolBarManager;
private FormatControllerManager formatControllerManager = new FormatControllerManager();
- private SelectionBar selectionBar = new SelectionBar();
-
+
public void doSave(IProgressMonitor monitor) {
}
@@ -117,10 +116,6 @@
this.controller = controller;
formatControllerManager.setVpeController(controller);
controller.setToolbarFormatControllerManager(formatControllerManager);
- //Add the Selection Bar to listen VPE
- selectionBar.setVpeController(controller);
-// editor.addControlListener(selectionBar);
- controller.setSelectionBarController(selectionBar);
}
Link link = null;
@@ -201,38 +196,6 @@
});
verBar.pack();
- //Bottom Button to show/hide the Selection Bar
- VpePlugin.getDefault().getPreferenceStore().setDefault(SELECT_BAR, "show"); //$NON-NLS-1$
- VpePlugin.getDefault().savePluginPreferences();
-
- ToolBar bt = new ToolBar(cmpVerticalToolbar, SWT.VERTICAL|SWT.FLAT|SWT.BOTTOM);
- ToolItem bbt = new ToolItem(bt, SWT.FLAT | SWT.CHECK);
- bbt.setToolTipText(VpeUIMessages.SHOW_HIDE_SELECTIONBAR);
- bbt.setImage(ImageDescriptor.createFromFile(MozillaEditor.class, "icons/tag_line.gif").createImage()); //$NON-NLS-1$
- boolean bshow;
- if (VpePlugin.getDefault().getPreferenceStore().getString(SELECT_BAR).equals("show")){ //$NON-NLS-1$
- bbt.setSelection(true);
- bshow = true;
- }
- else{
- bbt.setSelection(false);
- bshow = false;
- }
-
- bbt.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- String preferenceValue = VpePlugin.getDefault().getPreferenceStore().getString(SELECT_BAR);
- selectionBar.showBar(preferenceValue);
- if (preferenceValue.equals("show")) { //$NON-NLS-1$
- VpePlugin.getDefault().getPreferenceStore().setValue(SELECT_BAR, "hide"); //$NON-NLS-1$
- }
- else {
- VpePlugin.getDefault().getPreferenceStore().setValue(SELECT_BAR, "show"); //$NON-NLS-1$
- }
- VpePlugin.getDefault().savePluginPreferences();
- }
- });
-
//Create a composite to the Editor
Composite cmpEd = new Composite (cmpEdTl, SWT.NATIVE);
GridLayout layoutEd = new GridLayout(1, false);
@@ -318,8 +281,7 @@
link.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label fill = new Label(cmpEd, SWT.WRAP);
fill.setLayoutData(new GridData(GridData.FILL_BOTH));
- }
- selectionBar.createToolBarComposite(cmpEdTl, bshow);
+ }
}
private ToolItem createToolItem(ToolBar parent, int type, String image, String toolTipText) {
@@ -354,10 +316,6 @@
editor.dispose();
editor = null;
}
- if (selectionBar != null) {
- selectionBar.dispose();
- selectionBar = null;
- }
}
public void setEditorLoadWindowListener(EditorLoadWindowListener listener) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashForm.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashForm.java 2007-08-14 10:44:57 UTC (rev 3112)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashForm.java 2007-08-14 11:04:01 UTC (rev 3113)
@@ -73,36 +73,7 @@
int mask = SWT.BORDER;
return style & mask;
}
- public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- Control[] controls = getControls(true);
- if (controls.length == 0) return new Point(wHint, hHint);
-
- int width = 0;
- int height = 0;
- boolean vertical = (orientation == SWT.VERTICAL);
- if (vertical) {
- height += (controls.length - 1) * SASH_WIDTH;
- } else {
- width += (controls.length - 1) * SASH_WIDTH;
- }
- for (int i = 0; i < controls.length; i++) {
- if (vertical) {
- Point size = controls[i].computeSize(wHint, SWT.DEFAULT);
- height += size.y;
- width = Math.max(width, size.x);
- } else {
- Point size = controls[i].computeSize(SWT.DEFAULT, hHint);
- width += size.x;
- height = Math.max(height, size.y);
- }
- }
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
-
- return new Point(width, height);
- }
-
+
public int getOrientation() {
return orientation;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2007-08-14 10:44:57 UTC (rev 3112)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2007-08-14 11:04:01 UTC (rev 3113)
@@ -43,7 +43,7 @@
public static String PREFERENCES;
public static String REFRESH;
public static String PAGE_DESIGN_OPTIONS;
- public static String SHOW_HIDE_SELECTIONBAR;
+ public static String HIDE_SELECTIONBAR;
public static String MOZILLA_LOADING_ERROR;
public static String MOZILLA_LOADING_ERROR_LINK_TEXT;
public static String MOZILLA_LOADING_ERROR_LINK;
@@ -89,7 +89,9 @@
public static String JUSTIFY;
public static String BULLETS;
public static String NUMBERING;
-
+ public static String CONFIRM_SELECTION_BAR_DIALOG_TITLE;
+ public static String CONFIRM_SELECTION_BAR_DIALOG_MESSAGE;
+ public static String CONFIRM_SELECTION_BAR_DIALOG_TOGGLE_MESSAGE;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2007-08-14 10:44:57 UTC (rev 3112)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2007-08-14 11:04:01 UTC (rev 3113)
@@ -3,7 +3,7 @@
PREFERENCES=Preferences
REFRESH=Refresh
PAGE_DESIGN_OPTIONS=Page Design Options
-SHOW_HIDE_SELECTIONBAR=Show/Hide Selection Bar
+HIDE_SELECTIONBAR=Hide Selection Bar
SHOW_BORDER_FOR_ALL_TAGS=show border for all tags
MOZILLA_LOADING_ERROR=The VPE editor can't be run because your system environment needs to be changed slightly.
MOZILLA_LOADING_ERROR_LINK_TEXT=Find out more.
@@ -49,3 +49,6 @@
JUSTIFY=Justify
BULLETS=Bullets
NUMBERING=Numbering
+CONFIRM_SELECTION_BAR_DIALOG_TITLE=Confirm hide selection bar
+CONFIRM_SELECTION_BAR_DIALOG_MESSAGE=Hide selection bar ?
+CONFIRM_SELECTION_BAR_DIALOG_TOGGLE_MESSAGE=Always hide selection bar without prompt
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2007-08-14 10:44:57 UTC (rev 3112)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2007-08-14 11:04:01 UTC (rev 3113)
@@ -7,225 +7,294 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.vpe.selbar;
-import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.compare.Splitter;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.w3c.dom.Node;
-
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.ui.util.ModelUtilities;
+import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
import org.jboss.tools.vpe.editor.selection.VpeSourceSelectionBuilder;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+import org.w3c.dom.Node;
/**
- * @author erick
- * This class create and manage the Selection Bar under the VPE. Entry point from the class MozilaEditor
- * This bar can be hiden and shown it uses splitter for this
+ * @author erick This class create and manage the Selection Bar under the VPE.
+ * Entry point from the class MozilaEditor This bar can be hiden and
+ * shown it uses splitter for this
*/
-
+
public class SelectionBar extends Layout implements SelectionListener {
- private Splitter splitter;
+ private Splitter splitter;
- private VpeController vpeController = null;
+ private VpeController vpeController = null;
- private ToolBar selBar = null;
+ private ToolBar selBar = null;
+ private ToolBar closeSelectionBar = null;
- private int itemCount = 0;
+ private int itemCount = 0;
- Composite cmpToolBar = null;
+ private Composite cmpToolBar = null;
+ private Composite cmpTlEmpty = null;
+ private Composite cmpBar = null;
+ private Composite closeBar = null;
- Composite cmpBar = null;
+ Listener selbarListener = null;
- Listener selbarListener = null;
+ final static String PREFERENCE_STATUS_BAR_ENABLE = "yes";
+ final static String PREFERENCE_STATUS_BAR_DISABLE = "no";
-
- public Composite createToolBarComposite(Composite parent, boolean show) {
+ public Composite createToolBarComposite(Composite parent, boolean show) {
- splitter = new Splitter(parent, SWT.NONE);
- splitter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ splitter = new Splitter(parent, SWT.NONE);
+ splitter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ /*
+ * The empty composite
+ */
+ cmpTlEmpty = new Composite(splitter, SWT.NONE) {
+ public Point computeSize(int wHint, int hHint, boolean changed) {
+ Point point = super.computeSize(wHint, hHint, changed);
+ point.y = 1;
+ return point;
+ }
+ };
- /*
- * The empty composite
- */
- Composite cmpTlEmpty = new Composite(splitter, SWT.NONE) {
- public Point computeSize(int wHint, int hHint, boolean changed) {
- Point point = super.computeSize(wHint, hHint, changed);
- point.y = 1;
- return point;
- }
- };
+ cmpTlEmpty.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- cmpTlEmpty.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ // Main composite of the visible splitter
+ cmpToolBar = new Composite(splitter, SWT.NONE);
+ cmpToolBar.setLayout(this);
- // Main composite of the visivle splitter
- cmpToolBar = new Composite(splitter, SWT.NONE);
- cmpToolBar.setLayout(this);
-
- GridLayout layoutTl = new GridLayout(1, false);
- layoutTl.marginBottom = 0;
- layoutTl.marginHeight = 0;
- layoutTl.marginWidth = 0;
- layoutTl.verticalSpacing = 0;
- layoutTl.horizontalSpacing = 0;
-
- // Midle composite, witch contain the selectbar
- cmpBar = new Composite(cmpToolBar, SWT.NONE);
- cmpBar.setLayout(layoutTl);
- cmpBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ GridLayout layoutTl = new GridLayout(1, false);
+ layoutTl.marginBottom = 0;
+ layoutTl.marginHeight = 0;
+ layoutTl.marginWidth = 0;
+ layoutTl.verticalSpacing = 0;
+ layoutTl.horizontalSpacing = 0;
- // Create selection bar
- selBar = new ToolBar(cmpBar, SWT.HORIZONTAL | SWT.FLAT);
- if (show == true) {
- splitter.setVisible(cmpTlEmpty, false);
- splitter.setVisible(cmpToolBar, true);
- }
- else {
- splitter.setVisible(cmpTlEmpty, true);
- splitter.setVisible(cmpToolBar, false);
- }
-
+ // Middle composite, witch contain the selectbar
+ cmpBar = new Composite(cmpToolBar, SWT.NONE);
+ cmpBar.setLayout(layoutTl);
+ cmpBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- return splitter;
- }
+ closeBar = new Composite(cmpToolBar, SWT.NONE);
+ closeBar.setLayout(layoutTl);
+ closeBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- public void showBar(String show) {
+ closeSelectionBar = new ToolBar(closeBar, SWT.HORIZONTAL | SWT.FLAT);
+ ToolItem closeItem = new ToolItem(closeSelectionBar, SWT.FLAT);
+ closeItem.setImage(PlatformUI.getWorkbench().getSharedImages()
+ .getImage(ISharedImages.IMG_TOOL_DELETE));
+ closeItem.setToolTipText(VpeUIMessages.HIDE_SELECTIONBAR);
+ closeItem.addListener(SWT.Selection, new Listener() {
- Control[] children = splitter.getChildren();
- if (children != null && children.length > 0) {
- if (show.equals("show")) {
- splitter.setVisible(children[0], true);
- splitter.setVisible(children[1], false);
- splitter.getParent().layout(true, true);
- } else {
- splitter.setVisible(children[0], false);
- splitter.setVisible(children[1], true);
- splitter.getParent().layout(true, true);
- }
+ public void handleEvent(Event event) {
+ boolean toggleState = VpePreference.ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT
+ .getValue().equals(PREFERENCE_STATUS_BAR_ENABLE);
+ XModelObject optionsObject = ModelUtilities
+ .getPreferenceModel().getByPath(
+ VpePreference.VPE_EDITOR_PATH);
+ if (!toggleState) {
+ MessageDialogWithToggle dialog = MessageDialogWithToggle
+ .openOkCancelConfirm(
+ PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow()
+ .getShell(),
+ VpeUIMessages.CONFIRM_SELECTION_BAR_DIALOG_TITLE,
+ VpeUIMessages.CONFIRM_SELECTION_BAR_DIALOG_MESSAGE,
+ VpeUIMessages.CONFIRM_SELECTION_BAR_DIALOG_TOGGLE_MESSAGE,
+ false, null, null);
+ if (dialog.getReturnCode() != IDialogConstants.OK_ID) {
+ return;
+ }
+ if (dialog.getToggleState()) {
+ optionsObject
+ .setAttributeValue(
+ VpePreference.ATT_ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT,
+ PREFERENCE_STATUS_BAR_ENABLE);
+ }
}
+ optionsObject.setAttributeValue(
+ VpePreference.ATT_SHOW_SELECTION_TAG_BAR,
+ PREFERENCE_STATUS_BAR_DISABLE);
+ showBar(PREFERENCE_STATUS_BAR_DISABLE);
+ }
+ });
+ // Create selection bar
+ selBar = new ToolBar(cmpBar, SWT.HORIZONTAL | SWT.FLAT);
+ if (show == true) {
+ splitter.setVisible(cmpTlEmpty, false);
+ splitter.setVisible(cmpToolBar, true);
+ } else {
+ splitter.setVisible(cmpTlEmpty, true);
+ splitter.setVisible(cmpToolBar, false);
}
- public void setVpeController(VpeController vpeController) {
- this.vpeController = vpeController;
+ return splitter;
+ }
+
+ public void showBar(String show) {
+ if (show.equals(PREFERENCE_STATUS_BAR_ENABLE)) {
+ splitter.setVisible(cmpToolBar, true);
+ splitter.setVisible(cmpTlEmpty, false);
+ splitter.getParent().layout(true, true);
+ } else {
+ splitter.setVisible(cmpToolBar, false);
+ splitter.setVisible(cmpTlEmpty, true);
+ splitter.getParent().layout(true, true);
}
+ }
- public void selectionChanged() {
+ public void setVpeController(VpeController vpeController) {
+ this.vpeController = vpeController;
+ }
- VpeSourceSelectionBuilder sourceSelectionBuilder = new VpeSourceSelectionBuilder(
- vpeController.getSourceEditor());
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
- if (selection == null) {
- return;
- }
+ public void selectionChanged() {
-// Node node = selection.getFocusNode();
- Node node = selection.getStartNode();
- if (node != null && node.getNodeType() == Node.TEXT_NODE) {
- node = node.getParentNode();
- }
+ VpeSourceSelectionBuilder sourceSelectionBuilder = new VpeSourceSelectionBuilder(
+ vpeController.getSourceEditor());
+ VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ if (selection == null) {
+ return;
+ }
- int elementCounter = 0;
- while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
- ToolItem item = null;
- if (selBar.getItemCount() > elementCounter) {
- item = selBar.getItem(selBar.getItemCount() - elementCounter - 1);
- item.setData(node);
- } else {
- item = new ToolItem(selBar, SWT.FLAT, 0);
- item.addSelectionListener(this);
- item.setData(node);
- }
- item.setText(node.getNodeName());
- elementCounter++;
- node = node.getParentNode();
- }
- itemCount = elementCounter;
- cmpToolBar.layout();
+ // Node node = selection.getFocusNode();
+ Node node = selection.getStartNode();
+ if (node != null && node.getNodeType() == Node.TEXT_NODE) {
+ node = node.getParentNode();
}
- protected Point computeSize(Composite composite, int wHint, int hHint,
- boolean flushCache) {
- return selBar.computeSize(SWT.DEFAULT, hHint);
+ int elementCounter = 0;
+ while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
+ ToolItem item = null;
+ if (selBar.getItemCount() > elementCounter) {
+ item = selBar.getItem(selBar.getItemCount() - elementCounter
+ - 1);
+ item.setData(node);
+ } else {
+ item = new ToolItem(selBar, SWT.FLAT, 0);
+ item.addSelectionListener(this);
+ item.setData(node);
+ }
+ item.setText(node.getNodeName());
+ elementCounter++;
+ node = node.getParentNode();
}
+ itemCount = elementCounter;
+ cmpToolBar.layout();
+ }
- protected void layout(Composite composite, boolean flushCache) {
- Rectangle rect = null;
- try {
- rect = composite.getBounds();
- } catch (SWTException e) {
- VpePlugin.getPluginLog().logError(e);
- }
+ protected Point computeSize(Composite composite, int wHint, int hHint,
+ boolean flushCache) {
+ Point point = selBar.computeSize(SWT.DEFAULT, hHint);
+ point.y = closeBar.getSize().y;
+ return point;
+ }
- int allItems = selBar.getItems().length;
- if (allItems == 0)
- return;
+ protected void layout(Composite composite, boolean flushCache) {
+ Rectangle rect = null;
+ try {
+ rect = composite.getBounds();
+ } catch (SWTException e) {
+ VpePlugin.getPluginLog().logError(e);
+ }
- Rectangle r = selBar.getItem(allItems - 1).getBounds();
- int width = r.x + r.width;
- int height = r.height;
-
+ Rectangle closeBarRect = closeSelectionBar.getItem(0).getBounds();
+ rect.width -= closeBarRect.width;
- if (allItems >= itemCount) {
- int x = 0;
+ int allItems = selBar.getItems().length;
+ if (allItems == 0) {
+ cmpBar.setBounds(new Rectangle(rect.x, rect.y, rect.width,
+ closeBarRect.height));
+ closeBar.setBounds(new Rectangle(rect.width, rect.y, rect.width
+ + closeBarRect.width, closeBarRect.height));
+ return;
+ }
+ Rectangle r = selBar.getItem(allItems - 1).getBounds();
+ int width = r.x + r.width;
+ int height = r.height;
- if (itemCount == 0) {
- x = selBar.getBounds().width;
- } else {
- x = selBar.getItem(allItems - itemCount).getBounds().x;
- }
- rect.x -= x;
- }
+ if (allItems >= itemCount) {
+ int x = 0;
- if (rect.width < (r.x + r.width - Math.abs(rect.x) + 10)) {
- rect.x -= (r.x + r.width - Math.abs(rect.x)) - rect.width;
- }
- cmpBar.setBounds(new Rectangle(rect.x, 0, width, height));
- selBar.setSize(width, height);
+ if (itemCount == 0) {
+ x = selBar.getBounds().width;
+ } else {
+ x = selBar.getItem(allItems - itemCount).getBounds().x;
+ }
+ rect.x -= x;
+
+ if (rect.width < (r.x + r.width - Math.abs(rect.x) + 10)) {
+ rect.x -= (r.x + r.width - Math.abs(rect.x)) - rect.width;
+ }
+ cmpBar.setBounds(new Rectangle(rect.x, 0, width, height));
+ selBar.setSize(width, closeBarRect.height);
+ closeBar.setBounds(new Rectangle(rect.width, rect.y, rect.width
+ + closeBarRect.width, closeBarRect.height));
}
+ }
- public void dispose() {
- if (selBar != null && (!selBar.isDisposed())) {
- for (int i =0; i < selBar.getItemCount(); i++) {
- if (!selBar.getItem(i).isDisposed()) {
- selBar.getItem(i).removeSelectionListener(this);
- }
- }
+ public void dispose() {
+ if (!selBar.isDisposed()) {
+ for (int i = 0; i < selBar.getItemCount(); i++) {
+ if (!selBar.getItem(i).isDisposed()) {
+ selBar.getItem(i).removeSelectionListener(this);
}
+ }
}
-
- public void widgetSelected(SelectionEvent e) {
- ToolItem toolItem = (ToolItem) e.widget;
- int offset = ((ElementImpl)(Node)toolItem.getData()).getStartOffset();
- setSourceFocus(offset);
+ if (!closeSelectionBar.isDisposed()) {
+ for (int i = 0; i < closeSelectionBar.getItemCount(); i++) {
+ if (!closeSelectionBar.getItem(i).isDisposed()) {
+ closeSelectionBar.getItem(i).removeSelectionListener(this);
+ }
+ }
}
+ }
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- private void setSourceFocus(int offset) {
- vpeController.getPageContext().getSourceBuilder().getStructuredTextViewer().setSelectedRange(offset, 0);
- vpeController.getPageContext().getSourceBuilder().getStructuredTextViewer().revealRange(offset, 0);
- }
-
- public String toString() {
- StringBuffer st = new StringBuffer("CountItem: ");
- st.append(itemCount);
- st.append(" Parent Composite: " + cmpToolBar.getBounds().width);
- st.append(" Midle composite: " + cmpBar.getBounds().width);
- st.append(" Bar : " + selBar.getBounds().width);
- return st.toString();
- }
-
+ public void widgetSelected(SelectionEvent e) {
+ ToolItem toolItem = (ToolItem) e.widget;
+ int offset = ((ElementImpl) (Node) toolItem.getData()).getStartOffset();
+ setSourceFocus(offset);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ private void setSourceFocus(int offset) {
+ vpeController.getPageContext().getSourceBuilder()
+ .getStructuredTextViewer().setSelectedRange(offset, 0);
+ vpeController.getPageContext().getSourceBuilder()
+ .getStructuredTextViewer().revealRange(offset, 0);
+ }
+
+ public String toString() {
+ StringBuffer st = new StringBuffer("CountItem: ");
+ st.append(itemCount);
+ st.append(" Parent Composite: " + cmpToolBar.getBounds().width);
+ st.append(" Midle composite: " + cmpBar.getBounds().width);
+ st.append(" Bar : " + selBar.getBounds().width);
+ return st.toString();
+ }
}
18 years, 4 months
JBoss Tools SVN: r3112 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-08-14 06:44:57 -0400 (Tue, 14 Aug 2007)
New Revision: 3112
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF
Log:
http://jira.jboss.com/jira/browse/EXIN-443 Removed common.model from dependecies.
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF 2007-08-14 10:42:01 UTC (rev 3111)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF 2007-08-14 10:44:57 UTC (rev 3112)
@@ -21,7 +21,6 @@
org.eclipse.ui.editors,
org.eclipse.jface.text,
org.jboss.tools.common,
- org.jboss.tools.common.model,
org.hibernate.eclipse,
org.hibernate.eclipse.console,
org.eclipse.debug.core
18 years, 4 months