Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 112401 Details for
Bug 247136
[outline] ArrayIndexOutOfBoundsException occurs when a node is moved to its parent by drag & drop
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
sample patch
patch2.txt (text/plain), 2.26 KB, created by
Naoki Akiyama
on 2008-09-12 05:41:56 EDT
(
hide
)
Description:
sample patch
Filename:
MIME Type:
Creator:
Naoki Akiyama
Created:
2008-09-12 05:41:56 EDT
Size:
2.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.dtd.ui >Index: src/org/eclipse/wst/dtd/ui/internal/dnd/DragContentModelCommand.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragContentModelCommand.java,v >retrieving revision 1.4 >diff -u -r1.4 DragContentModelCommand.java >--- src/org/eclipse/wst/dtd/ui/internal/dnd/DragContentModelCommand.java 10 Apr 2007 20:05:22 -0000 1.4 >+++ src/org/eclipse/wst/dtd/ui/internal/dnd/DragContentModelCommand.java 11 Sep 2008 11:19:09 -0000 >@@ -26,6 +26,7 @@ > import org.eclipse.wst.dtd.core.internal.DTDNode; > import org.eclipse.wst.dtd.core.internal.Element; > import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; >+import org.w3c.dom.Node; > > > public class DragContentModelCommand extends DefaultDragAndDropCommand { >@@ -73,6 +74,7 @@ > return; > } > >+ boolean contentModelReplaced = false; > Iterator iter = sources.iterator(); > while (iter.hasNext()) { > DTDNode node = (DTDNode) iter.next(); >@@ -81,6 +83,9 @@ > if (element.getContentModel() == node) { > continue; > } >+ if(isAncestor(element.getContentModel(), node)) { >+ contentModelReplaced = true; >+ } > element.replaceContentModel(this, (CMNode) node); > } > else { >@@ -91,8 +96,14 @@ > group.insertIntoModel(this, (CMNode) referenceNode, (CMNode) node, isAfter()); > > } >- DTDNode nodeParent = (DTDNode) node.getParentNode(); >- nodeParent.delete(this, node); >+ if(!contentModelReplaced) { >+ DTDNode nodeParent = (DTDNode) node.getParentNode(); >+ nodeParent.delete(this, node); >+ } >+ else { >+ // replace only the first selected node >+ break; >+ } > } > } > dtdFile.getDTDModel().endRecording(this); >@@ -110,4 +121,18 @@ > > return super.getFeedback(); > } >+ >+ /** >+ * Returns with true if node1 is an ancestor of node2. >+ */ >+ private boolean isAncestor(Node node1, Node node2) { >+ boolean result = false; >+ for (Node parent = node2; parent != null; parent = parent.getParentNode()) { >+ if (parent == node1) { >+ result = true; >+ break; >+ } >+ } >+ return result; >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 247136
: 112401 |
149772
|
149773