use of com.google.cloud.tools.intellij.project.CloudProject in project google-cloud-intellij by GoogleCloudPlatform.
the class GcsBucketPanelTest method testNotificationLabel_nonExistentProject.
@Test
public void testNotificationLabel_nonExistentProject() {
CloudProject nonExistingProject = CloudProject.create("non-existent-project", "non-existent-project", "non-existing-user");
when(projectSelector.getSelectedProject()).thenReturn(nonExistingProject);
bucketPanel.refresh();
assertTrue(bucketPanel.getNotificationPanel().isVisible());
assertFalse(bucketPanel.getBucketListPanel().isVisible());
assertThat(bucketPanel.getNotificationLabel().getText()).isEqualTo("Could not load buckets for selected project.");
}
use of com.google.cloud.tools.intellij.project.CloudProject in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineFlexibleDeploymentEditorTest method applyEditorTo_withUser_doesSetGoogleUsername.
@Test
public void applyEditorTo_withUser_doesSetGoogleUsername() {
when(credentialedUser.getEmail()).thenReturn(EMAIL);
CloudProject project = CloudProject.create("some-project", "some-project", EMAIL);
when(projectSelector.getSelectedProject()).thenReturn(project);
editor.applyEditorTo(configuration);
assertThat(configuration.getGoogleUsername()).isEqualTo(EMAIL);
}
use of com.google.cloud.tools.intellij.project.CloudProject in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineDeploymentConfigurationPanel method applyEditorTo.
/**
* Shared implementation of {@link
* com.intellij.openapi.options.SettingsEditor#applyEditorTo(Object)}. To be invoked by users of
* this panel in the overriden method.
*/
public void applyEditorTo(@NotNull AppEngineDeploymentConfiguration configuration) {
configuration.setVersion(versionIdField.getText());
configuration.setPromote(promoteCheckbox.isSelected());
configuration.setStopPreviousVersion(stopPreviousVersionCheckbox.isSelected());
configuration.setDeployAllConfigs(deployAllConfigsCheckbox.isSelected());
CloudProject selectedProject = projectSelector.getSelectedProject();
if (selectedProject != null) {
configuration.setCloudProjectName(selectedProject.projectId());
configuration.setGoogleUsername(selectedProject.googleUsername());
}
}
use of com.google.cloud.tools.intellij.project.CloudProject in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineDeploymentConfigurationPanel method resetEditorFrom.
/**
* Shared implementation of {@link
* com.intellij.openapi.options.SettingsEditor#resetEditorFrom(Object)}. To be invoked by users of
* this panel in the overriden method.
*/
public void resetEditorFrom(@NotNull AppEngineDeploymentConfiguration configuration) {
promoteCheckbox.setSelected(configuration.isPromote());
versionIdField.setText(configuration.getVersion());
stopPreviousVersionCheckbox.setSelected(configuration.isStopPreviousVersion());
deployAllConfigsCheckbox.setSelected(configuration.isDeployAllConfigs());
if (configuration.getEnvironment() != null) {
environmentLabel.setText(configuration.getEnvironment().localizedLabel());
}
// TODO(ivanporty) add project name to configuration and then use separate project ID field.
if (configuration.getCloudProjectName() != null && configuration.getGoogleUsername() != null) {
CloudProject cloudProject = CloudProject.create(configuration.getCloudProjectName(), configuration.getCloudProjectName(), configuration.getGoogleUsername());
projectSelector.setSelectedProject(cloudProject);
} else {
// unset project, load default active cloud project (if available for this IDE project)
projectSelector.loadActiveCloudProject();
}
refreshApplicationInfoPanel(projectSelector.getSelectedProject());
}
use of com.google.cloud.tools.intellij.project.CloudProject in project google-cloud-intellij by GoogleCloudPlatform.
the class SetupCloudRepositoryDialog method updateButtons.
private void updateButtons() {
CloudProject selectedProject = projectSelector.getSelectedProject();
Optional<CredentialedUser> user = Services.getLoginService().getLoggedInUser(selectedProject.googleUsername());
if (!StringUtil.isEmpty(selectedProject.projectId()) && !user.isPresent()) {
setErrorText(GctBundle.message("cloud.repository.dialog.invalid.project"));
setOKActionEnabled(false);
return;
}
if (!StringUtil.isEmpty(repositorySelector.getText()) && StringUtil.isEmpty(repositorySelector.getSelectedRepository())) {
setErrorText(GctBundle.message("cloud.repository.dialog.invalid.repository"));
setOKActionEnabled(false);
return;
}
if (!user.isPresent() || StringUtil.isEmpty(repositorySelector.getSelectedRepository())) {
setErrorText(null);
setOKActionEnabled(false);
return;
}
if (StringUtil.isEmpty(remoteNameSelector.getText())) {
setErrorText(GctBundle.message("uploadtogcp.dialog.missing.remote"));
setOKActionEnabled(false);
return;
}
setErrorText(null);
setOKActionEnabled(true);
}
Aggregations