@Override public void notifyIfVersionOutOfDate() { CloudSdkValidator sdkValidator = CloudSdkValidator.getInstance(); if (sdkValidator .validateCloudSdk() .contains(CloudSdkValidationResult.CLOUD_SDK_NOT_MINIMUM_VERSION)) { String message = "<p>" + CloudSdkValidationResult.CLOUD_SDK_NOT_MINIMUM_VERSION.getMessage() + "</p>"; showNotification( CloudSdkMessageBundle.message("appengine.cloudsdk.version.support.title"), message); } }
new TreeSet<>(CloudSdkValidator.getInstance().validateCloudSdk(path));
private void checkCommonConfig(AppEngineDeployable deployable) throws RuntimeConfigurationError { // do not check SDK if it supports dynamic install - the deployment runner will block itself // until installation is done. CloudSdkService cloudSdkService = CloudSdkService.getInstance(); SdkStatus sdkStatus = cloudSdkService.getStatus(); if (sdkStatus != SdkStatus.READY && !cloudSdkService.isInstallSupported()) { Set<CloudSdkValidationResult> sdkValidationResult = CloudSdkValidator.getInstance().validateCloudSdk(); if (!sdkValidationResult.isEmpty()) { CloudSdkValidationResult result = Iterables.getFirst(sdkValidationResult, null); throw new RuntimeConfigurationError( AppEngineMessageBundle.message( "appengine.flex.config.server.error", result.getMessage())); } } check( deployable instanceof UserSpecifiedPathDeploymentSource || deployable.isValid(), "appengine.config.deployment.source.error"); check( StringUtils.isNotBlank(cloudProjectName), "appengine.flex.config.project.missing.message"); }
public void apply() throws ConfigurationException { CloudSdkServiceUserSettings sdkServiceUserSettings = CloudSdkServiceUserSettings.getInstance(); if (customRadioButton.isSelected()) { String customSdkPathText = getCloudSdkDirectoryText(); if (CloudSdkValidator.getInstance() .validateCloudSdk(customSdkPathText) .contains(CloudSdkValidationResult.MALFORMED_PATH)) { throw new ConfigurationException( CloudSdkMessageBundle.message("appengine.cloudsdk.location.badchars.message")); } sdkServiceUserSettings.setCustomSdkPath(customSdkPathText); } CloudSdkServiceType previousSdkType = sdkServiceUserSettings.getUserSelectedSdkServiceType(); if (previousSdkType != selectedCloudSdkServiceType) { // notify SDK manager about changed selection ServiceManager.getService(CloudSdkServiceManager.class) .onNewCloudSdkServiceTypeSelected(selectedCloudSdkServiceType); } sdkServiceUserSettings.setUserSelectedSdkServiceType(selectedCloudSdkServiceType); boolean previousAutomaticUpdateEnabled = sdkServiceUserSettings.isAutomaticUpdateEnabled(); sdkServiceUserSettings.setEnableAutomaticUpdates(enableAutomaticUpdatesCheckbox.isSelected()); if (enableAutomaticUpdatesCheckbox.isSelected() && !previousAutomaticUpdateEnabled) { // activate updates again. ManagedCloudSdkUpdateService.getInstance().activate(); } // settings are applied and saved, clear modification status settingsModified = false; }
@VisibleForTesting void showCloudSdkNotification(String notificationMessage, NotificationType notificationType) { if (!CloudSdkValidator.getInstance().isValidCloudSdk()) { Notification invalidSdkWarning = new Notification( new PropertiesFileFlagReader().getFlagString("notifications.plugin.groupdisplayid"), CloudSdkMessageBundle.message("cloudsdk.notification.title"), notificationMessage, notificationType); // add a link to SDK settings for a quick fix if this is a fatal error. if (notificationType == NotificationType.ERROR) { invalidSdkWarning.addAction( new AnAction( CloudSdkMessageBundle.message("appengine.deployment.error.sdk.settings.action")) { @Override public void actionPerformed(AnActionEvent e) { ShowSettingsUtil.getInstance() .showSettingsDialog( null /* IDE-wide settings, no project needed. */, CloudSdkConfigurable.class); // expire if action has been called to avoid error hanging out forever. invalidSdkWarning.expire(); } }); } Notifications.Bus.notify(invalidSdkWarning); } }
@Override public void notifyIfVersionParseError() { CloudSdkValidator sdkValidator = CloudSdkValidator.getInstance(); try { CloudSdk cloudSdk = sdkValidator.buildCloudSdk(); // Try to get the version; if fails with exception, then notify the user. cloudSdk.getVersion(); } catch (CloudSdkNotFoundException ex) { // Cloud SDK not found. Don't notify. } catch (CloudSdkVersionFileException ex) { String message = "<p>" + CloudSdkValidationResult.CLOUD_SDK_VERSION_FILE_ERROR.getMessage() + "</p>"; showNotification( CloudSdkMessageBundle.message("appengine.cloudsdk.version.file.error.title"), message); UsageTrackerService.getInstance() .trackEvent(GctTracking.SDK_VERSION_PARSE_ERROR) .addMetadata(GctTracking.METADATA_LABEL_KEY, ex.getMessage()) .ping(); } }
@Override public void checkConfiguration() throws RuntimeConfigurationException { if (artifactPointer == null || artifactPointer.getArtifact() == null) { throw new RuntimeConfigurationError( AppEngineMessageBundle.message("appengine.run.server.artifact.missing")); } // do not check SDK if it supports dynamic install - the deployment runner will block itself // until installation is done. CloudSdkService cloudSdkService = CloudSdkService.getInstance(); SdkStatus sdkStatus = cloudSdkService.getStatus(); if (sdkStatus != SdkStatus.READY && !cloudSdkService.isInstallSupported()) { if (!CloudSdkValidator.getInstance().isValidCloudSdk()) { throw new RuntimeConfigurationError( AppEngineMessageBundle.message("appengine.run.server.sdk.misconfigured.panel.message")); } } if (ProjectRootManager.getInstance(commonModel.getProject()).getProjectSdk() == null) { throw new RuntimeConfigurationError( AppEngineMessageBundle.getString("appengine.run.server.nojdk")); } }