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;
}
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();
}
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()));
}
}
}
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();
}
}
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();
}
Aggregations