Skip to content
Permalink
Browse files

Merge pull request #5274 from rstudio/bugfix/save-all/satellites

Make Save All command work across satellites
  • Loading branch information...
jmcphers committed Aug 21, 2019
2 parents d4ee623 + 20ed30c commit b86e763a9ccf0f00cd35bf95d0a3c3569640e9b7
@@ -1016,7 +1016,8 @@ well as menu structures (for main menu and popup menus).
label="Save All Source Documents"
menuLabel="Sa_ve All"
buttonLabel=""
desc="Save all open documents"/>
desc="Save all open documents"
windowMode="main"/>

<cmd id="saveSourceDocWithEncoding"
label="Save Current Document with Encoding..."
@@ -2214,6 +2214,7 @@ private void cpsExecuteForEachEditor(ArrayList<EditingTarget> editors,
@Handler
public void onSaveAllSourceDocs()
{
// Save all documents in the main window
cpsExecuteForEachEditor(editors_, new CPSEditingTargetCommand()
{
@Override
@@ -2229,6 +2230,9 @@ public void execute(EditingTarget target, Command continuation)
}
}
});

// Save all documents in satellite windows
windowManager_.saveUnsavedDocuments(null, null);
}


@@ -3923,7 +3927,15 @@ private void manageSaveCommands()


private void manageSaveAllCommand()
{
{
// if source windows are open, managing state of the command becomes
// complicated, so leave it enabled
if (windowManager_.areSourceWindowsOpen())
{
commands_.saveAllSourceDocs().setEnabled(true);
return;
}

// if one document is dirty then we are enabled
for (EditingTarget target : editors_)
{
@@ -333,6 +333,11 @@ public boolean isSourceWindowOpen(String windowId)
return sourceWindows_.containsKey(windowId);
}

public boolean areSourceWindowsOpen()
{
return !sourceWindows_.isEmpty();
}

public String getWindowIdOfDocPath(String path)
{
SourceDocument doc = getDocFromPath(path);
@@ -379,7 +384,6 @@ public void saveWithPrompt(UnsavedChangesItem item, Command onCompleted)
public void saveUnsavedDocuments(final Set<String> ids,
final Command onCompleted)
{

doForAllSourceWindows(new SourceWindowCommand()
{
@Override

0 comments on commit b86e763

Please sign in to comment.
You can’t perform that action at this time.