private void addGObject(final GObject newThing, ComponentSettings componentSettings, final View view, final ViewListeners viewListeners, Node settingsNode, int x, int y, final Pane destination) {

        //Sets the default settings on the gObject and creates the property edit pane
        final PropertyEditPane propertyEditPane = new PropertyEditPane(newThing, componentSettings, fieldNames, view.middleTabPane.viewPane, settingsNode, historyManager);

        newThing.setPEP(propertyEditPane);

        if (componentSettings.getLayoutType().equals("anchorpane")) {
            dealWithPane((Pane) newThing);
        }

        final Node newNode = (Node) newThing;

        newNode.layoutBoundsProperty().addListener(new ChangeListener<Bounds>() {
            @Override
            public void changed(ObservableValue<? extends Bounds> ov, Bounds t, Bounds t1) {
                selectionManager.updateSelected((GObject) newNode);
            }
        });

        newNode.layoutXProperty().addListener(new ChangeListener<Number>() {
            @Override
            public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
                selectionManager.updateSelected((GObject) newNode);
            }
        });

        newNode.layoutYProperty().addListener(new ChangeListener<Number>() {
            @Override
            public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
                selectionManager.updateSelected((GObject) newNode);
            }
        });

        newNode.setOnMousePressed(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent mouseEvent) {
                selectionManager.updateSelected((GObject) newNode);
                viewListeners.onMousePressed(newNode, mouseEvent);
                mouseEvent.consume();//Stops the mouseEvent falling through to the viewPane which would clear selection
            }
        });
        newNode.setOnMouseReleased(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent mouseEvent) {
                viewListeners.onMouseReleased(newNode, mouseEvent);
            }
        });
        newNode.setOnMouseDragged(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent mouseEvent) {
                viewListeners.onMouseDragged(newNode, mouseEvent);
                selectionManager.updateSelected((GObject) newNode);
            }
        });


        final ContextMenu nodePopUp = new ContextMenu();
        final MenuItem deletebutton = new MenuItem(LabelGrabber.getLabel("delete.node.text"));
        nodePopUp.getItems().add(deletebutton);
        newNode.addEventFilter(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent t) {
                if (t.getButton().equals(MouseButton.SECONDARY)) {
                    nodePopUp.show(newNode, Side.RIGHT, 0, 0);
                    deletebutton.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent t) {
                            destination.getChildren().remove(newNode);
                            selectionManager.clearSelection();
                            historyManager.addHistory(new HistoryItem() {
                                @Override
                                public void revert() {
                                    destination.getChildren().add(newNode);
                                    selectionManager.updateSelected((GObject) newNode);
                                }

                                @Override
                                public void restore() {
                                    destination.getChildren().remove(newNode);
                                    selectionManager.clearSelection();
                                }

                                @Override
                                public String getAppearance() {
                                    return ((GObject) newNode).getFieldName() + " deleted!";
                                }
                            });
                        }
                    });
                }
            }
        });

        destination.getChildren().add(newNode);

        if (settingsNode == null) {
            if (newNode instanceof Circle) {
                newNode.setLayoutX((newNode.getLayoutBounds().getWidth() / 2) + 4);
                newNode.setLayoutY((newNode.getLayoutBounds().getWidth() / 2) + 4);
            } else {
                newNode.setLayoutX(newNode.getLayoutX() + 4);
                newNode.setLayoutY(newNode.getLayoutY() + 4);
            }
        }

        if (x > 0 && y > 0) {
            newNode.setLayoutX(x);
            newNode.setLayoutY(y);
        }

        // Finally, let the history manager know this new thing has happened.
        historyManager.addHistory(new HistoryItem() {
            @Override
            public void restore() {
                destination.getChildren().add(newNode);
                selectionManager.updateSelected(newThing);
            }

            @Override
            public void revert() {
                destination.getChildren().remove(newThing);
                selectionManager.clearSelection();
            }

            @Override
            public String getAppearance() {
                return newThing.getClass().getSuperclass().getSimpleName() + " added!";
            }
        });
    }