本文整理汇总了Java中com.intellij.util.CatchingConsumer类的典型用法代码示例。如果您正苦于以下问题:Java CatchingConsumer类的具体用法?Java CatchingConsumer怎么用?Java CatchingConsumer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CatchingConsumer类属于com.intellij.util包,在下文中一共展示了CatchingConsumer类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fetchPackageDetails
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
public static void fetchPackageDetails(@NotNull final String packageName, @NotNull final CatchingConsumer<String, Exception> consumer) {
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
try {
final String details = loadPackageDetails(packageName);
consumer.consume(formatDetails(packageName, details));
}
catch (ExecutionException e) {
consumer.consume(e);
}
}
});
}
示例2: valueChanged
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
@Override
public void valueChanged(ListSelectionEvent event) {
myOptionsCheckBox.setEnabled(myPackages.getSelectedIndex() >= 0);
myVersionCheckBox.setEnabled(myPackages.getSelectedIndex() >= 0);
myOptionsCheckBox.setSelected(false);
myVersionCheckBox.setSelected(false);
myVersionComboBox.setEnabled(false);
myOptionsField.setEnabled(false);
myDescriptionTextArea.setText("<html><body style='text-align: center;padding-top:20px;'>Loading...</body></html>");
final Object pyPackage = myPackages.getSelectedValue();
if (pyPackage instanceof RepoPackage) {
final String packageName = ((RepoPackage)pyPackage).getName();
mySelectedPackageName = packageName;
myVersionComboBox.removeAllItems();
if (myVersionCheckBox.isEnabled()) {
myController.fetchPackageVersions(packageName, new CatchingConsumer<List<String>, Exception>() {
@Override
public void consume(final List<String> releases) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (myPackages.getSelectedValue() == pyPackage) {
myVersionComboBox.removeAllItems();
for (String release : releases) {
myVersionComboBox.addItem(release);
}
}
}
}, ModalityState.any());
}
@Override
public void consume(Exception e) {
LOG.info("Error retrieving releases", e);
}
});
}
myInstallButton.setEnabled(!myCurrentlyInstalling.contains(packageName));
myController.fetchPackageDetails(packageName, new CatchingConsumer<String, Exception>() {
@Override
public void consume(final String details) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (myPackages.getSelectedValue() == pyPackage) {
myDescriptionTextArea.setText(details);
myDescriptionTextArea.setCaretPosition(0);
}/* else {
do nothing, because other package gets selected
}*/
}
});
}
@Override
public void consume(Exception exception) {
myDescriptionTextArea.setText("No information available");
LOG.info("Error retrieving package details", exception);
}
});
}
else {
myInstallButton.setEnabled(false);
myDescriptionTextArea.setText("");
}
}
示例3: setLatestVersionsForInstalledPackages
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
private void setLatestVersionsForInstalledPackages() {
final PackageManagementServiceEx serviceEx = getServiceEx();
if (serviceEx == null) {
return;
}
int packageCount = myPackagesTableModel.getRowCount();
if (packageCount == 0) {
onUpdateFinished();
}
final AtomicInteger inProgressPackageCount = new AtomicInteger(packageCount);
for (int i = 0; i < packageCount; ++i) {
final int finalIndex = i;
final InstalledPackage pkg = getInstalledPackageAt(finalIndex);
serviceEx.fetchLatestVersion(pkg, new CatchingConsumer<String, Exception>() {
private void decrement() {
if (inProgressPackageCount.decrementAndGet() == 0) {
onUpdateFinished();
}
}
@Override
public void consume(Exception e) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
decrement();
}
});
}
@Override
public void consume(@Nullable final String latestVersion) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (finalIndex < myPackagesTableModel.getRowCount()) {
InstalledPackage p = getInstalledPackageAt(finalIndex);
if (pkg == p) {
myPackagesTableModel.setValueAt(latestVersion, finalIndex, 2);
}
}
decrement();
}
});
}
});
}
}
示例4: fetchPackageVersions
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
@Override
public void fetchPackageVersions(String packageName, CatchingConsumer<List<String>, Exception> consumer) {
final List<String> versions = PyCondaPackageService.getInstance().getPackageVersions(packageName);
Collections.sort(versions, Collections.reverseOrder(new PackageVersionComparator()));
consumer.consume(versions);
}
示例5: fetchPackageVersions
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
@Override
public void fetchPackageVersions(String s, CatchingConsumer<List<String>, Exception> consumer) {
consumer.consume(ContainerUtil.<String>emptyList());
}
示例6: fetchPackageDetails
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
@Override
public void fetchPackageDetails(String packageName, CatchingConsumer<String, Exception> consumer) {
TheRPackagesUtil.fetchPackageDetails(packageName, consumer);
}
示例7: valueChanged
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
@Override
public void valueChanged(ListSelectionEvent event) {
myOptionsCheckBox.setEnabled(myPackages.getSelectedIndex() >= 0);
myVersionCheckBox.setEnabled(myPackages.getSelectedIndex() >= 0);
myOptionsCheckBox.setSelected(false);
myVersionCheckBox.setSelected(false);
myVersionComboBox.setEnabled(false);
myOptionsField.setEnabled(false);
myDescriptionTextArea.setText("<html><body style='text-align: center;padding-top:20px;'>Loading...</body></html>");
final Object pyPackage = myPackages.getSelectedValue();
if (pyPackage instanceof RepoPackage) {
final String packageName = ((RepoPackage)pyPackage).getName();
mySelectedPackageName = packageName;
myVersionComboBox.removeAllItems();
if (myVersionCheckBox.isEnabled()) {
myController.fetchPackageVersions(packageName, new CatchingConsumer<List<String>, Exception>() {
@Override
public void consume(final List<String> releases) {
ApplicationManager.getApplication().invokeLater(() -> {
if (myPackages.getSelectedValue() == pyPackage) {
myVersionComboBox.removeAllItems();
for (String release : releases) {
myVersionComboBox.addItem(release);
}
}
}, ModalityState.any());
}
@Override
public void consume(Exception e) {
LOG.info("Error retrieving releases", e);
}
});
}
myInstallButton.setEnabled(!myCurrentlyInstalling.contains(packageName));
myController.fetchPackageDetails(packageName, new CatchingConsumer<String, Exception>() {
@Override
public void consume(final String details) {
UIUtil.invokeLaterIfNeeded(() -> {
if (myPackages.getSelectedValue() == pyPackage) {
myDescriptionTextArea.setText(details);
myDescriptionTextArea.setCaretPosition(0);
}/* else {
do nothing, because other package gets selected
}*/
});
}
@Override
public void consume(Exception exception) {
UIUtil.invokeLaterIfNeeded(() -> myDescriptionTextArea.setText("No information available"));
LOG.info("Error retrieving package details", exception);
}
});
}
else {
myInstallButton.setEnabled(false);
myDescriptionTextArea.setText("");
}
}
示例8: setLatestVersionsForInstalledPackages
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
private void setLatestVersionsForInstalledPackages() {
final PackageManagementServiceEx serviceEx = getServiceEx();
if (serviceEx == null) {
return;
}
int packageCount = myPackagesTableModel.getRowCount();
if (packageCount == 0) {
onUpdateFinished();
}
final AtomicInteger inProgressPackageCount = new AtomicInteger(packageCount);
for (int i = 0; i < packageCount; ++i) {
final int finalIndex = i;
final InstalledPackage pkg = getInstalledPackageAt(finalIndex);
serviceEx.fetchLatestVersion(pkg, new CatchingConsumer<String, Exception>() {
private void decrement() {
if (inProgressPackageCount.decrementAndGet() == 0) {
onUpdateFinished();
}
}
@Override
public void consume(Exception e) {
UIUtil.invokeLaterIfNeeded(() -> decrement());
}
@Override
public void consume(@Nullable final String latestVersion) {
UIUtil.invokeLaterIfNeeded(() -> {
if (finalIndex < myPackagesTableModel.getRowCount()) {
InstalledPackage p = getInstalledPackageAt(finalIndex);
if (pkg == p) {
myPackagesTableModel.setValueAt(latestVersion, finalIndex, 2);
}
}
decrement();
});
}
});
}
}
示例9: fetchPackageVersions
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
public abstract void fetchPackageVersions(String packageName, CatchingConsumer<List<String>, Exception> consumer);
示例10: fetchPackageDetails
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
public abstract void fetchPackageDetails(String packageName, CatchingConsumer<String, Exception> consumer);
示例11: fetchLatestVersion
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
public abstract void fetchLatestVersion(@NotNull InstalledPackage pkg, @NotNull final CatchingConsumer<String, Exception> consumer);
示例12: fetchLatestVersion
import com.intellij.util.CatchingConsumer; //导入依赖的package包/类
public abstract void fetchLatestVersion(@Nonnull InstalledPackage pkg, @Nonnull final CatchingConsumer<String, Exception> consumer);