Skip to content
Snippets Groups Projects
Commit 3e3efae1 authored by tobias's avatar tobias
Browse files

Update ErrorDialog (not working hier, but in dev-6-0/media-folder)

parent 2fb491db
Branches
Tags
No related merge requests found
......@@ -127,7 +127,7 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro
showLiveInfo(false);
helpMenu.getItems().add(new HelpMenuItem(helpMenu));
// helpMenu.getItems().add(new HelpMenuItem(helpMenu)); BETA
}
private void initLayoutMenu() {
......
......@@ -34,7 +34,6 @@ import javafx.beans.value.ChangeListener;
import javafx.scene.media.AudioEqualizer;
import javafx.util.Duration;
// TODO Extract Fade in / Fade Out
public class AudioContent extends PadContent implements Pauseable, Durationable, Fadeable, Equalizable, SinglePathContent {
private static final String TYPE = "audio";
......
......@@ -26,7 +26,7 @@ public class HelpMenuItem extends CustomMenuItem implements ChangeListener<Strin
setHideOnClick(false);
Label label = new Label("Suchen nach (Beta): "); // TODO BETA i18n
Label label = new Label("Suchen nach (Beta): "); // BETA i18n
TextField textfield = new TextField();
textfield.textProperty().addListener(this);
......
package de.tobias.playpad.viewcontroller.cell.errordialog;
import java.nio.file.Files;
import java.nio.file.Path;
import de.tobias.playpad.PlayPadPlugin;
import de.tobias.playpad.pad.Pad;
import de.tobias.playpad.pad.PadException;
import de.tobias.playpad.pad.conntent.PadContent;
import de.tobias.playpad.pad.conntent.PadContentConnect;
import de.tobias.playpad.registry.NoSuchComponentException;
import de.tobias.playpad.view.ExceptionButton;
import de.tobias.utils.util.FileUtils;
import javafx.scene.control.Button;
import javafx.scene.control.Control;
import javafx.scene.control.TableCell;
......@@ -38,33 +31,7 @@ public class FixCell extends TableCell<PadException, PadException> {
case FILE_NOT_FOUND:
ExceptionButton<Path> notExistsExButton = ExceptionButton.FILE_NOT_FOUND_EXCEPTION;
Button notExistsButton = notExistsExButton.getButton();
notExistsButton.setOnAction(a ->
{
Path path = notExistsExButton.getHandler().handle(item.getPad(), stage);
if (path != null) {
Pad pad = item.getPad();
PadContent content = item.getPad().getContent();
try {
PadContentConnect padContentConnect = PlayPadPlugin.getRegistryCollection().getPadContents()
.getComponent(content.getType());
if (Files.exists(path) && PadContentConnect.isFileSupported(path, padContentConnect)) {
try {
content.handlePath(path);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
pad.setName(FileUtils.getFilenameWithoutExtention(path.getFileName()));
pad.removeException(item);
}
} catch (NoSuchComponentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
notExistsButton.setOnAction(new IOExceptionButtonListener(item, stage, notExistsExButton));
vbox.getChildren().add(notExistsButton);
break;
......@@ -72,33 +39,7 @@ public class FixCell extends TableCell<PadException, PadException> {
case CONVERT_NOT_SUPPORTED:
ExceptionButton<Path> supportExButton = ExceptionButton.FILE_NOT_FOUND_EXCEPTION;
Button supportButton = supportExButton.getButton();
supportButton.setOnAction(a ->
{
Path path = supportExButton.getHandler().handle(item.getPad(), stage);
if (path != null) {
Pad pad = item.getPad();
PadContent content = item.getPad().getContent();
try {
PadContentConnect padContentConnect = PlayPadPlugin.getRegistryCollection().getPadContents()
.getComponent(content.getType());
if (Files.exists(path) && PadContentConnect.isFileSupported(path, padContentConnect)) {
try {
content.handlePath(path);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
pad.setName(FileUtils.getFilenameWithoutExtention(path.getFileName()));
pad.removeException(item);
}
} catch (NoSuchComponentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
supportButton.setOnAction(new IOExceptionButtonListener(item, stage, supportExButton));
vbox.getChildren().add(supportButton);
break;
......
package de.tobias.playpad.viewcontroller.cell.errordialog;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import de.tobias.playpad.PlayPadPlugin;
import de.tobias.playpad.pad.Pad;
import de.tobias.playpad.pad.PadContentRegistry;
import de.tobias.playpad.pad.PadException;
import de.tobias.playpad.pad.conntent.PadContent;
import de.tobias.playpad.pad.conntent.PadContentConnect;
import de.tobias.playpad.registry.NoSuchComponentException;
import de.tobias.playpad.view.ExceptionButton;
import de.tobias.utils.util.FileUtils;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.stage.Stage;
public class IOExceptionButtonListener implements EventHandler<ActionEvent> {
private PadException item;
private Stage stage;
private ExceptionButton<Path> exButton;
public IOExceptionButtonListener(PadException item, Stage stage, ExceptionButton<Path> notExistsExButton) {
this.item = item;
this.stage = stage;
this.exButton = notExistsExButton;
}
@Override
public void handle(ActionEvent a) {
Path path = exButton.getHandler().handle(item.getPad(), stage);
if (path != null) {
Pad pad = item.getPad();
PadContent content = item.getPad().getContent();
try {
PadContentRegistry padContents = PlayPadPlugin.getRegistryCollection().getPadContents();
PadContentConnect padContentConnect = padContents.getComponent(content.getType());
if (Files.exists(path) && PadContentConnect.isFileSupported(path, padContentConnect)) {
content.handlePath(path);
pad.setName(FileUtils.getFilenameWithoutExtention(path.getFileName()));
pad.removeException(item);
}
} catch (NoSuchComponentException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment