Skip to content
Snippets Groups Projects
Commit 184ecb82 authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Fixed duplicate naming bug, rename property in ProjectReference

parent 58ac8664
No related branches found
No related tags found
No related merge requests found
......@@ -29,17 +29,6 @@ public class DuplicateProjectDialog extends TextInputDialog {
Stage dialog = (Stage) getDialogPane().getScene().getWindow();
PlayPadMain.stageIcon.ifPresent(dialog.getIcons()::add);
setResultConverter(button ->
{
String param = getEditor().getText();
if (!param.endsWith(PlayPadMain.projectType.substring(1))) {
param += PlayPadMain.projectType.substring(1);
}
ButtonData data = button == null ? null : button.getButtonData();
return data == ButtonData.OK_DONE ? param : null;
});
Button button = (Button) getDialogPane().lookupButton(ButtonType.OK);
getEditor().textProperty().addListener((a, b, c) ->
{
......
......@@ -19,7 +19,6 @@ import de.tobias.playpad.project.ref.ProjectReferences;
import de.tobias.playpad.settings.Profile;
import de.tobias.playpad.viewcontroller.cell.ProjectCell;
import de.tobias.utils.ui.NotificationHandler;
import de.tobias.utils.ui.ViewController;
import de.tobias.utils.ui.scene.NotificationPane;
import de.tobias.utils.util.Localization;
import de.tobias.utils.util.TimeUtils;
......@@ -115,7 +114,7 @@ public class ProjectManagerDialog extends NVC implements NotificationHandler {
try {
ProfileReference profileRef = ref.getProfileReference();
profileLabel.setText(profileRef.getName());
dateLabel.setText(TimeUtils.getDfmLong().format(ref.getLastMofied()));
dateLabel.setText(TimeUtils.getDfmLong().format(ref.getLastModified()));
} catch (Exception e) {
profileLabel.setText("-");
dateLabel.setText("-");
......@@ -235,6 +234,7 @@ public class ProjectManagerDialog extends NVC implements NotificationHandler {
if (getSelecteItem() != null) {
DuplicateProjectDialog dialog = new DuplicateProjectDialog(this, getSelectedProject());
dialog.getName().ifPresent(ref ->
{
projectList.getItems().add(ref);
......
......@@ -19,21 +19,18 @@ import javafx.beans.property.StringProperty;
public class ProjectReference implements Displayable {
/**
* Name + XML
*/
private UUID uuid;
private String name;
private ProfileReference profileReference;
private Set<Module> requestedModules;
private long lastMofied;
private long lastModified;
public ProjectReference(UUID uuid, String name, ProfileReference profileReference) {
this.uuid = uuid;
this.name = name;
this.lastMofied = System.currentTimeMillis();
this.lastModified = System.currentTimeMillis();
this.profileReference = profileReference;
requestedModules = new HashSet<>();
......@@ -43,27 +40,27 @@ public class ProjectReference implements Displayable {
public ProjectReference(UUID uuid, String name, ProfileReference profileReference, Set<Module> modules) {
this.uuid = uuid;
this.name = name;
this.lastMofied = System.currentTimeMillis();
this.lastModified = System.currentTimeMillis();
this.profileReference = profileReference;
requestedModules = modules;
updateDisplayProperty();
}
public ProjectReference(UUID uuid, String name, long lastMofied, ProfileReference profileReference) {
public ProjectReference(UUID uuid, String name, long lastModified, ProfileReference profileReference) {
this.uuid = uuid;
this.name = name;
this.lastMofied = lastMofied;
this.lastModified = lastModified;
this.profileReference = profileReference;
requestedModules = new HashSet<>();
updateDisplayProperty();
}
public ProjectReference(UUID uuid, String name, long lastMofied, ProfileReference profileReference, Set<Module> requestedModules) {
public ProjectReference(UUID uuid, String name, long lastModified, ProfileReference profileReference, Set<Module> requestedModules) {
this.uuid = uuid;
this.name = name;
this.lastMofied = lastMofied;
this.lastModified = lastModified;
this.profileReference = profileReference;
this.requestedModules = requestedModules;
......@@ -78,12 +75,12 @@ public class ProjectReference implements Displayable {
return name;
}
public void setLastMofied(long lastMofied) {
this.lastMofied = lastMofied;
public void setLastModified(long lastModified) {
this.lastModified = lastModified;
}
public long getLastMofied() {
return lastMofied;
public long getLastModified() {
return lastModified;
}
public void setName(String name) {
......
......@@ -41,7 +41,7 @@ public class ProjectReferenceSerializer implements XMLDeserializer<ProjectRefere
Path projectPath = ApplicationUtils.getApplication().getPath(PathType.DOCUMENTS, ref.getFileName());
if (Files.exists(projectPath)) {
try {
ref.setLastMofied(Files.getLastModifiedTime(projectPath).toMillis());
ref.setLastModified(Files.getLastModifiedTime(projectPath).toMillis());
} catch (IOException e) {
e.printStackTrace();
}
......
......@@ -115,7 +115,7 @@ public final class ProjectReferences {
List<ProjectReference> items = new ArrayList<>();
projects.forEach(item -> items.add(item));
items.sort((o1, o2) -> Long.compare(o2.getLastMofied(), o1.getLastMofied()));
items.sort((o1, o2) -> Long.compare(o2.getLastModified(), o1.getLastModified()));
return items;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment