public void combineElements(int key1, int key2) {
		Element element1 = elements.get(key1);
		Element element2 = elements.get(key2);

		if (element1 == null) {
			throw new IllegalArgumentException(
					"Unable to find element with key: " + key1);
		}

		if (element2 == null) {
			throw new IllegalArgumentException(
					"Unable to find element with key: " + key2);
		}

		if (element1.isInSet1() != element2.isInSet1()) {
			throw new IllegalArgumentException(
					"Cannot combine elements from different sets");
		}

		UndoableEdit edit = new CombineEdit(element1, element2);

		element1.setText(element1.getText() + element2.getText());

		// Uklanja se element2 i sve njegove veze
		for (Integer destination : element2.getConnections()) {
			elements.get(destination).removeConnection(key2);
		}

		if (element2.isInSet1()) {
			keys1.remove(Integer.valueOf(key2));
		} else {
			keys2.remove(Integer.valueOf(key2));
		}

		elements.remove(key2);

		if (element1.isInSet1()) {
			firePropertyChange(ELEMENTS_COMBINED_IN_SET1, key2, key1);
		} else {
			firePropertyChange(ELEMENTS_COMBINED_IN_SET2, key2, key1);
		}
		postEdit(edit);
	}