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 71319 - auto-sync between editor window and project/files/favorites windows
Summary: auto-sync between editor window and project/files/favorites windows
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Projects UI (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker with 4 votes (vote)
Assignee: Milan Kubec
URL:
Keywords:
: 71377 72382 87061 108021 108196 113279 123968 127029 134405 135897 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-01-12 17:31 UTC by _ gsporar
Modified: 2009-02-19 22:56 UTC (History)
8 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Patch for Projects and Files tabs (4.01 KB, patch)
2006-01-13 19:22 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ gsporar 2006-01-12 17:31:22 UTC
In Eclipse there is a handy option you can turn on that keeps the Projects/Files
windows (that's not what they're called in Eclipse, but they are equivalent to
those NB windows) in sync with the current selection in the editor.  

In NetBeans, I have to keep pressing Ctrl-Shift-1 and Ctrl-Shift-2 to get the
same behavior.  This is annoying.  Several Eclipse users have commented that
they would also like this feature.

Note, it should probably also keep the Favorites window in sync, to avoid having
to press Ctrl-Shift-3.
Comment 1 Marian Mirilovic 2006-01-13 10:47:34 UTC
I am not sure users can benefit on synchroznizing all tree-based views with
editor. We've implemented it this way, it's different. 

At least synchronization with Favorites view is impossible. Favorites window
doesn't contain all files in the tree by default, it contains only home folder
and your added pointers. 

Reassigne to projects, because Projects/Files view are in their responsibility.
Comment 2 _ gsporar 2006-01-13 15:56:51 UTC
>I am not sure users can benefit on synchroznizing all tree-based views with 
editor.

I'm not sure I understand this comment.  We've had multiple requests from
Eclipse users who use this feature in Eclipse all the time.   When they switch
to NetBeans they want equivalent functionality.  Naturally, by default it would
be turned off.

>We've implemented it this way, it's different.

What exactly does "implemented it this way" mean?  Are you saying that there is
a specific reason that NetBeans does not have this feature?  And what exactly is
meant by "it's different"?  What is different?  The Eclipse Package Explorer and
the NetBeans Project Window look equivalent to me.  The Eclipse Navigator and
the NetBeans Files Window also look equivalent.  They have different names but
they perform the same functions.

>At least synchronization with Favorites view is impossible.

That is correct for situations where the Favorites view does not contain the
necessary folder(s).  But if it did have the necessary folder, why couldn't it
synchronize as well?
Comment 3 Jesse Glick 2006-01-13 18:41:19 UTC
If we do it we should turn it on by default and make sure that it works right,
not make it yet another hidden option.
Comment 4 Jesse Glick 2006-01-13 19:22:36 UTC
Created attachment 28386 [details]
Patch for Projects and Files tabs
Comment 5 Jesse Glick 2006-01-13 19:38:17 UTC
Try the attached patch. It's quite simple. Notes:

1. Impl could probably be optimized somewhat.

1a. Listens for (its own) selection changes when focussed, but then has to
ignore them. Couldn't find a better way, though - using
componentActivated/Deactivated in addition to componentShowing/Hidden did not
work out.

1b. Should cancel any running selection task when selection is changing rapidly.
Currently just sends all selection jobs into RP to be processed whenever, which
is not very good.

2. Makes C-S-1/2 (Select Node in > Projects/Files) redundant and useless. Just
C-1/2 work as well. Meaning that some code in various parts of projectui could
be deleted, incl. code to select newly created files - would be automatic anyway
if they were opened in the editor.

3. Could easily be fixed to handle multiselections; currently only handles
single selections.

4. Analogous patch for Favorites would probably not be hard.

5. Currently leaves deep trees expanded even after selection is moved away,
which can lead to a mess after a while. Could consider collapsing all but the
currently used tree after making an automated selection change. Or keeping track
of expansions which were done automatically, and collapse only those expansions
when selection changes again.

6. Patched behavior is fully consistent with the existing behavior of the
Navigator window. Try opening both Projects and Navigator windows and do a Find
Usages and step thru results with F12. You will see your selection tracked
simultaneously in both windows.

Anyway, something to play with and comment on. It seems like a step forward to
me. I'm sure you can find some scenarios where automatic synchronization would
be unwanted, but the question is whether these are really common enough to
justify continuing to withhold this feature from our users (or making it a
disabled option, which is nearly the same thing in practice).

Note that a large number of our users have been asking for this feature in one
form or another for essentially the entire existence of NetBeans, as can be seen
by looking at the history of issue #7551, issue #18856, issue #6559, issue
#35652, etc. etc.
Comment 6 Jesse Glick 2006-01-13 19:50:57 UTC
*** Issue 71377 has been marked as a duplicate of this issue. ***
Comment 7 Martin Krauskopf 2006-01-16 14:21:25 UTC
> 2. Makes C-S-1/2 (Select Node in > Projects/Files) redundant and useless. Just
> C-1/2 work as well. Meaning that some code in various parts of projectui could
> be deleted, incl. code to select newly created files - would be automatic
> anyway if they were opened in the editor.

Please don't do so. I used Eclipse for relatively long time in the past. I also
liked that feature a lot. But probably the reason was that I din't have
shortcuts like those C-S-1/2/3 in NetBeans. So I din't have another choice than
to turning on and off the auto-sync feature. On the other side this meant that
in any bigger project I had to use to a visual jumping/blinking of Navigator /
Project Explorer whenever I pressed C-F6 (the same like C-Tab in NB) which was
annoying. So after I "switched" ;) to NB what I really like was those shortcuts
- C-S-1/2/3 which are much better (sure, IMHO).

I think that the main reason is that Eclipse developers do not have those
shortcuts (by default) or are not used to them. I'm heavily dependent shortcut
user :) and really like those shortcuts. Please keep them - I believe they can
easily coexist with this new feature (sure, they can be "turned off" when the
user check auto-sync).

PS: I don't know current shortcut/feature situation in Eclipse but not imporatnt
in this case.

Comment 8 Jan Lahoda 2006-01-23 12:20:33 UTC
See also issue #61615.
Comment 9 Jesse Glick 2007-07-13 19:01:00 UTC
*** Issue 108196 has been marked as a duplicate of this issue. ***
Comment 10 Jesse Glick 2007-08-10 00:37:09 UTC
*** Issue 108021 has been marked as a duplicate of this issue. ***
Comment 11 Jesse Glick 2007-09-26 17:48:31 UTC
*** Issue 113279 has been marked as a duplicate of this issue. ***
Comment 12 rsearjeant 2007-10-24 14:10:49 UTC
Making auto-sync'ing behaviour a preference, whilst keeping the ctrl+shift+1 etc. shortcuts would be ideal, I think. 
Personally, I would like to have the auto-syncing behaviour, but if it is made optional, not all users would have to put
up with it.

I'll give this a vote.
Comment 13 Jesse Glick 2007-12-17 17:40:38 UTC
Please do not increase the Version field. It refers to the _oldest_ version for which the issue is known to be applicable.
Comment 14 Jesse Glick 2008-08-20 17:01:38 UTC
*** Issue 123968 has been marked as a duplicate of this issue. ***
Comment 15 Milan Kubec 2008-10-17 13:59:24 UTC
*** Issue 127029 has been marked as a duplicate of this issue. ***
Comment 16 Milan Kubec 2008-10-17 14:16:59 UTC
*** Issue 134405 has been marked as a duplicate of this issue. ***
Comment 17 Milan Kubec 2008-10-29 11:42:15 UTC
*** Issue 87061 has been marked as a duplicate of this issue. ***
Comment 18 Milan Kubec 2008-10-29 13:14:38 UTC
Some UI Spec would be needed if we want to implement this feature. First of all I think that we cannot remove those
shortcuts C/S/1-2. They have to stay there IMO. Eclipse way of turning the feature on/off seems to me easily accessible
and discoverable. NetBeans doesn't have such a toolbar to provide some button so it would have to be probably in
Navigate menu, something like "Synchronize selection" check box. 

HIE guys, please provide comments.
Comment 19 Milan Kubec 2008-10-29 13:50:46 UTC
Other thing is that whether we want to have sync in both directions, as Eclipse does? Selecting (not double clicking) a
node in Explorer would select the file in Editor.
Comment 20 Milan Kubec 2008-10-30 15:34:35 UTC
Jesse, is 1b. still a valid concern?
Comment 21 Milan Kubec 2008-10-31 08:41:43 UTC
*** Issue 72382 has been marked as a duplicate of this issue. ***
Comment 22 Milan Kubec 2008-11-04 12:56:25 UTC
Reassigning to jrojcek to some HIE insight.
Comment 23 Milan Kubec 2008-11-21 10:38:06 UTC
*** Issue 135897 has been marked as a duplicate of this issue. ***
Comment 24 Ondrej Langr 2008-11-21 17:46:31 UTC
UI spec does not seem to be needed as it is just a feature which can be on/off, i.e. it requires only one option.
Location for the option to enable/disable synchronization has been added to permanent UI specification
(http://wiki.netbeans.org/MainMenu). It is the view menu, below the "Show Versioning Labels" menu item. 

The permanent UI spec. assumes:
1) The option would be off by default (to keep current behavior for current users) 
2) Current shortcuts would remain too. 

I assume this is all which is needed from HIE, so re-assigning back.
Comment 25 Quality Engineering 2008-11-27 05:34:10 UTC
Integrated into 'main-golden', will be available in build *200811270201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/ab06cad09216
User: Milan Kubec <mkubec@netbeans.org>
Log: #71319: synchronization of selected node between editor and Projects and Files views
Comment 26 Quality Engineering 2008-12-07 05:28:49 UTC
Integrated into 'main-golden', will be available in build *200812070201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/1809ec7ce2b0
User: Lukas Hasik <lhasik@netbeans.org>
Log: #71319: adding the new menu item to perm ui spec
Comment 27 Tomas Danek 2008-12-10 14:29:01 UTC
i guess fixed..works fine, verified in 20081208