Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 245342 - [outline] In DTD Editor, Outline view doesn't synchronize in the case of Group items logically
Summary: [outline] In DTD Editor, Outline view doesn't synchronize in the case of Grou...
Status: CLOSED DUPLICATE of bug 157430
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.dtd (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3   Edit
Assignee: wst.dtd-triaged CLA
QA Contact: David Carver CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-27 03:10 EDT by Naoki Akiyama CLA
Modified: 2011-02-18 11:16 EST (History)
4 users (show)

See Also:
d_a_carver: review? (nsand.dev)


Attachments
Outline1.png (13.20 KB, image/png)
2008-08-27 03:10 EDT, Naoki Akiyama CLA
no flags Details
Outline2.png (13.25 KB, image/png)
2008-08-27 03:12 EDT, Naoki Akiyama CLA
no flags Details
Outline3.png (13.55 KB, image/png)
2008-08-27 03:13 EDT, Naoki Akiyama CLA
no flags Details
Outline4.png (14.95 KB, image/png)
2008-08-27 03:13 EDT, Naoki Akiyama CLA
no flags Details
Outline5.png (7.62 KB, image/png)
2008-08-27 03:14 EDT, Naoki Akiyama CLA
no flags Details
Problem1.png (12.50 KB, image/png)
2008-08-27 03:14 EDT, Naoki Akiyama CLA
no flags Details
sample patch (5.35 KB, patch)
2008-08-27 03:15 EDT, Naoki Akiyama CLA
thatnitind: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Naoki Akiyama CLA 2008-08-27 03:10:53 EDT
Created attachment 111032 [details]
Outline1.png

Build ID: Eclipse: I20080617-2000, WTP: 20080616152118

The problem occurs when [Group items logically] button of the toolbar of
Outline view is clicked. The source doesn't synchronize with the node of
Outline view. Some examples are shown below.

Pattern 1:
1. Open the DTD file of the following source.
   <!ELEMENT NewElement1 EMPTY>
2. Types so that the source become as follows.
   <!ELEMENT NewElement1 EMPTY>
   <!ATTLIST NewElement1 NewAttribute CDATA #IMPLIED>
  --> The node of Outline view becomes like the left of Outline1.png.
3. Save the editor. Open the DTD file again.
  --> The node of Outline view becomes like the right of Outline1.png.
      The attribute under the Attributes node doesn't exist.

Pattern 2:
1. <!ELEMENT NewElement1 EMPTY>
   <!ATTLIST NewElement1 NewAttribute CDATA #IMPLIED>
2. <!ELEMENT NewElement1 EMPTY>
   <!ATTLIST NewElement1 ChangeAttr CDATA #IMPLIED>
  --> The left of Outline2.png.
3. Save the editor. Open the DTD file again.
  --> The right of Outline2.png.
      The attribute under the Attributes node doesn't change.

Pattern 3:
1. <!ELEMENT NewElement1 EMPTY>
   <!ATTLIST NewElement1 NewAttribute1 CDATA #IMPLIED>
   <!ATTLIST NewElement1 NewAttribute2 CDATA #IMPLIED>
2. <!ELEMENT NewElement1 EMPTY>
   <!ATTLIST NewElement1 NewAttribute1 CDATA #IMPLIED>
  --> The left of Outline3.png.
3. Save the editor. Open the DTD file again.
  --> The right of Outline3.png.
      The NewAttribute2 attribute under the NewElement1 element is not deleted.

Pattern 4:
The problem occurs by a syntax not validate as follows.
1. <!ELEMENT NewElement1 EMPTY>
   <!ELEMENT NewElement1 EMPTY>
   <!ATTLIST NewElement1 NewAttribute1 CDATA #IMPLIED>
2. <!ELEMENT NewElement1 EMPTY>
   <!ELEMENT NewElement1 EMPTY>
   <!ATTLIST NewElement1 ChangeAttr CDATA #IMPLIED>
  --> The left of Outline4.png.
3. Save the editor. Open the DTD file again.
  --> The right of Outline4.png.
      The attribute under the Attributes node doesn't change.
      Moreover, the NewAttribute1 attribute under the second the NewElement1
      element is not changed.

The problem occurs when not clicking on [Group items logically] button. 
Some examples are shown below.

Pattern 5:
1. <!ELEMENT NewElement1 EMPTY>
2. Delete all content of the source. 
  --> The left of Outline5.png.
3. Save the editor. Open the DTD file again.
  --> The right of Outline5.png.
      The NewElement1 element exists.

Pattern 6:
Problem of Bug 157430.

More information:
I attached sample patch. The model of the Element and the Attribute doesn't
have the relation between parent and child. The implementation of
DTDTreeContentProvider#getChildren produces the relation. Other methods are
fixed based on the implementation.

However, the patch has the following problem. I was not able to resolve this
problem.

1. <!ELEMENT NewElement1 EMPTY>
   <!ATTLIST NewElement1 NewAttribute CDATA #IMPLIED>
2. <!ELEMENT NewElement1 EMPTY>
   <!ATTLIST ChangeElement NewAttribute CDATA #IMPLIED>
  --> The left of Problem1.png.
3. Save the editor. Open the DTD file again.
  --> The right of Problem1.png.
      The NewAttribute attribute exists under the NewElement1 element.
Comment 1 Naoki Akiyama CLA 2008-08-27 03:12:19 EDT
Created attachment 111033 [details]
Outline2.png
Comment 2 Naoki Akiyama CLA 2008-08-27 03:13:38 EDT
Created attachment 111034 [details]
Outline3.png
Comment 3 Naoki Akiyama CLA 2008-08-27 03:13:59 EDT
Created attachment 111035 [details]
Outline4.png
Comment 4 Naoki Akiyama CLA 2008-08-27 03:14:22 EDT
Created attachment 111036 [details]
Outline5.png
Comment 5 Naoki Akiyama CLA 2008-08-27 03:14:41 EDT
Created attachment 111037 [details]
Problem1.png
Comment 6 Naoki Akiyama CLA 2008-08-27 03:15:41 EDT
Created attachment 111038 [details]
sample patch
Comment 7 David Carver CLA 2009-03-26 21:03:58 EDT
targeting for 3.1m7
Comment 8 David Carver CLA 2009-04-17 09:30:48 EDT
Due to some other underlying issues discovered in bug 245216 I think it's best to try to address this early in 3.2M1.  
Comment 9 David Carver CLA 2009-10-10 12:52:58 EDT
Nick or Nitin can you guys take a look at this patch.  I know that there are some issues that Nitin and I discussed about how the DTD document model is implemented with the SSE, so I had a not that we needed to review this.   I'd like to try and address this during 3.2M3 or 3.2M4.
Comment 10 Nick Sandonato CLA 2009-10-19 14:45:46 EDT
(In reply to comment #9)
> Nick or Nitin can you guys take a look at this patch.  I know that there are
> some issues that Nitin and I discussed about how the DTD document model is
> implemented with the SSE, so I had a not that we needed to review this.   I'd
> like to try and address this during 3.2M3 or 3.2M4.

In nodesRemoved(), I'm curious about the outer loop for (int i = 0; i < count;i++). This looks like it would just cause the same items to be removed from the viewer (count) times. Also, in the if block following, we'd remove the same objects from the viewer again. Is that step necessary?

Will we see a regression if the code from Bug 111100 is removed?
Comment 11 Nick Sandonato CLA 2009-10-29 17:22:52 EDT
(In reply to comment #10)
> (In reply to comment #9)
> > Nick or Nitin can you guys take a look at this patch.  I know that there are
> > some issues that Nitin and I discussed about how the DTD document model is
> > implemented with the SSE, so I had a not that we needed to review this.   I'd
> > like to try and address this during 3.2M3 or 3.2M4.
> 
> In nodesRemoved(), I'm curious about the outer loop for (int i = 0; i <
> count;i++). This looks like it would just cause the same items to be removed
> from the viewer (count) times. Also, in the if block following, we'd remove the
> same objects from the viewer again. Is that step necessary?
> 
> Will we see a regression if the code from Bug 111100 is removed?

Any opinions?
Comment 12 David Carver CLA 2009-10-29 18:10:57 EDT
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > Nick or Nitin can you guys take a look at this patch.  I know that there are
> > > some issues that Nitin and I discussed about how the DTD document model is
> > > implemented with the SSE, so I had a not that we needed to review this.   I'd
> > > like to try and address this during 3.2M3 or 3.2M4.
> > 
> > In nodesRemoved(), I'm curious about the outer loop for (int i = 0; i <
> > count;i++). This looks like it would just cause the same items to be removed
> > from the viewer (count) times. Also, in the if block following, we'd remove the
> > same objects from the viewer again. Is that step necessary?
> > 
> > Will we see a regression if the code from Bug 111100 is removed?
> 
> Any opinions?

The only way to find out for sure, is to setup a Unit test for this particular bug and patch.
Comment 13 Ian Tewksbury CLA 2009-12-23 14:52:06 EST
Because I was in DTDTreeContentProvider to fix Bug 157430 Nick suggested I fix these problems while I was at it.  I have submitted a patch to Bug 157430 that fixes ALL of the problems described in both of these bugs.  This includes the problem described in the description of this bug that the "sample patch" provided by Naoki Akiyama does not fix.  The work I did for the patch in Bug 157430 is very loosely based off the patch provided here but I did a lot of reorganizing to make the whole class flow better and eliminate duplicate code.

I would say this bug can now either be duped against the other or set to depends on. I leave that up to the owner.
Comment 14 Nick Sandonato CLA 2011-02-18 11:16:03 EST
Ian's patch for Bug 157430 addresses all of these concerns. We'll pursue a fix from there.

*** This bug has been marked as a duplicate of bug 157430 ***