This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 175750 - Navigating via Navigator opens a second pom.xml editor
Summary: Navigating via Navigator opens a second pom.xml editor
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Data Systems (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: API_REVIEW_FAST
: 175277 175776 177706 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-10-30 10:54 UTC by Antonin Nebuzelsky
Modified: 2009-11-27 11:34 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Call stacks (6.46 KB, text/plain)
2009-10-30 14:48 UTC, mslama
Details
The api change and its usage in xml (15.49 KB, patch)
2009-11-05 15:19 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antonin Nebuzelsky 2009-10-30 10:54:52 UTC
Product Version: NetBeans IDE Dev (Build 200910290252)
Java: 1.6.0_16; Java HotSpot(TM) Client VM 14.2-b01
System: Linux version 2.6.28-16-generic running on i386; UTF-8; en_US (nb)

1) open pom.xml in editor either from Go To File wizard or from Explorer
2) double-click on any item of the POM model view of the pom.xml in Navigator
3) -> the same pom.xml is opened in a second editor tab and cursor is moved to the item's position there

4) go back to the first pom.xml editor
5) double-click on any other item in Navigator
6) -> focus is changed again to the second pom.xml editor and navigation happens there
Comment 1 Milos Kleint 2009-10-30 11:25:06 UTC
hmm.. this could be somehow related to the "cannot save edited pom file" problem. It seems something somewhere changed
and we get 2 editors/documents for the same thing maybe?
Comment 2 Milos Kleint 2009-10-30 12:56:13 UTC
reassigning to platform/text. Please for reasoning see issue 175277, it could be effectively a duplicate of that one.
This one is 100% reproducible given the steps in description.
Comment 3 mslama 2009-10-30 13:27:14 UTC
Not sure what could cause this but I cannot reproduce with my latest build from core-main when I follow steps. Please
retest. Only one editor stays opened. I created sample Maven project Maven Calculator Service. Or is it specific to some
project only? In such case please attach test project.
Comment 4 mslama 2009-10-30 13:42:13 UTC
It started to happen to me too. Investigating.
Comment 5 Antonin Nebuzelsky 2009-10-30 14:18:50 UTC
I tried today's build and first it seemed like it is not happening any more, but then I switched back to the older build
and back to the new one and now I see it with both, most of the time.
Comment 6 mslama 2009-10-30 14:47:28 UTC
2 instances of DataEditorSupport are created. Passing to data systems. I will attach call stacks.
Comment 7 mslama 2009-10-30 14:48:44 UTC
Created attachment 90304 [details]
Call stacks
Comment 8 mslama 2009-10-30 14:49:31 UTC
DataObject instance is the same
Comment 9 mslama 2009-11-02 10:40:22 UTC
P2 is duplicate of this issue.
Comment 10 mslama 2009-11-02 10:40:51 UTC
*** Issue 175277 has been marked as a duplicate of this issue. ***
Comment 11 mslama 2009-11-02 10:41:19 UTC
*** Issue 175277 has been marked as a duplicate of this issue. ***
Comment 12 Jaroslav Tulach 2009-11-03 10:29:16 UTC
Simulated in following test:

diff -r 23804ead259f xml/test/unit/src/org/netbeans/modules/xml/XMLDataObjectTest.java
--- a/xml/test/unit/src/org/netbeans/modules/xml/XMLDataObjectTest.java Tue Nov 03 06:21:21 2009 +0300
+++ b/xml/test/unit/src/org/netbeans/modules/xml/XMLDataObjectTest.java Tue Nov 03 11:28:34 2009 +0100
@@ -42,6 +42,7 @@

 import java.io.IOException;
 import org.netbeans.junit.NbTestCase;
+import org.openide.cookies.EditorCookie;
 import org.openide.filesystems.FileObject;
 import org.openide.filesystems.FileUtil;
 import org.openide.loaders.DataObject;
@@ -76,5 +77,11 @@

         XMLDataObject dataObject = (XMLDataObject) object;
         assertNotNull(dataObject.getLookup().lookup(FileObject.class));
+
+        EditorCookie ec = dataObject.getCookie(EditorCookie.class);
+        assertNotNull("Editor cookie found", ec);
+
+        EditorCookie lkp = dataObject.getLookup().lookup(EditorCookie.class);
+        assertEquals("Cookies are the same", ec, lkp);
     }
 }
Comment 13 Jaroslav Tulach 2009-11-03 11:28:42 UTC
Looks like a bug in CookieSet.
Comment 14 Jaroslav Tulach 2009-11-03 11:34:35 UTC
core-main#2c07cc308ffb
Comment 15 mslama 2009-11-04 09:34:25 UTC
*** Issue 175776 has been marked as a duplicate of this issue. ***
Comment 16 Quality Engineering 2009-11-04 22:29:52 UTC
Integrated into 'main-golden', will be available in build *200911041401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/2c07cc308ffb
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #175750: Sharing the CookieEntry between cookie and lookup to let only one instance be created by the factory
Comment 17 Antonin Nebuzelsky 2009-11-05 11:17:55 UTC
Unfortunately I can still reproduce with build 200911041401.
Comment 18 Jaroslav Tulach 2009-11-05 15:18:56 UTC
Various cookies of XMLDataObject subclass are duplicated. I guess the cleanest solution is to enhance the API.
Comment 19 Jaroslav Tulach 2009-11-05 15:19:47 UTC
Created attachment 90521 [details]
The api change and its usage in xml
Comment 20 Jaroslav Tulach 2009-11-05 15:21:26 UTC
Guys, give me explicit go, so I can integrate on Monday Nov 9, 2009. Thanks.
Comment 21 Jesse Glick 2009-11-05 15:44:59 UTC
Looks OK to me.
Comment 22 Milos Kleint 2009-11-05 17:16:53 UTC
I haven't tested the patch but one thing sounds strange here to me.. The maven support doesn't have it's own dataobject.
we use the default xml one, so how did duplicates ended up there in the first place?
Comment 23 Jaroslav Tulach 2009-11-05 20:12:26 UTC
For historical reasons there are two XMLDataObjects. org.openide.loaders.XMLDataObject and 
org.netbeans.modules.xml.XMLDataObject. The later subclasses the first and tries to override its 
CloneableEditorSupport functionality using some wild tricks that do not work reliably. The API just allows the 
subclass to disable CES registration in super class, so no tricks are necessary anymore.
Comment 24 Jiri Skrivanek 2009-11-06 10:08:18 UTC
No comment. => Go.
Comment 25 Jaroslav Tulach 2009-11-09 01:03:51 UTC
OK, let's do it.
Comment 26 Jaroslav Tulach 2009-11-09 01:07:27 UTC
core-main#35e736c73924
Comment 27 Jaroslav Tulach 2009-11-27 11:34:40 UTC
*** Bug 177706 has been marked as a duplicate of this bug. ***