Author: mareshkau
Date: 2010-09-17 07:16:09 -0400 (Fri, 17 Sep 2010)
New Revision: 24976
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/icons/
trunk/jst/plugins/org.jboss.tools.jst.jsp/icons/selbar.gif
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SelectedNodeInfo.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SelectionHelper.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelection.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelectionBuilder.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/handlers/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/handlers/SelectionBarHandler.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/NodesManagingUtil.java
Removed:
trunk/vpe/plugins/org.jboss.tools.vpe/resources/org/jboss/tools/vpe/editor/mozilla/icons/selbar.gif
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSelectedNodeInfo.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSelectionHelper.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelection.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelectionBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/NodesManagingUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeCompositionTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDecorateTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputScriptTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeProxyUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlImportTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamDecorateTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3650Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/OpenOnJsf20Test_JBIDE5382.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreferencesInitializer.java
trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF
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/VpeSourceDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction2.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/SelectThisTagAction.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/preferences/VpePreferencesPage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/KeyEventManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeBreackerHelper.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCustomTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeIncludeTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/IAddNodeHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
Log:
https://jira.jboss.org/browse/JBIDE-7059
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeCompositionTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeCompositionTemplate.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeCompositionTemplate.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -16,12 +16,12 @@
import org.jboss.tools.jsf.vpe.facelets.template.messages.Messages;
import org.jboss.tools.jsf.vpe.facelets.template.util.Facelets;
import org.jboss.tools.jsf.vpe.facelets.util.FaceletsUtil;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.template.VpeDefineContainerTemplate;
import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDecorateTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDecorateTemplate.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDecorateTemplate.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -13,9 +13,9 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.jboss.tools.jsf.vpe.facelets.template.util.Facelets;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputScriptTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputScriptTemplate.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputScriptTemplate.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -13,10 +13,10 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Node;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -13,12 +13,12 @@
import java.util.ArrayList;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
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.util.HTML;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeProxyUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeProxyUtil.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/NodeProxyUtil.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -19,9 +19,9 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.jboss.tools.jsf.vpe.jsf.template.util.model.VpeElementProxyData;
import org.jboss.tools.jsf.vpe.jsf.template.util.proxy.JsfTemplateInvocationHandler;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.w3c.dom.Attr;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlImportTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlImportTemplate.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jstl/src/org/jboss/tools/jsf/vpe/jstl/template/JstlImportTemplate.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -13,10 +13,10 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.jboss.tools.jsf.vpe.jstl.template.util.Jstl;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.template.VpeDefineContainerTemplate;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamDecorateTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamDecorateTemplate.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/SeamDecorateTemplate.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -14,11 +14,11 @@
import org.eclipse.jface.text.Region;
import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
import org.jboss.tools.jsf.vpe.seam.template.util.SeamUtil;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.template.VpeDefineContainerTemplate;
import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3650Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3650Test.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3650Test.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -16,8 +16,8 @@
import org.eclipse.wst.xml.core.internal.document.NodeImpl;
import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.util.TextUtil;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/OpenOnJsf20Test_JBIDE5382.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/OpenOnJsf20Test_JBIDE5382.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/OpenOnJsf20Test_JBIDE5382.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -14,8 +14,8 @@
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.jboss.tools.vpe.ui.test.OpenOnUtil;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2010-09-17 07:36:37 UTC
(rev 24975)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2010-09-17 11:16:09 UTC
(rev 24976)
@@ -27,7 +27,8 @@
org.jboss.tools.jst.jsp.support.kb,
org.jboss.tools.jst.jsp.text,
org.jboss.tools.jst.jsp.ui.action,
- org.jboss.tools.jst.jsp.util
+ org.jboss.tools.jst.jsp.util,
+ org.jboss.tools.jst.jsp.selection
Require-Bundle: org.jboss.tools.common.el.core,
org.jboss.tools.common.model.ui,
org.jboss.tools.jst.web,
@@ -51,6 +52,8 @@
org.jboss.tools.jst.web.kb,
org.eclipse.core.databinding.property;bundle-version="1.2.0",
org.eclipse.emf.ecore;bundle-version="2.5.0",
- org.eclipse.wst.dtd.core
+ org.eclipse.compare,
+ org.eclipse.wst.dtd.core,
+ org.eclipse.ui
Bundle-Version: 3.2.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/icons/selbar.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/icons/selbar.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties 2010-09-17 07:36:37 UTC
(rev 24975)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties 2010-09-17 11:16:09 UTC
(rev 24976)
@@ -15,4 +15,5 @@
javaStringELHoverDescription= Shows the Javadoc of the selected EL-operand.
proposalCategory.xmlEL= JBoss JSF/SEAM EL Proposals
-proposalCategory.xmlTag= JBoss JSF/SEAM Tag Proposals
\ No newline at end of file
+proposalCategory.xmlTag= JBoss JSF/SEAM Tag Proposals
+Show.Selection.Bar=Show Selection Bar
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-09-17 07:36:37 UTC (rev
24975)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-09-17 11:16:09 UTC (rev
24976)
@@ -307,6 +307,24 @@
</visibleWhen>
</command>
</menuContribution>
+ <menuContribution
+ locationURI="menu:navigate?endof=show.ext">
+ <command label="%Show.Selection.Bar"
+
commandId="org.jboss.tools.jst.jsp.commands.showSelectionBar"
+ id="org.jboss.tools.jst.jsp.menus.sampleCommand"
+ mnemonic="S">
+ </command>
+ </menuContribution>
+ <menuContribution
+
locationURI="toolbar:org.eclipse.ui.workbench.navigate?after=forwardHistory">
+ <command
+
+
commandId="org.jboss.tools.jst.jsp.commands.showSelectionBar"
+ icon="icons/selbar.gif"
+ id="org.jboss.tools.jst.jsp.toolbars.sampleCommand"
+ tooltip="%Show.Selection.Bar">
+ </command>
+ </menuContribution>
</extension>
<extension
@@ -401,6 +419,16 @@
<reference
definitionId="org.jboss.tools.ui.structuredEditor"/>
</enabledWhen>
</handler>
+ <handler
+
class="org.jboss.tools.jst.jsp.selection.bar.handlers.SelectionBarHandler"
+ commandId="org.jboss.tools.jst.jsp.commands.showSelectionBar">
+ <activeWhen>
+ <reference
definitionId="org.jboss.tools.ui.structuredEditor"/>
+ </activeWhen>
+ <enabledWhen>
+ <reference
definitionId="org.jboss.tools.ui.structuredEditor"/>
+ </enabledWhen>
+ </handler>
</extension>
<extension point="org.eclipse.core.expressions.definitions">
@@ -654,6 +682,15 @@
id="org.jboss.tools.jst.jsp.commands.openCSSDialog"
name="Open CSS Dialog">
</command>
+ <category
+ id="org.jboss.tools.jst.jsp.commands.category"
+ name="Sample Category">
+ </category>
+ <command
+ categoryId="org.jboss.tools.jst.jsp.commands.category"
+ id="org.jboss.tools.jst.jsp.commands.showSelectionBar"
+ name="Sample Command">
+ </command>
</extension>
<extension
point="org.eclipse.ui.bindings">
@@ -663,6 +700,12 @@
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="Ctrl+Shift+C">
</key>
+ <key
+ commandId="org.jboss.tools.jst.jsp.commands.showSelectionBar"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+6">
+ </key>
</extension>
<extension
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -446,7 +446,7 @@
}
try {
if (visualEditor != null) {
- visualSourceIndex = addPage(visualEditor, getEditorInput());
+ visualSourceIndex = addPage(visualEditor, getEditorInput(),sourceEditor);
setPageText(
visualSourceIndex,
JSPEditorMessages.JSPMultiPageEditor_TabLabel_VisualSource);
@@ -466,11 +466,11 @@
try {
String sourceTabLabel = JSPEditorMessages.JSPMultiPageEditor_TabLabel_Source;
if (visualEditor != null) {
- sourceIndex = addPage(visualEditor, getEditorInput());
+ sourceIndex = addPage(visualEditor, getEditorInput(),sourceEditor);
setPageText(sourceIndex, sourceTabLabel);
setPartName(visualEditor.getTitle());
} else {
- sourceIndex = addPage(sourceEditor, getEditorInput());
+ sourceIndex = addPage(sourceEditor, getEditorInput(),sourceEditor);
setPageText(sourceIndex, sourceTabLabel);
setPartName(sourceEditor.getTitle());
}
@@ -481,7 +481,7 @@
// Add tab contain default web-browser
try {
if (visualEditor != null) {
- setPreviewIndex(addPage(visualEditor, getEditorInput()));
+ setPreviewIndex(addPage(visualEditor, getEditorInput(),sourceEditor));
setPageText(getPreviewIndex(),
JSPEditorMessages.JSPMultiPageEditor_TabLabel_Preview);
setPartName(visualEditor.getTitle());
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -25,6 +25,9 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Item;
@@ -41,7 +44,9 @@
import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
import org.eclipse.ui.part.MultiPageEditorSite;
import org.eclipse.ui.part.MultiPageSelectionProvider;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.jboss.tools.common.core.resources.XModelObjectEditorInput;
+import org.jboss.tools.jst.jsp.selection.bar.SelectionBar;
/**
*
@@ -66,8 +71,15 @@
*/
Composite ppp = null;
+ /**
+ *
+ * @param editor
+ * @param input
+ * @return
+ * @throws PartInitException
+ */
- public int addPage(IEditorPart editor, IEditorInput input)
+ public int addPage(IEditorPart editor, IEditorInput input, StructuredTextEditor
sourcePart)
throws PartInitException {
Composite parent2;
if (ppp == null) {
@@ -75,8 +87,15 @@
editor.init(site, input);
parent2 = new Composite(getContainer(), SWT.NONE);
ppp = parent2;
- parent2.setLayout(new FillLayout());
editor.createPartControl(parent2);
+ parent2.setLayout(new GridLayout(2, false));
+
+ SelectionBar selBar = new SelectionBar(sourcePart);
+ selBar.createToolBarComposite(parent2, true);
+// GridData gridData = new GridData();
+// gridData.horizontalAlignment = GridData.FILL;
+// gridData.horizontalSpan = 2;
+// but.setLayoutData(gridData);
editor.addPropertyListener(new IPropertyListener() {
public void propertyChanged(Object source, int propertyId) {
JSPMultiPageEditorPart.this
@@ -106,6 +125,7 @@
pageChange(newPageIndex);
}
});
+
return newContainer;
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -1072,13 +1072,15 @@
storedSelection = p;
if (selection instanceof ITextSelection) {
ITextSelection ts = (ITextSelection) selection;
+// getSelectionProvider().setSelection(ts);
if (ts.getLength() == 0) {
- if (vpeController != null) {
- vpeController
- .selectionChanged(new SelectionChangedEvent(
- getSelectionProvider(),
- getSelectionProvider().getSelection()));
- }
+ getSelectionProvider().setSelection(ts);
+// if (vpeController != null) {
+// vpeController
+// .selectionChanged(new SelectionChangedEvent(
+// getSelectionProvider(),
+// getSelectionProvider().getSelection()));
+// }
}
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -123,4 +123,11 @@
public static String INFORM_WHEN_PROJECT_MIGHT_NOT_BE_CONFIGURED_PROPERLY_FOR_VPE;
public static String DOCS_INFO_LINK;
public static String DOCS_INFO_LINK_TEXT;
+ 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;
+ public static String ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR;
+ public static String SelectionBar_MoreNodes;
+ public static String HIDE_SELECTION_BAR;
+
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties 2010-09-17
11:16:09 UTC (rev 24976)
@@ -100,4 +100,10 @@
INFORM_WHEN_PROJECT_MIGHT_NOT_BE_CONFIGURED_PROPERLY_FOR_VPE=Inform when a project might
not be configured properly for Visual Page Editor
DOCS_INFO_LINK=http://www.jboss.org/community/docs/DOC-10862
-DOCS_INFO_LINK_TEXT=See JBoss Tools Visual Editor FAQ
\ No newline at end of file
+DOCS_INFO_LINK_TEXT=See JBoss Tools Visual Editor FAQ
+
+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
+SelectionBar_MoreNodes=More Nodes...
+HIDE_SELECTION_BAR=Hide selection bar
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -14,7 +14,6 @@
static final String SHOW_BORDER_FOR_UNKNOWN_TAGS = "Show Border for Unknown
Tags"; //$NON-NLS-1$
static final String SHOW_NON_VISUAL_TAGS = "Show non-visual tags";
//$NON-NLS-1$
- static final String SHOW_SELECTION_TAG_BAR = "Show Selection Tag Bar";
//$NON-NLS-1$
static final String SHOW_TEXT_FORMATTING = "Show Text Formatting bar";
//$NON-NLS-1$
static final String SHOW_RESOURCE_BUNDLES_USAGE_AS_EL = "Show Resource Bundles
Usage as EL Expressions"; //$NON-NLS-1$
static final String ASK_TAG_ATTRIBUTES_ON_TAG_INSERT = "Ask for tag attributes
during tag insert"; //$NON-NLS-1$
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreferencesInitializer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreferencesInitializer.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreferencesInitializer.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -24,7 +24,6 @@
defaultPreferences.putBoolean(IVpePreferencesPage.SHOW_BORDER_FOR_UNKNOWN_TAGS, true);
defaultPreferences.putBoolean(IVpePreferencesPage.SHOW_NON_VISUAL_TAGS, false);
- defaultPreferences.putBoolean(IVpePreferencesPage.SHOW_SELECTION_TAG_BAR, true);
defaultPreferences.putBoolean(IVpePreferencesPage.SHOW_TEXT_FORMATTING, true);
defaultPreferences.putBoolean(IVpePreferencesPage.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL,
false);
defaultPreferences.putBoolean(IVpePreferencesPage.ASK_TAG_ATTRIBUTES_ON_TAG_INSERT,
true);
Copied:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SelectedNodeInfo.java
(from rev 24935,
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSelectedNodeInfo.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SelectedNodeInfo.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SelectedNodeInfo.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.selection;
+
+import org.w3c.dom.Node;
+
+public class SelectedNodeInfo {
+ private Node node;
+ private int startOffset;
+ private int endOffset;
+
+ public SelectedNodeInfo(Node node) {
+ this.node = node;
+ }
+ public SelectedNodeInfo(Node node, int startOffset, int endOffset) {
+ this(node);
+ this.startOffset = startOffset;
+ this.endOffset = endOffset;
+ }
+
+ public Node getNode() {
+ return node;
+ }
+
+ public int getStartOffset() {
+ return startOffset;
+ }
+
+ public int getEndOffset() {
+ return endOffset;
+ }
+
+ public String toString() {
+ if (node != null) {
+ return node.toString();
+ }
+ return super.toString();
+ }
+
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SelectionHelper.java
(from rev 24935,
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSelectionHelper.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SelectionHelper.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SelectionHelper.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.selection;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
+import org.w3c.dom.Node;
+
+public class SelectionHelper {
+
+ public static StyledText getSourceTextWidget(StructuredTextEditor sourceEditor) {
+ if (sourceEditor != null && sourceEditor.getTextViewer() != null &&
sourceEditor.getTextViewer().getTextWidget() != null &&
!sourceEditor.getTextViewer().getTextWidget().isDisposed()) {
+ return (StyledText)sourceEditor.getTextViewer().getTextWidget();
+ }
+ return null;
+ }
+
+ public static int getCaretOffset(StructuredTextEditor sourceEditor) {
+ StyledText t = getSourceTextWidget(sourceEditor);
+ return t == null ? 0 : t.getCaretOffset();
+ }
+
+ public static List getTextWidgetSelectedNodes(IStructuredModel model, ISelectionProvider
provider) {
+ ISelection s = provider.getSelection();
+ if(s == null || s.isEmpty() || !(s instanceof ITextSelection)) return new ArrayList();
+ ITextSelection ts = (ITextSelection)s;
+ int offset = ts.getOffset();
+ if (model == null) return new ArrayList(0);
+ IndexedRegion firstSelectedNode = model.getIndexedRegion(offset);
+
+ // Never send a "null" in the selection
+ List selectedNodes = null;
+ if (firstSelectedNode != null) {
+ selectedNodes = new ArrayList(1);
+ selectedNodes.add(firstSelectedNode);
+ }
+ else {
+ selectedNodes = new ArrayList(0);
+ }
+ return selectedNodes;
+ }
+ /**
+ * select node completely
+ *
+ * @param pageContext
+ * @param node
+ */
+ public static void setSourceSelection(StructuredTextEditor structuredTextEditor, Node
node) {
+
+ int start = NodesManagingUtil.getStartOffsetNode(node);
+ int length = NodesManagingUtil.getNodeLength(node);
+
+ structuredTextEditor.getTextViewer()
+ .setSelectedRange(start, length);
+ structuredTextEditor.getTextViewer().revealRange(
+ start, length);
+ }
+
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelection.java
(from rev 24935,
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelection.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelection.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelection.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.selection;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
+
+import org.eclipse.swt.graphics.Point;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Node;
+
+public class SourceSelection {
+ private Node startNode;
+ private int startOffset;
+ private Node endNode;
+ private int endOffset;
+ private List selectedNodes;
+ private Attr focusAttribute;
+ private Point focusAttributeRange;
+
+ public SourceSelection(Node startNode, int startOffset, Node endNode, int endOffset) {
+ this.startNode = startNode;
+ this.startOffset = startOffset;
+ this.endNode = endNode;
+ this.endOffset = endOffset;
+ this.selectedNodes = getSelNodes();
+ }
+
+ public List getSelectedNodes() {
+ return selectedNodes;
+ }
+
+ private List getSelNodes() {
+ List nodes = Collections.EMPTY_LIST;
+ VpeNodeIterator nodeIterator = new VpeNodeIterator(startNode, endNode);
+ Node nextNode = nodeIterator.nextNode();
+ if (nextNode != null) nodes = new ArrayList();
+// Node commonAncestor = getCommonAncestor();
+ while (nextNode != null) {
+ SelectedNodeInfo nextNodeInfo = null;
+ int type = nextNode.getNodeType();
+ if (type == Node.TEXT_NODE || type == Node.COMMENT_NODE) {
+ if (nextNode == startNode && nextNode == endNode) {
+ nextNodeInfo = new SelectedNodeInfo(nextNode, startOffset, endOffset);
+ } else if (nextNode == startNode) {
+ nextNodeInfo = new SelectedNodeInfo(nextNode, startOffset,
nextNode.getNodeValue().length());
+ } else if (nextNode == endNode) {
+ nextNodeInfo = new SelectedNodeInfo(nextNode, 0, endOffset);
+ } else {
+ nextNodeInfo = new SelectedNodeInfo(nextNode, 0, nextNode.getNodeValue().length());
+ }
+ } else if (nextNode.getNodeType() == Node.ELEMENT_NODE) {
+ if (!inParents(nextNode, endNode)) {
+ nextNodeInfo = new SelectedNodeInfo(nextNode);
+ }
+ }
+ if (nextNodeInfo != null) nodes.add(nextNodeInfo);
+ nextNode = nodeIterator.nextNode();
+ }
+ return nodes;
+ }
+
+ private boolean inParents(Node node1, Node node2) {
+ if (node2 != null) {
+ Node p = node2.getParentNode();
+ while (p != null) {
+ if (p == node1)
+ return true;
+ p = p.getParentNode();
+ }
+ }
+ return false;
+
+ }
+
+ public Node getCommonAncestor() {
+ if (endNode == null)
+ return null;
+
+ for (Node na = endNode; na != null; na = na.getParentNode()) {
+ for (Node ta = startNode; ta != null; ta = ta.getParentNode()) {
+ if (ta == na)
+ return ta;
+ }
+ }
+
+ return null; // not found
+ }
+
+ public boolean isOneNodeSelected() {
+ return startNode == endNode;
+ }
+
+ public static class VpeNodeIterator {
+ private Node nextNode;
+ private Node endNode;
+
+ public VpeNodeIterator(Node startNode, Node endNode) {
+ this.nextNode = startNode;
+ this.endNode = endNode;
+ }
+
+ public Node nextNode() {
+ for (Node node = getNextNode(); node != null; node = getNextNode()) {
+ return node;
+ }
+ return null;
+ }
+
+ private final Node getNextNode() {
+ if (this.nextNode == null)
+ return null;
+ Node oldNext = this.nextNode;
+ Node child = this.nextNode.getFirstChild();
+ if (child != null) {
+ this.nextNode = child;
+ return oldNext;
+ }
+ for (Node node = this.nextNode; node != null && !node.equals(endNode); node =
node.getParentNode()) {
+ Node next = node.getNextSibling();
+ if (next != null) {
+ this.nextNode = next;
+ return oldNext;
+ }
+ }
+ this.nextNode = null;
+ return oldNext;
+ }
+ }
+
+ public Node getEndNode() {
+ return endNode;
+ }
+
+ public Node getStartNode() {
+ return startNode;
+ }
+
+ public int getEndOffset() {
+ return endOffset;
+ }
+
+ public int getStartOffset() {
+ return startOffset;
+ }
+
+ public boolean isCollapsed() {
+ return isOneNodeSelected() && startOffset == endOffset;
+ }
+
+ public Node getFocusNode() {
+// return focusNode;
+ return endNode;
+ }
+
+ public int getFocusOffset() {
+ return endOffset;
+ }
+
+ public void setEndOffset(int endOffset) {
+ this.endOffset = endOffset;
+ }
+
+ public void setStartOffset(int startOffset) {
+ this.startOffset = startOffset;
+ }
+
+ public Attr getFocusAttribute() {
+ return focusAttribute;
+ }
+
+ public void setFocusAttribute(Attr focusAttribute) {
+ this.focusAttribute = focusAttribute;
+ }
+
+ public Point getFocusAttributeRange() {
+ return focusAttributeRange;
+ }
+
+ public void setFocusAttributeRange(Point focusAttributeRange) {
+ this.focusAttributeRange = focusAttributeRange;
+ }
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelectionBuilder.java
(from rev 24935,
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelectionBuilder.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelectionBuilder.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/SourceSelectionBuilder.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.selection;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.xml.core.internal.document.AttrImpl;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.w3c.dom.Attr;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+public class SourceSelectionBuilder {
+ StructuredTextEditor sourceEditor;
+
+ public SourceSelectionBuilder(StructuredTextEditor sourceEditor) {
+ this.sourceEditor = sourceEditor;
+ }
+
+ public SourceSelection getSelection() {
+ Point range = sourceEditor.getTextViewer().getSelectedRange();
+ int anchorPosition = range.x;
+ int focusPosition = range.x + range.y;
+ boolean extendFlag = range.y != 0;
+ boolean reversionFlag = extendFlag && anchorPosition ==
SelectionHelper.getCaretOffset(sourceEditor);
+ if (reversionFlag) {
+ anchorPosition = focusPosition;
+ focusPosition = range.x;
+ }
+ Node focusNode = getSourceNodeAt(this.sourceEditor,focusPosition);
+ if (focusNode == null) {
+ return null;
+ }
+
+ int focusOffset = getSourceNodeOffset(focusNode, focusPosition, !reversionFlag);
+ Node anchorNode = null;
+ int anchorOffset = 0;
+ if (extendFlag) {
+ anchorNode = getSourceNodeAt(this.sourceEditor,anchorPosition);
+ anchorOffset = getSourceNodeOffset(anchorNode, anchorPosition, reversionFlag);
+ } else {
+ anchorNode = focusNode;
+ anchorOffset = focusOffset;
+ }
+
+ SourceSelection selection = null;
+ if (reversionFlag) {
+ selection = new SourceSelection(focusNode, focusOffset, anchorNode, anchorOffset);
+ } else {
+ selection = new SourceSelection(anchorNode, anchorOffset, focusNode, focusOffset);
+ }
+ List selectedNodes = null;
+ if (focusNode instanceof IDOMElement) {
+ IDOMElement element = (IDOMElement)focusNode;
+ if (focusPosition < element.getEndStartOffset()) {
+ NamedNodeMap attrs = focusNode.getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ AttrImpl attr = (AttrImpl)attrs.item(i);
+ ITextRegion region = attr.getValueRegion();
+ if(region==null) {
+ break;
+ }
+ int attrStart = region.getStart();
+ int attrEnd = attrStart + attr.getValue().length();
+ if (range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1 >=
attrStart && range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1
<= attrEnd) {
+ selectedNodes = new ArrayList();
+ selectedNodes.add(attr);
+ break;
+ }
+ }
+ }
+ }
+
+ if (selectedNodes == null) {
+ selectedNodes = SelectionHelper.getTextWidgetSelectedNodes(sourceEditor.getModel(),
sourceEditor.getSelectionProvider());
+ }
+ if (selectedNodes != null && selectedNodes.size() == 1) {
+ Object node = selectedNodes.get(0);
+ if (node instanceof AttrImpl) {
+ AttrImpl attr = (AttrImpl)node;
+ int attrStart = attr.getValueRegion().getStart();
+ int attrEnd = attrStart + attr.getValue().length();
+ if (range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1 >=
attrStart && range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1
<= attrEnd) {
+ selection.setFocusAttribute((Attr)node);
+ Point attrRange = new Point(range.x -
(((ElementImpl)attr.getOwnerElement()).getStartOffset() +
attr.getValueRegion().getStart()) - 1, range.y);
+ selection.setFocusAttributeRange(attrRange);
+ }
+ }
+ }
+ return selection;
+ }
+
+ public static Node getSourceNodeAt(StructuredTextEditor srcEditor,int offset) {
+ if (srcEditor != null && srcEditor.getModel() != null) {
+ IndexedRegion node = srcEditor.getModel().getIndexedRegion(offset);
+ if (node == null) {
+ node = srcEditor.getModel().getIndexedRegion(offset - 1);
+ }
+ if (node instanceof Node) {
+ return (Node) node;
+ }
+ }
+ return null;
+ }
+
+ private int getSourceNodeOffset(Node node, int pos, boolean endFlag) {
+ if (node == null) return 0;
+ int start = ((IndexedRegion)node).getStartOffset();
+ int end = ((IndexedRegion)node).getEndOffset();
+
+ if (node.getNodeType() == Node.TEXT_NODE) {
+ if (pos < start) {
+ return 0;
+ } else if (pos > end) {
+ return end - start;
+ } else {
+ return pos - start;
+ }
+ } else if (node.getNodeType() == Node.ELEMENT_NODE) {
+ ElementImpl element = (ElementImpl)node;
+ if (element.isContainer()) {
+ if (pos < element.getStartEndOffset()) {
+ return 0;
+ } else {
+ if (element.hasEndTag() && pos <= element.getEndStartOffset()) {
+ return 2;
+ } else {
+ return 1;
+ }
+ }
+ } else {
+ return endFlag ? 1 : 0;
+ }
+ } else if (node.getNodeType() == Node.COMMENT_NODE) {
+ if (pos > end) {
+ pos = end;
+ }
+ int offset = pos - start - 4;
+ return offset < 0 ? 0 : offset;
+ } else {
+ return endFlag ? 1 : 0;
+ }
+ }
+}
\ No newline at end of file
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/SelectionBar.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -0,0 +1,806 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.selection.bar;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.compare.Splitter;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
+import org.eclipse.ui.internal.WorkbenchImages;
+import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
+import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
+import org.jboss.tools.jst.jsp.selection.SelectionHelper;
+import org.jboss.tools.jst.jsp.selection.SourceSelection;
+import org.jboss.tools.jst.jsp.selection.SourceSelectionBuilder;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * 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
+ * @author yradtsevich
+ * @author mareshkau
+ */
+public class SelectionBar implements ISelectionChangedListener{
+ /**
+ *
+ */
+ private static final int SEL_ITEM_RIGHT_MARGIN = 5;
+
+ private Splitter splitter;
+
+ private boolean resizeListenerAdded = false;
+ private ToolBar selBar = null;
+ private FormData selBarData;
+// private Composite closeBar = null;
+ private Menu dropDownMenu = null;
+ private int itemCount = 0;
+// private Composite arrowBar;
+ private Composite cmpToolBar = null;
+ private Composite cmpTlEmpty = null;
+ private StructuredTextEditor textEditor;
+
+ public SelectionBar(StructuredTextEditor textEditor) {
+ super();
+ this.textEditor = textEditor;
+ this.textEditor.getTextViewer().addSelectionChangedListener(this);
+ }
+
+ /**
+ * Visibility state of the {@code SelectionBar}.
+ */
+ private static boolean visible;
+
+ private ImageButton arrowButton;
+ private Node currentSelectedNode = null;
+ private Node currentLastNode = null;
+
+ public Composite createToolBarComposite(Composite parent, boolean visible) {
+ splitter = new Splitter(parent, SWT.NONE);
+ splitter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ /*
+ * The empty composite
+ */
+ cmpTlEmpty = new Composite(splitter, SWT.NONE) {
+ @Override
+ 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));
+
+ // Main composite of the visible splitter
+ cmpToolBar = new Composite(splitter, SWT.NONE);
+ cmpToolBar.setLayout(new FormLayout());
+
+ final Image closeImage = PlatformUI.getWorkbench().getSharedImages()
+ .getImage(ISharedImages.IMG_TOOL_DELETE);
+
+ final Listener closeListener = new Listener() {
+ public void handleEvent(Event event) {
+ if (askConfirmationOnClosingSelectionBar()) {
+ MessageDialogWithToggle dialog = MessageDialogWithToggle
+ .openOkCancelConfirm(
+ PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow()
+ .getShell(),
+ JstUIMessages.CONFIRM_SELECTION_BAR_DIALOG_TITLE,
+ JstUIMessages.CONFIRM_SELECTION_BAR_DIALOG_MESSAGE,
+ JstUIMessages.ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR,
+ askConfirmationOnClosingSelectionBar(), null, null);
+ if (dialog.getReturnCode() != IDialogConstants.OK_ID) {
+ return;
+ }
+ setAskConfirmationOnClosingSelectionBar(dialog.getToggleState());
+ }
+ /*
+ * Hide the selection bar
+ */
+ setVisible(false);
+ }
+ };
+
+ ImageButton closeButton = new ImageButton(cmpToolBar, closeImage,
+ JstUIMessages.HIDE_SELECTION_BAR);
+ closeButton.addSelectionListener(closeListener);
+ FormData closeBarData = new FormData();
+ closeBarData.right = new FormAttachment(100);
+ closeBarData.top = new FormAttachment(0);
+ Composite closeItemComposite = closeButton.getComposite();
+ closeItemComposite.setLayoutData(closeBarData);
+
+ // Create selection bar
+ selBar = new ToolBar(cmpToolBar, SWT.HORIZONTAL | SWT.FLAT | SWT.NO_BACKGROUND);
+ selBarData = new FormData();
+ selBarData.left = new FormAttachment(0);
+ selBarData.right = new FormAttachment(closeItemComposite, 0, SWT.LEFT);
+ selBarData.top = new FormAttachment(0);
+ selBar.setLayoutData(selBarData);
+ createArrowButton();
+ cmpToolBar.layout();
+ setVisible(visible);
+ return splitter;
+ }
+
+ public void setAskConfirmationOnClosingSelectionBar(boolean askConfirmation) {
+ JspEditorPlugin.getDefault().getPreferenceStore().setValue(
+ IVpePreferencesPage.ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR,
+ askConfirmation);
+ }
+
+ public boolean askConfirmationOnClosingSelectionBar() {
+ return JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR);
+ }
+
+ /**
+ * Sets {@code visible} state to this {@code SelectionBar} and fires
+ * all registered {@code VisibilityListener}s.
+ */
+ public void setVisible(boolean visible) {
+ if (visible) {
+ splitter.setVisible(cmpToolBar, true);
+ splitter.setVisible(cmpTlEmpty, false);
+ } else {
+ splitter.setVisible(cmpToolBar, false);
+ splitter.setVisible(cmpTlEmpty, true);
+ }
+ splitter.getParent().layout(true, true);
+
+ this.visible = visible;
+// /*
+// *
https://jira.jboss.org/jira/browse/JBIDE-4968
+// * Updating VPE toolbar icon on selection bar changes.
+// */
+// if (vpeController != null) {
+// vpeController.updateVpeToolbar();
+// }
+// fireVisibilityListeners();
+ }
+
+ /**
+ * Returns {@code visible} state of this {@code SelectionBar}.
+ */
+ public boolean isVisible() {
+ return visible;
+ }
+
+// /**
+// * Adds the listener to the collection of listeners who will
+// * be notified when the {@code #visible} state is changed.
+// *
+// * @param listener the listener which should be notified
+// *
+// * @see VisibilityListener
+// * @see VisibilityEvent
+// */
+// public void addVisibilityListener(VisibilityListener listener) {
+// visibilityListeners.add(listener);
+// }
+//
+// /**
+// * Removes the listener from the collection of listeners who will
+// * be notified when the {@link #visible} state is changed.
+// *
+// * @param listener the listener which should be removed
+// *
+// * @see VisibilityListener
+// */
+// public void removeVisibilityListener(VisibilityListener listener) {
+// visibilityListeners.remove(listener);
+// }
+//
+// /**
+// * Fires all registered instances of {@code VisibilityListener} by
+// * sending them {@link VisibilityEvent}.
+// *
+// * @see #addVisibilityListener(VisibilityListener)
+// * @see #removeVisibilityListener(VisibilityListener)
+// */
+// private void fireVisibilityListeners() {
+// VisibilityEvent event = new VisibilityEvent(this);
+// for (VisibilityListener listener : visibilityListeners) {
+// listener.visibilityChanged(event);
+// }
+// }
+//
+// public void setVpeController(VpeController vpeController) {
+// this.vpeController = vpeController;
+// }
+
+ /**
+ * Updates buttons in the selection bar and the drop-down menu
+ * according to the source selection.
+ */
+ public void updateNodes(boolean forceUpdate) {
+ SourceSelectionBuilder sourceSelectionBuilder = new SourceSelectionBuilder(
+ textEditor);
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
+ if (selection == null) {
+ return;
+ }
+
+ // Node node = selection.getFocusNode();
+ Node node = selection.getStartNode();
+ if (node != null && node.getNodeType() == Node.TEXT_NODE) {
+ node = node.getParentNode();
+ }
+
+ if (currentSelectedNode == node && !forceUpdate) {
+ return;
+ }
+
+ final boolean ancestorSelected = isAncestor(node, currentLastNode);
+ if (ancestorSelected) {
+ if (forceUpdate) {
+ // reinitialize selBar with currentLastNode
+ setSelBarItems(currentLastNode);
+ } else {
+ // deselect currentSelectedNode
+ setNodeSelected(currentSelectedNode, false);
+ }
+ } else {
+ setSelBarItems(node);
+ currentLastNode = node;
+ }
+
+ setNodeSelected(node, true);
+ currentSelectedNode = node;
+ }
+
+ /**
+ * Sets the selection state of the given node in the selection bar.
+ */
+ private void setNodeSelected(Node node, boolean selected) {
+ for (ToolItem item : selBar.getItems()) {
+ if (item.getData() == node) {
+ item.setSelection(selected);
+ return;
+ }
+ }
+
+ if (dropDownMenu == null) {
+ return;
+ }
+
+ for (MenuItem item : dropDownMenu.getItems()) {
+ if (item.getData() == node) {
+ item.setSelection(selected);
+ return;
+ }
+ }
+ }
+
+ /**
+ * Cleans {@link #selBar} and adds to it buttons which
+ * appropriate the {@code node} and all its ancestors.
+ */
+ private void setSelBarItems(Node node) {
+ // bug was fixed when toolbar are not shown for resizeble components
+ cmpToolBar.layout();
+ splitter.getParent().layout(true, true);
+
+ removeNodeListenerFromAllNodes();
+ cleanToolBar(selBar);
+
+ disposeDropDownMenu();
+ // for now dropDownMenu = null
+
+ int elementCounter = 0;
+ while ((node != null)
+ && ((node.getNodeType() == Node.ELEMENT_NODE)
+ || (node.getNodeType() == Node.COMMENT_NODE))) {
+ addNodeListenerTo(node);
+
+ /*
+ * If there is no DDM -- item will be added to line
+ */
+ if (dropDownMenu == null) {
+ ToolItem item;
+ NodeList children = node.getChildNodes();
+ List<Node> list = new ArrayList<Node>();
+ for (int i = 0; i < children.getLength(); i++) {
+ if (children.item(i).getNodeType() == Node.ELEMENT_NODE) {
+ list.add(children.item(i));
+ }
+ }
+ /*
+ * for the last tag -- show check button
+ */
+ if ((elementCounter == 0) && (list.size() == 0)){
+ item = new ToolItem(selBar, SWT.FLAT | SWT.CHECK, 1);
+ item.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ handleSelectionEvent(e);
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ handleSelectionEvent(e);
+ }
+ });
+ } else {
+ /*
+ * Create DropDownMenu button
+ */
+ item = new ToolItem(selBar, SWT.DROP_DOWN, 1);
+ final DropdownSelectionListener listenerOne = new DropdownSelectionListener(item);
+ for (Node node2 : list) {
+ listenerOne.add(node2);
+ }
+ item.addSelectionListener(listenerOne);
+ item.addDisposeListener(new DisposeListener(){
+ public void widgetDisposed(DisposeEvent e) {
+ listenerOne.disposeMenu();
+ }
+ });
+ }
+ item.setData(node);
+ item.setText(node.getNodeName());
+ /*
+ * When the item does not fit to the bar --
+ * put it to the DDM
+ */
+ if (!isItemShown(selBar.getItem(elementCounter + 1))) {
+ item.dispose();
+ dropDownMenu = new Menu(selBar);
+ }
+ }
+
+ /*
+ * After the DDM has been created
+ * all other items will be added to the DDM
+ * as they do not fit to the selection bar any more.
+ */
+ if (dropDownMenu != null) {
+ MenuItem menuItem = new MenuItem(dropDownMenu, SWT.CHECK, 0);
+ menuItem.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ handleSelectionEvent(e);
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ handleSelectionEvent(e);
+ }
+ });
+ menuItem.setText(node.getNodeName());
+ menuItem.setData(node);
+ }
+
+ /*
+ * Count the elements
+ */
+ elementCounter++;
+ /*
+ * Get the parent to put it to the bar
+ */
+ node = node.getParentNode();
+ }
+ itemCount = elementCounter;
+ arrowButton.setEnabled(dropDownMenu != null);
+
+ if (node != null && node.getNodeType() == Node.DOCUMENT_NODE) {
+ addNodeListenerTo(node);
+ }
+
+ if (!resizeListenerAdded ) {
+ cmpToolBar.addListener(SWT.Resize, new Listener() {
+ public void handleEvent(Event event) {
+ updateNodes(true);
+ }
+ });
+ resizeListenerAdded = true;
+ }
+ }
+
+ /**
+ * Checks if the {@code potentialAncestor} is an ancestor of
+ * {@code potentialAncestor node}.
+ */
+ private boolean isAncestor(Node potentialAncestor, Node node) {
+ if (potentialAncestor == null || node == null) {
+ return false;
+ }
+
+ Node curAncestor = node;
+ while ((curAncestor = curAncestor.getParentNode()) != null) {
+ if (potentialAncestor == curAncestor) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Deletes all items (except the first item-arrow button)
+ * from the given {@code #toolBar}.
+ */
+ private void cleanToolBar(ToolBar toolBar) {
+ ToolItem[] oldItems = toolBar.getItems();
+ for (int i = 1; i < oldItems.length; i++) {
+ oldItems[i].dispose();
+ }
+ }
+
+ /**
+ * Initializes {@link #arrowButton}.
+ */
+ private void createArrowButton() {
+ final Image hoverImage = WorkbenchImages.getImage(
+ IWorkbenchGraphicConstants.IMG_LCL_RENDERED_VIEW_MENU);
+
+ arrowButton = new ImageButton(selBar, hoverImage,
+ JstUIMessages.SelectionBar_MoreNodes);
+ arrowButton.setEnabled(false);
+ arrowButton.addSelectionListener(
+ new Listener() {
+ public void handleEvent(Event event) {
+ Rectangle bounds = arrowButton.getButtonBounds();
+ Point point = selBar.toDisplay(bounds.x, bounds.y
+ + bounds.height);
+ dropDownMenu.setLocation(point);
+ dropDownMenu.setVisible(true);
+ }
+ });
+
+ ToolItem arrowItem = new ToolItem(selBar, SWT.SEPARATOR, 0);
+ Composite arrowButtonComposite = arrowButton.getComposite();
+ arrowItem.setControl(arrowButtonComposite);
+ arrowButtonComposite.pack();
+ arrowItem.setWidth(arrowButtonComposite.getSize().x);
+
+ FormData arrowToolBarData = new FormData();
+ arrowToolBarData.left = new FormAttachment(0);
+ arrowToolBarData.top = new FormAttachment(0);
+ arrowButtonComposite.setLayoutData(arrowToolBarData);
+ }
+
+ /**
+ * Checks if the given {@code toolItem} is fully shown on the screen.
+ */
+ private boolean isItemShown(ToolItem toolItem) {
+ ToolBar toolBar = toolItem.getParent();
+ Rectangle toolItemBounds = toolItem.getBounds();
+
+ toolItemBounds.width += SEL_ITEM_RIGHT_MARGIN;
+ Rectangle intersection = toolBar.getBounds().intersection(
+ toolItemBounds);
+ return intersection.equals(toolItemBounds);
+ }
+
+ /**
+ * List of nodes that are notifying {@link #nodeListener} when they are
+ * changed.
+ */
+ private List<INodeNotifier> nodeNotifiers = new
ArrayList<INodeNotifier>();
+ /**
+ * Listener for all {@link #nodeNotifiers}
+ */
+ private NodeListener nodeListener = new NodeListener(this);
+
+ /**
+ * Adds {@link #nodeListener} to the given {@code node}.
+ *
+ * @param node the node to that the listener must be added.
+ */
+ private void addNodeListenerTo(Node node) {
+ if (node instanceof INodeNotifier) {
+ INodeNotifier notifier = (INodeNotifier) node;
+ if (notifier.getExistingAdapter(this) == null) {
+ notifier.addAdapter(nodeListener);
+ nodeNotifiers.add(notifier);
+ }
+ }
+ }
+ /**
+ * Removes {@link #nodeListener} from all nodes associated with this {@code
SelectionBar}.
+ */
+ private void removeNodeListenerFromAllNodes() {
+ for (INodeNotifier notifier : nodeNotifiers) {
+ notifier.removeAdapter(nodeListener);
+ }
+ nodeNotifiers.clear();
+ }
+
+ public void dispose() {
+ removeNodeListenerFromAllNodes();
+
+ if (splitter != null) {
+ splitter.dispose();
+ splitter = null;
+ }
+
+ disposeDropDownMenu();
+ }
+
+ /**
+ * Disposes {@link #dropDownMenu}.
+ */
+ private void disposeDropDownMenu() {
+ if (dropDownMenu != null) {
+ dropDownMenu.dispose();
+ dropDownMenu = null;
+ }
+ }
+
+ public void handleSelectionEvent(SelectionEvent e) {
+ Widget widget = e.widget;
+
+ /* ensure that the ToolItem or MenuItem is selected
+ * (for repeated clicks on the same widget)*/
+ if (widget instanceof ToolItem) {
+ ((ToolItem)widget).setSelection(true);
+ } else if (widget instanceof MenuItem) {
+ ((MenuItem)widget).setSelection(true);
+ }
+
+ SelectionHelper.setSourceSelection(textEditor,
+ (Node) widget.getData());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer st = new StringBuffer("CountItem: "); //$NON-NLS-1$
+ st.append(itemCount);
+ st.append(" Parent Composite: " + cmpToolBar.getBounds().width);
//$NON-NLS-1$
+ st.append(" Bar : " + selBar.getBounds().width); //$NON-NLS-1$
+ return st.toString();
+ }
+
+ /**
+
*********************************************************************************************
+ * This class provides the "drop down" functionality for the selection
bar.
+
*********************************************************************************************/
+ class DropdownSelectionListener extends SelectionAdapter {
+ private ToolItem dropdown;
+ private Menu menu;
+ private boolean shown = false;
+
+ public void disposeMenu() {
+ if (menu != null) {
+ menu.dispose();
+ menu = null;
+ }
+ }
+ /**
+ * Constructs a DropdownSelectionListener
+ *
+ * @param dropdown
+ * the dropdown this listener belongs to
+ */
+ public DropdownSelectionListener(ToolItem dropdown) {
+ this.dropdown = dropdown;
+ menu = new Menu(dropdown.getParent().getShell());
+ }
+
+ /**
+ * Adds an item to the dropdown list
+ *
+ * @param item
+ * the item to add
+ */
+ public void add(Node node) {
+ MenuItem menuItem = new MenuItem(menu, SWT.NONE);
+ menuItem.setText(node.getNodeName());
+ menuItem.setData(node);
+ menuItem.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ handleSelectionEvent(event);
+ }
+ });
+ }
+
+ /**
+ * Called when either the button itself or the dropdown arrow is clicked
+ *
+ * @param event
+ * the event that trigged this call
+ */
+ public void widgetSelected(SelectionEvent event) {
+ /*
+ * If they clicked the arrow, we show the list or close it
+ */
+ if (event.detail == SWT.ARROW) {
+ if (shown) {
+ menu.setVisible(false);
+ shown = false;
+ } else {
+ /*
+ * Determine where to put the dropdown list and show it
+ */
+ ToolItem item = (ToolItem) event.widget;
+ Rectangle rect = item.getBounds();
+ Point pt = item.getParent().toDisplay(
+ new Point(rect.x, rect.y));
+ menu.setLocation(pt.x, pt.y + rect.height);
+ menu.setVisible(true);
+ shown = true;
+ }
+ } else {
+ /*
+ * User pushed the button; take appropriate action
+ */
+ handleSelectionEvent(event);
+ }
+ }
+ }
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateNodes(true);
+ }
+}
+
+/**
+ * Instances of this class represent a flat button with image.
+ *
+ * @author yradtsevich
+ */
+class ImageButton {
+ private ToolItem item;
+ private Composite composite;
+ private Image emptyImage;
+ private Image image;
+
+ public ImageButton(Composite parent, Image image, String toolTip) {
+ composite = new Composite(parent, SWT.NONE);
+ composite.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ release();
+ }
+ });
+ GridLayout layoutTl = new GridLayout(1, false);
+ layoutTl.marginBottom = 0;
+ layoutTl.marginHeight = 0;
+ layoutTl.marginWidth = 0;
+ layoutTl.verticalSpacing = 0;
+ layoutTl.horizontalSpacing = 0;
+ composite.setLayout(layoutTl);
+
+ this.image = image;
+ ToolBar toolBar = new ToolBar(composite, SWT.HORIZONTAL | SWT.FLAT);
+ item = new ToolItem(toolBar, SWT.FLAT);
+ item.setImage(image);
+ emptyImage = new Image(Display.getCurrent(), 1, 1);
+ Color emptyImageColor = toolBar.getBackground();
+ emptyImage.setBackground(emptyImageColor);
+ GC gc = new GC(emptyImage);
+ gc.setForeground(emptyImageColor);
+ gc.drawPoint(0, 0);
+ gc.dispose();
+ item.setDisabledImage(emptyImage);
+ item.setToolTipText(toolTip);
+ }
+
+ public void addSelectionListener (Listener listener) {
+ item.addListener(SWT.Selection, listener);
+ }
+
+ /**
+ * Releases resources.
+ */
+ protected void release() {
+ if (emptyImage != null) {
+ emptyImage.dispose();
+ emptyImage = null;
+ }
+ }
+
+ public void dispose () {
+ if (composite != null) {
+ composite.dispose();
+ composite = null;
+ item = null;
+ image = null;
+ }
+ }
+ public void setEnabled (boolean enabled) {
+ item.setEnabled(enabled);
+
+ // fix for JBIDE-5588
+ if (enabled) {
+ item.setImage(image);
+ } else {
+ item.setImage(emptyImage);
+ }
+ }
+
+ public Rectangle getButtonBounds() {
+ return item.getBounds();
+ }
+
+
+ public Composite getComposite() {
+ return composite;
+ }
+}
+
+/**
+ * Listener for nodes that are implementing {@link INodeAdapter}.
+ * Calls {@link SelectionBar#updateNodes()} every time when these nodes are changed.
+ * <P>
+ * This class is a part of fix of JBIDE-3919:
+ * Incorrect interaction of block comments with selection bar.
+ * </P>
+ * @author yradtsevich
+ */
+class NodeListener implements INodeAdapter {
+ private SelectionBar selectionBar;
+
+ public NodeListener(SelectionBar selectionBar) {
+ this.selectionBar = selectionBar;
+ }
+
+ /* (non-javadoc)
+ * The infrastructure calls this method to determine if the adapter is
+ * appropriate for 'type'. Typically, adapters return true based on
+ * identity comparison to 'type', but this is not required, that is, the
+ * decision can be based on complex logic.
+ */
+ public boolean isAdapterForType(Object type) {
+ return selectionBar == type;
+ }
+
+ /* (non-javadoc)
+ * Sent to adapter when notifier changes. Each notifier is responsible for
+ * defining specific eventTypes, feature changed, etc.
+ *
+ * ISSUE: may be more evolvable if the argument was one big 'notifier
+ * event' instance.
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object
changedFeature, Object oldValue, Object newValue, int pos) {
+ selectionBar.updateNodes(false);
+ }
+ }
+
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/handlers/SelectionBarHandler.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/handlers/SelectionBarHandler.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/handlers/SelectionBarHandler.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -0,0 +1,34 @@
+package org.jboss.tools.jst.jsp.selection.bar.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class SelectionBarHandler extends AbstractHandler {
+ /**
+ * The constructor.
+ */
+ public SelectionBarHandler() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information
+ * from the application context.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+ MessageDialog.openInformation(
+ window.getShell(),
+ "Jsp Editor Plug-in",
+ "Hello, Selection Bar Handler");
+ return null;
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/handlers/SelectionBarHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/NodesManagingUtil.java
(from rev 24935,
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/NodesManagingUtil.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/NodesManagingUtil.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/NodesManagingUtil.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.jsp.util;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * @author S.Dzmitrovich
+ *
+ */
+public class NodesManagingUtil {
+
+ /**
+ *
+ * @param node
+ * @return
+ */
+ public static int getNodeLength(Node node) {
+
+ if ((node instanceof IDOMAttr)
+ && (((IDOMAttr) node).getValueSource() != null)) {
+ return ((IDOMAttr) node).getValueSource().length();
+ } else if (node instanceof IndexedRegion) {
+ return ((IndexedRegion) node).getEndOffset()
+ - ((IndexedRegion) node).getStartOffset();
+ }
+ return 0;
+ }
+
+ /**
+ * get start offset of node
+ *
+ * @param node
+ * @return
+ */
+ public static int getStartOffsetNode(Node node) {
+
+ if (node instanceof IDOMAttr) {
+ return ((IDOMAttr) node).getValueRegionStartOffset() + 1;
+ } else if (node instanceof IndexedRegion) {
+ return ((IndexedRegion) node).getStartOffset();
+ }
+ return 0;
+ }
+
+ /**
+ * get end offset of node
+ *
+ * @param node
+ * @return
+ */
+ public static int getEndOffsetNode(Node node) {
+
+ if (node instanceof IDOMAttr) {
+ return getStartOffsetNode(node) + getNodeLength(node);
+ } else if (node instanceof IndexedRegion) {
+ return ((IndexedRegion) node).getEndOffset();
+ }
+ return 0;
+ }
+
+ /**
+ *
+ * @param node
+ * @return
+ */
+ public static Point getNodeRange(Node node) {
+
+ return new Point(getStartOffsetNode(node), getNodeLength(node));
+
+ }
+
+ /**
+ * if position belong to node return true
+ *
+ * @param node
+ * @param position
+ * @return
+ */
+ public static boolean isNodeContainsPosition(Node node, int position) {
+ return NodesManagingUtil.getStartOffsetNode(node) <= position
+ && NodesManagingUtil.getEndOffsetNode(node) >= position;
+ }
+
+ /**
+ *
+ * @param pageContext
+ * @param startPosition
+ * @param endPosition
+ * @return
+ */
+ public static String getSourceText(Node node) {
+
+ return ((IDOMNode) node).getSource();
+ }
+
+}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF 2010-09-17 07:36:37 UTC
(rev 24975)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF 2010-09-17 11:16:09 UTC
(rev 24976)
@@ -36,8 +36,7 @@
org.jboss.tools.vpe.editor.util,
org.jboss.tools.vpe.editor.wizards,
org.jboss.tools.vpe.editor.xpl,
- org.jboss.tools.vpe.messages,
- org.jboss.tools.vpe.selbar
+ org.jboss.tools.vpe.messages
Require-Bundle: org.eclipse.jface.text,
org.jboss.tools.jst.jsp,
org.jboss.tools.jst.web,
Deleted:
trunk/vpe/plugins/org.jboss.tools.vpe/resources/org/jboss/tools/vpe/editor/mozilla/icons/selbar.gif
===================================================================
(Binary files differ)
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 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -84,6 +84,7 @@
import org.jboss.tools.jst.jsp.editor.IVisualController;
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.selection.SelectionHelper;
import org.jboss.tools.jst.web.model.helpers.WebAppHelper;
import org.jboss.tools.jst.web.project.WebProject;
import org.jboss.tools.jst.web.tld.URIConstants;
@@ -106,7 +107,6 @@
import org.jboss.tools.vpe.editor.mozilla.listener.MozillaSelectionListener;
import org.jboss.tools.vpe.editor.mozilla.listener.MozillaTooltipListener;
import org.jboss.tools.vpe.editor.selection.VpeSelectionController;
-import org.jboss.tools.vpe.editor.selection.VpeSelectionHelper;
import org.jboss.tools.vpe.editor.template.IKeyEventHandler;
import org.jboss.tools.vpe.editor.template.ISelectionManager;
import org.jboss.tools.vpe.editor.template.IZoomEventManager;
@@ -126,7 +126,6 @@
import org.jboss.tools.vpe.resref.core.CSSReferenceList;
import org.jboss.tools.vpe.resref.core.RelativeFolderReferenceList;
import org.jboss.tools.vpe.resref.core.TaglibReferenceList;
-import org.jboss.tools.vpe.selbar.SelectionBar;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -188,7 +187,6 @@
private RelativeFolderReferenceList relativeFolderReferenceListListener;
private VpeIncludeList includeList = new VpeIncludeList();
private FormatControllerManager toolbarFormatControllerManager = null;
- private SelectionBar selectionBar = null;
private XModelTreeListenerSWTSync optionsListener;
// Added by Max Areshkau Fix for JBIDE-1479
private UIJob job = null;
@@ -315,7 +313,7 @@
// sourceEditor.getViewerSelectionManager();
// selectionManager.addNodeSelectionListener(this);
// selectionManager.addTextSelectionListener(this);
- StyledText textWidget = VpeSelectionHelper
+ StyledText textWidget = SelectionHelper
.getSourceTextWidget(sourceEditor);
if (textWidget != null) {
textWidget.addSelectionListener(this);
@@ -404,7 +402,7 @@
// sourceEditor.getViewerSelectionManager();
// selectionManager.removeNodeSelectionListener(this);
// selectionManager.removeTextSelectionListener(this);
- StyledText textWidget = VpeSelectionHelper
+ StyledText textWidget = SelectionHelper
.getSourceTextWidget(sourceEditor);
if (textWidget != null) {
textWidget.removeSelectionListener(this);
@@ -2209,10 +2207,6 @@
toolbarFormatControllerManager = formatControllerManager;
}
- public void setSelectionBarController(SelectionBar selectionBar) {
- this.selectionBar = selectionBar;
- }
-
public IStructuredModel getModel() {
return sourceEditor.getModel();
}
@@ -2239,8 +2233,6 @@
* (!switcher.startActiveEditor)
*/
public void selectionChanged(SelectionChangedEvent event) {
- if (selectionBar != null)
- selectionBar.updateNodes(false);
// FIX for JBIDE-2114
if (!isVisualEditorVisible()) {
// selection event doesn't changes a content
@@ -2528,14 +2520,6 @@
return selectionManager;
}
- /*
- *
https://jira.jboss.org/jira/browse/JBIDE-4968
- * Updating VPE toolbar icon on selection bar changes.
- */
- public void updateVpeToolbar() {
- visualEditor.updateShowSelectionBarItem(selectionBar.isVisible());
- }
-
/**
* Update Externalize Strings toolbar icon state.
* <p>
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 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -41,7 +41,6 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.IReusableEditor;
@@ -80,10 +79,9 @@
import org.jboss.tools.vpe.editor.mozilla.MozillaPreview;
import org.jboss.tools.vpe.editor.mozilla.listener.EditorLoadWindowListener;
import org.jboss.tools.vpe.editor.xpl.CustomSashForm;
+import org.jboss.tools.vpe.editor.xpl.CustomSashForm.ICustomSashFormListener;
import org.jboss.tools.vpe.editor.xpl.EditorSettings;
import org.jboss.tools.vpe.editor.xpl.SashSetting;
-import org.jboss.tools.vpe.editor.xpl.CustomSashForm.ICustomSashFormListener;
-import org.jboss.tools.vpe.selbar.SelectionBar;
@SuppressWarnings("restriction")
public class VpeEditorPart extends EditorPart implements ITextEditor,
@@ -101,7 +99,7 @@
private ControlListener controlListener;
private XModelTreeListener listener;
private XModelObject optionsObject;
- private SelectionBar selectionBar = new SelectionBar();
+// private SelectionBar selectionBar = new SelectionBar();
private ActivationListener activationListener = new ActivationListener();
private int visualMode = 0;
private EditorPart multiPageEditor;
@@ -316,7 +314,7 @@
*
https://jira.jboss.org/browse/JBIDE-6832
* Restore the state after switching from Preview, for example.
*/
- selectionBar.setVisible(selectionBar.getAlwaysVisibleOption());
+// selectionBar.setVisible(selectionBar.getAlwaysVisibleOption());
setVerticalToolbarVisible(true);
/*
* Fixes
https://jira.jboss.org/jira/browse/JBIDE-3140
@@ -344,7 +342,7 @@
// break;
case SOURCE_MODE:
- selectionBar.setVisible(selectionBar.getAlwaysVisibleOption());
+// selectionBar.setVisible(selectionBar.getAlwaysVisibleOption());
setVerticalToolbarVisible(false);
if (sourceContent != null) {
sourceContent.setVisible(true);
@@ -374,9 +372,9 @@
break;
case PREVIEW_MODE:
- if (selectionBar != null) {
- selectionBar.setVisible(false);
- }
+// if (selectionBar != null) {
+// selectionBar.setVisible(false);
+// }
setVerticalToolbarVisible(false);
/*
* Fixes
https://jira.jboss.org/jira/browse/JBIDE-3140
@@ -504,7 +502,7 @@
/*
* Creating selection bar at the bottom of the editor
*/
- selectionBar.createToolBarComposite(cmpEdTl, true);
+// selectionBar.createToolBarComposite(cmpEdTl, true);
//container = new SashForm(cmpEd, SWT.VERTICAL);
/*
@@ -658,7 +656,7 @@
* do it for newly opened ones only.
*/
// fillContainer(false, null);
- selectionBar.setVisible(selectionBar.getAlwaysVisibleOption());
+// selectionBar.setVisible(selectionBar.getAlwaysVisibleOption());
}
public void structureChanged(XModelTreeEvent event) {
@@ -878,8 +876,8 @@
visualEditor.setEditorLoadWindowListener(null);
VpeController vpeController = new VpeController(
VpeEditorPart.this);
- selectionBar.setVpeController(vpeController);
- vpeController.setSelectionBarController(selectionBar);
+// selectionBar.setVpeController(vpeController);
+// vpeController.setSelectionBarController(selectionBar);
vpeController.init(sourceEditor, visualEditor);
}
});
@@ -971,10 +969,10 @@
previewContent = null;
}
- if (selectionBar != null) {
- selectionBar.dispose();
- selectionBar = null;
- }
+// if (selectionBar != null) {
+// selectionBar.dispose();
+// selectionBar = null;
+// }
activeEditor = null;
multiPageEditor = null;
super.dispose();
@@ -1174,13 +1172,10 @@
doVisualRefresh = true;
}
- boolean presfShowSelectionBar = JspEditorPlugin.getDefault()
- .getPreferenceStore().getBoolean(
- IVpePreferencesPage.SHOW_SELECTION_TAG_BAR);
- if (presfShowSelectionBar != selectionBar.isVisible()) {
- selectionBar.setVisible(presfShowSelectionBar);
- doVisualRefresh = true;
- }
+// if (presfShowSelectionBar != selectionBar.isVisible()) {
+// selectionBar.setVisible(presfShowSelectionBar);
+// doVisualRefresh = true;
+// }
boolean prefsShowNonVisualTags = JspEditorPlugin.getDefault()
.getPreferenceStore().getBoolean(
@@ -1213,13 +1208,13 @@
}
}
- public void updateSelectionBar(boolean isSelectionBarVisible) {
- if (selectionBar != null) {
- selectionBar.setVisible(isSelectionBarVisible);
- } else {
- VpePlugin.getDefault().logError("VPE Selection Bar is not initialized.");
//$NON-NLS-1$
- }
- }
+// public void updateSelectionBar(boolean isSelectionBarVisible) {
+// if (selectionBar != null) {
+// selectionBar.setVisible(isSelectionBarVisible);
+// } else {
+// VpePlugin.getDefault().logError("VPE Selection Bar is not initialized.");
//$NON-NLS-1$
+// }
+// }
private void deactivateServices() {
IWorkbench workbench = PlatformUI.getWorkbench();
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -34,16 +34,17 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
+import org.jboss.tools.jst.jsp.selection.SelectionHelper;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.mapping.VpeElementMapping;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.jboss.tools.vpe.editor.selection.VpeSelectionHelper;
import org.jboss.tools.vpe.editor.template.VpeTemplate;
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.util.TextUtil;
+import org.jboss.tools.vpe.editor.util.VpeNodesManagingUtil;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
@@ -209,7 +210,7 @@
}
Node getSelectedNode() {
- List nodes = VpeSelectionHelper.getTextWidgetSelectedNodes(model,
+ List nodes = SelectionHelper.getTextWidgetSelectedNodes(model,
selectionManager);
// selectionManager.getSelectedNodes();
if (nodes != null && nodes.size() > 0) {
@@ -308,7 +309,7 @@
* false otherwise
*/
private boolean openOnOnVisualNode(nsIDOMNode visualNode) {
- VpeNodeMapping nodeMapping = NodesManagingUtil.getNodeMapping(
+ VpeNodeMapping nodeMapping = VpeNodesManagingUtil.getNodeMapping(
this.domMapping, visualNode);
if (nodeMapping != null && nodeMapping instanceof VpeElementMapping) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -36,15 +36,15 @@
import org.eclipse.wst.xml.core.internal.document.InvalidCharacterException;
import org.eclipse.wst.xml.core.internal.document.TextImpl;
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
+import org.jboss.tools.jst.jsp.selection.SourceSelectionBuilder;
+import org.jboss.tools.jst.jsp.selection.SourceSelection;
+import org.jboss.tools.jst.jsp.selection.SelectedNodeInfo;
import org.jboss.tools.vpe.VpeDebug;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.mapping.VpeElementMapping;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.jboss.tools.vpe.editor.selection.VpeSelectedNodeInfo;
-import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
-import org.jboss.tools.vpe.editor.selection.VpeSourceSelectionBuilder;
import org.jboss.tools.vpe.editor.template.VpeHtmlTemplate;
import org.jboss.tools.vpe.editor.template.VpeTemplate;
import org.jboss.tools.vpe.editor.util.FlatIterator;
@@ -210,8 +210,8 @@
}
private boolean selectToBegin() {
- VpeSourceSelectionBuilder sourceSelectionBuilder = new
VpeSourceSelectionBuilder(sourceEditor);
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ SourceSelectionBuilder sourceSelectionBuilder = new
SourceSelectionBuilder(sourceEditor);
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
if (selection != null) {
Node focusNode = selection.getFocusNode();
int focusOffset = selection.getFocusOffset();
@@ -225,8 +225,8 @@
}
private boolean selectToEnd() {
- VpeSourceSelectionBuilder sourceSelectionBuilder = new
VpeSourceSelectionBuilder(sourceEditor);
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ SourceSelectionBuilder sourceSelectionBuilder = new
SourceSelectionBuilder(sourceEditor);
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
if (selection != null) {
Node focusNode = selection.getFocusNode();
int focusOffset = selection.getFocusOffset();
@@ -247,7 +247,7 @@
}
private boolean deleteRight() {
- VpeSourceSelectionBuilder sourceSelectionBuilder = new
VpeSourceSelectionBuilder(sourceEditor);
+ SourceSelectionBuilder sourceSelectionBuilder = new
SourceSelectionBuilder(sourceEditor);
if (processNonCollapsedSelection(sourceSelectionBuilder, VK_DELETE)) {
return true;
}
@@ -256,7 +256,7 @@
return true;
}
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
if (selection != null) {
if (!selection.isCollapsed()) {
return false;
@@ -289,7 +289,7 @@
return false;
}
- private boolean deleteRightCharOrElement(VpeSourceSelectionBuilder
sourceSelectionBuilder, VpeSourceSelection selection, Node node) {
+ private boolean deleteRightCharOrElement(SourceSelectionBuilder sourceSelectionBuilder,
SourceSelection selection, Node node) {
if (node.getNodeType() == Node.ELEMENT_NODE) {
int a = 1;
if (!hasNoEmptyChildren(node)) {
@@ -357,7 +357,7 @@
* @return
*/
- private VpeSourceSelection deleteRightChar(VpeSourceSelectionBuilder
sourceSelectionBuilder, VpeSourceSelection selection) {
+ private SourceSelection deleteRightChar(SourceSelectionBuilder sourceSelectionBuilder,
SourceSelection selection) {
boolean atLeastOneCharIsDeleted = false;
Node focusNode = null;
while (selection != null && (focusNode = selection.getFocusNode()) != null) {
@@ -432,14 +432,14 @@
return selection;
}
- private boolean processNonCollapsedSelection(VpeSourceSelectionBuilder
sourceSelectionBuilder, long keyCode) {
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ private boolean processNonCollapsedSelection(SourceSelectionBuilder
sourceSelectionBuilder, long keyCode) {
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
if (selection != null) {
List selectedNodes = selection.getSelectedNodes();
int focusOffset = -1;
if (!selection.isCollapsed()) {
for (int i = 0; i < selectedNodes.size(); i++) {
- VpeSelectedNodeInfo nodeInfo = (VpeSelectedNodeInfo)selectedNodes.get(i);
+ SelectedNodeInfo nodeInfo = (SelectedNodeInfo)selectedNodes.get(i);
focusOffset = processNode(nodeInfo, keyCode, selection);
}
Node commonAncestor = selection.getCommonAncestor();
@@ -454,8 +454,8 @@
return false;
}
- private boolean processAttributeSelection(VpeSourceSelectionBuilder
sourceSelectionBuilder, long keyCode) {
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ private boolean processAttributeSelection(SourceSelectionBuilder sourceSelectionBuilder,
long keyCode) {
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
if (selection != null) {
if (selection.getFocusAttribute() != null) {
AttrImpl attr = (AttrImpl)selection.getFocusAttribute();
@@ -516,7 +516,7 @@
}
private boolean deleteLeft() {
- VpeSourceSelectionBuilder sourceSelectionBuilder = new
VpeSourceSelectionBuilder(sourceEditor);
+ SourceSelectionBuilder sourceSelectionBuilder = new
SourceSelectionBuilder(sourceEditor);
if (processNonCollapsedSelection(sourceSelectionBuilder, VK_BACK_SPACE)) {
return true;
}
@@ -525,7 +525,7 @@
return true;
}
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
if (selection != null) {
if (!selection.isCollapsed()) {
return false;
@@ -570,7 +570,7 @@
return false;
}
- private boolean deleteLeftCharOrElement(VpeSourceSelectionBuilder
sourceSelectionBuilder, VpeSourceSelection selection, Node node) {
+ private boolean deleteLeftCharOrElement(SourceSelectionBuilder sourceSelectionBuilder,
SourceSelection selection, Node node) {
if (node.getNodeType() == Node.ELEMENT_NODE) {
if (!hasNoEmptyChildren(node)) {
AttrImpl attr = (AttrImpl)getVisualNodeSourceAttribute(node);
@@ -677,13 +677,13 @@
}
if (focusNodeOffset > 0) {
focusNodeOffset--;
- return VpeSourceSelectionBuilder.getSourceNodeAt(this.sourceEditor,focusNodeOffset);
+ return SourceSelectionBuilder.getSourceNodeAt(this.sourceEditor,focusNodeOffset);
}
}
return null;
}
- private VpeSourceSelection deleteLeftChar(VpeSourceSelectionBuilder
sourceSelectionBuilder, VpeSourceSelection selection) {
+ private SourceSelection deleteLeftChar(SourceSelectionBuilder sourceSelectionBuilder,
SourceSelection selection) {
boolean atLeastOneCharIsDeleted = false;
Node focusNode = null;
while (selection != null && (focusNode = selection.getFocusNode()) != null) {
@@ -985,13 +985,13 @@
}
private boolean handleKey(nsIDOMKeyEvent keyEvent) {
- VpeSourceSelectionBuilder sourceSelectionBuilder = new
VpeSourceSelectionBuilder(sourceEditor);
+ SourceSelectionBuilder sourceSelectionBuilder = new
SourceSelectionBuilder(sourceEditor);
processNonCollapsedSelection(sourceSelectionBuilder, keyEvent.getCharCode());
processAttributeSelection(sourceSelectionBuilder, keyEvent.getCharCode());
boolean isEditable = false;
int start = 0;
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
if (selection != null) {
Node sourceNode = selection.getFocusNode();
if (sourceNode != null) {
@@ -1042,8 +1042,8 @@
private boolean _nonctrlKeyPressHandler(nsIDOMKeyEvent keyEvent) {
ITextFormatter formatter = null;
- VpeSourceSelectionBuilder sourceSelectionBuilder = new
VpeSourceSelectionBuilder(sourceEditor);
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ SourceSelectionBuilder sourceSelectionBuilder = new
SourceSelectionBuilder(sourceEditor);
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
if (selection != null) {
long keyCode = keyEvent.getKeyCode();
List selectedNodes = selection.getSelectedNodes();
@@ -1051,7 +1051,7 @@
case VK_ENTER:
if (!selection.isCollapsed()) {
for (int i = 0; i < selectedNodes.size(); i++) {
- VpeSelectedNodeInfo nodeInfo = (VpeSelectedNodeInfo)selectedNodes.get(i);
+ SelectedNodeInfo nodeInfo = (SelectedNodeInfo)selectedNodes.get(i);
processNode(nodeInfo, keyCode, selection);
}
Node commonAncestor = selection.getCommonAncestor();
@@ -1107,13 +1107,13 @@
private boolean split() {
ITextFormatter formatter = null;
IRegion region = null;
- VpeSourceSelectionBuilder sourceSelectionBuilder = new
VpeSourceSelectionBuilder(sourceEditor);
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ SourceSelectionBuilder sourceSelectionBuilder = new
SourceSelectionBuilder(sourceEditor);
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
if (selection != null) {
List selectedNodes = selection.getSelectedNodes();
if (!selection.isCollapsed()) {
for (int i = 0; i < selectedNodes.size(); i++) {
- VpeSelectedNodeInfo nodeInfo = (VpeSelectedNodeInfo)selectedNodes.get(i);
+ SelectedNodeInfo nodeInfo = (SelectedNodeInfo)selectedNodes.get(i);
processNode(nodeInfo, VK_ENTER, selection);
}
Node commonAncestor = selection.getCommonAncestor();
@@ -1214,7 +1214,7 @@
}
}
- private int processNode(VpeSelectedNodeInfo nodeInfo, long keyCode, VpeSourceSelection
selection) {
+ private int processNode(SelectedNodeInfo nodeInfo, long keyCode, SourceSelection
selection) {
Node node = nodeInfo.getNode();
if (domMapping.getNodeMapping(node) != null) {
int type = node.getNodeType();
@@ -1259,7 +1259,7 @@
return null;
}
- private void goToParentTemplate(Node node, VpeSourceSelection selection, long keyCode)
{
+ private void goToParentTemplate(Node node, SourceSelection selection, long keyCode) {
ITextFormatter formatter = null;
VpeNodeMapping nearNodeMapping = domMapping.getNearParentMapping(node);
if (nearNodeMapping != null && nearNodeMapping instanceof VpeElementMapping) {
@@ -1298,8 +1298,8 @@
}
private boolean moveForward() {
- VpeSourceSelectionBuilder sourceSelectionBuilder = new
VpeSourceSelectionBuilder(sourceEditor);
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ SourceSelectionBuilder sourceSelectionBuilder = new
SourceSelectionBuilder(sourceEditor);
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
if (selection != null && selection.isCollapsed()) {
Node node = getNextNode(selection.getStartNode());
if (node != null) {
@@ -1432,8 +1432,8 @@
}
private boolean moveBack() {
- VpeSourceSelectionBuilder sourceSelectionBuilder = new
VpeSourceSelectionBuilder(sourceEditor);
- VpeSourceSelection selection = sourceSelectionBuilder.getSelection();
+ SourceSelectionBuilder sourceSelectionBuilder = new
SourceSelectionBuilder(sourceEditor);
+ SourceSelection selection = sourceSelectionBuilder.getSelection();
if (selection != null && selection.isCollapsed()) {
Node node = getPrevNode(selection.getStartNode());
if (node != null) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -33,6 +33,7 @@
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
import org.jboss.tools.common.model.util.ModelFeatureFactory;
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.jst.web.tld.URIConstants;
import org.jboss.tools.vpe.VpeDebug;
import org.jboss.tools.vpe.VpePlugin;
@@ -54,7 +55,6 @@
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.util.SelectionUtil;
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.jboss.tools.vpe.xulrunner.util.DOMTreeDumper;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction2.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction2.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction2.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -20,11 +20,11 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.jst.web.tld.URIConstants;
import org.jboss.tools.jst.web.tld.model.helpers.TLDToPaletteHelper;
import org.jboss.tools.vpe.editor.menu.InsertType;
import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.util.SelectionUtil;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/SelectThisTagAction.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/SelectThisTagAction.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/SelectThisTagAction.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -12,8 +12,8 @@
import org.eclipse.jface.action.Action;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.menu.VpeMenuUtil;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.w3c.dom.Node;
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 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -121,12 +121,11 @@
public static final String ICON_ORIENTATION_SOURCE_LEFT_DISABLED =
"icons/source_left_disabled.gif"; //$NON-NLS-1$
public static final String ICON_SHOW_BORDER_FOR_UNKNOWN_TAGS =
"icons/border.gif"; //$NON-NLS-1$
public static final String ICON_NON_VISUAL_TAGS =
"icons/non-visusal-tags.gif"; //$NON-NLS-1$
- public static final String ICON_SELECTION_BAR = "icons/selbar.gif";
//$NON-NLS-1$
public static final String ICON_TEXT_FORMATTING = "icons/text-formatting.gif";
//$NON-NLS-1$
public static final String ICON_BUNDLE_AS_EL= "icons/bundle-as-el.gif";
//$NON-NLS-1$
public static final String ICON_EXTERNALIZE_STRINGS= "icons/properties.gif";
//$NON-NLS-1$
- static String SELECT_BAR = "SELECT_LBAR"; //$NON-NLS-1$
+ //static String SELECT_BAR = "SELECT_LBAR"; //$NON-NLS-1$
private XulRunnerEditor xulRunnerEditor;
private nsIDOMElement contentArea;
private nsIDOMNode headNode;
@@ -151,7 +150,6 @@
private Action rotateEditorsAction;
private Action showBorderAction;
private Action showNonVisualTagsAction;
- private Action showSelectionBarAction;
private Action showTextFormattingAction;
private Action showBundleAsELAction;
private Action externalizeStringsAction;
@@ -406,26 +404,6 @@
ICON_NON_VISUAL_TAGS));
showNonVisualTagsAction.setToolTipText(VpeUIMessages.SHOW_NON_VISUAL_TAGS);
toolBarManager.add(showNonVisualTagsAction);
-
- /*
- * Create SHOW SELECTION BAR tool bar item
- */
- showSelectionBarAction = new Action(VpeUIMessages.SHOW_SELECTION_BAR,
- IAction.AS_CHECK_BOX) {
- @Override
- public void run() {
- /*
- * Update Selection Bar
- */
- controller.getPageContext().getEditPart().updateSelectionBar(this.isChecked());
- JspEditorPlugin.getDefault().getPreferenceStore().
- setValue(IVpePreferencesPage.SHOW_SELECTION_TAG_BAR, this.isChecked());
- }
- };
- showSelectionBarAction.setImageDescriptor(ImageDescriptor.createFromFile(MozillaEditor.class,
- ICON_SELECTION_BAR));
- showSelectionBarAction.setToolTipText(VpeUIMessages.SHOW_SELECTION_BAR);
- toolBarManager.add(showSelectionBarAction);
/*
* Create SHOW TEXT FORMATTING tool bar item
@@ -507,7 +485,6 @@
rotateEditorsAction = null;;
showBorderAction = null;
showNonVisualTagsAction = null;
- showSelectionBarAction = null;
showTextFormattingAction = null;
showBundleAsELAction = null;
externalizeStringsAction = null;
@@ -1080,8 +1057,6 @@
.getBoolean(IVpePreferencesPage.SHOW_BORDER_FOR_UNKNOWN_TAGS);
boolean prefsShowNonVisualTags = JspEditorPlugin.getDefault().getPreferenceStore()
.getBoolean(IVpePreferencesPage.SHOW_NON_VISUAL_TAGS);
- boolean prefsShowSelectionBar = JspEditorPlugin.getDefault().getPreferenceStore()
- .getBoolean(IVpePreferencesPage.SHOW_SELECTION_TAG_BAR);
boolean prefsShowTextFormatting = JspEditorPlugin.getDefault().getPreferenceStore()
.getBoolean(IVpePreferencesPage.SHOW_TEXT_FORMATTING);
boolean prefsShowBundlesAsEL = JspEditorPlugin.getDefault().getPreferenceStore()
@@ -1093,9 +1068,6 @@
if (showNonVisualTagsAction != null) {
showNonVisualTagsAction.setChecked(prefsShowNonVisualTags);
}
- if (showSelectionBarAction != null) {
- showSelectionBarAction.setChecked(prefsShowSelectionBar);
- }
if (showTextFormattingAction != null) {
showTextFormattingAction.setChecked(prefsShowTextFormatting);
}
@@ -1110,10 +1082,6 @@
}
}
- public void updateShowSelectionBarItem(boolean checked) {
- showSelectionBarAction.setChecked(checked);
- }
-
public void setResizeListener(MozillaResizeListener resizeListener) {
this.resizeListener = resizeListener;
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -136,8 +136,6 @@
visualAppearanceGroup));
addField(new BooleanFieldEditor(SHOW_NON_VISUAL_TAGS,
VpeUIMessages.SHOW_NON_VISUAL_TAGS, visualAppearanceGroup));
- addField(new BooleanFieldEditor(SHOW_SELECTION_TAG_BAR,
- VpeUIMessages.SHOW_SELECTION_TAG_BAR, visualAppearanceGroup));
addField(new BooleanFieldEditor(SHOW_TEXT_FORMATTING,
VpeUIMessages.SHOW_TEXT_FORMATTING, visualAppearanceGroup));
addField(new BooleanFieldEditor(SHOW_RESOURCE_BUNDLES_USAGE_AS_EL,
Deleted:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSelectedNodeInfo.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSelectedNodeInfo.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSelectedNodeInfo.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.selection;
-
-import org.w3c.dom.Node;
-
-public class VpeSelectedNodeInfo {
- private Node node;
- private int startOffset;
- private int endOffset;
-
- public VpeSelectedNodeInfo(Node node) {
- this.node = node;
- }
- public VpeSelectedNodeInfo(Node node, int startOffset, int endOffset) {
- this(node);
- this.startOffset = startOffset;
- this.endOffset = endOffset;
- }
-
- public Node getNode() {
- return node;
- }
-
- public int getStartOffset() {
- return startOffset;
- }
-
- public int getEndOffset() {
- return endOffset;
- }
-
- public String toString() {
- if (node != null) {
- return node.toString();
- }
- return super.toString();
- }
-
-}
Deleted:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSelectionHelper.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSelectionHelper.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSelectionHelper.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.selection;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-
-public class VpeSelectionHelper {
-
- public static StyledText getSourceTextWidget(StructuredTextEditor sourceEditor) {
- if (sourceEditor != null && sourceEditor.getTextViewer() != null &&
sourceEditor.getTextViewer().getTextWidget() != null &&
!sourceEditor.getTextViewer().getTextWidget().isDisposed()) {
- return (StyledText)sourceEditor.getTextViewer().getTextWidget();
- }
- return null;
- }
-
- public static int getCaretOffset(StructuredTextEditor sourceEditor) {
- StyledText t = getSourceTextWidget(sourceEditor);
- return t == null ? 0 : t.getCaretOffset();
- }
-
- public static List getTextWidgetSelectedNodes(IStructuredModel model, ISelectionProvider
provider) {
- ISelection s = provider.getSelection();
- if(s == null || s.isEmpty() || !(s instanceof ITextSelection)) return new ArrayList();
- ITextSelection ts = (ITextSelection)s;
- int offset = ts.getOffset();
- if (model == null) return new ArrayList(0);
- IndexedRegion firstSelectedNode = model.getIndexedRegion(offset);
-
- // Never send a "null" in the selection
- List selectedNodes = null;
- if (firstSelectedNode != null) {
- selectedNodes = new ArrayList(1);
- selectedNodes.add(firstSelectedNode);
- }
- else {
- selectedNodes = new ArrayList(0);
- }
- return selectedNodes;
- }
-
-
-}
Deleted:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelection.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelection.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelection.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.selection;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Collections;
-
-import org.eclipse.swt.graphics.Point;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
-
-public class VpeSourceSelection {
- private Node startNode;
- private int startOffset;
- private Node endNode;
- private int endOffset;
- private List selectedNodes;
- private Attr focusAttribute;
- private Point focusAttributeRange;
-
- public VpeSourceSelection(Node startNode, int startOffset, Node endNode, int endOffset)
{
- this.startNode = startNode;
- this.startOffset = startOffset;
- this.endNode = endNode;
- this.endOffset = endOffset;
- this.selectedNodes = getSelNodes();
- }
-
- public List getSelectedNodes() {
- return selectedNodes;
- }
-
- private List getSelNodes() {
- List nodes = Collections.EMPTY_LIST;
- VpeNodeIterator nodeIterator = new VpeNodeIterator(startNode, endNode);
- Node nextNode = nodeIterator.nextNode();
- if (nextNode != null) nodes = new ArrayList();
-// Node commonAncestor = getCommonAncestor();
- while (nextNode != null) {
- VpeSelectedNodeInfo nextNodeInfo = null;
- int type = nextNode.getNodeType();
- if (type == Node.TEXT_NODE || type == Node.COMMENT_NODE) {
- if (nextNode == startNode && nextNode == endNode) {
- nextNodeInfo = new VpeSelectedNodeInfo(nextNode, startOffset, endOffset);
- } else if (nextNode == startNode) {
- nextNodeInfo = new VpeSelectedNodeInfo(nextNode, startOffset,
nextNode.getNodeValue().length());
- } else if (nextNode == endNode) {
- nextNodeInfo = new VpeSelectedNodeInfo(nextNode, 0, endOffset);
- } else {
- nextNodeInfo = new VpeSelectedNodeInfo(nextNode, 0,
nextNode.getNodeValue().length());
- }
- } else if (nextNode.getNodeType() == Node.ELEMENT_NODE) {
- if (!inParents(nextNode, endNode)) {
- nextNodeInfo = new VpeSelectedNodeInfo(nextNode);
- }
- }
- if (nextNodeInfo != null) nodes.add(nextNodeInfo);
- nextNode = nodeIterator.nextNode();
- }
- return nodes;
- }
-
- private boolean inParents(Node node1, Node node2) {
- if (node2 != null) {
- Node p = node2.getParentNode();
- while (p != null) {
- if (p == node1)
- return true;
- p = p.getParentNode();
- }
- }
- return false;
-
- }
-
- public Node getCommonAncestor() {
- if (endNode == null)
- return null;
-
- for (Node na = endNode; na != null; na = na.getParentNode()) {
- for (Node ta = startNode; ta != null; ta = ta.getParentNode()) {
- if (ta == na)
- return ta;
- }
- }
-
- return null; // not found
- }
-
- public boolean isOneNodeSelected() {
- return startNode == endNode;
- }
-
- public static class VpeNodeIterator {
- private Node nextNode;
- private Node endNode;
-
- public VpeNodeIterator(Node startNode, Node endNode) {
- this.nextNode = startNode;
- this.endNode = endNode;
- }
-
- public Node nextNode() {
- for (Node node = getNextNode(); node != null; node = getNextNode()) {
- return node;
- }
- return null;
- }
-
- private final Node getNextNode() {
- if (this.nextNode == null)
- return null;
- Node oldNext = this.nextNode;
- Node child = this.nextNode.getFirstChild();
- if (child != null) {
- this.nextNode = child;
- return oldNext;
- }
- for (Node node = this.nextNode; node != null && !node.equals(endNode); node =
node.getParentNode()) {
- Node next = node.getNextSibling();
- if (next != null) {
- this.nextNode = next;
- return oldNext;
- }
- }
- this.nextNode = null;
- return oldNext;
- }
- }
-
- public Node getEndNode() {
- return endNode;
- }
-
- public Node getStartNode() {
- return startNode;
- }
-
- public int getEndOffset() {
- return endOffset;
- }
-
- public int getStartOffset() {
- return startOffset;
- }
-
- public boolean isCollapsed() {
- return isOneNodeSelected() && startOffset == endOffset;
- }
-
- public Node getFocusNode() {
-// return focusNode;
- return endNode;
- }
-
- public int getFocusOffset() {
- return endOffset;
- }
-
- public void setEndOffset(int endOffset) {
- this.endOffset = endOffset;
- }
-
- public void setStartOffset(int startOffset) {
- this.startOffset = startOffset;
- }
-
- public Attr getFocusAttribute() {
- return focusAttribute;
- }
-
- public void setFocusAttribute(Attr focusAttribute) {
- this.focusAttribute = focusAttribute;
- }
-
- public Point getFocusAttributeRange() {
- return focusAttributeRange;
- }
-
- public void setFocusAttributeRange(Point focusAttributeRange) {
- this.focusAttributeRange = focusAttributeRange;
- }
-}
Deleted:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelectionBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelectionBuilder.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelectionBuilder.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.selection;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.xml.core.internal.document.AttrImpl;
-import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.jboss.tools.vpe.VpePlugin;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-public class VpeSourceSelectionBuilder {
- StructuredTextEditor sourceEditor;
-
- public VpeSourceSelectionBuilder(StructuredTextEditor sourceEditor) {
- this.sourceEditor = sourceEditor;
- }
-
- public VpeSourceSelection getSelection() {
- Point range = sourceEditor.getTextViewer().getSelectedRange();
- int anchorPosition = range.x;
- int focusPosition = range.x + range.y;
- boolean extendFlag = range.y != 0;
- boolean reversionFlag = extendFlag && anchorPosition ==
VpeSelectionHelper.getCaretOffset(sourceEditor);
- if (reversionFlag) {
- anchorPosition = focusPosition;
- focusPosition = range.x;
- }
- Node focusNode = getSourceNodeAt(this.sourceEditor,focusPosition);
- if (focusNode == null) {
- return null;
- }
-
- int focusOffset = getSourceNodeOffset(focusNode, focusPosition, !reversionFlag);
- Node anchorNode = null;
- int anchorOffset = 0;
- if (extendFlag) {
- anchorNode = getSourceNodeAt(this.sourceEditor,anchorPosition);
- anchorOffset = getSourceNodeOffset(anchorNode, anchorPosition, reversionFlag);
- } else {
- anchorNode = focusNode;
- anchorOffset = focusOffset;
- }
-
- VpeSourceSelection selection = null;
- if (reversionFlag) {
- selection = new VpeSourceSelection(focusNode, focusOffset, anchorNode, anchorOffset);
- } else {
- selection = new VpeSourceSelection(anchorNode, anchorOffset, focusNode, focusOffset);
- }
- List selectedNodes = null;
- if (focusNode instanceof IDOMElement) {
- IDOMElement element = (IDOMElement)focusNode;
- if (focusPosition < element.getEndStartOffset()) {
- NamedNodeMap attrs = focusNode.getAttributes();
- for (int i = 0; i < attrs.getLength(); i++) {
- AttrImpl attr = (AttrImpl)attrs.item(i);
- ITextRegion region = attr.getValueRegion();
- if(region==null) {
- break;
- }
- int attrStart = region.getStart();
- int attrEnd = attrStart + attr.getValue().length();
- if (range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1 >=
attrStart && range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1
<= attrEnd) {
- selectedNodes = new ArrayList();
- selectedNodes.add(attr);
- break;
- }
- }
- }
- }
-
- if (selectedNodes == null) {
- selectedNodes = VpeSelectionHelper.getTextWidgetSelectedNodes(sourceEditor.getModel(),
sourceEditor.getSelectionProvider());
- }
- if (selectedNodes != null && selectedNodes.size() == 1) {
- Object node = selectedNodes.get(0);
- if (node instanceof AttrImpl) {
- AttrImpl attr = (AttrImpl)node;
- int attrStart = attr.getValueRegion().getStart();
- int attrEnd = attrStart + attr.getValue().length();
- if (range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1 >=
attrStart && range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1
<= attrEnd) {
- selection.setFocusAttribute((Attr)node);
- Point attrRange = new Point(range.x -
(((ElementImpl)attr.getOwnerElement()).getStartOffset() +
attr.getValueRegion().getStart()) - 1, range.y);
- selection.setFocusAttributeRange(attrRange);
- }
- }
- }
- return selection;
- }
-
- public static Node getSourceNodeAt(StructuredTextEditor srcEditor,int offset) {
- if (srcEditor != null && srcEditor.getModel() != null) {
- IndexedRegion node = srcEditor.getModel().getIndexedRegion(offset);
- if (node == null) {
- node = srcEditor.getModel().getIndexedRegion(offset - 1);
- }
- if (node instanceof Node) {
- return (Node) node;
- }
- }
- return null;
- }
-
- private int getSourceNodeOffset(Node node, int pos, boolean endFlag) {
- if (node == null) return 0;
- int start = ((IndexedRegion)node).getStartOffset();
- int end = ((IndexedRegion)node).getEndOffset();
-
- if (node.getNodeType() == Node.TEXT_NODE) {
- if (pos < start) {
- return 0;
- } else if (pos > end) {
- return end - start;
- } else {
- return pos - start;
- }
- } else if (node.getNodeType() == Node.ELEMENT_NODE) {
- ElementImpl element = (ElementImpl)node;
- if (element.isContainer()) {
- if (pos < element.getStartEndOffset()) {
- return 0;
- } else {
- if (element.hasEndTag() && pos <= element.getEndStartOffset()) {
- return 2;
- } else {
- return 1;
- }
- }
- } else {
- return endFlag ? 1 : 0;
- }
- } else if (node.getNodeType() == Node.COMMENT_NODE) {
- if (pos > end) {
- pos = end;
- }
- int offset = pos - start - 4;
- return offset < 0 ? 0 : offset;
- } else {
- return endFlag ? 1 : 0;
- }
- }
-}
\ No newline at end of file
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/KeyEventManager.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/KeyEventManager.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/KeyEventManager.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -14,6 +14,7 @@
import org.eclipse.swt.custom.ST;
import org.eclipse.swt.graphics.Point;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.AttributeData;
import org.jboss.tools.vpe.editor.mapping.NodeData;
@@ -21,7 +22,6 @@
import org.jboss.tools.vpe.editor.mapping.VpeElementData;
import org.jboss.tools.vpe.editor.mapping.VpeElementMapping;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.util.SelectionUtil;
import org.jboss.tools.vpe.editor.util.TextUtil;
import org.mozilla.interfaces.nsIDOMKeyEvent;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -16,16 +16,17 @@
import org.eclipse.swt.graphics.Point;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.xml.core.internal.document.NodeImpl;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.NodeData;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.mapping.VpeElementMapping;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
import org.jboss.tools.vpe.editor.selection.VpeSelectionController;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.util.SelectionUtil;
import org.jboss.tools.vpe.editor.util.TextUtil;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
+import org.jboss.tools.vpe.editor.util.VpeNodesManagingUtil;
import org.mozilla.interfaces.nsIDOMMouseEvent;
import org.mozilla.interfaces.nsIDOMNSUIEvent;
import org.mozilla.interfaces.nsIDOMNode;
@@ -71,7 +72,7 @@
if (selectedVisualNode == null)
return;
- VpeNodeMapping nodeMapping = NodesManagingUtil.getNodeMapping(
+ VpeNodeMapping nodeMapping = VpeNodesManagingUtil.getNodeMapping(
getDomMapping(), selectedVisualNode);
if (nodeMapping == null)
@@ -161,7 +162,7 @@
nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
// get element mapping
- VpeNodeMapping nodeMapping = NodesManagingUtil.getNodeMapping(
+ VpeNodeMapping nodeMapping = VpeNodesManagingUtil.getNodeMapping(
getDomMapping(), visualNode);
if (nodeMapping == null)
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractCreator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractCreator.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractCreator.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -13,8 +13,8 @@
import java.util.Map;
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
+import org.jboss.tools.jst.jsp.selection.SourceSelection;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionException;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -116,7 +116,7 @@
* @param formatter Formatter of text.
* @return <code>true</code> if the key is treated,
<code>false</code> otherwise.
*/
- public boolean nonctrlKeyPressHandler(VpePageContext pageContext, Document
sourceDocument, Node sourceNode, Object data, long charCode, VpeSourceSelection selection,
ITextFormatter formatter) {
+ public boolean nonctrlKeyPressHandler(VpePageContext pageContext, Document
sourceDocument, Node sourceNode, Object data, long charCode, SourceSelection selection,
ITextFormatter formatter) {
return false;
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -22,6 +22,8 @@
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
+import org.jboss.tools.jst.jsp.selection.SourceSelection;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.dnd.VpeDnDHelper;
import org.jboss.tools.vpe.editor.VpeSourceInnerDragInfo;
@@ -31,13 +33,12 @@
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.mapping.VpeElementData;
import org.jboss.tools.vpe.editor.mapping.VpeElementMapping;
-import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionException;
import org.jboss.tools.vpe.editor.template.resize.VpeResizer;
import org.jboss.tools.vpe.editor.template.textformating.TextFormatingData;
import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.util.SelectionUtil;
+import org.jboss.tools.vpe.editor.util.VpeNodesManagingUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -503,7 +504,7 @@
*/
public boolean nonctrlKeyPressHandler(VpePageContext pageContext,
Document sourceDocument, Node sourceNode, nsIDOMNode visualNode,
- Object data, long charCode, VpeSourceSelection selection,
+ Object data, long charCode, SourceSelection selection,
ITextFormatter formatter) {
switch (breakerType) {
case BREAKER_TYPE_IGNORE:
@@ -534,7 +535,7 @@
*/
private boolean nonctrlKeyPressHandlerImpl(VpePageContext pageContext,
Document sourceDocument, Node sourceNode, nsIDOMNode visualNode,
- Object data, long charCode, VpeSourceSelection selection,
+ Object data, long charCode, SourceSelection selection,
ITextFormatter formatter) {
clearRegionToFormat();
Node focusNode = selection.getFocusNode();
@@ -1435,7 +1436,7 @@
&& nodeData.getSourceNode().getNodeValue() != null)
return pageContext.getBundle().openBundle(
nodeData.getSourceNode().getNodeValue(),
- NodesManagingUtil.getPageLocale(pageContext, nodeData
+ VpeNodesManagingUtil.getPageLocale(pageContext, nodeData
.getSourceNode()));
return false;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeBreackerHelper.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeBreackerHelper.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeBreackerHelper.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -16,14 +16,14 @@
import org.w3c.dom.Document;
import org.w3c.dom.Node;
+import org.jboss.tools.jst.jsp.selection.SourceSelection;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMNode;
public class VpeBreackerHelper {
- public static boolean selectItem(VpePageContext pageContext, Document sourceDocument,
Node sourceNode, nsIDOMNode visualNode, Object data, long charCode, VpeSourceSelection
selection) {
+ public static boolean selectItem(VpePageContext pageContext, Document sourceDocument,
Node sourceNode, nsIDOMNode visualNode, Object data, long charCode, SourceSelection
selection) {
Attr attr = selection.getFocusAttribute();
if (attr != null) {
Point range = selection.getFocusAttributeRange();
@@ -51,7 +51,7 @@
return false;
}
- public static boolean breakInline(VpePageContext pageContext, Document sourceDocument,
Node sourceNode, Node visualNode, Object data, int charCode, VpeSourceSelection selection)
{
+ public static boolean breakInline(VpePageContext pageContext, Document sourceDocument,
Node sourceNode, Node visualNode, Object data, int charCode, SourceSelection selection) {
Attr attr = selection.getFocusAttribute();
if (attr != null) {
Point range = selection.getFocusAttributeRange();
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreator.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreator.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -13,8 +13,8 @@
import java.util.Map;
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
+import org.jboss.tools.jst.jsp.selection.SourceSelection;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionException;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -109,7 +109,7 @@
* @param formatter Formatter of text.
* @return <code>true</code> if the key is treated,
<code>false</code> otherwise.
*/
- boolean nonctrlKeyPressHandler(VpePageContext pageContext, Document sourceDocument, Node
sourceNode, Object data, long charCode, VpeSourceSelection selection, ITextFormatter
formatter);
+ boolean nonctrlKeyPressHandler(VpePageContext pageContext, Document sourceDocument, Node
sourceNode, Object data, long charCode, SourceSelection selection, ITextFormatter
formatter);
Node getNodeForUpdate(VpePageContext pageContext, Node sourceNode, nsIDOMNode
visualNode, Map<VpeTemplate,?> visualNodeMap);
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCustomTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCustomTemplate.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCustomTemplate.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -14,11 +14,11 @@
import org.eclipse.core.resources.IStorage;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.VpeIncludeInfo;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.custom.CustomTLDReference;
import org.jboss.tools.vpe.editor.template.custom.VpeCustomStringStorage;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Attr;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -20,15 +20,15 @@
import org.eclipse.jface.text.Region;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
+import org.jboss.tools.jst.jsp.selection.SourceSelection;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.jst.web.tld.TaglibData;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionBuilder;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionException;
import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -236,7 +236,7 @@
}
}
@Override
- public boolean nonctrlKeyPressHandler(VpePageContext pageContext, Document
sourceDocument, Node sourceNode, nsIDOMNode visualNode, Object data, long charCode,
VpeSourceSelection selection, ITextFormatter formatter) {
+ public boolean nonctrlKeyPressHandler(VpePageContext pageContext, Document
sourceDocument, Node sourceNode, nsIDOMNode visualNode, Object data, long charCode,
SourceSelection selection, ITextFormatter formatter) {
if (creator != null) {
boolean done = creator.nonctrlKeyPressHandler(pageContext, sourceDocument,
sourceNode, data, charCode, selection, formatter);
if (done) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeIncludeTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeIncludeTemplate.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeIncludeTemplate.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -13,6 +13,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeIncludeInfo;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
@@ -26,7 +27,6 @@
import org.jboss.tools.vpe.editor.util.FaceletUtil;
import org.jboss.tools.vpe.editor.util.FileUtil;
import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -12,6 +12,7 @@
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
+import org.jboss.tools.jst.jsp.selection.SourceSelection;
import org.jboss.tools.vpe.editor.VpeSourceInnerDragInfo;
import org.jboss.tools.vpe.editor.VpeSourceDropInfo;
import org.jboss.tools.vpe.editor.context.VpePageContext;
@@ -19,7 +20,6 @@
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.mapping.VpeElementData;
import org.jboss.tools.vpe.editor.mapping.VpeElementMapping;
-import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
import org.jboss.tools.vpe.editor.template.textformating.TextFormatingData;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -99,7 +99,7 @@
*/
boolean nonctrlKeyPressHandler(VpePageContext pageContext,
Document sourceDocument, Node sourceNode, nsIDOMNode visualNode,
- Object data, long charCode, VpeSourceSelection selection,
+ Object data, long charCode, SourceSelection selection,
ITextFormatter formatter);
/**
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -22,14 +22,14 @@
import org.w3c.dom.Node;
import org.jboss.tools.common.reporting.ProblemReportingHelper;
+import org.jboss.tools.jst.jsp.selection.SourceSelectionBuilder;
+import org.jboss.tools.jst.jsp.selection.SourceSelection;
+import org.jboss.tools.jst.jsp.selection.SelectedNodeInfo;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.mapping.VpeElementMapping;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.jboss.tools.vpe.editor.selection.VpeSelectedNodeInfo;
-import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
-import org.jboss.tools.vpe.editor.selection.VpeSourceSelectionBuilder;
import org.jboss.tools.vpe.editor.template.VpeTemplate;
import org.jboss.tools.vpe.editor.template.textformating.FormatData;
import org.jboss.tools.vpe.editor.template.textformating.TextFormatingData;
@@ -50,7 +50,7 @@
private FormatData currentFormatData;
private Node currentSelectedNode;
private Node currentSelectedElement; // Parent node If currentSelectedNode is Text.
- private VpeSelectedNodeInfo currentSelectedNodeInfo;
+ private SelectedNodeInfo currentSelectedNodeInfo;
private boolean controllerNotifedSelectionChange = false;
private String currentSelectedTagValue;
private boolean ignoreSelectionChanges = false;
@@ -76,7 +76,7 @@
public void selectionChanged() {
List cleanNodesList = getCleanSelectedNodesList();
if(cleanNodesList.size()==1) {
- VpeSelectedNodeInfo newNodeInfo = (VpeSelectedNodeInfo)cleanNodesList.get(0);
+ SelectedNodeInfo newNodeInfo = (SelectedNodeInfo)cleanNodesList.get(0);
if(newNodeInfo!=null) {
Node newNode = newNodeInfo.getNode();
if(currentSelectedNode == newNode && newNode.getNodeType() ==
Node.ELEMENT_NODE) {
@@ -162,7 +162,7 @@
}
}
- private TextFormatingData getParentFormatingDataForTextNode(VpeSelectedNodeInfo
selectedNodeInfo) {
+ private TextFormatingData getParentFormatingDataForTextNode(SelectedNodeInfo
selectedNodeInfo) {
Node selectedNode = selectedNodeInfo.getNode();
if(selectedNode instanceof TextImpl) {
// int startOffset =
selectedNodeInfo.getStartOffset()>selectedNodeInfo.getEndOffset()?selectedNodeInfo.getEndOffset():selectedNodeInfo.getStartOffset();
@@ -237,16 +237,16 @@
/**
* @return
*/
- public VpeSelectedNodeInfo computeSelectedNode() {
+ public SelectedNodeInfo computeSelectedNode() {
List nodes = getCleanSelectedNodesList();
if(nodes.size()==0) {
return null;
}
- return (VpeSelectedNodeInfo)nodes.get(0);
+ return (SelectedNodeInfo)nodes.get(0);
}
private List getCleanSelectedNodesList() {
- VpeSourceSelection selection = getSelection();
+ SourceSelection selection = getSelection();
if(selection==null) {
return new ArrayList();
}
@@ -259,7 +259,7 @@
ArrayList nodes = new ArrayList(dirtyNodesList.size());
HashSet parentNodes = new HashSet();
for(int i=0; i<dirtyNodesList.size(); i++) {
- VpeSelectedNodeInfo nodeInfo = (VpeSelectedNodeInfo)dirtyNodesList.get(i);
+ SelectedNodeInfo nodeInfo = (SelectedNodeInfo)dirtyNodesList.get(i);
Node node = nodeInfo.getNode();
if(parentNodes.contains(node.getParentNode())) {
// Ignore child node.
@@ -288,8 +288,8 @@
/**
* @return current selection
*/
- public VpeSourceSelection getSelection() {
- VpeSourceSelectionBuilder sourceSelectionBuilder = new
VpeSourceSelectionBuilder(vpeController.getSourceEditor());
+ public SourceSelection getSelection() {
+ SourceSelectionBuilder sourceSelectionBuilder = new
SourceSelectionBuilder(vpeController.getSourceEditor());
return sourceSelectionBuilder.getSelection();
}
@@ -331,7 +331,7 @@
/**
* @return Returns the currentSelectedNodeInfo.
*/
- public VpeSelectedNodeInfo getCurrentSelectedNodeInfo() {
+ public SelectedNodeInfo getCurrentSelectedNodeInfo() {
return currentSelectedNodeInfo;
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/IAddNodeHandler.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/IAddNodeHandler.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/IAddNodeHandler.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -12,7 +12,7 @@
import org.w3c.dom.Node;
-import org.jboss.tools.vpe.editor.selection.VpeSelectedNodeInfo;
+import org.jboss.tools.jst.jsp.selection.SelectedNodeInfo;
import org.jboss.tools.vpe.editor.template.textformating.FormatData;
/**
@@ -26,5 +26,5 @@
* @param node is Node which is adding children.
* @param selectedNode is Node which is selected.
*/
- public void run(FormatData formatData, Node node, VpeSelectedNodeInfo selectedNode);
+ public void run(FormatData formatData, Node node, SelectedNodeInfo selectedNode);
}
\ No newline at end of file
Deleted:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/NodesManagingUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/NodesManagingUtil.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/NodesManagingUtil.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.vpe.editor.util;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
-import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- *
- * @author S.Dzmitrovich
- *
- */
-public class NodesManagingUtil {
-
- /**
- * name of "view" tag
- */
- private static final String VIEW_TAGNAME = "view"; //$NON-NLS-1$
-
- /**
- * name of "locale" attribute
- */
- private static final String LOCALE_ATTRNAME = "locale"; //$NON-NLS-1$
-
- /**
- *
- * @param domMapping
- * @param node
- * @return
- */
- public static VpeNodeMapping getNodeMapping(VpeDomMapping domMapping,
- Node node) {
-
- return domMapping.getNearNodeMappingAtSourceNode(node);
-
- }
-
- /**
- *
- * @param domMapping
- * @param node
- * @return
- */
- public static VpeNodeMapping getNodeMapping(VpeDomMapping domMapping,
- nsIDOMNode node) {
-
- return domMapping.getNearNodeMappingAtVisualNode(node);
-
- }
-
- /**
- *
- * @param node
- * @return
- */
- public static int getNodeLength(Node node) {
-
- if ((node instanceof IDOMAttr)
- && (((IDOMAttr) node).getValueSource() != null)) {
- return ((IDOMAttr) node).getValueSource().length();
- } else if (node instanceof IndexedRegion) {
- return ((IndexedRegion) node).getEndOffset()
- - ((IndexedRegion) node).getStartOffset();
- }
- return 0;
- }
-
- /**
- * get start offset of node
- *
- * @param node
- * @return
- */
- public static int getStartOffsetNode(Node node) {
-
- if (node instanceof IDOMAttr) {
- return ((IDOMAttr) node).getValueRegionStartOffset() + 1;
- } else if (node instanceof IndexedRegion) {
- return ((IndexedRegion) node).getStartOffset();
- }
- return 0;
- }
-
- /**
- * get end offset of node
- *
- * @param node
- * @return
- */
- public static int getEndOffsetNode(Node node) {
-
- if (node instanceof IDOMAttr) {
- return getStartOffsetNode(node) + getNodeLength(node);
- } else if (node instanceof IndexedRegion) {
- return ((IndexedRegion) node).getEndOffset();
- }
- return 0;
- }
-
- /**
- *
- * @param node
- * @return
- */
- public static Point getNodeRange(Node node) {
-
- return new Point(getStartOffsetNode(node), getNodeLength(node));
-
- }
-
- /**
- * if position belong to node return true
- *
- * @param node
- * @param position
- * @return
- */
- public static boolean isNodeContainsPosition(Node node, int position) {
- return NodesManagingUtil.getStartOffsetNode(node) <= position
- && NodesManagingUtil.getEndOffsetNode(node) >= position;
- }
-
- /**
- *
- * @param pageContext
- * @param sourceElement
- * @return
- */
- public static String getPageLocale(VpePageContext pageContext,
- Node sourceNode) {
-
- while (sourceNode != null) {
-
- if (VIEW_TAGNAME.equals(sourceNode.getLocalName())) {
- break;
- }
- sourceNode = sourceNode.getParentNode();
- }
-
- if ((sourceNode == null) || !(sourceNode instanceof Element)
- || !(((Element) sourceNode).hasAttribute(LOCALE_ATTRNAME)))
- return null;
-
- String locale = ((Element) sourceNode).getAttribute(LOCALE_ATTRNAME);
-
- return locale;
-
- }
-
- /**
- *
- * @param pageContext
- * @param startPosition
- * @param endPosition
- * @return
- */
- public static String getSourceText(VpePageContext pageContext,
- int startPosition, int endPosition) {
-
- return pageContext.getSourceBuilder().getStructuredTextViewer()
- .getTextWidget().getText(startPosition, endPosition);
- }
-
- /**
- *
- * @param pageContext
- * @param startPosition
- * @param endPosition
- * @return
- */
- public static String getSourceText(Node node) {
-
- return ((IDOMNode) node).getSource();
- }
-
-}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -19,6 +19,7 @@
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.xml.core.internal.document.NodeImpl;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
@@ -147,7 +148,7 @@
// if focus node also contain anchor point (selected only 1 element)
if (focusNode != null
&& NodesManagingUtil.isNodeContainsPosition(focusNode, anchor)) {
- return NodesManagingUtil.getNodeMapping(domMapping, focusNode);
+ return VpeNodesManagingUtil.getNodeMapping(domMapping, focusNode);
}
return null;
}
@@ -278,7 +279,7 @@
if (focusNode != null) {
// if (NodesManagingUtil.isNodeContainsPosition(focusNode,
// anchor)) {
- return NodesManagingUtil.getNodeMapping(domMapping, focusNode);
+ return VpeNodesManagingUtil.getNodeMapping(domMapping, focusNode);
// }
}
} finally {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/TextUtil.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -19,6 +19,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.jboss.tools.jst.jsp.util.NodesManagingUtil;
import org.jboss.tools.vpe.VpePlugin;
import org.mozilla.interfaces.nsIDOMKeyEvent;
import org.w3c.dom.Node;
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 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2010-09-17
11:16:09 UTC (rev 24976)
@@ -29,8 +29,6 @@
public static String PREFERENCES;
public static String REFRESH;
public static String PAGE_DESIGN_OPTIONS;
- public static String HIDE_SELECTION_BAR;
- public static String SHOW_SELECTION_BAR;
public static String MOZILLA_LOADING_ERROR;
public static String MOZILLA_LOADING_ERROR_LINK_TEXT;
public static String MOZILLA_LOADING_ERROR_LINK;
@@ -64,9 +62,6 @@
public static String ITALIC;
public static String UNDERLINE;
public static String FOREGROUND_COLOR;
- 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;
public static String VPE_UPDATE_JOB_TITLE;
public static String VPE_VISUAL_REFRESH_JOB;
public static String VpeDnD_PLACE_AFTER_INSIDE;
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 2010-09-17
07:36:37 UTC (rev 24975)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2010-09-17
11:16:09 UTC (rev 24976)
@@ -6,8 +6,6 @@
PREFERENCES=Preferences
REFRESH=Refresh
PAGE_DESIGN_OPTIONS=Page Design Options
-HIDE_SELECTION_BAR=Hide selection bar
-SHOW_SELECTION_BAR=Show selection bar
MOZILLA_LOADING_ERROR=Could not open the Visual Page Editor: {0}
MOZILLA_LOADING_ERROR_LINK_TEXT=See JBoss Tools Visual Editor FAQ
# START NON-TRANSLATABLE
@@ -46,9 +44,6 @@
ITALIC=Italic
UNDERLINE=Underline
FOREGROUND_COLOR=Foreground Color
-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
VPE_UPDATE_JOB_TITLE=Visual Editor View Update
VPE_VISUAL_REFRESH_JOB=Visual Editor Refresh
@@ -123,7 +118,6 @@
EXTERNALIZE_STRINGS=Externalize strings
SHOW_BUNDLES_AS_MESSAGES=Show bundle's messages explicitly
ASK_TAG_ATTRIBUTES_ON_TAG_INSERT=Ask for tag attributes during tag insert
-ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR=Ask for confirmation when closing Selection
Bar
INFORM_WHEN_PROJECT_MIGHT_NOT_BE_CONFIGURED_PROPERLY_FOR_VPE=Inform when a project might
not be configured properly for Visual Page Editor
DEFAULT_VPE_TAB=Select the default active editor's tab
VISUAL_SOURCE_EDITORS_SPLITTING=Visual/Source editors splitting