Skip to content

Commit

Permalink
Merge pull request #634 from sp-apertus/develop
Browse files Browse the repository at this point in the history
check wether ID is unique when adding new placements, throw error if not unique
  • Loading branch information
vonnieda committed Sep 1, 2017
2 parents 63b567b + b4ad212 commit be1f85b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/org/openpnp/gui/JobPlacementsPanel.java
Expand Up @@ -302,7 +302,16 @@ public void actionPerformed(ActionEvent arg0) {
if (id == null) {
return;
}
// TODO: Make sure it's unique.

// Check if the new placement ID is unique
for(Placement compareplacement : boardLocation.getBoard().getPlacements()) {
if (compareplacement.getId().equals(id)) {
MessageBoxes.errorBox(getTopLevelAncestor(), "Error",
"The ID for the new placement already exists");
return;
}
}

Placement placement = new Placement(id);

placement.setPart(Configuration.get().getParts().get(0));
Expand Down

0 comments on commit be1f85b

Please sign in to comment.