use of org.phoenicis.javafx.dialogs.ErrorDialog in project POL-POM-5 by PlayOnLinux.
the class ContainersFeaturePanel method deleteContainer.
/**
* Deletes a given container
*
* @param container The container
*/
public void deleteContainer(final ContainerDTO container) {
final SimpleConfirmDialog confirmMessage = SimpleConfirmDialog.builder().withTitle(tr("Delete {0} container", container.getName())).withMessage(tr("Are you sure you want to delete the {0} container?", container.getName())).withOwner(getScene().getWindow()).withYesCallback(() -> {
getContainersManager().deleteContainer(container, unused -> Platform.runLater(() -> setSelectedContainer(null)), e -> Platform.runLater(() -> {
final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("Error")).withException(e).withOwner(getScene().getWindow()).build();
errorDialog.showAndWait();
}));
getContainersManager().fetchContainers(containerCategories -> Platform.runLater(() -> categories.setAll(containerCategories)), e -> Platform.runLater(() -> {
final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("Loading containers failed.")).withException(e).withOwner(getScene().getWindow()).build();
errorDialog.showAndWait();
}));
}).build();
confirmMessage.showAndCallback();
}
use of org.phoenicis.javafx.dialogs.ErrorDialog in project POL-POM-5 by PlayOnLinux.
the class ContainersFeaturePanel method openFileBrowser.
/**
* Opens the given container in a file browser
*
* @param container The container
*/
public void openFileBrowser(final ContainerDTO container) {
try {
final File containerDir = new File(container.getPath());
EventQueue.invokeLater(() -> {
try {
Desktop.getDesktop().open(containerDir);
} catch (IOException e) {
Platform.runLater(() -> {
final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("Cannot open container {0} in file browser", container.getPath())).withException(e).withOwner(getScene().getWindow()).build();
errorDialog.showAndWait();
});
}
});
} catch (IllegalArgumentException e) {
Platform.runLater(() -> {
final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("Cannot open container {0} in file browser", container.getPath())).withException(e).withOwner(getScene().getWindow()).build();
errorDialog.showAndWait();
});
}
}
use of org.phoenicis.javafx.dialogs.ErrorDialog in project POL-POM-5 by PlayOnLinux.
the class ContainersFeaturePanel method changeEngineVersion.
/**
* Opens a dialog to change the engine version used for a given container
*
* @param container The container
*/
public void changeEngineVersion(final ContainerDTO container) {
EnginesManager enginesManager = getEnginesManager();
if (enginesManager != null) {
final String engineId = container.getEngine().toLowerCase();
enginesManager.getEngine(engineId, engine -> engine.changeVersion(container.getName()), exception -> Platform.runLater(() -> {
final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("Error during engine version change")).withException(exception).withOwner(getScene().getWindow()).build();
errorDialog.showAndWait();
}));
}
}
use of org.phoenicis.javafx.dialogs.ErrorDialog in project POL-POM-5 by PlayOnLinux.
the class LibraryFeaturePanel method uninstallShortcut.
/**
* Removes a given shortcut
*
* @param shortcut The shortcut to be removed
*/
public void uninstallShortcut(ShortcutDTO shortcut) {
final String shortcutName = shortcut.getInfo().getName();
final SimpleConfirmDialog confirmMessage = SimpleConfirmDialog.builder().withTitle(tr("Uninstall {0}", shortcutName)).withMessage(tr("Are you sure you want to uninstall {0}?", shortcutName)).withOwner(getScene().getWindow()).withResizable(true).withYesCallback(() -> getShortcutManager().uninstallFromShortcut(shortcut, e -> {
final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("Error while uninstalling {0}", shortcutName)).withException(e).withOwner(getScene().getWindow()).build();
errorDialog.showAndWait();
})).build();
confirmMessage.showAndCallback();
}
use of org.phoenicis.javafx.dialogs.ErrorDialog in project POL-POM-5 by PlayOnLinux.
the class EnginesController method fetchEngineSubcategories.
/**
* Fetches all engine subcategories that belong to a given list of engine categories
*
* @param engineCategories The engine categories
* @param result The temporary transport variable
* @param callback A callback method, which is called after all engine subcategories have been fetched
*/
private void fetchEngineSubcategories(Queue<EngineCategoryDTO> engineCategories, Map<EngineCategoryDTO, List<EngineSubCategoryDTO>> result, Consumer<Map<EngineCategoryDTO, List<EngineSubCategoryDTO>>> callback) {
final Queue<EngineCategoryDTO> queue = new ArrayDeque<>(engineCategories);
if (queue.isEmpty()) {
// recursion anchor
callback.accept(result);
} else {
final EngineCategoryDTO engineCategory = queue.poll();
final String engineId = engineCategory.getName().toLowerCase();
enginesManager.fetchAvailableVersions(engineId, versions -> {
// recursively process the remaining engine categories
fetchEngineSubcategories(queue, ImmutableMap.<EngineCategoryDTO, List<EngineSubCategoryDTO>>builder().putAll(result).put(engineCategory, versions).build(), callback);
}, e -> Platform.runLater(() -> {
final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("Error")).withException(e).withOwner(this.enginesView.getContent().getScene().getWindow()).build();
errorDialog.showAndWait();
}));
}
}
Aggregations