Skip to content

Commit

Permalink
source the file path if the document has no unsaved changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Jun 27, 2011
1 parent 3ec9348 commit 7798590
Showing 1 changed file with 21 additions and 13 deletions.
Expand Up @@ -40,7 +40,6 @@
import org.rstudio.core.client.regex.Match;
import org.rstudio.core.client.regex.Pattern;
import org.rstudio.core.client.widget.*;
import org.rstudio.studio.client.RStudioGinjector;
import org.rstudio.studio.client.application.Desktop;
import org.rstudio.studio.client.application.events.ChangeFontSizeEvent;
import org.rstudio.studio.client.application.events.ChangeFontSizeHandler;
Expand Down Expand Up @@ -1395,18 +1394,27 @@ private void sourceActiveDocument(final boolean echo)
{
boolean sweave = fileType_.canCompilePDF();


server_.saveActiveDocument(code, sweave, new SimpleRequestCallback<Void>() {
@Override
public void onResponseReceived(Void response)
{
consoleDispatcher_.executeSourceCommand(
"~/.active-rstudio-document",
"UTF-8",
activeCodeIsAscii(),
echo);
}
});
if (dirtyState_.getValue() || sweave)
{
server_.saveActiveDocument(code, sweave, new SimpleRequestCallback<Void>() {
@Override
public void onResponseReceived(Void response)
{
consoleDispatcher_.executeSourceCommand(
"~/.active-rstudio-document",
"UTF-8",
activeCodeIsAscii(),
echo);
}
});
}
else
{
consoleDispatcher_.executeSourceCommand(getPath(),
"UTF-8",
activeCodeIsAscii(),
echo);
}
}

// update pref if necessary
Expand Down

0 comments on commit 7798590

Please sign in to comment.