private static String getCloudSdkDownloadMessage() { String openTag = "<a href='" + CLOUD_SDK_DOWNLOAD_LINK + "'>"; return CloudSdkMessageBundle.message("cloudsdk.download.message", openTag, "</a>"); }
private void checkManagedSdkFeatureStatus() { if (!ServiceManager.getService(PluginInfoService.class).shouldEnable(GctFeature.MANAGED_SDK)) { managedSdkComponentsPanel.setVisible(false); managedRadioButton.setVisible(false); customRadioButton.setSelected(true); // more specific title for this case as this panel will be re-used in multiple places. customRadioButton.setText( CloudSdkMessageBundle.getString("cloudsdk.customsdk.without.managedsdk.feature")); } }
@Nls @Override public String getDisplayName() { return CloudSdkMessageBundle.message("settings.menu.item.cloud.sdk.text"); }
sdkLogging.log(CloudSdkMessageBundle.getString("managedsdk.waiting.for.sdk.ready") + "\n");
public static String getString( @NotNull @PropertyKey(resourceBundle = BUNDLE_NAME) String key, @NotNull Object... params) { return message(key, params); } }
private void setProgressText(String message) { progressIndicator.setText( CloudSdkMessageBundle.message("managedsdk.progress.message", message)); }
public void notifyManagedSdkJobFailure(ManagedSdkJobType jobType, String errorMessage) { String message = CloudSdkMessageBundle.message( "managedsdk.failure." + jobType.name().toLowerCase(), errorMessage); showNotification(message, NotificationType.ERROR); }
public void notifyManagedSdkJobSuccess(ManagedSdkJobType jobType, ManagedSdkJobResult jobResult) { String message = CloudSdkMessageBundle.message("managedsdk.success." + jobType.name().toLowerCase()); switch (jobResult) { case PROCESSED: showNotification(message, NotificationType.INFORMATION); return; default: // do nothing, everything is up-to-date. } }
public void notifyManagedSdkJobCancellation(ManagedSdkJobType jobType) { String message = CloudSdkMessageBundle.message("managedsdk.cancel." + jobType.name().toLowerCase()); showNotification(message, NotificationType.WARNING); }
Notification notification = showNotification( CloudSdkMessageBundle.message("managedsdk.update.notification"), NotificationType.INFORMATION); notification.addAction( new AnAction(CloudSdkMessageBundle.message("managedsdk.update.notification.cancel")) { @Override public void actionPerformed(AnActionEvent e) { new AnAction(CloudSdkMessageBundle.message("managedsdk.update.notification.disable")) { @Override public void actionPerformed(AnActionEvent e) {
private Notification showNotification(String message, NotificationType notificationType) { Notification notification = NOTIFICATION_GROUP.createNotification( CloudSdkMessageBundle.message("managedsdk.notifications.title"), null /*subtitle*/, message, notificationType); notification.notify(null); return notification; } }
@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); } }
public static String buildSdkMessage(String path, boolean htmlEnabled) { if (StringUtil.isEmpty(path)) { String missingMessage = CloudSdkMessageBundle.message("cloudsdk.location.missing.message");
@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); } }
CloudSdkMessageBundle.message("cloudsdk.location.browse.window.title"),
@Test public void update_withUnknown_setsProgressIndeterminate() { String message = "working"; progressListener.start(message, ProgressListener.UNKNOWN); verify(mockProgressIndicator) .setText(CloudSdkMessageBundle.message("managedsdk.progress.message", message)); verify(mockProgressIndicator).setIndeterminate(true); }
private void executeWithSdkWriteLock(ThrowableRunnable<Exception> runWithLock) throws Exception { try { // if write lock is not available, show a progress to a user that all SDK processes must be // finished in order to update SDK. if (!CloudSdkServiceManager.getInstance().getSdkWriteLock().tryLock()) { ProgressListener waitForSdkProcessesProgress = ManagedCloudSdkServiceUiPresenter.getInstance().createProgressListener(this); waitForSdkProcessesProgress.start( CloudSdkMessageBundle.message("managedsdk.progress.wait.for.processes"), ProgressListener.UNKNOWN); try { CloudSdkServiceManager.getInstance().getSdkWriteLock().lockInterruptibly(); } finally { // make sure the indicator goes away in case of this job error/cancel waitForSdkProcessesProgress.done(); } } runWithLock.run(); } finally { CloudSdkServiceManager.getInstance().getSdkWriteLock().unlock(); } }
@Test public void update_sets_valid_mainProgressFractions() { String message = "start"; progressListener.start(message, 10); progressListener.update(5); verify(mockProgressIndicator) .setText(CloudSdkMessageBundle.message("managedsdk.progress.message", message)); verify(mockProgressIndicator).setFraction(0.5); }
/** Creates managed SDK, installs if necessary, and checks for fatal errors. */ @VisibleForTesting void initManagedSdk() { try { managedCloudSdk = createManagedSdk(); // do not install SDK on activation if user cancelled installation once. if (!CloudSdkServiceUserSettings.getInstance().isUserCancelledInstallation()) { install(); } } catch (UnsupportedOsException ex) { logger.warn("Unsupported OS for Managed Cloud SDK", ex); updateStatus(SdkStatus.NOT_AVAILABLE); ManagedCloudSdkServiceUiPresenter.getInstance() .notifyManagedSdkJobFailure( ManagedSdkJobType.INSTALL, CloudSdkMessageBundle.message("managedsdk.unsupported.os")); } }
new Backgroundable( CloudSdkMessageBundle.message("managedsdk.notifications.title"), true /* cancellable */, PerformInBackgroundOption.ALWAYS_BACKGROUND) {