Search in sources :

Example 1 with NewProjectResult

use of org.rstudio.studio.client.projects.model.NewProjectResult in project rstudio by rstudio.

the class Projects method handleNewProject.

private void handleNewProject(boolean forceSaveAll, final boolean allowOpenInNewWindow) {
    // first resolve the quit context (potentially saving edited documents   
    // and determining whether to save the R environment on exit)
    applicationQuit_.prepareForQuit("Save Current Workspace", forceSaveAll, new ApplicationQuit.QuitContext() {

        @Override
        public void onReadyToQuit(final boolean saveChanges) {
            projServer_.getNewProjectContext(new SimpleRequestCallback<NewProjectContext>() {

                @Override
                public void onResponseReceived(NewProjectContext context) {
                    NewProjectWizard wiz = new NewProjectWizard(session_.getSessionInfo(), pUIPrefs_.get(), pWorkbenchContext_.get(), new NewProjectInput(FileSystemItem.createDir(pUIPrefs_.get().defaultProjectLocation().getValue()), context), allowOpenInNewWindow, new ProgressOperationWithInput<NewProjectResult>() {

                        @Override
                        public void execute(NewProjectResult newProject, ProgressIndicator indicator) {
                            indicator.onCompleted();
                            createNewProject(newProject, saveChanges);
                        }
                    });
                    wiz.showModal();
                }
            });
        }
    });
}
Also used : NewProjectResult(org.rstudio.studio.client.projects.model.NewProjectResult) NewProjectContext(org.rstudio.studio.client.projects.model.NewProjectContext) ApplicationQuit(org.rstudio.studio.client.application.ApplicationQuit) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) NewProjectInput(org.rstudio.studio.client.projects.model.NewProjectInput) NewProjectWizard(org.rstudio.studio.client.projects.ui.newproject.NewProjectWizard) SimpleRequestCallback(org.rstudio.studio.client.common.SimpleRequestCallback)

Example 2 with NewProjectResult

use of org.rstudio.studio.client.projects.model.NewProjectResult in project rstudio by rstudio.

the class VersionControlPage method collectInput.

@Override
protected NewProjectResult collectInput() {
    if (txtDirName_.getText().trim().length() == 0)
        autoFillCheckoutDir();
    String url = txtRepoUrl_.getText().trim();
    String username = txtUsername_.getText().trim();
    String checkoutDir = txtDirName_.getText().trim();
    String dir = existingRepoDestDir_.getText().trim();
    if (url.length() > 0 && checkoutDir.length() > 0 && dir.length() > 0) {
        String projFile = projFileFromDir(FileSystemItem.createDir(dir).completePath(checkoutDir));
        VcsCloneOptions options = VcsCloneOptions.create(getVcsId(), url, username, checkoutDir, dir);
        return new NewProjectResult(projFile, false, false, dir, options, null, null, null);
    } else {
        return null;
    }
}
Also used : VcsCloneOptions(org.rstudio.studio.client.common.vcs.VcsCloneOptions) NewProjectResult(org.rstudio.studio.client.projects.model.NewProjectResult)

Example 3 with NewProjectResult

use of org.rstudio.studio.client.projects.model.NewProjectResult in project rstudio by rstudio.

the class NewDirectoryNavigationPage method createPages.

private static ArrayList<WizardPage<NewProjectInput, NewProjectResult>> createPages(SessionInfo sessionInfo) {
    ArrayList<WizardPage<NewProjectInput, NewProjectResult>> pages = new ArrayList<WizardPage<NewProjectInput, NewProjectResult>>();
    // add default RStudio dialogs
    pages.add(new NewDirectoryPage());
    pages.add(new NewPackagePage());
    pages.add(new NewShinyAppPage());
    // add user-defined project template dialogs
    ProjectTemplateRegistryProvider registryProvider = RStudioGinjector.INSTANCE.getProjectTemplateRegistryProvider();
    ProjectTemplateRegistry registry = registryProvider.getProjectTemplateRegistry();
    for (String key : JsUtil.asIterable(registry.keys())) {
        JsArray<ProjectTemplateDescription> descriptions = registry.get(key);
        for (ProjectTemplateDescription description : JsUtil.asIterable(descriptions)) pages.add(new WizardProjectTemplatePage(description));
    }
    return pages;
}
Also used : NewProjectResult(org.rstudio.studio.client.projects.model.NewProjectResult) ProjectTemplateDescription(org.rstudio.studio.client.projects.model.ProjectTemplateDescription) NewProjectInput(org.rstudio.studio.client.projects.model.NewProjectInput) ArrayList(java.util.ArrayList) WizardProjectTemplatePage(org.rstudio.core.client.widget.WizardProjectTemplatePage) ProjectTemplateRegistry(org.rstudio.studio.client.projects.model.ProjectTemplateRegistry) WizardPage(org.rstudio.core.client.widget.WizardPage) ProjectTemplateRegistryProvider(org.rstudio.studio.client.projects.model.ProjectTemplateRegistryProvider)

Aggregations

NewProjectResult (org.rstudio.studio.client.projects.model.NewProjectResult)3 NewProjectInput (org.rstudio.studio.client.projects.model.NewProjectInput)2 ArrayList (java.util.ArrayList)1 ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)1 WizardPage (org.rstudio.core.client.widget.WizardPage)1 WizardProjectTemplatePage (org.rstudio.core.client.widget.WizardProjectTemplatePage)1 ApplicationQuit (org.rstudio.studio.client.application.ApplicationQuit)1 SimpleRequestCallback (org.rstudio.studio.client.common.SimpleRequestCallback)1 VcsCloneOptions (org.rstudio.studio.client.common.vcs.VcsCloneOptions)1 NewProjectContext (org.rstudio.studio.client.projects.model.NewProjectContext)1 ProjectTemplateDescription (org.rstudio.studio.client.projects.model.ProjectTemplateDescription)1 ProjectTemplateRegistry (org.rstudio.studio.client.projects.model.ProjectTemplateRegistry)1 ProjectTemplateRegistryProvider (org.rstudio.studio.client.projects.model.ProjectTemplateRegistryProvider)1 NewProjectWizard (org.rstudio.studio.client.projects.ui.newproject.NewProjectWizard)1