Search in sources :

Example 1 with RepositorySourceProvider

use of com.android.repository.api.RepositorySourceProvider in project android by JetBrains.

the class SourcesTableModel method showEditDialog.

/**
   * Creates a dialog for adding or editing a source.
   *
   * @param source The source to edit, or {@code null} if we're creating a new source.
   */
@NotNull
private EditSourceDialog showEditDialog(@Nullable RepositorySource source) {
    RepositorySourceProvider userSourceProvider = getUserSourceProvider();
    // we know it won't be null since otherwise we shouldn't have been editable
    assert userSourceProvider != null;
    EditSourceDialog input = new EditSourceDialog(userSourceProvider, source);
    input.show();
    return input;
}
Also used : RepositorySourceProvider(com.android.repository.api.RepositorySourceProvider) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with RepositorySourceProvider

use of com.android.repository.api.RepositorySourceProvider in project android by JetBrains.

the class SourcesTableModel method removeRow.

/**
   * Removes the source at the specified row index.
   */
@Override
public void removeRow(int idx) {
    RepositorySourceProvider userSourceProvider = getUserSourceProvider();
    // we know it won't be null since otherwise we shouldn't have been editable
    assert userSourceProvider != null;
    userSourceProvider.removeSource(getRowValue(idx).mySource);
    refreshUi();
}
Also used : RepositorySourceProvider(com.android.repository.api.RepositorySourceProvider)

Example 3 with RepositorySourceProvider

use of com.android.repository.api.RepositorySourceProvider in project android by JetBrains.

the class AndroidSdkUpdaterPlugin method initComponent.

@Override
public void initComponent() {
    if (isAndroidSdkManagerEnabled()) {
        ExternalComponentManager.getInstance().registerComponentSource(new SdkComponentSource());
        URL offlineRepo = getOfflineRepoDir();
        if (offlineRepo != null) {
            // We don't have an actual RepoManager yet, so just get all the modules statically.
            RepositorySourceProvider provider = new ConstantSourceProvider(offlineRepo.toString(), "Offline Repo", AndroidSdkHandler.getAllModules());
            AndroidSdkHandler.addCustomSourceProvider(provider, new StudioLoggerProgressIndicator(getClass()));
        }
    }
}
Also used : StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) ConstantSourceProvider(com.android.repository.api.ConstantSourceProvider) RepositorySourceProvider(com.android.repository.api.RepositorySourceProvider) URL(java.net.URL)

Example 4 with RepositorySourceProvider

use of com.android.repository.api.RepositorySourceProvider in project android by JetBrains.

the class SourcesTableModel method save.

/**
   * Save any changes the user has made.
   */
public void save(@NotNull ProgressIndicator progress) {
    if (isSourcesModified()) {
        RepositorySourceProvider userSourceProvider = getUserSourceProvider();
        // we know it won't be null since otherwise we shouldn't have been editable
        assert userSourceProvider != null;
        userSourceProvider.save(new RepoProgressIndicatorAdapter(progress));
        reset();
    }
}
Also used : RepoProgressIndicatorAdapter(com.android.tools.idea.sdk.progress.RepoProgressIndicatorAdapter) RepositorySourceProvider(com.android.repository.api.RepositorySourceProvider)

Example 5 with RepositorySourceProvider

use of com.android.repository.api.RepositorySourceProvider in project android by JetBrains.

the class SourcesTableModel method createSource.

/**
   * Creates a new source with the given URL and display name.
   */
private void createSource(@NotNull String url, @Nullable String uiName) {
    RepositorySourceProvider userSourceProvider = getUserSourceProvider();
    // we know it won't be null since otherwise we shouldn't have been editable
    assert userSourceProvider != null;
    // TODO: we shouldn't have to specify the allowed sources here, since they're already specified in the provider.
    RepositorySource newSource = new SimpleRepositorySource(url, uiName, true, ImmutableList.of(AndroidSdkHandler.getAddonModule(), AndroidSdkHandler.getSysImgModule(), RepoManager.getCommonModule()), userSourceProvider);
    userSourceProvider.addSource(newSource);
    refreshUi();
}
Also used : SimpleRepositorySource(com.android.repository.api.SimpleRepositorySource) RepositorySource(com.android.repository.api.RepositorySource) RepositorySourceProvider(com.android.repository.api.RepositorySourceProvider) SimpleRepositorySource(com.android.repository.api.SimpleRepositorySource)

Aggregations

RepositorySourceProvider (com.android.repository.api.RepositorySourceProvider)5 ConstantSourceProvider (com.android.repository.api.ConstantSourceProvider)1 RepositorySource (com.android.repository.api.RepositorySource)1 SimpleRepositorySource (com.android.repository.api.SimpleRepositorySource)1 RepoProgressIndicatorAdapter (com.android.tools.idea.sdk.progress.RepoProgressIndicatorAdapter)1 StudioLoggerProgressIndicator (com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator)1 URL (java.net.URL)1 NotNull (org.jetbrains.annotations.NotNull)1