Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Add function to suggest untitled document name #89

Merged
merged 5 commits into from
Jan 18, 2012
Merged

Conversation

chrisbank
Copy link
Contributor

This is to fix #26

function _getUntitledFileSuggestion( dir, baseFileName, fileExt ) {
var suggestedName = baseFileName + fileExt;
var dirEntry = new NativeFileSystem.DirectoryEntry(dir);
var result = $.Deferred();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By convention, we should use new with $.Deferred() (it isn't necessary, but does make the code a bit easier to read).

@gruehle
Copy link
Member

gruehle commented Jan 16, 2012

The async code looks good, but it feels a bit odd putting it in ProjectManager like that. How about doing this async implementation, but back in FileCommandHandlers. The call to ProjectManager.createNewItem() would be made in the done() handler.

@chrisbank
Copy link
Contributor Author

If I call ProjectManager.createNewItem() in my done handler, how do I return the results to the caller of handleFileNewInProject?

@gruehle
Copy link
Member

gruehle commented Jan 17, 2012

You would need to add a new Deferred in handleFileNewInProject, and return that. The new Deferred would resolve()/reject() based on the result of the Deferred returned from ProjectManager.createNewItem(). Asynchronous coding at it's finest :-)

@chrisbank
Copy link
Contributor Author

Should be ready to roll

gruehle added a commit that referenced this pull request Jan 18, 2012
Add function to suggest untitled document name
@gruehle gruehle merged commit 21bc941 into master Jan 18, 2012
sedge pushed a commit to sedge/nimble that referenced this pull request Mar 12, 2015
sedge added a commit to sedge/nimble that referenced this pull request Mar 12, 2015
gideonthomas pushed a commit to gideonthomas/brackets that referenced this pull request Mar 13, 2015
sedge pushed a commit to sedge/nimble that referenced this pull request Mar 18, 2015
sedge pushed a commit to sedge/nimble that referenced this pull request Apr 20, 2015
gideonthomas pushed a commit to gideonthomas/brackets that referenced this pull request May 15, 2015
gideonthomas pushed a commit to gideonthomas/brackets that referenced this pull request May 20, 2015
sedge pushed a commit to sedge/nimble that referenced this pull request May 27, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle existing Untitled.js file for File > New
2 participants