Author Topic: Creating new files from the project context menu  (Read 6838 times)

icambron

  • Community Member
  • Posts: 5
  • Hero Points: 0
Creating new files from the project context menu
« on: May 12, 2008, 07:55:32 pm »
I've created a C# project. It's got a pretty deep directory hierarchy and I work on code in a bunch of different folders at once, so it's not too convenient to CD around. Fortunately, I can open any file in the whole tree via by pulling up the project files list and using the typeahead. What's inconvenient, though, is specifying which folder I want to create a new file in. The way I want to do this is to open up the hierarchical view of the project and selecting the folder I want, and using the context menu to add a new file. For some reason though, almost the entire menu is grayed-out; only the add->makefile option is available. Why aren't I allowed to add->new file?

Graeme

  • Senior Community Member
  • Posts: 2357
  • Hero Points: 309
Re: Creating new files from the project context menu
« Reply #1 on: May 13, 2008, 09:27:00 am »
In the project toolbar, if you select auto-folder "custom view" mode, the add file menu option isn't grayed out.  The "new file" dialog opens with the "location editbox" preset to the project working directory, usually.  It's grayed out in directory view because this is an unsupported/missing feature.  The reason "makefile" isn't grayed out is because this option does absolutely nothing.  If you click it you'll get "unknown command" message on the status bar possibly depending on which version of slickedit you use.  There is no projecttbAddMakefile in slick sources and no corresponding _OnUpdate function.  This is probably an oversight.

The function responsible for graying out is _OnUpdate_projecttbAddFiles() in ptoolbar.e.  The function responsible for initializing the "location editbox" is initialize_file_tab() in wkspace.e.  You can see in _OnUpdate_projecttbAddFiles where auto folder mode VPJ_AUTOFOLDERS_CUSTOMVIEW returns MF_ENABLED.  To make this work for directory view, initialize_file_tab() would have to find the folder/path associated with the current node in the project toolbar.  It's probably not hard for a slick dev to do so if you put in a feature request, it might get done.

If you click the ellipsis beside the "location editbox" in the new file dialog, you can browse to the folder you want.  You can also copy the path of the current buffer and paste it into the location editbox.  If you use file -> new, to create a new file, it looks like the location editbox is set to the current working directory if the project doesn't specify a working directory.

Graeme

icambron

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Creating new files from the project context menu
« Reply #2 on: May 13, 2008, 01:46:41 pm »
Thanks for the reply. It does seem that you're expected to do this by changing the working directory, but that's a concept I wouldn't otherwise use, and clicking the ellipsis is just painful. I'll make the feature request.

Graeme

  • Senior Community Member
  • Posts: 2357
  • Hero Points: 309
Re: Creating new files from the project context menu
« Reply #3 on: May 13, 2008, 09:46:59 pm »
I'm curious as to why browsing via the ellipsis button is harder than browsing via the project toolbar  - is it because the folders that belong to your project are scattered  - or perhaps because the project toolbar is already showing you the approximate location in the deep hierarchy (you mention) so it doesn't take many clicks to get to the folder you want?

Graeme

icambron

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Creating new files from the project context menu
« Reply #4 on: May 14, 2008, 05:29:59 pm »
The latter. I'm generally working in two or three parts of my codebase at once (which is why changing the working dir is tough), and I would have them all expanded or at least approximately expanded. The other nice thing is that it's a really nice presentation of my folder tree, which allows me to better choose where I want to put it in the first place.

lambertia

  • Senior Community Member
  • Posts: 382
  • Hero Points: 14
  • I have nothing sufficiently witty to say.
Re: Creating new files from the project context menu
« Reply #5 on: May 14, 2008, 10:59:40 pm »
Hi.

I agree with this topic. It appears to be a no brainer that if you right click in the folder you should be able to add files to the fodler's location.

Cheers,
--
Greg.

Graeme

  • Senior Community Member
  • Posts: 2357
  • Hero Points: 309
Re: Creating new files from the project context menu
« Reply #6 on: May 19, 2008, 12:58:22 pm »