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 258843

Summary: [launchers] Launchers properties are not VCS friendly
Product: cnd Reporter: Vladimir Voskresensky <vv159170>
Component: ProjectAssignee: Alexander Simon <alexvsimon>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 258806    

Description Vladimir Voskresensky 2016-04-14 23:08:06 UTC
when only private launchers are modified in Launchers Manager and press OK => project's global launchers file is modified.

Please, don't write public file when only private launchers are changed 
and vice versa
Please, don't write private file when only public launchers are changed
Comment 1 Alexander Simon 2016-04-15 06:42:26 UTC
Unfortunately launcher list contains ordered list of public and private launchers. IDE make the best to preserve launchers ID in the public list.
IDE changed launchers only first time (to normalize numbering and content).
Next editing should not change public file content if number and order public launchers is not changed.
Comment 2 Alexander Simon 2016-04-15 10:14:11 UTC
By the way the launcher file structure is not well designed to avoid a big difference with small changes. The following structure would minimize difference:

[common]
env.x=y
rundir=/home

[launcher=1]
displayName=simple echo
runCommand=echo Hi

[launcer=2]
displayName=directory
runCommand=ls -la

Apparently nobody do not think about VCS when launchers were introduced.
Comment 3 Vladimir Voskresensky 2016-04-15 10:37:50 UTC
better 
[launcher1]
vs.
[launcher=1]
Comment 4 Vladimir Voskresensky 2016-04-15 10:39:53 UTC
(In reply to Alexander Simon from comment #1)
> Unfortunately launcher list contains ordered list of public and private
> launchers. IDE make the best to preserve launchers ID in the public list.
> IDE changed launchers only first time (to normalize numbering and content).
> Next editing should not change public file content if number and order
> public launchers is not changed.
I do zero reordering or add/remove/copy activity.
I only change property of existing launcher, so no numbers are changed.
Please, preserve them as is
Comment 5 Alexander Simon 2016-04-15 10:55:57 UTC
(In reply to Vladimir Voskresensky from comment #4)
> (In reply to Alexander Simon from comment #1)
> > Unfortunately launcher list contains ordered list of public and private
> > launchers. IDE make the best to preserve launchers ID in the public list.
> > IDE changed launchers only first time (to normalize numbering and content).
> > Next editing should not change public file content if number and order
> > public launchers is not changed.
> I do zero reordering or add/remove/copy activity.
> I only change property of existing launcher, so no numbers are changed.
> Please, preserve them as is

As I said the initial reformatting will be done in any case.
Please provide steps to reproduce the bug beside initial reformatting.
Comment 6 Vladimir Voskresensky 2016-04-19 09:34:58 UTC
The current grammar to define launchers are not VCS friendly. It's easy to see when change order of launchers and file completely changed + comments are lost.

The new proposal is based on Alex's 
https://netbeans.org/bugzilla/show_bug.cgi?id=258843#c2

We should support loading old format, but when write we should use the new one which also persists comments:

[common]
env.x=y
rundir=/home

[launcher]
position=10
displayName=simple echo
runCommand=echo Hi

#comments are attached
#to the next non comment line
[launcer]
postion=20
displayName=directory
#comment attached to the next property
runCommand=ls -la
Comment 7 Alexander Simon 2016-04-19 10:14:40 UTC
(In reply to Vladimir Voskresensky from comment #6)
> The current grammar to define launchers are not VCS friendly. It's easy to
> see when change order of launchers and file completely changed + comments
> are lost.
> 
> The new proposal is based on Alex's 
> https://netbeans.org/bugzilla/show_bug.cgi?id=258843#c2
> 
> We should support loading old format, but when write we should use the new
> one which also persists comments:
> 
> [common]
> env.x=y
> rundir=/home
> 
> [launcher]
> position=10
> displayName=simple echo
> runCommand=echo Hi
> 
> #comments are attached
> #to the next non comment line
> [launcer]
> postion=20
> displayName=directory
> #comment attached to the next property
> runCommand=ls -la

Sections in property file should have different names.
Please, fix section names
Comment 8 Vladimir Voskresensky 2016-04-19 11:38:00 UTC
(In reply to Alexander Simon from comment #7)
> Sections in property file should have different names.
Please, explain, why?
Comment 9 Alexander Simon 2016-04-19 11:45:15 UTC
(In reply to Vladimir Voskresensky from comment #8)
> (In reply to Alexander Simon from comment #7)
> > Sections in property file should have different names.
> Please, explain, why?

Your proposal is very different from standard properties/config files are used in real applications. It is not intuitive understandable that sections with same name are different.
Compare your proposal with git config file:
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = https://github.com/git/git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
Comment 10 Vladimir Voskresensky 2016-04-19 11:49:13 UTC
I'm ok to have current launcher with Index as the section name, so
[launcherNNNN]
where NNNN is an integer number is OK from your POV?
Comment 11 Vladimir Voskresensky 2016-04-19 11:50:40 UTC
Then position attribute is not needed
Comment 12 Alexander Simon 2016-04-19 11:59:06 UTC
(In reply to Vladimir Voskresensky from comment #10)
> I'm ok to have current launcher with Index as the section name, so
> [launcherNNNN]
> where NNNN is an integer number is OK from your POV?

I'd prefer to avoid number (ordering) at all:
[launcher "My Launcher"]

Menu is created as sorted list (by name) public and private launchers.
There is no default launcher name (currently as missing name is used command).
Comment 13 Alexander Simon 2016-04-19 12:10:52 UTC
(In reply to Vladimir Voskresensky from comment #6)
> It's easy to
> see when change order of launchers and file completely changed + comments
> are lost.

Launchers UI is not editor that keep all user additional comments.
It supports predefined set of properties in property file and do not keep other extra stuff. And do not support user ordering of properties.
Comment 14 Vladimir Voskresensky 2016-04-19 12:51:00 UTC
As the user of launchers I can confirm that ability to reorder and keep of comments is the "request" for this feature to be comfortably usable
Comment 15 Alexander Simon 2016-04-19 13:22:19 UTC
(In reply to Vladimir Voskresensky from comment #14)
> As the user of launchers I can confirm that ability to reorder and keep of
> comments is the "request" for this feature to be comfortably usable

Sorry, I do not understand where you see comments in launchers UI dialogue?
Are you trying simultaneously work with UI and edit property file?
What is your real use case?
Comment 16 Vladimir Voskresensky 2016-04-19 13:38:34 UTC
This is true.
I comment and edit launchers in property file, because now it is simpler and allow me to keep in comments some previous states.
I expected we were trying to make usable UI for that.
Comment 17 Alexander Simon 2016-04-20 09:37:00 UTC
(In reply to Vladimir Voskresensky from comment
Comment 18 Alexander Simon 2016-04-20 09:37:52 UTC
(In reply to Vladimir Voskresensky from comment #16)
> This is true.
> I comment and edit launchers in property file, because now it is simpler and
> allow me to keep in comments some previous states.
> I expected we were trying to make usable UI for that.

As I understand you need a several previous command states?
I can suggest a "Hide or Disable" launcher flag.
So workflow is:
- you going to modify command and want to keep a current command state.
- create copy of a launcher, set "Disable" flag in a copied
- modify the launcher.
Comment 19 Alexander Simon 2016-04-21 12:19:41 UTC
Change set:
http://hg.netbeans.org/cnd-main/rev/656aec97f47c
- introduced new launcher attribute "hide" which allows to hide launcher in pop-up menu.
- separate modification flag for private and public meta data.
- more accurate count new launcher id in Up/Down operations.
Comment 20 Vladimir Voskresensky 2016-04-25 09:25:28 UTC
Could you, please, write empty line between launcher's sections?
Now all lines are adjusted.
#Header Comment
common.symbolFiles=
common.env.LD_LIBRARY_PAPH
launcher1000.displayName=
launcher1000.runCommand=
launcher2000.displayName=
launcher2000.runCommand=
Expected:
#Header Comment
common.symbolFiles=
common.env.LD_LIBRARY_PAPH=

launcher1000.displayName=
launcher1000.runCommand=

launcher2000.displayName=
launcher2000.runCommand=
Comment 21 Vladimir Voskresensky 2016-04-25 09:26:58 UTC
and don't forget empty line after the last launcher to prevent VCS warning: <no empty line...>
Comment 22 Vladimir Voskresensky 2016-04-25 14:15:35 UTC
I think, it's done
http://hg.netbeans.org/cnd-main/rev/7cc1c3f724c3
Comment 23 Quality Engineering 2016-04-25 19:56:13 UTC
Integrated into 'main-silver', will be available in build *201604251813* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/656aec97f47c
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixing Bug #258843 [launchers] Launchers properties are not VCS friendly