Author: mareshkau
Date: 2007-10-16 04:44:29 -0400 (Tue, 16 Oct 2007)
New Revision: 4210
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAttributeCreator.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreator.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDebugUtil.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1091, some Maps and list was mode parameterized
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-10-16
08:15:47 UTC (rev 4209)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-10-16
08:44:29 UTC (rev 4210)
@@ -324,9 +324,9 @@
}
public void notifyChanged(INodeNotifier notifier, int eventType, Object feature, Object
oldValue, Object newValue, int pos) {
-// if (!switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
-// return;
-// }
+ if (!switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
+ }
if (VpeDebug.PRINT_SOURCE_MUTATION_EVENT) {
printSourceEvent(notifier, eventType, feature, oldValue, newValue, pos);
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-10-16
08:15:47 UTC (rev 4209)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-10-16
08:44:29 UTC (rev 4210)
@@ -348,7 +348,7 @@
switch (sourceNode.getNodeType()) {
case Node.ELEMENT_NODE:
Map<?, ?> xmlnsMap = createXmlns((Element) sourceNode);
- Set<?> ifDependencySet = new HashSet();
+ Set<Node> ifDependencySet = new HashSet<Node>();
pageContext.setCurrentVisualNode(visualOldContainer);
VpeTemplate template = templateManager.getTemplate(pageContext,
(Element) sourceNode, ifDependencySet);
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAttributeCreator.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAttributeCreator.java 2007-10-16
08:15:47 UTC (rev 4209)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAttributeCreator.java 2007-10-16
08:44:29 UTC (rev 4210)
@@ -71,7 +71,7 @@
private void setValue(VpePageContext pageContext, Element sourceElement, Map
visualNodeMap) {
if (expression != null) {
- Element visualElement = (Element) visualNodeMap.get(this);
+ nsIDOMElement visualElement = (nsIDOMElement) visualNodeMap.get(this);
VpeValue vpeValue = expression.exec(pageContext, sourceElement);
if (vpeValue != null && vpeValue.stringValue().length() > 0) {
visualElement.setAttribute(this.name, vpeValue.stringValue());
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreator.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreator.java 2007-10-16
08:15:47 UTC (rev 4209)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreator.java 2007-10-16
08:44:29 UTC (rev 4210)
@@ -35,7 +35,7 @@
* @param visualNodeMap Is used for a storage padding information.
* @return The information on the created node of the visual tree.
*/
- VpeCreatorInfo create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument
visualDocument, nsIDOMElement visualElement, Map visualNodeMap);
+ VpeCreatorInfo create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument
visualDocument, nsIDOMElement visualElement, Map<VpeTemplate,?> visualNodeMap);
/**
* Is invoked after construction of all child nodes of the current visual node.
@@ -46,7 +46,7 @@
* @param visualElement The current element of the visual tree.
* @param visualNodeMap Is used for a storage padding information.
*/
- void validate(VpePageContext pageContext, Element sourceElement, nsIDOMDocument
visualDocument, nsIDOMElement visualParent, nsIDOMElement visualElement, Map
visualNodeMap);
+ void validate(VpePageContext pageContext, Element sourceElement, nsIDOMDocument
visualDocument, nsIDOMElement visualParent, nsIDOMElement visualElement,
Map<VpeTemplate,?> visualNodeMap);
/**
* Informs on remove of an element of the visual tree.
@@ -54,7 +54,7 @@
* @param sourceElement The current element of the source tree.
* @param visualNodeMap Is used for a storage padding information.
*/
- void removeElement(VpePageContext pageContext, Element sourceElement, Map
visualNodeMap);
+ void removeElement(VpePageContext pageContext, Element sourceElement,
Map<VpeTemplate,?> visualNodeMap);
/**
* Is used for refresh the current element of visual tree.
@@ -62,7 +62,7 @@
* @param sourceElement The current element of the source tree.
* @param visualNodeMap Is used for a storage padding information.
*/
- void refreshElement(VpePageContext pageContext, Element sourceElement, Map
visualNodeMap);
+ void refreshElement(VpePageContext pageContext, Element sourceElement,
Map<VpeTemplate,?> visualNodeMap);
/**
* Sets value of attribute of the current visual element.
@@ -73,7 +73,7 @@
* @param name Attribute name.
* @param value Attribute value.
*/
- void setAttribute(VpePageContext pageContext, Element sourceElement, Map visualNodeMap,
String name, String value);
+ void setAttribute(VpePageContext pageContext, Element sourceElement,
Map<VpeTemplate,?> visualNodeMap, String name, String value);
/**
* Informs on remove of attribute of the current source element.
@@ -82,7 +82,7 @@
* @param visualNodeMap Is used for a storage padding information.
* @param name Attribute name.
*/
- void removeAttribute(VpePageContext pageContext, Element sourceElement, Map
visualNodeMap, String name);
+ void removeAttribute(VpePageContext pageContext, Element sourceElement,
Map<VpeTemplate,?> visualNodeMap, String name);
/**
* Returns <code>true</code> if it is required to re-create an element at a
modification of attribute, <code>false</code> otherwise.
@@ -110,5 +110,5 @@
*/
boolean nonctrlKeyPressHandler(VpePageContext pageContext, Document sourceDocument, Node
sourceNode, Object data, long charCode, VpeSourceSelection selection, ITextFormatter
formatter);
- Node getNodeForUptate(VpePageContext pageContext, Node sourceNode, nsIDOMNode
visualNode, Map visualNodeMap);
+ Node getNodeForUptate(VpePageContext pageContext, Node sourceNode, nsIDOMNode
visualNode, Map<VpeTemplate,?> visualNodeMap);
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java 2007-10-16
08:15:47 UTC (rev 4209)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java 2007-10-16
08:44:29 UTC (rev 4210)
@@ -65,14 +65,14 @@
private VpeCreator creator = null;
private VpeDependencyMap dependencyMap;
private boolean dependencyFromBundle;
-
+ @Override
protected void init(Element templateElement) {
dependencyMap = new VpeDependencyMap(caseSensitive);
super.init(templateElement);
dependencyMap.validate();
dependencyFromBundle =
dependencyMap.contains(VpeExpressionBuilder.SIGNATURE_JSF_VALUE);
}
-
+ @Override
protected void initTemplateSection(Element templateSection) {
if (creator == null) {
String name = templateSection.getNodeName();
@@ -139,7 +139,7 @@
}
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- Map visualNodeMap = new HashMap();
+ Map<VpeTemplate, ModifyInfo> visualNodeMap = new HashMap<VpeTemplate,
ModifyInfo> ();
VpeCreatorInfo creatorInfo = createVisualElement(pageContext, (Element)sourceNode,
visualDocument, null, visualNodeMap);
nsIDOMElement newVisualElement = null;
if (creatorInfo != null) {
@@ -147,7 +147,7 @@
}
VpeCreationData creationData = new VpeCreationData(newVisualElement);
if (creatorInfo != null) {
- List childrenInfoList = creatorInfo.getChildrenInfoList();
+ List<VpeChildrenInfo> childrenInfoList = creatorInfo.getChildrenInfoList();
if (childrenInfoList != null) {
for (int i = 0; i < childrenInfoList.size(); i++) {
creationData.addChildrenInfo((VpeChildrenInfo)childrenInfoList.get(i));
@@ -157,28 +157,28 @@
creationData.setData(visualNodeMap);
return creationData;
}
-
+ @Override
public void validate(VpePageContext pageContext, Node sourceNode, nsIDOMDocument
visualDocument, VpeCreationData creationdata) {
- validateVisualElement(pageContext, (Element)sourceNode, visualDocument, null,
(nsIDOMElement)creationdata.getNode(), (Map)creationdata.getData());
+ validateVisualElement(pageContext, (Element)sourceNode, visualDocument, null,
(nsIDOMElement)creationdata.getNode(),
(Map<VpeTemplate,ModifyInfo>)creationdata.getData());
}
-
- public void setAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name, String value) {
+ @Override
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
setAttribute(pageContext, sourceElement, (Map<?,?>)data, name, value);
}
-
+ @Override
public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
- removeAttribute(pageContext, sourceElement, (Map)data, name);
+ removeAttribute(pageContext, sourceElement, (Map<?,?>)data, name);
}
-
+ @Override
public void beforeRemove(VpePageContext pageContext, Node sourceNode, nsIDOMNode
visualNode, Object data) {
- removeElement(pageContext, (Element)sourceNode, (Map) data);
+ removeElement(pageContext, (Element)sourceNode, (Map<VpeTemplate,?>) data);
}
-
+ @Override
public boolean isChildren() {
return creator == null ? false : children;
}
- private VpeCreatorInfo createVisualElement(VpePageContext pageContext, Element
sourceElement, nsIDOMDocument visualDocument, nsIDOMElement visualParent, Map
visualNodeMap) {
+ private VpeCreatorInfo createVisualElement(VpePageContext pageContext, Element
sourceElement, nsIDOMDocument visualDocument, nsIDOMElement visualParent,
Map<VpeTemplate,ModifyInfo> visualNodeMap) {
if (creator == null) {
return null;
}
@@ -202,12 +202,12 @@
return elementInfo;
}
- private void validateVisualElement(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMElement visualParent, nsIDOMElement visualElement,
Map visualNodeMap) {
+ private void validateVisualElement(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMElement visualParent, nsIDOMElement visualElement,
Map<VpeTemplate,ModifyInfo> visualNodeMap) {
if (creator != null) {
creator.validate(pageContext, sourceElement, visualDocument, visualParent,
visualElement, visualNodeMap);
}
}
-
+ @Override
public boolean nonctrlKeyPressHandler(VpePageContext pageContext, Document
sourceDocument, Node sourceNode, nsIDOMNode visualNode, Object data, long charCode,
VpeSourceSelection selection, ITextFormatter formatter) {
if (creator != null) {
boolean done = creator.nonctrlKeyPressHandler(pageContext, sourceDocument,
sourceNode, data, charCode, selection, formatter);
@@ -227,11 +227,12 @@
*
* Deprecated
*/
+ @Override
public void refreshBundleValues(VpePageContext pageContext, Element sourceElement,
Object data) {
- refreshBundleValues(pageContext, sourceElement, (Map<?,?>) data);
+ refreshBundleValues(pageContext, sourceElement, (Map<VpeTemplate,ModifyInfo>)
data);
}
- private void refreshBundleValues(VpePageContext pageContext, Element sourceElement, Map
visualNodeMap) {
+ private void refreshBundleValues(VpePageContext pageContext, Element sourceElement,
Map<VpeTemplate,ModifyInfo> visualNodeMap) {
if (dependencyFromBundle) {
VpeCreator[] creators =
dependencyMap.getCreators(VpeExpressionBuilder.SIGNATURE_JSF_VALUE);
for (int i = 0; i < creators.length; i++) {
@@ -245,6 +246,7 @@
*
* Deprecated
*/
+ @Override
public int getType() {
return type;
}
@@ -253,6 +255,7 @@
*
* Deprecated
*/
+ @Override
public VpeAnyData getAnyData() {
VpeAnyData data = null;
if (getType() == TYPE_ANY && creator != null) {
@@ -276,11 +279,12 @@
*
* Deprecated
*/
+ @Override
public void openBundleEditors(VpePageContext pageContext, Element sourceElement, Object
data) {
- openBundleEditors(pageContext, sourceElement, (Map) data);
+ openBundleEditors(pageContext, sourceElement, (Map<VpeTemplate,nsIDOMElement>)
data);
}
- private void openBundleEditors(VpePageContext pageContext, Element sourceElement, Map
visualNodeMap) {
+ private void openBundleEditors(VpePageContext pageContext, Element sourceElement,
Map<VpeTemplate,nsIDOMElement> visualNodeMap) {
if (dependencyFromBundle) {
VpeCreator[] creators =
dependencyMap.getCreators(VpeExpressionBuilder.SIGNATURE_JSF_VALUE);
for (int i = 0; i < creators.length; i++) {
@@ -352,6 +356,7 @@
*
* Deprecated
*/
+ @Override
public void openIncludeEditor(VpePageContext pageContext, Element sourceElement, Object
data) {
openIncludeEditor(pageContext, sourceElement, (Map) data);
}
@@ -374,11 +379,12 @@
*
* Deprecated
*/
+ @Override
public void setSourceAttributeValue(VpePageContext pageContext, Element sourceElement,
Object data) {
- setSourceAttributeValue(pageContext, sourceElement, (Map)data);
+ setSourceAttributeValue(pageContext, sourceElement, (Map<?,?>)data);
}
- private void setSourceAttributeValue(VpePageContext pageContext, Element sourceElement,
Map visualNodeMap) {
+ private void setSourceAttributeValue(VpePageContext pageContext, Element sourceElement,
Map<?,?> visualNodeMap) {
VpeCreator[] creators =
dependencyMap.getCreators(VpeValueCreator.SIGNATURE_VPE_VALUE);
for (int i = 0; i < creators.length; i++) {
if (creators[i] instanceof VpeOutputAttributes) {
@@ -387,7 +393,7 @@
}
changeModify(pageContext, sourceElement, visualNodeMap);
}
-
+ @Override
public String[] getOutputAtributeNames() {
VpeCreator[] creators =
dependencyMap.getCreators(VpeValueCreator.SIGNATURE_VPE_VALUE);
for (int i = 0; i < creators.length; i++) {
@@ -397,12 +403,12 @@
}
return null;
}
-
+ @Override
public nsIDOMText getOutputTextNode(VpePageContext pageContext, Element sourceElement,
Object data) {
VpeCreator[] creators =
dependencyMap.getCreators(VpeValueCreator.SIGNATURE_VPE_VALUE);
for (int i = 0; i < creators.length; i++) {
if (creators[i] instanceof VpeOutputAttributes) {
- return ((VpeOutputAttributes)creators[i]).getOutputTextNode(pageContext,
sourceElement, (Map)data);
+ return ((VpeOutputAttributes)creators[i]).getOutputTextNode(pageContext,
sourceElement, (Map<?,?>)data);
}
}
return null;
@@ -412,6 +418,7 @@
*
* Deprecated
*/
+ @Override
public void setSourceAttributeSelection(VpePageContext pageContext, Element
sourceElement, int offset, int length, Object data) {
setSourceAttributeSelection(pageContext, sourceElement, offset, length, (Map) data);
}
@@ -510,6 +517,7 @@
*
* Deprecated
*/
+ @Override
public boolean isOutputAttributes() {
VpeCreator[] creators =
dependencyMap.getCreators(VpeValueCreator.SIGNATURE_VPE_VALUE);
for (int i = 0; i < creators.length; i++) {
@@ -522,7 +530,7 @@
//////////////////////////////////////////////
- private void removeElement(VpePageContext pageContext, Element sourceElement, Map
visualNodeMap) {
+ private void removeElement(VpePageContext pageContext, Element sourceElement,
Map<VpeTemplate,?> visualNodeMap) {
if (creator != null) {
if (dependencyFromBundle) {
pageContext.removeBundleDependency(sourceElement);
@@ -547,25 +555,25 @@
}
}
- private void setAttribute(VpeCreator[] creators, VpePageContext pageContext, Element
sourceElement, Map visualNodeMap, String name, String value) {
+ private void setAttribute(VpeCreator[] creators, VpePageContext pageContext, Element
sourceElement, Map<VpeTemplate,?> visualNodeMap, String name, String value) {
for (int i = 0; i < creators.length; i++) {
creators[i].setAttribute(pageContext, sourceElement, visualNodeMap, name, value);
}
}
- private void removeAttribute(VpeCreator[] creators, VpePageContext pageContext, Element
sourceElement, Map visualNodeMap, String name) {
+ private void removeAttribute(VpeCreator[] creators, VpePageContext pageContext, Element
sourceElement, Map<VpeTemplate,?> visualNodeMap, String name) {
for (int i = 0; i < creators.length; i++) {
creators[i].removeAttribute(pageContext, sourceElement, visualNodeMap, name);
}
}
-
+ @Override
public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMElement visualNode, Object data, String name, String
value) {
if (creator != null) {
return creator.isRecreateAtAttrChange(pageContext, sourceElement, visualDocument,
visualNode, data, name, value);
}
return false;
}
-
+ @Override
public Node getNodeForUptate(VpePageContext pageContext, Node sourceNode, nsIDOMNode
visualNode, Object data) {
// TODO Sergey Vasilyev redevelop JSF's facet template
if (sourceNode.getNodeName().endsWith(":facet")) {
@@ -573,7 +581,7 @@
}
if (creator != null) {
- return creator.getNodeForUptate(pageContext, sourceNode, visualNode, (Map)data);
+ return creator.getNodeForUptate(pageContext, sourceNode, visualNode,
(Map<VpeTemplate,?>)data);
}
return null;
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDebugUtil.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDebugUtil.java 2007-10-16
08:15:47 UTC (rev 4209)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDebugUtil.java 2007-10-16
08:44:29 UTC (rev 4210)
@@ -14,6 +14,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.vpe.VpeDebug;
/**
* @author Max Areshkau (mareshkau(a)exadel.com)
@@ -37,4 +38,13 @@
System.out.print(formatter.format(new Date())+":"+ msg);
}
}
+ /**
+ *
+ */
+ public static void debugVPEDnDEvents(String msg) {
+ if(VpeDebug.PRINT_VISUAL_DRAGDROP_EVENT) {
+
+ System.out.println(formatter.format(new Date())+":"+ msg);
+ }
+ }
}