Search in sources :

Example 1 with GlobalStorageStatus

use of org.sonarsource.sonarlint.core.client.api.connected.GlobalStorageStatus in project sonarlint-core by SonarSource.

the class ConnectedContainer method updateModule.

public void updateModule(String moduleKey, ProgressWrapper progress) {
    GlobalStorageStatus updateStatus = getComponentByType(StorageReader.class).getGlobalStorageStatus();
    if (updateStatus == null) {
        throw new GlobalUpdateRequiredException("Please update server first");
    }
    getComponentByType(ModuleStorageUpdateExecutor.class).update(moduleKey, progress);
}
Also used : StorageReader(org.sonarsource.sonarlint.core.container.storage.StorageReader) GlobalUpdateRequiredException(org.sonarsource.sonarlint.core.client.api.exceptions.GlobalUpdateRequiredException) ModuleStorageUpdateExecutor(org.sonarsource.sonarlint.core.container.connected.update.perform.ModuleStorageUpdateExecutor) GlobalStorageStatus(org.sonarsource.sonarlint.core.client.api.connected.GlobalStorageStatus)

Example 2 with GlobalStorageStatus

use of org.sonarsource.sonarlint.core.client.api.connected.GlobalStorageStatus in project sonarlint-core by SonarSource.

the class StorageContainer method doAfterStart.

@Override
protected void doAfterStart() {
    ConnectedGlobalConfiguration config = getComponentByType(ConnectedGlobalConfiguration.class);
    GlobalStorageStatus updateStatus = getComponentByType(StorageContainerHandler.class).getGlobalStorageStatus();
    if (updateStatus != null) {
        LOG.info("Using storage for server '{}' (last update {})", config.getServerId(), DATE_FORMAT.format(updateStatus.getLastUpdateDate()));
        installPlugins();
    } else {
        LOG.warn("No storage for server '{}'. Please update.", config.getServerId());
    }
    this.globalExtensionContainer = new GlobalExtensionContainer(this);
    globalExtensionContainer.startComponents();
}
Also used : GlobalExtensionContainer(org.sonarsource.sonarlint.core.container.global.GlobalExtensionContainer) GlobalStorageStatus(org.sonarsource.sonarlint.core.client.api.connected.GlobalStorageStatus) ConnectedGlobalConfiguration(org.sonarsource.sonarlint.core.client.api.connected.ConnectedGlobalConfiguration)

Example 3 with GlobalStorageStatus

use of org.sonarsource.sonarlint.core.client.api.connected.GlobalStorageStatus in project sonarlint-intellij by SonarSource.

the class SonarQubeServerMgmtPanel method setStatus.

private void setStatus(ConnectedSonarLintEngine.State state) {
    ConnectedSonarLintEngine.State currentState = engine.getState();
    StringBuilder builder = new StringBuilder();
    switch(currentState) {
        case NEVER_UPDATED:
            builder.append("never updated");
            break;
        case UPDATED:
            GlobalStorageStatus storageStatus = engine.getGlobalStorageStatus();
            if (storageStatus != null) {
                builder.append(DateUtils.toAge(storageStatus.getLastUpdateDate().getTime()));
            } else {
                builder.append("up to date");
            }
            break;
        case UPDATING:
            builder.append("updating..");
            break;
        case NEED_UPDATE:
            builder.append("needs update");
            break;
        case UNKNOW:
        default:
            builder.append("unknown");
            break;
    }
    serverStatus.setText(builder.toString());
    updateServerButton.setEnabled(state != ConnectedSonarLintEngine.State.UPDATING);
}
Also used : GlobalStorageStatus(org.sonarsource.sonarlint.core.client.api.connected.GlobalStorageStatus) ConnectedSonarLintEngine(org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine)

Aggregations

GlobalStorageStatus (org.sonarsource.sonarlint.core.client.api.connected.GlobalStorageStatus)3 ConnectedGlobalConfiguration (org.sonarsource.sonarlint.core.client.api.connected.ConnectedGlobalConfiguration)1 ConnectedSonarLintEngine (org.sonarsource.sonarlint.core.client.api.connected.ConnectedSonarLintEngine)1 GlobalUpdateRequiredException (org.sonarsource.sonarlint.core.client.api.exceptions.GlobalUpdateRequiredException)1 ModuleStorageUpdateExecutor (org.sonarsource.sonarlint.core.container.connected.update.perform.ModuleStorageUpdateExecutor)1 GlobalExtensionContainer (org.sonarsource.sonarlint.core.container.global.GlobalExtensionContainer)1 StorageReader (org.sonarsource.sonarlint.core.container.storage.StorageReader)1