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 230126

Summary: /net/yourip/export/.../f.cpp is not equal /export/.../f.cpp (IDE opens new tab)
Product: platform Reporter: igor_nikiforov <igor_nikiforov>
Component: TextAssignee: igor_nikiforov <igor_nikiforov>
Status: VERIFIED FIXED    
Severity: normal CC: alexvsimon, apireviews, DrSobik, issues, jtulach, mmirilovic
Priority: P2 Keywords: API_REVIEW_FAST
Version: 7.4   
Hardware: All   
OS: Unix   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 234795    
Bug Blocks: 241991    
Attachments: Proposed patch
Proposed patch with CloneableOpenSupportRedirector
A patch without OpenSupport.findDataObject

Description igor_nikiforov 2013-05-22 14:58:16 UTC
Scenario:
- Create C/C++ Application on /export/
- Open file in editor via double click in Projects tab
- Push File|Open File...
- Type /net/your_ip/export/CppApplication_1/main.cpp in dialog window
- Press OK button
==>
now: IDE opens second tab
previous builds: IDE activates first file
Comment 1 Vladimir Voskresensky 2013-05-22 15:38:11 UTC
What we technically need is analogue or version of CloneableEditorSupportRedirector which will be called only during opening of document when algorith tries to understand if file is in list of already opened TCs or not.
Comment 2 Vladimir Voskresensky 2013-05-23 09:14:06 UTC
It is data lost. We will try to propose a patch.
Comment 3 Andrew Krasny 2013-05-27 11:47:48 UTC
Created attachment 134945 [details]
Proposed patch

A simple patch what allows SPI implementers to setup filter on specific requests only... This could minimize number of redirect() calls.
Comment 4 Vladimir Voskresensky 2013-05-27 12:38:23 UTC
Jarda, what do you think?
Comment 5 Jaroslav Tulach 2013-05-27 12:43:20 UTC
Interesting approach. If that works for you, polish it as an API request and it can (imho) be applied.
Comment 6 Andrew Krasny 2013-05-28 17:39:29 UTC
Created attachment 135020 [details]
Proposed patch with CloneableOpenSupportRedirector

Looks like the proposed approach still is not perfect - it allows to reduce the number of redirection queries, but introduces other problems:
- SPI implementers don't really know what events are important..
- there is no way to 'forget' about 'redirected' editor

How about this approach?
I have introduced a CloneableOpenSupportRedirector that invokes 'redirect' on opening component only. It also gets notifications about closed components.
And.. it gets notification about opened components as well - this is needed for 'restored' opened TCs (when IDE starts)...
Comment 7 Vladimir Voskresensky 2013-05-29 08:09:46 UTC
Andrew, I like COS redirector more than CES. 

Btw, patch contains public findDataObject in OpenSupport. Is it really needed?
Comment 8 Andrew Krasny 2013-05-29 09:57:16 UTC
This was the easiest way to get the DataObject (and IMO not *that* bad)...
I have no problem removing this... But that will require clients (COSRedirectorImpl) to do more tricks.
Comment 9 Andrew Krasny 2013-05-30 15:40:34 UTC
looks like I was too optimistic ;)

Jarda, Vladimir, 

I don't see a way of getting DataObject from OpenSupport.Env other than using reflection (which I don't like).
Do you have ideas? 

And... maybe we can just introduced the proposed findDataObject()?
Comment 10 Andrew Krasny 2013-06-20 14:56:04 UTC
Jarda, 

could you, please, take a look?
Comment 11 Jaroslav Tulach 2013-06-24 16:25:35 UTC
You can't modify OpenSupport to reference to DataObject. Sorry.
Comment 12 Vladimir Voskresensky 2013-06-25 05:20:21 UTC
Bug itself is not invalid your comment is about patch, right?

method in OpenSupport is introduced, but not used.
So, what about other parts of patch? Are they ok?

Thanks!
Comment 13 Andrew Krasny 2013-07-02 12:05:15 UTC
Created attachment 136592 [details]
A patch without OpenSupport.findDataObject
Comment 14 Jaroslav Tulach 2013-07-08 07:04:30 UTC
The previous patch looks like an API change request to me. Why don't you guys follow the API review guidelines?
Comment 15 Vladimir Voskresensky 2013-08-13 10:26:07 UTC
If no objections, Igor, please, integrate
Comment 16 igor_nikiforov 2013-08-13 12:49:06 UTC
The patch together with required apichanges.xml modifications is integrated:
  http://hg.netbeans.org/cnd-main/rev/118c422c781a
Comment 17 Quality Engineering 2013-08-14 14:38:45 UTC
Integrated into 'main-silver', will be available in build *201308141142* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/118c422c781a
User: igor_nikiforov <igor_nikiforov@netbeans.org>
Log: Bug 230126 - /net/yourip/export/.../f.cpp is not equal /export/.../f.cpp (IDE opens new tab) - fix.
Comment 18 igor_nikiforov 2013-08-15 14:20:09 UTC
COSRedirecctor implementation, based on CESRedirector:
  http://hg.netbeans.org/cnd-main/rev/0a0315d3ee72

Stat usage is replaced by Java 7 File API usage. The implementation doesn't look optimal, and it's better to refactor/re-implement it.
Comment 19 Quality Engineering 2013-08-16 02:40:26 UTC
Integrated into 'main-silver', will be available in build *201308152300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/0a0315d3ee72
User: igor_nikiforov <igor_nikiforov@netbeans.org>
Log: Bug 230126 - /net/yourip/export/.../f.cpp is not equal /export/.../f.cpp (IDE opens new tab) - additional fix.
Comment 20 Vladimir Voskresensky 2013-08-23 14:49:39 UTC
*** Bug 234795 has been marked as a duplicate of this bug. ***
Comment 21 Vladimir Voskresensky 2013-08-26 07:25:17 UTC
*** Bug 234795 has been marked as a duplicate of this bug. ***
Comment 22 Alexander Simon 2013-08-28 11:01:07 UTC
*** Bug 216041 has been marked as a duplicate of this bug. ***
Comment 23 igor_nikiforov 2013-09-09 09:43:38 UTC
Reflection cache added:
  http://hg.netbeans.org/cnd-main/rev/407e58e8cbd1
Comment 24 Marian Mirilovic 2013-11-04 13:19:43 UTC
Feedback from reporter : 
Dear developers,
the issue was indeed resolved in the pre-release build 201310110001. But in the final release of NB 7.4 the issue still persists... Please, clarity this problem.
Kind regards,
Oleh Sobeyko
Comment 25 Quality Engineering 2013-11-11 20:12:14 UTC
Integrated into 'releases/release74', will be available in build *201311111738* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/386280fa241f
User: igor_nikiforov <igor_nikiforov@netbeans.org>
Log: Bug 230126 - /net/yourip/export/.../f.cpp is not equal /export/.../f.cpp (IDE opens new tab) - additional fix.
(transplanted from 407e58e8cbd1139eaf3a1a340507649a526a9a7e)
(transplanted from 705484352212f3ac566f99d540b863289ac9baca)
Comment 26 soldatov 2013-11-12 08:46:19 UTC
verified in NetBeans IDE 7.4 (Build 201311111738)