JBoss Tools SVN: r20984 - trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-03-23 11:31:17 -0400 (Tue, 23 Mar 2010)
New Revision: 20984
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java
Log:
Use getPathToResources() when locating resources.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java 2010-03-23 15:28:45 UTC (rev 20983)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ImportUnknownTagsWizardTest.java 2010-03-23 15:31:17 UTC (rev 20984)
@@ -50,11 +50,7 @@
/*
* Load stored tags
*/
- Bundle bundle = Platform.getBundle("org.jboss.tools.vpe.ui.bot.test"); //$NON-NLS-1$
- URL url = bundle.getEntry("/resources"); //$NON-NLS-1$
- url = FileLocator.resolve(url);
- IPath path = new Path(url.getPath());
- File file = path.append(STORED_TAGS_PATH).toFile();
+ File file = new File (getPathToResources(STORED_TAGS_PATH));
assertTrue("File '" + file.getAbsolutePath() +"' does not exist.", file.exists()); //$NON-NLS-1$ //$NON-NLS-2$
bot.text().setText(file.getAbsolutePath());
/*
14 years, 7 months
JBoss Tools SVN: r20983 - trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-03-23 11:28:45 -0400 (Tue, 23 Mar 2010)
New Revision: 20983
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
Log:
Import proper Activator class.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2010-03-23 15:25:38 UTC (rev 20982)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2010-03-23 15:28:45 UTC (rev 20983)
@@ -15,7 +15,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.test.TestProperties;
-import org.jboss.tools.ui.bot.test.Activator;
+import org.jboss.tools.vpe.ui.bot.test.Activator;
import org.jboss.tools.ui.bot.test.JBTSWTBotTestCase;
import org.jboss.tools.ui.bot.test.SWTBotJSPMultiPageEditor;
import org.jboss.tools.ui.bot.test.WidgetVariables;
@@ -235,7 +235,14 @@
}
protected String getPathToResources(String testPage) throws IOException {
- String filePath = FileLocator.toFileURL(Platform.getBundle(Activator.PLUGIN_ID).getEntry("/")).getFile()+"resources/"+testPage; //$NON-NLS-1$//$NON-NLS-2$
+ String filePath = FileLocator
+ .toFileURL(
+ Platform.getBundle(Activator.PLUGIN_ID)
+ .getEntry("/"))
+ .getFile()+
+ "resources/"
+ +
+ testPage; //$NON-NLS-1$//$NON-NLS-2$
File file = new File(filePath);
if (!file.isFile()) {
filePath = FileLocator.toFileURL(Platform.getBundle(Activator.PLUGIN_ID).getEntry("/")).getFile()+testPage; //$NON-NLS-1$
14 years, 7 months
JBoss Tools SVN: r20982 - trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-03-23 11:25:38 -0400 (Tue, 23 Mar 2010)
New Revision: 20982
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
Log:
Added possibility to specify connection profile name when creating connection profile
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-03-23 14:25:55 UTC (rev 20981)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-03-23 15:25:38 UTC (rev 20982)
@@ -29,7 +29,7 @@
* @throws ConnectionProfileException
* @return driver instance
*/
- public static void createDriver(DriverEntity entity) throws ConnectionProfileException {
+ public static void createDriver(DriverEntity entity, String profileName) throws ConnectionProfileException {
String driverPath;
try {
driverPath = new File(entity.getDrvPath()).getCanonicalPath(); //$NON-NLS-1$
@@ -67,7 +67,7 @@
}
driver = DriverManager.getInstance().getDriverInstanceByName(entity.getInstanceName());
- if (driver != null && ProfileManager.getInstance().getProfileByName("DefaultDS") == null) { //$NON-NLS-1$
+ if (driver != null && ProfileManager.getInstance().getProfileByName(profileName) == null) { //$NON-NLS-1$
// create profile
Properties props = new Properties();
props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, "DriverDefn.Hypersonic DB");
@@ -84,4 +84,14 @@
ProfileManager.getInstance().createProfile(entity.getProfileName(), entity.getProfileDescription(), IDBConnectionProfileConstants.CONNECTION_PROFILE_ID, props, "", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
+
+ /**
+ * Create HSQLDB Driver and default connection profile
+ * @throws ConnectionProfileException
+ * @return driver instance
+ */
+ public static void createDriver(DriverEntity entity) throws ConnectionProfileException {
+ createDriver(entity,"DefaultDS");
+ }
+
}
14 years, 7 months
JBoss Tools SVN: r20981 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe: editor and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2010-03-23 10:25:55 -0400 (Tue, 23 Mar 2010)
New Revision: 20981
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualCaretInfo.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5042
Enhance DnD support in VPE
VPE Refactoring
- Drag&Drop-related methods have been moved from VpeSelectionBuilder to VpeDnD.
- Other minor changes like commenting unused methods etc.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-03-23 13:33:10 UTC (rev 20980)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-03-23 14:25:55 UTC (rev 20981)
@@ -14,6 +14,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
@@ -35,11 +36,14 @@
import org.jboss.tools.vpe.editor.VpeSourceInnerDragInfo;
import org.jboss.tools.vpe.editor.VpeSourceInnerDropInfo;
import org.jboss.tools.vpe.editor.VpeVisualCaretInfo;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.VpeVisualInnerDragInfo;
import org.jboss.tools.vpe.editor.VpeVisualInnerDropInfo;
import org.jboss.tools.vpe.editor.mozilla.MozillaDropInfo;
import org.jboss.tools.vpe.editor.mozilla.listener.MozillaDndListener;
import org.jboss.tools.vpe.editor.selection.VpeSelectionController;
+import org.jboss.tools.vpe.editor.template.VpePseudoContentCreator;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.jboss.tools.vpe.editor.util.VpeDndUtil;
import org.jboss.tools.vpe.xulrunner.XPCOM;
@@ -49,7 +53,9 @@
import org.mozilla.interfaces.nsIDOMEvent;
import org.mozilla.interfaces.nsIDOMEventTarget;
import org.mozilla.interfaces.nsIDOMMouseEvent;
+import org.mozilla.interfaces.nsIDOMNSUIEvent;
import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
import org.mozilla.interfaces.nsIDragService;
import org.mozilla.interfaces.nsIFile;
import org.mozilla.interfaces.nsISelectionController;
@@ -71,6 +77,8 @@
* Class responsible for Drag&Drop functionality
*/
public class VpeDnD implements MozillaDndListener {
+ private static int HUGE_DISTANCE = 999999;
+
/*
* Default transfer data
*/
@@ -140,7 +148,7 @@
* Starts drag session
* @param dragetElement
*/
- public void startDragSession(nsIDOMEvent domEvent) {
+ private void startDragSession(nsIDOMEvent domEvent) {
nsISupportsArray transArray = (nsISupportsArray) getComponentManager()
.createInstanceByContractID(XPCOM.NS_SUPPORTSARRAY_CONTRACTID, null,
nsISupportsArray.NS_ISUPPORTSARRAY_IID);
@@ -183,44 +191,6 @@
return iTransferable;
}
- /**
- * @return the componentManager
- */
- public nsIComponentManager getComponentManager() {
-
- if(componentManager==null) {
-
- componentManager = Mozilla.getInstance()
- .getComponentManager();
- }
- return componentManager;
- }
-
- /**
- * @return the serviceManager
- */
- public nsIServiceManager getServiceManager() {
-
- if(serviceManager==null) {
- serviceManager = Mozilla.getInstance()
- .getServiceManager();
- }
- return serviceManager;
- }
-
- /**
- * @return the dragService
- */
- public nsIDragService getDragService() {
-
- if(dragService==null) {
- dragService = (nsIDragService) getServiceManager()
- .getServiceByContractID(XPCOM.NS_DRAGSERVICE_CONTRACTID,
- nsIDragService.NS_IDRAGSERVICE_IID);
- }
- return dragService;
- }
-
private void refreshCanDrop(nsIDOMEvent event) {
boolean canDrop = true;
@@ -266,7 +236,7 @@
mouseEvent.stopPropagation();
}
- public void externalDropAny(final String flavor, final String data, final Point range,
+ private void externalDropAny(final String flavor, final String data, final Point range,
Node container) {
if (flavor == null || flavor.length() == 0)
return;
@@ -296,7 +266,7 @@
dropCommand.execute(dropData);
}
- public boolean canInnerDrag(nsIDOMMouseEvent event) {
+ private boolean canInnerDrag(nsIDOMMouseEvent event) {
vpeController.onHideTooltip();
if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
@@ -307,8 +277,7 @@
innerDragInfo = null;
}
boolean canDrag = false;
- VpeVisualInnerDragInfo dragInfo = vpeController.getSelectionBuilder()
- .getInnerDragInfo(event);
+ VpeVisualInnerDragInfo dragInfo = getInnerDragInfo(event);
if (dragInfo != null) {
nsIDOMNode dragNode = dragInfo.getNode();
if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
@@ -351,7 +320,7 @@
return canDrag;
}
- public MozillaDropInfo canInnerDrop(nsIDOMMouseEvent event) {
+ private MozillaDropInfo canInnerDrop(nsIDOMMouseEvent event) {
vpeController.onHideTooltip();
if (vpeController.getDropWindow().isActive()) {
@@ -383,8 +352,7 @@
nsIDOMNode caretParent = null;
long caretOffset = 0;
if (innerDragInfo != null) {
- VpeVisualInnerDropInfo visualDropInfo = vpeController.getSelectionBuilder()
- .getInnerDropInfo(event);
+ VpeVisualInnerDropInfo visualDropInfo = getInnerDropInfo(event);
if (visualDropInfo.getDropContainer() != null) {
if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
System.out.print(" x: " //$NON-NLS-1$
@@ -429,15 +397,14 @@
return new MozillaDropInfo(canDrop, caretParent, caretOffset);
}
- public void innerDrop(nsIDOMMouseEvent event) {
+ private void innerDrop(nsIDOMMouseEvent event) {
vpeController.onHideTooltip();
if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
System.out.print("<<<<<< innerDrop"); //$NON-NLS-1$
}
if (innerDragInfo != null) {
- VpeVisualInnerDropInfo visualDropInfo = vpeController.getSelectionBuilder()
- .getInnerDropInfo(event);
+ VpeVisualInnerDropInfo visualDropInfo = getInnerDropInfo(event);
if (visualDropInfo.getDropContainer() != null) {
if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
System.out
@@ -477,11 +444,10 @@
}
}
- public void externalDrop(nsIDOMMouseEvent mouseEvent, String flavor, String data) {
+ private void externalDrop(nsIDOMMouseEvent mouseEvent, String flavor, String data) {
vpeController.onHideTooltip();
- VpeVisualInnerDropInfo visualDropInfo = vpeController.getSelectionBuilder()
- .getInnerDropInfo(mouseEvent);
+ VpeVisualInnerDropInfo visualDropInfo = getInnerDropInfo(mouseEvent);
Point range = vpeController.getSelectionBuilder().getSourceSelectionRangeAtVisualNode(
visualDropInfo.getDropContainer(), (int) visualDropInfo
.getDropOffset());
@@ -558,7 +524,7 @@
}
}
- public MozillaDropInfo canExternalDrop(nsIDOMMouseEvent mouseEvent, String flavor, String data) {
+ private MozillaDropInfo canExternalDrop(nsIDOMMouseEvent mouseEvent, String flavor, String data) {
InnerDragBuffer.object = null;
vpeController.onHideTooltip();
@@ -605,8 +571,7 @@
&& !TLDUtil.isTaglib(object)) {
IFile f = (IFile) EclipseResourceUtil.getResource(object);
canDrop = f != null;
- VpeVisualInnerDropInfo visualDropInfo = vpeController.getSelectionBuilder()
- .getInnerDropInfo(mouseEvent);
+ VpeVisualInnerDropInfo visualDropInfo = getInnerDropInfo(mouseEvent);
caretParent = visualDropInfo.getDropContainer();
caretOffset = visualDropInfo.getDropOffset();
} else {
@@ -614,8 +579,7 @@
if (tagname.indexOf("taglib") >= 0)tagname = "taglib"; //$NON-NLS-1$ //$NON-NLS-2$
Node sourceDragNode = ((Document) vpeController.getModel().getAdapter(
Document.class)).createElement(tagname);
- VpeVisualInnerDropInfo visualDropInfo = vpeController.getSelectionBuilder()
- .getInnerDropInfo(mouseEvent);
+ VpeVisualInnerDropInfo visualDropInfo = getInnerDropInfo(mouseEvent);
if (visualDropInfo.getDropContainer() != null) {
VpeSourceInnerDropInfo sourceDropInfo = vpeController.getVisualBuilder()
.getSourceInnerDropInfo(sourceDragNode,
@@ -638,8 +602,7 @@
}
} else if (XulRunnerEditor.TRANS_FLAVOR_kFileMime.equals(flavor)
|| XulRunnerEditor.TRANS_FLAVOR_kURLMime.equals(flavor)) {
- VpeVisualInnerDropInfo visualDropInfo = vpeController.getSelectionBuilder()
- .getInnerDropInfo(mouseEvent);
+ VpeVisualInnerDropInfo visualDropInfo = getInnerDropInfo(mouseEvent);
caretParent = visualDropInfo.getDropContainer();
caretOffset = visualDropInfo.getDropOffset();
canDrop = true;
@@ -653,6 +616,269 @@
}
+ /**
+ * @return the componentManager
+ */
+ private nsIComponentManager getComponentManager() {
+
+ if(componentManager==null) {
+
+ componentManager = Mozilla.getInstance()
+ .getComponentManager();
+ }
+ return componentManager;
+ }
+
+ /**
+ * @return the serviceManager
+ */
+ private nsIServiceManager getServiceManager() {
+
+ if(serviceManager==null) {
+ serviceManager = Mozilla.getInstance()
+ .getServiceManager();
+ }
+ return serviceManager;
+ }
+
+ /**
+ * @return the dragService
+ */
+ private nsIDragService getDragService() {
+
+ if(dragService==null) {
+ dragService = (nsIDragService) getServiceManager()
+ .getServiceByContractID(XPCOM.NS_DRAGSERVICE_CONTRACTID,
+ nsIDragService.NS_IDRAGSERVICE_IID);
+ }
+ return dragService;
+ }
+
+ private VpeVisualInnerDragInfo getInnerDragInfo(nsIDOMMouseEvent event) {
+ nsIDOMElement selectedElement = vpeController.getVisualBuilder().getXulRunnerEditor().getLastSelectedElement();
+ if (selectedElement == null) {
+ return null;
+ } else {
+ return new VpeVisualInnerDragInfo(selectedElement);
+ }
+
+ // fix of JBIDE-4998
+// nsISelection selection = visualSelectionController.getSelection(
+// nsISelectionController.SELECTION_NORMAL);
+// nsIDOMNode focusNode = selection.getFocusNode();
+// nsIDOMNode anchorNode = selection.getAnchorNode();
+// //when we select input this function return null
+// //but we select elemnt
+// if(focusNode==null && anchorNode==null) {
+// nsIDOMNode visualNode =(nsIDOMNode) event.getTarget()
+// .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+// //fix of JBIDE-1097
+// if(HTML.TAG_SPAN.equalsIgnoreCase(visualNode.getNodeName())) {
+// if(visualBuilder.getXulRunnerEditor().getLastSelectedElement() != null
+// && !visualBuilder.getNodeBounds(
+// visualBuilder.getXulRunnerEditor()
+// .getLastSelectedElement())
+// .contains(VisualDomUtil.getMousePoint(event))) {
+// return null;
+// }
+// }
+// int offset = (int) VisualDomUtil.getOffset(visualNode);
+// selection.removeAllRanges();
+// selection.collapse(visualNode.getParentNode(), offset);
+// try {
+// selection.extend(visualNode.getParentNode(), offset + 1);
+// } catch(XPCOMException ex) {
+// //just ignore exception
+// // throws when we trying drag element which already resizing
+// return null;
+// }
+// focusNode = selection.getFocusNode();
+// anchorNode = selection.getAnchorNode();
+// }
+// if (focusNode != null && focusNode.equals(anchorNode)) {
+// int focusOffset = selection.getFocusOffset();
+// int anchorOffset = selection.getAnchorOffset();
+// int offset = Math.min(focusOffset, anchorOffset);
+// int length = Math.max(focusOffset, anchorOffset) - offset;
+//
+// int focusNodeType = focusNode.getNodeType();
+// if (focusNodeType == nsIDOMNode.ELEMENT_NODE) {
+// if (length == 1) {
+// nsIDOMNodeList children = focusNode.getChildNodes();
+// nsIDOMNode selectedNode = children.item(
+// Math.min(focusOffset, anchorOffset));
+// if (visualBuilder.getNodeBounds(selectedNode).contains(VisualDomUtil.getMousePoint(event))) {
+// int selectedNodeType = selectedNode.getNodeType();
+// if (selectedNodeType == nsIDOMNode.ELEMENT_NODE) {
+// return new VpeVisualInnerDragInfo((nsIDOMElement)selectedNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID));
+// } else if (selectedNodeType == nsIDOMNode.TEXT_NODE) {
+// return new VpeVisualInnerDragInfo(selectedNode, 0, selectedNode.getNodeValue().length());
+// }
+// }
+// }
+// } else if (focusNodeType == nsIDOMNode.TEXT_NODE) {
+// return new VpeVisualInnerDragInfo(focusNode, offset, length);
+// }
+// }
+//
+// return null;
+ }
+
+ private VpeVisualInnerDropInfo getInnerDropInfo(nsIDOMEvent event) {
+ nsIDOMNSUIEvent nsuiEvent = (nsIDOMNSUIEvent) event.queryInterface(nsIDOMNSUIEvent.NS_IDOMNSUIEVENT_IID);
+ nsIDOMNode dropContainer = null;
+ int dropOffset = 0;
+ int mouseX = nsuiEvent.getPageX();
+ int mouseY = nsuiEvent.getPageY();
+ nsIDOMNode originalNode = vpeController.getVisualBuilder().getOriginalTargetNode(event);
+ if (originalNode == null || originalNode.getParentNode() == null ||
+ originalNode.getParentNode().getNodeType() == Node.DOCUMENT_NODE) {
+ return new VpeVisualInnerDropInfo(null, 0, mouseX, mouseY);
+ }
+ if (originalNode.getNodeType() == Node.TEXT_NODE) {
+ dropContainer = nsuiEvent.getRangeParent();
+ nsIDOMNode containerForPseudoContent = VpePseudoContentCreator.getContainerForPseudoContent(dropContainer);
+ if (containerForPseudoContent != null) {
+ dropContainer = containerForPseudoContent;
+ dropOffset = 0;
+ } else {
+ dropOffset = nsuiEvent.getRangeOffset();
+ }
+ } else {
+ int closestXDistance = HUGE_DISTANCE;
+ int closestYDistance = HUGE_DISTANCE;
+ boolean inNodeFlag = false;
+ nsIDOMNode closestNode = null;
+
+ nsIDOMNodeList childen = originalNode.getChildNodes();
+ long count = childen.getLength();
+ for (long i = 0; i < count; i++) {
+ nsIDOMNode child = childen.item(i);
+ if (VpeVisualDomBuilder.isPseudoElement(child) || VpeVisualDomBuilder.isAnonElement(child)) {
+ continue;
+ }
+ Rectangle rect = vpeController.getVisualBuilder().getNodeBounds(child);
+ int fromTop = mouseY - rect.y;
+ int fromBottom = mouseY - rect.y - rect.height;
+
+ int yDistance;
+ if (fromTop > 0 && fromBottom < 0) {
+ yDistance = 0;
+ } else {
+ yDistance = Math.min(Math.abs(fromTop), Math.abs(fromBottom));
+ }
+
+ if (yDistance <= closestYDistance && rect.width > 0 && rect.height > 0) {
+ if (yDistance < closestYDistance) {
+ closestXDistance = HUGE_DISTANCE;
+ }
+ int fromLeft = mouseX - rect.x;
+ int fromRight = mouseX - rect.x - rect.width;
+
+ int xDistance;
+ if (fromLeft > 0 && fromRight < 0) {
+ xDistance = 0;
+ } else {
+ xDistance = Math.min(Math.abs(fromLeft), Math.abs(fromRight));
+ }
+ if (xDistance == 0 && yDistance == 0) {
+ closestNode = child;
+ inNodeFlag = true;
+ break;
+ }
+
+ if (xDistance < closestXDistance || (xDistance == closestXDistance && rect.x <= mouseX)) {
+ closestXDistance = xDistance;
+ closestYDistance = yDistance;
+ closestNode = child;
+ }
+ }
+ }
+
+ if (closestNode == null) {
+ closestNode = originalNode;
+ inNodeFlag = true;
+ }
+ if (inNodeFlag) {
+ if (closestNode.getNodeType() == Node.TEXT_NODE) {
+ dropContainer = nsuiEvent.getRangeParent();
+ dropOffset = nsuiEvent.getRangeOffset();
+ } else {
+ if (HTML.TAG_COLGROUP.equalsIgnoreCase(closestNode.getNodeName())) {
+ nsIDOMNode nearChild = getNearChild(closestNode, mouseX, mouseY);
+ if (nearChild != null && nearChild.getNodeType() == Node.ELEMENT_NODE) {
+ dropContainer = nearChild;
+ } else {
+ dropContainer = closestNode;
+ }
+ } else {
+ dropContainer = closestNode;
+ }
+ dropOffset = 0;
+ }
+ } else {
+ dropContainer = closestNode.getParentNode();
+ dropOffset = (int)VisualDomUtil.getOffset(closestNode);
+ Rectangle rect = vpeController.getVisualBuilder().getNodeBounds(closestNode);
+ if (VpeVisualDomBuilder.canInsertAfter(mouseX, mouseY, rect)) {
+ dropOffset++;
+ }
+ }
+ }
+ VpeVisualInnerDropInfo info = new VpeVisualInnerDropInfo(dropContainer, dropOffset, mouseX, mouseY);
+ return info;
+ }
+
+ private nsIDOMNode getNearChild(nsIDOMNode container, int x, int y) {
+ int closestXDistance = HUGE_DISTANCE;
+ int closestYDistance = HUGE_DISTANCE;
+ nsIDOMNode closestNode = null;
+
+ nsIDOMNodeList childen = container.getChildNodes();
+ long count = childen.getLength();
+ for (long i = 0; i < count; i++) {
+ nsIDOMNode child = childen.item(i);
+ if (VpeVisualDomBuilder.isPseudoElement(child) || VpeVisualDomBuilder.isAnonElement(child)) {
+ continue;
+ }
+ Rectangle rect = vpeController.getVisualBuilder().getNodeBounds(child);
+ int fromTop = y - rect.y;
+ int fromBottom = y - rect.y - rect.height;
+
+ int yDistance;
+ if (fromTop > 0 && fromBottom < 0) {
+ yDistance = 0;
+ } else {
+ yDistance = Math.min(Math.abs(fromTop), Math.abs(fromBottom));
+ }
+
+ if (yDistance <= closestYDistance && rect.width > 0 && rect.height > 0) {
+ if (yDistance < closestYDistance) {
+ closestXDistance = HUGE_DISTANCE;
+ }
+ int fromLeft = x - rect.x;
+ int fromRight = x - rect.x - rect.width;
+
+ int xDistance;
+ if (fromLeft > 0 && fromRight < 0) {
+ xDistance = 0;
+ } else {
+ xDistance = Math.min(Math.abs(fromLeft), Math.abs(fromRight));
+ }
+ if (xDistance == 0 && yDistance == 0) {
+ closestNode = child;
+ break;
+ }
+ if (xDistance < closestXDistance || (xDistance == closestXDistance && rect.x <= x)) {
+ closestXDistance = xDistance;
+ closestYDistance = yDistance;
+ closestNode = child;
+ }
+ }
+ }
+ return closestNode;
+ }
+
// this method is never used
// public VpeSourceInnerDropInfo canExternalDropMacro(XModelObject object, Node parentNode, int offset) {
// String tagname = vpeController.getTagName(object);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java 2010-03-23 13:33:10 UTC (rev 20980)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java 2010-03-23 14:25:55 UTC (rev 20981)
@@ -12,7 +12,6 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.xml.core.internal.document.CommentImpl;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
@@ -23,9 +22,7 @@
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
import org.jboss.tools.vpe.editor.selection.VpeSelectionController;
import org.jboss.tools.vpe.editor.template.VpePseudoContentCreator;
-import org.jboss.tools.vpe.editor.template.VpeTemplate;
import org.jboss.tools.vpe.editor.util.HTML;
-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.xulrunner.editor.XulRunnerEditor;
@@ -41,7 +38,6 @@
import org.mozilla.interfaces.nsISelection;
import org.mozilla.interfaces.nsISelectionController;
import org.mozilla.interfaces.nsISelectionDisplay;
-import org.mozilla.xpcom.XPCOMException;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -854,13 +850,15 @@
return new VpeVisualCaretInfo(this, nsuiEvent.getRangeParent(), nsuiEvent.getRangeOffset());
}
- void showVisualDragCaret(nsIDOMNode node, int offset) {
- visualBuilder.showDragCaret(node, offset);
- }
+//this method is never used
+// void showVisualDragCaret(nsIDOMNode node, int offset) {
+// visualBuilder.showDragCaret(node, offset);
+// }
- void hideVisualDragCaret() {
- visualBuilder.hideDragCaret();
- }
+//this method is never used
+// void hideVisualDragCaret() {
+// visualBuilder.hideDragCaret();
+// }
int getSourcePosition(nsIDOMNode visualInitNode, int visualInitOffset) {
int position = 0;
@@ -964,180 +962,9 @@
return new Point(position, offset);
}
- nsIDOMNode getOriginalTargetNode(nsIDOMEvent event) {
- nsIDOMNode targetNode = VisualDomUtil.getTargetNode(event);
- if (HTML.TAG_INPUT.equalsIgnoreCase(targetNode.getNodeName())) {
- return targetNode;
- }
- nsIDOMNSEvent nsEvent = (nsIDOMNSEvent) event.queryInterface(nsIDOMNSEvent.NS_IDOMNSEVENT_IID);
- // TODO Sergey Vasilyev figure out with TmpRealOriginalTarget
-// nsIDOMEventTarget target = nsEvent.getTmpRealOriginalTarget();
- nsIDOMEventTarget target = nsEvent.getOriginalTarget();
- nsIDOMNode originalNode = (nsIDOMNode) target.queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
- if (VpeVisualDomBuilder.isAnonElement(originalNode)) {
- originalNode = visualBuilder.getLastSelectedElement();
- }
- return originalNode;
- }
-
- public VpeVisualInnerDropInfo getInnerDropInfo(nsIDOMEvent event) {
- nsIDOMNSUIEvent nsuiEvent = (nsIDOMNSUIEvent) event.queryInterface(nsIDOMNSUIEvent.NS_IDOMNSUIEVENT_IID);
- nsIDOMNode dropContainer = null;
- int dropOffset = 0;
- int mouseX = nsuiEvent.getPageX();
- int mouseY = nsuiEvent.getPageY();
- nsIDOMNode originalNode = getOriginalTargetNode(event);
- if (originalNode == null || originalNode.getParentNode() == null ||
- originalNode.getParentNode().getNodeType() == Node.DOCUMENT_NODE) {
- return new VpeVisualInnerDropInfo(null, 0, mouseX, mouseY);
- }
- if (originalNode.getNodeType() == Node.TEXT_NODE) {
- dropContainer = nsuiEvent.getRangeParent();
- nsIDOMNode containerForPseudoContent = VpePseudoContentCreator.getContainerForPseudoContent(dropContainer);
- if (containerForPseudoContent != null) {
- dropContainer = containerForPseudoContent;
- dropOffset = 0;
- } else {
- dropOffset = nsuiEvent.getRangeOffset();
- }
- } else {
- int closestXDistance = HUGE_DISTANCE;
- int closestYDistance = HUGE_DISTANCE;
- boolean inNodeFlag = false;
- nsIDOMNode closestNode = null;
-
- nsIDOMNodeList childen = originalNode.getChildNodes();
- long count = childen.getLength();
- for (long i = 0; i < count; i++) {
- nsIDOMNode child = childen.item(i);
- if (VpeVisualDomBuilder.isPseudoElement(child) || VpeVisualDomBuilder.isAnonElement(child)) {
- continue;
- }
- Rectangle rect = visualBuilder.getNodeBounds(child);
- int fromTop = mouseY - rect.y;
- int fromBottom = mouseY - rect.y - rect.height;
-
- int yDistance;
- if (fromTop > 0 && fromBottom < 0) {
- yDistance = 0;
- } else {
- yDistance = Math.min(Math.abs(fromTop), Math.abs(fromBottom));
- }
-
- if (yDistance <= closestYDistance && rect.width > 0 && rect.height > 0) {
- if (yDistance < closestYDistance) {
- closestXDistance = HUGE_DISTANCE;
- }
- int fromLeft = mouseX - rect.x;
- int fromRight = mouseX - rect.x - rect.width;
-
- int xDistance;
- if (fromLeft > 0 && fromRight < 0) {
- xDistance = 0;
- } else {
- xDistance = Math.min(Math.abs(fromLeft), Math.abs(fromRight));
- }
- if (xDistance == 0 && yDistance == 0) {
- closestNode = child;
- inNodeFlag = true;
- break;
- }
-
- if (xDistance < closestXDistance || (xDistance == closestXDistance && rect.x <= mouseX)) {
- closestXDistance = xDistance;
- closestYDistance = yDistance;
- closestNode = child;
- }
- }
- }
-
- if (closestNode == null) {
- closestNode = originalNode;
- inNodeFlag = true;
- }
- if (inNodeFlag) {
- if (closestNode.getNodeType() == Node.TEXT_NODE) {
- dropContainer = nsuiEvent.getRangeParent();
- dropOffset = nsuiEvent.getRangeOffset();
- } else {
- if (HTML.TAG_COLGROUP.equalsIgnoreCase(closestNode.getNodeName())) {
- nsIDOMNode nearChild = getNearChild(closestNode, mouseX, mouseY);
- if (nearChild != null && nearChild.getNodeType() == Node.ELEMENT_NODE) {
- dropContainer = nearChild;
- } else {
- dropContainer = closestNode;
- }
- } else {
- dropContainer = closestNode;
- }
- dropOffset = 0;
- }
- } else {
- dropContainer = closestNode.getParentNode();
- dropOffset = (int)VisualDomUtil.getOffset(closestNode);
- Rectangle rect = visualBuilder.getNodeBounds(closestNode);
- if (VpeVisualDomBuilder.canInsertAfter(mouseX, mouseY, rect)) {
- dropOffset++;
- }
- }
- }
- VpeVisualInnerDropInfo info = new VpeVisualInnerDropInfo(dropContainer, dropOffset, mouseX, mouseY);
- return info;
- }
-
- private nsIDOMNode getNearChild(nsIDOMNode container, int x, int y) {
- int closestXDistance = HUGE_DISTANCE;
- int closestYDistance = HUGE_DISTANCE;
- nsIDOMNode closestNode = null;
-
- nsIDOMNodeList childen = container.getChildNodes();
- long count = childen.getLength();
- for (long i = 0; i < count; i++) {
- nsIDOMNode child = childen.item(i);
- if (VpeVisualDomBuilder.isPseudoElement(child) || VpeVisualDomBuilder.isAnonElement(child)) {
- continue;
- }
- Rectangle rect = visualBuilder.getNodeBounds(child);
- int fromTop = y - rect.y;
- int fromBottom = y - rect.y - rect.height;
-
- int yDistance;
- if (fromTop > 0 && fromBottom < 0) {
- yDistance = 0;
- } else {
- yDistance = Math.min(Math.abs(fromTop), Math.abs(fromBottom));
- }
-
- if (yDistance <= closestYDistance && rect.width > 0 && rect.height > 0) {
- if (yDistance < closestYDistance) {
- closestXDistance = HUGE_DISTANCE;
- }
- int fromLeft = x - rect.x;
- int fromRight = x - rect.x - rect.width;
-
- int xDistance;
- if (fromLeft > 0 && fromRight < 0) {
- xDistance = 0;
- } else {
- xDistance = Math.min(Math.abs(fromLeft), Math.abs(fromRight));
- }
- if (xDistance == 0 && yDistance == 0) {
- closestNode = child;
- break;
- }
- if (xDistance < closestXDistance || (xDistance == closestXDistance && rect.x <= x)) {
- closestXDistance = xDistance;
- closestYDistance = yDistance;
- closestNode = child;
- }
- }
- }
- return closestNode;
- }
-
void setVisualElementSelection(nsIDOMMouseEvent mouseEvent) {
nsISelection selection = visualSelectionController.getSelection(nsISelectionController.SELECTION_NORMAL);
- nsIDOMNode visualNode = getOriginalTargetNode(mouseEvent);
+ nsIDOMNode visualNode = visualBuilder.getOriginalTargetNode(mouseEvent);
if (selection.containsNode(visualNode, false) || VpeVisualDomBuilder.isAnonElement(visualNode)) {
return;
}
@@ -1154,37 +981,38 @@
}
- nsIDOMElement getDragElement(nsIDOMMouseEvent mouseEvent) {
- nsIDOMElement dragElement = visualBuilder.getDragElement(mouseEvent);
- if (dragElement != null) {
- return dragElement;
- }
-
- nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
- //FIX FOR JBIDE-1468 added by Sergey Dzmitrovich
- if (visualNode != null
- && visualNode.getNodeType() == Node.ELEMENT_NODE
- && (HTML.TAG_INPUT.equalsIgnoreCase(visualNode.getNodeName())
- || HTML.TAG_OPTION.equalsIgnoreCase(visualNode
- .getNodeName())
- || HTML.TAG_BUTTON.equalsIgnoreCase(visualNode
- .getNodeName()) || HTML.TAG_SELECT
- .equalsIgnoreCase(visualNode.getNodeName()))
- /*&& !selection.containsNode(visualNode, false)*/
- && visualBuilder.canInnerDrag((nsIDOMElement) visualNode
- .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID))) {
- return (nsIDOMElement) visualNode
- .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- }
- return null;
- }
+//this method is never used
+// nsIDOMElement getDragElement(nsIDOMMouseEvent mouseEvent) {
+// nsIDOMElement dragElement = visualBuilder.getDragElement(mouseEvent);
+// if (dragElement != null) {
+// return dragElement;
+// }
+//
+// nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
+// //FIX FOR JBIDE-1468 added by Sergey Dzmitrovich
+// if (visualNode != null
+// && visualNode.getNodeType() == Node.ELEMENT_NODE
+// && (HTML.TAG_INPUT.equalsIgnoreCase(visualNode.getNodeName())
+// || HTML.TAG_OPTION.equalsIgnoreCase(visualNode
+// .getNodeName())
+// || HTML.TAG_BUTTON.equalsIgnoreCase(visualNode
+// .getNodeName()) || HTML.TAG_SELECT
+// .equalsIgnoreCase(visualNode.getNodeName()))
+// /*&& !selection.containsNode(visualNode, false)*/
+// && visualBuilder.canInnerDrag((nsIDOMElement) visualNode
+// .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID))) {
+// return (nsIDOMElement) visualNode
+// .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+// }
+// return null;
+// }
nsIDOMElement getAppropriateElementForSelection(nsIDOMEvent event) {
nsISelection selection = visualSelectionController.getSelection(nsISelectionController.SELECTION_NORMAL);
nsIDOMNode visualNode = VisualDomUtil.getTargetNode(event);
if (visualNode != null) {
if (!HTML.TAG_INPUT.equalsIgnoreCase(visualNode.getNodeName())) {
- visualNode = getOriginalTargetNode(event);
+ visualNode = visualBuilder.getOriginalTargetNode(event);
}
if (visualNode != null && visualNode.getNodeType() == Node.ELEMENT_NODE && !selection.containsNode((nsIDOMNode)visualNode, false)) {
VpeElementMapping elementMapping = domMapping.getNearElementMapping(visualNode);
@@ -1208,77 +1036,6 @@
setSelection(selection);
}
- public VpeVisualInnerDragInfo getInnerDragInfo(nsIDOMMouseEvent event) {
- nsIDOMElement selectedElement
- = visualBuilder.getXulRunnerEditor().getLastSelectedElement();
- if (selectedElement == null) {
- return null;
- } else {
- return new VpeVisualInnerDragInfo(selectedElement);
- }
-
- // fix of JBIDE-4998
-// nsISelection selection = visualSelectionController.getSelection(
-// nsISelectionController.SELECTION_NORMAL);
-// nsIDOMNode focusNode = selection.getFocusNode();
-// nsIDOMNode anchorNode = selection.getAnchorNode();
-// //when we select input this function return null
-// //but we select elemnt
-// if(focusNode==null && anchorNode==null) {
-// nsIDOMNode visualNode =(nsIDOMNode) event.getTarget()
-// .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
-// //fix of JBIDE-1097
-// if(HTML.TAG_SPAN.equalsIgnoreCase(visualNode.getNodeName())) {
-// if(visualBuilder.getXulRunnerEditor().getLastSelectedElement() != null
-// && !visualBuilder.getNodeBounds(
-// visualBuilder.getXulRunnerEditor()
-// .getLastSelectedElement())
-// .contains(VisualDomUtil.getMousePoint(event))) {
-// return null;
-// }
-// }
-// int offset = (int) VisualDomUtil.getOffset(visualNode);
-// selection.removeAllRanges();
-// selection.collapse(visualNode.getParentNode(), offset);
-// try {
-// selection.extend(visualNode.getParentNode(), offset + 1);
-// } catch(XPCOMException ex) {
-// //just ignore exception
-// // throws when we trying drag element which already resizing
-// return null;
-// }
-// focusNode = selection.getFocusNode();
-// anchorNode = selection.getAnchorNode();
-// }
-// if (focusNode != null && focusNode.equals(anchorNode)) {
-// int focusOffset = selection.getFocusOffset();
-// int anchorOffset = selection.getAnchorOffset();
-// int offset = Math.min(focusOffset, anchorOffset);
-// int length = Math.max(focusOffset, anchorOffset) - offset;
-//
-// int focusNodeType = focusNode.getNodeType();
-// if (focusNodeType == nsIDOMNode.ELEMENT_NODE) {
-// if (length == 1) {
-// nsIDOMNodeList children = focusNode.getChildNodes();
-// nsIDOMNode selectedNode = children.item(
-// Math.min(focusOffset, anchorOffset));
-// if (visualBuilder.getNodeBounds(selectedNode).contains(VisualDomUtil.getMousePoint(event))) {
-// int selectedNodeType = selectedNode.getNodeType();
-// if (selectedNodeType == nsIDOMNode.ELEMENT_NODE) {
-// return new VpeVisualInnerDragInfo((nsIDOMElement)selectedNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID));
-// } else if (selectedNodeType == nsIDOMNode.TEXT_NODE) {
-// return new VpeVisualInnerDragInfo(selectedNode, 0, selectedNode.getNodeValue().length());
-// }
-// }
-// }
-// } else if (focusNodeType == nsIDOMNode.TEXT_NODE) {
-// return new VpeVisualInnerDragInfo(focusNode, offset, length);
-// }
-// }
-//
-// return null;
- }
-
void setMouseUpSelection(nsIDOMMouseEvent mouseEvent) {
}
@@ -1303,35 +1060,36 @@
}
}
- void setCaretAtMouse(nsIDOMMouseEvent mouseEvent) {
- nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
- boolean isAnonElement = VpeVisualDomBuilder.isAnonElement(visualNode);
- if (isAnonElement) return;
- VpeVisualInnerDropInfo visualDropInfo = getInnerDropInfo(mouseEvent);
- nsIDOMNode visuaDropContainer = visualDropInfo.getDropContainer();
- if (visuaDropContainer.getNodeType() == Node.TEXT_NODE) return;
- int visualDropOffset = (int)visualDropInfo.getDropOffset();
- if (visualDropOffset > 0) {
- nsIDOMNodeList visualChildren = visuaDropContainer.getChildNodes();
- nsIDOMNode visualChild = visualChildren.item(visualDropOffset - 1);
- boolean isText = visualChild.getNodeType() == Node.TEXT_NODE;
- if (isText) return;
- }
- nsISelection selection = visualSelectionController.getSelection(nsISelectionController.SELECTION_NORMAL);
- if (!VisualDomUtil.isSelectionContains(selection, visuaDropContainer, visualDropOffset)) {
- setVisualCaret(visuaDropContainer, visualDropOffset);
- // TODO Sergey Vasilyev figure out with nsIFrameSelection
-// nsIFrameSelection frameSelection = presShell.getFrameSelection();
-// if (frameSelection != null) {
-// frameSelection.setMouseDownState(true);
-// }
-
- // was commented by Max Areshkau (with this code scrolling doesn't works)
- //
-// mouseEvent.preventDefault();
-// mouseEvent.stopPropagation();
- }
- }
+// this method is never used
+// void setCaretAtMouse(nsIDOMMouseEvent mouseEvent) {
+// nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
+// boolean isAnonElement = VpeVisualDomBuilder.isAnonElement(visualNode);
+// if (isAnonElement) return;
+// VpeVisualInnerDropInfo visualDropInfo = getInnerDropInfo(mouseEvent);
+// nsIDOMNode visuaDropContainer = visualDropInfo.getDropContainer();
+// if (visuaDropContainer.getNodeType() == Node.TEXT_NODE) return;
+// int visualDropOffset = (int)visualDropInfo.getDropOffset();
+// if (visualDropOffset > 0) {
+// nsIDOMNodeList visualChildren = visuaDropContainer.getChildNodes();
+// nsIDOMNode visualChild = visualChildren.item(visualDropOffset - 1);
+// boolean isText = visualChild.getNodeType() == Node.TEXT_NODE;
+// if (isText) return;
+// }
+// nsISelection selection = visualSelectionController.getSelection(nsISelectionController.SELECTION_NORMAL);
+// if (!VisualDomUtil.isSelectionContains(selection, visuaDropContainer, visualDropOffset)) {
+// setVisualCaret(visuaDropContainer, visualDropOffset);
+// // TODO Sergey Vasilyev figure out with nsIFrameSelection
+//// nsIFrameSelection frameSelection = presShell.getFrameSelection();
+//// if (frameSelection != null) {
+//// frameSelection.setMouseDownState(true);
+//// }
+//
+// // was commented by Max Areshkau (with this code scrolling doesn't works)
+// //
+//// mouseEvent.preventDefault();
+//// mouseEvent.stopPropagation();
+// }
+// }
void setVisualCaret(nsIDOMNode visualNode, int offset) {
nsISelection selection = visualSelectionController.getSelection(nsISelectionController.SELECTION_NORMAL);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualCaretInfo.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualCaretInfo.java 2010-03-23 13:33:10 UTC (rev 20980)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualCaretInfo.java 2010-03-23 14:25:55 UTC (rev 20981)
@@ -34,15 +34,17 @@
public int getRageOffset(){
return rangeOffset;
}
+
+//this method is never used
+// public void showCaret() {
+// selectionBuilder.showVisualDragCaret(rangeParent, rangeOffset);
+// }
+
+//this method is never used
+// public void hideCaret() {
+// selectionBuilder.hideVisualDragCaret();
+// }
- public void showCaret() {
- selectionBuilder.showVisualDragCaret(rangeParent, rangeOffset);
- }
-
- public void hideCaret() {
- selectionBuilder.hideVisualDragCaret();
- }
-
public int getSourcePosition() {
return selectionBuilder.getSourcePosition(rangeParent, rangeOffset);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2010-03-23 13:33:10 UTC (rev 20980)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2010-03-23 14:25:55 UTC (rev 20981)
@@ -76,8 +76,11 @@
import org.mozilla.interfaces.nsIDOMAttr;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMEvent;
+import org.mozilla.interfaces.nsIDOMEventTarget;
import org.mozilla.interfaces.nsIDOMHTMLDocument;
import org.mozilla.interfaces.nsIDOMMouseEvent;
+import org.mozilla.interfaces.nsIDOMNSEvent;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
import org.mozilla.interfaces.nsIDOMRange;
@@ -891,7 +894,7 @@
return false;
}
- static boolean isPseudoElement(nsIDOMNode visualNode) {
+ public static boolean isPseudoElement(nsIDOMNode visualNode) {
if (visualNode == null) {
return false;
}
@@ -1554,7 +1557,7 @@
}
}
- static boolean isAnonElement(nsIDOMNode visualNode) {
+ public static boolean isAnonElement(nsIDOMNode visualNode) {
if (visualNode != null
&& visualNode.getNodeType() == nsIDOMNode.ELEMENT_NODE) {
String attrValue = ((nsIDOMElement) visualNode
@@ -1938,12 +1941,12 @@
return buffer.toString();
}
- Rectangle getNodeBounds(nsIDOMNode visualNode) {
+ public Rectangle getNodeBounds(nsIDOMNode visualNode) {
return XulRunnerVpeUtils.getElementBounds(visualNode);
}
- static boolean canInsertAfter(int x, int y, Rectangle rect) {
+ public static boolean canInsertAfter(int x, int y, Rectangle rect) {
if (y > (rect.y + rect.height) || x > (rect.x + rect.width)) {
return true;
}
@@ -2076,6 +2079,22 @@
}
return null;
}
+
+ public nsIDOMNode getOriginalTargetNode(nsIDOMEvent event) {
+ nsIDOMNode targetNode = VisualDomUtil.getTargetNode(event);
+ if (HTML.TAG_INPUT.equalsIgnoreCase(targetNode.getNodeName())) {
+ return targetNode;
+ }
+ nsIDOMNSEvent nsEvent = (nsIDOMNSEvent) event.queryInterface(nsIDOMNSEvent.NS_IDOMNSEVENT_IID);
+ // TODO Sergey Vasilyev figure out with TmpRealOriginalTarget
+// nsIDOMEventTarget target = nsEvent.getTmpRealOriginalTarget();
+ nsIDOMEventTarget target = nsEvent.getOriginalTarget();
+ nsIDOMNode originalNode = (nsIDOMNode) target.queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+ if (VpeVisualDomBuilder.isAnonElement(originalNode)) {
+ originalNode = getLastSelectedElement();
+ }
+ return originalNode;
+ }
public VpeSourceInnerDragInfo getSourceInnerDragInfo(
VpeVisualInnerDragInfo visualDragInfo) {
14 years, 7 months
JBoss Tools SVN: r20980 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-03-23 09:33:10 -0400 (Tue, 23 Mar 2010)
New Revision: 20980
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6088
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java 2010-03-23 12:59:34 UTC (rev 20979)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/LinkEditPart.java 2010-03-23 13:33:10 UTC (rev 20980)
@@ -131,7 +131,7 @@
conn.add(pathLabel, pathLocator);
String text = ""; //$NON-NLS-1$
- if (getLink().getJSFModel().getOptions().showShortcutPath())
+ if (getLink().getJSFModel().getOptions().showShortcutPath() && getLink().getToGroup() != null)
text = getLink().getToGroup().getVisiblePath();
shortcutLabel = new GEFLabel(text, FigureFactory.normalColor);
if (getLink().getJSFModel().getOptions().showShortcutIcon())
@@ -220,7 +220,7 @@
public void linkChange(ILink source) {
pathLabel.setText(getLink().getLinkName());
- if (getLinkModel().getJSFModel().getOptions().showShortcutPath())
+ if (getLinkModel().getJSFModel().getOptions().showShortcutPath() && getLink().getToGroup() != null)
shortcutLabel.setText(getLink().getToGroup().getVisiblePath());
else
shortcutLabel.setText(""); //$NON-NLS-1$
14 years, 7 months
JBoss Tools SVN: r20979 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2010-03-23 08:59:34 -0400 (Tue, 23 Mar 2010)
New Revision: 20979
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5007
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizard.java 2010-03-23 12:48:17 UTC (rev 20978)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizard.java 2010-03-23 12:59:34 UTC (rev 20979)
@@ -335,6 +335,9 @@
File location = revengPath.toFile();
org.jboss.tools.common.util.FileUtil.writeFile(location, params.get(HibernateLaunchConstants.ATTR_REVENG_TABLES).getValueAsString());
wc.setAttribute(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS, revengPath.toString());
+ } else if (params.containsKey(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS)){
+ wc.setAttribute(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS,
+ params.get(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS).getValueAsString());
}
launchManager.addLaunch(wc.launch(ILaunchManager.RUN_MODE, monitor));
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizardPage.java 2010-03-23 12:48:17 UTC (rev 20978)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizardPage.java 2010-03-23 12:59:34 UTC (rev 20979)
@@ -20,21 +20,31 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
+import org.hibernate.eclipse.console.HibernateConsoleMessages;
+import org.hibernate.eclipse.console.utils.DialogSelectionHelper;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.hibernate.eclipse.launch.PathHelper;
import org.jboss.tools.common.ui.CommonUIMessages;
import org.jboss.tools.common.ui.IValidator;
import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
@@ -50,10 +60,13 @@
/**
* @author Alexey Kazakov
*/
+@SuppressWarnings("restriction")
public class SeamGenerateEntitiesWizardPage extends WizardPage implements PropertyChangeListener, IAdaptable {
private IFieldEditor projectEditor;
private IFieldEditor configEditor;
+ private SelectionButtonDialogField existingReveng;
+ private StringButtonDialogField reverseEngineeringSettings;
private RadioField radios;
IProject rootSeamProject;
@@ -113,18 +126,51 @@
Composite radioComposite = new GridLayoutComposite(group, SWT.NONE, 2);
ArrayList<Object> values = new ArrayList<Object>();
- values.add("reverse"); //$NON-NLS-1$
values.add("existing"); //$NON-NLS-1$
+ values.add("reverse"); //$NON-NLS-1$
ArrayList<String> labels = new ArrayList<String>();
- labels.add(SeamUIMessages.GENERATE_SEAM_ENTITIES_WIZARD_REVERSE_ENGINEER_LABEL);
labels.add(SeamUIMessages.GENERATE_SEAM_ENTITIES_WIZARD_EXISTING_ENTITIES_LABEL);
+ labels.add(SeamUIMessages.GENERATE_SEAM_ENTITIES_WIZARD_REVERSE_ENGINEER_LABEL);
radios = new RadioField(radioComposite, labels, values, null, true);
radios.addPropertyChangeListener(this);
+
+ IDialogFieldListener fieldlistener = new IDialogFieldListener() {
+ public void dialogFieldChanged(DialogField field) {
+ wizardChanged();
+ }
+ };
+
+ Composite revengComposite = new GridLayoutComposite(group, SWT.NONE, 3);
+ existingReveng = new SelectionButtonDialogField(SWT.CHECK);
+ existingReveng.setLabelText("Use existing reveng");
+ existingReveng.setDialogFieldListener(fieldlistener);
+ existingReveng.doFillIntoGrid(revengComposite, 3);
+ existingReveng.setEnabled(false);
+
+ reverseEngineeringSettings= new StringButtonDialogField(new IStringButtonAdapter() {
+ public void changeControlPressed(DialogField field) {
+ IPath reverseEngineeringSettingsFile = getReverseEngineeringSettingsFile();
+ IPath[] paths = DialogSelectionHelper.chooseFileEntries(getShell(), reverseEngineeringSettingsFile, new IPath[0], HibernateConsoleMessages.CodeGenerationSettingsTab_select_reverse_engineering_settings_file, HibernateConsoleMessages.CodeGenerationSettingsTab_choose_file_read_reverse_settings, new String[] {HibernateConsoleMessages.CodeGenerationSettingsTab_reveng_xml_1}, false, false, true);
+ if(paths!=null && paths.length==1) {
+ reverseEngineeringSettings.setText( ( (paths[0]).toOSString() ) );
+ }
+ }
+ });
+ reverseEngineeringSettings.setDialogFieldListener(fieldlistener);
+ reverseEngineeringSettings.setLabelText(HibernateConsoleMessages.CodeGenerationSettingsTab_reveng_xml_2);
+ reverseEngineeringSettings.setButtonLabel("Browse...");
+ Control[] controls = reverseEngineeringSettings.doFillIntoGrid(revengComposite, 3);
+ reverseEngineeringSettings.setEnabled(false);
+ ( (GridData)controls[1].getLayoutData() ).grabExcessHorizontalSpace=true;
setControl(top);
validate();
}
+ protected IPath getReverseEngineeringSettingsFile() {
+ return PathHelper.pathOrNull(reverseEngineeringSettings.getText() );
+ }
+
private static String getConsoleConfigurationName(String seamWebProjectName) {
if(seamWebProjectName==null || seamWebProjectName.trim().length()==0) {
return null;
@@ -178,6 +224,12 @@
configEditor.setValue(consoleConfigName);
}
}
+ wizardChanged();
+ }
+
+ public void wizardChanged(){
+ existingReveng.setEnabled("reverse".equals(radios.getValue()));
+ reverseEngineeringSettings.setEnabled(existingReveng.isEnabled() && existingReveng.isSelected());
validate();
}
@@ -247,6 +299,20 @@
return;
}
}
+
+ if ("reverse".equals(radios.getValue()) && existingReveng.isSelected() && reverseEngineeringSettings.getText().trim().length() == 0){
+ setErrorMessage("Select reveng.xml file");//$NON-NLS-1$
+ setPageComplete(false);
+ return;
+ }
+ if("reverse".equals(radios.getValue()) && existingReveng.isSelected()) {
+ String msg = PathHelper.checkFile(reverseEngineeringSettings.getText(), HibernateConsoleMessages.CodeGenerationSettingsTab_reveng_xml_3, true);
+ if(msg!=null) {
+ setErrorMessage(msg);//$NON-NLS-1$
+ setPageComplete(false);
+ return;
+ }
+ }
setErrorMessage(null);
setMessage(null);
@@ -262,12 +328,17 @@
String mode = radios.getValue().toString();
String value = "reverse".equals(mode) ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
values.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER, new NamedElementImpl("reverse", value)); //$NON-NLS-1$
- IWizardPage page2 = getWizard().getPage(SeamGenerateEntitiesTablesWizardPage.pageName);
- if (page2 instanceof SeamGenerateEntitiesTablesWizardPage){
- SeamGenerateEntitiesTablesWizardPage page = (SeamGenerateEntitiesTablesWizardPage)page2;
- String filters = page.getFilters();
- if (filters.length() > 0) values.put(HibernateLaunchConstants.ATTR_REVENG_TABLES, new NamedElementImpl("filters", filters)); //$NON-NLS-1$
- }
+ if(reverseEngineeringSettings.isEnabled()){
+ values.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS,
+ new NamedElementImpl("reveng_file", reverseEngineeringSettings.getText()));
+ } else {
+ IWizardPage page2 = getWizard().getPage(SeamGenerateEntitiesTablesWizardPage.pageName);
+ if (page2 instanceof SeamGenerateEntitiesTablesWizardPage){
+ SeamGenerateEntitiesTablesWizardPage page = (SeamGenerateEntitiesTablesWizardPage)page2;
+ String filters = page.getFilters();
+ if (filters.length() > 0) values.put(HibernateLaunchConstants.ATTR_REVENG_TABLES, new NamedElementImpl("filters", filters)); //$NON-NLS-1$
+ }
+ }
return values;
}
return null;
@@ -311,7 +382,7 @@
@Override
public boolean canFlipToNextPage() {
- return "reverse".equals(radios.getValue()) && (getErrorMessage() == null); //$NON-NLS-1$
+ return "reverse".equals(radios.getValue()) && (getErrorMessage() == null && !existingReveng.isSelected()); //$NON-NLS-1$
}
public String getConsoleCongigurationName(){
14 years, 7 months
JBoss Tools SVN: r20978 - trunk/seam/tests/org.jboss.tools.seam.ui.bot.test/src/org/jboss/tools/seam/ui/bot/test/create.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-03-23 08:48:17 -0400 (Tue, 23 Mar 2010)
New Revision: 20978
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.bot.test/src/org/jboss/tools/seam/ui/bot/test/create/CreateEntities.java
Log:
Remove not used import statement
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.bot.test/src/org/jboss/tools/seam/ui/bot/test/create/CreateEntities.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.bot.test/src/org/jboss/tools/seam/ui/bot/test/create/CreateEntities.java 2010-03-23 12:47:47 UTC (rev 20977)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.bot.test/src/org/jboss/tools/seam/ui/bot/test/create/CreateEntities.java 2010-03-23 12:48:17 UTC (rev 20978)
@@ -1,7 +1,5 @@
package org.jboss.tools.seam.ui.bot.test.create;
-import java.io.IOException;
-
import org.jboss.tools.seam.ui.bot.test.TestControl;
public class CreateEntities extends TestControl{
14 years, 7 months
JBoss Tools SVN: r20977 - trunk/seam/tests/org.jboss.tools.seam.ui.bot.test/src/org/jboss/tools/seam/ui/bot/test/create.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-03-23 08:47:47 -0400 (Tue, 23 Mar 2010)
New Revision: 20977
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.bot.test/src/org/jboss/tools/seam/ui/bot/test/create/CreateEntities.java
Log:
Remove debug breakpoint
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.bot.test/src/org/jboss/tools/seam/ui/bot/test/create/CreateEntities.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.bot.test/src/org/jboss/tools/seam/ui/bot/test/create/CreateEntities.java 2010-03-22 17:49:32 UTC (rev 20976)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.bot.test/src/org/jboss/tools/seam/ui/bot/test/create/CreateEntities.java 2010-03-23 12:47:47 UTC (rev 20977)
@@ -30,13 +30,6 @@
public void testCreateEntityFor22ear(){
createSeamUnit(TEST_TYPE, seam22Settings, TYPE_EAR);
- // TODO: Remove it
- try {
- System.in.read();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
}
}
14 years, 7 months
JBoss Tools SVN: r20976 - in trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui: editors/dnd and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: yzhishko
Date: 2010-03-22 13:49:32 -0400 (Mon, 22 Mar 2010)
New Revision: 20976
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesTableViewer.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/DialogCellEditorEx.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizardDialog.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5876 - fixed.
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/DialogCellEditorEx.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/DialogCellEditorEx.java 2010-03-22 13:46:49 UTC (rev 20975)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/DialogCellEditorEx.java 2010-03-22 17:49:32 UTC (rev 20976)
@@ -42,6 +42,7 @@
public class DialogCellEditorEx extends DialogCellEditor { //implements IValueEditor {
protected Text text;
protected String textValue = null;
+ protected String startValue = null;
private Button button;
private static final int defaultStyle = SWT.NONE;
private boolean skipDeactivate = Boolean.FALSE.booleanValue();
@@ -181,6 +182,7 @@
}
public void keyReleased(KeyEvent e) {
if (e.character == '\u001b') { // Escape
+ text.setText(startValue);
fireCancelEditor();
}
}
@@ -295,11 +297,15 @@
public void activate() {
super.activate();
skipDeactivate = false;
+ if (text != null) {
+ startValue = text.getText();
+ }
}
public void deactivate() {
if (!this.skipDeactivate) {
skipDeactivate = true;
+ startValue = null;
super.deactivate();
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizardDialog.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizardDialog.java 2010-03-22 13:46:49 UTC (rev 20975)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizardDialog.java 2010-03-22 17:49:32 UTC (rev 20976)
@@ -10,8 +10,13 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.editors.dnd;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.jboss.tools.common.model.plugin.ModelPlugin;
@@ -39,4 +44,57 @@
if(os_name != null && os_name.indexOf("Windows") >= 0) return DO_WIDTH_VALUE; //$NON-NLS-1$
return DO_WIDTH_VALUE_LINUX;
}
+
+ @Override
+ public void updateButtons() {
+ boolean canFlipToNextPage = false;
+ boolean canFinish = getWizard().canFinish();
+ if (getButton(IDialogConstants.BACK_ID) != null) {
+ getButton(IDialogConstants.BACK_ID).setEnabled(getCurrentPage().getPreviousPage() != null);
+ }
+ if (getButton(IDialogConstants.NEXT_ID) != null) {
+ canFlipToNextPage = getCurrentPage().canFlipToNextPage();
+ getButton(IDialogConstants.NEXT_ID).setEnabled(canFlipToNextPage);
+ }
+ getButton(IDialogConstants.FINISH_ID).setEnabled(canFinish);
+ getShell().setDefaultButton(null);
+ }
+
+ /*
+ *
+ * a part of https://jira.jboss.org/jira/browse/JBIDE-5876 fix
+ *
+ */
+
+ @Override
+ protected Button createButton(Composite parent, int id, String label,
+ boolean defaultButton) {
+ Button button = super.createButton(parent, id, label, defaultButton);
+ if (id == IDialogConstants.FINISH_ID) {
+ getShell().setDefaultButton(null);
+ }
+ return button;
+ }
+
+ @Override
+ public void create() {
+ super.create();
+ getShell().addTraverseListener(new TraverseListener() {
+
+ public void keyTraversed(TraverseEvent e) {
+ if (e.character == '\r') {
+ Button finishButton = getButton(IDialogConstants.FINISH_ID);
+ Button cancelButton = getButton(IDialogConstants.CANCEL_ID);
+ if (!finishButton.isFocusControl() && !cancelButton.isFocusControl()) {
+ if (finishButton.isEnabled()) {
+ buttonPressed(IDialogConstants.FINISH_ID);
+ } else {
+ handleShellCloseEvent();
+ }
+ }
+ }
+ }
+ });
+ }
+
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java 2010-03-22 13:46:49 UTC (rev 20975)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java 2010-03-22 17:49:32 UTC (rev 20976)
@@ -187,7 +187,7 @@
TableLayout tableLayout = new TableLayout();
tableViewer =
- new TableViewer(swtTable);
+ new TagAttributesTableViewer(swtTable);
swtTable.setLayout(tableLayout);
swtTable.setLayoutData(data);
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesTableViewer.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesTableViewer.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesTableViewer.java 2010-03-22 17:49:32 UTC (rev 20976)
@@ -0,0 +1,111 @@
+package org.jboss.tools.common.model.ui.editors.dnd.composite;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
+import org.eclipse.jface.viewers.ICellEditorListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.viewers.ViewerRow;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+public class TagAttributesTableViewer extends TableViewer {
+ private boolean isHandle = true;
+ private boolean isTraversed = false;
+
+ public TagAttributesTableViewer(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ public TagAttributesTableViewer(Composite parent) {
+ super(parent);
+ }
+
+ public TagAttributesTableViewer(Table table) {
+ super(table);
+ }
+
+ @Override
+ protected void hookControl(Control control) {
+ super.hookControl(control);
+ if (getColumnViewerEditor() != null) {
+ getTable().addKeyListener(new KeyListener() {
+
+ public void keyReleased(KeyEvent e) {
+ if (isHandle || (!isHandle && isTraversed)) {
+ handleKeyReleasedEvent(e);
+ }
+ isHandle = true;
+ isTraversed = false;
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+ });
+ addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ isTraversed = false;
+ isHandle = true;
+ }
+ });
+ getTable().addTraverseListener(new TraverseListener() {
+
+ public void keyTraversed(TraverseEvent e) {
+ if (e.character == '\r') {
+ e.doit = false;
+ }
+ if (isCellEditorActive() && e.detail == SWT.TRAVERSE_ESCAPE) {
+ e.doit = false;
+ e.detail = SWT.TRAVERSE_NONE;
+ isTraversed = true;
+ }
+ }
+ });
+ }
+ }
+
+ private void handleKeyReleasedEvent(KeyEvent keyEvent) {
+ if (keyEvent.character == '\r' && keyEvent.doit == true) {
+ TableItem[] selectedItems = getTable().getSelection();
+ if (selectedItems == null || selectedItems.length != 1) {
+ return;
+ }
+ TableItem item = selectedItems[0];
+ ViewerRow row = getViewerRowFromItem(item);
+ ViewerCell cell = row.getCell(1);
+ if (cell != null) {
+ triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(
+ cell));
+ }
+ }
+ }
+
+ @Override
+ public void setCellEditors(CellEditor[] editors) {
+ super.setCellEditors(editors);
+ editors[1].addListener(new ICellEditorListener() {
+
+ public void editorValueChanged(boolean oldValidState,
+ boolean newValidState) {
+ isHandle = false;
+ }
+
+ public void cancelEditor() {
+ isHandle = false;
+ }
+
+ public void applyEditorValue() {
+ }
+ });
+ }
+
+}
14 years, 7 months
JBoss Tools SVN: r20975 - trunk/struts/docs/struts_tools_tutorial/en-US.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2010-03-22 09:46:49 -0400 (Mon, 22 Mar 2010)
New Revision: 20975
Modified:
trunk/struts/docs/struts_tools_tutorial/en-US/struts_validation.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-1151 - The obsolete word is updated.
Modified: trunk/struts/docs/struts_tools_tutorial/en-US/struts_validation.xml
===================================================================
--- trunk/struts/docs/struts_tools_tutorial/en-US/struts_validation.xml 2010-03-22 13:08:44 UTC (rev 20974)
+++ trunk/struts/docs/struts_tools_tutorial/en-US/struts_validation.xml 2010-03-22 13:46:49 UTC (rev 20975)
@@ -37,7 +37,7 @@
<listitem><para>In the dialog box, click on the <emphasis><property>Browse...</property></emphasis>button next to the Folder field, expand the
JavaSource folder in this next dialog box, select the sample subfolder, and click on the <emphasis><property>OK</property></emphasis> button</para></listitem>
<listitem><para>Back in the first dialog box, type in "applResources" for the Name field and click on the <emphasis><property>Finish</property></emphasis> button</para></listitem>
-<listitem><para>Right-click on a newly created file and select <emphasis><property>Add > Default Error Messages</property></emphasis>
+<listitem><para>Right-click on a newly created file and select <emphasis><property>New > Default Error Messages</property></emphasis>
from the context menu</para></listitem>
<listitem><para>Drag up the sample.applResources icon until you can drop it on the resources folder under struts-config.xml</para></listitem>
14 years, 7 months