apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.69k stars 853 forks source link

Document Groups don't import correctly #6588

Open MichalGasparovic opened 1 year ago

MichalGasparovic commented 1 year ago

Apache NetBeans version

Apache NetBeans 19

What happened

When importing the settings, all document groups are transferred correctly, but the documents themselves are not. I have been registering the problem since version 17.

How to reproduce

No response

Did this work correctly in an earlier version?

Apache NetBeans 17

Operating System

linux

JDK

openjdk version "11.0.20.1" 2023-08-24 OpenJDK Runtime Environment (build 11.0.20.1+1-post-Ubuntu-0ubuntu122.04) OpenJDK 64-Bit Server VM (build 11.0.20.1+1-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

mbien commented 1 year ago

I am not quite sure what you mean by "document groups"

neilcsmith-net commented 1 year ago

@mbien it's under the Window menu. Although I'm unclear exactly the issue? That the group names themselves are migrated, but that the documents they refer to are not?

mbien commented 1 year ago

@neilcsmith-net wow, didn't even know that this existed

neilcsmith-net commented 1 year ago

OK, just set up some groups in NB19, then imported settings into NB20-rc3. Group names are there, but they have no documents included.

@neilcsmith-net wow, didn't even know that this existed

I've never used it to be honest, unlike project groups which kind of fulfil that requirement for me.

mbien commented 1 year ago

you know... this looks quite useful! One thing is missing: if switching to the group "none" would automatically stash the last group into "stashed group", so that you can switch back when you are done.

neilcsmith-net commented 1 year ago

Looks related to something @lkishalmi brought up a while back on importing window configuration. There's a DocumentGroups folder in <userdir>/config that contains the group configuration and window modes, which are copied across, but window settings files (hence document references) that are not. I'm not sure if it's a good idea to bring those across as is though?

EDIT: I also deleted the DocumentGroups folder and restarted NB19, and the group names still showed up, so it might be somewhere else they're stored that is being imported.

jroman commented 7 months ago

Any hope for advance in this bug?

I came to this thread from a collateral effect. After upgrading from v20 to v21 I had my settings imported when opening for the first time, but the editor tabs I have open in v20 were not open in v21 (editor was plain empty).

I tried creating a "Document group" in v20, and the group is available in v21, but the editor opens empty again and if I open the Document group nothing happens.

I see that "Document group" functionality is worth evaluating for the day to day, but for now I just wanted to move from v20 to v21 and keeping in v21 the same editor tabs I had (and still have) in v20

Any other idea for starting v21 with the same open files as I have in v20?

Thanks in advance.

mbien commented 7 months ago

@jroman opened files are currently not imported since those are part of regular UI persistence which has no compatibility promises between versions.

You can try to replace the config manually: it would be in [netbeans_user_config]/[version]/config/Windows2Local/* this usually works but there are no guarantees.

I tried to look into this a few times already but always got distracted by code cleanups (https://github.com/apache/netbeans/pull/7155) since the part of the codebase is ancient and had several other issues with higher priority (e.g https://github.com/apache/netbeans/pull/6094, https://github.com/apache/netbeans/pull/6559), but we are going to get to this one day - I would like to see this too.

mbien commented 7 months ago

ran a few experiments: letting NB auto import config/Windows2Local/.* (or a subset of it) would break things since NB would try to deserialize UI components before the right clusters are active, this will open the tabs but the state is inconsistent (it will also throw exceptions).

what seems to work a bit better is:

since this makes sure that the right clusters are active before the deserialization begins.

jroman commented 7 months ago

Thanks for your reply!

That worked for me. I hope there is no incompatibility with the config files...

neilcsmith-net commented 7 months ago

@mbien it might be better to look at storing as a set of URI instead, similar to parts of the project group support. Possibly even hide the document groups from the UI and just support project grouping?

mbien commented 7 months ago

@neilcsmith-net I believe this wouldn't work properly, since it wouldn't be able to create the project group/doc group -> files associations. If would open the files but if you switch pg or dg it wouldn't do anything.

mbien commented 6 months ago

I just noticed while testing that ant projects seem to store a file list per project group directly in the project folder in nbproject/private/private.xml

its interesting to me that different project types have different ways how to handle this.