Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Edit Project Prefs button #11095

Merged
merged 5 commits into from May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -2633,11 +2633,11 @@ public interface PrefsConstants extends com.google.gwt.i18n.client.Messages {
String pythonPreferencesText();

/**
* Translated "(NOTE: This project has already been configured with its own Python interpreter. Use the Project Options dialog to change the version of Python used in this project.".
* Translated "(NOTE: This project has already been configured with its own Python interpreter. Use the Edit Project Options button to change the version of Python used in this project.)".
*
* @return translated "(NOTE: This project has already been configured with its own Python interpreter. Use the Project Options dialog to change the version of Python used in this project."
* @return translated "(NOTE: This project has already been configured with its own Python interpreter. Use the Edit Project Options button to change the version of Python used in this project.)"
*/
@DefaultMessage("(NOTE: This project has already been configured with its own Python interpreter. Use the Project Options dialog to change the version of Python used in this project.")
@DefaultMessage("(NOTE: This project has already been configured with its own Python interpreter. Use the Edit Project Options button to change the version of Python used in this project.)")
@Key("overrideText")
String overrideText();

Expand Down Expand Up @@ -4530,20 +4530,20 @@ public interface PrefsConstants extends com.google.gwt.i18n.client.Messages {
String editingUseNativePipeOperatorLabel();

/**
* Translated "NOTE: Some of these settings may be overridden by project-specific preferences."
* Translated "NOTE: Some of these settings may be overridden by project-specific options."
*
* @return translated "NOTE: Some of these settings may be overridden by project-specific preferences."
* @return translated "NOTE: Some of these settings may be overridden by project-specific options."
*/
@DefaultMessage("NOTE: Some of these settings may be overridden by project-specific preferences.")
@DefaultMessage("NOTE: Some of these settings may be overridden by project-specific options.")
@Key("editingProjectOverrideInfoText")
String editingProjectOverrideInfoText();

/**
* Translated "Edit Project Preferences..."
* Translated "Edit Project Options..."
*
* @return translated "Edit Project Preferences..."
* @return translated "Edit Project Options..."
*/
@DefaultMessage("Edit Project Preferences...")
@DefaultMessage("Edit Project Options...")
@Key("editProjectPreferencesButtonLabel")
String editProjectPreferencesButtonLabel();

Expand Down
Expand Up @@ -294,7 +294,7 @@ newRSConnectCloudPageSubTitle=A cloud service run by RStudio. Publish Shiny appl
newRSConnectCloudPageSub=and interactive documents to the Internet.
newRSConnectCloudPageCaption=Connect ShinyApps.io Account
pythonPreferencesText=(No interpreter selected)
overrideText=(NOTE: This project has already been configured with its own Python interpreter. Use the Project Options dialog to change the version of Python used in this project.
overrideText=(NOTE: This project has already been configured with its own Python interpreter. Use the Edit Project Options button to change the version of Python used in this project.)
headerPythonLabel=Python
mismatchWarningBarText=The active Python interpreter has been changed by an R startup script.
progressIndicatorText=Finding interpreters...
Expand Down Expand Up @@ -491,8 +491,8 @@ editingAutoDetectIndentationLabel=Auto-detect code indentation
editingAutoDetectIndentationDesc=When enabled, the indentation for documents not part of an RStudio project will be automatically detected.
editingInsertMatchingLabel=Insert matching parens/quotes
editingUseNativePipeOperatorLabel=Use native pipe operator, |> (requires R 4.1+)
editingProjectOverrideInfoText=NOTE: Some of these settings may be overridden by project-specific preferences.
editProjectPreferencesButtonLabel=Edit Project Preferences...
editingProjectOverrideInfoText=NOTE: Some of these settings may be overridden by project-specific options.
editProjectPreferencesButtonLabel=Edit Project Options...
editingReindentOnPasteLabel=Auto-indent code after paste
editingVerticallyAlignArgumentsIndentLabel=Vertically align arguments in auto-indent
editingContinueCommentsOnNewlineLabel=Continue comment when inserting new line
Expand Down
Expand Up @@ -294,7 +294,7 @@ newRSConnectCloudPageSubTitle=C''est un service en nuage géré par RStudio. Pub
newRSConnectCloudPageSub=et des documents interactifs sur Internet.
newRSConnectCloudPageCaption=Connecter le compte ShinyApps.io
pythonPreferencesText=(Aucun interpréteur sélectionné)
overrideText=(NOTE : Ce projet a déjà été configuré avec son propre interpréteur Python. Utilisez le dialogue Options du projet pour modifier la version de Python utilisée dans ce projet.
overrideText=(NOTE : Ce projet a déjà été configuré avec son propre interpréteur Python. Utilisez le dialogue Options du projet pour modifier la version de Python utilisée dans ce projet.)
headerPythonLabel=Python
mismatchWarningBarText=L''interpréteur Python actif a été modifié par un script de démarrage R.
progressIndicatorText=Recherche d''interpréteurs...
Expand Down
Expand Up @@ -15,8 +15,14 @@
package org.rstudio.studio.client.workbench.prefs.views;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.HorizontalPanel;
import org.rstudio.core.client.StringUtil;
import org.rstudio.core.client.prefs.RestartRequirement;
import org.rstudio.core.client.widget.SmallButton;
import org.rstudio.studio.client.workbench.commands.Commands;
import org.rstudio.studio.client.workbench.prefs.PrefsConstants;
import org.rstudio.studio.client.workbench.prefs.model.UserPrefs;

Expand All @@ -27,14 +33,30 @@ public class PythonPreferencesPane extends PythonPreferencesPaneBase<UserPrefs>
{
@Inject
public PythonPreferencesPane(PythonDialogResources res,
PythonServerOperations server)
PythonServerOperations server,
Commands commands)
{

super("420px", constants_.pythonPreferencesText(), false);


projectPrefsPanel_ = new HorizontalPanel();
projectPrefsPanel_.getElement().getStyle().setMarginTop(5, Style.Unit.PX);
overrideLabel_ = new Label();
add(overrideLabel_);
projectPrefsPanel_.add(overrideLabel_);

SmallButton editProjectSettings = new SmallButton(constants_.editProjectPreferencesButtonLabel());
editProjectSettings.getElement().getStyle().setMarginLeft(5, Style.Unit.PX);
editProjectSettings.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event)
{
// open the project options pane for editing
// this will open to the General tab, but it would be ideal if we could open directly to Editing tab
commands.projectOptions().execute();
}
});
projectPrefsPanel_.add(editProjectSettings);
add(projectPrefsPanel_);
}

@Override
Expand All @@ -52,13 +74,13 @@ protected void initialize(UserPrefs prefs)
constants_.overrideText();

overrideLabel_.setText(text);
overrideLabel_.setVisible(true);
overrideLabel_.addStyleName(RES.styles().overrideLabel());
projectPrefsPanel_.setVisible(true);
}
else
{
overrideLabel_.setVisible(false);
overrideLabel_.removeStyleName(RES.styles().overrideLabel());
projectPrefsPanel_.setVisible(false);
}
}

Expand All @@ -83,6 +105,7 @@ public RestartRequirement onApply(UserPrefs prefs)
}

private final Label overrideLabel_;
private final HorizontalPanel projectPrefsPanel_;
private static final PrefsConstants constants_ = GWT.create(PrefsConstants.class);

}