Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rstudio/rstudio
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheng5 committed Jul 14, 2011
2 parents fe5ed7f + 461611f commit b1523ab
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/cpp/session/modules/SessionWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ void enqueAssignedEvent(const r::sexp::Variable& variable)
// server mode. this means that if you are ever suspended then you will always
// end up with a 'dirty' workspace. not a big deal considering how infrequently
// quit occurs in server mode.
// TODO: this now affects switching projects after a suspend. we should try
// to figure out how to preserve dirty state of the workspace accross suspend
int s_lastSaveAction = r::session::kSaveActionAsk;

void enqueSaveActionChanged()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,32 @@

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Focusable;

public class DirectoryChooserTextBox extends TextBoxWithButton
{
public DirectoryChooserTextBox(String label)
public DirectoryChooserTextBox(String label, Focusable focusAfter)
{
this(label,
focusAfter,
RStudioGinjector.INSTANCE.getFileDialogs(),
RStudioGinjector.INSTANCE.getRemoteFileSystemContext());
}

public DirectoryChooserTextBox(String label,
FileDialogs fileDialogs,
FileSystemContext fsContext)
final Focusable focusAfter,
final FileDialogs fileDialogs,
final FileSystemContext fsContext)
{
super(label, "Browse...", null);
fileDialogs_ = fileDialogs;
fsContext_ = fsContext;

addClickHandler(new ClickHandler()
{
public void onClick(ClickEvent event)
{
fileDialogs_.chooseFolder(
fileDialogs.chooseFolder(
"Choose Directory",
fsContext_,
fsContext,
FileSystemItem.createDir(getText()),
new ProgressOperationWithInput<FileSystemItem>()
{
Expand All @@ -43,13 +44,12 @@ public void execute(FileSystemItem input,

setText(input.getPath());
indicator.onCompleted();
if (focusAfter != null)
focusAfter.setFocus(true);
}
});
}
});

}

private final FileDialogs fileDialogs_;
private final FileSystemContext fsContext_;
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,12 @@ public void onValueChange(ValueChangeEvent<Boolean> event)
emptyLocationPanel.add(txtProjectName_);

// project dir
newProjectParent_ = new DirectoryChooserTextBox("Create in:");
newProjectParent_ = new DirectoryChooserTextBox("Create in:",
txtProjectName_);
newProjectParent_.setText(defaultNewProjectLocation_.getPath());

emptyLocationPanel.add(newProjectParent_);

verticalPanel.add(emptyLocationPanel);

verticalPanel.add(new HTML("<br/>"));
Expand Down Expand Up @@ -207,7 +209,7 @@ public void execute()
VerticalPanel existingLocationPanel = new VerticalPanel();
existingLocationPanel.addStyleName(styles.newProjectLocationPanel());

existingProjectDir_ = new DirectoryChooserTextBox("Directory:");
existingProjectDir_ = new DirectoryChooserTextBox("Directory:", null);
existingLocationPanel.add(existingProjectDir_);
verticalPanel.add(existingLocationPanel);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public void onClick(ClickEvent event)

add(tight(new Label("Default working directory (when not in a project):")));
add(dirChooser_ = new DirectoryChooserTextBox(null,
null,
fileDialogs_,
fsContext_));
dirChooser_.addStyleName(res_.styles().spaced());
Expand Down

0 comments on commit b1523ab

Please sign in to comment.