Author: dmaliarevich
Date: 2012-02-15 05:08:42 -0500 (Wed, 15 Feb 2012)
New Revision: 38741
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/VpeVisualDomBuilder.java
Log:
https://issues.jboss.org/browse/JBIDE-9997 - code cleanup.
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 2012-02-15
09:49:50 UTC (rev 38740)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2012-02-15
10:08:42 UTC (rev 38741)
@@ -631,13 +631,12 @@
Object feature, Object oldValue, Object newValue, int pos) {
if (editPart.getVisualMode() != VpeEditorPart.SOURCE_MODE) {
if (VpeDebug.PRINT_SOURCE_MUTATION_EVENT) {
- VpeDebugUtil.printSourceEvent(notifier, eventType, feature, oldValue,
- newValue, pos);
+ VpeDebugUtil.printSourceEvent(
+ notifier, eventType, feature, oldValue, newValue, pos);
}
if (visualBuilder == null) {
return;
}
- // visualBuilder.rebuildFlag = false;
switch (eventType) {
case INodeNotifier.CHANGE:
sourceChangeFlag = true;
@@ -650,30 +649,29 @@
boolean update = visualBuilder.setText((Node) notifier);
visualEditor.showResizer();
// Added by Max Areshkau JBIDE-1554
- if (!update)
+ if (!update) {
visualBuilder.updateNode((Node) notifier);
+ }
} else if (type == Node.COMMENT_NODE) {
if ("yes".equals(VpePreference.SHOW_COMMENTS.getValue())) { //$NON-NLS-1$
visualBuilder.clearSelectionRectangle();
visualBuilder.updateNode((Node) notifier);
}
- } else if (feature != null
+ } else if ((feature != null)
&& ((Node) feature).getNodeType() == Node.ATTRIBUTE_NODE) {
if (newValue != null) {
String attrName = ((Attr) feature).getName();
if ((Attr) feature == lastRemovedAttr
&& !attrName.equals(lastRemovedAttrName)) {
lastRemovedAttr = null;
- visualBuilder.removeAttribute((Element) notifier,
- lastRemovedAttrName);
+ visualBuilder.removeAttribute((Element) notifier, lastRemovedAttrName);
}
visualBuilder.setAttribute((Element) notifier,
((Attr) feature).getName(), (String) newValue);
} else {
lastRemovedAttr = (Attr) feature;
lastRemovedAttrName = ((Attr) feature).getName();
- visualBuilder.removeAttribute((Element) notifier,
- lastRemovedAttrName);
+ visualBuilder.removeAttribute((Element) notifier, lastRemovedAttrName);
}
}
visualEditor.showResizer();
@@ -715,14 +713,12 @@
case INodeNotifier.STRUCTURE_CHANGED:
/*
- *
https://jira.jboss.org/jira/browse/JBIDE-4102 Do not update
- * parent tag when a comment was changed,
+ *
https://jira.jboss.org/jira/browse/JBIDE-4102
+ * Do not update parent tag when a comment was changed,
+ *
+ *
https://jira.jboss.org/jira/browse/JBIDE-6067
+ * Update if action is connected with add or remove comment
*/
-
- /*
- *
https://jira.jboss.org/jira/browse/JBIDE-6067 Update if action
- * is connected with add or remove comment
- */
if (!commentNodeChanged ||(commentNodeChanged && (commentAddCount != 1 ||
commentRemoveCount != 1))) {
visualEditor.hideResizer();
visualBuilder.clearSelectionRectangle();
@@ -1093,7 +1089,7 @@
removeSourceScrollListener();
visualScrollEventFlag = true;
int line = scrollCoordinator.computeSourcePositionFromVisual();
- if ((line != -1) && (sourceEditor.getTextViewer() != null)){
+ if ((line != -1) && (sourceEditor.getTextViewer() != null)) {
sourceEditor.getTextViewer().setTopIndex(line);
}
addSourceScrollListener();
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2012-02-15
09:49:50 UTC (rev 38740)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2012-02-15
10:08:42 UTC (rev 38741)
@@ -98,17 +98,9 @@
private MozillaEditor visualEditor;
private XulRunnerEditor xulRunnerEditor;
-
- // JBIDE-2170 Sergey Dzmitrovich
- // private nsIDOMElement visualContentArea;
private VpePageContext pageContext;
- // JBIDE-2170 Sergey Dzmitrovich
- // private nsIDOMNode headNode;
private List<VpeIncludeInfo> includeStack;
- // TODO Max Areshkau JBIDE-1457
- // boolean rebuildFlag = false;
-
private static final String ATTR_VPE = "vpe"; //$NON-NLS-1$
private static final String ATTR_VPE_INLINE_LINK_VALUE = "inlinelink";
//$NON-NLS-1$
@@ -142,29 +134,17 @@
private boolean showBorderForUnknownTags;
public static final List<nsIDOMNode> EMPTY_SELECTION =
Collections.unmodifiableList(new ArrayList<nsIDOMNode>(0));
- public VpeVisualDomBuilder(VpeDomMapping domMapping,
- INodeAdapter sorceAdapter,
+ public VpeVisualDomBuilder(VpeDomMapping domMapping, INodeAdapter sorceAdapter,
MozillaEditor visualEditor, VpePageContext pageContext) {
super(domMapping, sorceAdapter);
this.visualEditor = visualEditor;
xulRunnerEditor = visualEditor.getXulRunnerEditor();
-
- // this.visualContentArea = visualEditor.getContentArea();
this.pageContext = pageContext;
- // this.headNode = visualEditor.getHeadNode();
-
-// if (isFacelet()) {
-// faceletFile = true;
-// } else {
-// faceletFile = false;
-// }
-
this.showInvisibleTags = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
IVpePreferencesPage.SHOW_NON_VISUAL_TAGS);
this.showBorderForUnknownTags =
JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
IVpePreferencesPage.SHOW_BORDER_FOR_UNKNOWN_TAGS);
-
}
public void buildDom(Document sourceDocument) {